[Lldb-commits] [lldb] [lldb/test] Suppress crash reports from LLDB's gtest death tests (PR #218981)
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 26 09:48:12 PDT 2026
https://github.com/medismailben created https://github.com/llvm/llvm-project/pull/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.
>From 46105a282f1412510a64f5f377c0c0979df92716 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <ismail at bennani.ma>
Date: Wed, 19 Aug 2026 12:55:39 +0100
Subject: [PATCH] [lldb/test] Suppress crash reports from LLDB's gtest death
tests
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>
---
lldb/unittests/Host/ProcessRunLockTest.cpp | 7 +++++++
lldb/unittests/Utility/PolicyTest.cpp | 6 ++++++
2 files changed, 13 insertions(+)
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