-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.sh
executable file
·54 lines (46 loc) · 1.09 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
#!/bin/bash
#
# This is essentially just a crash test, not a proper unit test
#
testpass=0
testcount=0
CC=gcc
#CC=gcc-5
#CC=gcc-4.9
#CC=clang
function ctest() {
testcount=$(($testcount+1))
echo "Crash testing $1"
./lua $1 -o test.c
if [ $? -ne 0 ]; then
echo "Translation error: $1"
failedtests=$failedtests$1
else
$CC test.c
if [ $? -ne 0 ]; then
echo "Compilation error: $1"
failedtests=$failedtests$1
else
./a.out
if [ $? -ne 0 ]; then
echo "Runtime error: $1"
failedtests=$failedtests$1
else
testpass=$(($testpass+1))
fi
fi
fi
}
ctest "tests/compile/arithmetic.lua"
ctest "tests/compile/basic.lua"
ctest "tests/compile/if.lua"
ctest "tests/compile/print.lua"
ctest "tests/compile/functions.lua"
ctest "tests/ass/test1.lua"
ctest "tests/ass/test2.lua"
ctest "tests/ass/test3.lua"
ctest "tests/ass/test4.lua"
ctest "tests/ass/test6.lua"
# Will not fix
#ctest "tests/ass/test5.lua"
printf "%d/%d crashtests passed\n" $testpass $testcount