diff options
author | Ralph Boehme <slow@samba.org> | 2019-04-23 16:47:45 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-08-07 06:07:28 +0000 |
commit | 323f852147524b950bab4628a2824aa2273cb577 (patch) | |
tree | c334985fe2b174d1c054ef4d07914631b5375cb8 /lib/torture | |
parent | 39e2f6d59fa2e839c8ef40934790b34dbdfc8f29 (diff) | |
download | samba-323f852147524b950bab4628a2824aa2273cb577.tar.gz |
torture: add torture_assert_errno_equal_goto()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@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 a7f3f471b3a..9f55c164ac1 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -579,6 +579,18 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data) } \ } while(0) +#define torture_assert_errno_equal_goto(torture_ctx,expected,ret,label,cmt)\ + do { int __expected = (expected); \ + if (errno != __expected) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": errno was %d (%s), expected %d: %s: %s", \ + errno, strerror(errno), __expected, \ + strerror(__expected), cmt); \ + ret = false; \ + goto label; \ + } \ + } while(0) + #define torture_assert_guid_equal(torture_ctx,got,expected,cmt)\ do {const struct GUID __got = (got), __expected = (expected); \ if (!GUID_equal(&__got, &__expected)) { \ |