[PATCH 3/8] lib: Add a igt_assert_cmpint()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx>
---
 lib/drmtest.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/drmtest.h b/lib/drmtest.h
index ff2827d..f45780b 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
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux