diff --git a/tests/posix/signals/CMakeLists.txt b/tests/posix/signals/CMakeLists.txt new file mode 100644 index 000000000000..1c61d68cf1ec --- /dev/null +++ b/tests/posix/signals/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(posix_signals) + +target_sources(app PRIVATE src/main.c) + +target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L) diff --git a/tests/posix/signals/prj.conf b/tests/posix/signals/prj.conf new file mode 100644 index 000000000000..4b2412f20c03 --- /dev/null +++ b/tests/posix/signals/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_PSE51=y +CONFIG_POSIX_SIGNALS=y diff --git a/tests/posix/common/src/signal.c b/tests/posix/signals/src/main.c similarity index 95% rename from tests/posix/common/src/signal.c rename to tests/posix/signals/src/main.c index ddfba977c760..4e82eb9ca3c8 100644 --- a/tests/posix/common/src/signal.c +++ b/tests/posix/signals/src/main.c @@ -12,7 +12,7 @@ #include #include -ZTEST(signal, test_sigemptyset) +ZTEST(posix_signals, test_sigemptyset) { sigset_t set; @@ -27,7 +27,7 @@ ZTEST(signal, test_sigemptyset) } } -ZTEST(signal, test_sigfillset) +ZTEST(posix_signals, test_sigfillset) { sigset_t set = (sigset_t){0}; @@ -38,7 +38,7 @@ ZTEST(signal, test_sigfillset) } } -ZTEST(signal, test_sigaddset_oor) +ZTEST(posix_signals, test_sigaddset_oor) { sigset_t set = (sigset_t){0}; @@ -52,7 +52,7 @@ ZTEST(signal, test_sigaddset_oor) zassert_equal(errno, EINVAL, "errno should be %s", "EINVAL"); } -ZTEST(signal, test_sigaddset) +ZTEST(posix_signals, test_sigaddset) { int signo; sigset_t set = (sigset_t){0}; @@ -99,7 +99,7 @@ ZTEST(signal, test_sigaddset) } } -ZTEST(signal, test_sigdelset_oor) +ZTEST(posix_signals, test_sigdelset_oor) { sigset_t set = (sigset_t){0}; @@ -113,7 +113,7 @@ ZTEST(signal, test_sigdelset_oor) zassert_equal(errno, EINVAL, "errno should be %s", "EINVAL"); } -ZTEST(signal, test_sigdelset) +ZTEST(posix_signals, test_sigdelset) { int signo; sigset_t set = (sigset_t){0}; @@ -160,7 +160,7 @@ ZTEST(signal, test_sigdelset) } } -ZTEST(signal, test_sigismember_oor) +ZTEST(posix_signals, test_sigismember_oor) { sigset_t set = {0}; @@ -174,7 +174,7 @@ ZTEST(signal, test_sigismember_oor) zassert_equal(errno, EINVAL, "errno should be %s", "EINVAL"); } -ZTEST(signal, test_sigismember) +ZTEST(posix_signals, test_sigismember) { sigset_t set = (sigset_t){0}; @@ -195,7 +195,7 @@ ZTEST(signal, test_sigismember) zassert_equal(sigismember(&set, SIGTERM), 0, "%s not expected to be member", "SIGTERM"); } -ZTEST(signal, test_signal_strsignal) +ZTEST(posix_signals, test_signal_strsignal) { /* Using -INT_MAX here because compiler resolves INT_MIN to (-2147483647 - 1) */ char buf[sizeof("RT signal -" STRINGIFY(INT_MAX))] = {0}; @@ -297,7 +297,7 @@ static void *test_sigmask_entry(void *arg) return NULL; } -ZTEST(signal, test_pthread_sigmask) +ZTEST(posix_signals, test_pthread_sigmask) { pthread_t th; @@ -305,7 +305,7 @@ ZTEST(signal, test_pthread_sigmask) zassert_ok(pthread_join(th, NULL)); } -ZTEST(signal, test_sigprocmask) +ZTEST(posix_signals, test_sigprocmask) { if (IS_ENABLED(CONFIG_MULTITHREADING)) { if (!IS_ENABLED(CONFIG_ASSERT)) { @@ -330,4 +330,4 @@ static void before(void *arg) } } -ZTEST_SUITE(signal, NULL, NULL, before, NULL, NULL); +ZTEST_SUITE(posix_signals, NULL, NULL, before, NULL, NULL); diff --git a/tests/posix/signals/testcase.yaml b/tests/posix/signals/testcase.yaml new file mode 100644 index 000000000000..7d475ee19cf9 --- /dev/null +++ b/tests/posix/signals/testcase.yaml @@ -0,0 +1,31 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - signals + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation + min_flash: 64 + min_ram: 32 +tests: + portability.posix.signals: {} + portability.posix.signals.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.signals.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + portability.posix.signals.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y + portability.posix.signals.strginal_no_desc: + extra_configs: + - CONFIG_POSIX_SIGNAL_STRING_DESC=n + portability.posix.signals.big_nsig: + extra_configs: + - CONFIG_POSIX_RTSIG_MAX=1024