1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-04 16:30:01 +00:00
6502bench/SourceGen/SGTestData
Andy McFadden b387298685 Fix various local variable de-duplication bugs
In 1.5.0-dev1, as part of changes to the way label localization
works, the local variable de-duplicator started checking against a
filtered copy of the symbol table.  Unfortunately it never
re-generated the table, so a long-lived LocalVariableLookup (like
the one used by LineListGen) would set up the dup map wrong and
be inconsistent with other parts of the program.

We now regenerate the table on every Reset().

The de-duplication stuff also had problems when opcodes and
operands were double-clicked on.  When the opcode is clicked, the
selection should jump to the appropriate variable declaration, but
it wasn't being found because the label generated in the list was
in its original form.  Fixed.

When an instruction operand is double-clicked, the instruction operand
editor opens with an "edit variable" shortcut.  This was showing
the de-duplicated name, which isn't necessarily a bad thing, but it
was passing that value on to the DefSymbol editor, which thought it
was being asked to create a new entry.  Fixed.  (Entering the editor
through the LvTable editor works correctly, with nary a de-duplicated
name in sight.  You'll be forced to rename it because it'll fail the
uniqueness test.)

References to de-duplicated local variables were getting lost when
the symbol's label was replaced (due largely to a convenient but
flawed shortcut: xrefs are attached to DefSymbol objects).  Fixed by
linking the XrefSets.

Given the many issues and their relative subtlety, I decided to make
the modified names more obvious, and went back to the "_DUPn" naming
strategy.  (I'm also considering just making it an error and
discarding conflicting entries during analysis... this is much more
complicated than I expected it to be.)

Quick tests can be performed in 2019-local-variables:
 - go to +000026, double-click on the opcode, confirm sel change
 - go to +000026, double-click on the operand, confirm orig name
   shown in shortcut and that shortcut opens editor with orig name
 - go to +00001a, down a line, click on PROJ_ZERO_DUP1 and confirm
   that it has a single reference (from +000026)
 - double-click on var table and confirm editing entry
