From 94b0bf1e6f0dc1e7fafbec6014736f7cd524bbfa Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Fri, 12 Jan 2024 11:10:15 +0100 Subject: [PATCH] llext: move current test to a hello_world subdir In preparation for multiple tests, move the current hello_world test to its own subdirectory. Also, merge the llext compilation in the parent CMakeLists.txt. Signed-off-by: Luca Burelli --- tests/subsys/llext/CMakeLists.txt | 26 ------------------- tests/subsys/llext/hello_world/CMakeLists.txt | 20 +++++++++++--- tests/subsys/llext/{ => hello_world}/Kconfig | 0 tests/subsys/llext/{ => hello_world}/prj.conf | 0 .../hello_world/{ => src/llext}/hello_world.c | 0 .../src/test}/test_llext_simple.c | 0 .../llext/{ => hello_world}/testcase.yaml | 0 7 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 tests/subsys/llext/CMakeLists.txt rename tests/subsys/llext/{ => hello_world}/Kconfig (100%) rename tests/subsys/llext/{ => hello_world}/prj.conf (100%) rename tests/subsys/llext/hello_world/{ => src/llext}/hello_world.c (100%) rename tests/subsys/llext/{src => hello_world/src/test}/test_llext_simple.c (100%) rename tests/subsys/llext/{ => hello_world}/testcase.yaml (100%) diff --git a/tests/subsys/llext/CMakeLists.txt b/tests/subsys/llext/CMakeLists.txt deleted file mode 100644 index 45cea437c330d2d..000000000000000 --- a/tests/subsys/llext/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2023 Intel Corporation. -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(llext_test) - -add_subdirectory(hello_world) - -target_sources(app PRIVATE src/test_llext_simple.c) - -target_include_directories(app PRIVATE - ${ZEPHYR_BASE}/include - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/${ARCH}/include - ) - -set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/) - -generate_inc_file_for_target( - app - ${HELLO_WORLD_LLEXT} - ${gen_dir}/hello_world.inc - ) - -add_dependencies(app hello_world_llext) diff --git a/tests/subsys/llext/hello_world/CMakeLists.txt b/tests/subsys/llext/hello_world/CMakeLists.txt index 40aad0cd3db8815..8eb1a1575f14eba 100644 --- a/tests/subsys/llext/hello_world/CMakeLists.txt +++ b/tests/subsys/llext/hello_world/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(hello_world) +project(llext_hello_world_test) if(NOT CONFIG_LLEXT_TEST_HELLO) # Test disabled, do nothing @@ -12,14 +12,26 @@ elseif(CONFIG_MODULES AND NOT CONFIG_LLEXT_TEST_HELLO STREQUAL "m") message(FATAL_ERROR "CONFIG_LLEXT_TEST_HELLO must be set to 'm' when CONFIG_MODULES is enabled") else() - set(llext_src_file ${PROJECT_SOURCE_DIR}/hello_world.c) - set(llext_bin_file ${PROJECT_BINARY_DIR}/hello_world.llext) + target_sources(app PRIVATE + src/test/test_llext_simple.c + ) + + target_include_directories(app PRIVATE + ${ZEPHYR_BASE}/include + ${ZEPHYR_BASE}/kernel/include + ${ZEPHYR_BASE}/arch/${ARCH}/include + ) + + # Compile a simple hello world llext to an include file + set(llext_src_file ${PROJECT_SOURCE_DIR}/src/llext/hello_world.c) + set(llext_bin_file ${ZEPHYR_BINARY_DIR}/hello_world.llext) + set(llext_inc_file ${ZEPHYR_BINARY_DIR}/include/generated/hello_world.inc) add_llext_target(hello_world_llext OUTPUT ${llext_bin_file} SOURCES ${llext_src_file} ) - set(HELLO_WORLD_LLEXT ${llext_bin_file} PARENT_SCOPE) + generate_inc_file_for_target(app ${llext_bin_file} ${llext_inc_file}) endif() diff --git a/tests/subsys/llext/Kconfig b/tests/subsys/llext/hello_world/Kconfig similarity index 100% rename from tests/subsys/llext/Kconfig rename to tests/subsys/llext/hello_world/Kconfig diff --git a/tests/subsys/llext/prj.conf b/tests/subsys/llext/hello_world/prj.conf similarity index 100% rename from tests/subsys/llext/prj.conf rename to tests/subsys/llext/hello_world/prj.conf diff --git a/tests/subsys/llext/hello_world/hello_world.c b/tests/subsys/llext/hello_world/src/llext/hello_world.c similarity index 100% rename from tests/subsys/llext/hello_world/hello_world.c rename to tests/subsys/llext/hello_world/src/llext/hello_world.c diff --git a/tests/subsys/llext/src/test_llext_simple.c b/tests/subsys/llext/hello_world/src/test/test_llext_simple.c similarity index 100% rename from tests/subsys/llext/src/test_llext_simple.c rename to tests/subsys/llext/hello_world/src/test/test_llext_simple.c diff --git a/tests/subsys/llext/testcase.yaml b/tests/subsys/llext/hello_world/testcase.yaml similarity index 100% rename from tests/subsys/llext/testcase.yaml rename to tests/subsys/llext/hello_world/testcase.yaml