Merge branch 'bugfix/freertos_smp_disable_scheduler_suspension_tests' into 'master'

freertos: Disable scheduler suspension tests for SMP FreeRTOS

Closes IDF-5077

See merge request espressif/esp-idf!18361
This commit is contained in:
Zim Kalinowski 2022-06-07 00:25:02 +08:00
commit e6c5badfe2

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