Skip to content

Commit

Permalink
llext: tests: Update tests
Browse files Browse the repository at this point in the history
Updates llext tests to use new cmake extension declaration.
MPU is no longer disabled.

Signed-off-by: Cedric Lescop <cedric.lescop@se.com>
  • Loading branch information
selescop committed Mar 18, 2024
1 parent 38b2d8a commit 0513e09
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions tests/subsys/llext/simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ target_include_directories(app PRIVATE
# generate extension targets foreach extension given by name
foreach(ext_name hello_world logging relative_jump object)
set(ext_src ${PROJECT_SOURCE_DIR}/src/${ext_name}_ext.c)
set(ext_bin ${ZEPHYR_BINARY_DIR}/${ext_name}.llext)
zephyr_llext(${ext_name})
zephyr_llext_sources(${ext_src})

set(ext_bin ${CMAKE_CURRENT_BINARY_DIR}/${ext_name}.llext)
set(ext_inc ${ZEPHYR_BINARY_DIR}/include/generated/${ext_name}.inc)
add_llext_target(${ext_name}_ext
OUTPUT ${ext_bin}
SOURCES ${ext_src}
)
generate_inc_file_for_target(app ${ext_bin} ${ext_inc})
endforeach()
4 changes: 2 additions & 2 deletions tests/subsys/llext/simple/src/hello_world_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

static const uint32_t number = 42;

void test_entry(void)
void start(void)
{
printk("hello world\n");
printk("A number is %u\n", number);
}
LL_EXTENSION_SYMBOL(test_entry);
LL_EXTENSION_SYMBOL(start);
4 changes: 2 additions & 2 deletions tests/subsys/llext/simple/src/logging_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ LOG_MODULE_REGISTER(logging_ext);

static const uint32_t number = 42;

void test_entry(void)
void start(void)
{
LOG_INF("hello world");
LOG_INF("A number is %" PRIu32, number);
}
LL_EXTENSION_SYMBOL(test_entry);
LL_EXTENSION_SYMBOL(start);
8 changes: 4 additions & 4 deletions tests/subsys/llext/simple/src/test_llext_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ void load_call_unload(struct llext_test *test_case)

zassert_ok(res, "load should succeed");

void (*test_entry_fn)() = llext_find_sym(&ext->exp_tab, "test_entry");
void (*test_entry_fn)() = llext_find_sym(&ext->exp_tab, "start");

zassert_not_null(test_entry_fn, "test_entry should be an exported symbol");
zassert_not_null(test_entry_fn, "start should be an exported symbol");

#ifdef CONFIG_USERSPACE
/*
Expand Down Expand Up @@ -114,8 +114,8 @@ void load_call_unload(struct llext_test *test_case)


#else /* CONFIG_USERSPACE */
zassert_ok(llext_call_fn(ext, "test_entry"),
"test_entry call should succeed");
zassert_ok(llext_call_fn(ext, "start"),
"start call should succeed");
#endif /* CONFIG_USERSPACE */

llext_unload(&ext);
Expand Down

0 comments on commit 0513e09

Please sign in to comment.