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 16source android/common.sh 17 18OBJ_LIST_FILE=$1 19 20# Symlink from BAD obj to working tree. 21SWITCH_CMD="ln -sf ${BISECT_BAD_BUILD}/{} {}; touch {};" 22 23overall_status=0 24 25# Check that number of arguments == 1 26if [ $# -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}" 32else 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 38fi 39overall_status=$? 40 41 42exit ${overall_status} 43