forked from aaSSfxxx/r2-regressions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bisect.sh
executable file
·47 lines (46 loc) · 926 Bytes
/
bisect.sh
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
46
47
#!/bin/sh
if [ -z "$1" ]; then
echo "Use ./bisect.sh [test]"
echo " ./bisect.sh -a # test all"
echo " ./bisect.sh -b # test all BROKEN"
exit 1
fi
TESTS=$@
UPTO=32
if [ "${TESTS}" = "-a" ]; then
TESTS=$(cd t ; ls)
elif [ "${TESTS}" = "-b" ]; then
TESTS=$(cd t ; grep -r BROKEN=1 *|cut -d : -f 1)
fi
if [ -z "${TESTS}" ]; then
echo "* No matching test"
exit 1
fi
for a in ${TESTS}; do
if [ ! -x $a ]; then
echo "* Cannot find test $a"
exit 1
fi
done
cd ..
echo "* Running bisect on ${TESTS}"
REVS=$(git log|grep ^commit |awk '{print $2}')
for a in ${REVS}; do
[ "${UPTO}" = 0 ] && break
UPTO=$(($UPTO-1))
echo "* Building revision $a ..."
sleep 2
sys/install-rev.sh ${a} > build.$a.log 2>&1
cd r2-regressions
for b in ${TESTS}; do
R2_SOURCED=1 ./$b
if [ $? = 0 ]; then
echo "* Worked on revision $a"
exit 0
else
echo "* Error on revision $a"
fi
done
cd ../..
done
exit 1