Skip to content

Commit fedcee6

Browse files
[UR][Tests] fix match.py on-error printing
Input and match files were printed only on one error. Now, it will be printed for both places (where this makes sense). This is an extension to commit: be85a49
1 parent 00c7edb commit fedcee6

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

cmake/match.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
import sys
1212
import re
1313

14+
15+
## @brief print the whole content of input and match files
16+
def print_content(input_lines, match_lines):
17+
print("--- Input Lines " + "-" * 64)
18+
print("".join(input_lines).strip())
19+
print("--- Match Lines " + "-" * 64)
20+
print("".join(match_lines).strip())
21+
print("-" * 80)
22+
23+
1424
if len(sys.argv) != 3:
1525
print("Usage: python match.py <input_file> <match_file>")
1626
sys.exit(1)
@@ -23,7 +33,9 @@
2333
match_lines = match.readlines()
2434

2535
if len(match_lines) < len(input_lines):
26-
sys.exit(f"Match length < input length (input: {len(input_lines)}, match: {len(match_lines)})")
36+
print(f"Match length < input length (input: {len(input_lines)}, match: {len(match_lines)})")
37+
print_content(input_lines, match_lines)
38+
sys.exit(1)
2739

2840
input_idx = 0
2941
opt = "{{OPT}}"
@@ -60,11 +72,7 @@
6072
print("Line " + str(i+1) + " does not match")
6173
print("is: " + input_line)
6274
print("expected: " + match_line.strip())
63-
print("--- Input Lines " + "-" * 64)
64-
print("".join(input_lines).strip())
65-
print("--- Match Lines " + "-" * 64)
66-
print("".join(match_lines).strip())
67-
print("-" * 80)
75+
print_content(input_lines, match_lines)
6876
sys.exit(1)
6977
else:
7078
if (input_idx == len(input_lines) - 1):

0 commit comments

Comments
 (0)