diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2017-05-25 22:00:57 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2017-05-25 22:00:57 -0400 |
commit | 28f0d02a151ab867ae04c314c11cef0295af289a (patch) | |
tree | 487d64a8ab650781cb11dd98de8d24b778b39007 /src/mongo/unittest | |
parent | 5b3d2570abe554f1eb7602ffdcd0ee811def9029 (diff) | |
download | mongo-28f0d02a151ab867ae04c314c11cef0295af289a.tar.gz |
SERVER-28960 Avoid creating core dumps during DEATH_TESTs.
Diffstat (limited to 'src/mongo/unittest')
-rw-r--r-- | src/mongo/unittest/death_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/unittest/death_test.cpp b/src/mongo/unittest/death_test.cpp index 7c4759611b0..1c12bb55699 100644 --- a/src/mongo/unittest/death_test.cpp +++ b/src/mongo/unittest/death_test.cpp @@ -33,6 +33,7 @@ #ifndef _WIN32 #include <cstdio> +#include <sys/resource.h> #include <sys/wait.h> #include <unistd.h> #endif @@ -112,6 +113,13 @@ void DeathTestImpl::_doTest() { checkSyscall(close(pipes[0])); checkSyscall(dup2(pipes[1], 1)); checkSyscall(dup2(1, 2)); + + // We disable the creation of core dump files in the child process since the child process is + // expected to exit uncleanly. This avoids unnecessarily creating core dump files when the child + // process calls std::abort() or std::terminate(). + const struct rlimit kNoCoreDump{0U, 0U}; + checkSyscall(setrlimit(RLIMIT_CORE, &kNoCoreDump)); + try { _test->run(); } catch (const TestAssertionFailureException& tafe) { |