diff options
Diffstat (limited to 'src/mongo/unittest/death_test.cpp')
-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) { |