pre-commit: check generated DBC files (#692)
This commit is contained in:
parent
7ae3554ee5
commit
6fad914a10
|
@ -42,3 +42,10 @@ repos:
|
||||||
- --force
|
- --force
|
||||||
- --quiet
|
- --quiet
|
||||||
- -j4
|
- -j4
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: generator
|
||||||
|
name: dbc generator
|
||||||
|
entry: generator/test_generator.py
|
||||||
|
language: script
|
||||||
|
pass_filenames: false
|
||||||
|
|
|
@ -11,7 +11,11 @@ def test_generator():
|
||||||
|
|
||||||
ignore = [f for f in os.listdir(opendbc_root) if not f.endswith('_generated.dbc')]
|
ignore = [f for f in os.listdir(opendbc_root) if not f.endswith('_generated.dbc')]
|
||||||
comp = filecmp.dircmp(opendbc_root, d, ignore=ignore)
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue