public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] support: Kill process group for test failure
@ 2020-02-20 14:34 Adhemerval Zanella
  2020-02-20 14:53 ` Carlos O'Donell
  2020-02-20 15:05 ` Florian Weimer
  0 siblings, 2 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2020-02-20 14:34 UTC (permalink / raw)
  To: libc-alpha

Some testcases that create multiple subprocesses might abort or exit
prior waiting for their children.  In such case, support_test_main
does not try to kill the spawned test process group (as in the
test timeout case).

On example that we are observing in internal tests is when
malloc/tst-mallocfork2 fails to fork in the signal handling (due
either maximum number of process or other non expected failure).

This patch kill the process group in the case of failed execution,
similar on how it is done on timeout.

Checked on x86_64-linux-gnu.
---
 support/support_test_main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/support/support_test_main.c b/support/support_test_main.c
index e3f0bf15f2..ac9f710fb7 100644
--- a/support/support_test_main.c
+++ b/support/support_test_main.c
@@ -459,6 +459,9 @@ support_test_main (int argc, char **argv, const struct test_config *config)
   /* Process terminated normaly without timeout etc.  */
   if (WIFEXITED (status))
     {
+      /* It is expected that a successful test execution handles all its
+	 children.  */
+
       if (config->expected_status == 0)
         {
           if (config->expected_signal == 0)
@@ -486,6 +489,10 @@ support_test_main (int argc, char **argv, const struct test_config *config)
   /* Process was killed by timer or other signal.  */
   else
     {
+      /* Kill the whole process group if test process aborts or exits prior
+	 waiting for them.  */
+      kill (-test_pid, SIGKILL);
+
       if (config->expected_signal == 0)
         {
           printf ("Didn't expect signal from child: got `%s'\n",
-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-20 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 14:34 [PATCH] support: Kill process group for test failure Adhemerval Zanella
2020-02-20 14:53 ` Carlos O'Donell
2020-02-20 15:14   ` Carlos O'Donell
2020-02-20 15:05 ` Florian Weimer
2020-02-20 15:12   ` Carlos O'Donell
2020-02-20 16:51     ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).