aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2016-08-26 04:31:19 +0000
committerEnji Cooper <ngie@FreeBSD.org>2016-08-26 04:31:19 +0000
commit6e122b96101bfcb0168c613447c37817d4e02196 (patch)
treedf7a7470adf3068dcc0e1fa2b87831511362b730 /contrib
parentaaf3e744fd4e63742027d09d2eee91b1912ce8e2 (diff)
downloadsrc-6e122b96101bfcb0168c613447c37817d4e02196.tar.gz
src-6e122b96101bfcb0168c613447c37817d4e02196.zip
Add copious debugging to aid in determining why :sigqueue_rt is currently failing
For some odd reason SIGINT is only being delivered once, as opposed to multiple times. Disclaimer: this test was run on a kernel built on 08/14/2016. Need to build a new kernel and rerun the test.
Notes
Notes: svn path=/projects/netbsd-tests-update-12/; revision=304831
Diffstat (limited to 'contrib')
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
index 80191b7665bd..8ff36f628b93 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
@@ -32,7 +32,6 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $");
-
#include <atf-c.h>
#include <errno.h>
#include <signal.h>
@@ -40,6 +39,11 @@ __RCSID("$NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $");
#include <sched.h>
#include <unistd.h>
+#ifdef __FreeBSD__
+#include <err.h>
+#include <stdio.h>
+#endif
+
static void handler(int, siginfo_t *, void *);
#define VALUE (int)0xc001dad1
@@ -77,7 +81,7 @@ ATF_TC_BODY(sigqueue_basic, tc)
sv.sival_int = VALUE;
#ifdef __FreeBSD__
- /*
+ /*
* From kern_sig.c:
* Specification says sigqueue can only send signal to single process.
*/
@@ -122,6 +126,9 @@ static void
myhandler(int signo, siginfo_t *info, void *context)
{
delivered[count++] = signo;
+#ifdef __FreeBSD__
+ printf("Signal #%zu: signo: %d\n", (size_t)count, signo);
+#endif
}
static int
@@ -188,7 +195,12 @@ ATF_TC_BODY(sigqueue_rt, tc)
sigset_t mask, orig;
sigemptyset(&mask);
for (size_t i = 0; i < CNT; i++)
+#ifdef __FreeBSD__
+ if (sigaddset(&mask, signals[i]) == -1)
+ warn("sigaddset");
+#else
sigaddset(&mask, signals[i]);
+#endif
ATF_REQUIRE(sigprocmask(SIG_BLOCK, &mask, &orig) != -1);
@@ -197,13 +209,24 @@ ATF_TC_BODY(sigqueue_rt, tc)
ATF_REQUIRE(sigprocmask(SIG_UNBLOCK, &mask, &orig) != -1);
sleep(1);
+#ifdef __FreeBSD__
+ ATF_CHECK_MSG((size_t)count == ndelivered,
+ "count %zu != ndelivered %zu", (size_t)count, ndelivered);
+#else
ATF_REQUIRE_MSG((size_t)count == ndelivered,
"count %zu != ndelivered %zu", (size_t)count, ndelivered);
+#endif
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]);
+#ifdef __FreeBSD__
+ if (count > ndelivered)
+ for (size_t i = ndelivered; i < count; i++)
+ printf("Undelivered signal #%zu: %d\n", i, ordered[i]);
+#endif
+
for (size_t i = 0; i < ndelivered; i++)
ATF_REQUIRE(sigaction(signals[i], &oact[i], NULL) != -1);
}