diff options
Diffstat (limited to 'binary_search_tool/full_bisect_test/switch_to_good.sh')
-rwxr-xr-x | binary_search_tool/full_bisect_test/switch_to_good.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/binary_search_tool/full_bisect_test/switch_to_good.sh b/binary_search_tool/full_bisect_test/switch_to_good.sh new file mode 100755 index 00000000..9d8c29bc --- /dev/null +++ b/binary_search_tool/full_bisect_test/switch_to_good.sh @@ -0,0 +1,57 @@ +#!/bin/bash -u +# +# This is one of the scripts that is passed to binary_search_state.py to do +# the bisection. This one takes a list of object files (either a real list or +# a file containing the list) and copies the files from the good objects +# directory to the working directory. +# + + +source full_bisect_test/common.sh + +pushd ${BISECT_WORK_BUILD} +chmod 644 * + +OBJ_LIST_FILES=$1 +FILE_ARGS=0 + +if [[ -f ${OBJ_LIST_FILES} ]] ; then + file ${OBJ_LIST_FILES} &> ${BISECT_WORK_BUILD}/file_type.tmp + grep "ASCII text" ${BISECT_WORK_BUILD}/file_type.tmp + result=$? + if [[ ${result} -eq 0 ]] ; then + FILE_ARGS=1 + fi + rm ${BISECT_WORK_BUILD}/file_type.tmp +fi + +overall_status=0 + +if [[ ${FILE_ARGS} -eq 1 ]] ; then + while read obj || [[ -n "${obj}" ]]; + do + echo "Copying {BISECT_GOOD_BUILD}/${obj} to ${BISECT_WORK_BUILD}" + cp ${BISECT_GOOD_BUILD}/${obj} ${BISECT_WORK_BUILD} +# cp ${obj} ${BISECT_WORK_BUILD}/. + status=$? + if [[ ${status} -ne 0 ]] ; then + echo "Failed to copy ${obj} to work build tree." + overall_status=2 + fi + done < ${OBJ_LIST_FILES} +else + + for o in "$@" + do + cp ${BISECT_GOOD_BUILD}/${o} ${BISECT_WORK_BUILD} + status=$? + if [[ ${status} -ne 0 ]] ; then + echo "Failed to copy ${o} to work build tree." + overall_status=2 + fi + done +fi + +popd + +exit ${overall_status} |