forked from aaSSfxxx/r2-regressions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr2r
executable file
·105 lines (95 loc) · 1.47 KB
/
r2r
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh
#
# r2r entrypoint for the regressions testsuite
# TODO: bisect with -b
R2RDIR="@R2RDIR@"
TESTRUNNER="run_tests.sh"
if [ "${R2RDIR}" != "@""R2RDIR@" ]; then
cd "${R2RDIR}"
else
DIR=`readlink $0`
[ -n "${DIR}" ] && cd `dirname $DIR`
while [ ! -x r2r ]; do
cd ..
if [ "`pwd`" = / ]; then
echo "Cannot find radare2-regressions/"
exit 1
fi
done
fi
KW="$1"
KX="$2"
control_c() {
echo "^C"
exit 1
}
trap control_c 2
usage() {
echo "Usage: r2r ([-s|-p|-P]) [keyword]"
echo " -s search only. do not run any test"
echo " -p run test files in parallel"
echo " -P run every single test in parallel"
echo " -v show version"
}
case "$KW" in
-v)
echo "0.10.2"
exit 0
;;
-h)
usage
exit 0
;;
-P)
export HYPERPARALLEL=1
TESTRUNNER="run_tests_parallel.sh"
shift
KW=$1
KX="$2"
;;
-p)
TESTRUNNER="run_tests_parallel.sh"
shift
KW=$1
KX="$2"
;;
-s)
if [ -n "$KX" ]; then
find t* | grep "$KX"
exit 0
else
usage
exit 1
fi
;;
esac
export VERBOSE=1
if [ -n "$KW" ]; then
if [ -n "$KX" ]; then
TESTS=`find t* | grep -- "$KW" | grep -- "$KX" | grep -v '/\.'`
else
TESTS=`find t* | grep -- "$KW" | grep -v '/\.'`
fi
echo
echo "$TESTS"
echo
DIRS=""
for a in ${TESTS} ; do
SKIP=0
if [ -d "$a" ]; then
DIRS="${DIRS} $a"
else
for b in ${DIRS} ; do
if [ -n "`echo $a | grep ^$b`" ]; then
echo "Skip $a"
SKIP=1
break
fi
done
fi
[ "${SKIP}" = 0 ] && ./${TESTRUNNER} "$a"
done
else
usage
exit 1
fi