test(freertos): changed freertos tests to compile even if no gptimer

This commit is contained in:
Marius Vikhammer 2025-01-17 12:07:07 +08:00
parent 4c5e1a0341
commit 638b22ef4e
6 changed files with 29 additions and 5 deletions

View File

@ -185,6 +185,7 @@ TEST_CASE("FreeRTOS Event Groups do not cause priority inversion when higher pri
/*-----------------Test case for event group trace facilities-----------------*/ /*-----------------Test case for event group trace facilities-----------------*/
#ifdef CONFIG_FREERTOS_USE_TRACE_FACILITY #ifdef CONFIG_FREERTOS_USE_TRACE_FACILITY
#if SOC_GPTIMER_SUPPORTED
/* /*
* Test event group Trace Facility functions such as * Test event group Trace Facility functions such as
* xEventGroupClearBitsFromISR(), xEventGroupSetBitsFromISR() * xEventGroupClearBitsFromISR(), xEventGroupSetBitsFromISR()
@ -261,4 +262,5 @@ TEST_CASE("FreeRTOS Event Group ISR", "[freertos]")
vSemaphoreDelete(done_sem); vSemaphoreDelete(done_sem);
vTaskDelay(10); //Give time for idle task to clear up deleted tasks vTaskDelay(10); //Give time for idle task to clear up deleted tasks
} }
#endif //SOC_GPTIMER_SUPPORTED
#endif //CONFIG_FREERTOS_USE_TRACE_FACILITY #endif //CONFIG_FREERTOS_USE_TRACE_FACILITY

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -21,6 +21,8 @@
#include "unity.h" #include "unity.h"
#include "test_utils.h" #include "test_utils.h"
#if SOC_GPTIMER_SUPPORTED
#define NO_OF_NOTIFS 4 #define NO_OF_NOTIFS 4
#define NO_OF_TASKS 2 //Sender and receiver #define NO_OF_TASKS 2 //Sender and receiver
#define MESSAGE 0xFF #define MESSAGE 0xFF
@ -196,9 +198,10 @@ TEST_CASE("Test Task_Notify", "[freertos]")
TEST_ESP_OK(gptimer_del_timer(gptimers[i])); TEST_ESP_OK(gptimer_del_timer(gptimers[i]));
} }
} }
#endif //SOC_GPTIMER_SUPPORTED
/* Test causes asserts, so it cannot be run as a normal unity test case. /* Test causes asserts, so it cannot be run as a normal unity test case.
Test case is ran as a seperate test case in test_task_notify_too_high_index_fails Test case is ran as a separate test case in test_task_notify_too_high_index_fails
*/ */
TEST_CASE("Notify too high index fails", "[ignore]") TEST_CASE("Notify too high index fails", "[ignore]")
{ {
@ -207,7 +210,7 @@ TEST_CASE("Notify too high index fails", "[ignore]")
} }
/* Test causes asserts, so it cannot be run as a normal unity test case. /* Test causes asserts, so it cannot be run as a normal unity test case.
Test case is ran as a seperate test case in test_task_notify_wait_too_high_index_fails Test case is ran as a separate test case in test_task_notify_wait_too_high_index_fails
*/ */
TEST_CASE("Notify Wait too high index fails", "[ignore]") TEST_CASE("Notify Wait too high index fails", "[ignore]")
{ {

View File

@ -13,6 +13,7 @@
#include "portTestMacro.h" #include "portTestMacro.h"
/* ------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------ */
#if SOC_GPTIMER_SUPPORTED
/* /*
Test vTaskDelay Test vTaskDelay
@ -178,3 +179,4 @@ TEST_CASE("Tasks: Test vTaskDelayUntil", "[freertos]")
} }
#endif /* ( INCLUDE_xTaskDelayUntil == 1 ) */ #endif /* ( INCLUDE_xTaskDelayUntil == 1 ) */
#endif //SOC_GPTIMER_SUPPORTED

View File

@ -118,6 +118,8 @@ TEST_CASE("Suspend the current running task", "[freertos]")
TEST_ASSERT_TRUE(resumed); TEST_ASSERT_TRUE(resumed);
} }
#if SOC_GPTIMER_SUPPORTED
static volatile bool timer_isr_fired; static volatile bool timer_isr_fired;
static gptimer_handle_t gptimer = NULL; static gptimer_handle_t gptimer = NULL;
@ -203,3 +205,5 @@ 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);
} }
#endif // CONFIG_FREERTOS_UNICORE #endif // CONFIG_FREERTOS_UNICORE
#endif //SOC_GPTIMER_SUPPORTED

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -24,6 +24,8 @@ GP timer is used to trigger an interrupt. Test cases will register an interrupt
interrupt callback. The functions below simply the interrupt registration/trigger/deregistration process. interrupt callback. The functions below simply the interrupt registration/trigger/deregistration process.
*/ */
#if SOC_GPTIMER_SUPPORTED
static gptimer_handle_t gptimer = NULL; static gptimer_handle_t gptimer = NULL;
static bool (*registered_intr_callback)(void *) = NULL; static bool (*registered_intr_callback)(void *) = NULL;
@ -84,6 +86,8 @@ static void deregister_intr_cb(void)
TEST_ESP_OK(gptimer_del_timer(gptimer_temp)); TEST_ESP_OK(gptimer_del_timer(gptimer_temp));
} }
#endif //SOC_GPTIMER_SUPPORTED
/* --------------------------------------------------------------------------------------------------------------------- /* ---------------------------------------------------------------------------------------------------------------------
Test vTaskSuspendAll() and xTaskResumeAll() basic Test vTaskSuspendAll() and xTaskResumeAll() basic
@ -265,6 +269,9 @@ Expected:
--------------------------------------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------------------------------------- */
#if !CONFIG_FREERTOS_UNICORE #if !CONFIG_FREERTOS_UNICORE
#if SOC_GPTIMER_SUPPORTED
static volatile int test_unblk_sync; static volatile int test_unblk_sync;
static SemaphoreHandle_t test_unblk_done_sem; static SemaphoreHandle_t test_unblk_done_sem;
@ -394,6 +401,8 @@ TEST_CASE("Test vTaskSuspendAll allows scheduling on other cores", "[freertos]")
vTaskDelay(10); vTaskDelay(10);
} }
#endif //SOC_GPTIMER_SUPPORTED
/* --------------------------------------------------------------------------------------------------------------------- /* ---------------------------------------------------------------------------------------------------------------------
Test vTaskSuspendAll doesn't block unpinned tasks from being scheduled on other cores Test vTaskSuspendAll doesn't block unpinned tasks from being scheduled on other cores
@ -539,6 +548,8 @@ Expected:
#define TEST_PENDED_NUM_BLOCKED_TASKS 4 #define TEST_PENDED_NUM_BLOCKED_TASKS 4
#if SOC_GPTIMER_SUPPORTED
static bool test_pended_isr(void *arg) static bool test_pended_isr(void *arg)
{ {
TaskHandle_t *blkd_tsks = (TaskHandle_t *)arg; TaskHandle_t *blkd_tsks = (TaskHandle_t *)arg;
@ -639,6 +650,8 @@ TEST_CASE("Test xTaskResumeAll resumes pended tasks", "[freertos]")
vTaskDelay(10); vTaskDelay(10);
} }
#endif //SOC_GPTIMER_SUPPORTED
/* --------------------------------------------------------------------------------------------------------------------- /* ---------------------------------------------------------------------------------------------------------------------
Test xTaskSuspendAll on both cores pends all tasks and xTaskResumeAll on both cores resumes all tasks Test xTaskSuspendAll on both cores pends all tasks and xTaskResumeAll on both cores resumes all tasks

View File

@ -11,7 +11,7 @@ if(CONFIG_IDF_TARGET_ESP32)
# where PCNT can count the pulses generated by RMT, and RMT is clocked from REF_TICK # where PCNT can count the pulses generated by RMT, and RMT is clocked from REF_TICK
# REF_TICK won't be affected by DFS # REF_TICK won't be affected by DFS
list(APPEND srcs "ref_clock_impl_rmt_pcnt.c") list(APPEND srcs "ref_clock_impl_rmt_pcnt.c")
else() elseif(CONFIG_SOC_GPTIMER_SUPPORTED)
list(APPEND srcs "ref_clock_impl_timergroup.c") list(APPEND srcs "ref_clock_impl_timergroup.c")
endif() endif()