openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.6 KiB

5 years ago
#!/usr/bin/env python3
import os
import sys
5 years ago
from selfdrive.test.openpilotci import upload_file, get_url
5 years ago
from selfdrive.test.process_replay.compare_logs import save_log
from selfdrive.test.process_replay.process_replay import CONFIGS, PROC_REPLAY_DIR, CI, replay_process
from selfdrive.test.process_replay.test_processes import segments
from selfdrive.version import get_commit
5 years ago
from tools.lib.logreader import LogReader
if __name__ == "__main__":
no_upload = "--no-upload" in sys.argv
3 years ago
ref_commit_fn = os.path.join(PROC_REPLAY_DIR, "ref_commit")
5 years ago
ref_commit = get_commit()
if ref_commit is None:
3 years ago
raise Exception("Couldn't get ref commit")
5 years ago
with open(ref_commit_fn, "w") as f:
f.write(ref_commit)
# only upload
if CI:
for car_brand, segment in segments:
3 years ago
for cfg in CONFIGS:
3 years ago
log_fn = os.path.join(PROC_REPLAY_DIR, f"{segment}_{cfg.proc_name}_{ref_commit}.bz2")
3 years ago
if not os.path.exists(log_fn):
raise Exception(f"Cannot find log to upload: {log_fn}")
3 years ago
print(f'Uploading: {log_fn}')
3 years ago
upload_file(log_fn, os.path.basename(log_fn))
3 years ago
os.remove(log_fn)
else:
for car_brand, segment in segments:
r, n = segment.rsplit("--", 1)
lr = LogReader(get_url(r, n))
5 years ago
for cfg in CONFIGS:
log_msgs = replay_process(cfg, lr)
log_fn = os.path.join(PROC_REPLAY_DIR, f"{segment}_{cfg.proc_name}_{ref_commit}.bz2")
save_log(log_fn, log_msgs)
5 years ago
if not no_upload:
upload_file(log_fn, os.path.basename(log_fn))
os.remove(log_fn)
5 years ago
3 years ago
print(f'Done\nNew reference commit: {ref_commit}')