|
|
|
@ -9,7 +9,7 @@ from typing import Any, DefaultDict, Dict |
|
|
|
|
|
|
|
|
|
from openpilot.selfdrive.car.car_helpers import interface_names |
|
|
|
|
from openpilot.selfdrive.test.openpilotci import get_url, upload_file |
|
|
|
|
from openpilot.selfdrive.test.process_replay.compare_logs import compare_logs |
|
|
|
|
from openpilot.selfdrive.test.process_replay.compare_logs import compare_logs, format_diff |
|
|
|
|
from openpilot.selfdrive.test.process_replay.process_replay import CONFIGS, PROC_REPLAY_DIR, FAKEDATA, check_openpilot_enabled, replay_process |
|
|
|
|
from openpilot.system.version import get_commit |
|
|
|
|
from openpilot.tools.lib.filereader import FileReader |
|
|
|
@ -115,45 +115,6 @@ def test_process(cfg, lr, segment, ref_log_path, new_log_path, ignore_fields=Non |
|
|
|
|
return str(e), log_msgs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_diff(results, log_paths, ref_commit): |
|
|
|
|
diff1, diff2 = "", "" |
|
|
|
|
diff2 += f"***** tested against commit {ref_commit} *****\n" |
|
|
|
|
|
|
|
|
|
failed = False |
|
|
|
|
for segment, result in list(results.items()): |
|
|
|
|
diff1 += f"***** results for segment {segment} *****\n" |
|
|
|
|
diff2 += f"***** differences for segment {segment} *****\n" |
|
|
|
|
|
|
|
|
|
for proc, diff in list(result.items()): |
|
|
|
|
# long diff |
|
|
|
|
diff2 += f"*** process: {proc} ***\n" |
|
|
|
|
diff2 += f"\tref: {log_paths[segment][proc]['ref']}\n" |
|
|
|
|
diff2 += f"\tnew: {log_paths[segment][proc]['new']}\n\n" |
|
|
|
|
|
|
|
|
|
# short diff |
|
|
|
|
diff1 += f" {proc}\n" |
|
|
|
|
if isinstance(diff, str): |
|
|
|
|
diff1 += f" ref: {log_paths[segment][proc]['ref']}\n" |
|
|
|
|
diff1 += f" new: {log_paths[segment][proc]['new']}\n\n" |
|
|
|
|
diff1 += f" {diff}\n" |
|
|
|
|
failed = True |
|
|
|
|
elif len(diff): |
|
|
|
|
diff1 += f" ref: {log_paths[segment][proc]['ref']}\n" |
|
|
|
|
diff1 += f" new: {log_paths[segment][proc]['new']}\n\n" |
|
|
|
|
|
|
|
|
|
cnt: Dict[str, int] = {} |
|
|
|
|
for d in diff: |
|
|
|
|
diff2 += f"\t{str(d)}\n" |
|
|
|
|
|
|
|
|
|
k = str(d[1]) |
|
|
|
|
cnt[k] = 1 if k not in cnt else cnt[k] + 1 |
|
|
|
|
|
|
|
|
|
for k, v in sorted(cnt.items()): |
|
|
|
|
diff1 += f" {k}: {v}\n" |
|
|
|
|
failed = True |
|
|
|
|
return diff1, diff2, failed |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
all_cars = {car for car, _ in segments} |
|
|
|
|
all_procs = {cfg.proc_name for cfg in CONFIGS if cfg.proc_name not in EXCLUDED_PROCS} |
|
|
|
|