blob: f842e7ed8902cbd13e50a4f9217891b2a5917afe [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/usr/bin/env bash
2
3rev_file=.unit.rev
4if [ "$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
17fi
18
19# Replaces checkout.sh REV
20# Dummy print revision to temp file
21if [ "$1" = "-c" ]; then
22 echo $2 > $rev_file
23 exit 0
24fi
25
26# From here on, we assume the temp file exists
27if [ ! -f $rev_file ]; then
28 echo "Use unit_checkout.sh REV first"
29 exit 1
30fi
31REV=`cat $rev_file`
32echo "Testing revision $REV..."
33
34# Replaces run.sh
35# Dummy check for temp rev, compares to fake broken arg
36if [ "$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
44fi
45
46# Replaces test.sh
47# Dummy check for temp rev, compares to fake broken arg
48if [ "$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
56fi