mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Fix interface exposure with --public-depth or --trace-depth (#5758).
This commit is contained in:
+13
-4
@@ -2285,7 +2285,7 @@ class VlTest:
|
||||
#######################################################################
|
||||
# File utilities
|
||||
|
||||
def files_identical(self, fn1: str, fn2: str, is_logfile=False) -> None:
|
||||
def files_identical(self, fn1: str, fn2: str, is_logfile=False, strip_hex=False) -> None:
|
||||
"""Test if two files have identical contents"""
|
||||
delay = 0.25
|
||||
for tryn in range(Args.log_retries, -1, -1):
|
||||
@@ -2294,10 +2294,11 @@ class VlTest:
|
||||
delay = min(1, delay * 2)
|
||||
moretry = tryn != 0
|
||||
if not self._files_identical_try(
|
||||
fn1=fn1, fn2=fn2, is_logfile=is_logfile, moretry=moretry):
|
||||
fn1=fn1, fn2=fn2, is_logfile=is_logfile, strip_hex=strip_hex, moretry=moretry):
|
||||
break
|
||||
|
||||
def _files_identical_try(self, fn1: str, fn2: str, is_logfile: bool, moretry: bool) -> bool:
|
||||
def _files_identical_try(self, fn1: str, fn2: str, is_logfile: bool, strip_hex: bool,
|
||||
moretry: bool) -> bool:
|
||||
# If moretry, then return true to try again
|
||||
try:
|
||||
f1 = open( # pylint: disable=consider-using-with
|
||||
@@ -2321,6 +2322,7 @@ class VlTest:
|
||||
fn1=fn1,
|
||||
fn2=fn2,
|
||||
is_logfile=is_logfile,
|
||||
strip_hex=strip_hex,
|
||||
moretry=moretry)
|
||||
if f1:
|
||||
f1.close()
|
||||
@@ -2329,7 +2331,7 @@ class VlTest:
|
||||
return again
|
||||
|
||||
def _files_identical_reader(self, f1, f2, fn1: str, fn2: str, is_logfile: bool,
|
||||
moretry: bool) -> None:
|
||||
strip_hex: bool, moretry: bool) -> None:
|
||||
# If moretry, then return true to try again
|
||||
l1s = f1.readlines()
|
||||
l2s = f2.readlines() if f2 else []
|
||||
@@ -2377,6 +2379,13 @@ class VlTest:
|
||||
#
|
||||
l1s = l1o
|
||||
|
||||
if strip_hex:
|
||||
l1o = []
|
||||
for line in l1s:
|
||||
line = re.sub(r'\b0x[0-9a-f]+', '0x#', line)
|
||||
l1o.append(line)
|
||||
l1s = l1o
|
||||
|
||||
for lineno_m1 in range(0, max(len(l1s), len(l2s))):
|
||||
l1 = l1s[lineno_m1] if lineno_m1 < len(l1s) else "*EOF*\n"
|
||||
l2 = l2s[lineno_m1] if lineno_m1 < len(l2s) else "*EOF*\n"
|
||||
|
||||
Reference in New Issue
Block a user