svn commit: samba r24741 - in branches/SAMBA_4_0: . source source/selftest source/torture source/torture/raw source/torture/rpc

jelmer at samba.org jelmer at samba.org
Tue Aug 28 14:42:39 GMT 2007


Author: jelmer
Date: 2007-08-28 14:42:37 +0000 (Tue, 28 Aug 2007)
New Revision: 24741

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24741

Log:
More use of the torture API.

Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/samba4-knownfail
   branches/SAMBA_4_0/source/selftest/selftest.pl
   branches/SAMBA_4_0/source/torture/raw/write.c
   branches/SAMBA_4_0/source/torture/rpc/handles.c
   branches/SAMBA_4_0/source/torture/rpc/initshutdown.c
   branches/SAMBA_4_0/source/torture/rpc/rpc.c
   branches/SAMBA_4_0/source/torture/rpc/srvsvc.c
   branches/SAMBA_4_0/source/torture/rpc/winreg.c
   branches/SAMBA_4_0/source/torture/smbtorture.c
   branches/SAMBA_4_0/source/torture/ui.c
   branches/SAMBA_4_0/source/torture/util.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/samba4-knownfail
===================================================================
--- branches/SAMBA_4_0/source/samba4-knownfail	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/samba4-knownfail	2007-08-28 14:42:37 UTC (rev 24741)
@@ -8,3 +8,5 @@
 LOCAL-REGISTRY/security # Not implemented yet
 RPC-WKSSVC.*NetWkstaGetInfo
 RPC-WKSSVC.*NetWkstaTransportEnum
+RPC-HANDLES.*/lsarpc-shared
+RPC-HANDLES.*/mixed-shared

Modified: branches/SAMBA_4_0/source/selftest/selftest.pl
===================================================================
--- branches/SAMBA_4_0/source/selftest/selftest.pl	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/selftest/selftest.pl	2007-08-28 14:42:37 UTC (rev 24741)
@@ -504,6 +504,7 @@
 # ensure any one smbtorture call doesn't run too long
 push (@torture_options, "--maximum-runtime=$torture_maxtime");
 push (@torture_options, "--target=$opt_target");
+push (@torture_options, "--basedir=$prefix");
 push (@torture_options, "--option=torture:progress=no") if ($opt_format eq "buildfarm");
 push (@torture_options, "--format=subunit");
 push (@torture_options, "--option=torture:quick=yes") if ($opt_quick);

Modified: branches/SAMBA_4_0/source/torture/raw/write.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/write.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/raw/write.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -237,9 +237,9 @@
 	union smb_fileinfo finfo;
 	int max_bits=63;
 
-	if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+	if (!torture_setting_bool(tctx, "dangerous", false)) {
 		max_bits=33;
-		printf("dangerous not set - limiting range of test to 2^%d\n", max_bits);
+		torture_comment(tctx, "dangerous not set - limiting range of test to 2^%d\n", max_bits);
 	}
 
 	buf = talloc_zero_size(tctx, maxsize);

Modified: branches/SAMBA_4_0/source/torture/rpc/handles.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/handles.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/rpc/handles.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -116,11 +116,6 @@
 
 	torture_comment(torture, "RPC-HANDLE-LSARPC-SHARED\n");
 
-	if (torture_setting_bool(torture, "samba4", false)) {
-		torture_comment(torture, "LSA shared-policy-handle test against Samba4 - skipping\n");
-		return true;
-	}
-
 	torture_comment(torture, "connect lsa pipe1\n");
 	status = torture_rpc_connection(torture, &p1, &ndr_table_lsarpc);
 	torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1");
@@ -399,11 +394,6 @@
 
 	torture_comment(torture, "RPC-HANDLE-MIXED-SHARED\n");
 
-	if (torture_setting_bool(torture, "samba4", false)) {
-		torture_comment(torture, "Mixed shared-policy-handle test against Samba4 - skipping\n");
-		return true;
-	}
-
 	torture_comment(torture, "connect samr pipe1\n");
 	status = torture_rpc_connection(torture, &p1, &ndr_table_samr);
 	torture_assert_ntstatus_ok(torture, status, "opening samr pipe1");

