-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·65 lines (58 loc) · 1.05 KB
/
run_tests.sh
File metadata and controls
executable file
·65 lines (58 loc) · 1.05 KB
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
#!/bin/sh
ok="\033[1;32mOK\033[0m"
failed="\033[1;31mFailed\033[0m"
rm -f .failed
for i in demo/*.hs
do
(
b=$(basename $i .hs)
dir=$(mktemp -d)
cp LvInterpreter.in.lhs $dir/LvInterpreter.lhs
src="$dir/Test_$b.hs"
exe="Test_$b"
cat <<EOF > $src
import LvInterpreter
import Data.Sequence (fromList, elemIndexL)
import Data.List
import Data.Maybe
import Data.List.Split
main =
do
print vi
runVI vi
where vi = $b
EOF
cat testutil/* >> $src
cat $i >> $src
ghc -i. -i$dir -o $exe $src > /dev/null || {
rm LvInterpreter.lhs
echo -e "$failed compiling $src"
rm -rf "$dir"
touch .failed
exit 1
}
./$exe 2> /dev/null > $exe.out || {
echo -e "$failed running $exe"
rm -rf "$dir"
touch .failed
exit 1
}
rm -rf "$dir"
if diff $exe.out $exe.ref > /dev/null
then
echo -e "$ok! Test_$b"
else
echo -e "$failed! Test_$b"
touch .failed
exit 1
fi
) &
done
wait
if [ -e .failed ]
then
rm -f .failed
exit 1
fi
rm -f .failed
exit 0