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"], ["build", "SCONS_CACHE=1 scons -j16"],
["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"], ["test loggerd", "python selfdrive/loggerd/tests/test_loggerd.py"],
["test encoder", "LD_LIBRARY_PATH=/usr/local/lib python selfdrive/loggerd/tests/test_encoder.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"], //["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 cereal.services import service_list
from common.basedir import BASEDIR from common.basedir import BASEDIR
from common.timeout import Timeout from common.timeout import Timeout
from selfdrive.hardware import TICI
from selfdrive.loggerd.config import ROOT from selfdrive.loggerd.config import ROOT
from selfdrive.test.helpers import set_params_enabled from selfdrive.test.helpers import set_params_enabled
from tools.lib.logreader import LogReader from tools.lib.logreader import LogReader
PROCS = [ # Baseline CPU usage by process
("selfdrive.controls.controlsd", 47.0), PROCS = {
("./loggerd", 45.0), "selfdrive.controls.controlsd": 47.0,
("selfdrive.locationd.locationd", 32.8), "./loggerd": 45.0,
("selfdrive.controls.plannerd", 20.0), "selfdrive.locationd.locationd": 32.8,
("./_ui", 15.0), "selfdrive.controls.plannerd": 20.0,
("selfdrive.locationd.paramsd", 9.1), "./_ui": 15.0,
("./camerad", 7.07), "selfdrive.locationd.paramsd": 9.1,
("./_sensord", 6.17), "./camerad": 7.07,
("selfdrive.controls.radard", 5.67), "./_sensord": 6.17,
("./_modeld", 4.48), "selfdrive.controls.radard": 5.67,
("./boardd", 3.63), "./_modeld": 4.48,
("./_dmonitoringmodeld", 2.67), "./boardd": 3.63,
("selfdrive.thermald.thermald", 2.41), "./_dmonitoringmodeld": 2.67,
("selfdrive.locationd.calibrationd", 2.0), "selfdrive.thermald.thermald": 2.41,
("selfdrive.monitoring.dmonitoringd", 1.90), "selfdrive.locationd.calibrationd": 2.0,
("./proclogd", 1.54), "selfdrive.monitoring.dmonitoringd": 1.90,
("selfdrive.logmessaged", 0.2), "./proclogd": 1.54,
("./clocksd", 0.02), "selfdrive.logmessaged": 0.2,
("./ubloxd", 0.02), "./clocksd": 0.02,
("selfdrive.tombstoned", 0), "./ubloxd": 0.02,
("./logcatd", 0), "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): def cputime_total(ct):
@ -49,7 +63,7 @@ def check_cpu_usage(first_proc, last_proc):
r = True r = True
dt = (last_proc.logMonoTime - first_proc.logMonoTime) / 1e9 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 first, last = None, None
try: try:
first = [p for p in first_proc.procLog.procs if proc_name in p.cmdline][0] 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" os.environ['FINGERPRINT'] = "TOYOTA COROLLA TSS2 2019"
set_params_enabled() 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 # start manager and run openpilot for a minute
try: try:
@ -98,7 +115,9 @@ class TestOnroad(unittest.TestCase):
cls.segments = [] cls.segments = []
with Timeout(300, "timed out waiting for logs"): with Timeout(300, "timed out waiting for logs"):
while len(cls.segments) < 3: 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)] segs = [p for p in new_paths if "--" in str(p)]
cls.segments = sorted(segs, key=lambda s: int(str(s).rsplit('--')[-1])) cls.segments = sorted(segs, key=lambda s: int(str(s).rsplit('--')[-1]))
time.sleep(5) time.sleep(5)