summaryrefslogtreecommitdiff
path: root/tests/core_auth.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-08-04 16:38:51 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-08-07 18:12:41 +0200
commitf4f7b700e117993847e3d4cadbaa0ce2b88712bb (patch)
tree19d867e906336d425b6559d544487c9c69c3c792 /tests/core_auth.c
parentc22705954a11d56e61aa3dd8e72d6cd2fa945d67 (diff)
tests/core_auth: set rlimit
Some distros have huge rlimits and then the test takes forever, or worse oom, or even worse, takse down the entire machine (which is shouldn't be able to, but oh well, oom handling in linux). Make sure we have a consistent rlimit by adjusting it manually. v2: Use the default of 1024 from everywhere except ubuntu. Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'tests/core_auth.c')
-rw-r--r--tests/core_auth.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/core_auth.c b/tests/core_auth.c
index e08c8aed..cedcff92 100644
--- a/tests/core_auth.c
+++ b/tests/core_auth.c
@@ -39,6 +39,7 @@
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/poll.h>
+#include <sys/resource.h>
#include "drm.h"
IGT_TEST_DESCRIPTION("Call drmGetMagic() and drmAuthMagic() and see if it behaves.");
@@ -55,6 +56,12 @@ static void test_many_magics(int master)
char path[512];
int *fds = NULL, slave;
+ struct rlimit fd_limit;
+
+ do_or_die(getrlimit(RLIMIT_NOFILE, &fd_limit));
+ fd_limit.rlim_cur = 1024;
+ do_or_die(setrlimit(RLIMIT_NOFILE, &fd_limit));
+
sprintf(path, "/proc/self/fd/%d", master);
for (i = 0; ; ++i) {
@@ -157,6 +164,7 @@ igt_main
igt_subtest("basic-auth")
test_basic_auth(master);
+ /* this must be last, we adjust the rlimit */
igt_subtest("many-magics")
test_many_magics(master);
}