diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-04-30 13:07:27 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-04-30 13:07:27 +0200 |
| commit | c05e3fcec1623deb9c2fa4b023b1e2a6dc289bbb (patch) | |
| tree | 0ffc9f99d3f9973e8f154c80086de3d98b6e0c3b | |
| parent | 645c51f7ea035c6531f0a23e101c2b5d2a4d6b48 (diff) | |
| download | tools.nes-c05e3fcec1623deb9c2fa4b023b1e2a6dc289bbb.tar.gz tools.nes-c05e3fcec1623deb9c2fa4b023b1e2a6dc289bbb.zip | |
tests: adapt to the new 'unused' checks
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
| -rwxr-xr-x | scripts/test-e2e.sh | 34 | ||||
| -rw-r--r-- | tests/expected/unused-warning.txt | 4 | ||||
| -rw-r--r-- | tests/expected/unused.nes | bin | 22 -> 23 bytes | |||
| -rw-r--r-- | tests/unused.s | 16 |
4 files changed, 35 insertions, 19 deletions
diff --git a/scripts/test-e2e.sh b/scripts/test-e2e.sh index b25b50b..af11742 100755 --- a/scripts/test-e2e.sh +++ b/scripts/test-e2e.sh @@ -50,7 +50,7 @@ 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 +./target/debug/nasm -c empty --asan -o tests/out/unused.nes tests/unused.s 2> >(sort > 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 @@ -117,7 +117,7 @@ exit_code=$((exit_code + $?)) # doesn't matter that much as they are small programs. echo "test: code.nes => basics/sprite.nes" -$AS65 --no-errors -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/basics/sprite.s +$AS65 --no-errors --allow-unused -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" @@ -129,11 +129,11 @@ $AS65 --no-errors -b ./target/debug/nasm -C tests/code.nes/config/mmc1.cfg -o /d exit_code=$((exit_code + $?)) echo "test: code.nes => basics/flicker.nes" -$AS65 --no-errors -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/basics/flicker.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/unrom.cfg -o /dev/null tests/code.nes/basics/unrom.s +$AS65 --no-errors --allow-unused -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" @@ -141,54 +141,54 @@ $AS65 --no-errors -b ./target/debug/nasm -C tests/code.nes/config/unrom.cfg -o / exit_code=$((exit_code + $?)) echo "test: code.nes => fx/blink.nes" -$AS65 --no-errors -b ./target/debug/nasm -C tests/code.nes/config/mmc3.cfg -o /dev/null tests/code.nes/fx/blink.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/scroll/toggle.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/scroll/level.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/scroll/sprite0.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/mmc3.cfg -o /dev/null tests/code.nes/scroll/mmc3.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/rand/rand.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/mmc3.cfg -o /dev/null tests/code.nes/scroll/roulette.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/code.nes/config/nrom.cfg -o /dev/null tests/code.nes/space/src/space.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/1.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/2.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/3.s +$AS65 --no-errors --allow-unused -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 -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/4.s +$AS65 --no-errors --allow-unused -b ./target/debug/nasm -C tests/cfg/nrom65.cfg -o /dev/null tests/aoc2023.nes/src/4.s exit_code=$((exit_code + $?)) ## @@ -205,7 +205,7 @@ echo "LEVEL = 0" >> tests/jetpac.nes/config/generated.s # NOTE: we use '--stats' as otherwise the 'segments.txt' file would be removed # from the jetpac.nes repository, and the submodule would then be marked with # "-dirty". -$AS65 --no-errors --strict --stats -b ./target/debug/nasm -C tests/jetpac.nes/config/nrom.cfg -o /dev/null tests/jetpac.nes/src/jetpac.s 1>/dev/null +$AS65 --no-errors --allow-unused --strict --stats -b ./target/debug/nasm -C tests/jetpac.nes/config/nrom.cfg -o /dev/null tests/jetpac.nes/src/jetpac.s 1>/dev/null # Remove the generated.s file to avoid git from thinking we have modified the # project in any meaningful way. diff --git a/tests/expected/unused-warning.txt b/tests/expected/unused-warning.txt index fa97d8d..0451160 100644 --- a/tests/expected/unused-warning.txt +++ b/tests/expected/unused-warning.txt @@ -1 +1,3 @@ -warning: variable 'zp_unused' ($00) is unused (unused.s) +warning: macro argument 'UNUSED_ARG' is unused (unused.s) +warning: macro 'UNUSED_MACRO' is unused (unused.s) +warning: variable 'zp_unused' is unused (unused.s) diff --git a/tests/expected/unused.nes b/tests/expected/unused.nes Binary files differindex 055b6ec..ea60c01 100644 --- a/tests/expected/unused.nes +++ b/tests/expected/unused.nes diff --git a/tests/unused.s b/tests/unused.s index 938794d..2f0bb32 100644 --- a/tests/unused.s +++ b/tests/unused.s @@ -7,9 +7,23 @@ .segment "CODE" +;;; Macros + +.macro USED_MACRO UNUSED_ARG + nop +.endmacro + +.macro UNUSED_MACRO ARG1 + lda ARG1 +.endmacro + +USED_MACRO 1 + +;;; Variables + zp_unused = $00 zp_used = $01 -zp_another = $02 ; asan:ignore +zp_another = $02 ; check:ignore zp_more = $03 zp_yet = $04 |