2020-01-13 18:32:56 -08:00
..
Expected Fix various local variable de-duplication bugs 2020-01-13 18:32:56 -08:00
FunkyProjects Initial file commit 2018-09-28 10:05:11 -07:00
Source Add regression test for data analysis bug 2019-12-30 14:09:18 -08:00
Visualization Serialize animations to project file 2019-12-22 16:56:57 -08:00
1000-allops-value-65816 Initial file commit 2018-09-28 10:05:11 -07:00
1001-allops-zero-65816 Initial file commit 2018-09-28 10:05:11 -07:00
1002-embedded-instructions Initial file commit 2018-09-28 10:05:11 -07:00
1003-flags-and-branches Fix code tracing bug 2019-09-17 14:38:16 -07:00
1004-data-recognition Initial file commit 2018-09-28 10:05:11 -07:00
2000-allops-value-6502 Initial file commit 2018-09-28 10:05:11 -07:00
2000-allops-value-6502.dis65 Initial file commit 2018-09-28 10:05:11 -07:00
2001-allops-zero-6502 Initial file commit 2018-09-28 10:05:11 -07:00
2001-allops-zero-6502.dis65 Initial file commit 2018-09-28 10:05:11 -07:00
2002-allops-value-65C02 Initial file commit 2018-09-28 10:05:11 -07:00
2002-allops-value-65C02.dis65 Initial file commit 2018-09-28 10:05:11 -07:00
2003-allops-zero-65C02 Initial file commit 2018-09-28 10:05:11 -07:00
2003-allops-zero-65C02.dis65 Initial file commit 2018-09-28 10:05:11 -07:00
2004-numeric-types Add regression test for data analysis bug 2019-12-30 14:09:18 -08:00
2004-numeric-types.cs Add regression test for data analysis bug 2019-12-30 14:09:18 -08:00
2004-numeric-types.dis65 Add regression test for data analysis bug 2019-12-30 14:09:18 -08:00
2005-string-types Initial file commit 2018-09-28 10:05:11 -07:00
2005-string-types.dis65 Initial file commit 2018-09-28 10:05:11 -07:00
2006-operand-formats Correctly handle delimiters in character operands 2019-08-14 17:31:15 -07:00
2006-operand-formats.dis65 Correctly handle delimiters in character operands 2019-08-14 17:31:15 -07:00
2007-labels-and-symbols Progress toward 64tass expression support 2018-10-24 13:17:03 -07:00
2007-labels-and-symbols.dis65 Progress toward 64tass expression support 2018-10-24 13:17:03 -07:00
2007-labels-and-symbols.sym65 Initial file commit 2018-09-28 10:05:11 -07:00
2008-address-changes Initial file commit 2018-09-28 10:05:11 -07:00
2008-address-changes.dis65 Initial file commit 2018-09-28 10:05:11 -07:00
2009-branches-and-banks Add a blank line between constants and addresses 2019-10-22 22:45:13 -07:00
2009-branches-and-banks.dis65 Add a blank line between constants and addresses 2019-10-22 22:45:13 -07:00
2009-branches-and-banks.sym65 Initial file commit 2018-09-28 10:05:11 -07:00
2010-target-adjustment Tweak "nearby" label finder 2019-10-29 18:12:22 -07:00
2010-target-adjustment.dis65 Tweak "nearby" label finder 2019-10-29 18:12:22 -07:00
2011-hinting Fix handling of data formatting that overlaps with code 2019-09-14 11:44:17 -07:00
2011-hinting.cs More progress on visualization 2019-11-30 18:02:03 -08:00
2011-hinting.dis65 Expand set of symbols available to plugins 2019-10-04 16:57:57 -07:00
2012-label-localizer Remap labels that use opcode mnemonics 2019-09-20 15:29:34 -07:00
2012-label-localizer.dis65 Remap labels that use opcode mnemonics 2019-09-20 15:29:34 -07:00
2013-notes-and-comments Initial file commit 2018-09-28 10:05:11 -07:00
2013-notes-and-comments.dis65 Tweak line folding code 2019-11-01 19:47:56 -07:00
2014-label-dp Add 2014-label-dp 2018-10-30 16:07:35 -07:00
2014-label-dp.dis65 Add 2014-label-dp 2018-10-30 16:07:35 -07:00
2015-64k-nops Add 2015-64k-nops test 2019-08-04 16:54:01 -07:00
2015-64k-nops.dis65 Add 2015-64k-nops test 2019-08-04 16:54:01 -07:00
2016-char-encoding-a PETSCII does DCI 2019-08-20 17:55:12 -07:00
2016-char-encoding-a.dis65 PETSCII does DCI 2019-08-20 17:55:12 -07:00
2017-char-encoding-p PETSCII does DCI 2019-08-20 17:55:12 -07:00
2017-char-encoding-p.dis65 PETSCII does DCI 2019-08-20 17:55:12 -07:00
2018-char-encoding-s PETSCII does DCI 2019-08-20 17:55:12 -07:00
2018-char-encoding-s.dis65 PETSCII does DCI 2019-08-20 17:55:12 -07:00
2019-local-variables Work around two assembler issues 2019-09-20 14:05:17 -07:00
2019-local-variables.dis65 Work around two assembler issues 2019-09-20 14:05:17 -07:00
2020-cycle-counts-65816 Rename regression test 2020 to reflect the CPU configuration 2019-09-15 17:02:21 -07:00
2020-cycle-counts-65816.dis65 Remove excess whitespace after cycle count comments 2019-09-15 17:13:29 -07:00
2021-external-symbols External symbol I/O direction and address mask, part 3 (of 3) 2019-10-16 17:32:30 -07:00
2021-external-symbols-1.sym65 Fix constants declared with MULTI_MASK 2019-10-18 16:19:42 -07:00
2021-external-symbols-2.sym65 External symbol I/O direction and address mask, part 3 (of 3) 2019-10-16 17:32:30 -07:00
2021-external-symbols-3.sym65 Allow explicit widths in project/platform symbols, part 3 2019-10-02 16:50:15 -07:00
2021-external-symbols.dis65 External symbol I/O direction and address mask, part 3 (of 3) 2019-10-16 17:32:30 -07:00
2022-extension-scripts Correctly handle embedded instruction edge case 2019-10-19 17:28:45 -07:00
2022-extension-scripts-a.cs More progress on visualization 2019-11-30 18:02:03 -08:00
2022-extension-scripts-b.cs More progress on visualization 2019-11-30 18:02:03 -08:00
2022-extension-scripts.dis65 Correctly handle embedded instruction edge case 2019-10-19 17:28:45 -07:00
2022-extension-scripts.sym65 Expand the set of things SetInlineDataFormat accepts 2019-10-05 19:51:34 -07:00
2023-non-unique-labels Label rework, part 6 2019-11-18 13:36:53 -08:00
2023-non-unique-labels.dis65 Label rework, part 6 2019-11-18 13:36:53 -08:00
README.md Improve visualization 2019-12-04 15:59:37 -08:00

