forked from imunes/imunes-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestAll.sh
executable file
·89 lines (78 loc) · 1.55 KB
/
testAll.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
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
if [ "`whoami`" != "root" ]; then
echo "Run this as root!"
echo ""
exit 1
fi
. common/start_functions.sh
sequential=0
if test "$1" = "seq"; then
sequential=1
fi
if isOSlinux; then
sequential=1
fi
imunes -i
tests="DHCP DHCP6+RSOL DNS+Mail+WEB OSPF Ping RIP BGP Traceroute services"
if isOSfreebsd; then
tests="$tests functional_tests/rj45_vlan gif"
fi
echo "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*"
echo "# Running tests in:"
echo -n "# "
for dir in $tests; do
echo -n "$dir "
cd $dir
if test "$dir" = "ipsec/"; then
for i in 44 46 64 66; do
if [ $sequential -eq 1 ]; then
sh "test${i}.sh" > TESTRESULTS_$i 2>&1
else
sh "test${i}.sh" > TESTRESULTS_$i 2>&1 &
pids="$pids $!"
fi
done
else
if [ $sequential -eq 1 ]; then
sh test.sh > TESTRESULTS 2>&1
else
sh test.sh > TESTRESULTS 2>&1 &
pids="$pids $!"
fi
fi
cd - > /dev/null
done
if test ! -z "$pids" ; then
running=1;
echo ""
echo "Some tests are still running in the background."
echo "Please wait until everything has finished."
echo ""
echo -n "Running ."
while test $running -eq 1
do
running=0
for p in $pids
do
ps $p > /dev/null 2>&1
if test $? -eq 0; then
running=1
sleep 3
echo -n .
break
fi
done
done
echo ""
fi
echo "Finished."
grep "^There were errors." */TESTRESULTS* > /dev/null 2>&1
if test $? -eq 0
then
echo ""
echo "Please look at the logs:"
grep "^There were errors." */TESTRESULTS* */*/TESTRESULTS*
exit 1
else
echo "OK."
fi