summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-03-20 10:49:54 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-03-20 10:51:09 +0000
commit3d8af56ed2f08e57e58944c1baf8dc15fafa3f27 (patch)
treedfb5dd04b31ddce15efccfcc30b16cd3ba484bbb /tests
parent82e9113bfbc342d3f839797471a7eab16ec40548 (diff)
igt/gem_concurrent_blit: Reset process limits to allow dmabuf tests
Since dmabuf requires an actual fd for every object, we need to increase the number of files our process is allowed. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/gem_concurrent_all.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c
index 081e2ba3..6122686e 100644
--- a/tests/gem_concurrent_all.c
+++ b/tests/gem_concurrent_all.c
@@ -42,6 +42,7 @@
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
+#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
@@ -1554,6 +1555,26 @@ num_buffers(uint64_t max,
return n;
}
+static bool allow_unlimited_files(void)
+{
+ struct rlimit rlim;
+ unsigned nofile_rlim = 1024*1024;
+
+ FILE *file = fopen("/proc/sys/fs/file-max", "r");
+ if (file) {
+ igt_assert(fscanf(file, "%u", &nofile_rlim) == 1);
+ igt_info("System limit for open files is %u\n", nofile_rlim);
+ fclose(file);
+ }
+
+ if (getrlimit(RLIMIT_NOFILE, &rlim))
+ return false;
+
+ rlim.rlim_cur = nofile_rlim;
+ rlim.rlim_max = nofile_rlim;
+ return setrlimit(RLIMIT_NOFILE, &rlim) == 0;
+}
+
igt_main
{
const struct access_mode modes[] = {
@@ -1669,6 +1690,8 @@ igt_main
all = true;
igt_fixture {
+ igt_require(allow_unlimited_files());
+
fd = drm_open_driver(DRIVER_INTEL);
intel_detect_and_clear_missed_interrupts(fd);
devid = intel_get_drm_devid(fd);