aboutsummaryrefslogtreecommitdiff
path: root/bisect/sequential.sh
blob: bd1d6390a12f3beb6d73ec839c38f346a5c811f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash

# This script is the main driver of the bisection. Please read the 
# README.txt in this directory for more info.

syntax="Syntax: $0 [-(s)tep N | -(o)pts '-hvsc -t TEST'] <first commit> <last commit>"

step=1
while getopts "s:o:" opt; do
  case $opt in
    s)
      step=$OPTARG
      ;;
    o)
      run_opts="$run_opts $OPTARG"
      ;;
    *)
      echo -e $syntax
      exit 1
      ;;
  esac
done
shift $(($OPTIND-1))

if [[ $1 = '' || $2 = '' ]]; then
  echo -e $syntax
  exit 1
fi

from=$1
to=$(($2+1))
cur=$from

while [[ $cur < $to ]]; do
  echo "Testing $cur..."
  ./checkout.sh $cur 2>&1 > $cur.log
  ./run.sh $run_opts 2>&1 >> $cur.log
  if [[ $? != 0 ]]; then
    echo "BAD"
    exit 1
  else
    echo "GOOD"
  fi
  cur=$(($cur+$step))
done