0x22 is a rare field wedon't see much. BB-AI is a V172 file, but the 0x22 field has this element, so it must be at least V172, not V174. Add a block test to really nail this down (at least for V172!) This allows BB-AI-64 to load successfully.
Allegro unit tests
The Allegro format is complicated and opaque, so we have to lean heavily on unit tests to avoid regressions and lock in the most correct parsing we can.
Current test suites:
AllegroImport- tests on the full import of entire board files with some general checks on the overall import results in terms of tests on theBOARDobject.AllegroComprehensive- more in-depth tests on the full import of entire board files. Some of these also do cross-checks against.algASCII formats of the same board files.AllegroBlocks- tests on parsing of individual binary blocks. These are much faster to run than the full import tests, and help to isolate issues with version-dependent parsing logic and the conversion of binary data to the intermediate DB_OBJ form.AllegroBoards- generalised tests on the full import of entire board files, with test cases generated from a registry of board files and the general board "expectation" data.- Slow boards in this suite are labelled as
slow-boardand can be filtered out of the test runs when needed. - These test have the following sub-test units:
Import- tests that the board file can be imported without errorsExpectations- tests that check the imported board against the expectations defined for that board in the registry (depends on theImporttest, so will be skipped if the board fails to import)Header- tests on the header data parsing and any specific checks related to the header dataBlocks- tests on the parsing of individual blocks and/or conversion of block data to DB_OBJ form. These tests are strictly block-specific, so they don't have the wide board context.
- Slow boards in this suite are labelled as
Tests in the AllegroBlocks and AllegroBoards suites are generated from the data in the board_data_registry.json file.
These tests are organised into sub-suites based on the board name.
Running tests
The usual Boost test filtering works, so you can run tests like this:
- Run all Allegro tests:
qa_pcbnew -t 'Allegro*' - Run just the AllegroBlocks tests:
qa_pcbnew -t 'AllegroBlocks' - Run just the AllegroBlocks test for the
Fooboards:qa_pcbnew -t 'AllegroBlocks/Foo' - Run just the AllegroBoards tests, excluding slow boards:
qa_pcbnew -t 'AllegroBoards' -t '!@slow-board'(note - single quotes avoid having the!interpreted by the shell) - Run block tests for the
Barboard:qa_pcbnew -t 'AllegroBlocks/Bar' - Run just the loading test for all boards:
qa_pcbnew -t 'AllegroBoards/*/Import' - Run block tests for
0x20blocks in all boards:qa_pcbnew -t 'AllegroBlocks/*/*0x20'
Expectations
"Expectations" are declarative tests that can be run on the results of importing a board file.
Every board can have a list of expectations defined in the board_data_registry.json file, and these are run as part of the AllegroBoards test suite.
Each expectation is defined as a JSON object with a type field that specifies the type of expectation, and other fields that provide the data for the test. For example, this footprint
expectation checks that the number of footprints imported from the board file matches the expected count:
{
"type": "footprint",
"count": {
"minimum": 42,
}
}
Types
Current expectation types include:
footprint- checks footprint propertiescount- checks the number of footprintsexact- the count must match this value exactlyminimum- the count must be at least this valuemaximum- the count must be at most this value (can be used together withminimumto specify a range)
net- checks net propertiescount- checks the number of nets (same structure asfootprintcount)name- checks that there are nets with names matching this pattern (can be a glob). If count is not specified, at least one match is required for each pattern. Otherwise, the count is expected to match the total number of matches across all patterns.