aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-01-17 18:57:50 +0000
committerYang Tse <yangsita@gmail.com>2008-01-17 18:57:50 +0000
commit0530b0a5ca5e5a21054d7ba83354a230a76eab5b (patch)
tree2166d4cfad278da335b6829d2950c474f698bf6b /tests/libtest
parent5396121595acc9c346ecd211263db50a879d6927 (diff)
Don't abort tests 518 and 537 when unable to raise the open-file soft limit
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/lib518.c17
-rw-r--r--tests/libtest/lib537.c17
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c
index 3b83ae378..22680688b 100644
--- a/tests/libtest/lib518.c
+++ b/tests/libtest/lib518.c
@@ -153,12 +153,27 @@ static int rlimit(int keep_open)
if (rl.rlim_cur != rl.rlim_max) {
+#ifdef OPEN_MAX
+ if ((rl.rlim_cur > 0) &&
+ (rl.rlim_cur < OPEN_MAX)) {
+ fprintf(stderr, "raising soft limit up to OPEN_MAX\n");
+ rl.rlim_cur = OPEN_MAX;
+ if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
+ /* on failure don't abort just issue a warning */
+ store_errmsg("setrlimit() failed", ERRNO);
+ fprintf(stderr, "%s\n", msgbuff);
+ msgbuff[0] = '\0';
+ }
+ }
+#endif
+
fprintf(stderr, "raising soft limit up to hard limit\n");
rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
+ /* on failure don't abort just issue a warning */
store_errmsg("setrlimit() failed", ERRNO);
fprintf(stderr, "%s\n", msgbuff);
- return -2;
+ msgbuff[0] = '\0';
}
/* get current open file limits */
diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c
index b4b2b7a93..1f5a34221 100644
--- a/tests/libtest/lib537.c
+++ b/tests/libtest/lib537.c
@@ -148,12 +148,27 @@ static int rlimit(int keep_open)
if (rl.rlim_cur != rl.rlim_max) {
+#ifdef OPEN_MAX
+ if ((rl.rlim_cur > 0) &&
+ (rl.rlim_cur < OPEN_MAX)) {
+ fprintf(stderr, "raising soft limit up to OPEN_MAX\n");
+ rl.rlim_cur = OPEN_MAX;
+ if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
+ /* on failure don't abort just issue a warning */
+ store_errmsg("setrlimit() failed", ERRNO);
+ fprintf(stderr, "%s\n", msgbuff);
+ msgbuff[0] = '\0';
+ }
+ }
+#endif
+
fprintf(stderr, "raising soft limit up to hard limit\n");
rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &rl) != 0) {
+ /* on failure don't abort just issue a warning */
store_errmsg("setrlimit() failed", ERRNO);
fprintf(stderr, "%s\n", msgbuff);
- return -2;
+ msgbuff[0] = '\0';
}
/* get current open file limits */