diff --git a/tests/posix/single_process/CMakeLists.txt b/tests/posix/single_process/CMakeLists.txt new file mode 100644 index 00000000000..b7f056b2bbc --- /dev/null +++ b/tests/posix/single_process/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(posix_single_process) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) + +target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L) diff --git a/tests/posix/single_process/prj.conf b/tests/posix/single_process/prj.conf new file mode 100644 index 00000000000..472780a1806 --- /dev/null +++ b/tests/posix/single_process/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_BASE=y +CONFIG_POSIX_SINGLE_PROCESS=y diff --git a/tests/posix/common/src/confstr.c b/tests/posix/single_process/src/confstr.c similarity index 93% rename from tests/posix/common/src/confstr.c rename to tests/posix/single_process/src/confstr.c index c1926faf60b..f11ccf1ba89 100644 --- a/tests/posix/common/src/confstr.c +++ b/tests/posix/single_process/src/confstr.c @@ -10,7 +10,7 @@ #include #include -ZTEST(confstr, test_confstr) +ZTEST(posix_single_process, test_confstr) { char buf[1]; @@ -63,5 +63,3 @@ ZTEST(confstr, test_confstr) zassert_true(confstr(_CS_PATH, buf, sizeof(buf) > 0)); zassert_equal(buf[0], '\0'); } - -ZTEST_SUITE(confstr, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/single_process/src/main.c b/tests/posix/single_process/src/main.c new file mode 100644 index 00000000000..421af54891d --- /dev/null +++ b/tests/posix/single_process/src/main.c @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2023, Meta + * Copyright (c) 2024, Marvin Ouma + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +ZTEST_SUITE(posix_single_process, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/common/src/sysconf.c b/tests/posix/single_process/src/sysconf.c similarity index 82% rename from tests/posix/common/src/sysconf.c rename to tests/posix/single_process/src/sysconf.c index 363d93be365..7689ff04600 100644 --- a/tests/posix/common/src/sysconf.c +++ b/tests/posix/single_process/src/sysconf.c @@ -8,7 +8,7 @@ #include #include -ZTEST(posix_apis, test_posix_sysconf) +ZTEST(posix_single_process, test_posix_sysconf) { long ret; @@ -23,10 +23,7 @@ ZTEST(posix_apis, test_posix_sysconf) /* SC that value depends on target's configuration */ ret = sysconf(_SC_SEMAPHORES); if (IS_ENABLED(CONFIG_POSIX_THREADS)) { - zassert_equal(ret, - _POSIX_VERSION, - "sysconf returned unexpected value %d", - ret); + zassert_equal(ret, _POSIX_VERSION, "sysconf returned unexpected value %d", ret); } else { zassert_equal(ret, -1L, "sysconf returned unexpected value %d", ret); } diff --git a/tests/posix/common/src/uname.c b/tests/posix/single_process/src/uname.c similarity index 81% rename from tests/posix/common/src/uname.c rename to tests/posix/single_process/src/uname.c index 9b1e76d6b53..1d6b09d8c7e 100644 --- a/tests/posix/common/src/uname.c +++ b/tests/posix/single_process/src/uname.c @@ -9,7 +9,7 @@ #include -ZTEST(uname, test_uname) +ZTEST(posix_single_process, test_uname) { struct utsname info; @@ -17,5 +17,3 @@ ZTEST(uname, test_uname) zassert_ok(strncmp(info.sysname, "Zephyr", sizeof(info.sysname))); zassert_ok(strncmp(info.machine, CONFIG_ARCH, sizeof(info.machine))); } - -ZTEST_SUITE(uname, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/single_process/testcase.yaml b/tests/posix/single_process/testcase.yaml new file mode 100644 index 00000000000..a8f8a54c140 --- /dev/null +++ b/tests/posix/single_process/testcase.yaml @@ -0,0 +1,25 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - single_process + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation +tests: + portability.single_process.rwlocks: + min_flash: 64 + min_ram: 32 + portability.posix.single_process.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.single_process.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + portability.posix.single_process.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y