summaryrefslogtreecommitdiff
path: root/source4/selftest
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-07-04 00:34:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:59:02 -0500
commit31df9075c51e119fb9ab80bf2acb3a22645fa377 (patch)
tree37a3fc64001ac8be68a451e70a57f6a0f16802aa /source4/selftest
parent5dd8496af6f0e4a245ee3a365e2d9a440692fa05 (diff)
downloadsamba-31df9075c51e119fb9ab80bf2acb3a22645fa377.tar.gz
samba-31df9075c51e119fb9ab80bf2acb3a22645fa377.tar.bz2
samba-31df9075c51e119fb9ab80bf2acb3a22645fa377.zip
r23693: Give the process a chance to write out it's coverage data, before we
blast a kill -9 at it. Andrew Bartlett (This used to be commit 16692ae7d9ce269ca7d610319df20d894fe06a1c)
Diffstat (limited to 'source4/selftest')
-rw-r--r--source4/selftest/Samba4.pm25
1 files changed, 20 insertions, 5 deletions
diff --git a/source4/selftest/Samba4.pm b/source4/selftest/Samba4.pm
index 07ed12a80f..ec34358e0a 100644
--- a/source4/selftest/Samba4.pm
+++ b/source4/selftest/Samba4.pm
@@ -514,19 +514,34 @@ sub provision_dc($$)
sub teardown_env($$)
{
my ($self, $envvars) = @_;
+ my $pid;
close(DATA);
- sleep(2);
-
- my $failed = $? >> 8;
-
if (-f "$envvars->{PIDDIR}/smbd.pid" ) {
open(IN, "<$envvars->{PIDDIR}/smbd.pid") or die("unable to open smbd pid file");
- kill 9, <IN>;
+ $pid = <IN>;
close(IN);
+
+ # Give the process 20 seconds to exit. gcov needs
+ # this time to write out the covarge data
+ my $count = 0;
+ until (kill(0, $pid) == 0) {
+ # if no process sucessfully signalled, then we are done
+ sleep(1);
+ $count++;
+ last if $count > 20;
+ }
+
+ # If it is still around, kill it
+ if ($count > 20) {
+ print "smbd process $pid took more than $count seconds to exit, killing\n";
+ kill 9, $pid;
+ }
}
+ my $failed = $? >> 8;
+
$self->slapd_stop($envvars) if ($self->{ldap});
print $self->getlog_env($envvars);