diff options
author | Matt Kraai <kraai@debian.org> | 2001-10-30 23:11:20 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-10-30 23:11:20 +0000 |
commit | 3889078dbe09a9d85b359e9c0c0c225e0bbea343 (patch) | |
tree | e258582c0f14f06750e480e2c244260e79860fd0 /testsuite/runtest | |
parent | 999623e9736d21177d1f437679b334e0347a6e0f (diff) | |
download | busybox-w32-3889078dbe09a9d85b359e9c0c0c225e0bbea343.tar.gz busybox-w32-3889078dbe09a9d85b359e9c0c0c225e0bbea343.tar.bz2 busybox-w32-3889078dbe09a9d85b359e9c0c0c225e0bbea343.zip |
Merge test suite.
Diffstat (limited to 'testsuite/runtest')
-rwxr-xr-x | testsuite/runtest | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/testsuite/runtest b/testsuite/runtest new file mode 100755 index 000000000..b19be3dd8 --- /dev/null +++ b/testsuite/runtest | |||
@@ -0,0 +1,97 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | PATH=$(dirname $(pwd)):$PATH | ||
4 | |||
5 | run_applet_testcase () | ||
6 | { | ||
7 | local applet=$1 | ||
8 | local testcase=$2 | ||
9 | |||
10 | local status=0 | ||
11 | local U= | ||
12 | local X= | ||
13 | |||
14 | local uc_applet=$(echo $applet | tr a-z A-Z) | ||
15 | local testname=$(basename $testcase) | ||
16 | |||
17 | if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then | ||
18 | echo "UNSUPPORTED: $testname" | ||
19 | return 0 | ||
20 | fi | ||
21 | |||
22 | if grep -q "^# UNSUPPORTED: " $testcase; then | ||
23 | local feature=`sed -ne 's/.*UNSUPPORTED: //p' $testcase` | ||
24 | |||
25 | if grep -q "^# ${feature} is not set$" ../.config; then | ||
26 | echo "UNSUPPORTED: $testname" | ||
27 | return 0 | ||
28 | fi | ||
29 | fi | ||
30 | |||
31 | if grep -q "^# XFAIL$" $testcase; then | ||
32 | U=U | ||
33 | X=X | ||
34 | fi | ||
35 | |||
36 | mkdir tmp | ||
37 | pushd tmp >/dev/null | ||
38 | |||
39 | if . ../$testcase >/dev/null 2>&1; then | ||
40 | echo "${U}PASS: $testname" | ||
41 | if [ "$U" ]; then | ||
42 | status=1 | ||
43 | fi | ||
44 | else | ||
45 | echo "${X}FAIL: $testname" | ||
46 | if [ ! "$X" ]; then | ||
47 | status=1 | ||
48 | fi | ||
49 | fi | ||
50 | |||
51 | popd >/dev/null | ||
52 | rm -rf tmp | ||
53 | |||
54 | return $status | ||
55 | } | ||
56 | |||
57 | run_applet_tests () | ||
58 | { | ||
59 | local applet=$1 | ||
60 | |||
61 | local status=0 | ||
62 | |||
63 | for testcase in $applet/*; do | ||
64 | if [ "$testcase" = "$applet/CVS" ]; then | ||
65 | continue | ||
66 | fi | ||
67 | |||
68 | if run_applet_testcase $applet $testcase; then | ||
69 | : | ||
70 | else | ||
71 | status=1 | ||
72 | fi | ||
73 | done | ||
74 | |||
75 | return $status | ||
76 | } | ||
77 | |||
78 | |||
79 | status=0 | ||
80 | |||
81 | if [ $# -ne 0 ]; then | ||
82 | applets="$@" | ||
83 | else | ||
84 | applets="*" | ||
85 | fi | ||
86 | |||
87 | for applet in $applets; do | ||
88 | if [ "$applet" != CVS -a -d "$applet" ]; then | ||
89 | if run_applet_tests $applet; then | ||
90 | : | ||
91 | else | ||
92 | status=1 | ||
93 | fi | ||
94 | fi | ||
95 | done | ||
96 | |||
97 | exit $status | ||