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.
This commit is contained in:
Darian Leung 2022-10-15 01:19:15 +08:00
parent 60edaa4152
commit df4bfeee5b
24 changed files with 35 additions and 4 deletions

View File

@ -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)

View File

@ -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")