tsocket: remove DGRAM support from tsocket_context
[ira/wip.git] / lib / torture / torture.h
index f16d2707bb373014f9f5878ca21b20bfc90ffbd5..91448c64224edcfa63e318d54d43db3e1bf29ab0 100644 (file)
@@ -90,7 +90,7 @@ struct torture_context
        int level;
 
        /** Event context */
-       struct event_context *ev;
+       struct tevent_context *ev;
 
        /** Loadparm context (will go away in favor of torture_setting_ at some point) */
        struct loadparm_context *lp_ctx;
@@ -284,6 +284,21 @@ void torture_result(struct torture_context *test,
        } \
        } while(0)
 
+#define torture_assert_data_blob_equal(torture_ctx,got,expected,cmt)\
+       do { const DATA_BLOB __got = (got), __expected = (expected); \
+       if (__got.length != __expected.length) { \
+               torture_result(torture_ctx, TORTURE_FAIL, \
+                              __location__": "#got".len %d did not match "#expected" len %d: %s", \
+                              (int)__got.length, (int)__expected.length, cmt); \
+               return false; \
+       } \
+       if (memcmp(__got.data, __expected.data, __got.length) != 0) { \
+               torture_result(torture_ctx, TORTURE_FAIL, \
+                              __location__": "#got" of len %d did not match"#expected": %s", (int)__got.length, cmt); \
+               return false; \
+       } \
+       } while(0)
+
 #define torture_assert_file_contains_text(torture_ctx,filename,expected,cmt)\
        do { \
        char *__got; \
@@ -412,7 +427,7 @@ bool torture_suite_init_tcase(struct torture_suite *suite,
                              struct torture_tcase *tcase, 
                              const char *name);
 
-struct torture_context *torture_context_init(struct event_context *event_ctx, struct torture_results *results);
+struct torture_context *torture_context_init(struct tevent_context *event_ctx, struct torture_results *results);
 
 struct torture_results *torture_results_init(TALLOC_CTX *mem_ctx, const struct torture_ui_ops *ui_ops);