All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt] igt/gem_fd_exhaustion: Remove stale assert
@ 2017-10-20 10:24 Chris Wilson
  2017-10-20 11:00 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Chris Wilson @ 2017-10-20 10:24 UTC (permalink / raw)
  To: intel-gfx

__gem_create() doesn't touch the outparam *handle on failure, so we can
no longer assert that it zero. This is reasonable to remove as it is just
testing the library itself and not the kernel, so no loss in coverage.
We already had to remove the false assertion that gem_create() must fail
following fd exhaustion (as we can not prevent the kernel from freeing
VFS fdspace in between calls).

The last remaining change is that we do no need to rely on an external
path for open() as dup() will do the job of exhausting the fdtable.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103365
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gem_fd_exhaustion.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
index 250fe850..0969f9c6 100644
--- a/tests/gem_fd_exhaustion.c
+++ b/tests/gem_fd_exhaustion.c
@@ -33,11 +33,6 @@
 #include <fcntl.h>
 #include <limits.h>
 
-
-
-#define FD_ARR_SZ 100
-int fd_arr[FD_ARR_SZ];
-
 static bool allow_unlimited_files(void)
 {
 	struct rlimit rlim;
@@ -60,31 +55,23 @@ static bool allow_unlimited_files(void)
 
 igt_simple_main
 {
-	int fd, i;
+	int fd;
 
 	igt_require(allow_unlimited_files());
 
 	fd = drm_open_driver(DRIVER_INTEL);
 
-	igt_assert(open("/dev/null", O_RDONLY) >= 0);
-
 	igt_fork(n, 1) {
 		igt_drop_root();
 
-		for (i = 0; ; i++) {
-			int tmp_fd = open("/dev/null", O_RDONLY);
+		for (int i = 0; ; i++) {
+			int leak = dup(fd);
 			uint32_t handle;
 
-			if (tmp_fd >= 0 && i < FD_ARR_SZ)
-				fd_arr[i] = tmp_fd;
-
 			if (__gem_create(fd, 4096, &handle) == 0)
 				gem_close(fd, handle);
 
-
-			if (tmp_fd < 0) {
-				/* Ensure we actually hit the failure path ... */
-				igt_assert(handle == 0);
+			if (leak < 0) {
 				igt_info("fd exhaustion after %i rounds.\n", i);
 				break;
 			}
-- 
2.15.0.rc1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-25 17:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 10:24 [PATCH igt] igt/gem_fd_exhaustion: Remove stale assert Chris Wilson
2017-10-20 11:00 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-20 12:34 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-10-25 10:34 ` [PATCH igt] " Michał Winiarski
2017-10-25 10:44   ` Chris Wilson
2017-10-25 17:25 ` ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.