r25278: add a more extented macro for doing struct based winbind requests
authorStefan Metzmacher <metze@samba.org>
Fri, 21 Sep 2007 10:36:51 +0000 (10:36 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:07:04 +0000 (15:07 -0500)
metze
(This used to be commit ad3ec174088393a9efb265fa7a135fbfd080b6a7)

source4/torture/winbind/struct_based.c

index b6686e8a04d85ec22511d2d47c76f516e2bf0094..33ed0c79deffbcb5b1cef43bae242754649ce1fe 100644 (file)
 #include "libcli/security/security.h"
 #include "param/param.h"
 
+#define DO_STRUCT_REQ_REP_EXT(op,req,rep,expected,strict,warnaction,cmt) do { \
+       NSS_STATUS __got, __expected = (expected); \
+       __got = winbindd_request_response(op, req, rep); \
+       if (__got != __expected) { \
+               const char *__cmt = (cmt); \
+               if (strict) { \
+                       torture_result(torture, TORTURE_FAIL, \
+                               __location__ ": " __STRING(op) \
+                               " returned %d, expected %d%s%s", \
+                               __got, __expected, \
+                               (__cmt) ? ": " : "", \
+                               (__cmt) ? (__cmt) : ""); \
+                       return false; \
+               } else { \
+                       torture_warning(torture, \
+                               __location__ ": " __STRING(op) \
+                               " returned %d, expected %d%s%s", \
+                               __got, __expected, \
+                               (__cmt) ? ": " : "", \
+                               (__cmt) ? (__cmt) : ""); \
+                       warnaction; \
+               } \
+       } \
+} while(0)
+
 #define DO_STRUCT_REQ_REP(op,req,rep) do { \
-       NSS_STATUS _result; \
-       _result = winbindd_request_response(op, req, rep); \
-       torture_assert_int_equal(torture, _result, NSS_STATUS_SUCCESS, \
-                                __STRING(op) "(struct based)"); \
+       bool __noop = false; \
+       DO_STRUCT_REQ_REP_EXT(op,req,rep,NSS_STATUS_SUCCESS,true,__noop=true,NULL); \
 } while (0)
 
 static bool torture_winbind_struct_ping(struct torture_context *torture)