[compiler-rt] [NFC][asan] Try to deflake asan_lsan_deadlock test (PR #137718)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 14:54:25 PDT 2025


https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/137718

>From cfa4a1af18dc9b64eb82a72c58fb6498dcd5e008 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Mon, 28 Apr 2025 14:50:06 -0700
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp b/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
index 7ca07edbaf18c..7c2dbf27da3d4 100644
--- a/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
+++ b/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
@@ -36,11 +36,8 @@
 
 void Watchdog() {
   // Safety mechanism: Turn infinite deadlock into finite test failure
-  usleep(10000000);
-  // CHECK-NOT: Timeout! Deadlock detected.
-  puts("Timeout! Deadlock detected.");
-  fflush(stdout);
-  _exit(1);
+  sleep(60);
+  _exit(0);
 }
 
 int main(int argc, char **argv) {

>From 6a30c211848b0f8f34208f6b0adf3f325f51d11d Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Mon, 28 Apr 2025 14:54:15 -0700
Subject: [PATCH 2/2] rebase

Created using spr 1.3.4
---
 compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp b/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
index 7c2dbf27da3d4..b856b12325bf6 100644
--- a/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
+++ b/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
@@ -24,9 +24,8 @@
  * [Worker Thread] ASan: lock B -> requests lock A
  * 
  * Success Criteria: 
- * With proper lock ordering enforcement, watchdog should NOT trigger - test exits normally.
- * If deadlock occurs, watchdog terminates via _exit(1) after 10s timeout.
- */
+ * With proper lock ordering enforcement, watchdog should NOT trigger - test exits with Asan report.
+  */
 
 #include <mutex>
 #include <sanitizer/lsan_interface.h>
@@ -37,6 +36,7 @@
 void Watchdog() {
   // Safety mechanism: Turn infinite deadlock into finite test failure
   sleep(60);
+  // Unexpected. "not" in RUN will fail if we reached here.
   _exit(0);
 }
 



More information about the llvm-commits mailing list