svn commit: samba r16174 - in branches/SAMBA_4_0/source/torture: .

jelmer at samba.org jelmer at samba.org
Mon Jun 12 23:03:03 GMT 2006


Author: jelmer
Date: 2006-06-12 23:03:02 +0000 (Mon, 12 Jun 2006)
New Revision: 16174

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

Log:
Couple of fixes to the UI code - make 'torture_ok()' optional, be more verbose by default.

Modified:
   branches/SAMBA_4_0/source/torture/smbtorture.c
   branches/SAMBA_4_0/source/torture/ui.c
   branches/SAMBA_4_0/source/torture/ui.h


Changeset:
Modified: branches/SAMBA_4_0/source/torture/smbtorture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smbtorture.c	2006-06-12 23:01:51 UTC (rev 16173)
+++ branches/SAMBA_4_0/source/torture/smbtorture.c	2006-06-12 23:03:02 UTC (rev 16174)
@@ -240,7 +240,22 @@
 
 static void simple_test_result (struct torture_test *test, enum torture_result res, const char *reason)
 {
-	printf("\t %d: %s\n",res, reason?reason:"");
+	switch (res) {
+	case TORTURE_OK:
+		if (reason)
+			printf("OK: %s\n", reason);
+		break;
+	case TORTURE_FAIL:
+		printf("ERROR: %s - %s\n", test->name, reason);
+		break;
+	case TORTURE_TODO:
+		printf("TODO: %s - %s\n", test->name, reason);
+		break;
+	case TORTURE_SKIP:
+		printf("SKIP: %s - %s\n", test->name, reason);
+		break;
+
+	}
 }
 
 static void simple_comment (struct torture_test *test, const char *comment)

Modified: branches/SAMBA_4_0/source/torture/ui.c
===================================================================
--- branches/SAMBA_4_0/source/torture/ui.c	2006-06-12 23:01:51 UTC (rev 16173)
+++ branches/SAMBA_4_0/source/torture/ui.c	2006-06-12 23:03:02 UTC (rev 16174)
@@ -22,6 +22,17 @@
 #include "includes.h"
 #include "torture/ui.h"
 
+static int test_destructor(void *_test)
+{
+	struct torture_test *test = _test;
+
+	if (test->result == TORTURE_OK)
+		torture_ok(test);
+
+	return 0;	
+}
+
+
 struct torture_test *torture_test(struct torture_context *ctx, const char *name, const char *description)
 {
 	struct torture_test *test = talloc(ctx, struct torture_test);
@@ -32,6 +43,8 @@
 
 	ctx->ui_ops->test_start(test);
 
+	talloc_set_destructor(test, test_destructor);
+
 	return test;
 }
 
@@ -44,8 +57,10 @@
 	test->context = parent->context;
 
 	test->context->ui_ops->test_start(test);
+
+	talloc_set_destructor(test, test_destructor);
 	
-	return NULL;
+	return test;
 }
 
 void torture_comment(struct torture_test *test, const char *comment, ...) _PRINTF_ATTRIBUTE(2,3)
@@ -60,6 +75,7 @@
 	talloc_free(tmp);
 }
 
+
 void torture_ok(struct torture_test *test)
 {
 	test->context->ui_ops->test_result(test, TORTURE_OK, NULL);

Modified: branches/SAMBA_4_0/source/torture/ui.h
===================================================================
--- branches/SAMBA_4_0/source/torture/ui.h	2006-06-12 23:01:51 UTC (rev 16173)
+++ branches/SAMBA_4_0/source/torture/ui.h	2006-06-12 23:03:02 UTC (rev 16174)
@@ -43,6 +43,8 @@
 
 	void *ui_data;
 
+	enum torture_result result;
+
 	struct torture_context *context;
 };
 



More information about the samba-cvs mailing list