Modified: branches/SAMBA_4_0/source/torture/rpc/initshutdown.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/initshutdown.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/rpc/initshutdown.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -129,7 +129,8 @@
 	}
 
 	if (!torture_setting_bool(torture, "dangerous", False)) {
-		printf("initshutdown tests disabled - enable dangerous tests to use\n");
+		torture_comment(torture, 
+						"initshutdown tests disabled - enable dangerous tests to use\n");
 	} else {
 		ret &= test_Init(p, mem_ctx, "spottyfood", 30);
 		ret &= test_Abort(p, mem_ctx);

Modified: branches/SAMBA_4_0/source/torture/rpc/rpc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/rpc.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/rpc/rpc.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -27,6 +27,12 @@
 #include "librpc/ndr/ndr_table.h"
 #include "lib/util/dlinklist.h"
 
+struct torture_rpc_tcase {
+	struct torture_tcase tcase;
+	const struct ndr_interface_table *table;
+	struct dcerpc_pipe *pipe;
+};
+
 /* open a rpc connection to the chosen binding string */
 _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
 				struct dcerpc_pipe **p, 
@@ -97,13 +103,15 @@
 	struct cli_credentials *anon_credentials;
 	NTSTATUS status;
 	const char *binding = torture_setting_string(tctx, "binding", NULL);
+	struct torture_rpc_tcase *tcase = talloc_get_type(
+						tctx->active_tcase, struct torture_rpc_tcase);
 
 	anon_credentials = cli_credentials_init_anon(tctx);
 
 	status = dcerpc_pipe_connect(tctx, 
 				(struct dcerpc_pipe **)data, 
 				binding,
-				(const struct ndr_interface_table *)tctx->active_tcase->data,
+				tcase->table,
 				anon_credentials, NULL);
 
 	torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
@@ -114,10 +122,12 @@
 static bool torture_rpc_setup (struct torture_context *tctx, void **data)
 {
 	NTSTATUS status;
+	struct torture_rpc_tcase *tcase = talloc_get_type(
+						tctx->active_tcase, struct torture_rpc_tcase);
 	
 	status = torture_rpc_connection(tctx, 
 				(struct dcerpc_pipe **)data, 
-				(const struct ndr_interface_table *)tctx->active_tcase->data);
+				(const struct ndr_interface_table *)tcase->table);
 
 	torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
 
@@ -130,30 +140,34 @@
 	return true;
 }
 
-_PUBLIC_ struct torture_tcase *torture_suite_add_anon_rpc_iface_tcase(struct torture_suite *suite, 
+_PUBLIC_ struct torture_rpc_tcase *torture_suite_add_anon_rpc_iface_tcase(struct torture_suite *suite, 
 								const char *name,
 								const struct ndr_interface_table *table)
 {
-	struct torture_tcase *tcase = torture_suite_add_tcase(suite, name);
+	struct torture_rpc_tcase *tcase = talloc(suite, struct torture_rpc_tcase);
 
-	tcase->setup = torture_rpc_setup_anonymous;
-	tcase->teardown = torture_rpc_teardown;
-	tcase->data = discard_const(table);
+	torture_suite_init_tcase(suite, (struct torture_tcase *)tcase, name);
 
+	tcase->tcase.setup = torture_rpc_setup_anonymous;
+	tcase->tcase.teardown = torture_rpc_teardown;
+	tcase->table = table;
+
 	return tcase;
 }
 
 
-_PUBLIC_ struct torture_tcase *torture_suite_add_rpc_iface_tcase(struct torture_suite *suite, 
+_PUBLIC_ struct torture_rpc_tcase *torture_suite_add_rpc_iface_tcase(struct torture_suite *suite, 
 								const char *name,
 								const struct ndr_interface_table *table)
 {
-	struct torture_tcase *tcase = torture_suite_add_tcase(suite, name);
+	struct torture_rpc_tcase *tcase = talloc(suite, struct torture_rpc_tcase);
 
-	tcase->setup = torture_rpc_setup;
-	tcase->teardown = torture_rpc_teardown;
-	tcase->data = discard_const(table);
+	torture_suite_init_tcase(suite, (struct torture_tcase *)tcase, name);
 
+	tcase->tcase.setup = torture_rpc_setup;
+	tcase->tcase.teardown = torture_rpc_teardown;
+	tcase->table = table;
+
 	return tcase;
 }
 
@@ -180,7 +194,7 @@
 }
 
 _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test(
-					struct torture_tcase *tcase, 
+					struct torture_rpc_tcase *tcase, 
 					const char *name, 
 					bool (*fn) (struct torture_context *, struct dcerpc_pipe *))
 {
@@ -195,13 +209,13 @@
 	test->data = NULL;
 	test->fn = fn;
 
-	DLIST_ADD(tcase->tests, test);
+	DLIST_ADD(tcase->tcase.tests, test);
 
 	return test;
 }
 
 _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_ex(
-					struct torture_tcase *tcase, 
+					struct torture_rpc_tcase *tcase, 
 					const char *name, 
 					bool (*fn) (struct torture_context *, struct dcerpc_pipe *,
 								void *),
@@ -218,7 +232,7 @@
 	test->data = userdata;
 	test->fn = fn;
 
-	DLIST_ADD(tcase->tests, test);
+	DLIST_ADD(tcase->tcase.tests, test);
 
 	return test;
 }

Modified: branches/SAMBA_4_0/source/torture/rpc/srvsvc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/srvsvc.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/rpc/srvsvc.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -538,10 +538,9 @@
 	int i;
 	BOOL ret = True;
 
-	if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
-		d_printf("NetShareAddSetDel disabled - enable dangerous tests to use\n");
-		return True;
-	}
+	if (!torture_setting_bool(tctx, "dangerous", false))
+		torture_skip(tctx,
+			"NetShareAddSetDel disabled - enable dangerous tests to use\n");
 
 	a.in.server_unc = r.in.server_unc = q.in.server_unc = d.in.server_unc =
 		talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));

