ci: move manager test_startup_time to test_onroad (#34062)

* get

* fix

* now

* try

* better sign

* better

* better

* clean

* space

* fix

* more

* msg
pull/34067/head
Maxime Desroches 5 months ago committed by GitHub
parent 293c3fc57f
commit bf21e10d81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      selfdrive/test/test_onroad.py
  2. 10
      system/manager/test/test_manager.py

@ -138,6 +138,7 @@ class TestOnroad:
proc = None proc = None
try: try:
manager_path = os.path.join(BASEDIR, "system/manager/manager.py") manager_path = os.path.join(BASEDIR, "system/manager/manager.py")
cls.manager_st = time.monotonic()
proc = subprocess.Popen(["python", manager_path]) proc = subprocess.Popen(["python", manager_path])
sm = messaging.SubMaster(['carState']) sm = messaging.SubMaster(['carState'])
@ -202,6 +203,10 @@ class TestOnroad:
with subtests.test(service=s): with subtests.test(service=s):
assert len(msgs) >= math.floor(SERVICE_LIST[s].frequency*int(TEST_DURATION*0.8)) assert len(msgs) >= math.floor(SERVICE_LIST[s].frequency*int(TEST_DURATION*0.8))
def test_manager_starting_time(self):
st = self.msgs['managerState'][0].logMonoTime / 1e9
assert (st - self.manager_st) < 10, f"manager.py took {st - self.manager_st}s to publish the first 'managerState' msg"
def test_cloudlog_size(self): def test_cloudlog_size(self):
msgs = self.msgs['logMessage'] msgs = self.msgs['logMessage']

@ -3,8 +3,6 @@ import pytest
import signal import signal
import time import time
from parameterized import parameterized
from cereal import car from cereal import car
from openpilot.common.params import Params from openpilot.common.params import Params
import openpilot.system.manager.manager as manager import openpilot.system.manager.manager as manager
@ -37,14 +35,6 @@ class TestManager:
# TODO: ensure there are blacklisted procs until we have a dedicated test # TODO: ensure there are blacklisted procs until we have a dedicated test
assert len(BLACKLIST_PROCS), "No blacklisted procs to test not_run" assert len(BLACKLIST_PROCS), "No blacklisted procs to test not_run"
@parameterized.expand([(i,) for i in range(10)])
def test_startup_time(self, index):
start = time.monotonic()
os.environ['PREPAREONLY'] = '1'
manager.main()
t = time.monotonic() - start
assert t < MAX_STARTUP_TIME, f"startup took {t}s, expected <{MAX_STARTUP_TIME}s"
@pytest.mark.skip("this test is flaky the way it's currently written, should be moved to test_onroad") @pytest.mark.skip("this test is flaky the way it's currently written, should be moved to test_onroad")
def test_clean_exit(self, subtests): def test_clean_exit(self, subtests):
""" """

Loading…
Cancel
Save