diff options
Diffstat (limited to 'bisect/unit_test.sh')
-rwxr-xr-x | bisect/unit_test.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/bisect/unit_test.sh b/bisect/unit_test.sh new file mode 100755 index 0000000..f842e7e --- /dev/null +++ b/bisect/unit_test.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +rev_file=.unit.rev +if [ "$1" = "" ]; then + echo "For bisect.pl testing." + echo + echo "Usage:" + echo "./bisect.pl -c "unit_test -c" \\" + echo " -b "unit_test -b BAD_COMPILATION_REV" \\" + echo " -t "unit_test -t BAD_TEST_REV" \\" + echo " start_rev stop_rev" + echo + echo "So that you can make sure that BAD_COMPILATION_REV" + echo "does't break the bisect looking for BAD_TEST_REV." + rm -f $rev_file + exit 0 +fi + +# Replaces checkout.sh REV +# Dummy print revision to temp file +if [ "$1" = "-c" ]; then + echo $2 > $rev_file + exit 0 +fi + +# From here on, we assume the temp file exists +if [ ! -f $rev_file ]; then + echo "Use unit_checkout.sh REV first" + exit 1 +fi +REV=`cat $rev_file` +echo "Testing revision $REV..." + +# Replaces run.sh +# Dummy check for temp rev, compares to fake broken arg +if [ "$1" = "-b" ]; then + if [ "$2" = "$REV" ]; then + echo "Bad compilation" + exit 1 + else + echo "Good compilation" + exit 0 + fi +fi + +# Replaces test.sh +# Dummy check for temp rev, compares to fake broken arg +if [ "$1" = "-t" ]; then + if [ $REV -ge $2 ]; then + echo "Bad test" + exit 1 + else + echo "Good test" + exit 0 + fi +fi |