From 62db60595bb5129cc2f295fdc42f2cda473777fd Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 21 Sep 2023 15:28:19 -0700 Subject: [PATCH] Disable flash logging (#1667) * disable logging to flash * update tests * fix hitl --- board/drivers/logging.h | 15 +++++++++++++++ tests/hitl/2_health.py | 1 + tests/hitl/conftest.py | 9 +++++++-- tests/libpanda/SConscript | 1 + 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/board/drivers/logging.h b/board/drivers/logging.h index 28e42752..6198b548 100644 --- a/board/drivers/logging.h +++ b/board/drivers/logging.h @@ -1,3 +1,4 @@ +#ifdef ENABLE_LOGGING #include "logging_definitions.h" @@ -191,3 +192,17 @@ uint8_t logging_read(uint8_t *buffer) { } return ret; } + +#else + +void logging_init(void) { } +void logging_tick(void) { } +void logging_init_read_index(void) { } +void logging_find_read_index(uint16_t last_id) { UNUSED(last_id); } +void log(const char* msg) { UNUSED(msg); } +uint8_t logging_read(uint8_t *buffer) { + UNUSED(buffer); + return 0; +} + +#endif diff --git a/tests/hitl/2_health.py b/tests/hitl/2_health.py index 56d52b46..fd39cc0f 100644 --- a/tests/hitl/2_health.py +++ b/tests/hitl/2_health.py @@ -125,6 +125,7 @@ def test_microsecond_timer(p): time_diff = (end_time - start_time) / 1e6 assert 0.98 < time_diff < 1.02, f"Timer not running at the correct speed! (got {time_diff:.2f}s instead of 1.0s)" +@pytest.mark.skip("logging is disabled") @pytest.mark.expected_logs(1) def test_logging(p): p.reset() diff --git a/tests/hitl/conftest.py b/tests/hitl/conftest.py index 6deb2e0e..8d6030c4 100644 --- a/tests/hitl/conftest.py +++ b/tests/hitl/conftest.py @@ -144,8 +144,10 @@ def func_fixture_panda(request, module_panda): # TODO: reset is slow (2+ seconds) p.reset() - logs = p.get_logs() - last_log_id = logs[-1]['id'] if len(logs) > 0 else 0 + + #logs = p.get_logs() + #last_log_id = logs[-1]['id'] if len(logs) > 0 else 0 + assert len(p.get_logs()) == 0 # ensure FW hasn't changed assert p.up_to_date() @@ -174,6 +176,7 @@ def func_fixture_panda(request, module_panda): assert p.health()['fault_status'] == 0 # Make sure that there are no unexpected logs + """ min_expected_logs = 0 max_expected_logs = 0 mark = request.node.get_closest_marker('expected_logs') @@ -186,6 +189,8 @@ def func_fixture_panda(request, module_panda): log_id = logs[-1]['id'] if len(logs) > 0 else last_log_id assert min_expected_logs <= ((log_id - last_log_id) % 0xFFFE) <= max_expected_logs, f"Unexpected amount of logs. Last 5: {logs[-5:]}" + """ + assert len(p.get_logs()) == 0 # Check for SPI errors #assert p.health()['spi_checksum_error_count'] == 0 diff --git a/tests/libpanda/SConscript b/tests/libpanda/SConscript index 265fac9d..15e12081 100644 --- a/tests/libpanda/SConscript +++ b/tests/libpanda/SConscript @@ -15,6 +15,7 @@ env = Environment( '-std=gnu11', '-Wfatal-errors', '-Wno-pointer-to-int-cast', + '-DENABLE_LOGGING', ], CPPPATH=[".", "../../board/"], )