summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKarol Krol <karol.krol@intel.com>2018-03-05 18:36:41 +0100
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2018-03-09 18:01:12 +0200
commit5c2bf46ce5d63c7ee1a1314f39398f3510f11ef1 (patch)
tree685ec91a5094648949c903069edc2c44900168b6 /tests
parentd20a50e17657f864aaf5178be3f1451c0b16995f (diff)
igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion
Long time ago, there was an issue with driver crashing due to lack of error handling on struct file creation (gem_create()). We're unable to hit this scenario, because dup() does not create filp. Let's replace dup() with open() and assert that error is returned on exhaustion. v2: Pass if gem_create fails on exhaustion, no matter the errno. Signed-off-by: Karol Krol <karol.krol@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/gem_fd_exhaustion.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
index 0969f9c6..fdcb7f36 100644
--- a/tests/gem_fd_exhaustion.c
+++ b/tests/gem_fd_exhaustion.c
@@ -65,7 +65,7 @@ igt_simple_main
igt_drop_root();
for (int i = 0; ; i++) {
- int leak = dup(fd);
+ int leak = open("/dev/null", O_RDONLY);
uint32_t handle;
if (__gem_create(fd, 4096, &handle) == 0)
@@ -73,6 +73,8 @@ igt_simple_main
if (leak < 0) {
igt_info("fd exhaustion after %i rounds.\n", i);
+ igt_assert(__gem_create(fd, 4096,
+ &handle) < 0);
break;
}
}