Skip to content

Commit

Permalink
tests: posix: common: separate posix signal tests into a smaller test…
Browse files Browse the repository at this point in the history
…suite

posix.common contains testsuites that can be separated into smaller
groups of tests. This change moves signal tests into a singular
testsuite at tests/posix/signals app directory.

Signed-off-by: Marvin Ouma <[email protected]>
  • Loading branch information
Pancakem authored and kartben committed Nov 29, 2024
1 parent 9762c32 commit 8faa486
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 12 deletions.
9 changes: 9 additions & 0 deletions tests/posix/signals/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 5 additions & 0 deletions tests/posix/signals/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIG_POSIX_API=y
CONFIG_ZTEST=y

CONFIG_POSIX_AEP_CHOICE_PSE51=y
CONFIG_POSIX_SIGNALS=y
24 changes: 12 additions & 12 deletions tests/posix/common/src/signal.c → tests/posix/signals/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/ztest.h>

ZTEST(signal, test_sigemptyset)
ZTEST(posix_signals, test_sigemptyset)
{
sigset_t set;

Expand All @@ -27,7 +27,7 @@ ZTEST(signal, test_sigemptyset)
}
}

ZTEST(signal, test_sigfillset)
ZTEST(posix_signals, test_sigfillset)
{
sigset_t set = (sigset_t){0};

Expand All @@ -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};

Expand All @@ -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};
Expand Down Expand Up @@ -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};

Expand All @@ -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};
Expand Down Expand Up @@ -160,7 +160,7 @@ ZTEST(signal, test_sigdelset)
}
}

ZTEST(signal, test_sigismember_oor)
ZTEST(posix_signals, test_sigismember_oor)
{
sigset_t set = {0};

Expand All @@ -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};

Expand All @@ -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};
Expand Down Expand Up @@ -297,15 +297,15 @@ static void *test_sigmask_entry(void *arg)
return NULL;
}

ZTEST(signal, test_pthread_sigmask)
ZTEST(posix_signals, test_pthread_sigmask)
{
pthread_t th;

zassert_ok(pthread_create(&th, NULL, test_sigmask_entry, 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)) {
Expand All @@ -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);
31 changes: 31 additions & 0 deletions tests/posix/signals/testcase.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8faa486

Please sign in to comment.