[compiler-rt] e205929 - [asan] Flush stderr in test (#114084)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 12:40:59 PDT 2024


Author: Thurston Dang
Date: 2024-10-29T12:40:54-07:00
New Revision: e205929399d9ee4782b2d8ef1b659f918bdfe7c2

URL: https://github.com/llvm/llvm-project/commit/e205929399d9ee4782b2d8ef1b659f918bdfe7c2
DIFF: https://github.com/llvm/llvm-project/commit/e205929399d9ee4782b2d8ef1b659f918bdfe7c2.diff

LOG: [asan] Flush stderr in test (#114084)

This is the ASan equivalent of
https://github.com/llvm/llvm-project/pull/114083.

The x86_64_lam_qemu buildbots started failing

(https://lab.llvm.org/buildbot/#/builders/139/builds/5462/steps/2/logs/stdio).
Based on the logs, it appears the ASan check is correct but it did not
match the stderr/stdout output. This patch attempts to fix the issue by
flushing stderr as appropriate.

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp b/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp
index 87be90014d56e8..dfeb8ad5c7b53f 100644
--- a/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp
@@ -26,14 +26,17 @@ bool ignore_free = false;
 
 extern "C" {
 WEAK_ON_APPLE void __sanitizer_free_hook(const volatile void *ptr) {
-  if (ptr == glob_ptr)
+  if (ptr == glob_ptr) {
     fprintf(stderr, "Free Hook\n");
+    fflush(stderr);
+  }
 }
 
 WEAK_ON_APPLE int __sanitizer_ignore_free_hook(const volatile void *ptr) {
   if (ptr != glob_ptr)
     return 0;
   fprintf(stderr, ignore_free ? "Free Ignored\n" : "Free Respected\n");
+  fflush(stderr);
   return ignore_free;
 }
 } // extern "C"


        


More information about the llvm-commits mailing list