forked from Ezhil-Language-Foundation/Ezhil-Lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test3
executable file
·175 lines (160 loc) · 4.38 KB
/
test3
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
172
173
174
175
#!/bin/bash
# Tests for Ezhil language in Python 3
# (C) 2007, 2008, 2013-2015 முத்தையா அண்ணாமலை
MODEZHIL=`pwd`
if [ -e success3.txt ];
then
rm success3.txt
fi
if [ -e failed3.txt ];
then
rm failed3.txt
fi
if [ -e dump_file3 ];
then
rm dump_file3
fi
touch success3.txt
touch failed3.txt
touch dump_file3
export EZHIL_DATA_PATH=`pwd`/tests/data
export EZHIL_TEST_PATH=`pwd`/tests/
# run tests for Ezhil as well
cd ./tests
# last space important before the \
for i in `cat ../test_cases | sort`
do
echo "########## Testing Ezhil script $i" | tee -a ../dump_file3
PYTHONPATH=$MODEZHIL python3 -m ezhil $i 2>&1 >> ../dump_file3
if [ $? -eq 0 ];
then
echo $i >> ../success3.txt
else
echo $i >> ../failed3.txt
fi;
sleep 0
done
unset EZHIL_DATA_PATH
echo "**********Special TSCII Test**********"
PYTHONPATH=$MODEZHIL python3 -m ezhil -tamilencoding tscii tscii_calc2.n | tee -a ../dump_file3
if [ $? -eq 0 ];
then
echo "tscii_calc2.n" >> ../success3.txt
else
echo "tscii_calc2.n" >> ../failed3.txt
fi
echo "********************************************"
if [ -e names.txt ];
then
rm names.txt
fi
cd ../
echo "**************************************************"
echo " Running Web tests" | tee -a dump_file3
echo "**************************************************"
# this test needs Ezhil to be installed via pip
python3 ./web/ezhil_web.py 2>&1 >> dump_file3
if [ $? -eq 0 ]
then
echo "ezhil_web.py" >> success3.txt
else
echo "ezhil_web.py" >> failed3.txt
fi
echo "**************************************************"
echo " Running API tests"
echo "**************************************************"
cd web/ulle_veliye/
pip3 install -r requirements.txt
python3 manage.py test
cd -
echo "**************************************************"
echo " Running interactive tests " | tee -a dump_file3
echo "***************************************************"
for i in `echo demos/ch2.n \
`
do
echo "ezhil" | PYTHONPATH=$MODEZHIL python3 -m ezhil ./tests/$i >> dump_file3
if [ $? -eq 0 ]
then
echo "passed ezhil interactive test for $i" >> success3.txt
else
echo "failed ezhil interactive test for $i" >> failed3.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_file3
PYTHONPATH=$MODEZHIL python3 -m ezhil $i $1 -stacksize 10 2>&1 >> dump_file3
if [ $? -eq 0 ]
then
echo $i >> failed3.txt
else
echo $i >> success3.txt
fi
sleep 0
done
echo "**********Successful Tests**********"
cat success3.txt
echo "*************************************"
echo "***********Failed Tests**************"
cat failed3.txt
echo "***********Summary******************"
echo "Passed = "`wc -l success3.txt`", Failed = "`wc -l failed3.txt`
# number of failures is always limited, and when you add
# failed tests you have to bump this up.
# Known $NFAIL failures
# 1 badlex.n
# 2 bitwiseops.n
# 3 boolean_demorgan.n
# 4 boolean_fcns.n
# 5 boolean.n
# 6 boolf.n
# 7 chaos.n
# 8 dict.n
# 9 dict_ta.n
# 10 eval1.n
# 11 ezhil_web.py
# 12 fact.n
# 13 full_adder.n
# 14 gcd.n
# 15 half_adder.n
# 16 isbalanced.n
# 17 logical_not.n
# 18 math_geomprogression.n
# 19 math_goldenratio.n
# 20 morse.n
# 21 nonexistent_file.n
# 22 predicates.n
# 23 py1.n
# 24 solo_return.n
# 25 staircase_light.n
# 26 strings.n
# 27 tamil2.n
# 28 tamil_months.n
# 29 temple.n
# 30 unaryop.n
# 31 yinyang.n
NFAIL=26 #11/28/15
TOTFAIL=`wc -l failed3.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_file3
exitcode=0 # success
else
echo "Expecting $NFAIL failures, but found $TOTFAIL failures" | tee -a dump_file3
echo "Too few/many failures; some negative tests may have failed" | tee -a dump_file3
echo "" | tee -a dump_file3
echo "######### LIST OF FAILED FILES ##############" | tee -a dump_file3
cat failed3.txt | tee -a dump_file3
echo " " | tee -a dump_file3
exitcode=255 #failed failures != $NFAIL
exit $exitcode
fi
# cleanup
rm failed3.txt
rm success3.txt
exit $exitcode