Commit Graph

126 Commits

Author SHA1 Message Date
ISSOtm
cd107855e7 Test new working label subtractions 2020-01-24 03:03:18 +01:00
ISSOtm
ab9307ac61 Clean up symbol management
Stop using that bitfield for everything, including what can be determined otherwise
It also makes it easier to have a sane state, since some bits were (supposedly)
mutually exclusive
2020-01-24 02:51:48 +01:00
ISSOtm
e3ef194b4f Remove local label error checking
This is actually not necessary, because RGBLINK would warn about missing labels.
Besides, through semi-esoteric ways, it is possible to define more labels in this scope,
and there's no reason to prevent that.
2020-01-24 02:51:48 +01:00
ISSOtm
51d5ff0567 Test subtracting labels 2020-01-24 02:50:24 +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
56d5f1588a Do not run .pipe tests if the normal variant fails
They'll most likely fail as well, just adding redundant error output
2020-01-21 00:27:28 +01:00
ISSOtm
c05334dfc1 Upgrade testing to latest disasm commits 2020-01-20 14:51:25 +01:00
ISSOtm
89917ef688 Put semicolons before labels in test suite 2020-01-16 22:09:31 +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
95cd0c6e53 Add test for BANK() in constant context 2020-01-12 13:09:27 +01:00
ISSOtm
23ab245cec Return a consistent number for const BANK() when erroring out 2020-01-12 13:07:48 +01:00
ISSOtm
f1f70d250a Add test for DEF(@) 2020-01-09 06:10:28 +01:00
ISSOtm
83249ed69f Cap the number of concurrent jobs for testing
This has a serious tendency to just blow up process load (~35 here with the shim)
2020-01-09 01:10:51 +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
ISSOtm
5a06fad31e Separate stdout and stderr in tests
POSIX leaves undefined the order of output if stderr is injected into stdout,
and in practice it differs on Windows (Linux buffers both streams separately,
Windows interleaves them as they arrive without buffering).
This should help testing on other platforms
2020-01-09 01:10:51 +01:00
Eldred Habert
676800476d Merge pull request #430 from ISSOtm/known_selfbank
Make `BANK(@)` and `BANK("section")` known to RGBASM
2020-01-08 18:56:28 +01:00
ISSOtm
8a1e920e23 Fix incorrect line counting when running REPT blocks.
Fixes #461
2019-12-12 23:46:16 +01:00
ISSOtm
d23401316e Improve pc-bank test 2019-12-07 23:44:00 +01:00
ISSOtm
e4f4706508 Add tests for new "known self-bank" 2019-12-07 22:15:07 +01:00
ISSOtm
b1d4be66e4 Remove deprecated "section charmap" feature 2019-12-04 01:56:06 +01:00
ISSOtm
9976a139de Update test repos to latest commits
They work, and after an upcoming change the current ones are not
going to anymore!
2019-12-04 01:54:22 +01:00
ISSOtm
191ee4ba1f Add support for toggleable warnings 2019-11-18 20:45:21 +01:00
ISSOtm
122f5fe12e Prevent creating labels outside of sections
This doesn't make sense, and causes RGBLINK to misbehave
2019-11-04 08:35:00 +01:00
Eldred Habert
192f2de704 Merge pull request #440 from ISSOtm/nested_brackets
Allow nested bracketed symbols
2019-11-03 16:40:34 +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
cdd8200936 Add test for nested brackets 2019-10-10 15:00:59 +02:00
ISSOtm
d76f994318 Run tests under a specific locale
Fixes #427
2019-10-10 13:23:36 +02:00
Eldred Habert
e93d65d736 Merge pull request #425 from ISSOtm/eexpansion_error
Add info about string expansions in error reports
2019-10-03 10:20:49 +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
Eldred Habert
22a6a82642 Merge pull request #419 from dbrotz/fix-blackslash-tab-at-eof
Handle tabs after backslash at end of file
2019-09-23 00:05:21 +02:00
ISSOtm
55fbecee49 Add info about string expansions in error reports
This is especially useful when an EQUS expands to another one, to help
track them.
This is done separately from the file stack as the EQUS stack is separate
(which is itself because EQUS are managed *way* differently).
2019-09-12 10:02:24 +02:00
dbrotz
f36a3d5b2a Fix macro and rept buffer overflows
Macro and rept buffers were not always being terminated with newlines
and/or were vulnerable to the final newline being escaped, allowing
buffer overflows to occur. Now, they are terminated with newlines using
the same mechanism as the file buffer.
2019-09-10 03:03:04 -07:00
dbrotz
c5e8e4ff83 Reject input that contains null characters
Null characters in the middle of strings interact badly with the RGBDS
codebase, which assumes null-terminated strings. There is no reason to
support null characters in input source code, so the simplest way to deal
with null characters is to reject them early.
2019-09-09 17:27:56 -07:00
dbrotz
89eda89838 Handle tabs after backslash at end of file
Commit 6fbb25c added support for tabs between a \ and the newline it escapes,
but yy_create_buffer() was not updated to handle tabs.
2019-09-09 12:25:26 -07:00
dbrotz
889dd83798 Print useful error message when '\0' is used in a symbol name
AppendMacroArg() was passing 0 to sym_FindMacroArg(), which caused an assertion
failure. Now, AppendMacroArg() prints an error message instead.
2019-09-09 09:46:18 -07:00
Jakub Kądziołka
fa920f8449 Remove the no-longer-needed .out.pipe files 2019-09-03 23:25:27 +02:00
Jakub Kądziołka
01aa56606f test/asm: special-case include-recursion 2019-09-03 23:25:15 +02:00
Jakub Kądziołka
bddd5bc678 test/asm: Generate .out.pipe files on the fly 2019-09-03 22:46:05 +02:00
ISSOtm
37089ef940 Improve error stack
The old error stack was fairly obtuse and hard to use for debugging.
This improves it notably by ensuring all line numbers are relative
to the file, and not, say, the macro definition.
This is a breaking change if you were parsing the old stack, but
the change should be painless, and the new stack only brings more info.
The syntax is unchanged for files, macros see their name prefixed
with the file they're defined in and a pair of colors, REPT blocks
simply append a '::REPT~n' to the context they're in, where 'n' is
the number of iterations the REPT has done.
This is especially helpful in macro-heavy code such as rgbds-structs.
2019-09-02 14:18:29 +02:00
Eldred Habert
4ef27a0d23 Merge pull request #411 from ISSOtm/recursion_limit
Add a recursion limit
2019-09-02 02:21:16 +02:00
ISSOtm
20b2f5ee2f Fix incorrect line numbers with some IF blocks
If a line ended with a string's closing quote, or a newline escape, then
skipping over that line via IF/ELIF/ELSE would fail to count that line,
offsetting the rest of the file.
I have no idea why but for some reason 9829be1 changed *specifically*
`if_skip_to_else` to have incorrect behavior on string endings. The incorrect
behavior on newline escapes seems to have been here since the beginning.
Also added a test to check for both of those behaviors in both functions.

Honestly, it baffles me that nobody ever noticed. I didn't until I started
working on #395.
2019-09-01 03:59:29 +02:00
ISSOtm
f9a04696f2 Add recursion overflow tests 2019-08-31 17:22:43 +02:00
Anthony J. Bentley
a517f900e4 Use POSIX-compatible dd(1) instead of head -c. 2019-08-30 23:11:28 -06:00
Eldred Habert
350f40300c Merge pull request #403 from dbrotz/multiple-charmaps
Add support for multiple charmaps
2019-08-31 04:44:58 +02:00
dbrotz
d3db5f0d76 Add pushc and popc directives 2019-08-30 19:36:23 -07:00
ISSOtm
7e3af4b3cd Make testing external projects use local RGBDS
Currently, the installed version is used instead, which isn't
consistent with the tests, which use the local version.
2019-08-31 04:17:16 +02:00
dbrotz
e05199ca1e Add support for multiple charmaps
This adds two new directives: newcharmap and setcharmap.
newcharmap creates a new charmap and switches to it.
setcharmap switches to an existing charmap.
2019-08-29 21:54:06 -07:00