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

jelmer at samba.org jelmer at samba.org
Mon Jun 26 19:23:21 GMT 2006


Author: jelmer
Date: 2006-06-26 19:23:21 +0000 (Mon, 26 Jun 2006)
New Revision: 16524

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

Log:
Fix double evaluation.

Modified:
   branches/SAMBA_4_0/source/torture/local/socket.c
   branches/SAMBA_4_0/source/torture/ui.h


Changeset:
Modified: branches/SAMBA_4_0/source/torture/local/socket.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/socket.c	2006-06-26 18:31:39 UTC (rev 16523)
+++ branches/SAMBA_4_0/source/torture/local/socket.c	2006-06-26 19:23:21 UTC (rev 16524)
@@ -54,7 +54,7 @@
 	torture_assert(test, localhost, "Localhost not found");
 
 	status = socket_listen(sock1, localhost, 0, 0);
-	torture_assert_ntstatus_ok(test, status, "listen on socket 1")
+	torture_assert_ntstatus_ok(test, status, "listen on socket 1");
 
 	srv_addr = socket_get_my_addr(sock1, test);
 	if (srv_addr == NULL || strcmp(srv_addr->addr, iface_best_ip("127.0.0.1")) != 0) {
@@ -164,7 +164,7 @@
 	torture_comment(test, "server port is %d", srv_addr->port);
 
 	status = socket_connect_ev(sock2, NULL, srv_addr, 0, ev);
-	torture_assert_ntstatus_ok(test, status, "connect() on socket 2")
+	torture_assert_ntstatus_ok(test, status, "connect() on socket 2");
 
 	status = socket_accept(sock1, &sock3);
 	torture_assert_ntstatus_ok(test, status, "accept() on socket 1");

Modified: branches/SAMBA_4_0/source/torture/ui.h
===================================================================
--- branches/SAMBA_4_0/source/torture/ui.h	2006-06-26 18:31:39 UTC (rev 16523)
+++ branches/SAMBA_4_0/source/torture/ui.h	2006-06-26 19:23:21 UTC (rev 16524)
@@ -125,32 +125,41 @@
 	}
 
 #define torture_assert_werr_equal(ctx,got,expected,string) \
-	if (!W_ERROR_EQUAL(got, expected)) { \
+	do { WERROR __got = got, __expected = expected; \
+	if (!W_ERROR_EQUAL(__got, __expected)) { \
 		torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \
-					 __LINE__, string, win_errstr(got), win_errstr(expected)); \
+					 __LINE__, string, win_errstr(__got), win_errstr(__expected)); \
 		return False; \
-	}
+	} \
+	} while (0)
 
 #define torture_assert_ntstatus_equal(ctx,got,expected,string) \
-	if (!NT_STATUS_EQUAL(got, expected)) { \
+	do { NTSTATUS __got = got, __expected = expected; \
+	if (!NT_STATUS_EQUAL(__got, __expected)) { \
 		torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \
-					 __LINE__, string, nt_errstr(got), nt_errstr(expected)); \
+					 __LINE__, string, nt_errstr(__got), nt_errstr(__expected)); \
 		return False; \
-	}
+	}\
+	} while(0)
 
+
 #define torture_assert_casestr_equal(ctx,got,expected,string) \
-	if (strcasecmp(got, expected) != 0) { \
+	do { const char *__got = got, __expected = expected; \
+	if (strcasecmp(__got, __expected) != 0) { \
 		torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \
 					 __LINE__, string, got, expected); \
 		return False; \
-	}
+	} \
+	} while(0)
 
 #define torture_assert_str_equal(ctx,got,expected,string) \
-	if (strcmp(got, expected) != 0) { \
+	do { const char *__got = got, __expected = expected; \
+	if (strcmp(__got, __expected) != 0) { \
 		torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \
-					 __LINE__, string, got, expected); \
+					 __LINE__, string, __got, __expected); \
 		return False; \
-	}
+	} \
+	} while(0)
 
 
 /* Convenience macros */



More information about the samba-cvs mailing list