Modified: branches/SAMBA_4_0/source/torture/rpc/winreg.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/winreg.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/rpc/winreg.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -533,7 +533,6 @@
 		torture_skip(tctx, 
 		   "winreg_InitiateShutdown disabled - enable dangerous tests to use");
 
-
 	r.in.hostname = &hostname;
 	r.in.message = talloc(tctx, struct initshutdown_String);
 	init_initshutdown_String(tctx, r.in.message, "spottyfood");

Modified: branches/SAMBA_4_0/source/torture/smbtorture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smbtorture.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/smbtorture.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -479,15 +479,16 @@
 	NTSTATUS status;
 	int shell = False;
 	static const char *ui_ops_name = "simple";
+	const char *basedir = NULL;
 	static int list_tests = 0;
 	enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS, OPT_LIST,
-	      OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC,OPT_NUMPROGS, OPT_BASEDIR};
+	      OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC,OPT_NUMPROGS};
 	
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
 		{"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, NULL, OPT_BASEDIR, "base directory", "BSAEDIR" },
+		{"basedir",	  0, POPT_ARG_STRING, &basedir, 0, "base directory", "BASEDIR" },
 		{"seed",	  0, POPT_ARG_INT,  &torture_seed, 	0,	"seed", 	NULL},
 		{"num-progs",	  0, POPT_ARG_INT,  NULL, 	OPT_NUMPROGS,	"num progs",	NULL},
 		{"num-ops",	  0, POPT_ARG_INT,  &torture_numops, 	0, 	"num ops",	NULL},
@@ -539,9 +540,6 @@
 		case OPT_NUMPROGS:
 			lp_set_cmdline("torture:nprocs", poptGetOptArg(pc));
 			break;
-		case OPT_BASEDIR:
-			lp_set_cmdline("torture:basedir", poptGetOptArg(pc));
-			break;
 		case OPT_DNS:
 			parse_dns(poptGetOptArg(pc));
 			break;
@@ -635,6 +633,7 @@
 	}
 
 	torture = torture_context_init(talloc_autofree_context(), ui_ops);
+	torture->outputdir = basedir;
 
 	if (argc_new == 0) {
 		printf("You must specify a test to run, or 'ALL'\n");

Modified: branches/SAMBA_4_0/source/torture/ui.c
===================================================================
--- branches/SAMBA_4_0/source/torture/ui.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/ui.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -120,11 +120,11 @@
 	return test;
 }
 
-struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite, 
-							 const char *name)
+
+bool torture_suite_init_tcase(struct torture_suite *suite,
+									 struct torture_tcase *tcase,
+									 const char *name)
 {
-	struct torture_tcase *tcase = talloc(suite, struct torture_tcase);
-
 	tcase->name = talloc_strdup(tcase, name);
 	tcase->description = NULL;
 	tcase->setup = NULL;
@@ -134,6 +134,18 @@
 
 	DLIST_ADD_END(suite->testcases, tcase, struct torture_tcase *);
 
+	return true;
+}
+
+
+struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite, 
+							 const char *name)
+{
+	struct torture_tcase *tcase = talloc(suite, struct torture_tcase);
+
+	if (!torture_suite_init_tcase(suite, tcase, name))
+		return NULL;
+
 	return tcase;
 }
 
@@ -372,7 +384,7 @@
 	test->run = wrap_test_with_simple_tcase;
 	test->fn = run;
 	test->data = data;
-	test->dangerous = False;
+	test->dangerous = false;
 
 	DLIST_ADD_END(tcase->tests, test, struct torture_test *);
 
@@ -465,7 +477,7 @@
 	test->run = wrap_test_with_simple_test;
 	test->fn = run;
 	test->data = NULL;
-	test->dangerous = False;
+	test->dangerous = false;
 
 	DLIST_ADD_END(tcase->tests, test, struct torture_test *);
 

Modified: branches/SAMBA_4_0/source/torture/util.c
===================================================================
--- branches/SAMBA_4_0/source/torture/util.c	2007-08-28 14:31:31 UTC (rev 24740)
+++ branches/SAMBA_4_0/source/torture/util.c	2007-08-28 14:42:37 UTC (rev 24741)
@@ -31,10 +31,8 @@
 								   const char *prefix, 
 								   char **tempdir)
 {
-	const char *basedir = torture_setting_string(tctx, "basedir", ".");
+	*tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir, prefix);
 
-	*tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", basedir, prefix);
-
 	if (mkdtemp(*tempdir) == NULL)
 		return NT_STATUS_UNSUCCESSFUL;
 



More information about the samba-cvs mailing list