process_replay: sort logs before comparing them (#28201)

* Sort logs before comparing them in process replay

* Simplify
old-commit-hash: 504768f922
beeps
Kacper Rączy 2 years ago committed by GitHub
parent 8f2084089d
commit ca32ac861b
  1. 5
      selfdrive/test/process_replay/compare_logs.py

@ -70,7 +70,10 @@ def compare_logs(log1, log2, ignore_fields=None, ignore_msgs=None, tolerance=Non
field_tolerances = {}
default_tolerance = EPSILON if tolerance is None else tolerance
log1, log2 = (list(filter(lambda m: m.which() not in ignore_msgs, log)) for log in (log1, log2))
log1, log2 = (
sorted((m for m in log if m.which() not in ignore_msgs), key=lambda m: (m.logMonoTime, m.which()))
for log in (log1, log2)
)
if len(log1) != len(log2):
cnt1 = Counter(m.which() for m in log1)

Loading…
Cancel
Save