svn commit: samba r24846 - in branches/SAMBA_4_0: . source/torture source/torture/nbt source/torture/rpc

jelmer at samba.org jelmer at samba.org
Fri Aug 31 15:43:13 GMT 2007


Author: jelmer
Date: 2007-08-31 15:43:03 +0000 (Fri, 31 Aug 2007)
New Revision: 24846

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

Log:
Use metadata about dangerous tests.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/torture/nbt/winsreplication.c
   branches/SAMBA_4_0/source/torture/rpc/eventlog.c
   branches/SAMBA_4_0/source/torture/rpc/initshutdown.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/ui.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/torture/nbt/winsreplication.c
===================================================================
--- branches/SAMBA_4_0/source/torture/nbt/winsreplication.c	2007-08-31 15:34:26 UTC (rev 24845)
+++ branches/SAMBA_4_0/source/torture/nbt/winsreplication.c	2007-08-31 15:43:03 UTC (rev 24846)
@@ -97,10 +97,6 @@
 	struct nbt_name name;
 	const char *address;
 
-	if (!torture_setting_bool(tctx, "dangerous", false)) {
-		torture_skip(tctx, "winsrepl: cross connection assoc_ctx usage disabled - enable dangerous tests to use");
-	}
-
 	if (!torture_nbt_get_name(tctx, &name, &address))
 		return false;
 
@@ -9675,9 +9671,12 @@
 	struct torture_suite *suite = torture_suite_create(
 		talloc_autofree_context(),
 		"WINSREPLICATION");
-	torture_suite_add_simple_test(suite, "assoc_ctx1", 
-				      test_assoc_ctx1);
+	struct torture_tcase *tcase;
 
+	tcase = torture_suite_add_simple_test(suite, "assoc_ctx1", 
+					     test_assoc_ctx1);
+	tcase->tests->dangerous = true;
+
 	torture_suite_add_simple_test(suite, "assoc_ctx2", 
 				      test_assoc_ctx2);
 	

Modified: branches/SAMBA_4_0/source/torture/rpc/eventlog.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/eventlog.c	2007-08-31 15:34:26 UTC (rev 24845)
+++ branches/SAMBA_4_0/source/torture/rpc/eventlog.c	2007-08-31 15:43:03 UTC (rev 24846)
@@ -192,10 +192,6 @@
 	struct eventlog_CloseEventLog cr;
 	struct policy_handle handle;
 
-	if (!torture_setting_bool(tctx, "dangerous", false)) {
-		torture_skip(tctx, "ClearEventLog test disabled - enable dangerous tests to use");
-	}
-
 	if (!get_policy_handle(tctx, p, &handle))
 		return false;
 
