-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.sh
53 lines (41 loc) · 952 Bytes
/
tests.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
#!/bin/sh
# Regression demo script for Handl (interpreted from MicroC and CFlat)
# LLVM interpreter
LLI="lli"
#LLI="/usr/local/opt/llvm/bin/lli"
# LLVM compiler
LLC="llc"
# C compiler
CC="cc"
# Path to Handl compiler
HANDL="./handl.native"
# Set time limit for all operations
ulimit -t 30
globallog=testall.log
rm -f $globallog
error=0
globalerror=0
keep=0
Usage() {
echo "Usage: tests.sh"
exit 1
}
Run() {
echo $* 1>&2
eval $* || {
SignalError "$1 failed on $*"
return 1
}
}
Run "mkdir test_results"
for file in ./tests/*
do
basename=`echo $file | sed 's/.*\\///
s/.hdl//'`
Run "$CC -c handlmusic.c"
Run "$HANDL" "$file" ">" "${basename}.ll" &&
Run "$LLC" "-relocation-model=pic" "${basename}.ll" ">" "${basename}.s" &&
Run "$CC" "-o" "${basename}.exe" "${basename}.s" "handlmusic.o" &&
Run "./${basename}.exe" > "./test_results/${basename}.out"
done
exit