[Intel-gfx] [PATCH igt 2/8] lib/igt_core: Add igt_assert_fd

Daniel Stone daniels at collabora.com
Thu Oct 1 09:34:02 PDT 2015


Skip open-coding and assert that fds are valid.

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 lib/igt_core.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/igt_core.h b/lib/igt_core.h
index 9a5d9c5..8f93e8e 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -507,6 +507,17 @@ void igt_exit(void) __attribute__((noreturn));
 #define igt_assert_lt(n1, n2) igt_assert_cmpint(n1, <, >=, n2)
 
 /**
+ * igt_assert_fd:
+ * @fd: file descriptor
+ *
+ * Fails (sub-) test if the given file descriptor is not valid.
+ *
+ * Like igt_assert(), but displays the values being compared on failure instead
+ * of simply printing the stringified expression.
+ */
+#define igt_assert_fd(fd) igt_assert_lte(0, fd)
+
+/**
  * igt_require:
  * @expr: condition to test
  *
-- 
2.5.0



More information about the Intel-gfx mailing list