pre-commit: check generated DBC files (#692)

This commit is contained in:
Adeeb Shihadeh 2022-08-20 21:35:51 -07:00 committed by GitHub
parent 7ae3554ee5
commit 6fad914a10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -42,3 +42,10 @@ repos:
- --force
- --quiet
- -j4
- repo: local
hooks:
- id: generator
name: dbc generator
entry: generator/test_generator.py
language: script
pass_filenames: false

View File

@ -11,7 +11,11 @@ def test_generator():
ignore = [f for f in os.listdir(opendbc_root) if not f.endswith('_generated.dbc')]
comp = filecmp.dircmp(opendbc_root, d, ignore=ignore)
assert len(comp.diff_files) == 0, f"Different files: {comp.diff_files}"
err = "Generated DBC mismatch\n\n"
err += f"Different files: {comp.diff_files}\n\n"
err += "Run opendbc/generator/generator.py to regenerate DBC files."
assert len(comp.diff_files) == 0, err
if __name__ == "__main__":