@@ -237,13 +233,16 @@
 {
 	struct torture_suite *suite;
 	struct torture_rpc_tcase *tcase;
+	struct torture_test *test;
 
 	suite = torture_suite_create(talloc_autofree_context(), "EVENTLOG");
 	tcase = torture_suite_add_rpc_iface_tcase(suite, "eventlog", 
 						  &ndr_table_eventlog);
 
 	torture_rpc_tcase_add_test(tcase, "OpenEventLog", test_OpenEventLog);
-	torture_rpc_tcase_add_test(tcase, "ClearEventLog", test_ClearEventLog);
+	test = torture_rpc_tcase_add_test(tcase, "ClearEventLog", 
+					  test_ClearEventLog);
+	test->dangerous = true;
 	torture_rpc_tcase_add_test(tcase, "GetNumRecords", test_GetNumRecords);
 	torture_rpc_tcase_add_test(tcase, "ReadEventLog", test_ReadEventLog);
 	torture_rpc_tcase_add_test(tcase, "FlushEventLog", test_FlushEventLog);

Modified: branches/SAMBA_4_0/source/torture/rpc/initshutdown.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/initshutdown.c	2007-08-31 15:34:26 UTC (rev 24845)
+++ branches/SAMBA_4_0/source/torture/rpc/initshutdown.c	2007-08-31 15:43:03 UTC (rev 24846)
@@ -51,16 +51,12 @@
 }
 
 static bool test_Init(struct torture_context *tctx, 
-					  struct dcerpc_pipe *p)
+		      struct dcerpc_pipe *p)
 {
 	struct initshutdown_Init r;
 	NTSTATUS status;
 	uint16_t hostname = 0x0;
 
-	if (!torture_setting_bool(tctx, "dangerous", false))
-		torture_skip(tctx, 
-			"initshutdown tests 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");
@@ -83,10 +79,6 @@
 	NTSTATUS status;
 	uint16_t hostname = 0x0;
 
-	if (!torture_setting_bool(tctx, "dangerous", false))
-		torture_skip(tctx, 
-			"initshutdown tests 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");
@@ -109,12 +101,15 @@
 {
 	struct torture_suite *suite = torture_suite_create(mem_ctx, "INITSHUTDOWN");
 	struct torture_rpc_tcase *tcase;
+	struct torture_test *test;
 
 	tcase = torture_suite_add_rpc_iface_tcase(suite, "initshutdown", 
-											  &ndr_table_initshutdown);
+						  &ndr_table_initshutdown);
 
-	torture_rpc_tcase_add_test(tcase, "Init", test_Init);
-	torture_rpc_tcase_add_test(tcase, "InitEx", test_InitEx);
+	test = torture_rpc_tcase_add_test(tcase, "Init", test_Init);
+	test->dangerous = true;
+	test = torture_rpc_tcase_add_test(tcase, "InitEx", test_InitEx);
+	test->dangerous = true;
 
 	return suite;
 }

Modified: branches/SAMBA_4_0/source/torture/rpc/srvsvc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/srvsvc.c	2007-08-31 15:34:26 UTC (rev 24845)
+++ branches/SAMBA_4_0/source/torture/rpc/srvsvc.c	2007-08-31 15:43:03 UTC (rev 24846)
@@ -538,10 +538,6 @@
 	int i;
 	BOOL ret = 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));
 	r.in.share_name = talloc_strdup(tctx, "testshare");
