summaryrefslogtreecommitdiff
path: root/tests/kms_flip.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-10-08 10:44:06 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-10-08 10:44:57 +0100
commitc7551bf7ccee3ce52dc51b4684716c4b10b80604 (patch)
tree7b1f5612f725206fc9f44b49c1753f4fa5a9630f /tests/kms_flip.c
parent7041edfd144035f987001bd4f4a367d403cad912 (diff)
igt/kms_flip/nonblocking_read: Demonstrate that O_NONBLOCK is a myth
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/kms_flip.c')
-rw-r--r--tests/kms_flip.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 3cccfdf0..901f0133 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1513,6 +1513,28 @@ static void kms_flip_exit_handler(int sig)
}
}
+static void test_nonblocking_read(int in)
+{
+ char buffer[1024];
+ int fd = dup(in);
+ int ret;
+
+ ret = -1;
+ if (fd != -1)
+ ret = fcntl(fd, F_GETFL);
+ if (ret != -1) {
+ ret |= O_NONBLOCK;
+ ret = fcntl(fd, F_SETFL, ret);
+ }
+ igt_require(ret != -1);
+
+ ret = read(fd, buffer, sizeof(buffer));
+ igt_assert_eq(ret, -1);
+ igt_assert_eq(errno, EAGAIN);
+
+ close(fd);
+}
+
int main(int argc, char **argv)
{
struct {
@@ -1603,6 +1625,9 @@ int main(int argc, char **argv)
batch = intel_batchbuffer_alloc(bufmgr, devid);
}
+ igt_subtest("nonblocking-read")
+ test_nonblocking_read(drm_fd);
+
for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) {
igt_subtest(tests[i].name)
run_test(tests[i].duration, tests[i].flags);