The branch, master has been updated via 02e063b Be consistent about what functions add $LISTOPT and $LOADLIST to the command-line. via 0f40859 selftest: Add separate command line for listing tests, allowing us of subunit-filter (which doesn't support subunit v2). via c3855da selftest/tests.py: Remove testsuite samba.tests.samdb which does not have any tests. via afe94aa Re-use add_prefix function. via f6e3cd7 selftest: Drop support for TESTSUITE-IDLIST, and remove its last user. from 13a1406 ldb: version 1.1.18
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 02e063bd5be06925489f735c51225b65ff961d6b Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Nov 1 16:36:54 2014 -0700 Be consistent about what functions add $LISTOPT and $LOADLIST to the command-line. Change-Id: Ife86624b53a99d48ce9f00d146b14f798c9bdb24 Signed-off-by: Jelmer Vernooij <jel...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Jelmer Vernooij <jel...@samba.org> Autobuild-Date(master): Sun Nov 30 16:43:52 CET 2014 on sn-devel-104 commit 0f408599f83f5d8e68f0fb0f765143aa6620651e Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Nov 1 15:13:18 2014 -0700 selftest: Add separate command line for listing tests, allowing us of subunit-filter (which doesn't support subunit v2). Change-Id: Icb877214a422c63fd38ef92425c7b4fe7ee19ad5 Signed-Off-By: Jelmer Vernooij <jel...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit c3855dae71e557b824ad2679acd8bb5ad85936e2 Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Nov 1 16:06:09 2014 -0700 selftest/tests.py: Remove testsuite samba.tests.samdb which does not have any tests. Change-Id: I8edcf73aa4a9b61c6e5c7cfb592a4692d4030a29 Signed-Off-By: Jelmer Vernooij <jel...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit afe94aa53549ec66cb48959260753a4fa424e481 Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Nov 1 14:40:30 2014 -0700 Re-use add_prefix function. Change-Id: I6e91bc9fc6714c147427e920ca0e3e22cb9a076b Signed-Off-By: Jelmer Vernooij <jel...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit f6e3cd7f03a15595a2fa65c22a56c60d7d3f8bff Author: Jelmer Vernooij <jel...@samba.org> Date: Sun Oct 26 20:17:20 2014 -0700 selftest: Drop support for TESTSUITE-IDLIST, and remove its last user. Change-Id: Ic616676bb770fa4769195d73c4309915646caae0 Signed-Off-By: Jelmer Vernooij <jel...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: selftest/selftest.pl | 29 +++++++++++++------------- selftest/selftesthelpers.py | 44 +++++++++++++++++----------------------- selftest/testlist.py | 7 +++++-- selftest/tests.py | 1 - selftest/tests/test_testlist.py | 6 +++--- source4/scripting/bin/subunitrun | 2 ++ source4/selftest/tests.py | 6 +++--- 7 files changed, 47 insertions(+), 48 deletions(-) Changeset truncated at 500 lines: diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 7dde5b2..ea63ee5 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -568,17 +568,21 @@ sub read_testlist($) open(IN, $filename) or die("Unable to open $filename: $!"); while (<IN>) { - if (/-- TEST(-LOADLIST|-IDLIST|) --\n/) { + if (/-- TEST(-LOADLIST|) --\n/) { my $supports_loadlist = (defined($1) and $1 eq "-LOADLIST"); - my $supports_idlist = (defined($1) and $1 eq "-IDLIST"); my $name = <IN>; $name =~ s/\n//g; my $env = <IN>; $env =~ s/\n//g; + my $loadlist; + if ($supports_loadlist) { + $loadlist = <IN>; + $loadlist =~ s/\n//g; + } my $cmdline = <IN>; $cmdline =~ s/\n//g; if (should_run_test($name) == 1) { - push (@ret, [$name, $env, $cmdline, $supports_loadlist, $supports_idlist]); + push (@ret, [$name, $env, $cmdline, $loadlist]); } } else { print; @@ -823,7 +827,6 @@ sub setup_env($$) } } - return undef unless defined($testenv_vars); $running_envs{$envname} = $testenv_vars; @@ -939,11 +942,12 @@ $envvarstr teardown_env($testenv_name); } elsif ($opt_list) { foreach (@todo) { - my $cmd = $$_[2]; my $name = $$_[0]; my $envname = $$_[1]; + my $cmd = $$_[2]; + my $listcmd = $$_[3]; - unless($cmd =~ /\$LISTOPT/) { + unless (defined($listcmd)) { warn("Unable to list tests in $name"); # Rather than ignoring this testsuite altogether, just pretend the entire testsuite is # a single "test". @@ -951,14 +955,12 @@ $envvarstr next; } - $cmd =~ s/\$LISTOPT/--list/g; - - system($cmd); + system($listcmd); if ($? == -1) { - die("Unable to run $cmd: $!"); + die("Unable to run $listcmd: $!"); } elsif ($? & 127) { - die(sprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127), ($? & 128) ? 'with' : 'without')); + die(sprintf("%s died with signal %d, %s coredump\n", $listcmd, ($? & 127), ($? & 128) ? 'with' : 'without')); } my $exitcode = $? >> 8; @@ -995,9 +997,8 @@ $envvarstr print $fh substr($test, length($name)+1) . "\n"; } $cmd =~ s/\$LOADLIST/--load-list=$listid_file/g; - } elsif ($$_[4]) { - $cmd =~ s/\s+[^\s]+\s*$//; - $cmd .= " " . join(' ', @{$individual_tests->{$name}}); + } else { + warn("Unable to run individual tests in $name, it does not support --loadlist."); } } diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py index 502ba10..6e387ec 100644 --- a/selftest/selftesthelpers.py +++ b/selftest/selftesthelpers.py @@ -82,6 +82,12 @@ if sub.returncode == 0: if sub.returncode == 0: tap2subunit = "tap2subunit" +def to_subunit1(subunit_version): + if subunit_version == 1: + return "" + return " | " + subunit2to1 + + def valgrindify(cmdline): """Run a command under valgrind, if $VALGRIND was set.""" valgrind = os.getenv("VALGRIND") @@ -90,7 +96,7 @@ def valgrindify(cmdline): return valgrind + " " + cmdline -def plantestsuite(name, env, cmdline): +def plantestsuite(name, env, cmdline, subunit_version=1): """Plan a test suite. :param name: Testsuite name @@ -102,13 +108,9 @@ def plantestsuite(name, env, cmdline): print env if isinstance(cmdline, list): cmdline = " ".join(cmdline) - filter_subunit_args = ["--fail-on-empty"] if "$LISTOPT" in cmdline: - filter_subunit_args.append("$LISTOPT") - print "%s 2>&1 | %s/selftest/filter-subunit %s --prefix=\"%s.\" --suffix=\"(%s)\"" % (cmdline, - srcdir(), - " ".join(filter_subunit_args), - name, env) + raise AssertionError("test %s supports --list, but not --load-list" % name) + print cmdline + " 2>&1 " + to_subunit1(subunit_version) + " | " + add_prefix(name, env) def add_prefix(prefix, env, support_list=False): @@ -119,7 +121,7 @@ def add_prefix(prefix, env, support_list=False): return "%s/selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\" --suffix=\"(%s)\"" % (srcdir(), listopt, prefix, env) -def plantestsuite_loadlist(name, env, cmdline): +def plantestsuite_loadlist(name, env, cmdline, subunit_version=1): print "-- TEST-LOADLIST --" if env == "none": fullname = name @@ -130,20 +132,12 @@ def plantestsuite_loadlist(name, env, cmdline): if isinstance(cmdline, list): cmdline = " ".join(cmdline) support_list = ("$LISTOPT" in cmdline) - print "%s $LOADLIST 2>&1 | %s" % (cmdline, add_prefix(name, env, support_list)) - - -def plantestsuite_idlist(name, env, cmdline): - print "-- TEST-IDLIST --" - if env == "none": - fullname = name - else: - fullname = "%s(%s)" % (name, env) - print fullname - print env - if isinstance(cmdline, list): - cmdline = " ".join(cmdline) - print cmdline + if not "$LISTOPT" in cmdline: + raise AssertionError("loadlist test %s does not support not --list" % name) + if not "$LOADLIST" in cmdline: + raise AssertionError("loadlist test %s does not support --load-list" % name) + print ("%s | %s" % (cmdline.replace("$LOADLIST", ""), add_prefix(name, env, support_list))).replace("$LISTOPT", "--list") + print cmdline.replace("$LISTOPT", "") + " 2>&1 " + to_subunit1(subunit_version) + " | " + add_prefix(name, env, False) def skiptestsuite(name, reason): @@ -178,10 +172,10 @@ def planpythontestsuite(env, module, name=None, extra_path=[]): "%s/lib/testtools" % srcdir(), "%s/lib/extras" % srcdir(), "%s/lib/mimeparse" % srcdir()]) - args = [python, "-m", "subunit.run", "$LISTOPT", module] + args = [python, "-m", "subunit.run", "$LISTOPT", "$LOADLIST", module] if pypath: args.insert(0, "PYTHONPATH=%s" % ":".join(["$PYTHONPATH"] + pypath)) - plantestsuite_idlist(name, env, args) + plantestsuite_loadlist(name, env, args) def get_env_torture_options(): @@ -215,7 +209,7 @@ def plansmbtorture4testsuite(name, env, options, target, modname=None): if isinstance(options, list): options = " ".join(options) options = " ".join(smbtorture4_options + ["--target=%s" % target]) + " " + options - cmdline = "%s $LISTOPT %s %s" % (valgrindify(smbtorture4), options, name) + cmdline = "%s $LISTOPT $LOADLIST %s %s" % (valgrindify(smbtorture4), options, name) plantestsuite_loadlist(modname, env, cmdline) diff --git a/selftest/testlist.py b/selftest/testlist.py index 5102f42..34c7a5d 100644 --- a/selftest/testlist.py +++ b/selftest/testlist.py @@ -79,11 +79,14 @@ def read_testlist(inf, outf): return if l.startswith("-- TEST") and l.endswith(" --\n"): supports_loadlist = l.startswith("-- TEST-LOADLIST") - supports_idlist = l.startswith("-- TEST-IDLIST") name = inf.readline().rstrip("\n") env = inf.readline().rstrip("\n") + if supports_loadlist: + loadlist = inf.readline().rstrip("\n") + else: + loadlist = None cmdline = inf.readline().rstrip("\n") - yield (name, env, cmdline, supports_loadlist, supports_idlist) + yield (name, env, cmdline, loadlist) else: outf.write(l) diff --git a/selftest/tests.py b/selftest/tests.py index 4cd44e3..dcf48a2 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -59,7 +59,6 @@ planpythontestsuite("none", "samba.tests.samba3") planpythontestsuite("none", "samba.tests.strings") planpythontestsuite("none", "samba.tests.netcmd") planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc") -planpythontestsuite("none", "samba.tests.samdb") planpythontestsuite("none", "samba.tests.hostconfig") planpythontestsuite("dc:local", "samba.tests.messaging") planpythontestsuite("none", "samba.tests.samba3sam") diff --git a/selftest/tests/test_testlist.py b/selftest/tests/test_testlist.py index 4474d0a..7007d6d 100644 --- a/selftest/tests/test_testlist.py +++ b/selftest/tests/test_testlist.py @@ -67,14 +67,14 @@ class ReadTestlistTests(TestCase): def test_read_list(self): inf = StringIO("-- TEST --\nfoo\nbar\nbla\n") outf = StringIO() - self.assertEquals([('foo', 'bar', 'bla', False, False)], + self.assertEquals([('foo', 'bar', 'bla', None)], list(read_testlist(inf, outf))) self.assertEquals("", outf.getvalue()) def test_read_list_passes_through(self): inf = StringIO("MORENOISE\n-- TEST --\nfoo\nbar\nbla\nNOISE\n") outf = StringIO() - self.assertEquals([('foo', 'bar', 'bla', False, False)], + self.assertEquals([('foo', 'bar', 'bla', None)], list(read_testlist(inf, outf))) self.assertEquals("MORENOISE\nNOISE\n", outf.getvalue()) @@ -143,6 +143,6 @@ class ReadTestListFileTests(TestCase): f.close() outf = StringIO() self.assertEquals( - [('data', 'env', 'cmd', False, False)], + [('data', 'env', 'cmd', None)], list(read_testlist_file(p, outf))) self.assertEquals("noise\n", outf.getvalue()) diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun index 99d5319..8d43f25 100755 --- a/source4/scripting/bin/subunitrun +++ b/source4/scripting/bin/subunitrun @@ -81,5 +81,7 @@ opts, args = parser.parse_args() if not getattr(opts, "listtests", False): lp = sambaopts.get_loadparm() samba.tests.cmdline_credentials = credopts.get_credentials(lp) +if getattr(opts, 'load_list', None): + args.insert(0, "--load-list=%s" % opts.load_list) TestProgram(module=None, args=args, opts=subunitopts) diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index ef0d853..7362b64 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -313,7 +313,7 @@ plantestsuite("samba4.blackbox.gentest(dc)", "dc", [os.path.join(samba4srcdir, " plantestsuite("samba4.blackbox.rfc2307_mapping(dc:local)", "dc:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_rfc2307_mapping.sh"), '$DOMAIN', '$USERNAME', '$PASSWORD', "$SERVER", "$UID_RFC2307TEST", "$GID_RFC2307TEST", configuration]) plantestsuite("samba4.blackbox.chgdcpass", "chgdcpass", [os.path.join(bbdir, "test_chgdcpass.sh"), '$SERVER', "CHGDCPASS\$", '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", '$SELFTEST_PREFIX/chgdcpass', smbclient4]) plantestsuite("samba4.blackbox.samba_upgradedns(chgdcpass:local)", "chgdcpass:local", [os.path.join(bbdir, "test_samba_upgradedns.sh"), '$SERVER', '$REALM', '$PREFIX', '$SELFTEST_PREFIX/chgdcpass']) -plantestsuite_loadlist("samba4.rpc.echo against NetBIOS alias", "dc", [valgrindify(smbtorture4), "$LISTOPT", 'ncacn_np:$NETBIOSALIAS', '-U$DOMAIN/$USERNAME%$PASSWORD', 'rpc.echo']) +plantestsuite_loadlist("samba4.rpc.echo against NetBIOS alias", "dc", [valgrindify(smbtorture4), "$LISTOPT", "$LOADLIST", 'ncacn_np:$NETBIOSALIAS', '-U$DOMAIN/$USERNAME%$PASSWORD', 'rpc.echo']) # Tests using the "Simple" NTVFS backend for t in ["base.rw1"]: @@ -432,11 +432,11 @@ def planoldpythontestsuite(env, module, name=None, extra_path=[], environ={}, ex if py_path: environ["PYTHONPATH"] = ":".join(["$PYTHONPATH"] + py_path) args = ["%s=%s" % item for item in environ.iteritems()] - args += [subunitrun, "$LISTOPT", module] + args += [subunitrun, "$LISTOPT", "$LOADLIST", module] args += extra_args if name is None: name = module - plantestsuite(name, env, args) + plantestsuite_loadlist(name, env, args) planoldpythontestsuite("dc:local", "samba.tests.gensec", extra_args=['-U"$USERNAME%$PASSWORD"']) planoldpythontestsuite("none", "simple", extra_path=["%s/lib/tdb/python/tests" % srcdir()], name="tdb.python") -- Samba Shared Repository