[igt-dev] [PATCH i-g-t 2/2] tests/i915/gem_fd_exhaustion.c: Expect ENFILE when fds run out

Antonio Argenziano antonio.argenziano at intel.com
Mon Apr 8 22:52:00 UTC 2019


Change the test to expect gem_create to return ENFILE when we run out of
fds.

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
---
 tests/i915/gem_fd_exhaustion.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/i915/gem_fd_exhaustion.c b/tests/i915/gem_fd_exhaustion.c
index 23602b98..83d0e926 100644
--- a/tests/i915/gem_fd_exhaustion.c
+++ b/tests/i915/gem_fd_exhaustion.c
@@ -48,15 +48,16 @@ igt_simple_main
 			int leak = open("/dev/null", O_RDONLY);
 			uint32_t handle;
 
-			if (__gem_create(fd, 4096, &handle) == 0)
-				gem_close(fd, handle);
-
 			if (leak < 0) {
 				igt_info("fd exhaustion after %i rounds.\n", i);
-				igt_assert(__gem_create(fd, 4096,
-							&handle) < 0);
+				igt_assert_eq(__gem_create(fd, 4096,
+							&handle), -ENFILE);
 				break;
 			}
+
+			if (__gem_create(fd, 4096, &handle) == 0)
+				gem_close(fd, handle);
+
 		}
 
 		/* The child will free all the fds when exiting, so no need to
-- 
2.20.1



More information about the igt-dev mailing list