Skip to content

Commit

Permalink
tests: posix: signal: account for ANSI / ISO C signal bits
Browse files Browse the repository at this point in the history
The `signal()` function was part of ANSI-C and predates
POSIX, so it should be visible (even if it completely
unsupported in Zephyr currently).

The `sig_atomic_t` type is part of ISO C, regardless of
whether POSIX is enabled.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
  • Loading branch information
cfriedt committed Aug 8, 2023
1 parent 315de98 commit 873ba38
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions tests/posix/headers/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ CONFIG_POSIX_CLOCK=y
CONFIG_POSIX_MQUEUE=y
CONFIG_EVENTFD=y
CONFIG_GETOPT=y
CONFIG_POSIX_SIGNAL=y
60 changes: 30 additions & 30 deletions tests/posix/headers/src/signal_h.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@
*/
ZTEST(posix_headers, test_signal_h)
{
/* part of ANSI C */
zassert_not_null(signal);
/* part of ISO C */
zassert_not_equal(sizeof(sig_atomic_t), 0);

#ifdef CONFIG_POSIX_API
/* zassert_not_equal(-1, SIG_DFL); */ /* not implemented */
/* zassert_not_equal(-1, SIG_ERR); */ /* not implemented */
/* zassert_not_equal(-1, SIG_HOLD); */ /* not implemented */
/* zassert_not_equal(-1, SIG_IGN); */ /* not implemented */

/* zassert_not_equal((sig_atomic_t)-1, (sig_atomic_t)0); */ /* not implemented */
/* zassert_not_equal((pid_t)-1, (pid_t)0); */ /* not implemented */

zassert_not_equal(-1, offsetof(struct sigevent, sigev_notify));
Expand Down Expand Up @@ -130,7 +135,6 @@ ZTEST(posix_headers, test_signal_h)
/* zassert_not_equal(-1, SI_ASYNCIO); */ /* not implemented */
/* zassert_not_equal(-1, SI_MESGQ); */ /* not implemented */

#ifdef CONFIG_POSIX_SIGNAL
zassert_true(SIGRTMIN >= 0);
zassert_true(SIGRTMAX >= SIGRTMIN);
zassert_not_equal(-1, SIGABRT);
Expand All @@ -157,38 +161,34 @@ ZTEST(posix_headers, test_signal_h)
zassert_not_equal(-1, SIGURG);
zassert_not_equal(-1, SIGXCPU);
zassert_not_equal(-1, SIGXFSZ);
zassert_not_equal(((sigset_t){.sig[0] = 0}).sig[0], ((sigset_t){.sig[0] = -1}).sig[0]);
zassert_not_equal(sizeof(sigset_t), 0);
zassert_not_null(sigemptyset);
zassert_not_null(sigfillset);
zassert_not_null(sigaddset);
zassert_not_null(sigdelset);
zassert_not_null(sigismember);
zassert_not_null(strsignal);
#endif /* CONFIG_POSIX_SIGNAL */

if (IS_ENABLED(CONFIG_POSIX_API)) {
/* zassert_not_null(kill); */ /* not implemented */
/* zassert_not_null(killpg); */ /* not implemented */
/* zassert_not_null(psiginfo); */ /* not implemented */
/* zassert_not_null(psignal); */ /* not implemented */
/* zassert_not_null(pthread_kill); */ /* not implemented */
/* zassert_not_null(pthread_sigmask); */ /* not implemented */
/* zassert_not_null(raise); */ /* not implemented */
/* zassert_not_null(sigaction); */ /* not implemented */
/* zassert_not_null(sigaltstack); */ /* not implemented */
/* zassert_not_null(sighold); */ /* not implemented */
/* zassert_not_null(sigignore); */ /* not implemented */
/* zassert_not_null(siginterrupt); */ /* not implemented */
/* zassert_not_null(signal); */ /* not implemented */
/* zassert_not_null(sigpause); */ /* not implemented */
/* zassert_not_null(sigpending); */ /* not implemented */
/* zassert_not_null(sigprocmask); */ /* not implemented */
/* zassert_not_null(sigqueue); */ /* not implemented */
/* zassert_not_null(sigrelse); */ /* not implemented */
/* zassert_not_null(sigset); */ /* not implemented */
/* zassert_not_null(sigsuspend); */ /* not implemented */
/* zassert_not_null(sigtimedwait); */ /* not implemented */
/* zassert_not_null(sigwait); */ /* not implemented */
/* zassert_not_null(sigwaitinfo); */ /* not implemented */
}
/* zassert_not_null(kill); */ /* not implemented */
/* zassert_not_null(killpg); */ /* not implemented */
/* zassert_not_null(psiginfo); */ /* not implemented */
/* zassert_not_null(psignal); */ /* not implemented */
/* zassert_not_null(pthread_kill); */ /* not implemented */
/* zassert_not_null(pthread_sigmask); */ /* not implemented */
/* zassert_not_null(raise); */ /* not implemented */
/* zassert_not_null(sigaction); */ /* not implemented */
/* zassert_not_null(sigaltstack); */ /* not implemented */
/* zassert_not_null(sighold); */ /* not implemented */
/* zassert_not_null(sigignore); */ /* not implemented */
/* zassert_not_null(siginterrupt); */ /* not implemented */
/* zassert_not_null(sigpause); */ /* not implemented */
/* zassert_not_null(sigpending); */ /* not implemented */
/* zassert_not_null(sigprocmask); */ /* not implemented */
/* zassert_not_null(sigqueue); */ /* not implemented */
/* zassert_not_null(sigrelse); */ /* not implemented */
/* zassert_not_null(sigset); */ /* not implemented */
/* zassert_not_null(sigsuspend); */ /* not implemented */
/* zassert_not_null(sigtimedwait); */ /* not implemented */
/* zassert_not_null(sigwait); */ /* not implemented */
/* zassert_not_null(sigwaitinfo); */ /* not implemented */
#endif
}

0 comments on commit 873ba38

Please sign in to comment.