-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.sh
executable file
·54 lines (42 loc) · 1.15 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
#!/bin/bash
mkdir -p results
for a in $(cat tests.txt); do
echo "Running test: $a"
error=0
mono $1 "tests/$a"
if [ $? -eq 0 ]; then
ilasm "tests/${a}.il" > /dev/null
if [ $? -eq 0 ]; then
peverify --verify all "tests/${a}.exe"
if [ $? -eq 0 ]; then
if [ -f "inputs/$a" ]; then
mono "tests/${a}.exe" < "inputs/$a" > "results/$a"
else
mono "tests/${a}.exe" > "results/$a"
fi
if [ $? -ne 0 ]; then
error=2
fi
else
error=2
fi
else
error=2
fi
else
error=1
fi
if [ $error -eq 1 ]; then
echo -n "error" > "results/$a"
elif [ $error -eq 2 ]; then
echo -n "critical_error" > "results/$a"
fi
done
echo "Errors detected:" > errors.txt
for a in $(cat tests.txt); do
diff -b "expected_results/$a" "results/$a" > /dev/null
if [ $? -ne 0 ]; then
echo -e "\nTest: $a" >> errors.txt
diff -b "expected_results/$a" "results/$a" >> errors.txt
fi
done