summaryrefslogtreecommitdiff
path: root/lib/igt_core.h
diff options
context:
space:
mode:
authorLyude Paul <lyude@redhat.com>2020-09-30 13:31:47 -0400
committerLyude Paul <lyude@redhat.com>2020-09-30 15:02:29 -0400
commitc6dd50bf193864120bb13cdd8830c4f6cf7f9818 (patch)
treead1935525fd69eb7571473937f5b815b1bc306f5 /lib/igt_core.h
parent2d51dcb88d78ff7533b869cc44b7af1d4a2746e2 (diff)
lib/igt_core: Add igt_require_fd()
Like igt_assert_fd(), but using igt_require() instead Changes since v1: * Fix documentation error in igt_require_fd() - Petri Latvala Reviewed-by: Jeremy Cline <jcline@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'lib/igt_core.h')
-rw-r--r--lib/igt_core.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/igt_core.h b/lib/igt_core.h
index e74ede8b..5d835260 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -1022,6 +1022,18 @@ void igt_describe_f(const char *fmt, ...);
} while (0)
/**
+ * igt_require_fd:
+ * @fd: file descriptor
+ *
+ * Skips (sub-) test if the given file descriptor is invalid.
+ *
+ * Like igt_require(), but displays the stringified identifier that was supposed
+ * to contain a valid fd on failure.
+ */
+#define igt_require_fd(fd) \
+ igt_require_f(fd >= 0, "file descriptor " #fd " failed\n");
+
+/**
* igt_skip_on_f:
* @expr: condition to test
* @...: format string and optional arguments