mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 18:53:55 +08:00
test_onroad: log sizes check (#30265)
* test_onroad: check log sizes
* fix
* check logs
* rb
* len
* pytest
* mb
* corolla log is small
* adjust qlog
old-commit-hash: 13d780a5f2
This commit is contained in:
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@@ -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"],
|
||||
])
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user