From 1cc48481a2ca530bab04999da78eddc8a1b98adb Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Mon, 6 Feb 2017 14:54:28 -0800 Subject: [binary search tool] Add bisecting tests. Add real bisection testing, for use with or without compiler wrapper script. BUG=https://b.corp.google.com/issues/34888940 TEST=Tested wtih & without the compiler wrapper in my source tree. Change-Id: I72329b458b5c93f8e7f03f9970c755018390cc3c Reviewed-on: https://chromium-review.googlesource.com/438666 Commit-Ready: Caroline Tice Tested-by: Caroline Tice Reviewed-by: Yunlian Jiang --- .../full_bisect_test/interactive_test.sh | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 binary_search_tool/full_bisect_test/interactive_test.sh (limited to 'binary_search_tool/full_bisect_test/interactive_test.sh') 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 + + -- cgit v1.2.3