From df4bfeee5bce6bb702f74624b8abe11416c38e66 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 01:19:15 +0800 Subject: [PATCH] freertos: Migrate kernel tests to test app This commit renames the "integration" tests to "kernel" test and migrates them to the test app as a component. --- .../test_apps/freertos/CMakeLists.txt | 13 +++++++--- .../test_apps/freertos/kernel/CMakeLists.txt | 26 +++++++++++++++++++ .../freertos/kernel}/README.md | 0 .../event_groups/test_freertos_eventgroups.c | 0 .../freertos/kernel}/freertos_test_utils.c | 0 .../freertos/kernel}/freertos_test_utils.h | 0 .../freertos/kernel}/portTestMacro.h | 0 .../queue/test_freertos_debug_functions.c | 0 .../freertos/kernel}/queue/test_queuesets.c | 0 .../stream_buffer/test_stream_buffers.c | 0 .../kernel}/tasks/test_eTaskGetState.c | 0 .../test_freertos_scheduling_round_robin.c | 0 .../kernel}/tasks/test_freertos_task_delete.c | 0 .../kernel}/tasks/test_freertos_task_notify.c | 0 .../tasks/test_freertos_task_utilities.c | 0 .../kernel}/tasks/test_priority_scheduling.c | 0 .../tasks/test_priority_scheduling_smp.c | 0 .../freertos/kernel}/tasks/test_task_delay.c | 0 .../kernel}/tasks/test_task_priorities.c | 0 .../kernel}/tasks/test_task_suspend_resume.c | 0 .../kernel}/tasks/test_tasks_snapshot.c | 0 .../test_vTaskSuspendAll_xTaskResumeAll.c | 0 .../freertos/kernel}/tasks/test_yielding.c | 0 .../freertos/kernel}/timers/test_timers.c | 0 24 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 components/freertos/test_apps/freertos/kernel/CMakeLists.txt rename components/freertos/{test/integration => test_apps/freertos/kernel}/README.md (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/event_groups/test_freertos_eventgroups.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/freertos_test_utils.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/freertos_test_utils.h (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/portTestMacro.h (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/queue/test_freertos_debug_functions.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/queue/test_queuesets.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/stream_buffer/test_stream_buffers.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_eTaskGetState.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_freertos_scheduling_round_robin.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_freertos_task_delete.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_freertos_task_notify.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_freertos_task_utilities.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_priority_scheduling.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_priority_scheduling_smp.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_task_delay.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_task_priorities.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_task_suspend_resume.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_tasks_snapshot.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_vTaskSuspendAll_xTaskResumeAll.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/tasks/test_yielding.c (100%) rename components/freertos/{test/integration => test_apps/freertos/kernel}/timers/test_timers.c (100%) diff --git a/components/freertos/test_apps/freertos/CMakeLists.txt b/components/freertos/test_apps/freertos/CMakeLists.txt index ff3d5d9774..64a629abec 100644 --- a/components/freertos/test_apps/freertos/CMakeLists.txt +++ b/components/freertos/test_apps/freertos/CMakeLists.txt @@ -4,13 +4,18 @@ cmake_minimum_required(VERSION 3.16) # FreeRTOS tests of different types (e.g., kernel, port, performance etc.)are # split into different directores in the test app's root directory. Each test # type is treated as separate component -set(test_types) +set(test_types + "kernel") list(APPEND EXTRA_COMPONENT_DIRS - ${test_types}) # Add each test type as a component + ${test_types} # Add each test type as a component + "$ENV{IDF_PATH}/tools/unit-test-app/components") # For test_utils component -# "Trim" the build. Include the minimal set of components, main, and anything it depends on. -set(COMPONENTS main) +#"Trim" the build. Include the minimal set of components, main, and anything it depends on. +# Note: This is commented out for now due to pthread depending on vPortCleanUpTCB provided by "test_freertos_hooks.c". +# pthread is no used in FreeRTOS unit tests, but is pulled in by esp_system due to another dependency. +# Todo: Resolve this by either moving the "test_freertos_hooks.c" out, or solving the component dependencies. +#set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(freertos_test) diff --git a/components/freertos/test_apps/freertos/kernel/CMakeLists.txt b/components/freertos/test_apps/freertos/kernel/CMakeLists.txt new file mode 100644 index 0000000000..3e02a64a33 --- /dev/null +++ b/components/freertos/test_apps/freertos/kernel/CMakeLists.txt @@ -0,0 +1,26 @@ +# Register all of the "kernel" tests as a component + +# For refactored FreeRTOS unit tests, we need to support #include "xxx.h" of FreeRTOS headers +idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH) + +set(src_dirs + "." # For freertos_test_utils.c + "event_groups" + "queue" + "stream_buffer" + "tasks" + "timers") + +set(priv_include_dirs + "." # For portTestMacro.h + "${FREERTOS_ORIG_INCLUDE_PATH}") # FreeRTOS headers via`#include "xxx.h"` + +# In order for the cases defined by `TEST_CASE` in "kernel" to be linked into +# the final elf, the component can be registered as WHOLE_ARCHIVE +idf_component_register(SRC_DIRS ${src_dirs} + PRIV_INCLUDE_DIRS ${priv_include_dirs} + PRIV_REQUIRES test_utils esp_timer driver + WHOLE_ARCHIVE) + +# Todo: Fix no-format errors +target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/freertos/test/integration/README.md b/components/freertos/test_apps/freertos/kernel/README.md similarity index 100% rename from components/freertos/test/integration/README.md rename to components/freertos/test_apps/freertos/kernel/README.md diff --git a/components/freertos/test/integration/event_groups/test_freertos_eventgroups.c b/components/freertos/test_apps/freertos/kernel/event_groups/test_freertos_eventgroups.c similarity index 100% rename from components/freertos/test/integration/event_groups/test_freertos_eventgroups.c rename to components/freertos/test_apps/freertos/kernel/event_groups/test_freertos_eventgroups.c diff --git a/components/freertos/test/integration/freertos_test_utils.c b/components/freertos/test_apps/freertos/kernel/freertos_test_utils.c similarity index 100% rename from components/freertos/test/integration/freertos_test_utils.c rename to components/freertos/test_apps/freertos/kernel/freertos_test_utils.c diff --git a/components/freertos/test/integration/freertos_test_utils.h b/components/freertos/test_apps/freertos/kernel/freertos_test_utils.h similarity index 100% rename from components/freertos/test/integration/freertos_test_utils.h rename to components/freertos/test_apps/freertos/kernel/freertos_test_utils.h diff --git a/components/freertos/test/integration/portTestMacro.h b/components/freertos/test_apps/freertos/kernel/portTestMacro.h similarity index 100% rename from components/freertos/test/integration/portTestMacro.h rename to components/freertos/test_apps/freertos/kernel/portTestMacro.h diff --git a/components/freertos/test/integration/queue/test_freertos_debug_functions.c b/components/freertos/test_apps/freertos/kernel/queue/test_freertos_debug_functions.c similarity index 100% rename from components/freertos/test/integration/queue/test_freertos_debug_functions.c rename to components/freertos/test_apps/freertos/kernel/queue/test_freertos_debug_functions.c diff --git a/components/freertos/test/integration/queue/test_queuesets.c b/components/freertos/test_apps/freertos/kernel/queue/test_queuesets.c similarity index 100% rename from components/freertos/test/integration/queue/test_queuesets.c rename to components/freertos/test_apps/freertos/kernel/queue/test_queuesets.c diff --git a/components/freertos/test/integration/stream_buffer/test_stream_buffers.c b/components/freertos/test_apps/freertos/kernel/stream_buffer/test_stream_buffers.c similarity index 100% rename from components/freertos/test/integration/stream_buffer/test_stream_buffers.c rename to components/freertos/test_apps/freertos/kernel/stream_buffer/test_stream_buffers.c diff --git a/components/freertos/test/integration/tasks/test_eTaskGetState.c b/components/freertos/test_apps/freertos/kernel/tasks/test_eTaskGetState.c similarity index 100% rename from components/freertos/test/integration/tasks/test_eTaskGetState.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_eTaskGetState.c diff --git a/components/freertos/test/integration/tasks/test_freertos_scheduling_round_robin.c b/components/freertos/test_apps/freertos/kernel/tasks/test_freertos_scheduling_round_robin.c similarity index 100% rename from components/freertos/test/integration/tasks/test_freertos_scheduling_round_robin.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_freertos_scheduling_round_robin.c diff --git a/components/freertos/test/integration/tasks/test_freertos_task_delete.c b/components/freertos/test_apps/freertos/kernel/tasks/test_freertos_task_delete.c similarity index 100% rename from components/freertos/test/integration/tasks/test_freertos_task_delete.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_freertos_task_delete.c diff --git a/components/freertos/test/integration/tasks/test_freertos_task_notify.c b/components/freertos/test_apps/freertos/kernel/tasks/test_freertos_task_notify.c similarity index 100% rename from components/freertos/test/integration/tasks/test_freertos_task_notify.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_freertos_task_notify.c diff --git a/components/freertos/test/integration/tasks/test_freertos_task_utilities.c b/components/freertos/test_apps/freertos/kernel/tasks/test_freertos_task_utilities.c similarity index 100% rename from components/freertos/test/integration/tasks/test_freertos_task_utilities.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_freertos_task_utilities.c diff --git a/components/freertos/test/integration/tasks/test_priority_scheduling.c b/components/freertos/test_apps/freertos/kernel/tasks/test_priority_scheduling.c similarity index 100% rename from components/freertos/test/integration/tasks/test_priority_scheduling.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_priority_scheduling.c diff --git a/components/freertos/test/integration/tasks/test_priority_scheduling_smp.c b/components/freertos/test_apps/freertos/kernel/tasks/test_priority_scheduling_smp.c similarity index 100% rename from components/freertos/test/integration/tasks/test_priority_scheduling_smp.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_priority_scheduling_smp.c diff --git a/components/freertos/test/integration/tasks/test_task_delay.c b/components/freertos/test_apps/freertos/kernel/tasks/test_task_delay.c similarity index 100% rename from components/freertos/test/integration/tasks/test_task_delay.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_task_delay.c diff --git a/components/freertos/test/integration/tasks/test_task_priorities.c b/components/freertos/test_apps/freertos/kernel/tasks/test_task_priorities.c similarity index 100% rename from components/freertos/test/integration/tasks/test_task_priorities.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_task_priorities.c diff --git a/components/freertos/test/integration/tasks/test_task_suspend_resume.c b/components/freertos/test_apps/freertos/kernel/tasks/test_task_suspend_resume.c similarity index 100% rename from components/freertos/test/integration/tasks/test_task_suspend_resume.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_task_suspend_resume.c diff --git a/components/freertos/test/integration/tasks/test_tasks_snapshot.c b/components/freertos/test_apps/freertos/kernel/tasks/test_tasks_snapshot.c similarity index 100% rename from components/freertos/test/integration/tasks/test_tasks_snapshot.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_tasks_snapshot.c diff --git a/components/freertos/test/integration/tasks/test_vTaskSuspendAll_xTaskResumeAll.c b/components/freertos/test_apps/freertos/kernel/tasks/test_vTaskSuspendAll_xTaskResumeAll.c similarity index 100% rename from components/freertos/test/integration/tasks/test_vTaskSuspendAll_xTaskResumeAll.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_vTaskSuspendAll_xTaskResumeAll.c diff --git a/components/freertos/test/integration/tasks/test_yielding.c b/components/freertos/test_apps/freertos/kernel/tasks/test_yielding.c similarity index 100% rename from components/freertos/test/integration/tasks/test_yielding.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_yielding.c diff --git a/components/freertos/test/integration/timers/test_timers.c b/components/freertos/test_apps/freertos/kernel/timers/test_timers.c similarity index 100% rename from components/freertos/test/integration/timers/test_timers.c rename to components/freertos/test_apps/freertos/kernel/timers/test_timers.c