diff options
author | Cassidy Burden <cburden@google.com> | 2016-07-27 13:02:57 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-28 10:48:17 -0700 |
commit | c3fd4279b4220e53d767b3407c757a31f08ad659 (patch) | |
tree | c1f9833ce7b7771eca290c5339ae4c41647454d3 | |
parent | d0c2d0dcecaa61a4a4d5e8d2612a8fbb457bad34 (diff) | |
download | toolchain-utils-c3fd4279b4220e53d767b3407c757a31f08ad659.tar.gz |
binary search tool: Add android switch scripts
Add switch scripts for android bisector. Each script hardlinks files
from GOOD/BAD cache into working tree. ln/touch are invoked via xargs
to allow easier input parsing and parallel execution.
TEST=Tested various code paths and tried with prototype bisector
Change-Id: I9f52358737e8d18486287eb9e4d30bf3e1ad13ea
Reviewed-on: https://chrome-internal-review.googlesource.com/271725
Commit-Ready: Cassidy Burden <cburden@google.com>
Tested-by: Cassidy Burden <cburden@google.com>
Reviewed-by: Caroline Tice <cmtice@google.com>
Reviewed-by: Han Shen <shenhan@google.com>
-rwxr-xr-x | binary_search_tool/android/switch_to_bad.sh | 42 | ||||
-rwxr-xr-x | binary_search_tool/android/switch_to_good.sh | 41 |
2 files changed, 83 insertions, 0 deletions
diff --git a/binary_search_tool/android/switch_to_bad.sh b/binary_search_tool/android/switch_to_bad.sh new file mode 100755 index 00000000..7bb55dbf --- /dev/null +++ b/binary_search_tool/android/switch_to_bad.sh @@ -0,0 +1,42 @@ +#!/bin/bash -u +# +# Copyright 2016 Google Inc. All Rights Reserved. +# +# This script is intended to be used by binary_search_state.py, as +# part of the binary search triage on the Android source tree. This script +# symlinks a list of object files from the 'bad' build tree into the working +# build tree, for testing. +# +# It is highly recommended to not use --noincremental with these scripts. If the +# switch scripts are given non incremental sets of GOOD/BAD objects, make will +# not be able to do an incremental build and will take much longer to build. +# + + +source android/common.sh + +OBJ_LIST_FILE=$1 + +# Symlink from BAD obj to working tree. +SWITCH_CMD="ln -f ${BISECT_BAD_BUILD}/{} ${BISECT_WORK_BUILD}/{}; touch ${BISECT_WORK_BUILD}/{};" + +overall_status=0 + +# Check that number of arguments == 1 +if [ $# -eq 1 ] ; then + # Run symlink once per input line, ignore empty lines. + # Have ${BISECT_NUM_JOBS} processes running concurrently. + # Pass to "sh" to allow multiple commands to be executed. + xargs -P ${BISECT_NUM_JOBS} -a ${OBJ_LIST_FILE} -r -l -I '{}' \ + sh -c "${SWITCH_CMD}" +else + echo "ERROR:" + echo "Please run the binary search tool with --file_args" + echo "Android has too many files to be passed as command line arguments" + echo "The binary search tool will now exit..." + exit 1 +fi +overall_status=$? + + +exit ${overall_status} diff --git a/binary_search_tool/android/switch_to_good.sh b/binary_search_tool/android/switch_to_good.sh new file mode 100755 index 00000000..485ece73 --- /dev/null +++ b/binary_search_tool/android/switch_to_good.sh @@ -0,0 +1,41 @@ +#!/bin/bash -u +# +# Copyright 2016 Google Inc. All Rights Reserved. +# +# This script is intended to be used by binary_search_state.py, as +# part of the binary search triage on the Android source tree. This script +# symlinks a list of object files from the 'good' build tree into the working +# build tree, for testing. +# +# It is highly recommended to not use --noincremental with these scripts. If the +# switch scripts are given non incremental sets of GOOD/BAD objects, make will +# not be able to do an incremental build and will take much longer to build. +# + +source android/common.sh + +OBJ_LIST_FILE=$1 + +# Symlink from GOOD obj to working tree. +SWITCH_CMD="ln -f ${BISECT_GOOD_BUILD}/{} ${BISECT_WORK_BUILD}/{}; touch ${BISECT_WORK_BUILD}/{};" + +overall_status=0 + +# Check that number of arguments == 1 +if [ $# -eq 1 ] ; then + # Run symlink once per input line, ignore empty lines. + # Have ${BISECT_NUM_JOBS} processes running concurrently. + # Pass to "sh" to allow multiple commands to be executed. + xargs -P ${BISECT_NUM_JOBS} -a ${OBJ_LIST_FILE} -r -l -I '{}' \ + sh -c "${SWITCH_CMD}" +else + echo "ERROR:" + echo "Please run the binary search tool with --file_args" + echo "Android has too many files to be passed as command line arguments" + echo "The binary search tool will now exit..." + exit 1 +fi +overall_status=$? + + +exit ${overall_status} |