summaryrefslogtreecommitdiff
path: root/lib/torture
diff options
context:
space:
mode:
authorUri Simchoni <uri@samba.org>2017-03-23 21:30:50 +0200
committerRalph Boehme <slow@samba.org>2017-03-26 19:42:16 +0200
commitf31fd41ca728d664ded940a7309ef1e32383bb66 (patch)
treeb30bb59ced2f1a1a08535b4dcfe91ce9892087ef /lib/torture
parente11d4eb4d5c6cfc6daa3dbdcc301a4fa83298f0e (diff)
downloadsamba-f31fd41ca728d664ded940a7309ef1e32383bb66.tar.gz
torture: add torture_assert_mem_not_equal_goto()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12715 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib/torture')
-rw-r--r--lib/torture/torture.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index b6d1301d1cb..668458a292e 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -367,6 +367,16 @@ void torture_result(struct torture_context *test,
} \
} while(0)
+#define torture_assert_mem_not_equal_goto(torture_ctx,got,expected,len,ret,label,cmt) \
+ do { const void *__got = (got), *__expected = (expected); \
+ if (memcmp(__got, __expected, len) == 0) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" of len %d unexpectedly matches "#expected": %s", (int)len, cmt); \
+ ret = false; \
+ goto label; \
+ } \
+ } while(0)
+
static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
{
char **dump = (char **)private_data;