summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-04-14 10:08:19 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-04-15 06:55:29 +0200
commitee66c579dedf7130aa4d59afbf373f28c98eead5 (patch)
tree2b29d8e236b02789877da88ecf05d5b463c046da /tests
parent19894e0a1b6fbbcb62028fc6513ef3904a6f5c76 (diff)
Report EMFILE/ENFILE from xs_socket()
This patch propoagates the error from signaler and mailbox initialisation up the stack. To achieve this signaler and mailbox classes were re-written is C-like syntax. Finally, shutdown_stress test now ignores EMFILE/ENFILE errors. Thus, the tests should pass even on OSX which sets the max number of file descriptors pretty low by default. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/shutdown_stress.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/shutdown_stress.cpp b/tests/shutdown_stress.cpp
index 27ab1f0..f106cc0 100644
--- a/tests/shutdown_stress.cpp
+++ b/tests/shutdown_stress.cpp
@@ -69,13 +69,18 @@ int XS_TEST_MAIN ()
for (i = 0; i != THREAD_COUNT; i++) {
s2 = xs_socket (ctx, XS_SUB);
- assert (s2);
- threads [i] = thread_create (shutdown_stress_worker, s2);
- assert (threads [i]);
+ if (!s2 && (errno == EMFILE || errno == ENFILE))
+ threads [i] = NULL;
+ else {
+ assert (s2);
+ threads [i] = thread_create (shutdown_stress_worker, s2);
+ assert (threads [i]);
+ }
}
for (i = 0; i != THREAD_COUNT; i++)
- thread_join (threads [i]);
+ if (threads [i])
+ thread_join (threads [i]);
rc = xs_close (s1);
assert (rc == 0);