aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/quarantine_size_mb.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Linux/quarantine_size_mb.cc')
-rw-r--r--test/asan/TestCases/Linux/quarantine_size_mb.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/asan/TestCases/Linux/quarantine_size_mb.cc b/test/asan/TestCases/Linux/quarantine_size_mb.cc
new file mode 100644
index 000000000000..4499992444f9
--- /dev/null
+++ b/test/asan/TestCases/Linux/quarantine_size_mb.cc
@@ -0,0 +1,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