165 Commits

Author SHA1 Message Date
Jakub Kądziołka
1ffd7cb5bb Make tests work on NixOS
Some distributions, such as NixOS and Guix, only have the /bin/sh and
/usr/bin/env binaries in standard locations.
2021-04-16 16:38:04 +02:00
Rangi
a265b85d9d Report "1 error", not "1 errors", when assembly is aborted
This matches other such pluralized error messages
2021-03-28 15:55:32 -04:00
Rangi
7e7f92f18c Assign section locations to all UNIONs/FRAGMENTs
Fixes the test case from #800

The `out.gb` output was corrected, since the two "test"
fragments have a different order in ROM than in SRAM.
It is effectively:

; ROM0[$0000], fragments ordered by size
    jr Label
    dw Label
    db 0

; SRAM[$a000], fragments ordered by .o order
    ds 1  ; db 0
    ds 2  ; jr Label
Label:    ; $a003
    ds 2  ; dw Label
2021-03-28 15:21:17 -04:00
Eldred Habert
7461170956 Add LOAD FRAGMENT pc test (#800)
Reproduces a reported problem, fix pending
2021-03-28 15:11:20 -04:00
Rangi
8d1b56bcf5 rgblink identifies patches' PC sections after reading all sections
Fixes #794
2021-03-18 23:53:54 +01:00
Rangi
e7d6ddf593 Fix linking tiny overlay files (#755)
* Fix compatibility of rgblink -O and -t

The -t "tiny mode" option makes ROM0 cover 0x8000 bytes,
not 0x4000. The -O "overlay" option fills areas uncovered
by sections with data from an overlay file. These needed
to cooperate so that the calculated uncovered overlay size
does not exceed the actual size of the ROM.

Fixes #754

* Print link test names like asm tests do

* Make the three test.sh scripts more similar
2021-02-24 23:04:51 -05:00
Eldred Habert
dafef5a953 Remove column 1 restriction for labels with colons (#635)
Partial fix for #457
2021-02-23 14:42:24 -05:00
Rangi
037bc7abb3 Add an rgblink test case for an $8000-byte ROM0 section with -t 2021-02-21 16:30:02 -05:00
ISSOtm
76446e6d00 Change behavior of merging FRAGMENTs to constrain each fragment individually
Additionally, remove the deprecated merging of non-fragment SECTIONs
2021-02-10 10:19:16 +01:00
ISSOtm
7bc42d468b Clean up temp test files even if interrupted
Avoids "tmp.*" piling up in /tmp
2020-12-26 14:38:04 +01:00
Jakub Kądziołka
b421c983d6 link: Suppress cascading errors. 2020-10-04 18:14:22 +02:00
ISSOtm
baeb180acd Apply error reporting changes to tests 2020-10-04 04:45:58 +02:00
Eldred Habert
c6eacde55e Merge pull request #544 from ISSOtm/atomic_ind
Split register-indirect tokens
2020-08-05 10:52:18 +02:00
ISSOtm
6563133426 Avoid using echo -e in tests 2020-07-27 18:26:05 +02:00
ISSOtm
762474d3ac Let RGBASM write JR offsets in floating sections
This requires some special-casing for `jr @` because the `jr` opcode has
already been emitted, but not the operand, so PC points to the middle.
Moved the RGBLINK test to RGBASM's folder, and created a new RGBLINK test.
2020-07-27 18:17:29 +02:00
ISSOtm
ca6fa6d1d7 Split register-indirect tokens
This allows whitespace between the brackets and the register.
This also fixes #531

Note that `$ff00 + c` is still treated as a single token, because trying to
use an expression on the left side causes a shift/reduce conflict.
This isn't great, but most people seem to be either used to it as-is, or
using the new `ldh a, [c]` syntax.
If this causes problems with a lexer rewrite, it'll be deprecated; but for
now, keep it around, as the support is clunky but bearable.
2020-07-22 15:00:39 +02:00
ISSOtm
1f2f797cb9 Add section fragments
Fixes #517, and hopefully enables RGBDS as a SDCC back-end
2020-07-21 19:56:46 +02:00
James Larrowe
5c24de3dc4 Use inttypes for stdint types
This should help make RGBDS portable to systems with 16-bit integers,
like DOS.

For kicks, use the macros for 16-bit and 8-bit integers.

Fix other miscellaneous things, like #include ordering and other
printf-format related things.

Reduce repitition in math.c while I'm there.
2020-05-07 11:10:20 -04:00
ISSOtm
023a3c037f Properly handle missing symbols
Fixes #512
2020-04-12 22:52:32 +02:00
ISSOtm
b0ec8468e6 Allow specifying offset in addition to alignment 2020-04-08 00:40:41 +02:00
ISSOtm
190678107b Prevent RGBLINK from crashing when getting the bank of a constant 2020-04-07 20:41:29 +02:00
ISSOtm
82e0e4ffaf Make some RGBLINK errors non-fatal 2020-04-06 00:48:10 +02:00
ISSOtm
ffb199a26a Avoid Useless Use of backticks in rgblink testing 2020-04-06 00:44:59 +02:00
ISSOtm
175933d2b1 Remove old scripts for updating references for tests
I much rather prefer correcting everything by hand, and gauging
whether the change is good on a case by case basis
2020-04-06 00:41:37 +02:00
ISSOtm
92134d7684 Add testing for assertions inside unionized sections 2020-03-22 11:14:04 +01:00
ISSOtm
4877bb783c Add more tests for unionized sections + fix bugs
Implementing those tests found a few bugs... oops
2020-03-22 11:14:04 +01:00
ISSOtm
e123b6dec7 Implement unionized sections in RGBLINK 2020-03-22 11:13:39 +01:00
ISSOtm
fb58166e5d Add assertions
Closes #292
2020-03-21 23:00:38 +01:00
ISSOtm
eb445271df Remove carryover from RGBASM in RGBLINK tests 2020-03-20 21:50:38 +01:00
ISSOtm
8c4b473d6f Add more checks to section creation in RGBASM
Fixes rednex#471, but also backports a couple more checks from RGBLINK
2020-02-10 03:35:55 +01:00
ISSOtm
b42a04c24e Add test for jr @
Fun fact: current build *fails* this test!
2020-02-07 13:19:50 +01:00
ISSOtm
9687e6e1dd Allow forcing the second byte of STOP
Fixes #433
2020-02-07 10:06:02 +01:00
ISSOtm
ee34200e5f Output diffs when binary tests fail 2020-02-06 15:36:15 +01:00
ISSOtm
295fc6c619 Improve coverage of db-@ test 2020-02-05 13:24:50 +01:00
ISSOtm
35f7340dc9 Report failing test names in RGBLINK as well 2020-02-04 01:41:35 +01:00
ISSOtm
b1cd730db2 Add link-time RST instruction
This allows using a label as the argument to a `rst` instruction
Fixes rednex#448
2020-02-03 21:07:12 +01:00
ISSOtm
ed06981f57 Add test for db X, @
It should behave identically to both of these on separate lines
2020-01-28 21:04:41 +01:00
ISSOtm
1bd41bf79a Don't use diff to compare bin files in tests 2020-01-26 21:10:31 +01:00
Eldred Habert
fb81733b2b Merge pull request #472 from ISSOtm/romx-tiny
Allow ROMX and WRAMX sections in restricted modes
2020-01-26 14:48:32 +01:00
ISSOtm
1f8422575e Test that all-instructions does not error out 2020-01-21 03:05:22 +01:00
ISSOtm
61c381a62c Systemize RGBLINK testing 2020-01-21 03:01:58 +01:00
ISSOtm
71fe652556 Allow ROMX and WRAMX sections in restricted modes
Closes #462, although with this implementation `BANK("some ROMX section")` would
return 0 instead of 1, which I think is benign anyways
2020-01-16 22:24:05 +01:00
ISSOtm
2c52364978 Add test for fixed section addresses 2020-01-16 18:12:42 +01:00
ISSOtm
10140f74dc Allow RGBLINK to report multiple sanity check errors 2020-01-16 18:10:35 +01:00
ISSOtm
8a90d74340 Ignore line endings in test suite
This removes many false positives with Windows
2020-01-09 01:10:51 +01:00
Eldred Habert
c568b3a976 Merge pull request #439 from ISSOtm/tests_locale
Run tests under a specific locale
2019-11-03 16:30:38 +01:00
ISSOtm
0e24adcafd Rewrite RGBLINK entirely
The goal was to improve readability, but along the way a few things were
gained.
- Sorted sym and map files
- Infrastructure for supporting multiple .o versions
- Valgrind-proof, as far as my testing goes anyways
- Improved verbosity messages
- Added error checking
- Performance improvements, see end of commit message

The readability improvement was spurred while trying to make sense of the
old code while trying to implement features such as sorted sym and map
files.
I also did my best to remove hardcoded logic, such that modifications
should be doable; for example, "RAM loading" sections, which are linked
against a different location than the one they're stored at.

Some work remains to be done, see the "TODO:" and "FIXME:" comments.
Further, while regression tests pass, this new linker should be tested on
different codebases (ideally while instrumented with `make develop` and
under valgrind).
The few errors spotted in the man pages (alignment) need to be corrected.
Finally, documentation comments need to be written, I have written a lot of
them but not all.

This also provides a significant performance boost (benchmarked with a
51994-symbol project):

Current master RGBLINK:
2.02user 0.03system 0:02.06elapsed 99%CPU (0avgtext+0avgdata 84336maxresident)k
0inputs+11584outputs (0major+20729minor)pagefaults 0swaps

Rewritten RGBLINK:
0.19user 0.06system 0:00.63elapsed 40%CPU (0avgtext+0avgdata 32460maxresident)k
23784inputs+11576outputs (0major+7672minor)pagefaults 0swaps
2019-11-02 22:37:10 +01:00
ISSOtm
d76f994318 Run tests under a specific locale
Fixes #427
2019-10-10 13:23:36 +02:00
ISSOtm
dab5f59ed9 Fix location of all relevant SECTIONs in tests
If section placement is changed such that those are no longer guaranteed to be
placed at zero, tests would break when they shouldn't.
2019-09-23 01:28:48 +02:00
Anthony J. Bentley
a517f900e4 Use POSIX-compatible dd(1) instead of head -c. 2019-08-30 23:11:28 -06:00