-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.sh
executable file
·42 lines (38 loc) · 1.21 KB
/
run_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
#!/bin/bash
SRCDIR="test/src/"
OUTDIR="test/output/"
RESULTDIR="test/results/"
# Compile tests
for entry in ${SRCDIR}*.glmp
do
filename=$(b=${entry##*/}; echo ${b%.*})
./build/glomp -c -o $OUTDIR$filename $entry
done
# Generate output from compiled tests and compare to previous output
for entry in $OUTDIR*
do
name=$(b=${entry##*/}; echo ${b%.*})
bash -c "./$entry 2>&1 | tee ${RESULTDIR}${name}_com.txt &>/dev/null"
diff ${RESULTDIR}${name}.txt ${RESULTDIR}${name}_com.txt &>/dev/null
if [ $? -gt 0 ]; then
echo Compiler test failed: $name
echo expected:
echo `cat ${RESULTDIR}${name}.txt`
echo got:
echo `cat ${RESULTDIR}${name}_com.txt`
fi
done
# Generate output from interpreted tests and compare to previous output
for entry in $SRCDIR*
do
name=$(b=${entry##*/}; echo ${b%.*})
bash -c "./build/glomp -i $entry 2>&1 | tee ${RESULTDIR}${name}_int.txt &>/dev/null"
diff ${RESULTDIR}${name}.txt ${RESULTDIR}${name}_int.txt &>/dev/null
if [ $? -gt 0 ]; then
echo Interpreter test failed: $name
echo expected:
echo `cat ${RESULTDIR}${name}.txt`
echo got:
echo `cat ${RESULTDIR}${name}_int.txt`
fi
done