From 60edaa4152d46d0f2ed8d7adccdc8d681e40b37f Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 02:29:23 +0800 Subject: [PATCH 1/9] freertos: Add blank freertos test app This commit adds a blank FreeRTOS test app in preparation for migrating of FreeRTOS unit tests to the created test app. --- components/freertos/test/CMakeLists.txt | 15 ------- .../test_apps/freertos/CMakeLists.txt | 16 ++++++++ .../freertos/test_apps/freertos/README.md | 2 + .../test_apps/freertos/main/CMakeLists.txt | 2 + .../freertos/main/test_freertos_main.c | 40 +++++++++++++++++++ .../test_apps/freertos/pytest_freertos.py | 13 ++++++ 6 files changed, 73 insertions(+), 15 deletions(-) delete mode 100644 components/freertos/test/CMakeLists.txt create mode 100644 components/freertos/test_apps/freertos/CMakeLists.txt create mode 100644 components/freertos/test_apps/freertos/README.md create mode 100644 components/freertos/test_apps/freertos/main/CMakeLists.txt create mode 100644 components/freertos/test_apps/freertos/main/test_freertos_main.c create mode 100644 components/freertos/test_apps/freertos/pytest_freertos.py diff --git a/components/freertos/test/CMakeLists.txt b/components/freertos/test/CMakeLists.txt deleted file mode 100644 index ac4364d633..0000000000 --- a/components/freertos/test/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# 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) - -idf_component_register(SRC_DIRS integration # For freertos_test_utils.c - integration/event_groups - integration/queue - integration/stream_buffer - integration/tasks - integration/timers - miscellaneous - performance - port - PRIV_INCLUDE_DIRS . ./integration "${FREERTOS_ORIG_INCLUDE_PATH}" - PRIV_REQUIRES cmock test_utils esp_system driver esp_timer) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/freertos/test_apps/freertos/CMakeLists.txt b/components/freertos/test_apps/freertos/CMakeLists.txt new file mode 100644 index 0000000000..ff3d5d9774 --- /dev/null +++ b/components/freertos/test_apps/freertos/CMakeLists.txt @@ -0,0 +1,16 @@ +# This is the project CMakeLists.txt file for the test subproject +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) + +list(APPEND EXTRA_COMPONENT_DIRS + ${test_types}) # Add each test type as a component + +# "Trim" the build. Include the minimal set of components, main, and anything it depends on. +set(COMPONENTS main) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(freertos_test) diff --git a/components/freertos/test_apps/freertos/README.md b/components/freertos/test_apps/freertos/README.md new file mode 100644 index 0000000000..b5be4985c5 --- /dev/null +++ b/components/freertos/test_apps/freertos/README.md @@ -0,0 +1,2 @@ +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | diff --git a/components/freertos/test_apps/freertos/main/CMakeLists.txt b/components/freertos/test_apps/freertos/main/CMakeLists.txt new file mode 100644 index 0000000000..0d8828ca14 --- /dev/null +++ b/components/freertos/test_apps/freertos/main/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_component_register(SRCS "test_freertos_main.c" + PRIV_REQUIRES unity test_utils driver) diff --git a/components/freertos/test_apps/freertos/main/test_freertos_main.c b/components/freertos/test_apps/freertos/main/test_freertos_main.c new file mode 100644 index 0000000000..e8247d9657 --- /dev/null +++ b/components/freertos/test_apps/freertos/main/test_freertos_main.c @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "unity.h" +#include "unity_test_runner.h" +#include "esp_heap_caps.h" + +#define TEST_MEMORY_LEAK_THRESHOLD (-256) + +static size_t before_free_8bit; +static size_t before_free_32bit; + +static void check_leak(size_t before_free, size_t after_free, const char *type) +{ + ssize_t delta = after_free - before_free; + printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta); + TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak"); +} + +void setUp(void) +{ + before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); +} + +void tearDown(void) +{ + size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); + size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); + check_leak(before_free_8bit, after_free_8bit, "8BIT"); + check_leak(before_free_32bit, after_free_32bit, "32BIT"); +} + +void app_main(void) +{ + unity_run_menu(); +} diff --git a/components/freertos/test_apps/freertos/pytest_freertos.py b/components/freertos/test_apps/freertos/pytest_freertos.py new file mode 100644 index 0000000000..464d842724 --- /dev/null +++ b/components/freertos/test_apps/freertos/pytest_freertos.py @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.supported_targets +@pytest.mark.generic +def test_freertos(dut: Dut) -> None: + dut.expect_exact('Press ENTER to see the list of tests') + dut.write('*') + dut.expect_unity_test_output() From df4bfeee5bce6bb702f74624b8abe11416c38e66 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 01:19:15 +0800 Subject: [PATCH 2/9] 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 From df9aa722afe582362b950de70dce2b596524a1d5 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 01:37:33 +0800 Subject: [PATCH 3/9] freertos: Migrate port tests to test app This commit migrates the "port" tests to the test app as a component. --- components/freertos/test_apps/freertos/CMakeLists.txt | 3 ++- .../freertos/test_apps/freertos/port/CMakeLists.txt | 10 ++++++++++ .../freertos}/port/test_context_save_clobber.S | 0 .../freertos}/port/test_context_save_clobber.c | 0 .../freertos}/port/test_fpu_in_isr.c | 0 .../freertos}/port/test_fpu_in_task.c | 0 .../freertos}/port/test_freertos_hooks.c | 0 .../freertos}/port/test_freertos_isinisrcontext.c | 0 .../freertos}/port/test_newlib_reent.c | 0 .../{test => test_apps/freertos}/port/test_spinlocks.c | 0 .../freertos}/port/test_thread_local.c | 0 .../freertos}/port/test_xtensa_loadstore_handler.c | 0 12 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 components/freertos/test_apps/freertos/port/CMakeLists.txt rename components/freertos/{test => test_apps/freertos}/port/test_context_save_clobber.S (100%) rename components/freertos/{test => test_apps/freertos}/port/test_context_save_clobber.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_fpu_in_isr.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_fpu_in_task.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_freertos_hooks.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_freertos_isinisrcontext.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_newlib_reent.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_spinlocks.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_thread_local.c (100%) rename components/freertos/{test => test_apps/freertos}/port/test_xtensa_loadstore_handler.c (100%) diff --git a/components/freertos/test_apps/freertos/CMakeLists.txt b/components/freertos/test_apps/freertos/CMakeLists.txt index 64a629abec..e0168c913b 100644 --- a/components/freertos/test_apps/freertos/CMakeLists.txt +++ b/components/freertos/test_apps/freertos/CMakeLists.txt @@ -5,7 +5,8 @@ cmake_minimum_required(VERSION 3.16) # split into different directores in the test app's root directory. Each test # type is treated as separate component set(test_types - "kernel") + "kernel" + "port") list(APPEND EXTRA_COMPONENT_DIRS ${test_types} # Add each test type as a component diff --git a/components/freertos/test_apps/freertos/port/CMakeLists.txt b/components/freertos/test_apps/freertos/port/CMakeLists.txt new file mode 100644 index 0000000000..594e8a8295 --- /dev/null +++ b/components/freertos/test_apps/freertos/port/CMakeLists.txt @@ -0,0 +1,10 @@ +# Register all of the "port" tests as a component + +# In order for the cases defined by `TEST_CASE` in "port" to be linked into +# the final elf, the component can be registered as WHOLE_ARCHIVE +idf_component_register(SRC_DIRS "." + PRIV_REQUIRES test_utils + WHOLE_ARCHIVE) + +# Todo: Fix no-format errors +target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/freertos/test/port/test_context_save_clobber.S b/components/freertos/test_apps/freertos/port/test_context_save_clobber.S similarity index 100% rename from components/freertos/test/port/test_context_save_clobber.S rename to components/freertos/test_apps/freertos/port/test_context_save_clobber.S diff --git a/components/freertos/test/port/test_context_save_clobber.c b/components/freertos/test_apps/freertos/port/test_context_save_clobber.c similarity index 100% rename from components/freertos/test/port/test_context_save_clobber.c rename to components/freertos/test_apps/freertos/port/test_context_save_clobber.c diff --git a/components/freertos/test/port/test_fpu_in_isr.c b/components/freertos/test_apps/freertos/port/test_fpu_in_isr.c similarity index 100% rename from components/freertos/test/port/test_fpu_in_isr.c rename to components/freertos/test_apps/freertos/port/test_fpu_in_isr.c diff --git a/components/freertos/test/port/test_fpu_in_task.c b/components/freertos/test_apps/freertos/port/test_fpu_in_task.c similarity index 100% rename from components/freertos/test/port/test_fpu_in_task.c rename to components/freertos/test_apps/freertos/port/test_fpu_in_task.c diff --git a/components/freertos/test/port/test_freertos_hooks.c b/components/freertos/test_apps/freertos/port/test_freertos_hooks.c similarity index 100% rename from components/freertos/test/port/test_freertos_hooks.c rename to components/freertos/test_apps/freertos/port/test_freertos_hooks.c diff --git a/components/freertos/test/port/test_freertos_isinisrcontext.c b/components/freertos/test_apps/freertos/port/test_freertos_isinisrcontext.c similarity index 100% rename from components/freertos/test/port/test_freertos_isinisrcontext.c rename to components/freertos/test_apps/freertos/port/test_freertos_isinisrcontext.c diff --git a/components/freertos/test/port/test_newlib_reent.c b/components/freertos/test_apps/freertos/port/test_newlib_reent.c similarity index 100% rename from components/freertos/test/port/test_newlib_reent.c rename to components/freertos/test_apps/freertos/port/test_newlib_reent.c diff --git a/components/freertos/test/port/test_spinlocks.c b/components/freertos/test_apps/freertos/port/test_spinlocks.c similarity index 100% rename from components/freertos/test/port/test_spinlocks.c rename to components/freertos/test_apps/freertos/port/test_spinlocks.c diff --git a/components/freertos/test/port/test_thread_local.c b/components/freertos/test_apps/freertos/port/test_thread_local.c similarity index 100% rename from components/freertos/test/port/test_thread_local.c rename to components/freertos/test_apps/freertos/port/test_thread_local.c diff --git a/components/freertos/test/port/test_xtensa_loadstore_handler.c b/components/freertos/test_apps/freertos/port/test_xtensa_loadstore_handler.c similarity index 100% rename from components/freertos/test/port/test_xtensa_loadstore_handler.c rename to components/freertos/test_apps/freertos/port/test_xtensa_loadstore_handler.c From 87c3cc57d195503ae02b8422dc81034077fbd98d Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 01:42:13 +0800 Subject: [PATCH 4/9] freertos: Migrate performance tests to test app This commit migrates the "performance" tests to the test app as a component. --- components/freertos/test_apps/freertos/CMakeLists.txt | 1 + .../test_apps/freertos/performance/CMakeLists.txt | 10 ++++++++++ .../performance/test_freertos_scheduling_time.c | 0 .../freertos}/performance/test_isr_latency.c | 0 4 files changed, 11 insertions(+) create mode 100644 components/freertos/test_apps/freertos/performance/CMakeLists.txt rename components/freertos/{test => test_apps/freertos}/performance/test_freertos_scheduling_time.c (100%) rename components/freertos/{test => test_apps/freertos}/performance/test_isr_latency.c (100%) diff --git a/components/freertos/test_apps/freertos/CMakeLists.txt b/components/freertos/test_apps/freertos/CMakeLists.txt index e0168c913b..402da75c30 100644 --- a/components/freertos/test_apps/freertos/CMakeLists.txt +++ b/components/freertos/test_apps/freertos/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.16) # type is treated as separate component set(test_types "kernel" + "performance" "port") list(APPEND EXTRA_COMPONENT_DIRS diff --git a/components/freertos/test_apps/freertos/performance/CMakeLists.txt b/components/freertos/test_apps/freertos/performance/CMakeLists.txt new file mode 100644 index 0000000000..8b2b417d5e --- /dev/null +++ b/components/freertos/test_apps/freertos/performance/CMakeLists.txt @@ -0,0 +1,10 @@ +# Register all of the "performance" tests as a component + +# In order for the cases defined by `TEST_CASE` in "performance" to be linked into +# the final elf, the component can be registered as WHOLE_ARCHIVE +idf_component_register(SRC_DIRS "." + PRIV_REQUIRES test_utils + WHOLE_ARCHIVE) + +# Todo: Fix no-format errors +target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/freertos/test/performance/test_freertos_scheduling_time.c b/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c similarity index 100% rename from components/freertos/test/performance/test_freertos_scheduling_time.c rename to components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c diff --git a/components/freertos/test/performance/test_isr_latency.c b/components/freertos/test_apps/freertos/performance/test_isr_latency.c similarity index 100% rename from components/freertos/test/performance/test_isr_latency.c rename to components/freertos/test_apps/freertos/performance/test_isr_latency.c From 54d7a3bb66e9cee7472a7ed573ada1b00911d480 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 01:45:47 +0800 Subject: [PATCH 5/9] freertos: Migrate misc tests to test app This commit migrates the "misc" tests to the test app as a component. --- components/freertos/test_apps/freertos/CMakeLists.txt | 1 + .../freertos/test_apps/freertos/misc/CMakeLists.txt | 10 ++++++++++ .../misc}/test_freertos_backported_functions.c | 0 .../freertos/misc}/test_freertos_mutex.c | 0 .../freertos/misc}/test_freertos_trace_utilities.c | 0 .../freertos/misc}/test_panic.c | 0 .../freertos/misc}/test_preemption.c | 0 .../freertos/misc}/test_tlsp_del_cb.c | 0 8 files changed, 11 insertions(+) create mode 100644 components/freertos/test_apps/freertos/misc/CMakeLists.txt rename components/freertos/{test/miscellaneous => test_apps/freertos/misc}/test_freertos_backported_functions.c (100%) rename components/freertos/{test/miscellaneous => test_apps/freertos/misc}/test_freertos_mutex.c (100%) rename components/freertos/{test/miscellaneous => test_apps/freertos/misc}/test_freertos_trace_utilities.c (100%) rename components/freertos/{test/miscellaneous => test_apps/freertos/misc}/test_panic.c (100%) rename components/freertos/{test/miscellaneous => test_apps/freertos/misc}/test_preemption.c (100%) rename components/freertos/{test/miscellaneous => test_apps/freertos/misc}/test_tlsp_del_cb.c (100%) diff --git a/components/freertos/test_apps/freertos/CMakeLists.txt b/components/freertos/test_apps/freertos/CMakeLists.txt index 402da75c30..d3ff742e10 100644 --- a/components/freertos/test_apps/freertos/CMakeLists.txt +++ b/components/freertos/test_apps/freertos/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.16) # type is treated as separate component set(test_types "kernel" + "misc" "performance" "port") diff --git a/components/freertos/test_apps/freertos/misc/CMakeLists.txt b/components/freertos/test_apps/freertos/misc/CMakeLists.txt new file mode 100644 index 0000000000..783c5a6af2 --- /dev/null +++ b/components/freertos/test_apps/freertos/misc/CMakeLists.txt @@ -0,0 +1,10 @@ +# Register all of the "misc" tests as a component + +# In order for the cases defined by `TEST_CASE` in "misc" to be linked into +# the final elf, the component can be registered as WHOLE_ARCHIVE +idf_component_register(SRC_DIRS "." + PRIV_REQUIRES test_utils + WHOLE_ARCHIVE) + +# Todo: Fix no-format errors +target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/freertos/test/miscellaneous/test_freertos_backported_functions.c b/components/freertos/test_apps/freertos/misc/test_freertos_backported_functions.c similarity index 100% rename from components/freertos/test/miscellaneous/test_freertos_backported_functions.c rename to components/freertos/test_apps/freertos/misc/test_freertos_backported_functions.c diff --git a/components/freertos/test/miscellaneous/test_freertos_mutex.c b/components/freertos/test_apps/freertos/misc/test_freertos_mutex.c similarity index 100% rename from components/freertos/test/miscellaneous/test_freertos_mutex.c rename to components/freertos/test_apps/freertos/misc/test_freertos_mutex.c diff --git a/components/freertos/test/miscellaneous/test_freertos_trace_utilities.c b/components/freertos/test_apps/freertos/misc/test_freertos_trace_utilities.c similarity index 100% rename from components/freertos/test/miscellaneous/test_freertos_trace_utilities.c rename to components/freertos/test_apps/freertos/misc/test_freertos_trace_utilities.c diff --git a/components/freertos/test/miscellaneous/test_panic.c b/components/freertos/test_apps/freertos/misc/test_panic.c similarity index 100% rename from components/freertos/test/miscellaneous/test_panic.c rename to components/freertos/test_apps/freertos/misc/test_panic.c diff --git a/components/freertos/test/miscellaneous/test_preemption.c b/components/freertos/test_apps/freertos/misc/test_preemption.c similarity index 100% rename from components/freertos/test/miscellaneous/test_preemption.c rename to components/freertos/test_apps/freertos/misc/test_preemption.c diff --git a/components/freertos/test/miscellaneous/test_tlsp_del_cb.c b/components/freertos/test_apps/freertos/misc/test_tlsp_del_cb.c similarity index 100% rename from components/freertos/test/miscellaneous/test_tlsp_del_cb.c rename to components/freertos/test_apps/freertos/misc/test_tlsp_del_cb.c From a50a238c185c758aab1fc7d2edd979dd4be8aaab Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 01:54:01 +0800 Subject: [PATCH 6/9] freertos: Tidy up test organization Some tests were placed in the incorrect test groups (i.e., kernel, port, performance etc). This commit fixes those placements. The following redundant tests were also removed: - "test_panic.c" as behavior is already covered in esp_system tests --- .../test_freertos_backported_functions.c | 0 .../queue}/test_freertos_mutex.c | 0 .../tasks}/test_freertos_hooks.c | 0 .../tasks}/test_freertos_trace_utilities.c | 0 .../{misc => kernel/tasks}/test_preemption.c | 0 .../{port => misc}/test_newlib_reent.c | 0 .../test_apps/freertos/misc/test_panic.c | 25 ------------------- .../tasks => port}/test_tasks_snapshot.c | 0 .../{misc => port}/test_tlsp_del_cb.c | 0 9 files changed, 25 deletions(-) rename components/freertos/test_apps/freertos/{misc => kernel/queue}/test_freertos_backported_functions.c (100%) rename components/freertos/test_apps/freertos/{misc => kernel/queue}/test_freertos_mutex.c (100%) rename components/freertos/test_apps/freertos/{port => kernel/tasks}/test_freertos_hooks.c (100%) rename components/freertos/test_apps/freertos/{misc => kernel/tasks}/test_freertos_trace_utilities.c (100%) rename components/freertos/test_apps/freertos/{misc => kernel/tasks}/test_preemption.c (100%) rename components/freertos/test_apps/freertos/{port => misc}/test_newlib_reent.c (100%) delete mode 100644 components/freertos/test_apps/freertos/misc/test_panic.c rename components/freertos/test_apps/freertos/{kernel/tasks => port}/test_tasks_snapshot.c (100%) rename components/freertos/test_apps/freertos/{misc => port}/test_tlsp_del_cb.c (100%) diff --git a/components/freertos/test_apps/freertos/misc/test_freertos_backported_functions.c b/components/freertos/test_apps/freertos/kernel/queue/test_freertos_backported_functions.c similarity index 100% rename from components/freertos/test_apps/freertos/misc/test_freertos_backported_functions.c rename to components/freertos/test_apps/freertos/kernel/queue/test_freertos_backported_functions.c diff --git a/components/freertos/test_apps/freertos/misc/test_freertos_mutex.c b/components/freertos/test_apps/freertos/kernel/queue/test_freertos_mutex.c similarity index 100% rename from components/freertos/test_apps/freertos/misc/test_freertos_mutex.c rename to components/freertos/test_apps/freertos/kernel/queue/test_freertos_mutex.c diff --git a/components/freertos/test_apps/freertos/port/test_freertos_hooks.c b/components/freertos/test_apps/freertos/kernel/tasks/test_freertos_hooks.c similarity index 100% rename from components/freertos/test_apps/freertos/port/test_freertos_hooks.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_freertos_hooks.c diff --git a/components/freertos/test_apps/freertos/misc/test_freertos_trace_utilities.c b/components/freertos/test_apps/freertos/kernel/tasks/test_freertos_trace_utilities.c similarity index 100% rename from components/freertos/test_apps/freertos/misc/test_freertos_trace_utilities.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_freertos_trace_utilities.c diff --git a/components/freertos/test_apps/freertos/misc/test_preemption.c b/components/freertos/test_apps/freertos/kernel/tasks/test_preemption.c similarity index 100% rename from components/freertos/test_apps/freertos/misc/test_preemption.c rename to components/freertos/test_apps/freertos/kernel/tasks/test_preemption.c diff --git a/components/freertos/test_apps/freertos/port/test_newlib_reent.c b/components/freertos/test_apps/freertos/misc/test_newlib_reent.c similarity index 100% rename from components/freertos/test_apps/freertos/port/test_newlib_reent.c rename to components/freertos/test_apps/freertos/misc/test_newlib_reent.c diff --git a/components/freertos/test_apps/freertos/misc/test_panic.c b/components/freertos/test_apps/freertos/misc/test_panic.c deleted file mode 100644 index 714db87aef..0000000000 --- a/components/freertos/test_apps/freertos/misc/test_panic.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - Test for multicore FreeRTOS. This test spins up threads, fiddles with queues etc. -*/ - -#include -#include - -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "freertos/semphr.h" -#include "freertos/queue.h" -#include "unity.h" - -TEST_CASE("Panic handler", "[freertos][ignore]") -{ - volatile int *i; - i = (volatile int *)0x0; - *i = 1; -} diff --git a/components/freertos/test_apps/freertos/kernel/tasks/test_tasks_snapshot.c b/components/freertos/test_apps/freertos/port/test_tasks_snapshot.c similarity index 100% rename from components/freertos/test_apps/freertos/kernel/tasks/test_tasks_snapshot.c rename to components/freertos/test_apps/freertos/port/test_tasks_snapshot.c diff --git a/components/freertos/test_apps/freertos/misc/test_tlsp_del_cb.c b/components/freertos/test_apps/freertos/port/test_tlsp_del_cb.c similarity index 100% rename from components/freertos/test_apps/freertos/misc/test_tlsp_del_cb.c rename to components/freertos/test_apps/freertos/port/test_tlsp_del_cb.c From c36e06c45c577384736ca5fc38c4c632f9cc9b9b Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 15 Oct 2022 02:29:51 +0800 Subject: [PATCH 7/9] freertos: Add test app sdkconfig This commit adds the sdkconfig files for the FreeRTOS test app. These configurations were dervied from the various legacy unit test app's config files that included the FreeRTOS component. This commit tries to keep a 1 to 1 config parity with the legacy test app. Meaning, if FreeRTOS test were run on a particular target with a particular config, that config will be represented in one of the test app's sdkconfig.ci.XXX files. However, the following configurations were removed for FreeRTOS tests: - The "freertos_flash" option was removed due to redudancy (already tested in freertos_options) --- .../test_apps/freertos/pytest_freertos.py | 9 ++++++++ .../test_apps/freertos/sdkconfig.ci.default | 1 + .../freertos/sdkconfig.ci.freertos_options | 6 +---- .../test_apps/freertos/sdkconfig.ci.psram | 12 ++++++++++ .../test_apps/freertos/sdkconfig.ci.release | 5 ++++ .../freertos/sdkconfig.ci.single_core | 4 ++++ .../test_apps/freertos/sdkconfig.defaults | 7 ++++++ tools/unit-test-app/configs/default | 2 +- tools/unit-test-app/configs/default_2 | 2 +- tools/unit-test-app/configs/default_2_c3 | 2 +- tools/unit-test-app/configs/default_2_s2 | 2 +- tools/unit-test-app/configs/default_2_s3 | 2 +- tools/unit-test-app/configs/default_3_c2 | 2 +- tools/unit-test-app/configs/default_c2 | 2 +- tools/unit-test-app/configs/default_c3 | 2 +- tools/unit-test-app/configs/default_s2_1 | 2 +- tools/unit-test-app/configs/default_s3 | 2 +- tools/unit-test-app/configs/freertos_flash | 2 +- tools/unit-test-app/configs/freertos_options | 23 ------------------- .../unit-test-app/configs/freertos_options_c3 | 22 ------------------ .../unit-test-app/configs/freertos_options_s2 | 21 ----------------- tools/unit-test-app/configs/psram | 2 +- tools/unit-test-app/configs/psram_3 | 2 +- tools/unit-test-app/configs/release | 2 +- tools/unit-test-app/configs/release_2 | 2 +- tools/unit-test-app/configs/release_2_s2 | 2 +- tools/unit-test-app/configs/release_c2 | 2 +- tools/unit-test-app/configs/release_c3 | 2 +- tools/unit-test-app/configs/release_s2 | 2 +- tools/unit-test-app/configs/release_s3 | 2 +- tools/unit-test-app/configs/single_core | 2 +- tools/unit-test-app/configs/single_core_2 | 2 +- tools/unit-test-app/configs/single_core_2_s2 | 2 +- tools/unit-test-app/sdkconfig.defaults | 4 ---- 34 files changed, 62 insertions(+), 98 deletions(-) create mode 100644 components/freertos/test_apps/freertos/sdkconfig.ci.default rename tools/unit-test-app/configs/freertos_options_c2 => components/freertos/test_apps/freertos/sdkconfig.ci.freertos_options (76%) create mode 100644 components/freertos/test_apps/freertos/sdkconfig.ci.psram create mode 100644 components/freertos/test_apps/freertos/sdkconfig.ci.release create mode 100644 components/freertos/test_apps/freertos/sdkconfig.ci.single_core create mode 100644 components/freertos/test_apps/freertos/sdkconfig.defaults delete mode 100644 tools/unit-test-app/configs/freertos_options delete mode 100644 tools/unit-test-app/configs/freertos_options_c3 delete mode 100644 tools/unit-test-app/configs/freertos_options_s2 diff --git a/components/freertos/test_apps/freertos/pytest_freertos.py b/components/freertos/test_apps/freertos/pytest_freertos.py index 464d842724..dee8f04e11 100644 --- a/components/freertos/test_apps/freertos/pytest_freertos.py +++ b/components/freertos/test_apps/freertos/pytest_freertos.py @@ -4,9 +4,18 @@ import pytest from pytest_embedded import Dut +CONFIGS = [ + pytest.param('default', marks=[pytest.mark.supported_targets]), + pytest.param('freertos_options', marks=[pytest.mark.supported_targets]), + pytest.param('psram', marks=[pytest.mark.esp32]), + pytest.param('release', marks=[pytest.mark.supported_targets]), + pytest.param('single_core', marks=[pytest.mark.esp32]), +] + @pytest.mark.supported_targets @pytest.mark.generic +@pytest.mark.parametrize('config', CONFIGS, indirect=True) def test_freertos(dut: Dut) -> None: dut.expect_exact('Press ENTER to see the list of tests') dut.write('*') diff --git a/components/freertos/test_apps/freertos/sdkconfig.ci.default b/components/freertos/test_apps/freertos/sdkconfig.ci.default new file mode 100644 index 0000000000..c149cb926f --- /dev/null +++ b/components/freertos/test_apps/freertos/sdkconfig.ci.default @@ -0,0 +1 @@ +# This is left intentionally blank. It inherits all configurations from sdkconfg.defaults diff --git a/tools/unit-test-app/configs/freertos_options_c2 b/components/freertos/test_apps/freertos/sdkconfig.ci.freertos_options similarity index 76% rename from tools/unit-test-app/configs/freertos_options_c2 rename to components/freertos/test_apps/freertos/sdkconfig.ci.freertos_options index 53b3026581..15a026cfe6 100644 --- a/tools/unit-test-app/configs/freertos_options_c2 +++ b/components/freertos/test_apps/freertos/sdkconfig.ci.freertos_options @@ -1,8 +1,4 @@ -# This is a small set of tests where we enable as many as possible of the optional features -# in FreeRTOS that are gated behind config - -CONFIG_IDF_TARGET="esp32c2" -TEST_COMPONENTS=freertos +# Test configuration for enabling multiple optional FreeRTOS related features. Tested on all targets CONFIG_FREERTOS_CORETIMER_1=y CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=n diff --git a/components/freertos/test_apps/freertos/sdkconfig.ci.psram b/components/freertos/test_apps/freertos/sdkconfig.ci.psram new file mode 100644 index 0000000000..5294d295d6 --- /dev/null +++ b/components/freertos/test_apps/freertos/sdkconfig.ci.psram @@ -0,0 +1,12 @@ +# Test configuration for using FreeRTOS with PSRAM enabled. Only tested on the ESP32 + +CONFIG_IDF_TARGET="esp32" + +# Enable SPIRAM +CONFIG_SPIRAM=y +CONFIG_SPIRAM_OCCUPY_NO_HOST=y + +# Disable encrypted flash reads/writes to save IRAM in this build configuration +CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=n +CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY=y +CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y diff --git a/components/freertos/test_apps/freertos/sdkconfig.ci.release b/components/freertos/test_apps/freertos/sdkconfig.ci.release new file mode 100644 index 0000000000..9a981808d7 --- /dev/null +++ b/components/freertos/test_apps/freertos/sdkconfig.ci.release @@ -0,0 +1,5 @@ +# Test configuration for a release build of FreeRTOS. Tested on all targets + +CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/components/freertos/test_apps/freertos/sdkconfig.ci.single_core b/components/freertos/test_apps/freertos/sdkconfig.ci.single_core new file mode 100644 index 0000000000..69b5e1abdc --- /dev/null +++ b/components/freertos/test_apps/freertos/sdkconfig.ci.single_core @@ -0,0 +1,4 @@ +# Test configuration for using FreeRTOS with under single core on a multicore target. Only tested on the ESP32 + +CONFIG_IDF_TARGET="esp32" +CONFIG_FREERTOS_UNICORE=y diff --git a/components/freertos/test_apps/freertos/sdkconfig.defaults b/components/freertos/test_apps/freertos/sdkconfig.defaults new file mode 100644 index 0000000000..44149a08d4 --- /dev/null +++ b/components/freertos/test_apps/freertos/sdkconfig.defaults @@ -0,0 +1,7 @@ +CONFIG_ESP_TASK_WDT=n +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=3 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=7 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3000 +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y diff --git a/tools/unit-test-app/configs/default b/tools/unit-test-app/configs/default index 8738fb2b14..6452c346d2 100644 --- a/tools/unit-test-app/configs/default +++ b/tools/unit-test-app/configs/default @@ -1,5 +1,5 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) # IRAM is full... split some component to default_32_2 CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver +TEST_COMPONENTS=esp_hw_support esp_ipc esp_system esp_timer driver CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD=y diff --git a/tools/unit-test-app/configs/default_2 b/tools/unit-test-app/configs/default_2 index 630f9c0693..80c4880421 100644 --- a/tools/unit-test-app/configs/default_2 +++ b/tools/unit-test-app/configs/default_2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=bt esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component diff --git a/tools/unit-test-app/configs/default_2_c3 b/tools/unit-test-app/configs/default_2_c3 index 44504fc9a2..3d9d41cff8 100644 --- a/tools/unit-test-app/configs/default_2_c3 +++ b/tools/unit-test-app/configs/default_2_c3 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be excluded CONFIG_IDF_TARGET="esp32c3" -TEST_EXCLUDE_COMPONENTS=bt esp_pm freertos esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs lwip spiffs experimental_cpp_component perfmon test_utils +TEST_EXCLUDE_COMPONENTS=bt esp_pm esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs lwip spiffs experimental_cpp_component perfmon test_utils diff --git a/tools/unit-test-app/configs/default_2_s2 b/tools/unit-test-app/configs/default_2_s2 index fc5fc9cba0..8cae45705e 100644 --- a/tools/unit-test-app/configs/default_2_s2 +++ b/tools/unit-test-app/configs/default_2_s2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=bt esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component diff --git a/tools/unit-test-app/configs/default_2_s3 b/tools/unit-test-app/configs/default_2_s3 index dcc7249252..156b131f2f 100644 --- a/tools/unit-test-app/configs/default_2_s3 +++ b/tools/unit-test-app/configs/default_2_s3 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s3" -TEST_EXCLUDE_COMPONENTS=bt freertos esp32s3 esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component test_utils +TEST_EXCLUDE_COMPONENTS=bt esp32s3 esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component test_utils diff --git a/tools/unit-test-app/configs/default_3_c2 b/tools/unit-test-app/configs/default_3_c2 index 6c394c843c..6d2a2958e8 100644 --- a/tools/unit-test-app/configs/default_3_c2 +++ b/tools/unit-test-app/configs/default_3_c2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c2" -TEST_EXCLUDE_COMPONENTS=app_trace efuse esp_common esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc freertos esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs +TEST_EXCLUDE_COMPONENTS=app_trace efuse esp_common esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs diff --git a/tools/unit-test-app/configs/default_c2 b/tools/unit-test-app/configs/default_c2 index 7009dfe166..607a538835 100644 --- a/tools/unit-test-app/configs/default_c2 +++ b/tools/unit-test-app/configs/default_c2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c2" -TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs +TEST_COMPONENTS= esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs diff --git a/tools/unit-test-app/configs/default_c3 b/tools/unit-test-app/configs/default_c3 index 67c9a75f90..36322c5b5e 100644 --- a/tools/unit-test-app/configs/default_c3 +++ b/tools/unit-test-app/configs/default_c3 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c3" -TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver +TEST_COMPONENTS=esp_hw_support esp_ipc esp_system esp_timer driver diff --git a/tools/unit-test-app/configs/default_s2_1 b/tools/unit-test-app/configs/default_s2_1 index ec990e29a4..cf5ae3fa56 100644 --- a/tools/unit-test-app/configs/default_s2_1 +++ b/tools/unit-test-app/configs/default_s2_1 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_COMPONENTS=freertos esp_hw_support esp_system esp_timer driver +TEST_COMPONENTS=esp_hw_support esp_system esp_timer driver diff --git a/tools/unit-test-app/configs/default_s3 b/tools/unit-test-app/configs/default_s3 index 0d78b2ff2a..b7767ea89c 100644 --- a/tools/unit-test-app/configs/default_s3 +++ b/tools/unit-test-app/configs/default_s3 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32s3" -TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs +TEST_COMPONENTS=esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs diff --git a/tools/unit-test-app/configs/freertos_flash b/tools/unit-test-app/configs/freertos_flash index 99c6b71961..0d3204820c 100644 --- a/tools/unit-test-app/configs/freertos_flash +++ b/tools/unit-test-app/configs/freertos_flash @@ -1,2 +1,2 @@ -TEST_COMPONENTS=freertos driver spi_flash +TEST_COMPONENTS=driver spi_flash CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y diff --git a/tools/unit-test-app/configs/freertos_options b/tools/unit-test-app/configs/freertos_options deleted file mode 100644 index 3e3196c6c5..0000000000 --- a/tools/unit-test-app/configs/freertos_options +++ /dev/null @@ -1,23 +0,0 @@ -# This is a small set of tests where we enable as many as possible of the optional features -# in FreeRTOS that are gated behind config - -CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos - -CONFIG_FREERTOS_CORETIMER_1=y -CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=n -CONFIG_FREERTOS_HZ=500 -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL=y -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=n -CONFIG_FREERTOS_LEGACY_HOOKS=y -CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=10 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y -CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y -CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y -CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y -CONFIG_FREERTOS_FPU_IN_ISR=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=16 -CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y diff --git a/tools/unit-test-app/configs/freertos_options_c3 b/tools/unit-test-app/configs/freertos_options_c3 deleted file mode 100644 index 3ef2aa5066..0000000000 --- a/tools/unit-test-app/configs/freertos_options_c3 +++ /dev/null @@ -1,22 +0,0 @@ -# This is a small set of tests where we enable as many as possible of the optional features -# in FreeRTOS that are gated behind config - -CONFIG_IDF_TARGET="esp32c3" -TEST_COMPONENTS=freertos - -CONFIG_FREERTOS_CORETIMER_1=y -CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=n -CONFIG_FREERTOS_HZ=500 -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL=y -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=n -CONFIG_FREERTOS_LEGACY_HOOKS=y -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=10 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y -CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y -CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y -CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y -CONFIG_FREERTOS_FPU_IN_ISR=y diff --git a/tools/unit-test-app/configs/freertos_options_s2 b/tools/unit-test-app/configs/freertos_options_s2 deleted file mode 100644 index c06addfa52..0000000000 --- a/tools/unit-test-app/configs/freertos_options_s2 +++ /dev/null @@ -1,21 +0,0 @@ -# This is a small set of tests where we enable as many as possible of the optional features -# in FreeRTOS that are gated behind config - -CONFIG_IDF_TARGET="esp32s2" -TEST_COMPONENTS=freertos - -CONFIG_FREERTOS_CORETIMER_1=y -CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=n -CONFIG_FREERTOS_HZ=500 -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL=y -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=n -CONFIG_FREERTOS_LEGACY_HOOKS=y -CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=10 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y -CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y -CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y -CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y -CONFIG_FREERTOS_FPU_IN_ISR=y diff --git a/tools/unit-test-app/configs/psram b/tools/unit-test-app/configs/psram index f550a59836..8870f0b994 100644 --- a/tools/unit-test-app/configs/psram +++ b/tools/unit-test-app/configs/psram @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=bt driver esp_hw_support esp_ipc esp_pm esp_system esp_timer spi_flash test_utils soc experimental_cpp_component esp-tls freertos sdmmc +TEST_EXCLUDE_COMPONENTS=bt driver esp_hw_support esp_ipc esp_pm esp_system esp_timer spi_flash test_utils soc experimental_cpp_component esp-tls sdmmc CONFIG_SPIRAM=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 CONFIG_SPIRAM_OCCUPY_NO_HOST=y diff --git a/tools/unit-test-app/configs/psram_3 b/tools/unit-test-app/configs/psram_3 index d61e270efc..375d781f4b 100644 --- a/tools/unit-test-app/configs/psram_3 +++ b/tools/unit-test-app/configs/psram_3 @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=driver freertos sdmmc +TEST_COMPONENTS=driver sdmmc CONFIG_SPIRAM=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 CONFIG_SPIRAM_OCCUPY_NO_HOST=y diff --git a/tools/unit-test-app/configs/release b/tools/unit-test-app/configs/release index c48959fc34..7f208af2ad 100644 --- a/tools/unit-test-app/configs/release +++ b/tools/unit-test-app/configs/release @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos esp_hw_support esp_system esp_ipc esp_timer driver soc spi_flash vfs +TEST_COMPONENTS=esp_hw_support esp_system esp_ipc esp_timer driver soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_2 b/tools/unit-test-app/configs/release_2 index b667b13bdf..8988678b67 100644 --- a/tools/unit-test-app/configs/release_2 +++ b/tools/unit-test-app/configs/release_2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=bt esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_2_s2 b/tools/unit-test-app/configs/release_2_s2 index 5354f78f96..fe59e9a7d5 100644 --- a/tools/unit-test-app/configs/release_2_s2 +++ b/tools/unit-test-app/configs/release_2_s2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=bt esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_c2 b/tools/unit-test-app/configs/release_c2 index e836324554..dfc01e9428 100644 --- a/tools/unit-test-app/configs/release_c2 +++ b/tools/unit-test-app/configs/release_c2 @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32c2" -TEST_COMPONENTS=freertos esp_hw_support esp_system esp_ipc esp_timer driver soc spi_flash vfs sdmmc +TEST_COMPONENTS=esp_hw_support esp_system esp_ipc esp_timer driver soc spi_flash vfs sdmmc CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y diff --git a/tools/unit-test-app/configs/release_c3 b/tools/unit-test-app/configs/release_c3 index e5cc761843..9e438d4f17 100644 --- a/tools/unit-test-app/configs/release_c3 +++ b/tools/unit-test-app/configs/release_c3 @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32c3" -TEST_COMPONENTS=freertos esp_hw_support esp_ipc esp_system esp_timer driver +TEST_COMPONENTS=esp_hw_support esp_ipc esp_system esp_timer driver CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y diff --git a/tools/unit-test-app/configs/release_s2 b/tools/unit-test-app/configs/release_s2 index 71e26b6e8f..9014edbae3 100644 --- a/tools/unit-test-app/configs/release_s2 +++ b/tools/unit-test-app/configs/release_s2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_COMPONENTS=freertos esp_hw_support esp_system esp_timer driver soc spi_flash vfs +TEST_COMPONENTS=esp_hw_support esp_system esp_timer driver soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_s3 b/tools/unit-test-app/configs/release_s3 index bb50ddbf3f..bc0282af27 100644 --- a/tools/unit-test-app/configs/release_s3 +++ b/tools/unit-test-app/configs/release_s3 @@ -1,5 +1,5 @@ CONFIG_IDF_TARGET="esp32s3" -TEST_COMPONENTS=freertos esp_hw_support esp_system esp_ipc esp_timer driver soc spi_flash vfs +TEST_COMPONENTS=esp_hw_support esp_system esp_ipc esp_timer driver soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/single_core b/tools/unit-test-app/configs/single_core index ef974638b8..55fdffe341 100644 --- a/tools/unit-test-app/configs/single_core +++ b/tools/unit-test-app/configs/single_core @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos esp_hw_support esp_system esp_timer driver soc spi_flash vfs +TEST_COMPONENTS=esp_hw_support esp_system esp_timer driver soc spi_flash vfs CONFIG_MEMMAP_SMP=n CONFIG_FREERTOS_UNICORE=y CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY=y diff --git a/tools/unit-test-app/configs/single_core_2 b/tools/unit-test-app/configs/single_core_2 index ade7034957..011c3790bc 100644 --- a/tools/unit-test-app/configs/single_core_2 +++ b/tools/unit-test-app/configs/single_core_2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_system esp_pm esp_ipc esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=bt esp_hw_support esp_system esp_pm esp_ipc esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component CONFIG_MEMMAP_SMP=n CONFIG_FREERTOS_UNICORE=y CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y diff --git a/tools/unit-test-app/configs/single_core_2_s2 b/tools/unit-test-app/configs/single_core_2_s2 index c56816e445..338ecf6e85 100644 --- a/tools/unit-test-app/configs/single_core_2_s2 +++ b/tools/unit-test-app/configs/single_core_2_s2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be excluded (esp32, esp32s2) CONFIG_IDF_TARGET="esp32s2" -TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_system esp_pm esp_timer driver soc spi_flash vfs experimental_cpp_component +TEST_EXCLUDE_COMPONENTS=bt esp_hw_support esp_ipc esp_system esp_pm esp_timer driver soc spi_flash vfs experimental_cpp_component CONFIG_MEMMAP_SMP=n CONFIG_FREERTOS_UNICORE=y CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y diff --git a/tools/unit-test-app/sdkconfig.defaults b/tools/unit-test-app/sdkconfig.defaults index 0e32c97821..3932be9a46 100644 --- a/tools/unit-test-app/sdkconfig.defaults +++ b/tools/unit-test-app/sdkconfig.defaults @@ -7,13 +7,10 @@ CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_app.csv" CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=3 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_HEAP_POISONING_COMPREHENSIVE=y CONFIG_SPI_FLASH_ENABLE_COUNTERS=y CONFIG_ESP_TASK_WDT_INIT=n CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS=y -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=7 CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y CONFIG_COMPILER_STACK_CHECK=y CONFIG_ESP_TIMER_PROFILING=y @@ -23,6 +20,5 @@ CONFIG_SPI_MASTER_IN_IRAM=y CONFIG_EFUSE_VIRTUAL=y CONFIG_SPIRAM_BANKSWITCH_ENABLE=n CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL=y -CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3000 CONFIG_MQTT_TEST_BROKER_URI="mqtt://${EXAMPLE_MQTT_BROKER_TCP}" CONFIG_NVS_ASSERT_ERROR_CHECK=y From 96fce0c9c41df7f1b3eddd8086412c2031ff1a38 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Wed, 19 Oct 2022 22:18:32 +0800 Subject: [PATCH 8/9] freertos: Fix/remove flakey tests after migration This commit fixes/ignores flakey freertos unit tests after migrating them to the test app: - Added vTaskDelay() before teardown to prevent memory leaks - Adjusted the "main" task's priority so that scheudling tasks would work - pytest now only runs tests that are not ignored - Reset tests are temporarily ignored. Will be enabled to dedicate reset tests. - Some flakey tests are fixed by adjusting delays and stack sizes. --- .../kernel/queue/test_freertos_mutex.c | 6 +++- .../kernel/tasks/test_eTaskGetState.c | 8 ++--- .../freertos/kernel/tasks/test_task_delay.c | 32 +++++++++++-------- .../kernel/tasks/test_task_suspend_resume.c | 12 ++++++- .../freertos/main/test_freertos_main.c | 18 ++++++++++- .../test_apps/freertos/pytest_freertos.py | 5 +-- .../test_apps/freertos/sdkconfig.defaults | 1 + 7 files changed, 60 insertions(+), 22 deletions(-) diff --git a/components/freertos/test_apps/freertos/kernel/queue/test_freertos_mutex.c b/components/freertos/test_apps/freertos/kernel/queue/test_freertos_mutex.c index 4d6d4a0b75..faddacab9b 100644 --- a/components/freertos/test_apps/freertos/kernel/queue/test_freertos_mutex.c +++ b/components/freertos/test_apps/freertos/kernel/queue/test_freertos_mutex.c @@ -20,7 +20,11 @@ static void mutex_release_task(void* arg) TEST_FAIL_MESSAGE("should not be reached"); } -TEST_CASE("mutex released not by owner causes an assert", "[freertos][reset=assert,SW_CPU_RESET]") +/* +Reset tests are temporarily ignored until the test app supports running them separately. +IDF-6096 +*/ +TEST_CASE("mutex released not by owner causes an assert", "[freertos][ignore][reset=assert,SW_CPU_RESET]") { SemaphoreHandle_t mutex = xSemaphoreCreateMutex(); xSemaphoreTake(mutex, portMAX_DELAY); diff --git a/components/freertos/test_apps/freertos/kernel/tasks/test_eTaskGetState.c b/components/freertos/test_apps/freertos/kernel/tasks/test_eTaskGetState.c index 7b5a48f7dd..cd742e0a8a 100644 --- a/components/freertos/test_apps/freertos/kernel/tasks/test_eTaskGetState.c +++ b/components/freertos/test_apps/freertos/kernel/tasks/test_eTaskGetState.c @@ -56,13 +56,13 @@ TEST_CASE("Test eTaskGetState", "[freertos]") // Create tasks of each state on each core for (int i = 0; i < portNUM_PROCESSORS; i++) { - TEST_ASSERT_EQUAL(pdPASS, xTaskCreatePinnedToCore(blocked_task, "blkd", configMINIMAL_STACK_SIZE, NULL, UNITY_FREERTOS_PRIORITY - 1, &blocked_tasks[i], i)); - TEST_ASSERT_EQUAL(pdPASS, xTaskCreatePinnedToCore(suspended_task, "susp", configMINIMAL_STACK_SIZE, NULL, UNITY_FREERTOS_PRIORITY - 1, &suspended_tasks[i], i)); - TEST_ASSERT_EQUAL(pdPASS, xTaskCreatePinnedToCore(loop_task, "rdy", configMINIMAL_STACK_SIZE, NULL, UNITY_FREERTOS_PRIORITY - 1, &ready_tasks[i], i)); + TEST_ASSERT_EQUAL(pdPASS, xTaskCreatePinnedToCore(blocked_task, "blkd", configMINIMAL_STACK_SIZE * 2, NULL, UNITY_FREERTOS_PRIORITY - 1, &blocked_tasks[i], i)); + TEST_ASSERT_EQUAL(pdPASS, xTaskCreatePinnedToCore(suspended_task, "susp", configMINIMAL_STACK_SIZE * 2, NULL, UNITY_FREERTOS_PRIORITY - 1, &suspended_tasks[i], i)); + TEST_ASSERT_EQUAL(pdPASS, xTaskCreatePinnedToCore(loop_task, "rdy", configMINIMAL_STACK_SIZE * 2, NULL, UNITY_FREERTOS_PRIORITY - 1, &ready_tasks[i], i)); if (i == UNITY_FREERTOS_CPU) { running_tasks[i] = xTaskGetCurrentTaskHandle(); } else { - xTaskCreatePinnedToCore(loop_task, "run", configMINIMAL_STACK_SIZE, NULL, UNITY_FREERTOS_PRIORITY, &running_tasks[i], i); + xTaskCreatePinnedToCore(loop_task, "run", configMINIMAL_STACK_SIZE * 2, NULL, UNITY_FREERTOS_PRIORITY, &running_tasks[i], i); } } diff --git a/components/freertos/test_apps/freertos/kernel/tasks/test_task_delay.c b/components/freertos/test_apps/freertos/kernel/tasks/test_task_delay.c index 9a54db40b5..a4eeae8756 100644 --- a/components/freertos/test_apps/freertos/kernel/tasks/test_task_delay.c +++ b/components/freertos/test_apps/freertos/kernel/tasks/test_task_delay.c @@ -27,8 +27,8 @@ Procedure: - For single core, run the test directly from the UnityTask - For SMP, run the test once on each core (using vTestOnAllCores()) Expected: - - The elapsed ticks should be TEST_VTASKDELAY_TICKS, with 1 tick of error allowed (in case ref clock functions last - long enough to cross a tick boundary). + - The elapsed ticks should be TEST_VTASKDELAY_TICKS, with 1 tick of error allowed (in case the delay and ref clock + functions last long enough to cross a tick boundary). - The elapsed time should be equivalent to TEST_VTASKDELAY_TICKS tick periods, with 1 tick period of error allowed (in case ref clock functions last longer that a tick period). */ @@ -57,8 +57,8 @@ static void test_vTaskDelay(void *arg) tick_end = xTaskGetTickCount(); ref_clock_end = portTEST_REF_CLOCK_GET_TIME(); - /* Check that elapsed ticks and ref clock is accurate. We allow 1 tick of error in case vTaskDelay() was called - * right before/after the tick boundary. */ + /* Check that elapsed ticks and ref clock is accurate. We allow 1 tick of error in case vTaskDelay() or + * portTEST_REF_CLOCK_GET_TIME() last long enough to cross a tick boundary */ #if ( configUSE_16_BIT_TICKS == 1 ) TEST_ASSERT_UINT16_WITHIN(1, TEST_VTASKDELAY_TICKS, tick_end - tick_start); #else @@ -102,8 +102,8 @@ Procedure: - For single core, run the test directly from the UnityTask - For SMP, run the test once on each core (using vTestOnAllCores()) Expected: - - The elapsed ticks should be exactly TEST_VTASKDELAYUNTIL_TICKS since vTaskDelayUntil() is relative to the previous - wake time + - The elapsed ticks should be TEST_VTASKDELAYUNTIL_TICKS, with 1 tick of error allowed (in case the delay and ref + clock functions last long enough to cross a tick boundary). - The elapsed time should be equivalent to TEST_VTASKDELAYUNTIL_TICKS tick periods, with 1 tick period of error allowed (in case ref clock functions last longer that a tick period). */ @@ -115,13 +115,13 @@ Expected: static void test_vTaskDelayUntil(void *arg) { - /* Delay until the next tick boundary */ - vTaskDelay(1); - for (int i = 0; i < TEST_VTASKDELAYUNTIL_ITERATIONS; i++) { TickType_t tick_start, tick_end, last_wake_tick; portTEST_REF_CLOCK_TYPE ref_clock_start, ref_clock_end; + /* Delay until the next tick boundary */ + vTaskDelay(1); + /* Get the current tick count and ref clock time */ tick_start = xTaskGetTickCount(); last_wake_tick = tick_start; @@ -133,10 +133,16 @@ static void test_vTaskDelayUntil(void *arg) tick_end = xTaskGetTickCount(); ref_clock_end = portTEST_REF_CLOCK_GET_TIME(); - /* Check that the elapsed ticks is accurate. Elapsed ticks should be exact as vTaskDelayUntil() executes a - * delay relative to last_wake_tick. */ - TEST_ASSERT_EQUAL(TEST_VTASKDELAYUNTIL_TICKS, tick_end - tick_start); - TEST_ASSERT_EQUAL(tick_end, last_wake_tick); + + /* Check that elapsed ticks and ref clock is accurate. We allow 1 tick of error in case vTaskDelayUntil() or + * portTEST_REF_CLOCK_GET_TIME() last long enough to cross a tick boundary */ + #if ( configUSE_16_BIT_TICKS == 1 ) + TEST_ASSERT_UINT16_WITHIN(1, TEST_VTASKDELAYUNTIL_TICKS, tick_end - tick_start); + TEST_ASSERT_UINT16_WITHIN(1, tick_end, last_wake_tick); + #else + TEST_ASSERT_UINT32_WITHIN(1, TEST_VTASKDELAYUNTIL_TICKS, tick_end - tick_start); + TEST_ASSERT_UINT32_WITHIN(1, tick_end, last_wake_tick); + #endif /* Check that the elapsed ref clock time is accurate. We allow 1 tick time worth of error to account for the * the execution time of the ref clock functions. */ diff --git a/components/freertos/test_apps/freertos/kernel/tasks/test_task_suspend_resume.c b/components/freertos/test_apps/freertos/kernel/tasks/test_task_suspend_resume.c index dfee45eedb..307c91cb77 100644 --- a/components/freertos/test_apps/freertos/kernel/tasks/test_task_suspend_resume.c +++ b/components/freertos/test_apps/freertos/kernel/tasks/test_task_suspend_resume.c @@ -80,7 +80,17 @@ TEST_CASE("Suspend/resume task on same core", "[freertos]") } #ifndef CONFIG_FREERTOS_UNICORE -TEST_CASE("Suspend/resume task on other core", "[freertos]") +/* +Note: This test is ignore for now due to a known issue (xKernelLock contention + task state change will lead to a race +condition). More specifically: + +- test_suspend_resume() suspends task_count() thus moving it to the suspended list +- But task_count() is already contesting the xKernelLock. +- Changes its own task list once it takes the xKernelLock +- xKernelLock never receives the crosscore interrupt as it was contesting for xKernelLock +Addressed in IDF-5844 +*/ +TEST_CASE("Suspend/resume task on other core", "[freertos][ignore]") { test_suspend_resume(!UNITY_FREERTOS_CPU); } diff --git a/components/freertos/test_apps/freertos/main/test_freertos_main.c b/components/freertos/test_apps/freertos/main/test_freertos_main.c index e8247d9657..2293213827 100644 --- a/components/freertos/test_apps/freertos/main/test_freertos_main.c +++ b/components/freertos/test_apps/freertos/main/test_freertos_main.c @@ -4,11 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" #include "unity.h" #include "unity_test_runner.h" #include "esp_heap_caps.h" +#include "test_utils.h" -#define TEST_MEMORY_LEAK_THRESHOLD (-256) +#define TEST_MEMORY_LEAK_THRESHOLD (-512) static size_t before_free_8bit; static size_t before_free_32bit; @@ -28,6 +31,8 @@ void setUp(void) void tearDown(void) { + // Add a short delay of 10ms to allow the idle task to free an remaining memory + vTaskDelay(pdMS_TO_TICKS(10)); size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); check_leak(before_free_8bit, after_free_8bit, "8BIT"); @@ -36,5 +41,16 @@ void tearDown(void) void app_main(void) { + /* + Some FreeRTOS tests are reliant on the main task being at priority UNITY_FREERTOS_PRIORITY to test scheduling + behavior. Thus, we raise the main task's priority before any tasks are run. See IDF-6088 + */ + vTaskPrioritySet(NULL, UNITY_FREERTOS_PRIORITY); + printf(" ______ _____ _______ ____ _____\n"); + printf("| ____| | __ \\__ __/ __ \\ / ____|\n"); + printf("| |__ _ __ ___ ___| |__) | | | | | | | (___\n"); + printf("| __| '__/ _ \\/ _ \\ _ / | | | | | |\\___ \\\n"); + printf("| | | | | __/ __/ | \\ \\ | | | |__| |____) |\n"); + printf("|_| |_| \\___|\\___|_| \\_\\ |_| \\____/|_____/\n"); unity_run_menu(); } diff --git a/components/freertos/test_apps/freertos/pytest_freertos.py b/components/freertos/test_apps/freertos/pytest_freertos.py index dee8f04e11..02b927997a 100644 --- a/components/freertos/test_apps/freertos/pytest_freertos.py +++ b/components/freertos/test_apps/freertos/pytest_freertos.py @@ -18,5 +18,6 @@ CONFIGS = [ @pytest.mark.parametrize('config', CONFIGS, indirect=True) def test_freertos(dut: Dut) -> None: dut.expect_exact('Press ENTER to see the list of tests') - dut.write('*') - dut.expect_unity_test_output() + dut.write('![ignore]') + # All of the FreeRTOS tests combined take > 60s to run. So we use a 120s timeout + dut.expect_unity_test_output(timeout=120) diff --git a/components/freertos/test_apps/freertos/sdkconfig.defaults b/components/freertos/test_apps/freertos/sdkconfig.defaults index 44149a08d4..8905783d27 100644 --- a/components/freertos/test_apps/freertos/sdkconfig.defaults +++ b/components/freertos/test_apps/freertos/sdkconfig.defaults @@ -1,3 +1,4 @@ +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 CONFIG_ESP_TASK_WDT=n CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=3 From 09587b84c2c22e4f3262ec88cc3a21530836b049 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Tue, 25 Oct 2022 17:41:06 +0200 Subject: [PATCH 9/9] freertos: final test cleanup --- .../freertos/kernel/stream_buffer/test_stream_buffers.c | 2 ++ components/freertos/test_apps/freertos/pytest_freertos.py | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/freertos/test_apps/freertos/kernel/stream_buffer/test_stream_buffers.c b/components/freertos/test_apps/freertos/kernel/stream_buffer/test_stream_buffers.c index 56a7d63cda..ded5bc1799 100644 --- a/components/freertos/test_apps/freertos/kernel/stream_buffer/test_stream_buffers.c +++ b/components/freertos/test_apps/freertos/kernel/stream_buffer/test_stream_buffers.c @@ -15,6 +15,7 @@ #include "unity.h" #include "test_utils.h" +#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2, ESP32C3) typedef struct { StreamBufferHandle_t sb; SemaphoreHandle_t end_test; @@ -107,3 +108,4 @@ TEST_CASE("Send-receive stream buffer test", "[freertos]") vStreamBufferDelete(tc.sb); vSemaphoreDelete(tc.end_test); } +#endif diff --git a/components/freertos/test_apps/freertos/pytest_freertos.py b/components/freertos/test_apps/freertos/pytest_freertos.py index 02b927997a..8ce75fb490 100644 --- a/components/freertos/test_apps/freertos/pytest_freertos.py +++ b/components/freertos/test_apps/freertos/pytest_freertos.py @@ -13,7 +13,6 @@ CONFIGS = [ ] -@pytest.mark.supported_targets @pytest.mark.generic @pytest.mark.parametrize('config', CONFIGS, indirect=True) def test_freertos(dut: Dut) -> None: