[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Mar 2 06:45:03 MST 2012


The branch, master has been updated
       via  95976d4 selftest: Rework samba4.blackbox.bogusdomain to use a temporary user
       via  5d4144a selftest: close stdin and wait with waitpid() for a safer exit
       via  0d94d68 selftest: Put stdin pipe on the environment
      from  6c1c092 s3: Test for statfs before statfs64

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 95976d4ec2111a5be7dab2698de35537a10536a1
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 2 22:28:59 2012 +1100

    selftest: Rework samba4.blackbox.bogusdomain to use a temporary user
    
    This avoids leaving an account in the test environment after the test is run
    and therefore avoids issues with interations with other tests.
    
    Also, we now use the local administrator account in the member server to
    add the test account.
    
    Andrew Bartlett
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Fri Mar  2 14:44:36 CET 2012 on sn-devel-104

commit 5d4144a82674467bccbfe30f42382ed0905026d0
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 2 18:20:45 2012 +1100

    selftest: close stdin and wait with waitpid() for a safer exit
    
    This avoids timelimit sending kill -9 after 1 second, which may
    disrupt the writing of gcov data.
    
    Andrew Bartlett

commit 0d94d681c4a829b2a0bdadf5800c11c05edd2fa4
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Mar 2 18:01:13 2012 +1100

    selftest: Put stdin pipe on the environment
    
    This seems to help us close the right pipe at cleanup time.
    
    Andrew Bartlett

-----------------------------------------------------------------------

Summary of changes:
 selftest/target/Samba3.pm   |   32 +++++++++++++++++++++++++++++++-
 selftest/target/Samba4.pm   |   21 ++++++++++++---------
 source4/selftest/tests.py   |    2 +-
 testprogs/blackbox/bogus.sh |   14 +++++++++++---
 4 files changed, 55 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 0ea63db..c9ad7d3 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -43,17 +43,45 @@ sub new($$) {
 sub teardown_env($$)
 {
 	my ($self, $envvars) = @_;
+	my $count = 0;
+	
+	# This should cause smbd to terminate gracefully
+	close($envvars->{STDIN_PIPE});
 
 	my $smbdpid = read_pid($envvars, "smbd");
 	my $nmbdpid = read_pid($envvars, "nmbd");
 	my $winbinddpid = read_pid($envvars, "winbindd");
 
+	until (kill(0, $smbdpid, $nmbdpid, $winbinddpid) == 0) {
+	    my $childpid = waitpid(-1, WNOHANG);
+	    # This should give it time to write out the gcov data
+	    sleep(1);
+	    $count++;
+	    last if $childpid == 0 or $count > 20;
+	}
+
+	if ($count <= 20) {
+	    return;
+	}
+
 	$self->stop_sig_term($smbdpid);
 	$self->stop_sig_term($nmbdpid);
 	$self->stop_sig_term($winbinddpid);
 
-	sleep(2);
+	$count = 0;
+	until (kill(0, $smbdpid, $nmbdpid, $winbinddpid) == 0) {
+	    # if no process sucessfully signalled, then we are done
+	    my $childpid = waitpid(-1, WNOHANG);
+	    sleep(1);
+	    $count++;
+	    last if $childpid == 0 or $count > 20;
+	}
+	
+	if ($count <= 10) {
+	    return;
+	}
 
+	warn("timelimit process did not quit on SIGTERM, sending SIGKILL");
 	$self->stop_sig_kill($smbdpid);
 	$self->stop_sig_kill($nmbdpid);
 	$self->stop_sig_kill($winbinddpid);
@@ -98,6 +126,8 @@ sub check_env($$)
 {
 	my ($self, $envvars) = @_;
 
+	my $childpid = waitpid(-1, WNOHANG);
+
 	# TODO ...
 	return 1;
 }
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 12c7e0a..b79e29f 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -158,7 +158,7 @@ sub check_or_start($$$)
 	}
 	print "DONE\n";
 
-	open(DATA, ">$env_vars->{SAMBA_TEST_FIFO}");
+	open($env_vars->{STDIN_PIPE}, ">$env_vars->{SAMBA_TEST_FIFO}");
 
 	return $pid;
 }
@@ -1354,20 +1354,21 @@ sub teardown_env($$)
 	my ($self, $envvars) = @_;
 	my $pid;
 
-	close(DATA);
+	# This should cause samba to terminate gracefully
+	close($envvars->{STDIN_PIPE});
 
 	if (open(IN, "<$envvars->{PIDDIR}/samba.pid")) {
 		$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;
+		    my $childpid = waitpid(-1, WNOHANG);
+	
+		    # This should give it time to write out the gcov data
+		    sleep(1);
+		    $count++;
+		    last if $childpid == 0 or $count > 20;
 		}
 
 		# If it is still around, kill it
@@ -1410,6 +1411,8 @@ sub check_env($$)
 {
 	my ($self, $envvars) = @_;
 
+	my $childpid = waitpid(-1, WNOHANG);
+
 	return (-p $envvars->{SAMBA_TEST_FIFO});
 }
 
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 5ad9861..18701c6 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -358,7 +358,7 @@ for mech in [
     plansmbtorturetestsuite('base.xcopy', "plugin_s4_dc",
                             ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s administrator" % name)
 
-plantestsuite("samba4.blackbox.bogusdomain", "s3member", ["testprogs/blackbox/bogus.sh", "$NETBIOSNAME", "xcopy_share", '$DC_USERNAME', '$DC_PASSWORD'], allow_empty_output=True)
+plantestsuite("samba4.blackbox.bogusdomain", "s3member", ["testprogs/blackbox/bogus.sh", "$NETBIOSNAME", "xcopy_share", '$USERNAME', '$PASSWORD', '$DC_USERNAME', '$DC_PASSWORD'])
 for mech in [
     "-k no",
     "-k no --option=usespnego=no",
diff --git a/testprogs/blackbox/bogus.sh b/testprogs/blackbox/bogus.sh
index 019957b..68bab03 100755
--- a/testprogs/blackbox/bogus.sh
+++ b/testprogs/blackbox/bogus.sh
@@ -13,8 +13,16 @@ SERVER=$1
 SHARE=$2
 USER=$3
 PWD=$4
+DC_USER=$5
+DC_PWD=$6
+shift 6
+
+TEST_USER=bogus_testuser
+TEST_PWD=bogus_pass3#@
 smbclient="$BINDIR/smbclient"
-testit_expect_failure "smbclient" $smbclient "//$SERVER/$SHARE" -W POUET -U$USER%$PWD -c "dir"&& failed=`expr $failed + 1`
-./bin/net rpc user add $USER $PWD -W $SERVER -U$USER%$PWD -S $SERVER
-testit "smbclient" $smbclient "//$SERVER/$SHARE" -W POUET -U$USER%$PWD -c "dir"|| failed=`expr $failed + 1`
+net="$BINDIR/net"
+testit_expect_failure "smbclient" $smbclient "//$SERVER/$SHARE" -W POUET -U$DC_USER%$DC_PWD -c "dir"&& failed=`expr $failed + 1`
+testit "net.user.add" $net rpc user add $TEST_USER $TEST_PWD -W $SERVER -U$SERVER\\$USER%$PWD -S $SERVER
+testit "smbclient" $smbclient "//$SERVER/$SHARE" -W POUET -U$TEST_USER%$TEST_PWD -c "dir"|| failed=`expr $failed + 1`
+testit "net.user.delete" $net rpc user delete $TEST_USER -W $SERVER -U$SERVER\\$USER%$PWD -S $SERVER
 exit $failed


-- 
Samba Shared Repository


More information about the samba-cvs mailing list