Mercurial > hg-old > index.cgi
comparison test/runtests.sh @ 387:a741d2e4869f
Various bugfixes; fixed lwobjdump to display symbols with unprintable characters more sensibly; start of a (nonfunctional for now) testing framework
author | lost@l-w.ca |
---|---|
date | Wed, 14 Jul 2010 20:15:23 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
386:af5f2c51db76 | 387:a741d2e4869f |
---|---|
1 #!/bin/bash | |
2 # | |
3 # run the various tests under the tests/ folder recursively | |
4 | |
5 function runtests() | |
6 { | |
7 local fn | |
8 local base="$2" | |
9 local odir=`pwd` | |
10 local dir="$1" | |
11 | |
12 cd "$dir" | |
13 | |
14 for fn in *.t; do | |
15 if [ -d "$fn" ]; then | |
16 echo "Running tests in $base/$fn" | |
17 runtests "$fn" "$base/$fn" | |
18 elif [ -r "$fn" ]; then | |
19 echo "Running test $fn" | |
20 testcount=$(($testcount+1)) | |
21 TESTSTATE=failed | |
22 source "$fn" | |
23 if [ "$TESTSTATE" = ok ]; then | |
24 testpassed=$(($testpassed+1)) | |
25 else | |
26 testfailed=$(($testfailed+1)) | |
27 fi | |
28 fi | |
29 done | |
30 | |
31 cd "$odir" | |
32 } | |
33 | |
34 testcount=0 | |
35 testfailed=0 | |
36 testpassed=0 | |
37 | |
38 dir="$1" | |
39 if [ "x$dir" = "x" ]; then | |
40 dir=. | |
41 fi | |
42 | |
43 runtests "$dir" "$dir" | |
44 | |
45 echo "Passed $testpassed tests of $testcount" | |
46 if [ "$testfailed" -ne 0 ]; then | |
47 echo "Failed $testfailed of $testcount tests!" | |
48 exit 1 | |
49 fi | |
50 exit 0 |