Comparison doesn't fail when csv_1 is bigger than csv_2 in the particular case where gpr_state_change_2 == 1 at the end of csv_2. To reproduce we can use these csv files:
diff --git a/scripts/instr_trace_compare.py b/scripts/instr_trace_compare.py
index b0fd3e8..820da10 100644
--- a/scripts/instr_trace_compare.py
+++ b/scripts/instr_trace_compare.py
@@ -81,10 +81,12 @@ def compare_trace_csv(csv1, csv2, name1, name2, log,
# Check if the GPR update is the same between trace 1 and 2
if gpr_state_change_2 == 0:
mismatch_cnt += 1
- fd.write("Mismatch[{}]:\n[{}] {} : {}\n".format(
- mismatch_cnt, trace_1_index, name1,trace.get_trace_string()))
- fd.write("{} instructions left in trace {}\n".format(
- len(instr_trace_1) - trace_1_index + 1, name1))
+ # print first few mismatches
+ if mismatch_cnt <= mismatch_print_limit:
+ fd.write("Mismatch[{}]:\n[{}] {} : {}\n".format(
+ mismatch_cnt, trace_1_index, name1,trace.get_trace_string()))
+ fd.write("{} instructions left in trace {}\n".format(
+ len(instr_trace_1) - trace_1_index + 1, name1))
elif len(trace.gpr) != len(
instr_trace_2[trace_2_index - 1].gpr):
mismatch_cnt += 1
@@ -115,9 +117,6 @@ def compare_trace_csv(csv1, csv2, name1, name2, log,
break
if not found_mismatch:
matched_cnt += 1
- # Break the loop if it reaches the end of trace 2
- if trace_2_index == len(instr_trace_2):
- break
# Check if there's remaining instruction that change architectural state
if trace_2_index != len(instr_trace_2):
while trace_2_index < len(instr_trace_2):
Unfortunately we cannot create a PR with this code due to a missing of Contributor License Agreement. If someone could merge it to the mainstream it would be great.
Comparison doesn't fail when csv_1 is bigger than csv_2 in the particular case where
gpr_state_change_2 == 1
at the end of csv_2. To reproduce we can use these csv files:csv_1 (1.csv.tmp):
csv_2 (2.csv.tmp):
We execute the comparaison by this command:
Obtained log:
Expected log:
It can be fixed as following:
Unfortunately we cannot create a PR with this code due to a missing of Contributor License Agreement. If someone could merge it to the mainstream it would be great.