diff options
author | Ralph Boehme <slow@samba.org> | 2017-05-12 17:09:08 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-05-17 23:02:09 +0200 |
commit | 60747c1be4d42c29fb81ab413b0bdabdaa22012a (patch) | |
tree | 706455087c1668d05ddc3734c7dc5805cd1c6bfb /lib/torture | |
parent | 67b9d3c0860fbb955969570a97495e555bd24779 (diff) | |
download | samba-60747c1be4d42c29fb81ab413b0bdabdaa22012a.tar.gz |
lib/torture: add two more ndr assert macros
Bug: https://bugzilla.samba.org/show_bug.cgi?id=12787
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'lib/torture')
-rw-r--r-- | lib/torture/torture.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/torture/torture.h b/lib/torture/torture.h index 668458a292e..6b373a9ca15 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -293,6 +293,15 @@ void torture_result(struct torture_context *test, }\ } while(0) +#define torture_assert_ndr_err_equal_goto(torture_ctx,got,expected,ret,label,cmt) \ + do { enum ndr_err_code __got = got, __expected = expected; \ + if (__got != __expected) { \ + torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %d (%s), expected %d (%s): %s", __got, ndr_errstr(__got), __expected, __STRING(expected), cmt); \ + ret = false; \ + goto label; \ + }\ + } while(0) + #define torture_assert_hresult_equal(torture_ctx, got, expected, cmt) \ do { HRESULT __got = got, __expected = expected; \ if (!HRES_IS_EQUAL(__got, __expected)) { \ @@ -647,6 +656,9 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data) #define torture_assert_ndr_success(torture_ctx,expr,cmt) \ torture_assert_ndr_err_equal(torture_ctx,expr,NDR_ERR_SUCCESS,cmt) +#define torture_assert_ndr_success_goto(torture_ctx,expr,ret,label,cmt) \ + torture_assert_ndr_err_equal_goto(torture_ctx,expr,NDR_ERR_SUCCESS,ret,label,cmt) + #define torture_assert_hresult_ok(torture_ctx,expr,cmt) \ torture_assert_hresult_equal(torture_ctx,expr,HRES_ERROR(0), cmt) |