SourceGen Test Data

This directory contains various regression tests.

NOTE: some tests may fail if you use a version of the assembler that is different from the one used to generate the expected output. The current set was generated for:

  • 64tass v1.53.1515
  • ACME v0.96.4
  • cc65 v2.18
  • Merlin 32 v1.0

Generator/Assembler Tests

Files with names like "1000-nifty-test" are regression test data files for the code generator. The test harness identifies them by filename pattern: four digits, a hyphen, then one or more alphanumeric and hyphens. Files with a '.' or '_' are ignored.

If the leading number is between 1000 and 1999, inclusive, the test file will be loaded as a new project. A 65816 CPU and load address of $1000 are assumed. As with all new projects, the first byte will be hinted as a code entry point. The entry flags are currently set to emulation mode, but tests should not rely on that.

If the leading number is 2000 or greater, the test file will be loaded as a saved project. A file with the same name plus a ".dis65" extension will be opened as the project file.

Execution

With debug features enabled, you can open the test runner from the menu with Debug > Source Generation Tests. Click "Run Test" to run all tests.

For each test, the test harness will create a new project or open the project file. For every known assembler, the test harness will generate source code, and compare it to the corresponding entry in the Expected directory. If they don't match exactly, a failure is reported for the generation phase. (These are text files, so the line terminators are not required to match.) Next, the generated sources are fed to the appropriate cross-assembler, whether or not the sources matched expectations. If the assembler reports success, the output file is compared to the original data file. If these match, success is reported for the assembly phase.

The top window in the test harness shows a summary of success or failure. The bottom window shows details reported for each individual test. Use the drop list to select which test is shown.

The generated sources and assembled output is placed into a temporary directory inside SGTestData that is named after the test. For example, test 2000-allops-value-6502 will have all of its generated output in a directory called "tmp2000". If all parts of the test are successful, the directory will be removed. If generation or assembly fails, or if you check the "retain output" box in the test harness, the directory and its contents will remain. This allows you to examine the outputs when investigating failures.

As a safety measure, the directory will NOT be removed if it contains files that the test harness doesn't recognize.

Updating Tests

If you want to add or update a test, follow these steps:

  1. Make the changes to the test data file and test project file.
  2. Run the test harness. The generation test will fail and leave output in the tmpNNNN directory. Make sure the assembly test is succeeding.
  3. After verifying that the generated sources look correct, copy them into the Expected directory, replacing any existing copies.
  4. Run the test harness. This should now report success, and will remove the tmpNNNN directory.

Be sure to have the version of the cross-assembler identified at the top of this document configured.

Other Notes

The original source code used to generate the test cases can be found in the Source directory. The test harness does not use these files. If you want to update a test file, you will need to run the assembler yourself. The assembler used is noted in a comment at the top of the file.

The code is not required to do anything useful. Many of the test cases would crash or hang if executed.

FunkyProjects

This is a collection of project files with deliberate errors. These exist to exercise the load-time error reporting. See the README in that directory for a full explanation.

Visualization

Some test projects and data files for exercising the visualization generators. Not part of a formal test; load the projects and eyeball the results.