forked from Ezhil-Language-Foundation/Ezhil-Lang
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test
executable file
·171 lines (152 loc) · 4.21 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
# Tests for Ezhil language
# (C) 2007, 2008, 2013-2015 முத்தையா அண்ணாமலை
if [ -e success.txt ];
then
rm success.txt
fi
if [ -e failed.txt ];
then
rm failed.txt
fi
if [ -e dump_file ];
then
rm dump_file
fi
touch success.txt
touch failed.txt
touch dump_file
## run all the success programs
for i in `ls ./tests/exprs/*.prog | sort`;
do
echo "########## Testing file $i" | tee -a dump_file
python ./ezhil/exprs.py $i $1 2>&1 >> dump_file
if [ $? -eq 0 ]
then
echo $i >> success.txt
else
echo $i >> failed.txt
fi
sleep 0
done
# run tests for Ezhil as well
export EZHIL_DATA_PATH=`pwd`/tests/data
export EZHIL_TEST_PATH=`pwd`/tests/
cd ./tests
# last space important before the \
for i in `cat ../test_cases | sort`
do
echo "########## Testing Ezhil script $i $1" | tee -a ../dump_file
python ../ezhil/ezhil.py $i $1 2>&1 >> ../dump_file
if [ $? -eq 0 ]
then
echo $i >> ../success.txt
else
echo $i >> ../failed.txt
fi
sleep 0
done
unset EZHIL_DATA_PATH
echo "**********Special TSCII Test**********"
python ../ezhil/ezhil.py -tamilencoding tscii tscii_calc2.n | tee -a ../dump_file
if [ $? -eq 0 ]
then
echo "tscii_calc2.n" >> ../success.txt
else
echo "tscii_calc2.n" >> ../failed.txt
fi
echo "********************************************"
if [ -e names.txt ];
then
rm names.txt
fi
cd ../
echo "**************************************************"
echo " Running Web tests" | tee -a dump_file
echo "**************************************************"
# this test needs Ezhil to be installed via pip
python ./web/ezhil_web.py 2>&1 >> dump_file
if [ $? -eq 0 ]
then
echo "ezhil_web.py" >> success.txt
else
echo "ezhil_web.py" >> failed.txt
fi
echo "**************************************************"
echo " Running API tests"
echo "**************************************************"
cd web/ulle_veliye/
pip install -r requirements.txt
python manage.py test
cd -
echo "**************************************************"
echo " Running interactive tests " | tee -a dump_file
echo "***************************************************"
for i in `echo demos/ch2.n \
`
do
echo "ezhil" | python ./ezhil/ezhil.py ./tests/$i >> dump_file
if [ $? -eq 0 ]
then
echo "passed ezhil interactive test for $i" >> success.txt
else
echo "failed ezhil interactive test for $i" >> failed.txt
fi
done
echo "**************************************************"
echo " Running all the failure programs, that must fail."
echo "**************************************************"
for i in `ls ./tests/*.fprog ./tests/typecheck/semantic_error*.n`;
do
echo "Testing file $i" | tee -a dump_file
python ./ezhil/exprs.py $i $1 -stacksize 10 2>&1 >> dump_file
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.
# Known $NFAIL failures
# ./tests/exprs/arraysum.prog
# ./tests/exprs/condtest.prog
# ./tests/exprs/dim2d_array.prog
# ./tests/exprs/ifelseif.prog
# badlex.n
# temple.n
# solo_return.n
# boolf.n
# nonexistent_file.n
# eval1.n
# yinyang.n -- fails b/c of no X-window
NFAIL=13 #11/28/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" | tee -a dump_file
exitcode=0 # success
else
echo "Expecting $NFAIL failures, but found $TOTFAIL failures" | tee -a dump_file
echo "Too few/many failures; some negative tests may have failed" | tee -a dump_file
echo "" | tee -a dump_file
echo "######### LIST OF FAILED FILES ##############" | tee -a dump_file
cat failed.txt | tee -a dump_file
echo " " | tee -a dump_file
exitcode=255 #failed failures != $NFAIL
exit $exitcode
fi
# cleanup
rm failed.txt
rm success.txt
exit $exitcode