From 7476e197ad3055f87cd4663e8b7a3fa92a6a5b61 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 30 May 2022 12:51:07 +0530 Subject: [PATCH] freertos: fix test_preemtion test Increased the yield count threshold to work for both SMP FreeRTOS and IDF FreeRTOS. --- .../freertos/test/miscellaneous/test_preemption.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/freertos/test/miscellaneous/test_preemption.c b/components/freertos/test/miscellaneous/test_preemption.c index 3085c9250a..15c571ef4e 100644 --- a/components/freertos/test/miscellaneous/test_preemption.c +++ b/components/freertos/test/miscellaneous/test_preemption.c @@ -23,6 +23,14 @@ static volatile bool trigger; static volatile bool flag; +#ifndef CONFIG_FREERTOS_SMP +#define MAX_YIELD_COUNT 10000 +#else +//TODO: IDF-5081 +#define MAX_YIELD_COUNT 15000 +#endif // CONFIG_FREERTOS_SMP + + /* Task: - Waits for 'trigger' variable to be set - Reads the cycle count on this CPU @@ -70,7 +78,7 @@ TEST_CASE("Yield from lower priority task, same CPU", "[freertos]") delta = now_ccount - yield_ccount; printf("Yielding from lower priority task took %u cycles\n", delta); - TEST_ASSERT(delta < 10000); + TEST_ASSERT(delta < MAX_YIELD_COUNT); vTaskDelete(sender_task); vQueueDelete(queue); @@ -107,7 +115,7 @@ TEST_CASE("Yield from lower priority task, other CPU", "[freertos]") delta = now_ccount - trigger_ccount; printf("Yielding from task on other core took %u cycles\n", delta); - TEST_ASSERT(delta < 10000); + TEST_ASSERT(delta < MAX_YIELD_COUNT); vQueueDelete(queue); vTaskDelete(sender_task);