-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautotest_pc.sh
executable file
·76 lines (61 loc) · 1.84 KB
/
autotest_pc.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
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
#!/bin/bash
test_exe_path="."
test_res_dir="testres"
test_res_short="test_short.txt"
test_res_long="test_long.txt"
[ $1 ] && test_res_dir=$1
srcdir=src
genmake=genMakefile.sh
makecmd="make -k all" # -k to compile & test all that is compileable at the moment
# despite of the some test's compilation is failed
pref="atest"
suff="pc"
cleanexit(){
msgall $@
rm `ls | grep -Ev "Makefile|make.log|$test_res_short|$test_res_long"` -rf
#rm $srcdir obj mod -rf
exit
}
msgsh_n_io(){
echo $@
echo $@ >> $test_res_short
}
msglong(){
echo $@ >> $test_res_long
}
msgall(){
msgsh_n_io $@
msglong $@
}
[ -e $test_res_dir ] && echo $test_res_dir "already exists, please remove it or use another directory for test results" && exit
mkdir $test_res_dir
cd $test_res_dir
if [ $? -ne 0 ]
then
echo "cannot cd to " $test_res_dir "exit!" ; exit
fi
echo > $test_res_short
echo > $test_res_long
msgall `date`
cp -r ../$srcdir $srcdir
../$genmake || cleanexit "cannot generate Makefile. Exit!"
echo "making..."
$makecmd &>make.log || msgall "Warning: make errors, see make.log"
echo "make complete!"
for tst in `ls ../$srcdir/test/*/$pref*$suff.sh`
do
$tst &> tst.tmp
stat=$?
msglong ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
msglong "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
cat tst.tmp >> $test_res_long
tname=`head -n1 tst.tmp`
tres="undefined"
grep "pass" tst.tmp &>/dev/null && tres="passed"
grep "fail" tst.tmp &>/dev/null && tres="failed"
[ $stat -ne 0 ] && tres="failed"
msgsh_n_io $tname ":::" $tres
done
msgall ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
msgall "tests completed, please see results in " $test_res_dir"/"$test_res_short", "$test_res_dir"/"$test_res_long
cleanexit