From 36745d63d687bdd310be0415c1a871a65a5ee724 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Wed, 15 Nov 2023 19:07:32 +0100 Subject: [PATCH] s4-torture: add torture_assert_werr_equal_goto and torture_assert_werr_ok_goto macros Guenther Signed-off-by: Guenther Deschner Reviewed-by: Andrew Bartlett --- lib/torture/torture.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/torture/torture.h b/lib/torture/torture.h index ad343cb030b..2d4376a3eb3 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -307,6 +307,15 @@ void torture_result(struct torture_context *test, } \ } while (0) +#define torture_assert_werr_equal_goto(torture_ctx, got, expected, ret, label, cmt) \ + do { WERROR __got = got, __expected = expected; \ + if (!W_ERROR_EQUAL(__got, __expected)) { \ + torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", win_errstr(__got), win_errstr(__expected), cmt); \ + ret = false; \ + goto label; \ + } \ + } while (0) + #define torture_assert_ntstatus_equal(torture_ctx,got,expected,cmt) \ do { NTSTATUS __got = got, __expected = expected; \ if (!NT_STATUS_EQUAL(__got, __expected)) { \ @@ -802,6 +811,9 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data) #define torture_assert_werr_ok(torture_ctx,expr,cmt) \ torture_assert_werr_equal(torture_ctx,expr,WERR_OK,cmt) +#define torture_assert_werr_ok_goto(torture_ctx,expr,ret,label,cmt) \ + torture_assert_werr_equal_goto(torture_ctx,expr,WERR_OK,ret,label,cmt) + #define torture_assert_ndr_success(torture_ctx,expr,cmt) \ torture_assert_ndr_err_equal(torture_ctx,expr,NDR_ERR_SUCCESS,cmt) -- 2.47.3