/
testall.sh
executable file
·59 lines (45 loc) · 1.21 KB
/
testall.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
#!/bin/bash
HECKELL="./heckell"
# Path to the LLVM interpreter
LLI="lli"
# Path to the LLVM compiler
LLC="llc"
# Path to the C compiler
CC="cc"
# Set time limit for all operations
ulimit -t 30
globallog=testall.log
rm -f $globallog
Compare() {
if diff $1 $2 &> /dev/null ; then
echo "SUCCESS"
else
echo "FAIL"
cat $1
cat $2
fi
}
files="tests/test-*.hck tests/fail-*.hck"
for file in $files
do
basename=`echo $file | sed 's/.*\\///
s/.hck//'`
echo -n "$basename..."
case $file in
*test-*)
$HECKELL $file > "tests/${basename}.ll"
$LLC "tests/${basename}.ll" > "tests/${basename}.s"
$CC -o "tests/${basename}.exe" "tests/${basename}.s" "ut-sets.o"
"./tests/${basename}.exe" > "tests/${basename}.diff"
Compare tests/${basename}.diff tests/${basename}.out
;;
*fail-*)
$HECKELL $file 2> "tests/${basename}.diff"
Compare tests/${basename}.diff tests/${basename}.err
;;
*)
echo "unknown file type $file"
esac
# Remove generated file
rm -f tests/${basename}.diff tests/${basename}.ll tests/${basename}.exe tests/${basename}.s
done