Skip to content

Commit

Permalink
llext: move current test to a hello_world subdir
Browse files Browse the repository at this point in the history
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 <l.burelli@arduino.cc>
  • Loading branch information
pillo79 committed Jan 12, 2024
1 parent 113902e commit 8226c24
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 30 deletions.
26 changes: 0 additions & 26 deletions tests/subsys/llext/CMakeLists.txt

This file was deleted.

20 changes: 16 additions & 4 deletions tests/subsys/llext/hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8226c24

Please sign in to comment.