Skip to content

Commit 62ae012

Browse files
committed
[asan] Try to deflake the test
`10000000` unlikely uncovers new cases in the code, but probably causing OOM before leak detection.
1 parent d5d3f98 commit 62ae012

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
// RUN: not %run %t 1 2>&1 | FileCheck %s
77
// RUN: not %run %t 1000 2>&1 | FileCheck %s
88
// RUN: not %run %t 1000000 2>&1 | FileCheck %s
9-
// RUN: not %run %t 10000000 2>&1 | FileCheck %s
109

1110
#include <cstdlib>
12-
#include <stdio.h>
1311
#include <thread>
14-
int *t;
1512

1613
__attribute__((noopt)) void leak(int n) {
1714
#if defined(__ANDROID__) || defined(__BIONIC__)
@@ -25,9 +22,8 @@ __attribute__((noopt)) void leak(int n) {
2522
// Repeat few times to make sure that at least one pointer is
2623
// not somewhere on the stack.
2724
for (int i = 0; i < 10; ++i) {
28-
t = new int[n];
29-
printf("t: %p\n", t);
30-
t = 0;
25+
volatile int *t = new int[n];
26+
t = nullptr;
3127
}
3228
}
3329

0 commit comments

Comments
 (0)