Skip to content

Commit fdd4178

Browse files
committed
Make sim-check output more user-friendly
1 parent 8cb86bf commit fdd4178

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tools/json_compare.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ def main():
1616
gold = json.load(f)
1717
with open(gate_path, "r") as f:
1818
gate = json.load(f)
19-
assert len(gold["events"]) == len(gate["events"]), f"mismatch: {len(gold['events'])} events in reference, {len(gate['events'])} in test output"
19+
if len(gold["events"]) != len(gate["events"]):
20+
print(f"Failed! Event mismatch: {len(gold['events'])} events in reference, {len(gate['events'])} in test output")
21+
return 1
2022
for ev_gold, ev_gate in zip(gold["events"], gate["events"]):
21-
for field in ("peripheral", "event", "payload"):
22-
assert ev_gold["peripheral"] == ev_gate["peripheral"] and ev_gold["event"] == ev_gate["event"] and ev_gold["payload"] == ev_gate["payload"], \
23-
f"reference event {ev_gold} mismatches test event {ev_gate} beyond timestamp"
24-
print("Event logs are identical")
23+
if ev_gold["peripheral"] != ev_gate["peripheral"] or \
24+
ev_gold["event"] != ev_gate["event"] or \
25+
ev_gold["payload"] != ev_gate["payload"]:
26+
print(f"Failed! Reference event {ev_gold} mismatches test event {ev_gate}")
27+
return 1
2528

29+
print("Success! Event logs are identical")
30+
return 0
2631

2732
if __name__ == "__main__":
2833
main()

0 commit comments

Comments
 (0)