@@ -1132,6 +1128,7 @@
 {
 	struct torture_suite *suite = torture_suite_create(mem_ctx, "SRVSVC");
 	struct torture_rpc_tcase *tcase;
+	struct torture_test *test;
 
 	tcase = torture_suite_add_rpc_iface_tcase(suite, "srvsvc (admin access)", &ndr_table_srvsvc);
 
@@ -1147,8 +1144,9 @@
 	torture_rpc_tcase_add_test(tcase, "NetRemoteTOD", test_NetRemoteTOD);
 	torture_rpc_tcase_add_test(tcase, "NetShareEnum", test_NetShareEnumFull);
 	torture_rpc_tcase_add_test(tcase, "NetShareGetInfo", test_NetShareGetInfoAdminFull);
-	torture_rpc_tcase_add_test(tcase, "NetShareAddSetDel", 
-							   test_NetShareAddSetDel);
+	test = torture_rpc_tcase_add_test(tcase, "NetShareAddSetDel", 
+					   test_NetShareAddSetDel);
+	test->dangerous = true;
 	torture_rpc_tcase_add_test(tcase, "NetNameValidate", test_NetNameValidate);
 	
 	tcase = torture_suite_add_anon_rpc_iface_tcase(suite, 

Modified: branches/SAMBA_4_0/source/torture/rpc/winreg.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/winreg.c	2007-08-31 15:34:26 UTC (rev 24845)
+++ branches/SAMBA_4_0/source/torture/rpc/winreg.c	2007-08-31 15:43:03 UTC (rev 24846)
@@ -523,16 +523,12 @@
 	return true;
 }
 
-static bool test_InitiateSystemShutdown(struct torture_context *tctx,
-										struct dcerpc_pipe *p)
+static bool test_InitiateSystemShutdown(struct torture_context *tctx, 
+					struct dcerpc_pipe *p)
 {
 	struct winreg_InitiateSystemShutdown r;
 	uint16_t hostname = 0x0;
 
-	if (!torture_setting_bool(tctx, "dangerous", false))
-		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");
@@ -556,10 +552,6 @@
 	struct winreg_InitiateSystemShutdownEx r;
 	uint16_t hostname = 0x0;
 
-	if (!torture_setting_bool(tctx, "dangerous", false))
-		torture_skip(tctx, 
-		   "winreg_InitiateShutdownEx 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");
@@ -749,15 +741,18 @@
 	int i;
 	struct torture_rpc_tcase *tcase;
 	struct torture_suite *suite = torture_suite_create(mem_ctx, "WINREG");
+	struct torture_test *test;
 
 	tcase = torture_suite_add_rpc_iface_tcase(suite, "winreg", 
-											  &ndr_table_winreg);
+						  &ndr_table_winreg);
 
-	torture_rpc_tcase_add_test(tcase, "InitiateSystemShutdown", 
-							   test_InitiateSystemShutdown);
+	test = torture_rpc_tcase_add_test(tcase, "InitiateSystemShutdown", 
+					  test_InitiateSystemShutdown);
+	test->dangerous = true;
 
-	torture_rpc_tcase_add_test(tcase, "InitiateSystemShutdownEx", 
-							   test_InitiateSystemShutdownEx);
+	test = torture_rpc_tcase_add_test(tcase, "InitiateSystemShutdownEx", 
+					  test_InitiateSystemShutdownEx);
+	test->dangerous = true;
 
 	for (i = 0; i < ARRAY_SIZE(open_fns); i++) {
 		torture_rpc_tcase_add_test_ex(tcase, open_fns[i].name, test_Open, 

Modified: branches/SAMBA_4_0/source/torture/ui.c
===================================================================
--- branches/SAMBA_4_0/source/torture/ui.c	2007-08-31 15:34:26 UTC (rev 24845)
+++ branches/SAMBA_4_0/source/torture/ui.c	2007-08-31 15:43:03 UTC (rev 24846)
@@ -112,7 +112,7 @@
 	test->description = NULL;
 	test->run = wrap_test_with_testcase;
 	test->fn = run;
-	test->dangerous = False;
+	test->dangerous = false;
 	test->data = data;
 
 	DLIST_ADD_END(tcase->tests, test, struct torture_test *);
@@ -227,38 +227,41 @@
 	BOOL ret;
 	char *old_testname;
 
-	if (test->dangerous && !torture_setting_bool(context, "dangerous", False)) {
-		torture_result(context, TORTURE_SKIP,
-				"disabled %s - enable dangerous tests to use", test->name);
-		return True;
-	}
-
 	if (!already_setup && tcase->setup && 
 		!tcase->setup(context, &(tcase->data)))
-		return False;
+		return false;
 
 	if (tcase == NULL || strcmp(test->name, tcase->name) != 0) { 
 		old_testname = context->active_testname;
 		context->active_testname = talloc_asprintf(context, "%s-%s", 
 											   old_testname, test->name);
 	}
+
 	context->active_tcase = tcase;
 	context->active_test = test;
 
 	torture_ui_test_start(context, tcase, test);
 
-
 	context->last_reason = NULL;
 	context->last_result = TORTURE_OK;
 
-	ret = test->run(context, tcase, test);
-	if (!ret && context->last_result == TORTURE_OK) {
-		if (context->last_reason == NULL)
-			context->last_reason = talloc_strdup(context, "Unknown error/failure");
-		context->last_result = TORTURE_ERROR;
+	if (test->dangerous && 
+	    !torture_setting_bool(context, "dangerous", false)) {
+	    context->last_result = TORTURE_SKIP;
+	    context->last_reason = talloc_asprintf(context, 
+	    	"disabled %s - enable dangerous tests to use", test->name);
+	} else {
+	    ret = test->run(context, tcase, test);
+
+	    if (!ret && context->last_result == TORTURE_OK) {
+		    if (context->last_reason == NULL)
+			    context->last_reason = talloc_strdup(context, "Unknown error/failure");
+		    context->last_result = TORTURE_ERROR;
+	    }
 	}
 
-	torture_ui_test_result(context, context->last_result, context->last_reason);
+	torture_ui_test_result(context, context->last_result, 
+			       context->last_reason);
 	
 	talloc_free(context->last_reason);
 



More information about the samba-cvs mailing list