From 711fba5e3541c8c0d51e18fa1756176e3ee9934d Mon Sep 17 00:00:00 2001 From: Rangi Date: Wed, 8 Oct 2025 13:08:51 -0400 Subject: [PATCH] Add more tests for things that only the external tests had covered --- test/asm/abort-on-missing-incbin-start.asm | 3 +++ test/asm/abort-on-missing-incbin-start.flags | 1 + test/asm/abort-on-missing-incbin.asm | 2 +- test/asm/const-low.asm | 10 ++++++++++ test/asm/const-low.err | 5 +++++ test/asm/flag-Q.asm | 2 ++ test/asm/flag-Q.flags | 1 + test/asm/flag-Q.out.bin | 1 + test/asm/flag-p.asm | 4 ++++ test/asm/flag-p.flags | 1 + test/asm/flag-p.out.bin | 1 + test/asm/incbin.asm | 4 ++++ test/asm/incbin.out.bin | 1 + test/asm/make-deps.asm | 2 ++ test/asm/make-deps.flags | 2 +- test/asm/make-deps.out | 2 ++ test/link/export-all/a.asm | 2 ++ test/link/export-all/b.asm | 2 ++ test/link/export-all/out.err | 0 test/link/export-all/ref.out.bin | Bin 0 -> 2 bytes test/link/export-all/ref.out.sym | 2 ++ test/link/test.sh | 11 +++++++++++ 22 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 test/asm/abort-on-missing-incbin-start.asm create mode 100644 test/asm/abort-on-missing-incbin-start.flags create mode 100644 test/asm/const-low.asm create mode 100644 test/asm/const-low.err create mode 100644 test/asm/flag-Q.asm create mode 100644 test/asm/flag-Q.flags create mode 100644 test/asm/flag-Q.out.bin create mode 100644 test/asm/flag-p.asm create mode 100644 test/asm/flag-p.flags create mode 100644 test/asm/flag-p.out.bin create mode 100644 test/asm/incbin.asm create mode 100644 test/asm/incbin.out.bin create mode 100644 test/link/export-all/a.asm create mode 100644 test/link/export-all/b.asm create mode 100644 test/link/export-all/out.err create mode 100644 test/link/export-all/ref.out.bin create mode 100644 test/link/export-all/ref.out.sym diff --git a/test/asm/abort-on-missing-incbin-start.asm b/test/asm/abort-on-missing-incbin-start.asm new file mode 100644 index 00000000..4f837216 --- /dev/null +++ b/test/asm/abort-on-missing-incbin-start.asm @@ -0,0 +1,3 @@ +section "test", rom0 +incbin "incbin-mg-noexist.bin", 2 +println "never reached" diff --git a/test/asm/abort-on-missing-incbin-start.flags b/test/asm/abort-on-missing-incbin-start.flags new file mode 100644 index 00000000..864229c4 --- /dev/null +++ b/test/asm/abort-on-missing-incbin-start.flags @@ -0,0 +1 @@ +-MG diff --git a/test/asm/abort-on-missing-incbin.asm b/test/asm/abort-on-missing-incbin.asm index 4f837216..4681e055 100644 --- a/test/asm/abort-on-missing-incbin.asm +++ b/test/asm/abort-on-missing-incbin.asm @@ -1,3 +1,3 @@ section "test", rom0 -incbin "incbin-mg-noexist.bin", 2 +incbin "incbin-mg-noexist.bin" println "never reached" diff --git a/test/asm/const-low.asm b/test/asm/const-low.asm new file mode 100644 index 00000000..7f90bb04 --- /dev/null +++ b/test/asm/const-low.asm @@ -0,0 +1,10 @@ +section "good", romx, align[8, 1] +Alpha: +static_assert LOW(Alpha) == 1 +db 99 +Beta: +static_assert LOW(Beta) == 2 + +section "bad", romx, align[7, 3] +Gamma: +static_assert LOW(Gamma) == 3 diff --git a/test/asm/const-low.err b/test/asm/const-low.err new file mode 100644 index 00000000..cd2bdc06 --- /dev/null +++ b/test/asm/const-low.err @@ -0,0 +1,5 @@ +error: Expected constant expression: `Gamma` is not constant at assembly time + at const-low.asm(10) +error: Assertion failed + at const-low.asm(10) +Assembly aborted with 2 errors! diff --git a/test/asm/flag-Q.asm b/test/asm/flag-Q.asm new file mode 100644 index 00000000..de6e86a3 --- /dev/null +++ b/test/asm/flag-Q.asm @@ -0,0 +1,2 @@ +section "test", rom0 +dl 3.14159 diff --git a/test/asm/flag-Q.flags b/test/asm/flag-Q.flags new file mode 100644 index 00000000..840bd78c --- /dev/null +++ b/test/asm/flag-Q.flags @@ -0,0 +1 @@ +-Q .24 diff --git a/test/asm/flag-Q.out.bin b/test/asm/flag-Q.out.bin new file mode 100644 index 00000000..468d2541 --- /dev/null +++ b/test/asm/flag-Q.out.bin @@ -0,0 +1 @@ +>?$ \ No newline at end of file diff --git a/test/asm/flag-p.asm b/test/asm/flag-p.asm new file mode 100644 index 00000000..188fdc31 --- /dev/null +++ b/test/asm/flag-p.asm @@ -0,0 +1,4 @@ +section "test", rom0 +db 1, 2, 3 +ds 3 +db 4, 5, 6 diff --git a/test/asm/flag-p.flags b/test/asm/flag-p.flags new file mode 100644 index 00000000..8bc7171f --- /dev/null +++ b/test/asm/flag-p.flags @@ -0,0 +1 @@ +-p 0x42 diff --git a/test/asm/flag-p.out.bin b/test/asm/flag-p.out.bin new file mode 100644 index 00000000..71d2a01f --- /dev/null +++ b/test/asm/flag-p.out.bin @@ -0,0 +1 @@ +BBB \ No newline at end of file diff --git a/test/asm/incbin.asm b/test/asm/incbin.asm new file mode 100644 index 00000000..34ff1754 --- /dev/null +++ b/test/asm/incbin.asm @@ -0,0 +1,4 @@ +section "test", rom0 +incbin "data.bin" +incbin "data.bin", $70 +incbin "data.bin", $20, 10 diff --git a/test/asm/incbin.out.bin b/test/asm/incbin.out.bin new file mode 100644 index 00000000..3a1b5da2 --- /dev/null +++ b/test/asm/incbin.out.bin @@ -0,0 +1 @@ +Q+)W-N^wY7F׾ cʃ.Yz+т'挮g}!XX6"]|6`93Qu/]@-baD$sF$!B(x yܽ {@O  {@O +т \ No newline at end of file diff --git a/test/asm/make-deps.asm b/test/asm/make-deps.asm index e69de29b..10ddcdb0 100644 --- a/test/asm/make-deps.asm +++ b/test/asm/make-deps.asm @@ -0,0 +1,2 @@ +section "test", rom0 +incbin "data.bin" diff --git a/test/asm/make-deps.flags b/test/asm/make-deps.flags index 79d5c00e..f717628b 100644 --- a/test/asm/make-deps.flags +++ b/test/asm/make-deps.flags @@ -1 +1 @@ --M - -MT preserve$dollars$$ -MQ escape$dollars$$ +-M - -MT preserve$dollars$$ -MQ escape$dollars$$ -MP diff --git a/test/asm/make-deps.out b/test/asm/make-deps.out index 201f4867..b549a94a 100644 --- a/test/asm/make-deps.out +++ b/test/asm/make-deps.out @@ -1 +1,3 @@ preserve$dollars$$ escape$$dollars$$$$: make-deps.asm +preserve$dollars$$ escape$$dollars$$$$: data.bin +data.bin: diff --git a/test/link/export-all/a.asm b/test/link/export-all/a.asm new file mode 100644 index 00000000..66cd91c0 --- /dev/null +++ b/test/link/export-all/a.asm @@ -0,0 +1,2 @@ +section "a", rom0[2] +OneColon: diff --git a/test/link/export-all/b.asm b/test/link/export-all/b.asm new file mode 100644 index 00000000..37a5215d --- /dev/null +++ b/test/link/export-all/b.asm @@ -0,0 +1,2 @@ +section "b", rom0[0] +dw OneColon diff --git a/test/link/export-all/out.err b/test/link/export-all/out.err new file mode 100644 index 00000000..e69de29b diff --git a/test/link/export-all/ref.out.bin b/test/link/export-all/ref.out.bin new file mode 100644 index 0000000000000000000000000000000000000000..5407bf3ddf8b5ca61b411342fe54921a2bbb0ec2 GIT binary patch literal 2 JcmZQ#0000600RI3 literal 0 HcmV?d00001 diff --git a/test/link/export-all/ref.out.sym b/test/link/export-all/ref.out.sym new file mode 100644 index 00000000..33bcb112 --- /dev/null +++ b/test/link/export-all/ref.out.sym @@ -0,0 +1,2 @@ +; File generated by rgblink +00:0002 OneColon diff --git a/test/link/test.sh b/test/link/test.sh index 63a4d2e3..78533e7f 100755 --- a/test/link/test.sh +++ b/test/link/test.sh @@ -162,6 +162,17 @@ tryDiff "$test"/ref.out.sym "$outtemp2" tryCmpRom "$test"/ref.out.bin evaluateTest +test="export-all" +startTest +"$RGBASM" -E -o "$otemp" "$test"/a.asm +"$RGBASM" -o "$gbtemp2" "$test"/b.asm +continueTest +rgblinkQuiet -o "$gbtemp" -n "$outtemp2" "$otemp" "$gbtemp2" 2>"$outtemp" +tryDiff "$test"/out.err "$outtemp" +tryDiff "$test"/ref.out.sym "$outtemp2" +tryCmpRom "$test"/ref.out.bin +evaluateTest + for test in fragment-align/*; do startTest "$RGBASM" -o "$otemp" "$test"/a.asm