summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-10-20 11:18:01 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2017-10-25 11:50:16 +0100
commit07f515979e06d4fdc6d09daa19335e91083a96f8 (patch)
tree0847b1268984299dd04f070fb0cedec27ebed8ff
parente2598d4ec8358388d2fc2d65171665d0eb5329ec (diff)
igt/gem_fd_exhaustion: Remove stale assert
__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> Reviewed-by: MichaƂ Winiarski <michal.winiarski@intel.com>
-rw-r--r--tests/gem_fd_exhaustion.c21
1 files 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;
}