aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/quarantine_size_mb.cc
blob: 4499992444f9bebd3fbf3f036d3f5ebc148f36f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Test quarantine_size_mb (and the deprecated quarantine_size)
// RUN: %clangxx_asan  %s -o %t
// RUN: ASAN_OPTIONS=quarantine_size=10485760:verbosity=1:hard_rss_limit_mb=50 %run %t  2>&1  | FileCheck %s  --check-prefix=Q10
// RUN: ASAN_OPTIONS=quarantine_size_mb=10:verbosity=1:hard_rss_limit_mb=50    %run %t  2>&1  | FileCheck %s  --check-prefix=Q10
// RUN: ASAN_OPTIONS=quarantine_size_mb=10:quarantine_size=20:verbosity=1  not  %run %t  2>&1 | FileCheck %s  --check-prefix=BOTH
// RUN: ASAN_OPTIONS=quarantine_size_mb=1000:hard_rss_limit_mb=50 not  %run %t           2>&1 | FileCheck %s  --check-prefix=RSS_LIMIT
// RUN: ASAN_OPTIONS=hard_rss_limit_mb=50                         not  %run %t           2>&1 | FileCheck %s  --check-prefix=RSS_LIMIT
#include <string.h>
char *g;

static const int kNumAllocs = 1 << 11;
static const int kAllocSize = 1 << 20;

int main() {
  for (int i = 0; i < kNumAllocs; i++) {
    g = new char[kAllocSize];
    memset(g, -1, kAllocSize);
    delete [] (g);
  }
}

// Q10: quarantine_size_mb=10M
// BOTH: please use either 'quarantine_size' (deprecated) or quarantine_size_mb, but not both
// RSS_LIMIT: AddressSanitizer: hard rss limit exhausted