From aee2d1a6778ae8cd22d0b6e5571e8d4bb345c520 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 10 Jan 2024 16:29:05 +0100 Subject: [PATCH] llext: provide an example of tristate Kconfig option Add a tristate Kconfig option to the llext hello-world twister test. Signed-off-by: Guennadi Liakhovetski --- tests/subsys/llext/Kconfig | 12 ++++++++++++ tests/subsys/llext/hello_world/CMakeLists.txt | 4 ++++ tests/subsys/llext/testcase.yaml | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 tests/subsys/llext/Kconfig diff --git a/tests/subsys/llext/Kconfig b/tests/subsys/llext/Kconfig new file mode 100644 index 00000000000..b09068f9810 --- /dev/null +++ b/tests/subsys/llext/Kconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2024 Intel Corporation. + +mainmenu "LLEXT functionality test" + +source "Kconfig.zephyr" + +config LLEXT_TEST_HELLO + tristate "llext hello test" + default n + help + Set to "m" to test hello-world loading diff --git a/tests/subsys/llext/hello_world/CMakeLists.txt b/tests/subsys/llext/hello_world/CMakeLists.txt index 833d8c56ccd..980f0e97d00 100644 --- a/tests/subsys/llext/hello_world/CMakeLists.txt +++ b/tests/subsys/llext/hello_world/CMakeLists.txt @@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(hello_world) +if(NOT CONFIG_MODULES OR CONFIG_LLEXT_TEST_HELLO STREQUAL "m") + # TODO check which architecture is being used if(CONFIG_ARM) set(CMAKE_C_FLAGS "-mlong-calls" "-mthumb") @@ -34,3 +36,5 @@ endif() set(HELLO_WORLD_LLEXT ${PROJECT_BINARY_DIR}/hello_world.llext PARENT_SCOPE) add_custom_target(hello_world DEPENDS ${PROJECT_BINARY_DIR}/hello_world.llext) + +endif() diff --git a/tests/subsys/llext/testcase.yaml b/tests/subsys/llext/testcase.yaml index 2747edf8d0c..6a5fdd1ef0f 100644 --- a/tests/subsys/llext/testcase.yaml +++ b/tests/subsys/llext/testcase.yaml @@ -6,6 +6,8 @@ tests: arch_allow: arm extra_configs: - CONFIG_ARM_MPU=n + - CONFIG_MODULES=y + - CONFIG_LLEXT_TEST_HELLO=m # Broken platforms platform_exclude: - nuvoton_pfm_m487 # See #63167 @@ -13,6 +15,8 @@ tests: arch_allow: xtensa extra_configs: - CONFIG_LLEXT_STORAGE_WRITABLE=y + - CONFIG_MODULES=y + - CONFIG_LLEXT_TEST_HELLO=m # Broken platforms platform_exclude: - qemu_xtensa_mmu # ELF sections are read-only, and without peek() .text copy isn't executable