4371 |
26 Oct 12 |
olle |
#!/bin/bash |
3486 |
16 Nov 09 |
gregory |
2 |
. ./config.sh |
3486 |
16 Nov 09 |
gregory |
3 |
|
3489 |
16 Nov 09 |
gregory |
4 |
arg1=$1 |
3489 |
16 Nov 09 |
gregory |
5 |
arg2=$2 |
3219 |
24 Apr 09 |
gregory |
6 |
|
3416 |
28 Sep 09 |
gregory |
7 |
test() |
3416 |
28 Sep 09 |
gregory |
8 |
{ |
3487 |
16 Nov 09 |
gregory |
9 |
test_file=$1 |
3504 |
30 Nov 09 |
gregory |
10 |
file_name=${test_file##*/} |
3504 |
30 Nov 09 |
gregory |
11 |
test_name=${file_name%%.*} |
3486 |
16 Nov 09 |
gregory |
12 |
if [ -e $test_file ]; then |
3486 |
16 Nov 09 |
gregory |
13 |
title=`head -1 $test_file` |
3493 |
23 Nov 09 |
gregory |
14 |
test=$title |
3486 |
16 Nov 09 |
gregory |
15 |
fi |
3489 |
16 Nov 09 |
gregory |
16 |
case $arg2 in |
3416 |
28 Sep 09 |
gregory |
17 |
"-v") |
3416 |
28 Sep 09 |
gregory |
18 |
echo "" |
3493 |
23 Nov 09 |
gregory |
19 |
echo "TEST [$1] $title" |
3416 |
28 Sep 09 |
gregory |
20 |
;; |
3416 |
28 Sep 09 |
gregory |
21 |
*) |
3416 |
28 Sep 09 |
gregory |
22 |
;; |
3416 |
28 Sep 09 |
gregory |
23 |
esac |
3486 |
16 Nov 09 |
gregory |
24 |
if [ -e $test_file ]; then |
3504 |
30 Nov 09 |
gregory |
25 |
if [ -d $test_name ]; then |
3504 |
30 Nov 09 |
gregory |
26 |
rm -rf $test_name |
3504 |
30 Nov 09 |
gregory |
27 |
fi |
3504 |
30 Nov 09 |
gregory |
28 |
mkdir $test_name |
3504 |
30 Nov 09 |
gregory |
29 |
cd $test_name |
3504 |
30 Nov 09 |
gregory |
30 |
. ../$test_file |
3504 |
30 Nov 09 |
gregory |
31 |
cd .. |
3486 |
16 Nov 09 |
gregory |
32 |
fi |
3416 |
28 Sep 09 |
gregory |
33 |
} |
3416 |
28 Sep 09 |
gregory |
34 |
|
3488 |
16 Nov 09 |
gregory |
35 |
clean() |
3488 |
16 Nov 09 |
gregory |
36 |
{ |
3504 |
30 Nov 09 |
gregory |
37 |
for dir in t* |
3223 |
27 Apr 09 |
gregory |
38 |
do |
3504 |
30 Nov 09 |
gregory |
39 |
if [ -d $dir ] && [ "$dir" != "tests" ]; then |
3504 |
30 Nov 09 |
gregory |
40 |
echo "rm -rf $dir" |
3504 |
30 Nov 09 |
gregory |
41 |
rm -rf $dir |
3223 |
27 Apr 09 |
gregory |
42 |
fi |
3223 |
27 Apr 09 |
gregory |
43 |
done |
3488 |
16 Nov 09 |
gregory |
44 |
} |
3488 |
16 Nov 09 |
gregory |
45 |
|
3489 |
16 Nov 09 |
gregory |
46 |
case $arg1 in |
3488 |
16 Nov 09 |
gregory |
47 |
clean) |
3488 |
16 Nov 09 |
gregory |
48 |
clean |
3223 |
27 Apr 09 |
gregory |
49 |
exit |
3223 |
27 Apr 09 |
gregory |
50 |
;; |
3242 |
28 Apr 09 |
gregory |
51 |
all) |
3487 |
16 Nov 09 |
gregory |
52 |
for ttt in ./tests/*.sh |
3223 |
27 Apr 09 |
gregory |
53 |
do |
3487 |
16 Nov 09 |
gregory |
54 |
test $ttt |
3488 |
16 Nov 09 |
gregory |
55 |
sleep 0.5 |
3223 |
27 Apr 09 |
gregory |
56 |
done |
3223 |
27 Apr 09 |
gregory |
57 |
;; |
3489 |
16 Nov 09 |
gregory |
58 |
list) |
3489 |
16 Nov 09 |
gregory |
59 |
for t in tests/* |
3489 |
16 Nov 09 |
gregory |
60 |
do |
3489 |
16 Nov 09 |
gregory |
61 |
c=`head -1 $t` |
3489 |
16 Nov 09 |
gregory |
62 |
echo $t $c |
3489 |
16 Nov 09 |
gregory |
63 |
done |
3489 |
16 Nov 09 |
gregory |
64 |
;; |
3242 |
28 Apr 09 |
gregory |
65 |
*) |
3489 |
16 Nov 09 |
gregory |
66 |
if [ -e ./tests/t${arg1}.sh ]; then |
3489 |
16 Nov 09 |
gregory |
67 |
test ./tests/t${arg1}.sh |
3486 |
16 Nov 09 |
gregory |
68 |
else |
3242 |
28 Apr 09 |
gregory |
69 |
cat <<EOF |
3489 |
16 Nov 09 |
gregory |
70 |
Usage: $0 [TESTID|all|clean|list] [-v] |
3242 |
28 Apr 09 |
gregory |
71 |
EOF |
3486 |
16 Nov 09 |
gregory |
72 |
fi |
3223 |
27 Apr 09 |
gregory |
73 |
esac |
3219 |
24 Apr 09 |
gregory |
74 |
|
3223 |
27 Apr 09 |
gregory |
75 |
|
3223 |
27 Apr 09 |
gregory |
76 |
|