Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys PR/51847: Ngie Cooper: More error checks, ...
details: https://anonhg.NetBSD.org/src/rev/d422758a8ed4
branches: trunk
changeset: 350563:d422758a8ed4
user: christos <christos%NetBSD.org@localhost>
date: Fri Jan 13 20:44:10 2017 +0000
description:
PR/51847: Ngie Cooper: More error checks, add __unused
diffstat:
tests/lib/libc/sys/t_sigqueue.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diffs (75 lines):
diff -r 14b87261cb2e -r d422758a8ed4 tests/lib/libc/sys/t_sigqueue.c
--- a/tests/lib/libc/sys/t_sigqueue.c Fri Jan 13 20:43:11 2017 +0000
+++ b/tests/lib/libc/sys/t_sigqueue.c Fri Jan 13 20:44:10 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $ */
+/* $NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $");
-
+__RCSID("$NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $");
#include <atf-c.h>
+#include <err.h>
#include <errno.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sched.h>
#include <unistd.h>
@@ -46,7 +47,7 @@
static int value;
static void
-handler(int signo, siginfo_t *info, void *data)
+handler(int signo __unused, siginfo_t *info, void *data __unused)
{
value = info->si_value.sival_int;
kill(0, SIGINFO);
@@ -107,9 +108,10 @@
static int delivered[CNT];
static void
-myhandler(int signo, siginfo_t *info, void *context)
+myhandler(int signo, siginfo_t *info, void *context __unused)
{
delivered[count++] = signo;
+ printf("Signal #%zu: signo: %d\n", (size_t)count, signo);
}
static int
@@ -176,7 +178,8 @@
sigset_t mask, orig;
sigemptyset(&mask);
for (size_t i = 0; i < CNT; i++)
- sigaddset(&mask, signals[i]);
+ if (sigaddset(&mask, signals[i]) == -1)
+ warn("sigaddset");
ATF_REQUIRE(sigprocmask(SIG_BLOCK, &mask, &orig) != -1);
@@ -185,13 +188,17 @@
ATF_REQUIRE(sigprocmask(SIG_UNBLOCK, &mask, &orig) != -1);
sleep(1);
- ATF_REQUIRE_MSG((size_t)count == ndelivered,
+ ATF_CHECK_MSG((size_t)count == ndelivered,
"count %zu != ndelivered %zu", (size_t)count, ndelivered);
for (size_t i = 0; i < ndelivered; i++)
ATF_REQUIRE_MSG(ordered[i] == delivered[i],
"%zu: ordered %d != delivered %d",
i, ordered[i], delivered[i]);
+ if ((size_t)count > ndelivered)
+ for (size_t i = ndelivered; i < (size_t)count; i++)
+ printf("Undelivered signal #%zu: %d\n", i, ordered[i]);
+
for (size_t i = 0; i < ndelivered; i++)
ATF_REQUIRE(sigaction(signals[i], &oact[i], NULL) != -1);
}
Home |
Main Index |
Thread Index |
Old Index