-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·40 lines (28 loc) · 873 Bytes
/
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
#!/usr/bin/env bash
set -euo pipefail
clear
#RTS='+RTS -t -RTS'
RTS=
echo tests started
stack run -- $RTS --dis data/nestest.nes > data/dis.log
diff data/dis.log{.expected,} | head
echo - dis-nestest passed
stack run -- $RTS --emu data/nestest.nes > data/em.log
cmp data/em.log{.expected,}
echo - emu-nestest passed
echo tests done
exit
status=$?
rm diff.log
diff -u <(cat data/nestest.log-cut |
sed 's/@ .. = .... = ../ /' |
sed 's/@ .... = ../ /' |
sed 's/= .... @ .... = ../ /' |
sed 's/= .... / /' |
sed 's/@ .. / /' |
sed 's/= .. / /'
) em.log > diff.log
if [ ! -f diff.log ]; then echo '**no diffs**'; exit $status; fi
cat diff.log | sed '1,/^-/!d'
cat diff.log | grep -v ^+++ | grep ^[+] | head -1
exit 1