diff --git a/Jenkinsfile b/Jenkinsfile index 3c97bcdca1..35c16e29c9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -156,7 +156,7 @@ node { ["build master-ci", "cd $SOURCE_DIR/release && TARGET_DIR=$TEST_DIR ./build_devel.sh"], ["build openpilot", "cd selfdrive/manager && ./build.py"], ["check dirty", "release/check-dirty.sh"], - ["onroad tests", "cd selfdrive/test/ && ./test_onroad.py"], + ["onroad tests", "pytest selfdrive/test/test_onroad.py -s"], ["time to onroad", "cd selfdrive/test/ && pytest test_time_to_onroad.py"], ]) }, diff --git a/selfdrive/test/test_onroad.py b/selfdrive/test/test_onroad.py index 230a96ddad..d4f86e8f89 100755 --- a/selfdrive/test/test_onroad.py +++ b/selfdrive/test/test_onroad.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import bz2 import math import json import os @@ -161,6 +162,7 @@ class TestOnroad(unittest.TestCase): # use the second segment by default as it's the first full segment cls.lr = list(LogReader(os.path.join(str(cls.segments[1]), "rlog"))) + cls.log_path = cls.segments[1] @cached_property def service_msgs(self): @@ -191,6 +193,26 @@ class TestOnroad(unittest.TestCase): big_logs = [f for f, n in cnt.most_common(3) if n / sum(cnt.values()) > 30.] self.assertEqual(len(big_logs), 0, f"Log spam: {big_logs}") + def test_log_sizes(self): + for f in self.log_path.iterdir(): + assert f.is_file() + + sz = f.stat().st_size / 1e6 + if f.name in ("qlog", "rlog"): + with open(f, 'rb') as ff: + sz = len(bz2.compress(ff.read())) / 1e6 + + if f.name == "qcamera.ts": + assert 2.15 < sz < 2.35 + elif f.name == "qlog": + assert 0.7 < sz < 0.95 + elif f.name == "rlog": + assert 5 < sz < 50 + elif f.name.endswith('.hevc'): + assert 70 < sz < 77 + else: + raise NotImplementedError + def test_ui_timings(self): result = "\n" result += "------------------------------------------------\n"