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

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

 



Skip open-coding and assert that fds are valid.

Signed-off-by: Daniel Stone <daniels@xxxxxxxxxxxxx>
---
 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

_______________________________________________
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