more tici CI coverage (#20639)

* run onroad test in tici

* run in jenkins

* no /data/media

* doesn't exists there yet

* more updates

Co-authored-by: Comma Device <device@comma.ai>
albatross
Adeeb Shihadeh 2021-04-11 15:56:17 -07:00 committed by GitHub
parent 4dd4528787
commit 01dc011f9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 26 deletions

1
Jenkinsfile vendored
View File

@ -164,6 +164,7 @@ pipeline {
["build", "SCONS_CACHE=1 scons -j16"],
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
["test encoder", "LD_LIBRARY_PATH=/usr/local/lib python selfdrive/loggerd/tests/test_encoder.py"],
["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"],
//["build release3-staging", "cd release && PUSH=${env.R3_PUSH} ./build_release3.sh"],
])
}

View File

@ -9,33 +9,47 @@ import cereal.messaging as messaging
from cereal.services import service_list
from common.basedir import BASEDIR
from common.timeout import Timeout
from selfdrive.hardware import TICI
from selfdrive.loggerd.config import ROOT
from selfdrive.test.helpers import set_params_enabled
from tools.lib.logreader import LogReader
PROCS = [
("selfdrive.controls.controlsd", 47.0),
("./loggerd", 45.0),
("selfdrive.locationd.locationd", 32.8),
("selfdrive.controls.plannerd", 20.0),
("./_ui", 15.0),
("selfdrive.locationd.paramsd", 9.1),
("./camerad", 7.07),
("./_sensord", 6.17),
("selfdrive.controls.radard", 5.67),
("./_modeld", 4.48),
("./boardd", 3.63),
("./_dmonitoringmodeld", 2.67),
("selfdrive.thermald.thermald", 2.41),
("selfdrive.locationd.calibrationd", 2.0),
("selfdrive.monitoring.dmonitoringd", 1.90),
("./proclogd", 1.54),
("selfdrive.logmessaged", 0.2),
("./clocksd", 0.02),
("./ubloxd", 0.02),
("selfdrive.tombstoned", 0),
("./logcatd", 0),
]
# Baseline CPU usage by process
PROCS = {
"selfdrive.controls.controlsd": 47.0,
"./loggerd": 45.0,
"selfdrive.locationd.locationd": 32.8,
"selfdrive.controls.plannerd": 20.0,
"./_ui": 15.0,
"selfdrive.locationd.paramsd": 9.1,
"./camerad": 7.07,
"./_sensord": 6.17,
"selfdrive.controls.radard": 5.67,
"./_modeld": 4.48,
"./boardd": 3.63,
"./_dmonitoringmodeld": 2.67,
"selfdrive.thermald.thermald": 2.41,
"selfdrive.locationd.calibrationd": 2.0,
"selfdrive.monitoring.dmonitoringd": 1.90,
"./proclogd": 1.54,
"selfdrive.logmessaged": 0.2,
"./clocksd": 0.02,
"./ubloxd": 0.02,
"selfdrive.tombstoned": 0,
"./logcatd": 0,
}
if TICI:
PROCS.update({
"./loggerd": 55.0,
"selfdrive.controls.controlsd": 26.0,
"./camerad": 20.0,
"selfdrive.locationd.locationd": 21.0,
"selfdrive.controls.plannerd": 12.0,
"selfdrive.locationd.paramsd": 5.0,
"./_dmonitoringmodeld": 10.0,
"selfdrive.thermald.thermald": 1.5,
})
def cputime_total(ct):
@ -49,7 +63,7 @@ def check_cpu_usage(first_proc, last_proc):
r = True
dt = (last_proc.logMonoTime - first_proc.logMonoTime) / 1e9
for proc_name, normal_cpu_usage in PROCS:
for proc_name, normal_cpu_usage in PROCS.items():
first, last = None, None
try:
first = [p for p in first_proc.procLog.procs if proc_name in p.cmdline][0]
@ -82,7 +96,10 @@ class TestOnroad(unittest.TestCase):
os.environ['FINGERPRINT'] = "TOYOTA COROLLA TSS2 2019"
set_params_enabled()
initial_segments = set(Path(ROOT).iterdir())
logger_root = Path(ROOT)
initial_segments = set()
if logger_root.exists():
initial_segments = set(Path(ROOT).iterdir())
# start manager and run openpilot for a minute
try:
@ -98,7 +115,9 @@ class TestOnroad(unittest.TestCase):
cls.segments = []
with Timeout(300, "timed out waiting for logs"):
while len(cls.segments) < 3:
new_paths = set(Path(ROOT).iterdir()) - initial_segments
new_paths = set()
if logger_root.exists():
new_paths = set(logger_root.iterdir()) - initial_segments
segs = [p for p in new_paths if "--" in str(p)]
cls.segments = sorted(segs, key=lambda s: int(str(s).rsplit('--')[-1]))
time.sleep(5)