Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # This script is the main driver of the bisection. Please read the |
| 4 | # README.txt in this directory for more info. |
| 5 | |
| 6 | syntax="Syntax: $0 [-(s)tep N | -(o)pts '-hvsc -t TEST'] <first commit> <last commit>" |
| 7 | |
| 8 | step=1 |
| 9 | while getopts "s:o:" opt; do |
| 10 | case $opt in |
| 11 | s) |
| 12 | step=$OPTARG |
| 13 | ;; |
| 14 | o) |
| 15 | run_opts="$run_opts $OPTARG" |
| 16 | ;; |
| 17 | *) |
| 18 | echo -e $syntax |
| 19 | exit 1 |
| 20 | ;; |
| 21 | esac |
| 22 | done |
| 23 | shift $(($OPTIND-1)) |
| 24 | |
| 25 | if [[ $1 = '' || $2 = '' ]]; then |
| 26 | echo -e $syntax |
| 27 | exit 1 |
| 28 | fi |
| 29 | |
| 30 | from=$1 |
| 31 | to=$(($2+1)) |
| 32 | cur=$from |
| 33 | |
| 34 | while [[ $cur < $to ]]; do |
| 35 | echo "Testing $cur..." |
| 36 | ./checkout.sh $cur 2>&1 > $cur.log |
| 37 | ./run.sh $run_opts 2>&1 >> $cur.log |
| 38 | if [[ $? != 0 ]]; then |
| 39 | echo "BAD" |
| 40 | exit 1 |
| 41 | else |
| 42 | echo "GOOD" |
| 43 | fi |
| 44 | cur=$(($cur+$step)) |
| 45 | done |