[Lldb-commits] [lldb] bea207b - [lldb/test] Suppress crash reports from LLDB's gtest death tests (#218981)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 1 14:46:24 PDT 2026
Author: Med Ismail Bennani
Date: 2026-09-01T22:46:19+01:00
New Revision: bea207b72938758a59b499e2aba345d9c882cb3c
URL: https://github.com/llvm/llvm-project/commit/bea207b72938758a59b499e2aba345d9c882cb3c
DIFF: https://github.com/llvm/llvm-project/commit/bea207b72938758a59b499e2aba345d9c882cb3c.diff
LOG: [lldb/test] Suppress crash reports from LLDB's gtest death tests (#218981)
PolicyStackDeathTest.GuardDestroyedOnDifferentThread and
ProcessRunLockDeathTest.MoveLockedAcrossThreads deliberately trip
thread-affinity checks that call report_fatal_error, so the forked
death-test child dies via SIGABRT. On platforms with a system crash
reporter that leaves a crash log behind for each run, which CI scrapes
and reports as a test failure even though both tests pass.
Call llvm::sys::Process::PreventCoreFiles() as the first statement
inside the EXPECT_DEATH block. EXPECT_DEATH forks by default, so this
only affects the child process and leaves the runner's own signal
handling alone. The assertions still hold: report_fatal_error writes to
stderr before aborting, so the regex still matches, and the nonzero exit
status satisfies ExitedUnsuccessfully.
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
Added:
Modified:
lldb/unittests/Host/ProcessRunLockTest.cpp
lldb/unittests/Utility/PolicyTest.cpp
Removed:
################################################################################
diff --git a/lldb/unittests/Host/ProcessRunLockTest.cpp b/lldb/unittests/Host/ProcessRunLockTest.cpp
index 5a48ad250170c..e797cc13fcfba 100644
--- a/lldb/unittests/Host/ProcessRunLockTest.cpp
+++ b/lldb/unittests/Host/ProcessRunLockTest.cpp
@@ -8,6 +8,8 @@
#include "lldb/Host/ProcessRunLock.h"
+#include "llvm/Support/Process.h"
+
#include "gtest/gtest.h"
#include <condition_variable>
@@ -177,6 +179,11 @@ TEST(ProcessRunLockDeathTest, MoveLockedAcrossThreads) {
// "ProcessRunLocker" common prefix only.
EXPECT_DEATH(
{
+ // The abort below is expected, so keep it away from the system crash
+ // reporter, which would otherwise record it as a real crash. This must
+ // stay inside the death-test statement so only the forked child is
+ // affected.
+ llvm::sys::Process::PreventCoreFiles();
std::thread t([locker = std::move(a)]() mutable { (void)locker; });
t.join();
},
diff --git a/lldb/unittests/Utility/PolicyTest.cpp b/lldb/unittests/Utility/PolicyTest.cpp
index 57919b57bdf0a..66c08f24eb5a5 100644
--- a/lldb/unittests/Utility/PolicyTest.cpp
+++ b/lldb/unittests/Utility/PolicyTest.cpp
@@ -8,6 +8,7 @@
#include "lldb/Utility/Policy.h"
#include "lldb/Utility/StreamString.h"
+#include "llvm/Support/Process.h"
#include "gtest/gtest.h"
#include <thread>
@@ -202,6 +203,11 @@ TEST(PolicyStackDeathTest, GuardDestroyedOnDifferentThread) {
// where the violation is detected.
EXPECT_DEATH(
{
+ // The abort below is expected, so keep it away from the system crash
+ // reporter, which would otherwise record it as a real crash. This must
+ // stay inside the death-test statement so only the forked child is
+ // affected.
+ llvm::sys::Process::PreventCoreFiles();
std::thread t([guard = std::move(outer)]() mutable { (void)guard; });
t.join();
},
More information about the lldb-commits
mailing list