[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Jul 7 12:17:07 UTC 2020


The branch, master has been updated
       via  31d187be0f4 s4:selftest: test for smbtorture subunit names with and without --fullname
       via  32f05b05ac9 s4:torture/local: Add new test to check smbtorture --fullname
       via  8902eb82d98 s4:torture: Add command line parameter --fullname
       via  4e39e43730c s4:torture: avoid multiple recursions into the test lists
       via  9025192333e s4:torture: use prefix_name() for all names in run_matching()
       via  0e0d89b55cd lib/torture: fix subunit names of nested suites
       via  a4a6c03bf84 lib/torture: add back links to the parent objects
       via  f6eb56bff29 lib/torture: make torture_subunit_test_name() public
       via  b7832c2c80b selftest/Samba4: split out _setup_ad_dc()
      from  2a7317e0b25 s3:wscript: vfs_gpfs needs kernel oplock support

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


- Log -----------------------------------------------------------------
commit 31d187be0f45737d3996a1e843de98f92953c305
Author: Sachin Prabhu <sprabhu at redhat.com>
Date:   Fri Jun 26 16:35:38 2020 +0000

    s4:selftest: test for smbtorture subunit names with and without --fullname
    
    We check the output with both --fullname and with the default shortname
    to ensure it works as expected.
    
    We also do tests for each level and test relative names are used.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User((no branch)): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date((no branch)): Tue Jul  7 12:16:34 UTC 2020 on sn-devel-184

commit 32f05b05ac9b39cd205daf0a9b93821f93636a5d
Author: Sachin Prabhu <sprabhu at redhat.com>
Date:   Thu Jun 25 18:02:28 2020 +0100

    s4:torture/local: Add new test to check smbtorture --fullname
    
    Add new always pass test to test smbtorture --fullname.
    
    Since we test the printing of the fullname of the test, the test is
    placed at the bottom of several levels of test suites.
    
    test : local.smbtorture.level1.level2.level3.always_pass
    
    Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 8902eb82d981e07812134285e199b47b22acd815
Author: Sachin Prabhu <sprabhu at redhat.com>
Date:   Fri Jul 3 14:17:43 2020 +0200

    s4:torture: Add command line parameter --fullname
    
    This argument is used to print out the the full name which includes the
    name of the test suite.
    
    For example, the name in the output for the test smb2.read.dir is "dir".
    By using the --fullname parameter, the name used will be
    "smb2.read.dir".
    
    The default continues to be to use the shortname.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Sachin Prabhu <sprabhu at redhat.com>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 4e39e43730ceaf79b5927f542ccd2f31c66ffb28
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 3 15:58:38 2020 +0200

    s4:torture: avoid multiple recursions into the test lists
    
    torture_run_suite_restricted() and torture_run_tcase_restricted()
    already handle recursion. If we call them from smbtorture
    we should avoid our own recursion.
    
    Without this passing 'smb2.multichannel.*' results in running
    tests more than once.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 9025192333e391a2b8cde7d3e75077f5830b2731
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 3 15:53:18 2020 +0200

    s4:torture: use prefix_name() for all names in run_matching()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 0e0d89b55cd3fa348af609fb33828a35d4affca1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 3 15:40:31 2020 +0200

    lib/torture: fix subunit names of nested suites
    
    E.g. passing 'smb2.multichannel.generic' to smbtorture results in
    
    - interface_info
    - num_channels
    
    While passing 'smb2.multichannel' to smbtorture results in:
    
    - generic.interface_info
    - genetic.num_channels
    - oplocks.test1
    ...
    - leases.test1
    ...
    
    Before we got this:
    
    - interface_info
    - num_channels
    - test1
    ...
    - test1
    
    That made it impossible to add knownfail entries for
    
    leases.test1 vs. oplocks.test1
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit a4a6c03bf8448923525a4997e4a7a3bd1f29c70f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 3 15:37:25 2020 +0200

    lib/torture: add back links to the parent objects
    
    This makes would allow the full name of a test to be constructed
    if needed in future.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit f6eb56bff29f73732048b31b4caa4138ada0e100
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 3 14:41:16 2020 +0200

    lib/torture: make torture_subunit_test_name() public
    
    This makes it easier to modify.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit b7832c2c80b7148e6dd5f2f194f8afdee8b7778c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 3 22:23:20 2020 +0200

    selftest/Samba4: split out _setup_ad_dc()
    
    setup_ad_dc() was used for more than 'ad_dc'.
    Setting up 'ad_dc' means not all missing arguments are
    passed as undef.
    
    The following had no effect
    
            if (!defined($conf_opts)) {
                    $conf_opts = "";
            }
    
    and $conf_opts results in a string of 'HASH(....)'
    
    So we better pass explicit undef arguments from setup_ad_dc() to
    _setup_ad_dc() now.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 lib/torture/subunit.c                            | 11 ---
 lib/torture/torture.c                            | 90 ++++++++++++++++++++++--
 lib/torture/torture.h                            | 17 +++++
 selftest/knownfail                               |  4 +-
 selftest/target/Samba4.pm                        | 10 ++-
 source4/selftest/tests.py                        |  7 ++
 source4/torture/local/local.c                    |  1 +
 source4/torture/local/smbtorture_fullname.c      | 31 ++++++++
 source4/torture/local/wscript_build              |  3 +-
 source4/torture/smbtorture.c                     | 47 ++++++++++---
 testprogs/blackbox/test_smbtorture_test_names.sh | 43 +++++++++++
 11 files changed, 233 insertions(+), 31 deletions(-)
 create mode 100644 source4/torture/local/smbtorture_fullname.c
 create mode 100755 testprogs/blackbox/test_smbtorture_test_names.sh


Changeset truncated at 500 lines:

diff --git a/lib/torture/subunit.c b/lib/torture/subunit.c
index deb96ffa3a9..693d9038bba 100644
--- a/lib/torture/subunit.c
+++ b/lib/torture/subunit.c
@@ -41,17 +41,6 @@ static void torture_subunit_suite_start(struct torture_context *ctx,
 {
 }
 
-static char *torture_subunit_test_name(struct torture_context *ctx,
-				   struct torture_tcase *tcase,
-				   struct torture_test *test)
-{
-	if (!strcmp(tcase->name, test->name)) {
-		return talloc_strdup(ctx, test->name);
-	} else {
-		return talloc_asprintf(ctx, "%s.%s", tcase->name, test->name);
-	}
-}
-
 static void torture_subunit_report_time(struct torture_context *tctx)
 {
 	struct timespec tp;
diff --git a/lib/torture/torture.c b/lib/torture/torture.c
index 40807d92a62..b8fb28f669f 100644
--- a/lib/torture/torture.c
+++ b/lib/torture/torture.c
@@ -54,6 +54,11 @@ struct torture_context *torture_context_init(struct tevent_context *event_ctx,
 	torture->ev = event_ctx;
 	torture->results = talloc_reference(torture, results);
 
+	/*
+	 * We start with an empty subunit prefix
+	 */
+	torture_subunit_prefix_reset(torture, NULL);
+
 	return torture;
 }
 
@@ -297,6 +302,7 @@ bool torture_suite_init_tcase(struct torture_suite *suite,
 	tcase->tests = NULL;
 
 	DLIST_ADD_END(suite->testcases, tcase);
+	tcase->suite = suite;
 
 	return true;
 }
@@ -313,6 +319,75 @@ struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite,
 	return tcase;
 }
 
+char *torture_subunit_test_name(struct torture_context *ctx,
+				struct torture_tcase *tcase,
+				struct torture_test *test)
+{
+	if (!strcmp(tcase->name, test->name)) {
+		return talloc_asprintf(ctx, "%s%s",
+				ctx->active_prefix->subunit_prefix,
+				test->name);
+	} else {
+		return talloc_asprintf(ctx, "%s%s.%s",
+				ctx->active_prefix->subunit_prefix,
+				tcase->name, test->name);
+	}
+}
+
+void torture_subunit_prefix_reset(struct torture_context *ctx,
+				  const char *name)
+{
+	struct torture_subunit_prefix *prefix = &ctx->_initial_prefix;
+
+	ZERO_STRUCTP(prefix);
+
+	if (name != NULL) {
+		int ret;
+
+		ret = snprintf(prefix->subunit_prefix,
+			       sizeof(prefix->subunit_prefix),
+			       "%s.", name);
+		if (ret < 0) {
+			abort();
+		}
+	}
+
+	ctx->active_prefix = prefix;
+}
+
+static void torture_subunit_prefix_push(struct torture_context *ctx,
+					struct torture_subunit_prefix *prefix,
+					const char *name)
+{
+	*prefix = (struct torture_subunit_prefix) {
+		.parent = ctx->active_prefix,
+	};
+
+	if (ctx->active_prefix->parent != NULL ||
+	    ctx->active_prefix->subunit_prefix[0] != '\0') {
+		/*
+		 * We need a new component for the prefix.
+		 */
+		int ret;
+
+		ret = snprintf(prefix->subunit_prefix,
+			       sizeof(prefix->subunit_prefix),
+			       "%s%s.",
+			       ctx->active_prefix->subunit_prefix,
+			       name);
+		if (ret < 0) {
+			abort();
+		}
+	}
+
+	ctx->active_prefix = prefix;
+}
+
+static void torture_subunit_prefix_pop(struct torture_context *ctx)
+{
+	ctx->active_prefix = ctx->active_prefix->parent;
+}
+
 int torture_suite_children_count(const struct torture_suite *suite)
 {
 	int ret = 0;
@@ -342,10 +417,13 @@ bool torture_run_suite(struct torture_context *context,
 bool torture_run_suite_restricted(struct torture_context *context, 
 		       struct torture_suite *suite, const char **restricted)
 {
+	struct torture_subunit_prefix _prefix_stack;
 	bool ret = true;
 	struct torture_tcase *tcase;
 	struct torture_suite *tsuite;
 
+	torture_subunit_prefix_push(context, &_prefix_stack, suite->name);
+
 	if (context->results->ui_ops->suite_start)
 		context->results->ui_ops->suite_start(context, suite);
 
@@ -366,6 +444,8 @@ bool torture_run_suite_restricted(struct torture_context *context,
 	if (context->results->ui_ops->suite_finish)
 		context->results->ui_ops->suite_finish(context, suite);
 
+	torture_subunit_prefix_pop(context);
+
 	return ret;
 }
 
@@ -407,13 +487,7 @@ static bool internal_torture_run_test(struct torture_context *context,
 					  const char **restricted)
 {
 	bool success;
-	char *subunit_testname = NULL;
-
-	if (tcase == NULL || strcmp(test->name, tcase->name) != 0) {
-		subunit_testname = talloc_asprintf(context, "%s.%s", tcase->name, test->name);
-	} else {
-		subunit_testname = talloc_strdup(context, test->name);
-	}
+	char *subunit_testname = torture_subunit_test_name(context, tcase, test);
 
 	if (!test_needs_running(subunit_testname, restricted))
 		return true;
@@ -618,6 +692,7 @@ struct torture_tcase *torture_suite_add_simple_tcase_const(
 	test->dangerous = false;
 
 	DLIST_ADD_END(tcase->tests, test);
+	test->tcase = tcase;
 
 	return tcase;
 }
@@ -666,6 +741,7 @@ bool torture_suite_add_suite(struct torture_suite *suite,
 		return false;
 
 	DLIST_ADD_END(suite->children, child);
+	child->parent = suite;
 
 	/* FIXME: Check for duplicates and return false if the 
 	 * added suite already exists as a child */
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index dbc711e25a1..c95103072d2 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -83,12 +83,19 @@ void torture_ui_report_time(struct torture_context *context);
  * specified below.
  */
 
+struct torture_subunit_prefix {
+	const struct torture_subunit_prefix *parent;
+	char subunit_prefix[256];
+};
+
 struct torture_context
 {
 	struct torture_results *results;
 
 	struct torture_test *active_test;
 	struct torture_tcase *active_tcase;
+	struct torture_subunit_prefix _initial_prefix;
+	const struct torture_subunit_prefix *active_prefix;
 
 	enum torture_result last_result;
 	char *last_reason;
@@ -143,6 +150,8 @@ struct torture_test {
 
 	/** Use data for this test */
 	const void *data;
+
+	struct torture_tcase *tcase;
 };
 
 /* 
@@ -157,6 +166,7 @@ struct torture_tcase {
 	void *data;
 	struct torture_test *tests;
 	struct torture_tcase *prev, *next;
+	const struct torture_suite *suite;
 };
 
 struct torture_suite
@@ -165,6 +175,7 @@ struct torture_suite
 	const char *description;
 	struct torture_tcase *testcases;
 	struct torture_suite *children;
+	const struct torture_suite *parent;
 
 	/* Pointers to siblings of this torture suite */
 	struct torture_suite *prev, *next;
@@ -218,6 +229,12 @@ struct torture_tcase *torture_suite_add_simple_test(
 bool torture_suite_add_suite(struct torture_suite *suite,
 		struct torture_suite *child);
 
+char *torture_subunit_test_name(struct torture_context *ctx,
+				struct torture_tcase *tcase,
+				struct torture_test *test);
+void torture_subunit_prefix_reset(struct torture_context *ctx,
+				  const char *name);
+
 /* Run the specified testsuite recursively */
 bool torture_run_suite(struct torture_context *context,
 					   struct torture_suite *suite);
diff --git a/selftest/knownfail b/selftest/knownfail
index 6fdeec1550d..9b25d22eae0 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -83,8 +83,8 @@
 ^samba4.raw.rename.*.osxrename
 ^samba4.raw.rename.*.directory rename
 ^samba4.rpc.winreg.*security
-^samba4.local.registry.(dir|ldb).check hive security
-^samba4.local.registry.local.security
+^samba4.local.registry.*.(dir|ldb).check hive security
+^samba4.local.registry.*.local.security
 ^samba4.rpc.wkssvc
 ^samba4.rpc.handles.*.lsarpc-shared
 ^samba4.rpc.epmapper
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 34dd0ee798d..1466cbd8d48 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -2568,7 +2568,7 @@ sub setup_rodc
 	return $env;
 }
 
-sub setup_ad_dc
+sub _setup_ad_dc
 {
 	my ($self, $path, $conf_opts, $server, $dom) = @_;
 
@@ -2607,6 +2607,12 @@ sub setup_ad_dc
 	return $env;
 }
 
+sub setup_ad_dc
+{
+	my ($self, $path) = @_;
+	return _setup_ad_dc($self, $path, undef, undef, undef);
+}
+
 sub setup_ad_dc_smb1
 {
 	my ($self, $path) = @_;
@@ -2615,7 +2621,7 @@ sub setup_ad_dc_smb1
 	client min protocol = CORE
 	server min protocol = LANMAN1
 ";
-	return setup_ad_dc($self, $path, $conf_opts, "addcsmb1", "addom2.samba.example.com");
+	return _setup_ad_dc($self, $path, $conf_opts, "addcsmb1", "addom2.samba.example.com");
 }
 
 sub setup_ad_dc_smb1_done
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 7f866d97249..4d3030e4700 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -479,6 +479,13 @@ planpythontestsuite("nt4_dc_smb1", "samba.tests.libsmb")
 # the API. These mainly test that the various command-line options of commands
 # work correctly.
 
+# smbtorture --fullname parameter test
+plantestsuite("samba4.blackbox.smbtorture_subunit_names", "none",
+              [
+                 os.path.join(bbdir, "test_smbtorture_test_names.sh"),
+                 smbtorture4
+              ])
+
 for env in ["ad_member", "s4member", "ad_dc_ntvfs", "chgdcpass"]:
     plantestsuite("samba4.blackbox.smbclient(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "utils/tests/test_smbclient.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', smbclient4])
 
diff --git a/source4/torture/local/local.c b/source4/torture/local/local.c
index 913daa39fbe..a3186788524 100644
--- a/source4/torture/local/local.c
+++ b/source4/torture/local/local.c
@@ -81,6 +81,7 @@
 	torture_local_util_str_escape,
 	torture_local_tfork,
 	torture_local_mdspkt,
+	torture_local_smbtorture,
 	NULL
 };
 
diff --git a/source4/torture/local/smbtorture_fullname.c b/source4/torture/local/smbtorture_fullname.c
new file mode 100644
index 00000000000..875b3cff0e6
--- /dev/null
+++ b/source4/torture/local/smbtorture_fullname.c
@@ -0,0 +1,31 @@
+#include "includes.h"
+#include "torture/smbtorture.h"
+#include "torture/local/proto.h"
+
+static bool test_smbtorture_always_pass(struct torture_context *tctx)
+{
+	return true;
+}
+
+struct torture_suite *torture_local_smbtorture(TALLOC_CTX *ctx)
+{
+	struct torture_suite *suite = torture_suite_create(ctx, "smbtorture");
+	struct torture_suite *suite_level1 = torture_suite_create(ctx,
+								   "level1");
+	struct torture_suite *suite_level2 = torture_suite_create(ctx,
+								   "level2");
+	struct torture_suite *suite_level3 = torture_suite_create(ctx,
+								  "level3");
+
+	torture_suite_add_suite(suite_level2, suite_level3);
+	torture_suite_add_suite(suite_level1, suite_level2);
+	torture_suite_add_suite(suite, suite_level1);
+
+	torture_suite_add_simple_test(suite_level3, "always_pass",
+				     test_smbtorture_always_pass);
+
+	suite->description = talloc_strdup(suite,
+				"smbtorture multilevel always pass test.");
+
+	return suite;
+}
diff --git a/source4/torture/local/wscript_build b/source4/torture/local/wscript_build
index 654b3f9c271..38b6c8f4b6e 100644
--- a/source4/torture/local/wscript_build
+++ b/source4/torture/local/wscript_build
@@ -28,7 +28,8 @@ TORTURE_LOCAL_SOURCE = '''../../../lib/util/charset/tests/iconv.c
 	verif_trailer.c
 	nss_tests.c
         mdspkt.c
-	fsrvp_state.c'''
+	fsrvp_state.c
+	smbtorture_fullname.c'''
 
 TORTURE_LOCAL_DEPS = 'RPC_NDR_ECHO TDR LIBCLI_SMB MESSAGING iconv POPT_CREDENTIALS TORTURE_AUTH TORTURE_UTIL TORTURE_NDR TORTURE_LIBCRYPTO share torture_registry %s ldb samdb replace-test RPC_FSS_STATE util_str_escape' % provision
 
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 1dbbe6c8301..88c38d254e9 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -38,6 +38,8 @@
 #include <readline/history.h>
 #endif
 
+static int use_fullname;
+
 static char *prefix_name(TALLOC_CTX *mem_ctx, const char *prefix, const char *name)
 {
 	if (prefix == NULL)
@@ -87,27 +89,54 @@ static bool run_matching(struct torture_context *torture,
 		if (gen_fnmatch(expr, name) == 0) {
 			*matched = true;
 			reload_charcnv(torture->lp_ctx);
-			if (restricted != NULL)
-				ret &= torture_run_suite_restricted(torture, o, restricted);
-			else
-				ret &= torture_run_suite(torture, o);
+			if (use_fullname == 1) {
+				torture_subunit_prefix_reset(torture, prefix);
+			}
+			ret &= torture_run_suite_restricted(torture, o, restricted);
+			if (use_fullname == 1) {
+				torture_subunit_prefix_reset(torture, NULL);
+			}
+			/*
+			 * torture_run_suite_restricted() already implements
+			 * recursion, so we're done with this child suite.
+			 */
+			continue;
 		}
 		ret &= run_matching(torture, name, expr, restricted, o, matched);
 	}
 
 	for (t = suite->testcases; t; t = t->next) {
-		char *name = talloc_asprintf(torture, "%s.%s", prefix, t->name);
-		if (gen_fnmatch(expr, name) == 0) {
+		char *tname = prefix_name(torture, prefix, t->name);
+		if (gen_fnmatch(expr, tname) == 0) {
 			*matched = true;
 			reload_charcnv(torture->lp_ctx);
+			if (use_fullname == 1) {
+				torture_subunit_prefix_reset(torture, prefix);
+			}
 			ret &= torture_run_tcase_restricted(torture, t, restricted);
+			if (use_fullname == 1) {
+				torture_subunit_prefix_reset(torture, NULL);
+			}
+			/*
+			 * torture_run_tcase_restricted() already implements
+			 * recursion, so we're done for this tcase.
+			 */
+			continue;
 		}
 		for (p = t->tests; p; p = p->next) {
-			name = talloc_asprintf(torture, "%s.%s.%s", prefix, t->name, p->name);
-			if (gen_fnmatch(expr, name) == 0) {
+			char *pname = prefix_name(torture, tname, p->name);
+			if (gen_fnmatch(expr, pname) == 0) {
 				*matched = true;
 				reload_charcnv(torture->lp_ctx);
+				if (use_fullname == 1) {
+					torture_subunit_prefix_reset(torture,
+								     tname);
+				}
 				ret &= torture_run_test_restricted(torture, t, p, restricted);
+				if (use_fullname == 1) {
+					torture_subunit_prefix_reset(torture,
+								     NULL);
+				}
 			}
 		}
 	}
@@ -393,6 +422,8 @@ int main(int argc, const char *argv[])
 
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
+		{"fullname",	0, POPT_ARG_NONE, &use_fullname, 0,
+		 "use full name for the test", NULL },
 		{"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit)", NULL },
 		{"smb-ports",	'p', POPT_ARG_STRING, NULL,     OPT_SMB_PORTS,	"SMB ports", 	NULL},
 		{"basedir",	  0, POPT_ARG_STRING, &basedir, 0, "base directory", "BASEDIR" },
diff --git a/testprogs/blackbox/test_smbtorture_test_names.sh b/testprogs/blackbox/test_smbtorture_test_names.sh
new file mode 100755
index 00000000000..a4513101b60
--- /dev/null
+++ b/testprogs/blackbox/test_smbtorture_test_names.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#Tests if the --fullname parameter passed to smbtorture is working as expected.
+
+if [ $# -ne 1 ]; then
+cat <<EOF
+Usage: test_smbtorture_test_names.sh SMBTORTURE
+EOF
+exit 1;
+fi
+
+SMBTORTURE="$1 //a/b"
+
+. `dirname $0`/subunit.sh
+
+failed=0
+
+testit_grep "with_shortname local.smbtorture.level1.level2.level3.always_pass" \
+            '^success: always_pass$' \
+            $SMBTORTURE local.smbtorture.level1.level2.level3.always_pass || failed=`expr $failed + 1`
+testit_grep "with_shortname local.smbtorture.level1.level2.level3" \
+            '^success: always_pass$' \
+            $SMBTORTURE local.smbtorture.level1.level2.level3 || failed=`expr $failed + 1`
+testit_grep "with_shortname local.smbtorture.level1.level2"\
+            '^success: level3.always_pass$' \
+            $SMBTORTURE local.smbtorture.level1.level2 || failed=`expr $failed + 1`
+testit_grep "with_shortname local.smbtorture.level1" \
+            '^success: level2.level3.always_pass$' \
+            $SMBTORTURE local.smbtorture.level1 || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1.level2.level3.always_pass" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \
+            $SMBTORTURE --fullname local.smbtorture.level1.level2.level3.always_pass || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1.level2.level3" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \
+            $SMBTORTURE --fullname local.smbtorture.level1.level2.level3 || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1.level2" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \
+            $SMBTORTURE --fullname local.smbtorture.level1.level2 || failed=`expr $failed + 1`
+testit_grep "with_fullname local.smbtorture.level1" \
+            '^success: local.smbtorture.level1.level2.level3.always_pass$' \


-- 
Samba Shared Repository



More information about the samba-cvs mailing list