diff options
-rw-r--r-- | tests/kms_flip.c | 25 |
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); |