diff --git a/.github/workflows/zephyr-systests.yml b/.github/workflows/zephyr-systests.yml index dc794649..43ebf83c 100644 --- a/.github/workflows/zephyr-systests.yml +++ b/.github/workflows/zephyr-systests.yml @@ -29,6 +29,7 @@ jobs: - lib - ocre - context + - input_output steps: - name: Clean other workspace run: rm -rf ../.west diff --git a/tests/system/input_output.c b/tests/system/input_output.c index 0fdb199d..b30e8f2d 100644 --- a/tests/system/input_output.c +++ b/tests/system/input_output.c @@ -51,20 +51,25 @@ void test_ocre_container_output_stdout(void) ocre_container_wait(container, NULL); - char buf[1000]; + /* Skip to newline */ + + char c; + do { + size_t n = read(stdout_pair[0], &c, 1); + TEST_ASSERT_EQUAL_size_t(1, n); + } while (c != '\n'); + + char buf[19]; /* "argv[1]=Zirigdum!\n" */ memset(buf, 0, sizeof(buf)); ssize_t n = read(stdout_pair[0], buf, sizeof(buf) - 1); - TEST_ASSERT_GREATER_THAN_size_t(0, n); - - char *second_line = strchr(buf, '\n'); - ++second_line; - TEST_ASSERT_NOT_NULL(second_line); + TEST_ASSERT_EQUAL_size_t(sizeof(buf) - 1, n); - TEST_ASSERT_EQUAL_STRING("argv[1]=" ARG_TEST_STRING "\n", second_line); + TEST_ASSERT_EQUAL_STRING("argv[1]=" ARG_TEST_STRING "\n", buf); ocre_container_kill(container); + close(stdout_pair[0]); ocre_container_wait(container, NULL); ocre_context_remove_container(context, container); @@ -94,6 +99,8 @@ void test_ocre_container_input_stdin_output_stdout(void) TEST_ASSERT_EQUAL_STRING(ARG_TEST_STRING "\n", buf); ocre_container_kill(container); + close(stdin_pair[0]); + close(stdout_pair[0]); ocre_container_wait(container, NULL); ocre_context_remove_container(context, container); @@ -131,6 +138,8 @@ void test_ocre_container_input_stdin_output_stderr(void) TEST_ASSERT_EQUAL_STRING(ARG_TEST_STRING "\n", buf); ocre_container_kill(container); + close(stdin_pair[0]); + close(stderr_pair[0]); ocre_container_wait(container, NULL); ocre_context_remove_container(context, container); diff --git a/tests/system/zephyr/input_output/CMakeLists.txt b/tests/system/zephyr/input_output/CMakeLists.txt index b2bc73ef..a210415f 100644 --- a/tests/system/zephyr/input_output/CMakeLists.txt +++ b/tests/system/zephyr/input_output/CMakeLists.txt @@ -22,6 +22,9 @@ add_library(Unity STATIC ../../../../tests/Unity/src/unity.c ) +target_link_libraries(Unity PUBLIC zephyr_interface) + + target_include_directories(Unity PUBLIC ../../../../tests/Unity/src ) diff --git a/wasm-micro-runtime b/wasm-micro-runtime index d1a577ea..089f5c7a 160000 --- a/wasm-micro-runtime +++ b/wasm-micro-runtime @@ -1 +1 @@ -Subproject commit d1a577ea0e62ff3d550a74639e4dff54007e2255 +Subproject commit 089f5c7a08710db225291a01c1528be0163f0f9a