From b3b6d7b40656aaa1fe859b0c97b9332c3b1f2ec7 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 15 Sep 2017 19:48:48 +0000 Subject: [PATCH] Fix the raise tests. - The exit probe was not appropriately filtered to only the known pid so it was firing on any random process that would exit rather the only the one we cared about. - The dtest script executes the tst.raise*.exe in the background from POSIX sh without jobs control. POSIX mandates that SIGINT be set to SIG_IGN in this case. The test executable never actually tested that SIGINT could be caught despite trying to block and delay the signal. So the SIGINT sent from raise() is never actually received since it is ignored. This could be fixed by calling 'trap - INT' from dtest before running the executable but I've opted to just use SIGUSR1 instead in these specific tests rather than adding more logic to test that SIGINT is not ignored at startup. These 2 issues meant that the tests would randomly work but only if a process coincidentally exited during the test. Reviewed by: markj MFC after: 2 weeks Sponsored by: Dell EMC Isilon --- .../opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c | 4 ++-- .../opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d | 3 ++- .../opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c | 2 +- .../opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d | 3 ++- .../opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c | 2 +- .../opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d | 3 ++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c index e39108366e39..8dd7bb972ef3 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.c @@ -35,13 +35,13 @@ main(int argc, char **argv) sigset_t ss; (void) sigemptyset(&ss); - (void) sigaddset(&ss, SIGINT); + (void) sigaddset(&ss, SIGUSR1); (void) sigprocmask(SIG_BLOCK, &ss, NULL); do { (void) getpid(); (void) sigpending(&ss); - } while (!sigismember(&ss, SIGINT)); + } while (!sigismember(&ss, SIGUSR1)); return (0); } diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d index cdc7154750b6..30bf5ae4bf0a 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise1.d @@ -47,7 +47,7 @@ syscall::getpid:entry /pid == $1/ { trace("raised"); - raise(SIGINT); + raise(SIGUSR1); /* * Wait no more than half a second for the process to die. */ @@ -55,6 +55,7 @@ syscall::getpid:entry } syscall::exit:entry +/pid == $1/ { exit(0); } diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c index 9089283f7893..3901d9862097 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.c @@ -45,7 +45,7 @@ main(int argc, char **argv) sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - (void) sigaction(SIGINT, &sa, NULL); + (void) sigaction(SIGUSR1, &sa, NULL); for (;;) { (void) getpid(); diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d index 4f68a0b93b3b..7d18442d7408 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise2.d @@ -47,7 +47,7 @@ syscall::getpid:return /pid == $1/ { trace("raised"); - raise(SIGINT); + raise(SIGUSR1); /* * Wait no more than half a second for the process to die. */ @@ -55,6 +55,7 @@ syscall::getpid:return } syscall::exit:entry +/pid == $1/ { exit(0); } diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c index 9089283f7893..3901d9862097 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.c @@ -45,7 +45,7 @@ main(int argc, char **argv) sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - (void) sigaction(SIGINT, &sa, NULL); + (void) sigaction(SIGUSR1, &sa, NULL); for (;;) { (void) getpid(); diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d index cdc7154750b6..30bf5ae4bf0a 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/raise/tst.raise3.d @@ -47,7 +47,7 @@ syscall::getpid:entry /pid == $1/ { trace("raised"); - raise(SIGINT); + raise(SIGUSR1); /* * Wait no more than half a second for the process to die. */ @@ -55,6 +55,7 @@ syscall::getpid:entry } syscall::exit:entry +/pid == $1/ { exit(0); }