summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-10-09 13:42:13 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2013-10-15 19:02:08 +0100
commit5a97ea91e11a4d2a2cfd46f18e0a69c2f0f279af (patch)
treed6148ba60092947b4e9a11d6100ef01605a2208c /lib
parentffa2107abc46bb891ee2e0f2f73944626b9c67a9 (diff)
lib: Add a igt_assert_cmpint()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/drmtest.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/drmtest.h b/lib/drmtest.h
index ff2827d38..f45780b45 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -193,6 +193,20 @@ void igt_exit(void) __attribute__((noreturn));
__igt_fail_assert(99, __FILE__, __LINE__, __func__, #expr , f); \
} while (0)
/**
+ * igt_assert_cmptint
+ *
+ * Like igt_assert(), but displays the values being compared on failure.
+ */
+#define igt_assert_cmpint(n1, cmp, n2) \
+ do { \
+ int __n1 = (n1), __n2 = (n2); \
+ if (__n1 cmp __n2) ; else \
+ __igt_fail_assert(99, __FILE__, __LINE__, __func__, \
+ #n1 " " #cmp " " #n2, \
+ "error: %d %s %d\n", __n1, #cmp, __n2); \
+ } while (0)
+
+/**
* igt_require - skip a (sub-)test if a condition is not met
*
* This is useful to streamline the skip logic since it allows for a more flat