diff options
author | Ralph Boehme <slow@samba.org> | 2016-12-08 15:44:37 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2017-03-07 08:28:15 +0100 |
commit | 22e81466a870d0cb6c70b9fab35893dc00c46d41 (patch) | |
tree | 966dee0398cf1aeaa93eddad6f7973392f75f488 | |
parent | 66ff93ba5dca7b418eb4a42ac75c548f6fc3679a (diff) | |
download | samba-22e81466a870d0cb6c70b9fab35893dc00c46d41.tar.gz |
lib/torture: add torture_assert_mem_equal_goto
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12427
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(cherry picked from commit 49723151b2107553559c397adadda90f7c4806f7)
-rw-r--r-- | lib/torture/torture.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/torture/torture.h b/lib/torture/torture.h index 45332b2ef7c..b6d1301d1cb 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -357,6 +357,16 @@ void torture_result(struct torture_context *test, } \ } while(0) +#define torture_assert_mem_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 did not match "#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; |