aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/full_bisect_test/interactive_test.sh
diff options
context:
space:
mode:
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
+
+