diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-06-13 18:01:33 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-06-13 18:14:13 +0200 |
commit | 2347e6d21eb1431479358955007a4c78430173d8 (patch) | |
tree | 02d2131359cd492f24024bf4fb8bc621723ce864 /lib/igt_core.h | |
parent | 46811c849a79892f6d0a63ae5425e59989244978 (diff) |
lib: Introduce igt_fail_on/_f
I've yet again totally screwed things up (this time automated with
cocci even, but not yet pushed luckily). So finally add a new version
for easier conversion and adjust the cocci script.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/igt_core.h')
-rw-r--r-- | lib/igt_core.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/igt_core.h b/lib/igt_core.h index b54ef615..e252eba7 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -204,7 +204,7 @@ void igt_exit(void) __attribute__((noreturn)); * igt_assert: * @expr: condition to test * - * Fails (sub-)test if the condition is not met + * Fails (sub-)test if the condition is not met. * * Should be used everywhere where a test checks results. */ @@ -218,7 +218,7 @@ void igt_exit(void) __attribute__((noreturn)); * @expr: condition to test * @...: format string and optional arguments * - * Fails (sub-)test if the condition is not met + * Fails (sub-)test if the condition is not met. * * Should be used everywhere where a test checks results. * @@ -231,6 +231,30 @@ void igt_exit(void) __attribute__((noreturn)); } while (0) /** + * igt_fail_on: + * @expr: condition to test + * + * Fails (sub-)test if the condition is met. + * + * Should be used everywhere where a test checks results. + */ +#define igt_fail_on(expr) igt_assert(!(expr)) + +/** + * igt_assert_f: + * @expr: condition to test + * @...: format string and optional arguments + * + * Fails (sub-)test if the condition is met. + * + * Should be used everywhere where a test checks results. + * + * In addition to the plain igt_assert() helper this allows to print additional + * information to help debugging test failures. + */ +#define igt_fail_on_f(expr, f...) igt_assert_f(!(expr), f) + +/** * igt_assert_cmpint: * @n1: first value * @cmp: compare operator |