diff options
author | Luis Lozano <llozano@chromium.org> | 2014-12-15 02:04:45 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-03-27 22:21:08 +0000 |
commit | de0a90d676297a216dde2e47562b3a9f57621c41 (patch) | |
tree | c7d7b95d03845d7ee26f033d91565fd06982428f /binary_search_tool/sysroot_wrapper | |
parent | 0e2d9a0bafc6bff6a53ca4ddf779715994f28ea8 (diff) | |
download | toolchain-utils-de0a90d676297a216dde2e47562b3a9f57621c41.tar.gz |
Scripts to use with sysroot_wrapper bisecting.
Scripts to be used by the binary searching tool to interact with
the bisecting functionality in the sysroot_wrapper.
BUG=None
TEST=Tested on 3 different occasions while triaging problems
in flash, kernel and glibc.
Change-Id: Icf55f60b0cb160ae453c9384ca77da70710c3f48
Reviewed-on: https://chrome-internal-review.googlesource.com/188665
Reviewed-by: Han Shen <shenhan@google.com>
Commit-Queue: Luis Lozano <llozano@chromium.org>
Tested-by: Luis Lozano <llozano@chromium.org>
Diffstat (limited to 'binary_search_tool/sysroot_wrapper')
-rw-r--r-- | binary_search_tool/sysroot_wrapper/README | 16 | ||||
-rw-r--r-- | binary_search_tool/sysroot_wrapper/common.sh | 3 | ||||
-rw-r--r-- | binary_search_tool/sysroot_wrapper/get_initial_items.sh | 5 | ||||
-rw-r--r-- | binary_search_tool/sysroot_wrapper/glibc_test_script.sh | 49 | ||||
-rw-r--r-- | binary_search_tool/sysroot_wrapper/switch_to_bad.sh | 10 | ||||
-rw-r--r-- | binary_search_tool/sysroot_wrapper/switch_to_good.sh | 10 | ||||
-rw-r--r-- | binary_search_tool/sysroot_wrapper/test_script.sh | 34 |
7 files changed, 127 insertions, 0 deletions
diff --git a/binary_search_tool/sysroot_wrapper/README b/binary_search_tool/sysroot_wrapper/README new file mode 100644 index 00000000..132c03d3 --- /dev/null +++ b/binary_search_tool/sysroot_wrapper/README @@ -0,0 +1,16 @@ +This is a set of scripts to use when triaging compiler problem by using +the bisecting functionality included in the sysroot_wrapper.hardened. +The only script that you need to create for your triaging problem is the +test_script.sh (The ones in this directory are here only as an example). + +To run the binary searcher tool with these scripts, execute it like this: + +./binary_search_state.py --get_initial_items=./sysroot_wrapper/get_initial_items.sh --switch_to_good=./sysroot_wrapper/switch_to_good.sh --switch_to_bad=./sysroot_wrapper/switch_to_bad.sh --test_script=./sysroot_wrapper/test_script.sh --noincremental --file_args 2>&1 | tee /tmp/binary_search.log + +For more information on how to use the sysroot_wrapper to do object file +triaging see: + +https://sites.google.com/a/google.com/chromeos-toolchain-team-home2/home/team-tools-and-scripts/bisecting-compiler-problems + + + diff --git a/binary_search_tool/sysroot_wrapper/common.sh b/binary_search_tool/sysroot_wrapper/common.sh new file mode 100644 index 00000000..0d60b9a6 --- /dev/null +++ b/binary_search_tool/sysroot_wrapper/common.sh @@ -0,0 +1,3 @@ +#!/bin/bash -u + +bisect_dir=${BISECT_DIR:-/tmp/sysroot_bisect} diff --git a/binary_search_tool/sysroot_wrapper/get_initial_items.sh b/binary_search_tool/sysroot_wrapper/get_initial_items.sh new file mode 100644 index 00000000..85d6942d --- /dev/null +++ b/binary_search_tool/sysroot_wrapper/get_initial_items.sh @@ -0,0 +1,5 @@ +#!/bin/bash -u + +source ./sysroot_wrapper/common.sh + +cat ${bisect_dir}/good/_LIST diff --git a/binary_search_tool/sysroot_wrapper/glibc_test_script.sh b/binary_search_tool/sysroot_wrapper/glibc_test_script.sh new file mode 100644 index 00000000..74e492ad --- /dev/null +++ b/binary_search_tool/sysroot_wrapper/glibc_test_script.sh @@ -0,0 +1,49 @@ +#!/bin/bash -u + +# This is an example execution script. +# This script changes with the problem you are trying to fix. +# This particular script was used to triage a problem where a glibc +# compiled with a new compiler would expose a problem in piglit. +# Note it returns 0 only when the installation of the image succeeded +# (ie: the machine booted after installation) + +source ./sysroot_wrapper/common.sh + +#export BISECT_STAGE=TRIAGE +echo "BISECT_STAGE=${BISECT_STAGE}" + +echo "State of sets" +wc -l ${bisect_dir}/*_SET + +board=x86-alex +DUT=172.17.186.180 + +echo "Cleaning up" +{ sudo emerge -C cross-i686-pc-linux-gnu/glibc || exit 2; } &>> /tmp/glibc_triage.log + +echo "Building" +{ sudo -E emerge cross-i686-pc-linux-gnu/glibc || exit 2; } &>> /tmp/glibc_triage.log + +echo "Building image" +{ /home/llozano/trunk/src/scripts/build_image --board=${board} test || exit 2; } &>> /tmp/glibc_triage.log + +echo "Installing image" +cros flash ${DUT} latest &> /tmp/tmp_cros_flash_result.log + +cat /tmp/tmp_cros_flash_result.log >> /tmp/cros_flash_result.log + +grep "Cros Flash completed successfully" /tmp/tmp_cros_flash_result.log || exit 2 + +echo "Trying piglit" + +echo "export DISPLAY=:0.0; echo \$DISPLAY; /usr/local/piglit/lib/piglit/bin/glx-close-display -auto" > /tmp/repro.sh +SSH_OPTS="-oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -oServerAliveInterval=10 -i /var/cache/chromeos-cache/distfiles/target/./chrome-src/src/third_party/chromite/ssh_keys/testing_rsa" +scp ${SSH_OPTS} /tmp/repro.sh root@${DUT}:/tmp + +# notice the bash -l here. Otherwise the DISPLAY cannot be set +( ssh ${SSH_OPTS} root@${DUT} -- /bin/bash -l /tmp/repro.sh ) > /tmp/result +grep pass /tmp/result || { echo "PIGLIT FAILED"; exit 1; } + +echo "PIGLIT PASSED" + +exit 0 diff --git a/binary_search_tool/sysroot_wrapper/switch_to_bad.sh b/binary_search_tool/sysroot_wrapper/switch_to_bad.sh new file mode 100644 index 00000000..62a908f4 --- /dev/null +++ b/binary_search_tool/sysroot_wrapper/switch_to_bad.sh @@ -0,0 +1,10 @@ +#!/bin/bash -u + +source ./sysroot_wrapper/common.sh + +cat $1 > ${bisect_dir}/BAD_SET + +grep -v -x -F -f $1 ${bisect_dir}/GOOD_SET > ${bisect_dir}/GOOD_SET.tmp +mv ${bisect_dir}/GOOD_SET.tmp ${bisect_dir}/GOOD_SET + +exit 0 diff --git a/binary_search_tool/sysroot_wrapper/switch_to_good.sh b/binary_search_tool/sysroot_wrapper/switch_to_good.sh new file mode 100644 index 00000000..3db8a9c6 --- /dev/null +++ b/binary_search_tool/sysroot_wrapper/switch_to_good.sh @@ -0,0 +1,10 @@ +#!/bin/bash -u + +source ./sysroot_wrapper/common.sh + +cat $1 > ${bisect_dir}/GOOD_SET + +grep -v -x -F -f $1 ${bisect_dir}/BAD_SET > ${bisect_dir}/BAD_SET.tmp +mv ${bisect_dir}/BAD_SET.tmp ${bisect_dir}/BAD_SET + +exit 0 diff --git a/binary_search_tool/sysroot_wrapper/test_script.sh b/binary_search_tool/sysroot_wrapper/test_script.sh new file mode 100644 index 00000000..ef6b4d40 --- /dev/null +++ b/binary_search_tool/sysroot_wrapper/test_script.sh @@ -0,0 +1,34 @@ +#!/bin/bash -u + +# This is an example execution script. +# This script changes with the problem you are trying to fix. +# This particular script was used to triage a problem where the kernel +# would not boot while migrating to GCC 4.9. +# Note it returns 0 only when the installation of the image succeeded +# (ie: the machine booted after installation) + +source ./sysroot_wrapper/common.sh + +export BISECT_STAGE=TRIAGE +echo "BISECT_STAGE=${BISECT_STAGE}" + +echo "State of sets" +wc -l ${bisect_dir}/*_SET + +echo "Cleaning up" +{ /usr/bin/sudo rm -rf /build/falco/var/cache/portage/sys-kernel && emerge-falco -C sys-kernel/chromeos-kernel-3_8-3.8.11-r96 || exit 2; } &>> /tmp/kernel_triage.log + +echo "Building" +{ /usr/local/bin/emerge-falco =sys-kernel/chromeos-kernel-3_8-3.8.11-r96 || exit 2; } &>> /tmp/kernel_triage.log + +echo "Building image" +{ /home/llozano/trunk/src/scripts/build_image --board=falco test || exit 2; } &>> /tmp/kernel_triage.log + +echo "Installing image" +cros flash 172.17.187.150 latest &> /tmp/tmp_cros_flash_result.log + +cat /tmp/tmp_cros_flash_result.log >> /tmp/cros_flash_result.log + +grep "Cros Flash completed successfully" /tmp/tmp_cros_flash_result.log || exit 1 + +exit 0 |