|
|
@ -57,14 +57,19 @@ def compare_logs(log1, log2, ignore_fields=None, ignore_msgs=None, tolerance=Non |
|
|
|
raise Exception(f"logs are not same length: {len(log1)} VS {len(log2)}\n\t\t{cnt1}\n\t\t{cnt2}") |
|
|
|
raise Exception(f"logs are not same length: {len(log1)} VS {len(log2)}\n\t\t{cnt1}\n\t\t{cnt2}") |
|
|
|
|
|
|
|
|
|
|
|
diff = [] |
|
|
|
diff = [] |
|
|
|
for msg1, msg2 in zip(log1, log2, strict=True): |
|
|
|
for idx, (msg1, msg2) in enumerate(zip(log1, log2, strict=True)): |
|
|
|
if msg1.which() != msg2.which(): |
|
|
|
# print(msg1.which(), msg2.which()) |
|
|
|
raise Exception("msgs not aligned between logs") |
|
|
|
|
|
|
|
|
|
|
|
# if msg1.which() == 'onroadEvents': |
|
|
|
|
|
|
|
# print('msg1', [i.name for i in msg1.onroadEvents]) |
|
|
|
|
|
|
|
# if msg2.which() == 'onroadEvents': |
|
|
|
|
|
|
|
# print('msg2', [i.name for i in msg2.onroadEvents]) |
|
|
|
|
|
|
|
|
|
|
|
msg1 = remove_ignored_fields(msg1, ignore_fields) |
|
|
|
msg1 = remove_ignored_fields(msg1, ignore_fields) |
|
|
|
msg2 = remove_ignored_fields(msg2, ignore_fields) |
|
|
|
msg2 = remove_ignored_fields(msg2, ignore_fields) |
|
|
|
|
|
|
|
|
|
|
|
if msg1.to_bytes() != msg2.to_bytes(): |
|
|
|
if msg1.to_bytes() != msg2.to_bytes(): |
|
|
|
|
|
|
|
# print('differ') |
|
|
|
msg1_dict = msg1.as_reader().to_dict(verbose=True) |
|
|
|
msg1_dict = msg1.as_reader().to_dict(verbose=True) |
|
|
|
msg2_dict = msg2.as_reader().to_dict(verbose=True) |
|
|
|
msg2_dict = msg2.as_reader().to_dict(verbose=True) |
|
|
|
|
|
|
|
|
|
|
@ -86,6 +91,12 @@ def compare_logs(log1, log2, ignore_fields=None, ignore_msgs=None, tolerance=Non |
|
|
|
dd = list(filter(outside_tolerance, dd)) |
|
|
|
dd = list(filter(outside_tolerance, dd)) |
|
|
|
|
|
|
|
|
|
|
|
diff.extend(dd) |
|
|
|
diff.extend(dd) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if msg1.which() != msg2.which(): |
|
|
|
|
|
|
|
raise Exception("msgs not aligned between logs") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if idx > 1000: |
|
|
|
|
|
|
|
# raise Exception("done") |
|
|
|
return diff |
|
|
|
return diff |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|