From 451465ff8c4fccc02b1c2391a4079ea269f4a37a Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Thu, 18 Feb 2021 11:43:52 +0800 Subject: [PATCH] esp_timer: fix "esp_timer orders timers correctly" headerline handling Discard header lines from esp_timer_dump that comes before the actual timer info. "esp_timer orders timers correctly" would crash when reading the header lines. --- components/esp_timer/test/test_esp_timer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/esp_timer/test/test_esp_timer.c b/components/esp_timer/test/test_esp_timer.c index e3a9b31da6..fd53398ea3 100644 --- a/components/esp_timer/test/test_esp_timer.c +++ b/components/esp_timer/test/test_esp_timer.c @@ -87,8 +87,13 @@ TEST_CASE("esp_timer orders timers correctly", "[esp_timer]") } fflush(stream); fseek(stream, 0, SEEK_SET); + + /* Discard header lines */ + char line[128]; + TEST_ASSERT_NOT_NULL(fgets(line, sizeof(line), stream)); + TEST_ASSERT_NOT_NULL(fgets(line, sizeof(line), stream)); + for (size_t i = 0; i < num_timers; ++i) { - char line[128]; TEST_ASSERT_NOT_NULL(fgets(line, sizeof(line), stream)); #if WITH_PROFILING int timer_id;