|
|
@ -12,7 +12,7 @@ from typing import Dict, List |
|
|
|
|
|
|
|
|
|
|
|
import cereal.messaging as messaging |
|
|
|
import cereal.messaging as messaging |
|
|
|
from cereal import log |
|
|
|
from cereal import log |
|
|
|
from cereal.services import service_list |
|
|
|
from cereal.services import SERVICE_LIST |
|
|
|
from openpilot.common.basedir import BASEDIR |
|
|
|
from openpilot.common.basedir import BASEDIR |
|
|
|
from openpilot.common.params import Params |
|
|
|
from openpilot.common.params import Params |
|
|
|
from openpilot.common.timeout import Timeout |
|
|
|
from openpilot.common.timeout import Timeout |
|
|
@ -27,8 +27,8 @@ from openpilot.common.transformations.camera import tici_f_frame_size, tici_d_fr |
|
|
|
|
|
|
|
|
|
|
|
SentinelType = log.Sentinel.SentinelType |
|
|
|
SentinelType = log.Sentinel.SentinelType |
|
|
|
|
|
|
|
|
|
|
|
CEREAL_SERVICES = [f for f in log.Event.schema.union_fields if f in service_list |
|
|
|
CEREAL_SERVICES = [f for f in log.Event.schema.union_fields if f in SERVICE_LIST |
|
|
|
and service_list[f].should_log and "encode" not in f.lower()] |
|
|
|
and SERVICE_LIST[f].should_log and "encode" not in f.lower()] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestLoggerd(unittest.TestCase): |
|
|
|
class TestLoggerd(unittest.TestCase): |
|
|
@ -219,8 +219,8 @@ class TestLoggerd(unittest.TestCase): |
|
|
|
self.assertEqual(expected_val, bootlog_val) |
|
|
|
self.assertEqual(expected_val, bootlog_val) |
|
|
|
|
|
|
|
|
|
|
|
def test_qlog(self): |
|
|
|
def test_qlog(self): |
|
|
|
qlog_services = [s for s in CEREAL_SERVICES if service_list[s].decimation is not None] |
|
|
|
qlog_services = [s for s in CEREAL_SERVICES if SERVICE_LIST[s].decimation is not None] |
|
|
|
no_qlog_services = [s for s in CEREAL_SERVICES if service_list[s].decimation is None] |
|
|
|
no_qlog_services = [s for s in CEREAL_SERVICES if SERVICE_LIST[s].decimation is None] |
|
|
|
|
|
|
|
|
|
|
|
services = random.sample(qlog_services, random.randint(2, min(10, len(qlog_services)))) + \ |
|
|
|
services = random.sample(qlog_services, random.randint(2, min(10, len(qlog_services)))) + \ |
|
|
|
random.sample(no_qlog_services, random.randint(2, min(10, len(no_qlog_services)))) |
|
|
|
random.sample(no_qlog_services, random.randint(2, min(10, len(no_qlog_services)))) |
|
|
@ -245,7 +245,7 @@ class TestLoggerd(unittest.TestCase): |
|
|
|
self.assertEqual(recv_cnt, 0, f"got {recv_cnt} {s} msgs in qlog") |
|
|
|
self.assertEqual(recv_cnt, 0, f"got {recv_cnt} {s} msgs in qlog") |
|
|
|
else: |
|
|
|
else: |
|
|
|
# check logged message count matches decimation |
|
|
|
# check logged message count matches decimation |
|
|
|
expected_cnt = (len(msgs) - 1) // service_list[s].decimation + 1 |
|
|
|
expected_cnt = (len(msgs) - 1) // SERVICE_LIST[s].decimation + 1 |
|
|
|
self.assertEqual(recv_cnt, expected_cnt, f"expected {expected_cnt} msgs for {s}, got {recv_cnt}") |
|
|
|
self.assertEqual(recv_cnt, expected_cnt, f"expected {expected_cnt} msgs for {s}, got {recv_cnt}") |
|
|
|
|
|
|
|
|
|
|
|
def test_rlog(self): |
|
|
|
def test_rlog(self): |
|
|
|