Skip to content

Conversation

@nyurik
Copy link
Member

@nyurik nyurik commented Jan 7, 2026

This PR adds https://github.com/oxibus/shared-test-files as a submodule and uses them for testing -- similar to can-dbc and can-dbc-pest repos. Note that there is a minor change to the lib.rs to handle missing signal name - rather than crashing. Other than that, the goal of this PR is NOT to fix issues, but to record the status quo. This way any changes to the generation logic will be clearly visible in the test files.

  • .dbc files are converted to .rs binary snapshots (update with just bless), and are later compiled to ensure the result is usable
  • In some cases, test files produce compilation errors - stored as snapshot files too, but without the corresponding .rs file
  • All compilation failures are store in the .stderr files. Warnings are treated as errors.
  • an entire opendbc repo is also used as a test case, but due to the size, the files are only used for generation testing, not compilation. All errors are saved as !error___*.snap files.

@nyurik nyurik marked this pull request as ready for review January 10, 2026 23:18
@nyurik nyurik requested review from Copilot and trnila January 10, 2026 23:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates test files from the shared-test-files repository as a submodule to enhance test coverage. The changes add multiple DBC (Database Container) file test snapshots from the cantools issue tracker, generating Rust code for various CAN message scenarios including multiplexing, extended IDs, and edge cases.

Changes:

  • Added snapshot test files for various cantools issues (issue_63, issue_62, issue_228, issue_207, issue_199, issue_184 variants)
  • Generated corresponding Rust code (.snap.rs files) from DBC definitions
  • Created snapshot metadata files (.snap) for test verification

Reviewed changes

Copilot reviewed 85 out of 166 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test-snapshots/dbc-cantools/issue_636_negative_scaling.snap Snapshot metadata for negative scaling test case
test-snapshots/dbc-cantools/issue_63.snap.rs Generated Rust code for AFT1PSI2 message with multiple signal types
test-snapshots/dbc-cantools/issue_63.snap Snapshot metadata for issue 63
test-snapshots/dbc-cantools/issue_62.snap.rs Generated Rust code for empty messages enum
test-snapshots/dbc-cantools/issue_62.snap Snapshot metadata for issue 62
test-snapshots/dbc-cantools/issue_228.snap.rs Generated Rust code for signed signal handling (SGMsg, NormalMsg)
test-snapshots/dbc-cantools/issue_228.snap Snapshot metadata for issue 228
test-snapshots/dbc-cantools/issue_207_sig_plus.snap.rs Generated Rust code for signals with plus notation
test-snapshots/dbc-cantools/issue_207_sig_plus.snap Snapshot metadata for sig_plus variant
test-snapshots/dbc-cantools/issue_199_extended.snap.rs Generated Rust code for extended CAN IDs with vehicle control messages
test-snapshots/dbc-cantools/issue_199_extended.snap Snapshot metadata for extended variant
test-snapshots/dbc-cantools/issue_199.snap.rs Generated Rust code for standard CAN IDs with vehicle control messages
test-snapshots/dbc-cantools/issue_199.snap Snapshot metadata for issue 199
test-snapshots/dbc-cantools/issue_184_extended_mux_multiple_values_dumped.snap.rs Generated Rust code for extended multiplexing with multiple values (dumped variant)
test-snapshots/dbc-cantools/issue_184_extended_mux_multiple_values_dumped.snap Snapshot metadata for dumped variant
test-snapshots/dbc-cantools/issue_184_extended_mux_multiple_values.snap.rs Generated Rust code for extended multiplexing with multiple values
test-snapshots/dbc-cantools/issue_184_extended_mux_multiple_values.snap Snapshot metadata for multiple values variant
test-snapshots/dbc-cantools/issue_184_extended_mux_independent_multiplexors_dumped.snap.rs Generated Rust code for independent multiplexors (dumped variant)
test-snapshots/dbc-cantools/issue_184_extended_mux_independent_multiplexors_dumped.snap Snapshot metadata for dumped multiplexors
test-snapshots/dbc-cantools/issue_184_extended_mux_independent_multiplexors.snap.rs Generated Rust code for independent multiplexors
test-snapshots/dbc-cantools/issue_184_extended_mux_independent_multiplexors.snap Snapshot metadata for independent multiplexors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nyurik nyurik changed the title generate and compile all .dbc files from test repo chore: generate and compile all .dbc files from test repo Jan 10, 2026
Error reading dbc test files from {dir_display}
{e}
Make sure git submodules are up to date by running
git submodule update --init --recursive
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directory exists in my case, but submodule wasnt pulled. Maybe we could check if there are any files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, I added a test for that too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants