freertos: Disable scheduler suspension tests for SMP FreeRTOS

The behavior of vTaskSuspendAll() has changed in SMP FreeRTOS. This commit
disables scheduler suspension related unit tests for SMP FreeRTOS.

The tests will be updated in IDF-5201
This commit is contained in:
Darian Leung 2022-06-02 21:27:50 +08:00
parent b617ccfb4c
commit 593fbe0b23

View File

@ -200,26 +200,22 @@ TEST_CASE("Resume task from ISR (other core)", "[freertos]")
test_resume_task_from_isr(!UNITY_FREERTOS_CPU); test_resume_task_from_isr(!UNITY_FREERTOS_CPU);
} }
#if !CONFIG_FREERTOS_SMP
/*
Scheduler suspension behavior has changed in SMP FreeRTOS, thus these test are disabled for SMP FreeRTOS.
See IDF-5201
*/
static volatile bool block; static volatile bool block;
static bool suspend_both_cpus; static bool suspend_both_cpus;
static void IRAM_ATTR suspend_scheduler_while_block_set(void *arg) static void IRAM_ATTR suspend_scheduler_while_block_set(void *arg)
{ {
#ifdef CONFIG_FREERTOS_SMP
//Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionDisable(NULL);
#else
vTaskSuspendAll(); vTaskSuspendAll();
#endif // CONFIG_FREERTOS_SMP
while (block) { }; while (block) { };
esp_rom_delay_us(1); esp_rom_delay_us(1);
#ifdef CONFIG_FREERTOS_SMP
//Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionEnable(NULL);
#else
xTaskResumeAll(); xTaskResumeAll();
#endif // CONFIG_FREERTOS_SMP
} }
static void IRAM_ATTR suspend_scheduler_on_both_cpus(void) static void IRAM_ATTR suspend_scheduler_on_both_cpus(void)
@ -229,23 +225,13 @@ static void IRAM_ATTR suspend_scheduler_on_both_cpus(void)
TEST_ESP_OK(esp_ipc_call((xPortGetCoreID() == 0) ? 1 : 0, &suspend_scheduler_while_block_set, NULL)); TEST_ESP_OK(esp_ipc_call((xPortGetCoreID() == 0) ? 1 : 0, &suspend_scheduler_while_block_set, NULL));
} }
#ifdef CONFIG_FREERTOS_SMP
//Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionDisable(NULL);
#else
vTaskSuspendAll(); vTaskSuspendAll();
#endif // CONFIG_FREERTOS_SMP
} }
static void IRAM_ATTR resume_scheduler_on_both_cpus(void) static void IRAM_ATTR resume_scheduler_on_both_cpus(void)
{ {
block = false; block = false;
#ifdef CONFIG_FREERTOS_SMP
//Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionEnable(NULL);
#else
xTaskResumeAll(); xTaskResumeAll();
#endif // CONFIG_FREERTOS_SMP
} }
static const int waiting_ms = 2000; static const int waiting_ms = 2000;
@ -405,3 +391,4 @@ TEST_CASE("Test suspend-resume CPU works with xTimer", "[freertos]")
test_scheduler_suspend3(1); test_scheduler_suspend3(1);
} }
#endif // CONFIG_FREERTOS_UNICORE #endif // CONFIG_FREERTOS_UNICORE
#endif // !CONFIG_FREERTOS_SMP