Skip to content

Conversation

DanBlackwell
Copy link
Contributor

Currently this test is flaky. I believe that it may be because the logs have not flushed to disk before the log show command is run.

This patch allows the test to retry reading the log twice more with a 5 second sleep inbetween.

Currently this test is flaky. I believe that it may be because the logs have not flushed to disk before the `log show` command is run.

This patch allows the test to retry reading the log twice more with a 5 second sleep inbetween.
@llvmbot
Copy link
Member

llvmbot commented Sep 15, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Dan Blackwell (DanBlackwell)

Changes

Currently this test is flaky. I believe that it may be because the logs have not flushed to disk before the log show command is run.

This patch allows the test to retry reading the log twice more with a 5 second sleep inbetween.


Full diff: https://github.com/llvm/llvm-project/pull/158662.diff

1 Files Affected:

  • (modified) compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp (+7-2)
diff --git a/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp b/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp
index 0091ebc09205c..5a0353bfb1b31 100644
--- a/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp
+++ b/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp
@@ -8,8 +8,13 @@
 // RUN: FileCheck %s --check-prefixes CHECK,CHECK-PROC -input-file=%t.process_output.txt
 
 // Check syslog output. We filter recent system logs based on PID to avoid
-// getting the logs of previous test runs.
-// RUN: log show --debug --last 5m  --predicate "processID == ${TEST_PID}" --style syslog > %t.process_syslog_output.txt
+// getting the logs of previous test runs. Make some reattempts in case there
+// is a delay.
+// RUN: for I in {1..3}; do \
+// RUN:   log show --debug --last $((SECONDS + 30))s --predicate "processID == ${TEST_PID}" --style syslog > %t.process_syslog_output.txt; \
+// RUN:   if grep -q "use-after-poison" %t.process_syslog_output.txt; then break; fi; \
+// RUN:   sleep 5; \
+// RUN: done
 // RUN: FileCheck %s -input-file=%t.process_syslog_output.txt
 #include <cassert>
 #include <cstdio>

Copy link
Contributor

@wrotki wrotki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. We also have this deflake script you could use, but I think it won't allow steps between reattempts.

@DanBlackwell DanBlackwell merged commit 191dbca into llvm:main Sep 23, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants