blob: 1820cb90c4ef62a4dc28623615fb820a187ae7ec [file] [log] [blame]
Stephen Hines86277eb2015-03-23 12:06:32 -07001// Test quarantine_size_mb (and the deprecated quarantine_size)
2// RUN: %clangxx_asan %s -o %t
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -07003// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:quarantine_size=10485760:verbosity=1:hard_rss_limit_mb=50 %run %t 2>&1 | FileCheck %s --check-prefix=Q10
4// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:quarantine_size_mb=10:verbosity=1:hard_rss_limit_mb=50 %run %t 2>&1 | FileCheck %s --check-prefix=Q10
5// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:quarantine_size_mb=10:quarantine_size=20:verbosity=1 not %run %t 2>&1 | FileCheck %s --check-prefix=BOTH
6// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:quarantine_size_mb=1000:hard_rss_limit_mb=50 not %run %t 2>&1 | FileCheck %s --check-prefix=RSS_LIMIT
7// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:hard_rss_limit_mb=50 not %run %t 2>&1 | FileCheck %s --check-prefix=RSS_LIMIT
Stephen Hines86277eb2015-03-23 12:06:32 -07008#include <string.h>
9char *g;
10
11static const int kNumAllocs = 1 << 11;
12static const int kAllocSize = 1 << 20;
13
14int main() {
15 for (int i = 0; i < kNumAllocs; i++) {
16 g = new char[kAllocSize];
17 memset(g, -1, kAllocSize);
18 delete [] (g);
19 }
20}
21
22// Q10: quarantine_size_mb=10M
23// BOTH: please use either 'quarantine_size' (deprecated) or quarantine_size_mb, but not both
24// RSS_LIMIT: AddressSanitizer: hard rss limit exhausted