Skip to content

Commit 4eec285

Browse files
SorinOlarikr-t
authored andcommitted
testing: add system tests for zephyr with configuration fixes
Signed-off-by: SorinO <sorin.olari2@gmail.com>
1 parent 094a207 commit 4eec285

23 files changed

Lines changed: 415 additions & 3 deletions

tests/system/container.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void setUp(void)
2727
};
2828

2929
ocre_initialize(NULL);
30-
context = ocre_create_context("./ocre/src/ocre/var/lib/ocre");
30+
context = ocre_create_context(NULL);
3131

3232
hello_world = ocre_context_create_container(context, "hello-world.wasm", "wamr/wasip1", "hello", false, NULL);
3333
blinky = ocre_context_create_container(context, "blinky.wasm", "wamr/wasip1", NULL, true, &args);

tests/system/context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct ocre_context *context;
1515
void setUp(void)
1616
{
1717
ocre_initialize(NULL);
18-
context = ocre_create_context("./ocre/src/ocre/var/lib/ocre");
18+
context = ocre_create_context(NULL);
1919
}
2020

2121
void tearDown(void)

tests/system/posix/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ foreach(test ${OCRE_TESTS})
5353

5454
add_custom_command(
5555
OUTPUT test_${test}.log
56-
COMMAND LLVM_PROFILE_FILE=test_${test}.profraw ./test_${test} > test_${test}.log
56+
COMMAND cd ocre && LLVM_PROFILE_FILE=../test_${test}.profraw ../test_${test} > ../test_${test}.log
5757
COMMAND rm -f test_${test}.testpass test_${test}.testfail
5858
COMMAND sh -c "[ \"$(tail -1 test_${test}.log)\" = \"OK\" ] && cp test_${test}.log test_${test}.testpass || cp test_${test}.log test_${test}.testfail"
5959
DEPENDS
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# @copyright Copyright (c) contributors to Project Ocre,
2+
# which has been established as Project Ocre a Series of LF Projects, LLC
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
cmake_minimum_required(VERSION 3.20.0)
7+
8+
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_LIST_DIR}/../../../..)
9+
10+
list(APPEND EXTRA_DTC_OVERLAY_FILE fstab.overlay)
11+
12+
list(APPEND OCRE_SDK_PRELOADED_IMAGES
13+
"return0.wasm"
14+
"return1.wasm"
15+
"sleep_5_return_0.wasm"
16+
"hello-world.wasm"
17+
"blinky.wasm"
18+
)
19+
20+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
21+
22+
project (ocre_system_test_container)
23+
24+
add_library(Unity STATIC
25+
../../../../tests/Unity/src/unity.c
26+
)
27+
28+
target_include_directories(Unity PUBLIC
29+
../../../../tests/Unity/src
30+
)
31+
32+
target_sources(app
33+
PRIVATE
34+
../../container.c
35+
)
36+
37+
target_link_libraries(app
38+
PUBLIC
39+
OcreCore
40+
Unity
41+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# @copyright Copyright (c) contributors to Project Ocre,
2+
# which has been established as Project Ocre a Series of LF Projects, LLC
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=10485760
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @copyright Copyright (c) contributors to Project Ocre,
3+
* which has been established as Project Ocre a Series of LF Projects, LLC
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
&flash0 {
9+
reg = < 0x0 DT_SIZE_M(32) >;
10+
};
11+
12+
&storage_partition {
13+
reg = < 0xfc000 DT_SIZE_M(16) >;
14+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @copyright Copyright (c) contributors to Project Ocre,
3+
* which has been established as Project Ocre a Series of LF Projects, LLC
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/ {
9+
fstab {
10+
compatible = "zephyr,fstab";
11+
lfs1: lfs1 {
12+
compatible = "zephyr,fstab,littlefs";
13+
read-size = <256>;
14+
prog-size = <256>;
15+
cache-size = <256>;
16+
lookahead-size = <256>;
17+
block-cycles = <512>;
18+
partition = <&storage_partition>;
19+
mount-point = "/lfs";
20+
automount;
21+
};
22+
};
23+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# @copyright Copyright (c) contributors to Project Ocre,
2+
# which has been established as Project Ocre a Series of LF Projects, LLC
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Logging
7+
CONFIG_LOG=y
8+
CONFIG_LOG_MODE_MINIMAL=y
9+
10+
# Filesystem
11+
CONFIG_ZVFS_POLL_MAX=10
12+
CONFIG_ZVFS_OPEN_MAX=10
13+
14+
# Memory options
15+
CONFIG_DYNAMIC_THREAD_STACK_SIZE=8192
16+
CONFIG_MAIN_STACK_SIZE=8192
17+
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1
18+
19+
# pthreads
20+
CONFIG_MAX_PTHREAD_MUTEX_COUNT=8
21+
CONFIG_POSIX_THREAD_THREADS_MAX=8
22+
23+
# Ocre configuration
24+
CONFIG_OCRE=y
25+
CONFIG_OCRE_TIMER=y
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# @copyright Copyright (c) contributors to Project Ocre,
2+
# which has been established as Project Ocre a Series of LF Projects, LLC
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
cmake_minimum_required(VERSION 3.20.0)
7+
8+
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_LIST_DIR}/../../../..)
9+
10+
list(APPEND EXTRA_DTC_OVERLAY_FILE fstab.overlay)
11+
12+
list(APPEND OCRE_SDK_PRELOADED_IMAGES
13+
"return0.wasm"
14+
"return1.wasm"
15+
"sleep_5_return_0.wasm"
16+
"hello-world.wasm"
17+
"filesystem.wasm"
18+
"blinky.wasm"
19+
)
20+
21+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
22+
23+
project (ocre_system_test_context)
24+
25+
add_library(Unity STATIC
26+
../../../../tests/Unity/src/unity.c
27+
)
28+
29+
target_include_directories(Unity PUBLIC
30+
../../../../tests/Unity/src
31+
)
32+
33+
target_sources(app
34+
PRIVATE
35+
../../context.c
36+
)
37+
38+
target_link_libraries(app
39+
PUBLIC
40+
OcreCore
41+
Unity
42+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# @copyright Copyright (c) contributors to Project Ocre,
2+
# which has been established as Project Ocre a Series of LF Projects, LLC
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=10485760

0 commit comments

Comments
 (0)