mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
igt/kms_flip/nonblocking_read: Demonstrate that O_NONBLOCK is a myth
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
7041edfd14
commit
c7551bf7cc
@ -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)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
@ -1603,6 +1625,9 @@ int main(int argc, char **argv)
|
|||||||
batch = intel_batchbuffer_alloc(bufmgr, devid);
|
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++) {
|
for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) {
|
||||||
igt_subtest(tests[i].name)
|
igt_subtest(tests[i].name)
|
||||||
run_test(tests[i].duration, tests[i].flags);
|
run_test(tests[i].duration, tests[i].flags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user