diff options
author | Michael Adam <obnox@samba.org> | 2015-03-26 21:20:23 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2015-03-30 13:41:26 +0200 |
commit | 4de622b6b1a6b5eb1d4984872fbcfd94666a84db (patch) | |
tree | 9ca28f0e1c0421a8bd365998d34cbc6d8f95b683 /lib/torture | |
parent | bc858fda4237dd75934ab6c29ae68ba4b0aa04cc (diff) | |
download | samba-4de622b6b1a6b5eb1d4984872fbcfd94666a84db.tar.gz |
torture: add torture_assert_not_null[_goto]
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'lib/torture')
-rw-r--r-- | lib/torture/torture.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/torture/torture.h b/lib/torture/torture.h index efdba182459..b90af843858 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -500,6 +500,27 @@ void torture_result(struct torture_context *test, }\ } while(0) +#define torture_assert_not_null(torture_ctx,got,cmt)\ + do { void *__got = (got); \ + if (__got == NULL) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": "#got" was NULL, expected != NULL: %s", \ + cmt); \ + return false; \ + } \ + } while(0) + +#define torture_assert_not_null_goto(torture_ctx,got,ret,label,cmt)\ + do { void *__got = (got); \ + if (__got == NULL) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": "#got" was NULL, expected != NULL: %s", \ + cmt); \ + ret = false; \ + goto label; \ + } \ + } while(0) + #define torture_skip(torture_ctx,cmt) do {\ torture_result(torture_ctx, TORTURE_SKIP, __location__": %s", cmt);\ return true; \ |