diff options
author | Andrew Kaster <akaster@serenityos.org> | 2021-06-30 21:34:12 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-06 17:22:45 +0200 |
commit | b7ae5619451ff5c796108bc87f46138c3a8ca923 (patch) | |
tree | 97e69f1c56923dff1f334693ca35da61d70a32b9 /Userland/Libraries | |
parent | e4013f6cc68f271a8ecc5f2f79a473d182ee14ef (diff) | |
download | serenity-b7ae5619451ff5c796108bc87f46138c3a8ca923.zip |
LibTest: Clear core dump flag for CrashTest child processes
Because these processes are expected to crash, generating a core dump
from them and throwing up a CrashReporter window is less helpful than
it is distracting while running many tests at a time.
Use the prctl for controlling the core dump-able flag to tell the kernel
we don't want core dumps from these processes. Note that because we also
build LibTest for Lagom, we have to check for MacOS which doesn't
support prctl(PR_SET_DUMPABLE).
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibTest/CrashTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibTest/CrashTest.cpp b/Userland/Libraries/LibTest/CrashTest.cpp index 5eba071c75..bcb7b83f1a 100644 --- a/Userland/Libraries/LibTest/CrashTest.cpp +++ b/Userland/Libraries/LibTest/CrashTest.cpp @@ -6,10 +6,15 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <AK/Platform.h> #include <LibTest/CrashTest.h> #include <sys/wait.h> #include <unistd.h> +#ifndef AK_OS_MACOS +# include <sys/prctl.h> +#endif + namespace Test { Crash::Crash(String test_type, Function<Crash::Failure()> crash_function) @@ -49,6 +54,10 @@ bool Crash::run(RunType run_type) perror("fork"); VERIFY_NOT_REACHED(); } else if (pid == 0) { +#ifndef AK_OS_MACOS + if (prctl(PR_SET_DUMPABLE, 0, 0) < 0) + perror("prctl(PR_SET_DUMPABLE)"); +#endif run_crash_and_print_if_error(); exit(0); } |