[compiler-rt] 62ae012 - [asan] Try to deflake the test

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 16:04:21 PDT 2024


Author: Vitaly Buka
Date: 2024-09-06T16:04:10-07:00
New Revision: 62ae01201fc7185aca61d040c4f2df5303bae0ad

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

LOG: [asan] Try to deflake the test

`10000000` unlikely uncovers new cases in the code,
but probably causing OOM before leak detection.

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/leaks.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/leaks.cpp b/compiler-rt/test/asan/TestCases/leaks.cpp
index 1207818308c233..d148adf728afe5 100644
--- a/compiler-rt/test/asan/TestCases/leaks.cpp
+++ b/compiler-rt/test/asan/TestCases/leaks.cpp
@@ -6,12 +6,9 @@
 // RUN: not %run %t 1 2>&1 | FileCheck %s
 // RUN: not %run %t 1000 2>&1 | FileCheck %s
 // RUN: not %run %t 1000000 2>&1 | FileCheck %s
-// RUN: not %run %t 10000000 2>&1 | FileCheck %s
 
 #include <cstdlib>
-#include <stdio.h>
 #include <thread>
-int *t;
 
 __attribute__((noopt)) void leak(int n) {
 #if defined(__ANDROID__) || defined(__BIONIC__)
@@ -25,9 +22,8 @@ __attribute__((noopt)) void leak(int n) {
   // Repeat few times to make sure that at least one pointer is
   // not somewhere on the stack.
   for (int i = 0; i < 10; ++i) {
-    t = new int[n];
-    printf("t: %p\n", t);
-    t = 0;
+    volatile int *t = new int[n];
+    t = nullptr;
   }
 }
 


        


More information about the llvm-commits mailing list