forked from Ezhil-Language-Foundation/open-tamil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunittest
executable file
·50 lines (43 loc) · 876 Bytes
/
unittest
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
#!/bin/bash
# run unit tests when previous bits passed
cd tests/
if [ -e success.txt ];
then
rm success.txt
fi
if [ -e failed.txt ];
then
rm failed.txt
fi
touch success.txt
touch failed.txt
for i in `ls *.py`
do
echo Running test $i
sleep 1
python $i
if [ $? -eq 0 ]
then
echo $i >> success.txt
else
echo $i >> failed.txt
fi
done
NFAIL=0 #ideally no unittests should fail
TOTFAIL=`wc -l failed.txt | cut -d'f' -f1`
echo "from sys import exit; exit( $TOTFAIL != $NFAIL )" | python
if [ $? -eq 0 ]
then
echo "Testing Successful!"
exitcode=0 # success
else
echo "Expecting $NFAIL failures, but found $TOTFAIL failures"
echo "Too few/many failures; some negative tests may have failed"
exitcode=255 #failed failures != $NFAIL
fi
# cleanup
rm failed.txt
rm success.txt
rm -fr ./tmp*
cd ../
exit $exitcode