Disable flash logging (#1667)

* disable logging to flash

* update tests

* fix hitl
This commit is contained in:
Adeeb Shihadeh
2023-09-21 15:28:19 -07:00
committed by GitHub
parent 38404c7d10
commit 62db60595b
4 changed files with 24 additions and 2 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -15,6 +15,7 @@ env = Environment(
'-std=gnu11',
'-Wfatal-errors',
'-Wno-pointer-to-int-cast',
'-DENABLE_LOGGING',
],
CPPPATH=[".", "../../board/"],
)