]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test537: cap the rlimit max this test runs
authorStefan Eissing <stefan@eissing.org>
Wed, 11 Sep 2024 10:10:10 +0000 (12:10 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 12 Sep 2024 06:45:50 +0000 (08:45 +0200)
Modern debian reports a soft limit of 134217724 which makes this test
run for minutes to allocate all file descriptors. Impose a cap of 256k,
so we do not run this tests on systems with larger rlimits.

Closes #14857

tests/libtest/lib537.c

index 145d3cc91cd1755deeb587398bcdc7a6abba5f37..7d454b4e422533563f3ecbf376403fc3a2a8ee68 100644 (file)
@@ -145,6 +145,15 @@ static int rlimit(int keep_open)
   rlim2str(strbuff, sizeof(strbuff), rl.rlim_max);
   fprintf(stderr, "initial hard limit: %s\n", strbuff);
 
+  /* If the OS allows a HUGE number of open files, we do not run.
+   * Modern debian sid reports a limit of 134217724 and this tests
+   * takes minutes. */
+#define LIMIT_CAP     (256*1024)
+  if(rl.rlim_cur > LIMIT_CAP) {
+    fprintf(stderr, "soft limit above %ld, not running\n", (long)LIMIT_CAP);
+    return -2;
+  }
+
   /*
    * if soft limit and hard limit are different we ask the
    * system to raise soft limit all the way up to the hard