Loading tests/FILEFORMAT +6 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,12 @@ is no other alternatives. Using this of course requires subsequent tests to restart servers. </killserver> <precheck> A command line that if set gets run by the test script before the test. If an output is displayed by the command line, the test will be skipped and the (single-line) output will be displayed as reason for not running the test. </precheck> <tool> Name of tool to use instead of "curl". This tool must be built and exist in the libtest/ directory. Loading tests/libtest/lib518.c +28 −12 Original line number Diff line number Diff line Loading @@ -39,24 +39,20 @@ #endif #if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) int test(char *URL) static int rlimit(void) { struct rlimit rl; int fd[NUM_OPEN]; int i; CURLcode res; CURL *curl; /* get open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) == -1) { fprintf(stderr, "warning: getrlimit: failed to get RLIMIT_NOFILE\n"); goto skip_open; return -1; } /* check that hard limit is high enough */ if (rl.rlim_max < NUM_NEEDED) { fprintf(stderr, "warning: RLIMIT_NOFILE hard limit is too low\n"); goto skip_open; return -1; } /* increase soft limit if needed */ Loading @@ -64,10 +60,32 @@ int test(char *URL) rl.rlim_cur = NUM_NEEDED; if (setrlimit(RLIMIT_NOFILE, &rl) == -1) { fprintf(stderr, "warning: setrlimit: failed to set RLIMIT_NOFILE\n"); goto skip_open; return -1; } } return 0; } int test(char *URL) { int fd[NUM_OPEN]; int i; CURLcode res; CURL *curl; if(!strcmp(URL, "check")) { /* used by the test script to ask if we can run this test or not */ if(rlimit()) { printf("rlimit problems\n"); return 1; } return 0; /* sure, run this! */ } if(rlimit()) /* failure */ return 100; /* open a dummy descriptor */ fd[0] = open(DEV_NULL, O_RDONLY); if (fd[0] == -1) { Loading @@ -86,8 +104,6 @@ int test(char *URL) } } skip_open: curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, URL); curl_easy_setopt(curl, CURLOPT_HEADER, TRUE); Loading @@ -104,7 +120,7 @@ skip_open: int test(char *URL) { (void)URL; fprintf(stderr, "system lacks necessary system function(s)"); printf("system lacks necessary system function(s)"); return 1; } #endif tests/runtests.pl +15 −0 Original line number Diff line number Diff line Loading @@ -888,6 +888,21 @@ sub singletest { $serverproblem = serverfortest($testnum); } if(!$serverproblem) { my @precheck = getpart("client", "precheck"); my $cmd = $precheck[0]; chomp $cmd; if($cmd) { my @o = `$cmd 2>/dev/null`; if($o[0]) { $serverproblem = 15; $why = $o[0]; chomp $why; } } } if($serverproblem) { # there's a problem with the server, don't run # this particular server, but count it as "skipped" Loading Loading
tests/FILEFORMAT +6 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,12 @@ is no other alternatives. Using this of course requires subsequent tests to restart servers. </killserver> <precheck> A command line that if set gets run by the test script before the test. If an output is displayed by the command line, the test will be skipped and the (single-line) output will be displayed as reason for not running the test. </precheck> <tool> Name of tool to use instead of "curl". This tool must be built and exist in the libtest/ directory. Loading
tests/libtest/lib518.c +28 −12 Original line number Diff line number Diff line Loading @@ -39,24 +39,20 @@ #endif #if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) int test(char *URL) static int rlimit(void) { struct rlimit rl; int fd[NUM_OPEN]; int i; CURLcode res; CURL *curl; /* get open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) == -1) { fprintf(stderr, "warning: getrlimit: failed to get RLIMIT_NOFILE\n"); goto skip_open; return -1; } /* check that hard limit is high enough */ if (rl.rlim_max < NUM_NEEDED) { fprintf(stderr, "warning: RLIMIT_NOFILE hard limit is too low\n"); goto skip_open; return -1; } /* increase soft limit if needed */ Loading @@ -64,10 +60,32 @@ int test(char *URL) rl.rlim_cur = NUM_NEEDED; if (setrlimit(RLIMIT_NOFILE, &rl) == -1) { fprintf(stderr, "warning: setrlimit: failed to set RLIMIT_NOFILE\n"); goto skip_open; return -1; } } return 0; } int test(char *URL) { int fd[NUM_OPEN]; int i; CURLcode res; CURL *curl; if(!strcmp(URL, "check")) { /* used by the test script to ask if we can run this test or not */ if(rlimit()) { printf("rlimit problems\n"); return 1; } return 0; /* sure, run this! */ } if(rlimit()) /* failure */ return 100; /* open a dummy descriptor */ fd[0] = open(DEV_NULL, O_RDONLY); if (fd[0] == -1) { Loading @@ -86,8 +104,6 @@ int test(char *URL) } } skip_open: curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, URL); curl_easy_setopt(curl, CURLOPT_HEADER, TRUE); Loading @@ -104,7 +120,7 @@ skip_open: int test(char *URL) { (void)URL; fprintf(stderr, "system lacks necessary system function(s)"); printf("system lacks necessary system function(s)"); return 1; } #endif
tests/runtests.pl +15 −0 Original line number Diff line number Diff line Loading @@ -888,6 +888,21 @@ sub singletest { $serverproblem = serverfortest($testnum); } if(!$serverproblem) { my @precheck = getpart("client", "precheck"); my $cmd = $precheck[0]; chomp $cmd; if($cmd) { my @o = `$cmd 2>/dev/null`; if($o[0]) { $serverproblem = 15; $why = $o[0]; chomp $why; } } } if($serverproblem) { # there's a problem with the server, don't run # this particular server, but count it as "skipped" Loading