-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·57 lines (48 loc) · 1.48 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
56
57
#!/bin/bash
STATUS=0
printf "[+] Test: run all src under tests/ .\n"
for f in `ls tests/*.S`; do
cpuex_asm debug.output.o $f
cpuex_disasm debug.output.o | awk -F';' '{print $1}' > debug.output.disasm
diff -b debug.output.disasm $f.disasm.expected > /dev/null
ret=$?
if [ $ret -eq 0 ] ;then
printf "\e[32m$f: disasm passed.\e[m\n"
else
printf "\e[31m$f: disasm failed.\e[m\n"
diff $f.disasm.expected debug.output.disasm
STATUS=1
fi
if [ -e $f.input ]; then
cpuex_sim debug.output.o -i $f.input -o debug.uart.output > debug.output.exec
else
cpuex_sim debug.output.o -o debug.uart.output > debug.output.exec
fi
diff -b debug.output.exec $f.exec.expected > /dev/null
ret=$?
if [ $ret -eq 0 ] ;then
printf "\e[32m$f: exec passed.\e[m\n"
else
printf "\e[31m$f: exec failed.\e[m\n"
diff $f.exec.expected debug.output.exec
STATUS=1
fi
if [ -e $f.uart.expected ] ;then
diff -b debug.uart.output $f.uart.expected > /dev/null
ret=$?
if [ $ret -eq 0 ] ;then
printf "\e[32m$f: uart passed.\e[m\n"
else
printf "\e[31m$f: uart failed.\e[m\n"
diff $f.uart.expected debug.output.uart
STATUS=1
fi
fi
done
rm -rf debug.*
if [ $STATUS -eq 0 ]; then
printf "\e[32m[+] Yay! testing passed.\e[m\n"
else
printf "\e[31m[-] Oops, testing failed.\e[m\n"
fi
exit $STATUS