[Lldb-commits] [lldb] [lldb] Add TSan supression for tests (PR #231565)

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 15 01:33:58 PDT 2026


https://github.com/Teemperor updated https://github.com/llvm/llvm-project/pull/231565

>From 6f895dba79131ddc16b0aab229e997cda696c4a0 Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Tue, 13 Oct 2026 15:02:39 +0100
Subject: [PATCH] [lldb] Add TSan supression for tests

This adds a suppressions file for ThreadSanitizer. The goal is to hide
sanitizer for failures that we can't easily fix.

To actually have real content and test that this works, I put the TSan
error found by TestCancelAttach.py as the first ignored error.
---
 lldb/test/API/lit.cfg.py        | 7 ++++++-
 lldb/test/Shell/lit.cfg.py      | 7 ++++++-
 lldb/test/Unit/lit.cfg.py       | 7 ++++++-
 lldb/test/tsan-suppressions.txt | 6 ++++++
 4 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 lldb/test/tsan-suppressions.txt

diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 4449f78bb9c147..774f6a0a45e0d6 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -138,7 +138,12 @@ def delete_module_cache(path):
             )
 
     if "Thread" in config.llvm_use_sanitizer:
-        config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
+        tsan_suppressions = os.path.join(
+            os.path.dirname(config.test_source_root), "tsan-suppressions.txt"
+        )
+        config.environment["TSAN_OPTIONS"] = (
+            "halt_on_error=1:suppressions=" + tsan_suppressions
+        )
         if "Darwin" in config.target_os:
             config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
                 "libclang_rt.tsan_osx_dynamic.dylib"
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index 292ee3d7199e69..7ac19578e51c89 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -52,7 +52,12 @@
 # Enable sanitizer runtime flags.
 if config.llvm_use_sanitizer:
     config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
-    config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
+    tsan_suppressions = os.path.join(
+        os.path.dirname(config.test_source_root), "tsan-suppressions.txt"
+    )
+    config.environment["TSAN_OPTIONS"] = (
+        "halt_on_error=1:suppressions=" + tsan_suppressions
+    )
     config.environment["MallocNanoZone"] = "0"
 
 if config.lldb_platform_url and config.cmake_sysroot and config.enable_remote:
diff --git a/lldb/test/Unit/lit.cfg.py b/lldb/test/Unit/lit.cfg.py
index 681e3b19dce349..b25c3c28376122 100644
--- a/lldb/test/Unit/lit.cfg.py
+++ b/lldb/test/Unit/lit.cfg.py
@@ -38,7 +38,12 @@
 # Enable sanitizer runtime flags.
 if config.llvm_use_sanitizer:
     config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
-    config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
+    tsan_suppressions = os.path.join(
+        os.path.dirname(os.path.dirname(__file__)), "tsan-suppressions.txt"
+    )
+    config.environment["TSAN_OPTIONS"] = (
+        "halt_on_error=1:suppressions=" + tsan_suppressions
+    )
     config.environment["MallocNanoZone"] = "0"
 
 # testFormat: The test format to use to interpret tests.
diff --git a/lldb/test/tsan-suppressions.txt b/lldb/test/tsan-suppressions.txt
new file mode 100644
index 00000000000000..c80913926b1a0a
--- /dev/null
+++ b/lldb/test/tsan-suppressions.txt
@@ -0,0 +1,6 @@
+# ThreadSanitizer suppressions for the LLDB test suite. Added suppressions
+should have a description whether they are a real bug or a false-positive.
+
+# Likely a real race. See issue #232224
+race:lldb_private::Process::PrivateStateThread::IsRunning
+



More information about the lldb-commits mailing list