[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Sat Oct 2 22:52:02 MDT 2010


The branch, master has been updated
       via  32ec1b3 s4-kcc: silence "Testing kcctpl_create_intersite_connections" message
       via  dfb664a s4-selftest: support 'make testenv SCREEN=1'
       via  29e1a84 s4-selftest: silence warnings about bind chown
       via  3bb5925 s4-test: silence a tap2subunit error
       via  762ad1c s4-test: silence the Failed to chown message in make test
       via  e36f20d s4-ldif: get rid of the ndr_pull_error message on startup
       via  87f0145 s4-server: exit with status 127 on SIGTERM
       via  b772871 s4-selftest: added --screen option for test
       via  507c413 s4-selftest: fixed up exit codes on signals for make test
      from  60e25ab land: Force always emailing when there is no other mechanism of progress reporting.

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


- Log -----------------------------------------------------------------
commit 32ec1b36e0ba201344097bcfc1c85c6bc316bab3
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 14:56:28 2010 -0700

    s4-kcc: silence "Testing kcctpl_create_intersite_connections" message
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Sun Oct  3 04:51:44 UTC 2010 on sn-devel-104

commit dfb664a1822f41cbd4f1f5a8ce6fcac4e1547bf6
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 14:23:43 2010 -0700

    s4-selftest: support 'make testenv SCREEN=1'
    
    this can be used to start a test envioronment in screen windows.
    
    Use:
    
      make testenv SCREEN=1 SELFTEST_TESTENV=dc
    
    to launch just one environment (in this case, "dc")

commit 29e1a847ddb28aee8ae04578b74cb8ab97427b96
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 14:21:52 2010 -0700

    s4-selftest: silence warnings about bind chown

commit 3bb59255bb5d0275242cc7c81b3935612b729354
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 14:21:11 2010 -0700

    s4-test: silence a tap2subunit error

commit 762ad1c4baf04aa2e5dcdbcf6242b3e34d92cd4e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 13:08:37 2010 -0700

    s4-test: silence the Failed to chown message in make test

commit e36f20d39dae2f20ebfcf8be156963e10e150066
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 13:03:40 2010 -0700

    s4-ldif: get rid of the ndr_pull_error message on startup
    
    detect if the prefixmap blob is text or binary using the first 4 bytes

commit 87f0145d078d1598c9889e2cc2942e654794ae4a
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 12:44:28 2010 -0700

    s4-server: exit with status 127 on SIGTERM
    
    this ensures that make test detects a failure if samba is killed by
    SIGTERM

commit b772871f4c85fe15b62cfca5c3a6d1f1a66540d6
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 12:43:50 2010 -0700

    s4-selftest: added --screen option for test
    
    you can now do:
    
      make test TESTS="some test" SCREEN=1
    
    while in GNU screen, and all the samba servers will launch in their
    own new screen, named after the server name.
    
    You can also do:
    
      make test TESTS="some test" SCREEN=1 VALGRIND_SERVER=1
    
    to run valgrind on each samba server, or
    
      make test TESTS="some test" SCREEN=1 GDBTEST=1
    
    to run gdb on each server

commit 507c413e488dfe374870bae3af0d89c3b015add2
Author: Andrew Tridgell <tridge at samba.org>
Date:   Sat Oct 2 12:42:00 2010 -0700

    s4-selftest: fixed up exit codes on signals for make test
    
    also set $ENVNAME in launched servers

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

Summary of changes:
 selftest/in_screen                          |   66 +++++++++++++++++++++++++++
 selftest/selftest.pl                        |    5 +-
 selftest/target/Samba4.pm                   |   20 ++++++--
 source4/dsdb/kcc/kcc_topology.c             |    2 +-
 source4/lib/ldb-samba/ldif_handlers.c       |   25 ++++++----
 source4/scripting/python/samba/provision.py |    8 ++-
 source4/selftest/tests.py                   |    2 +-
 source4/selftest/wscript                    |   33 +++++++++++--
 source4/smbd/server.c                       |    2 +-
 9 files changed, 135 insertions(+), 28 deletions(-)
 create mode 100755 selftest/in_screen


Changeset truncated at 500 lines:

diff --git a/selftest/in_screen b/selftest/in_screen
new file mode 100755
index 0000000..8a3cc5c
--- /dev/null
+++ b/selftest/in_screen
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+export TMPDIR="$SELFTEST_TMPDIR"
+
+SERVERNAME="$ENVNAME"
+[ -z "$SERVERNAME" ] && SERVERNAME="base"
+basedir=$TMPDIR
+
+[ -r $basedir/$SERVERNAME.pid ] && {
+    for i in $(seq 2 100); do
+	if [ ! -r "$basedir/${SERVERNAME}-$i.pid" ]; then
+	    SERVERNAME="${SERVERNAME}-$i"
+	    break
+	fi
+    done
+}
+
+rm -f $basedir/$SERVERNAME.*
+
+# set most of the environment vars we have in the screen session too
+_ENV=""
+vars=$(mktemp)
+printenv |
+  egrep -v '^TERMCAP|^WINDOW|^SHELL|^STY|^SHLVL|^SAMBA_VALGRIND|\$' |
+  egrep '^[A-Z]' |
+  sed "s/\(^[^=]*=\)\(.*\)/export \1'\2'/g" > $basedir/$SERVERNAME.vars
+
+cat <<EOF > $basedir/$SERVERNAME.launch
+ echo \$\$ > $basedir/$SERVERNAME.pid
+ . $basedir/$SERVERNAME.vars
+ echo "\$(date) starting $SERVERNAME" >> $basedir/$SERVERNAME.log
+ $@
+ echo \$? > $basedir/$SERVERNAME.status
+ read parent < $basedir/$SERVERNAME.parent.pid
+ kill \$parent
+EOF
+pid=$$
+
+cleanup() {
+    trap "exit 1" SIGINT SIGTERM SIGPIPE
+    [ -r $basedir/$SERVERNAME.status ] && {
+	read status < $basedir/$SERVERNAME.status
+	echo "$(date) samba exited with status $status" >> $basedir/$SERVERNAME.log
+	exit $status
+    }
+    read pid < $basedir/$SERVERNAME.pid
+    echo "$(date) Killing samba pid $pid from $$" >> $basedir/$SERVERNAME.log
+    if [ "$pid" = "$$" ]; then
+	exit 1
+    fi
+    kill -9 $pid 2>&1
+    exit 1
+}
+
+rm -f $basedir/$SERVERNAME.status $basedir/$SERVERNAME.log
+echo $$ > $basedir/$SERVERNAME.parent.pid
+trap cleanup SIGINT SIGTERM SIGPIPE
+screen -r -X screen -t test:$SERVERNAME bash $basedir/$SERVERNAME.launch
+echo "$(date) waiting in $$" >> $basedir/$SERVERNAME.log
+read stdin_var
+echo "$(date) EOF on stdin" >> $basedir/$SERVERNAME.log
+read pid < $basedir/$SERVERNAME.pid
+echo "$(date) killing $pid" >> $basedir/$SERVERNAME.log
+kill $pid 2> /dev/null
+echo "$(date) exiting" >> $basedir/$SERVERNAME.log
+exit 0
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index d102d43..08ee52c 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -923,11 +923,12 @@ if ($opt_testenv) {
 	die("Unable to setup environment $testenv_name") unless ($testenv_vars);
 
 	$ENV{PIDDIR} = $testenv_vars->{PIDDIR};
+	$ENV{ENVNAME} = $testenv_name;
 
 	my $envvarstr = exported_envvars_str($testenv_vars);
 
-	my $term = ($ENV{TERMINAL} or "xterm");
-	system("$term -e 'echo -e \"
+	my $term = ($ENV{TERMINAL} or "xterm -e");
+	system("$term 'echo -e \"
 Welcome to the Samba4 Test environment '$testenv_name'
 
 This matches the client environment used in make test
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 53237e0..36023f2 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -88,7 +88,7 @@ sub check_or_start($$$)
 	POSIX::mkfifo($env_vars->{SAMBA_TEST_FIFO}, 0700);
 	unlink($env_vars->{SAMBA_TEST_LOG});
 	
-	print "STARTING SAMBA... ";
+	print "STARTING SAMBA for $ENV{ENVNAME}\n";
 	my $pid = fork();
 	if ($pid == 0) {
 		open STDIN, $env_vars->{SAMBA_TEST_FIFO};
@@ -139,20 +139,23 @@ sub check_or_start($$$)
 			$model = $ENV{SAMBA_PROCESS_MODEL};
 		}
 		my $ret = system("$valgrind $samba $optarg $env_vars->{CONFIGURATION} -M $model -i");
-		if ($? == -1) {
+		if ($ret == -1) {
 			print "Unable to start $samba: $ret: $!\n";
 			exit 1;
 		}
+		my $exit = ($ret >> 8);
 		unlink($env_vars->{SAMBA_TEST_FIFO});
-		my $exit = $? >> 8;
 		if ($ret == 0) {
-			print "$samba exits with status $exit\n";
+			print "$samba exited with no error\n";
+			exit 0;
 		} elsif ( $ret & 127 ) {
 			print "$samba got signal ".($ret & 127)." and exits with $exit!\n";
 		} else {
-			$ret = $? >> 8;
 			print "$samba failed with status $exit!\n";
 		}
+		if ($exit == 0) {
+			$exit = -1;
+		}
 		exit $exit;
 	}
 	print "DONE\n";
@@ -1251,6 +1254,8 @@ sub setup_env($$$)
 {
 	my ($self, $envname, $path) = @_;
 
+	$ENV{ENVNAME} = $envname;
+
 	if ($envname eq "dc") {
 		return $self->setup_dc("$path/dc");
 	} elsif ($envname eq "fl2000dc") {
@@ -1281,10 +1286,12 @@ sub setup_env($$$)
 		return $self->setup_rodc("$path/rodc", $self->{vars}->{dc});
 	} elsif ($envname eq "all") {
 		if (not defined($self->{vars}->{dc})) {
+			$ENV{ENVNAME} = "dc";
 			$self->setup_dc("$path/dc");
 		}
 		my $ret = $self->setup_member("$path/member", $self->{vars}->{dc});
 		if (not defined($self->{vars}->{rpc_proxy})) {
+			$ENV{ENVNAME} = "rpc_proxy";
 			my $rpc_proxy_ret = $self->setup_rpc_proxy("$path/rpc_proxy", $self->{vars}->{dc});
 			
 			$ret->{RPC_PROXY_SERVER} = $rpc_proxy_ret->{SERVER};
@@ -1295,6 +1302,7 @@ sub setup_env($$$)
 			$ret->{RPC_PROXY_PASSWORD} = $rpc_proxy_ret->{PASSWORD};
 		}
 		if (not defined($self->{vars}->{fl2000dc})) {
+			$ENV{ENVNAME} = "fl2000dc";
 			my $fl2000dc_ret = $self->setup_fl2000dc("$path/fl2000dc", $self->{vars}->{dc});
 			
 			$ret->{FL2000DC_SERVER} = $fl2000dc_ret->{SERVER};
@@ -1305,6 +1313,7 @@ sub setup_env($$$)
 			$ret->{FL2000DC_PASSWORD} = $fl2000dc_ret->{PASSWORD};
 		}
 		if (not defined($self->{vars}->{fl2003dc})) {
+			$ENV{ENVNAME} = "fl2003dc";
 			my $fl2003dc_ret = $self->setup_fl2003dc("$path/fl2003dc", $self->{vars}->{dc});
 
 			$ret->{FL2003DC_SERVER} = $fl2003dc_ret->{SERVER};
@@ -1315,6 +1324,7 @@ sub setup_env($$$)
 			$ret->{FL2003DC_PASSWORD} = $fl2003dc_ret->{PASSWORD};
 		}
 		if (not defined($self->{vars}->{fl2008r2dc})) {
+			$ENV{ENVNAME} = "fl2008r2dc";
 			my $fl2008r2dc_ret = $self->setup_fl2008r2dc("$path/fl2008r2dc", $self->{vars}->{dc});
 
 			$ret->{FL2008R2DC_SERVER} = $fl2008r2dc_ret->{SERVER};
diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c
index eab7791..94ed7a8 100644
--- a/source4/dsdb/kcc/kcc_topology.c
+++ b/source4/dsdb/kcc/kcc_topology.c
@@ -3460,7 +3460,7 @@ NTSTATUS kcctpl_test(struct kccsrv_service *service)
 	struct GUID_list keep;
 	bool all_connected;
 
-	DEBUG(2, ("Testing kcctpl_create_intersite_connections\n"));
+	DEBUG(5, ("Testing kcctpl_create_intersite_connections\n"));
 	status = kcctpl_create_intersite_connections(service, tmp_ctx, &keep,
 						     &all_connected);
 	DEBUG(4, ("%s\n", nt_errstr(status)));
diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c
index 1c36610..324209b 100644
--- a/source4/lib/ldb-samba/ldif_handlers.c
+++ b/source4/lib/ldb-samba/ldif_handlers.c
@@ -527,17 +527,22 @@ static int ldif_read_prefixMap(struct ldb_context *ldb, void *mem_ctx,
 		return -1;
 	}
 
-	ndr_err = ndr_pull_struct_blob(in, tmp_ctx, blob,
-				       (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
-	if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-		ndr_err = ndr_push_struct_blob(out, mem_ctx,
-					       blob,
-					       (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
-		talloc_free(tmp_ctx);
-		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-			return -1;
+	/* use the switch value to detect if this is in the binary
+	 * format
+	 */
+	if (in->length >= 4 && IVAL(in->data, 0) == PREFIX_MAP_VERSION_DSDB) {
+		ndr_err = ndr_pull_struct_blob(in, tmp_ctx, blob,
+					       (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
+		if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+			ndr_err = ndr_push_struct_blob(out, mem_ctx,
+						       blob,
+						       (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
+			talloc_free(tmp_ctx);
+			if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+				return -1;
+			}
+			return 0;
 		}
-		return 0;
 	}
 
 	/* If this does not parse, then it is probably the text version, and we should try it that way */
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 1d0abf4..96e7aa5 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -1672,8 +1672,9 @@ def provision(setup_dir, logger, session_info,
             os.chmod(dns_keytab_path, 0640)
             os.chown(dns_keytab_path, -1, paths.bind_gid)
         except OSError:
-            logger.info("Failed to chown %s to bind gid %u", dns_keytab_path,
-                paths.bind_gid)
+            if not os.environ.has_key('SAMBA_SELFTEST'):
+                logger.info("Failed to chown %s to bind gid %u", dns_keytab_path,
+                            paths.bind_gid)
 
 
     logger.info("Please install the phpLDAPadmin configuration located at %s into /etc/phpldapadmin/config.php",
@@ -1826,7 +1827,8 @@ def create_zone_file(lp, logger, paths, targetdir, setup_path, dnsdomain,
             os.chmod(dns_dir, 0775)
             os.chmod(paths.dns, 0664)
         except OSError:
-            logger.error("Failed to chown %s to bind gid %u" % (dns_dir, paths.bind_gid))
+            if not os.environ.has_key('SAMBA_SELFTEST'):
+                logger.error("Failed to chown %s to bind gid %u" % (dns_dir, paths.bind_gid))
 
     if targetdir is None:
         os.system(rndc + " unfreeze " + lp.get("realm"))
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 1913c40..b6402e8 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -139,7 +139,7 @@ else:
 def smb4torture_testsuites(prefix):
     return filter(lambda x: x.startswith(prefix), smb4torture_testsuite_list)
 
-sub = subprocess.Popen("tap2subunit", stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
+sub = subprocess.Popen("tap2subunit 2> /dev/null", stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
 sub.communicate("")
 if sub.returncode != 0:
     tap2subunit = "PYTHONPATH=%s/../lib/subunit/python:%s/../lib/testtools %s %s/../lib/subunit/filters/tap2subunit" % (samba4srcdir, samba4srcdir, python, samba4srcdir)
diff --git a/source4/selftest/wscript b/source4/selftest/wscript
index c693f1b..561baeb 100644
--- a/source4/selftest/wscript
+++ b/source4/selftest/wscript
@@ -48,8 +48,11 @@ def set_options(opt):
     gr.add_option('--valgrind-server',
                   help=("use valgrind on the server in the tests (opens an xterm)"),
                   action="store_true", dest='VALGRIND_SERVER', default=False)
+    gr.add_option('--screen',
+                  help=("run the samba servers in screen sessions"),
+                  action="store_true", dest='SCREEN', default=False)
     gr.add_option('--gdbtest',
-                  help=("run the testsuite within a gdb xterm window"),
+                  help=("run the servers within a gdb window"),
                   action="store_true", dest='GDBTEST', default=False)
     gr.add_option('--fail-immediately',
                   help=("stop tests on first failure"),
@@ -75,6 +78,8 @@ def cmd_testonly(opt):
         print("ERROR: You must use --enable-selftest to enable selftest")
         sys.exit(1)
 
+    os.environ['SAMBA_SELFTEST'] = '1'
+
     env.TESTS  = Options.options.TESTS
 
     env.SUBUNIT_FORMATTER = '${PYTHON} -u ../selftest/format-subunit --prefix=${SELFTEST_PREFIX} --immediate'
@@ -85,6 +90,14 @@ def cmd_testonly(opt):
 
     env.FORMAT_TEST_OUTPUT = '${SUBUNIT_FORMATTER}'
 
+    # clean any previous temporary files
+    os.system("rm -rf %s/tmp" % env.SELFTEST_PREFIX);
+
+    # put all command line options in the environment as TESTENV_*=*
+    for o in dir(Options.options):
+        if o[0:1] != '_':
+            os.environ['TESTENV_%s' % o.upper()] = str(getattr(Options.options, o, ''))
+
     env.OPTIONS = ''
     if not Options.options.SLOWTEST:
         env.OPTIONS += ' --exclude=./selftest/slow'
@@ -109,11 +122,21 @@ def cmd_testonly(opt):
         if Options.options.VALGRINDLOG is not None:
             os.environ['VALGRIND'] += ' --log-file=%s' % Options.options.VALGRINDLOG
 
-    if Options.options.VALGRIND_SERVER:
-        os.environ['SAMBA_VALGRIND'] = 'xterm -n server -l -e ../selftest/valgrind_run DUMMY=X'
+    server_wrapper=''
 
-    if Options.options.GDBTEST:
-        os.environ['SAMBA_VALGRIND'] = 'xterm -n server -e ../selftest/gdb_run DUMMY=X'
+    if Options.options.VALGRIND_SERVER:
+        server_wrapper = '../selftest/valgrind_run _DUMMY=X'
+    elif Options.options.GDBTEST:
+        server_wrapper = '../selftest/gdb_run _DUMMY=X'
+
+    if Options.options.SCREEN:
+        server_wrapper = '../selftest/in_screen %s' % server_wrapper
+        os.environ['TERMINAL'] = '../selftest/in_screen'
+    elif server_wrapper != '':
+        server_wrapper = 'xterm -n server -l -e %s' % server_wrapper
+
+    if server_wrapper != '':
+        os.environ['SAMBA_VALGRIND'] = server_wrapper
 
     # this is needed for systems without rpath, or with rpath disabled
     ADD_LD_LIBRARY_PATH('bin/shared')
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 60269d0..6536455 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -117,7 +117,7 @@ static void sig_term(int sig)
 	}
 #endif
 	DEBUG(0,("Exiting pid %d on SIGTERM\n", (int)getpid()));
-	exit(0);
+	exit(127);
 }
 
 /*


-- 
Samba Shared Repository


More information about the samba-cvs mailing list