Home | History | Annotate | Download | only in android
      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 'good' 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 source android/common.sh
     16 
     17 OBJ_LIST_FILE=$1
     18 
     19 # Symlink from GOOD obj to working tree.
     20 SWITCH_CMD="ln -f ${BISECT_GOOD_BUILD}/{} {}; touch {};"
     21 
     22 overall_status=0
     23 
     24 # Check that number of arguments == 1
     25 if [ $# -eq 1 ] ; then
     26   # Run symlink once per input line, ignore empty lines.
     27   # Have ${BISECT_NUM_JOBS} processes running concurrently.
     28   # Pass to "sh" to allow multiple commands to be executed.
     29   xargs -P ${BISECT_NUM_JOBS} -a ${OBJ_LIST_FILE} -r -l -I '{}' \
     30     sh -c "${SWITCH_CMD}"
     31 else
     32   echo "ERROR:"
     33   echo "Please run the binary search tool with --file_args"
     34   echo "Android has too many files to be passed as command line arguments"
     35   echo "The binary search tool will now exit..."
     36   exit 1
     37 fi
     38 overall_status=$?
     39 
     40 
     41 exit ${overall_status}
     42