Improve the signalled-under-SIGSTOP test.
authorlace <>
Sun, 15 Apr 2007 03:37:00 +0000 (03:37 +0000)
committerlace <>
Sun, 15 Apr 2007 03:37:00 +0000 (03:37 +0000)
testsuite.c

index 306bc1d..242b53d 100644 (file)
@@ -208,7 +208,8 @@ static void murder (pid_t pid)
   if (!(pid_got == -1 && errno == ECHILD))
     {
       assert (pid_got == pid);
-      assert ((WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL)
+      assert ((WIFSIGNALED (status) && (WTERMSIG (status) == SIGKILL
+                                       || WTERMSIG (status) == SIGUSR2))
              || (WIFEXITED (status) && WEXITSTATUS (status) == 0));
       STATE (pid, 1 << STATE_ENOENT);
     }
@@ -357,9 +358,24 @@ static void body_spawner (void *(*child) (void *data, void *input), void *data,
   delay ();
   i = tkill (inferior, SIGCONT);
   assert (i == 0);
-  /* This is a race, we may not prove the successful SIGALRM delivery by it.  */
+  /* This is a race, we may not prove the successful SIGALRM delivery by it.
+     Rather recheck it below.  */
   STATE (inferior, 1 << STATE_RUNNING);
-  murder (inferior);
+  delay ();
+  i = tkill (inferior, SIGSTOP);
+  assert (i == 0);
+  /* Wait till it gets stopped otherwise we may get STATE_ENOENT below.  */
+  STATE (inferior, 1 << STATE_STOPPED);
+  delay ();
+  i = tkill (inferior, SIGUSR2);
+  assert (i == 0);
+  STATE (inferior, 1 << STATE_STOPPED);
+  delay ();
+  i = tkill (inferior, SIGCONT);
+  assert (i == 0);
+  /* Not just STATE_ZOMBIE as we can get spawn with waiter.  FIXME.  */
+  STATE (inferior, (1 << STATE_ENOENT) | (1 << STATE_ZOMBIE) | (1 << STATE_DEAD));
+  /* We would fail on: murder (inferior);  */
 }
 
 static void *pass (void *data, void *input)