This repository has been archived by the owner on Mar 2, 2023. It is now read-only.
/
test
executable file
·124 lines (112 loc) · 3.27 KB
/
test
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
i#!/bin/bash
if [ -e success.txt ];
then
rm success.txt
fi
if [ -e failed.txt ];
then
rm failed.txt
fi
touch success.txt
touch failed.txt
## run all the success programs
for i in `ls ./tests/exprs/*.prog | sort`;
do
echo "Testing file", $i
python ./ezhil/exprs.py $i $1
if [ $? -eq 0 ]
then
echo $i >> success.txt
else
echo $i >> failed.txt
fi
sleep 0
done
# run tests for Ezhil as well
cd ./tests
for i in `echo oklex.n badlex.n hello.n fact.n ranges.n gcd.n printtest.n vannakm.n temple.n lex2.n\
ifchain.n fern.n கூட்டு.n strings.n tables.n calc_asmd.n list.n \
string_demo.n list_ta.n yinyang.n unaryop.n boolean.n chaos.n \
prime.n array1.n array2.n filedemo.n filerw.n reverse.n friends.n \
palindromes.n ford2.n trials.n fornested.n loopupdate.n foreach.n foriter.n \
dowhile.n select_case2.n magic_coins.n rich_poor.n peanut_candy.n logical_not.n \
binary.n fibo.n floatpthole.n ifnested.n hailstone.n split_text.n lcmgcd.n \
windoze.n convert2kelvin.n dict.n speedoflight.n tictok.n \
change.n solo_return.n listmt.n predicates.n sexpr.n dict_ta.n \
fruity.n optional.n sine_qua_non.n armstrong.n array0.n array_nd.n \
tamil_letters.n tamil_months.n tower_of_hanoi.n hanoi.n \
max_wo_compare.n powers_of_two.n sum_of_digits.n bmi.n isbalanced.n mangalyaan.n \
neuron.n varavu_selavu.n calc2.n name_var.n py1.n demoif.n | sort`
do
echo "Testing Ezhil script","python ../ezhil/ezhil.py $i $1"
python ../ezhil/ezhil.py $i $1
if [ $? -eq 0 ]
then
echo $i >> ../success.txt
else
echo $i >> ../failed.txt
fi
sleep 0
done
if [ -e names.txt ];
then
rm names.txt
fi
cd ../
echo "**************************************************"
echo " Running Web tests"
echo "**************************************************"
# this test needs Ezhil to be installed via pip
python ./web/ezhil_web.py
if [ $? -eq 0 ]
then
echo "ezhil_web.py" >> success.txt
else
echo "ezhil_web.py" >> failed.txt
fi
echo "**************************************************"
echo " Running all the failure programs, that must fail."
echo "**************************************************"
sleep 2
for i in `ls ./tests/*.fprog`;
do
echo "Testing file", $i
python ./ezhil/exprs.py $i $1
if [ $? -eq 0 ]
then
echo $i >> failed.txt
else
echo $i >> success.txt
fi
sleep 0
done
echo "**********Successful Tests**********"
cat success.txt
echo "*************************************"
echo "***********Failed Tests**************"
cat failed.txt
echo "***********Summary******************"
echo "Passed = "`wc -l success.txt`", Failed = "`wc -l failed.txt`
# number of failures is always limited, and when you add
# failed tests you have to bump this up.
NFAIL=7 #02/06/15
TOTFAIL=`wc -l failed.txt | cut -d'f' -f1`
echo "from sys import exit; ( $TOTFAIL <= $NFAIL ) and exit(0) or exit(255)" | python
if [ $? -eq 0 ]
then
echo "Expected failures"
exitcode=0 # success
else
echo "Expecting $NFAIL failures, but found $TOTFAIL failures"
echo "Too few/many failures; some negative tests may have failed"
echo ""
echo "######### LIST OF FAILED FILES ##############"
cat failed.txt
echo " "
exitcode=255 #failed failures != $NFAIL
exit $exitcode
fi
# cleanup
rm failed.txt
rm success.txt
exit $exitcode