forked from chpatrick/IMPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·55 lines (46 loc) · 1.04 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
55
#!/bin/bash
if [ -d tmp ]; then
echo "tmp directory exists, remove before continuing"
return 1
fi
mkdir tmp
echo ">>>> TESTING ASSEMBLER <<<<"
exitcode=0
warnings=0
for p in demos/*.s;
do
echo "$p:"
name="`basename $p .s`.oout"
assembler/assemble $p tmp/$name -q
exitcode=$(( $exitcode + $? ))
if [ -e demos/$name ]; then
diff demos/$name tmp/$name
else
echo ">>>> $name does not exist, skipping diff <<<<"
warnings=$(( $warnings + 1 ))
fi
exitcode=$(( $exitcode + $? ))
done
echo ">>>> TESTING EMULATOR <<<<"
for p in demos/*.oout;
do
echo "$p:"
name="`basename $p .oout`.res"
emulator/emulate $p > tmp/$name
exitcode=$(( $exitcode + $? ))
if [ -e demos/$name ]; then
diff demos/$name tmp/$name
else
echo ">>>> $name does not exist, skipping diff <<<<"
fi
exitcode=$(( $exitcode + $? ))
done
if [ $exitcode -eq 0 ]; then
echo ">>>> ALL TESTS PASSED <<<<"
rm -r tmp
else
echo ">>>> ERRORS DETECTED, CHECK ./tmp/ <<<<"
fi
if [ $warnings -ne 0 ]; then
echo ">>>> $warnings WARNINGS <<<<"
fi