1#!/bin/bash
2#
3# This script is one of the two main driver scripts for testing the bisector.
4# It should be used to test the bisection tool, if you do NOT want to test
5# the compiler wrapper (e.g. don't bother with POPULATE_GOOD & POPULATE_BAD
6# stages).
7#
8# It makes sure the good & bad object directories exist (soft links); checks
9# to see if it needs to compile the good & bad sources & populate the
10# directories; does so if needed.
11#
12# Then it calls main-bisect-test, which runs the actual bisection tests.  This
13# script assumes it is being run from the parent directory.
14#
15# NOTE: Your PYTHONPATH environment variable needs to include both the
16# toolchain-utils directory and the
17# toolchain-utils/binary_search_tool directory for these testers to work.
18#
19
20SAVE_DIR=`pwd`
21
22DIR=full_bisect_test
23
24if [[ ! -d "${DIR}" ]] ; then
25  echo "Cannot find ${DIR}; you are running this script from the wrong place."
26  echo "You need to run this from toolchain-utils/binary_search_tool ."
27  exit 1
28fi
29
30# Set up object file soft links
31cd ${DIR}
32
33rm -f good-objects
34rm -f bad-objects
35
36ln -s good-objects-permanent good-objects
37ln -s bad-objects-permanent bad-objects
38
39if [[ ! -d work ]] ; then
40  mkdir work
41fi
42
43# Check to see if the object files need to be built.
44if [[ ! -f good-objects-permanent/build.o ]] ; then
45  # 'make clean'
46  rm -f work/*.o
47  # skip populate stages in bisect wrapper
48  unset BISECT_STAGE
49  # Set up the 'good' source files.
50  cd ..
51  ${DIR}/make_sources_good.sh
52  cd ${DIR}
53  # Build the 'good' .o files & copy to appropriate directory.
54  ./build.sh
55  mv work/*.o good-objects-permanent/.
56  # Set up the 'bad' source files.
57  cd ..
58  ${DIR}/make_sources_bad.sh
59  cd ${DIR}
60  # Build the 'bad' .o files & copy to appropriate directory.
61  ./build.sh
62  mv work/*.o bad-objects-permanent/.
63fi
64
65# Now we're ready for the main test.
66
67cd ${SAVE_DIR}
68${DIR}/main-bisect-test.sh
69