blob: ab7312b30cae8b696ff2607a2a07ea7da65a9b37 (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
#!/usr/bin/env sh
# Instead of setting -e or something like that, we will accumulate errors and
# exit with the accumulated result at the end.
exit_code=0
AS65=${AS65:-"./target/debug/xa65"}
##
# Ensure git submodules are there and that the environment is set up correctly.
pushd tests
rm -rf out/
mkdir -p out/
if [ ! -d code.nes ]; then
echo "(error) You need 'code.nes' for end-to-end tests."
exit 1
fi
if [ ! -d aoc2023.nes ]; then
echo "(error) You need 'aoc2023.nes' for end-to-end tests."
exit 1
fi
popd
##
# Build.
echo "(info): build development binaries"
cargo build
##
# Custom tests.
echo "test: custom => defines-undefines.nes"
./target/debug/nasm -c empty -Werror -o tests/out/defines-undefined.nes tests/defines.s
diff tests/out/defines-undefined.nes tests/expected/defines-undefined.nes
exit_code=$((exit_code + $?))
echo "test: custom => defines-one.nes"
./target/debug/nasm -D LALA -c empty -Werror -o tests/out/defines-one.nes tests/defines.s
diff tests/out/defines-one.nes tests/expected/defines-one.nes
exit_code=$((exit_code + $?))
echo "test: custom => defines-two.nes"
./target/debug/nasm -D LALA=2 -c empty -Werror -o tests/out/defines-two.nes tests/defines.s
diff tests/out/defines-two.nes tests/expected/defines-two.nes
exit_code=$((exit_code + $?))
echo "test: custom => unused.nes"
./target/debug/nasm -c empty --asan -o tests/out/unused.nes tests/unused.s 2>tests/out/unused-warning.txt
diff tests/out/unused-warning.txt tests/expected/unused-warning.txt
exit_code=$((exit_code + $?))
diff tests/out/unused.nes tests/expected/unused.nes
exit_code=$((exit_code + $?))
echo "test: custom => bare_accesses.nes"
./target/debug/nasm -c empty --asan tests/bare_accesses.s 2>tests/out/bare_accesses.txt
diff tests/out/bare_accesses.txt tests/expected/bare_accesses.txt
exit_code=$((exit_code + $?))
##
# code.nes
echo "test: code.nes => basics/sprite.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/basics/sprite.s
exit_code=$((exit_code + $?))
echo "test: code.nes => basics/input.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/basics/input.s
exit_code=$((exit_code + $?))
echo "test: code.nes => basics/persist.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/mmc1.cfg -o /dev/null tests/code.nes/basics/persist.s
exit_code=$((exit_code + $?))
echo "test: code.nes => basics/flicker.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/basics/flicker.s
exit_code=$((exit_code + $?))
echo "test: code.nes => basics/unrom.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/unrom.cfg -o /dev/null tests/code.nes/basics/unrom.s
exit_code=$((exit_code + $?))
echo "test: code.nes => basics/chr-ram.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/unrom.cfg -o /dev/null tests/code.nes/basics/chr-ram.s
exit_code=$((exit_code + $?))
echo "test: code.nes => fx/blink.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/mmc3.cfg -o /dev/null tests/code.nes/fx/blink.s
exit_code=$((exit_code + $?))
echo "test: code.nes => scroll/toggle.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/scroll/toggle.s
exit_code=$((exit_code + $?))
echo "test: code.nes => scroll/level.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/scroll/level.s
exit_code=$((exit_code + $?))
echo "test: code.nes => scroll/sprite0.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/scroll/sprite0.s
exit_code=$((exit_code + $?))
echo "test: code.nes => scroll/mmc3.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/mmc3.cfg -o /dev/null tests/code.nes/scroll/mmc3.s
exit_code=$((exit_code + $?))
echo "test: code.nes => rand/rand.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/rand/rand.s
exit_code=$((exit_code + $?))
echo "test: code.nes => scroll/roulette.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/mmc3.cfg -o /dev/null tests/code.nes/scroll/roulette.s
exit_code=$((exit_code + $?))
echo "test: code.nes => space/space.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/space/src/space.s
exit_code=$((exit_code + $?))
##
# aoc2023.nes
echo "test: aoc2023.nes => 1.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/1.s
exit_code=$((exit_code + $?))
echo "test: aoc2023.nes => 2.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/2.s
exit_code=$((exit_code + $?))
echo "test: aoc2023.nes => 3.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/3.s
exit_code=$((exit_code + $?))
echo "test: aoc2023.nes => 4.nes"
$AS65 --no-errors --strict -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/4.s
exit_code=$((exit_code + $?))
##
# Done!
exit $exit_code
|