aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/full_bisect_test/interactive_test.sh
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2017-07-22 01:11:35 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-07-22 01:11:35 +0000
commitddfea1f7e75062a350bd5a9418562e3b5af5b6e9 (patch)
treebf139ee25415cecde142e95791edba3803b2452a /binary_search_tool/full_bisect_test/interactive_test.sh
parent3690e025de8daaed03c4acb02d2b054e5c4c0dd5 (diff)
parent6c551e0d526de7de9d86516614d645cba6f975a6 (diff)
downloadtoolchain-utils-o-mr1-iot-preview-6.tar.gz
Merge branch 'aosp/mirror-chromium-master' into update_utils am: 4307f4735e am: 18caef1eddandroid-o-mr1-iot-preview-6o-mr1-iot-preview-6
am: 6c551e0d52 Change-Id: I44720cd3cd736bb61f583fb20df1c25ac9323ae0
Diffstat (limited to 'binary_search_tool/full_bisect_test/interactive_test.sh')
-rwxr-xr-xbinary_search_tool/full_bisect_test/interactive_test.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/binary_search_tool/full_bisect_test/interactive_test.sh b/binary_search_tool/full_bisect_test/interactive_test.sh
new file mode 100755
index 00000000..064e4ae5
--- /dev/null
+++ b/binary_search_tool/full_bisect_test/interactive_test.sh
@@ -0,0 +1,56 @@
+#!/bin/bash -u
+#
+# This script is one of the required scripts that get passed to
+# binary_search_state.py. It's job is to test the executable that
+# was generated by mixing/matching good & bad object files, and determine
+# whether the resulting binary is good or bad.
+#
+# In this particular case, the generated binary is 'bin-trees'. This
+# script runs the binary, captures its output, and compares the output
+# to a file containg the correct (good) output, and three files containing
+# what the bad output might look like, depending on if one of the two
+# possile bad .o files was used, or if both bad .o files were used.
+#
+# If the output matches the known good output, this returns 0.
+# If the output matches any known bad output, this returns 1.
+# If the output does not match the good or bad outputs, this returns 125.
+#
+
+source full_bisect_test/common.sh
+
+full_bisect_test/bin-trees > full_bisect_test/temp_output.txt
+
+diff full_bisect_test/temp_output.txt full_bisect_test/good-output.txt &> /dev/null
+retval=$?
+
+if [[ ${retval} -eq 0 ]]; then
+ rm -f full_bisect_test/temp_output.txt
+ exit 0
+fi
+
+diff full_bisect_test/temp_output.txt full_bisect_test/bad-output-1.txt &> /dev/null
+retval=$?
+
+if [[ ${retval} -eq 0 ]]; then
+ rm -f full_bisect_test/temp_output.txt
+ exit 1
+else
+ diff full_bisect_test/temp_output.txt full_bisect_test/bad-output-2.txt &> /dev/null
+ retval=$?
+ if [[ ${retval} -eq 0 ]]; then
+ rm -f full_bisect_test/temp_output.txt
+ exit 1
+ else
+ diff full_bisect_test/temp_output.txt full_bisect_test/bad-output-3.txt &> /dev/null
+ retval=$?
+ if [[ ${retval} -eq 0 ]]; then
+ rm -f full_bisect_test/temp_output.txt
+ exit 1
+ fi
+ fi
+fi
+
+rm -f full_bisect_test/temp_output.txt
+exit 125
+
+