aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool
diff options
context:
space:
mode:
authorCassidy Burden <cburden@google.com>2016-07-18 15:59:46 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-19 09:25:54 -0700
commit0f07f97cc8ff4ab42b05e32e3a008b2f618cc51f (patch)
tree0a8bb7fb8b7ffd15ad40e654b706200c8e610927 /binary_search_tool
parent4362e0a3a114215498593a589c5ee8faca9dbfe2 (diff)
downloadtoolchain-utils-0f07f97cc8ff4ab42b05e32e3a008b2f618cc51f.tar.gz
binary search tool: Add new common hash_test.sh
Add new test script for all bisecting tools. This test simply runs a checksum on a given file. If the checksum fails the image is "bad", otherwise the image is "good". This test replaces the less generic system test for cros_pkg (cros_pkg/testing_test.sh). TEST=Run system test for package bisector with hash_test.sh Change-Id: Ie1358101386ec2a04a077c8d81e73706f28112c0 Reviewed-on: https://chrome-internal-review.googlesource.com/270095 Commit-Ready: Cassidy Burden <cburden@google.com> Tested-by: Cassidy Burden <cburden@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'binary_search_tool')
-rw-r--r--binary_search_tool/README.bisect6
-rwxr-xr-xbinary_search_tool/common/hash_test.sh57
-rwxr-xr-xbinary_search_tool/cros_pkg/testing_test.sh36
3 files changed, 61 insertions, 38 deletions
diff --git a/binary_search_tool/README.bisect b/binary_search_tool/README.bisect
index 50e4fc18..5e0ecc76 100644
--- a/binary_search_tool/README.bisect
+++ b/binary_search_tool/README.bisect
@@ -130,9 +130,11 @@ Overriding:
Example 1 (do boot test instead of interactive test):
./bisect.py package daisy 172.17.211.182 --test_script=cros_pkg/boot_test.sh
- Example 2 (do package bisector system test instead of interactive test):
+ Example 2 (do package bisector system test instead of interactive test, this
+ is used to test the bisecting tool itself -- see comments in
+ hash_test.sh for more details):
./bisect.py package daisy 172.17.211.182 \
- --test_script=cros_pkg/testing_test.sh --install_script=""
+ --test_script=common/hash_test.sh --install_script=""
Example 3 (enable verbose mode and disable pruning):
./bisect.py package daisy 172.17.211.182 --verbose --noprune
diff --git a/binary_search_tool/common/hash_test.sh b/binary_search_tool/common/hash_test.sh
new file mode 100755
index 00000000..741f4237
--- /dev/null
+++ b/binary_search_tool/common/hash_test.sh
@@ -0,0 +1,57 @@
+#!/bin/bash -u
+#
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# This script is intended to be used by binary_search_state.py. It is to
+# be used for testing/development of the binary search triage tool
+# itself. It waits for the install script to build and install the
+# image, then checks the hashes in the provided file.
+# If the real hashes match the checksum hashes, then the image is 'good',
+# otherwise it is 'bad'. This allows the rest of the bisecting tool
+# to run without requiring help from the user (as it would if we were
+# dealing with a real 'bad' image).
+#
+
+#
+# Initialize the value below before using this script!!!
+#
+# Make an md5sum of all the files you want to check. For example if you want
+# file1, file2, and file3 to be found as bad items:
+#
+# md5sum file1 file2 file3 > checksum.out
+#
+# (Make sure you are hashing the files from your good build and that the hashes
+# from good to bad build differ)
+#
+# Then set HASHES_FILE to be the path to 'checksum.out'
+# In this example, file1, file2, file3 will be found as the bad files
+# because their hashes won't match when from the bad build tree. This is
+# assuming that the hashes between good/bad builds change. It is suggested to
+# build good and bad builds at different optimization levels to help ensure
+# each item has a different hash.
+#
+# WARNING:
+# Make sure paths to all files are absolute paths or relative to
+# binary_search_state.py
+#
+# cros_pkg bisector example:
+# 1. Build good packages with -O1, bad packages with -O2
+# 2. cros_pkg/switch_to_good.sh pkg1 pkg2 pkg3
+# 3. md5sum pkg1 pkg2 pkg3 > checksum.out.cros_pkg
+# 4. Set HASHES_FILE to be checksum.out.cros_pkg
+# 5. Run the bisector with this test script
+#
+#
+HASHES_FILE=
+
+if [[ -z "${HASHES_FILE}" || ! -f "${HASHES_FILE}" ]];
+then
+ echo "ERROR: HASHES_FILE must be intialized in common/hash_test.sh"
+ exit 3
+fi
+
+md5sum -c --status ${HASHES_FILE}
+md5_result=$?
+
+
+exit $md5_result
diff --git a/binary_search_tool/cros_pkg/testing_test.sh b/binary_search_tool/cros_pkg/testing_test.sh
deleted file mode 100755
index 0f634db5..00000000
--- a/binary_search_tool/cros_pkg/testing_test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash -u
-#
-# Copyright 2015 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 ChromeOS packages. It is to be
-# used for testing/development of the binary search triage tool
-# itself. It waits for the install script to build and install the
-# image, then checks the hash of the chrome package being used to build.
-# If the hash matches the test hash, then the image is 'good',
-# otherwise it is 'bad'. This allows the rest of the bisecting tool
-# to run without requiring help from the user (as it would if we were
-# dealing with a real 'bad' image).
-#
-
-source common/common.sh
-
-#
-#Initialize the value below before using this script!!!
-# e.g. if 'md5sum /build/${BOARD}/packages/chromeos-base/chromeos-chrome*' shows
-#
-# 6a003f76caac3cdbcf6e0f6ea307f10f /build/daisy/packages/chromeos-base/chromeos-chrome-53.0.2754.0_rc-r1.tbz2
-#
-# Then initialize HASH below to '6a003f76caac3cdbcf6e0f6ea307f10f'
-#
-HASH=''
-
-if [ -z "${HASH}" ]
-then
- echo "ERROR: HASH must be intialized in testing_test.sh"
- exit 3
-fi
-
-test_hash=$(md5sum /build/${BOARD}/packages/chromeos-base/chromeos-chrome* | awk '{print $1}')
-[[ "${HASH}" == "${test_hash}" ]]
-exit $?