forked from Ezhil-Language-Foundation/open-tamil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunittest3
executable file
·53 lines (46 loc) · 971 Bytes
/
unittest3
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
#!/bin/bash
# run unittests on Python 3
# run unit tests when previous bits passed
export PYTHONPATH=`pwd`:$PYTHONPATH
cd tests/
if [ -e success3.txt ];
then
rm success3.txt
fi
if [ -e failed3.txt ];
then
rm failed3.txt
fi
touch success3.txt
touch failed3.txt
for i in `ls *.py`
do
echo Running test $i
sleep 1
python3 $i
if [ $? -eq 0 ]
then
echo $i >> success3.txt
else
echo $i >> failed3.txt
fi
done
NFAIL=0 #ideally no unittests should fail
TOTFAIL=`wc -l failed3.txt | cut -d'f' -f1`
echo "from sys import exit; exit( $TOTFAIL != $NFAIL )" | python3
if [ $? -eq 0 ]
then
echo "Testing Successful!"
exitcode=0 # success
else
cat failed3.txt
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 failed3.txt
rm success3.txt
rm -fr ./tmp*
cd ../
exit $exitcode