1 #!/bin/bash -u 2 # 3 # Copyright 2016 Google Inc. All Rights Reserved. 4 # 5 # This script is intended to be used by binary_search_state.py, as 6 # part of the binary search triage on the Android source tree. This script 7 # symlinks a list of object files from the 'bad' build tree into the working 8 # build tree, for testing. 9 # 10 # It is highly recommended to not use --noincremental with these scripts. If the 11 # switch scripts are given non incremental sets of GOOD/BAD objects, make will 12 # not be able to do an incremental build and will take much longer to build. 13 # 14 15 16 source android/common.sh 17 18 OBJ_LIST_FILE=$1 19 20 # Symlink from BAD obj to working tree. 21 SWITCH_CMD="ln -f ${BISECT_BAD_BUILD}/{} {}; touch {};" 22 23 overall_status=0 24 25 # Check that number of arguments == 1 26 if [ $# -eq 1 ] ; then 27 # Run symlink once per input line, ignore empty lines. 28 # Have ${BISECT_NUM_JOBS} processes running concurrently. 29 # Pass to "sh" to allow multiple commands to be executed. 30 xargs -P ${BISECT_NUM_JOBS} -a ${OBJ_LIST_FILE} -r -l -I '{}' \ 31 sh -c "${SWITCH_CMD}" 32 else 33 echo "ERROR:" 34 echo "Please run the binary search tool with --file_args" 35 echo "Android has too many files to be passed as command line arguments" 36 echo "The binary search tool will now exit..." 37 exit 1 38 fi 39 overall_status=$? 40 41 42 exit ${overall_status} 43