summaryrefslogtreecommitdiff
path: root/selftest/target
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2012-01-03 16:48:29 +1100
committerAndrew Bartlett <abartlet@samba.org>2012-02-28 12:01:08 +0100
commit645fcc5375325b700ac58cb25c498f6f7b91421b (patch)
tree6f92d974dfa322e8a093958dbf24f8bde472af46 /selftest/target
parent8db121be4265bc4de3b34c6eab1b5ae2fd882957 (diff)
downloadsamba-645fcc5375325b700ac58cb25c498f6f7b91421b.tar.gz
samba-645fcc5375325b700ac58cb25c498f6f7b91421b.tar.bz2
samba-645fcc5375325b700ac58cb25c498f6f7b91421b.zip
selftest: added a pipe on stdin in s3 child processes
this adds a pipe for STDIN in smbd, nmbd and winbindd when run in selftest. This allows those processes to detect when they should exit by looking for EOF on stdin.
Diffstat (limited to 'selftest/target')
-rwxr-xr-xselftest/target/Samba3.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 45705c0028..4b0b725d52 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -590,6 +590,11 @@ sub read_pid($$)
sub check_or_start($$$$$) {
my ($self, $env_vars, $nmbd, $winbindd, $smbd) = @_;
+ # use a pipe for stdin in the child processes. This allows
+ # those processes to monitor the pipe for EOF to ensure they
+ # exit when the test script exits
+ pipe(STDIN_READER, $env_vars->{STDIN_PIPE});
+
unlink($env_vars->{NMBD_TEST_LOG});
print "STARTING NMBD...";
my $pid = fork();
@@ -631,6 +636,9 @@ sub check_or_start($$$$$) {
@preargs = split(/ /, $ENV{NMBD_VALGRIND});
}
+ close($env_vars->{STDIN_PIPE});
+ open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+
exec(@preargs, Samba::bindir_path($self, "nmbd"), "-F", "--no-process-group", "--log-stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start nmbd: $!");
}
write_pid($env_vars, "nmbd", $pid);
@@ -679,6 +687,9 @@ sub check_or_start($$$$$) {
print "Starting winbindd with config $env_vars->{SERVERCONFFILE}\n";
+ close($env_vars->{STDIN_PIPE});
+ open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+
exec(@preargs, Samba::bindir_path($self, "winbindd"), "-F", "--no-process-group", "--stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!");
}
write_pid($env_vars, "winbindd", $pid);
@@ -722,11 +733,17 @@ sub check_or_start($$$$$) {
if(defined($ENV{SMBD_VALGRIND})) {
@preargs = split(/ /,$ENV{SMBD_VALGRIND});
}
+
+ close($env_vars->{STDIN_PIPE});
+ open STDIN, ">&", \*STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
+
exec(@preargs, Samba::bindir_path($self, "smbd"), "-F", "--no-process-group", "--log-stdout", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start smbd: $!");
}
write_pid($env_vars, "smbd", $pid);
print "DONE\n";
+ close(STDIN_READER);
+
return 0;
}