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
This commit is contained in:
Bryan Drewery 2017-09-15 19:48:48 +00:00
parent 02c474b481
commit b3b6d7b406
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323620
6 changed files with 10 additions and 7 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();

View File

@ -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);
}

View File

@ -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();

View File

@ -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);
}