• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -u
2#
3# This script is one of the required scripts that get passed to
4# binary_search_state.py.  It's job is to test the executable that
5# was generated by mixing/matching good & bad object files, and determine
6# whether the resulting binary is good or bad.
7#
8# In this particular case, the generated binary is 'bin-trees'.  This
9# script runs the binary, captures its output, and compares the output
10# to a file containg the correct (good) output, and three files containing
11# what the bad output might look like, depending on if one of the two
12# possile bad .o files was used, or if both bad .o files were used.
13#
14# If the output matches the known good output, this returns 0.
15# If the output matches any known bad output, this returns 1.
16# If the output does not match the good or bad outputs, this returns 125.
17#
18
19source full_bisect_test/common.sh
20
21full_bisect_test/bin-trees > full_bisect_test/temp_output.txt
22
23diff full_bisect_test/temp_output.txt full_bisect_test/good-output.txt &> /dev/null
24retval=$?
25
26if [[ ${retval} -eq 0 ]]; then
27  rm -f full_bisect_test/temp_output.txt
28  exit 0
29fi
30
31diff full_bisect_test/temp_output.txt full_bisect_test/bad-output-1.txt &> /dev/null
32retval=$?
33
34if [[ ${retval} -eq 0 ]]; then
35  rm -f full_bisect_test/temp_output.txt
36  exit 1
37else
38  diff full_bisect_test/temp_output.txt full_bisect_test/bad-output-2.txt &> /dev/null
39  retval=$?
40  if [[ ${retval} -eq 0 ]]; then
41    rm -f full_bisect_test/temp_output.txt
42    exit 1
43  else
44    diff full_bisect_test/temp_output.txt full_bisect_test/bad-output-3.txt &> /dev/null
45    retval=$?
46    if [[ ${retval} -eq 0 ]]; then
47      rm -f full_bisect_test/temp_output.txt
48      exit 1
49    fi
50  fi
51fi
52
53rm -f full_bisect_test/temp_output.txt
54exit 125
55
56
57