From: Andrew Bartlett Date: Wed, 4 May 2016 23:35:46 +0000 (+1200) Subject: selftest: Include a few more details in selftest and samba startup. X-Git-Tag: tdb-1.3.10~1231 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=bcace463b97b0a6737dded4a6d45996923ff0057;p=bbaumbach%2Fsamba-autobuild%2F.git selftest: Include a few more details in selftest and samba startup. This helps us understand failure modes in selftest Reviewed-by: Douglas Bagnall Signed-off-by: Andrew Bartlett --- diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 779116dc6b8..6daa6b2c94d 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -91,7 +91,10 @@ sub check_or_start($$$) my $env_ok = $self->check_env($env_vars); if ($env_ok) { - return $env_vars->{SAMBA_PID}; + return $env_vars->{SAMBA_PID}; + } elsif (defined($env_vars->{SAMBA_PID})) { + warn("SAMBA PID $env_vars->{SAMBA_PID} is not running (died)"); + return undef; } # use a pipe for stdin in the child processes. This allows @@ -1820,7 +1823,7 @@ sub teardown_env($$) sub getlog_env($$) { my ($self, $envvars) = @_; - my $title = "SAMBA LOG of: $envvars->{NETBIOSNAME}\n"; + my $title = "SAMBA LOG of: $envvars->{NETBIOSNAME} pid $envvars->{SAMBA_PID}\n"; my $out = $title; open(LOG, "<$envvars->{SAMBA_TEST_LOG}"); diff --git a/source4/smbd/server.c b/source4/smbd/server.c index bd70ac658ad..c82362e00b3 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -162,7 +162,7 @@ static void server_stdin_handler(struct tevent_context *event_ctx, struct tevent const char *binary_name = (const char *)private_data; uint8_t c; if (read(0, &c, 1) == 0) { - DEBUG(0,("%s: EOF on stdin - terminating\n", binary_name)); + DEBUG(0,("%s: EOF on stdin - PID %d terminating\n", binary_name, (int)getpid())); #if HAVE_GETPGRP if (getpgrp() == getpid()) { DEBUG(0,("Sending SIGTERM from pid %d\n", (int)getpid())); @@ -181,8 +181,8 @@ _NORETURN_ static void max_runtime_handler(struct tevent_context *ev, struct timeval t, void *private_data) { const char *binary_name = (const char *)private_data; - DEBUG(0,("%s: maximum runtime exceeded - terminating at %llu, current ts: %llu\n", - binary_name, (unsigned long long)t.tv_sec, (unsigned long long) time(NULL))); + DEBUG(0,("%s: maximum runtime exceeded - terminating PID %d at %llu, current ts: %llu\n", + binary_name, (int)getpid(), (unsigned long long)t.tv_sec, (unsigned long long) time(NULL))); exit(0); } @@ -209,7 +209,8 @@ static void prime_ldb_databases(struct tevent_context *event_ctx) static NTSTATUS samba_terminate(struct irpc_message *msg, struct samba_terminate *r) { - DEBUG(0,("samba_terminate: %s\n", r->in.reason)); + DEBUG(0,("samba_terminate of %d: %s\n", + (int)getpid(), r->in.reason)); exit(1); } @@ -456,8 +457,9 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ } if (max_runtime) { - DEBUG(0,("Called with maxruntime %d - current ts %llu\n", - max_runtime, (unsigned long long) time(NULL))); + DEBUG(0,("%s PID %d was called with maxruntime %d - current ts %llu\n", + binary_name, (int)getpid(), + max_runtime, (unsigned long long) time(NULL))); tevent_add_timer(event_ctx, event_ctx, timeval_current_ofs(max_runtime, 0), max_runtime_handler,