-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_test.sh
executable file
·53 lines (50 loc) · 1.32 KB
/
run_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
#!/bin/bash
for file in test_progs/*.s; do
filename=$(echo $file | cut -d '/' -f2 | cut -d'.' -f1)
echo "Running $filename"
# build assembly
make assembly SOURCE=$file > /dev/null
# echo "Running $filename"
# simulate assembly
make > /dev/null
# echo "Saving $filename output"
# save program.out and writeback.out
cat program.out | grep "@@@" > ./outputs/$filename.program.out
mv writeback.out ./outputs/$filename.writeback.out
done
for file in test_progs/*.c; do
filename=$(echo $file | cut -d '/' -f2 | cut -d'.' -f1)
echo "Running $filename"
# build program
make program SOURCE=$file > /dev/null
# echo "Running $filename"
# simulate assembly
make > /dev/null
# echo "Saving $filename output"
# save program.out and writeback.out
cat program.out | grep "@@@" > ./outputs/$filename.program.out
mv writeback.out ./outputs/$filename.writeback.out
done
fail=0
for file in outputs/*.writeback.out; do
filename=$(echo $file | cut -d '/' -f2 | cut -d'.' -f1)
# diff the writebacks
diff -q $file "models/$filename.writeback.out" > /dev/null
if [ $? -ne 0 ]
then
# failed if different
echo "$filename failed!!!"
fail=1
continue
fi
diff -q outputs/$filename.program.out models/$filename.program.out > /dev/null
if [ $? -ne 0 ]
then
echo "$filename failed!!!"
fail=1
fi
done
if [ $fail -eq 0 ]
then
echo "All test passed."
fi