Skip to content

Commit 1d048a9

Browse files
committed
llext-edk: add dependency flag testing
Add an interface library to the test application that defines a macro whose value is later used in the extension. This verifies the full dependency chain for 'app' is evaluated during EDK generation. Signed-off-by: Luca Burelli <[email protected]>
1 parent a004c9b commit 1d048a9

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

tests/misc/llext-edk/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
6+
# verify information from dependencies is available to extensions
7+
add_library(dependency INTERFACE)
8+
target_compile_definitions(dependency INTERFACE GLOBAL_OPT="set")
9+
510
project(llext_edk_test LANGUAGES C)
611

712
target_sources(app PRIVATE src/main.c src/foo.c)
813
zephyr_include_directories(include)
914
zephyr_include_directories(${ZEPHYR_BASE}/boards/native/common)
15+
target_link_libraries(app PUBLIC dependency)
1016

1117
if(EXTENSION_DIR)
1218
target_include_directories(app PRIVATE ${EXTENSION_DIR})

tests/misc/llext-edk/extension/src/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@
99

1010
#include <app_api.h>
1111

12+
#ifndef GLOBAL_OPT
13+
#define GLOBAL_OPT "MISSING"
14+
#endif
15+
1216
int start(int bar)
1317
{
1418
printk("foo(%d) is %d\n", bar, foo(bar));
19+
printk("GLOBAL_OPT is %s\n", GLOBAL_OPT);
1520
return 0;
1621
}
1722
EXPORT_SYMBOL(start);

tests/misc/llext-edk/pytest/test_edk.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def test_edk(unlaunched_dut: DeviceAdapter):
115115
assert "Calling extension from user" in lines
116116
assert "foo(42) is 1764" in lines
117117
assert "foo(43) is 1849" in lines
118+
assert "GLOBAL_OPT is set" in lines
118119

119120
finally:
120121
unlaunched_dut.close()

0 commit comments

Comments
 (0)