diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-03-04 18:32:44 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-03-04 10:14:34 +0100 |
commit | a37990c5c15e8077c5466ed139044ed26bae8c5e (patch) | |
tree | 2c7af77194cc986129ea2acb39750d05453ce241 /selftest/target | |
parent | e495118aaba20d05e6da937040de4f82b600b70b (diff) | |
download | samba-a37990c5c15e8077c5466ed139044ed26bae8c5e.tar.gz samba-a37990c5c15e8077c5466ed139044ed26bae8c5e.tar.bz2 samba-a37990c5c15e8077c5466ed139044ed26bae8c5e.zip |
selftest: Rework Samba4.pm process termination.
We now double-check the waitpid() result with kill(0, $pid)
We now also send a SIGTERM, then a SIGKILL.
Andrew Bartlett
Diffstat (limited to 'selftest/target')
-rw-r--r-- | selftest/target/Samba4.pm | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index c96662abbc..8e27620589 100644 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -1335,16 +1335,33 @@ sub teardown_env($$) $pid = $envvars->{SAMBA_PID}; my $count = 0; my $childpid; - until (Samba::cleanup_child($pid, "samba") < 0) { - # This should give it time to write out the gcov data + + # This should give it time to write out the gcov data + until ($count > 20) { + if (Samba::cleanup_child($pid, "samba") == -1) { + last; + } sleep(1); $count++; - last if $count > 20; } - + + if ($count <= 20 && kill(0, $pid) == 0) { + return; + } + + kill "TERM", $pid; + + until ($count > 20) { + if (Samba::cleanup_child($pid, "samba") == -1) { + last; + } + sleep(1); + $count++; + } + # If it is still around, kill it - if ($count > 20) { - print "server process $pid took more than $count seconds to exit, killing\n"; + if ($count > 20 && kill(0, $pid) == 0) { + warn "server process $pid took more than $count seconds to exit, killing\n"; kill 9, $pid; } |