Change `verilator_difftree` to return exit code 1 on mismatch, 2 on error.
This commit is contained in:
parent
9f6719d28d
commit
e732f656a9
3
Changes
3
Changes
|
|
@ -32,6 +32,7 @@ Verilator 5.041 devel
|
|||
* Deprecate '--make cmake' option (#6540). [Geza Lore]
|
||||
* Change default `--expand-limit` to 256 (#3419).
|
||||
* Change developer coverage flow and add configure `--enable-dev-gcov` (#6526). [Geza Lore]
|
||||
* Change `verilator_difftree` to return exit code 1 on mismatch, 2 on error.
|
||||
* Support modports referencing clocking blocks (#4555) (#6436). [Ryszard Rozak, Antmicro Ltd.]
|
||||
* Support class package reference on pattern keys (#5653). [Todd Strader]
|
||||
* Support digits in `$sscanf` field width formats (#6083). [Iztok Jeras]
|
||||
|
|
@ -112,9 +113,9 @@ Verilator 5.041 devel
|
|||
* Fix single element unpacked array DPI parameters. [Geza Lore]
|
||||
* Fix DFG synthesis non-determinism (#6557) (#6568). [Todd Strader]
|
||||
* Fix hierarchical with parameterized instances under hier block (#6572). [Geza Lore]
|
||||
* Fix segfault on type casts (#6574). [David Moberg]
|
||||
* Fix references to interfaces containing generate blocks (#6579). [Ryszard Rozak, Antmicro Ltd.]
|
||||
* Fix missing net type mappings in FST traces (#6582) (#6583). [Matt Stroud]
|
||||
* Fix segfault on type casts (#6574). [David Moberg]
|
||||
|
||||
|
||||
Verilator 5.040 2025-08-30
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# pylint: disable=C0103,C0114,C0116,C0209
|
||||
# pylint: disable=C0103,C0114,C0116,C0209,W0603
|
||||
######################################################################
|
||||
|
||||
import argparse
|
||||
|
|
@ -9,20 +9,24 @@ import os.path
|
|||
import re
|
||||
import sys
|
||||
|
||||
exit_code = 0
|
||||
|
||||
|
||||
def diff(a, b):
|
||||
|
||||
if not os.path.exists(a):
|
||||
sys.exit("%Error: No old diff filename found: " + a)
|
||||
sys.stderr.write("%Error: No old diff filename found: " + a + "\n")
|
||||
sys.exit(2)
|
||||
if not os.path.exists(b):
|
||||
sys.exit("%Error: No new diff filename found: " + b)
|
||||
sys.stderr.write("%Error: No new diff filename found: " + b + "\n")
|
||||
sys.exit(2)
|
||||
|
||||
if os.path.isdir(a) and os.path.isdir(b):
|
||||
diff_dir(a, b)
|
||||
elif os.path.isfile(a) and os.path.isfile(b):
|
||||
diff_file(a, b)
|
||||
else:
|
||||
sys.exit("%Error: Mix of files and dirs")
|
||||
sys.stderr.write("%Error: Mix of files and dirs")
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
def diff_dir(a, b):
|
||||
|
|
@ -51,6 +55,8 @@ def diff_dir(a, b):
|
|||
|
||||
|
||||
def diff_file(a, b):
|
||||
global exit_code
|
||||
|
||||
# Compare the two tree files
|
||||
short_a = re.sub(r'[^a-zA-Z0-9.]+', '_', a)
|
||||
short_b = re.sub(r'[^a-zA-Z0-9.]+', '_', b)
|
||||
|
|
@ -65,10 +71,16 @@ def diff_file(a, b):
|
|||
|
||||
filterf(a, tmp_a)
|
||||
filterf(b, tmp_b)
|
||||
os.system("diff -u " + tmp_a + " " + tmp_b)
|
||||
status = os.system("diff -u " + tmp_a + " " + tmp_b)
|
||||
os.unlink(tmp_a)
|
||||
os.unlink(tmp_b)
|
||||
|
||||
status_exit_code = status >> 8
|
||||
if status_exit_code == 1:
|
||||
exit_code = 1
|
||||
elif status_exit_code:
|
||||
exit_code = 2
|
||||
|
||||
|
||||
def version_from(filename):
|
||||
# Return dump format
|
||||
|
|
@ -107,7 +119,9 @@ parser = argparse.ArgumentParser(
|
|||
|
||||
Verilator_difftree is used for debugging Verilator tree output files.
|
||||
It performs a diff between two files, or all files common between two
|
||||
directories, ignoring irrelevant pointer differences.""",
|
||||
directories, ignoring irrelevant pointer differences.
|
||||
|
||||
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.""",
|
||||
epilog="""Copyright 2005-2025 by Wilson Snyder. This program is free software; you
|
||||
can redistribute it and/or modify it under the terms of either the GNU
|
||||
Lesser General Public License Version 3 or the Perl Artistic License
|
||||
|
|
@ -124,6 +138,7 @@ parser.add_argument('fileb', help='input file b to diff')
|
|||
|
||||
Args = parser.parse_args()
|
||||
diff(Args.filea, Args.fileb)
|
||||
sys.exit(exit_code)
|
||||
|
||||
######################################################################
|
||||
# Local Variables:
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ test.run(cmd=[
|
|||
"cd " + test.obj_dir + " && " + os.environ["VERILATOR_ROOT"] + "/bin/verilator_difftree",
|
||||
test.t_dir + "/t_difftree.a.tree", test.t_dir + "/t_difftree.b.tree > diff.log"
|
||||
],
|
||||
check_finished=False)
|
||||
fails=1) # Testing mismatch, so exit code 1
|
||||
|
||||
test.files_identical(test.obj_dir + "/diff.log", test.golden_filename, 'logfile')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue