torture: Simplify torture suite running, call restricted test suite runner.
[samba.git] / lib / torture / torture.h
index cb2c02ba3e0e5de1ec86f8f4280be643e5243336..931937c1182b7e27a2b4e92ca9a9679fdbc4607c 100644 (file)
@@ -218,6 +218,11 @@ bool torture_suite_add_suite(struct torture_suite *suite,
 bool torture_run_suite(struct torture_context *context,
                                           struct torture_suite *suite);
 
+/* Run the specified testsuite recursively, but only the specified 
+ * tests */
+bool torture_run_suite_restricted(struct torture_context *context, 
+                      struct torture_suite *suite, char **restricted);
+
 /* Run the specified testcase */
 bool torture_run_tcase(struct torture_context *context,
                                           struct torture_tcase *tcase);
@@ -238,6 +243,13 @@ void torture_result(struct torture_context *test,
                return false; \
        }
 
+#define torture_assert_goto(torture_ctx,expr,ret,label,cmt) \
+       if (!(expr)) { \
+               torture_result(torture_ctx, TORTURE_FAIL, __location__": Expression `%s' failed: %s", __STRING(expr), cmt); \
+               ret = false; \
+               goto label; \
+       }
+
 #define torture_assert_werr_equal(torture_ctx, got, expected, cmt) \
        do { WERROR __got = got, __expected = expected; \
        if (!W_ERROR_EQUAL(__got, __expected)) { \
@@ -365,8 +377,8 @@ void torture_result(struct torture_context *test,
        do { int __got = (got), __expected = (expected); \
        if (__got != __expected) { \
                torture_result(torture_ctx, TORTURE_FAIL, \
-                       __location__": "#got" was %d, expected %d: %s", \
-                       __got, __expected, cmt); \
+                       __location__": "#got" was %d (0x%X), expected %d (0x%X): %s", \
+                       __got, __got, __expected, __expected, cmt); \
                return false; \
        } \
        } while(0)
@@ -375,8 +387,8 @@ void torture_result(struct torture_context *test,
        do { int __got = (got), __expected = (expected); \
        if (__got != __expected) { \
                torture_result(torture_ctx, TORTURE_FAIL, \
-                       __location__": "#got" was %d, expected %d: %s", \
-                       __got, __expected, cmt); \
+                       __location__": "#got" was %d (0x%X), expected %d (0x%X): %s", \
+                       __got, __got, __expected, __expected, cmt); \
                ret = false; \
                goto label; \
        } \
@@ -386,8 +398,10 @@ void torture_result(struct torture_context *test,
        do { uint64_t __got = (got), __expected = (expected); \
        if (__got != __expected) { \
                torture_result(torture_ctx, TORTURE_FAIL, \
-                       __location__": "#got" was %llu, expected %llu: %s", \
-                       (unsigned long long)__got, (unsigned long long)__expected, cmt); \
+                       __location__": "#got" was %llu (0x%llX), expected %llu (0x%llX): %s", \
+                       (unsigned long long)__got, (unsigned long long)__got, \
+                       (unsigned long long)__expected, (unsigned long long)__expected, \
+                       cmt); \
                return false; \
        } \
        } while(0)