process_replay: sort logs before comparing them (#28201)

* Sort logs before comparing them in process replay

* Simplify
old-commit-hash: 504768f922
This commit is contained in:
Kacper Rączy
2023-05-16 15:30:28 -07:00
committed by GitHub
parent 8f2084089d
commit ca32ac861b
@@ -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)