Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | rev_file=.unit.rev |
| 4 | if [ "$1" = "" ]; then |
| 5 | echo "For bisect.pl testing." |
| 6 | echo |
| 7 | echo "Usage:" |
| 8 | echo "./bisect.pl -c "unit_test -c" \\" |
| 9 | echo " -b "unit_test -b BAD_COMPILATION_REV" \\" |
| 10 | echo " -t "unit_test -t BAD_TEST_REV" \\" |
| 11 | echo " start_rev stop_rev" |
| 12 | echo |
| 13 | echo "So that you can make sure that BAD_COMPILATION_REV" |
| 14 | echo "does't break the bisect looking for BAD_TEST_REV." |
| 15 | rm -f $rev_file |
| 16 | exit 0 |
| 17 | fi |
| 18 | |
| 19 | # Replaces checkout.sh REV |
| 20 | # Dummy print revision to temp file |
| 21 | if [ "$1" = "-c" ]; then |
| 22 | echo $2 > $rev_file |
| 23 | exit 0 |
| 24 | fi |
| 25 | |
| 26 | # From here on, we assume the temp file exists |
| 27 | if [ ! -f $rev_file ]; then |
| 28 | echo "Use unit_checkout.sh REV first" |
| 29 | exit 1 |
| 30 | fi |
| 31 | REV=`cat $rev_file` |
| 32 | echo "Testing revision $REV..." |
| 33 | |
| 34 | # Replaces run.sh |
| 35 | # Dummy check for temp rev, compares to fake broken arg |
| 36 | if [ "$1" = "-b" ]; then |
| 37 | if [ "$2" = "$REV" ]; then |
| 38 | echo "Bad compilation" |
| 39 | exit 1 |
| 40 | else |
| 41 | echo "Good compilation" |
| 42 | exit 0 |
| 43 | fi |
| 44 | fi |
| 45 | |
| 46 | # Replaces test.sh |
| 47 | # Dummy check for temp rev, compares to fake broken arg |
| 48 | if [ "$1" = "-t" ]; then |
| 49 | if [ $REV -ge $2 ]; then |
| 50 | echo "Bad test" |
| 51 | exit 1 |
| 52 | else |
| 53 | echo "Good test" |
| 54 | exit 0 |
| 55 | fi |
| 56 | fi |