-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·90 lines (73 loc) · 2.37 KB
/
test.sh
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
KATALOG="."
function testGood {
for TESTNAME in $1
do
extension="${TESTNAME##*.}"
filename="${TESTNAME%.*}"
basename=$(basename $filename)
if [[ "$extension" == "lat" ]]
then
STDERR="$(${KATALOG}/latc_x86_64 ${filename}.lat \. 2>&1)"
if [[ "$STDERR" != OK* ]]
then
echo "${KATALOG}/latc_x86_64 ${filename}.lat . && \"./${basename}\""
echo "${filename}: ERROR"
exit 1
fi
if [ -f "${filename}.input" ]
then
"./${basename}" > "${basename}.out" < "${filename}.input"
else
"./${basename}" > "${basename}.out"
fi
rm "${basename}"
rm "${basename}.s"
if diff "${filename}.output" "${basename}.out"; then
echo "${basename}: OK"
rm "${basename}.out"
else
if [ -f "${filename}.input" ]
then
echo "${KATALOG}/latc_x86_64 ${filename}.lat . && \"./${basename}\" < \"${filename}.input\""
else
echo "${KATALOG}/latc_x86_64 ${filename}.lat . && \"./${basename}\""
fi
echo "${basename}: ERROR"
rm "${basename}.out"
fi
fi
done
}
function testBad {
for TESTNAME in $1
do
extension="${TESTNAME##*.}"
filename="${TESTNAME%.*}"
if [[ "$extension" == "lat" ]]
then
STDERR="$(${KATALOG}/latc_x86_64 ${filename}.lat \. 2>&1)"
if [[ "$STDERR" != ERROR* ]]
then
rm "${filename}.out"
rm "${filename}"
echo "${KATALOG}/latc_x86_64 ${filename}.lat \."
echo "${filename}: ERROR"
else
echo "${filename}: OK"
fi
fi
done
}
testGood "samples/mine/*"
testGood "samples/good/*"
testGood "samples/extra/good/basic/*"
testBad "samples/bad/*"
testGood "samples/extra/bad/runtime/*"
testBad "samples/extra/bad/semantic/*"
testGood "samples/extra/good/arrays/*"
testGood "samples/extensions/arrays1/*"
testGood "samples/extensions/struct/*"
testGood "samples/extensions/objects1/*"
testGood "samples/extensions/objects2/*"
testGood "samples/extra/good/virtual/*"
testGood "samples/extra/gr5/*"