Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Linux / small_quarantine_size_mb.cpp
blob35182296aaa97e78e04ef85a1e21671660ab44c8
1 // RUN: %clangxx_asan %s -o %t
2 // RUN: %env_asan_opts=quarantine_size_mb=2 %run %t 1
3 // RUN: %env_asan_opts=quarantine_size_mb=2 %run %t 4
5 #include <cassert>
6 #include <sanitizer/allocator_interface.h>
7 #include <stdio.h>
8 #include <stdlib.h>
10 void *g;
12 int main(int argc, char **argv) {
13 int s = atoi(argv[1]) * 1024 * 1024;
14 int a = __sanitizer_get_heap_size();
15 g = malloc(s);
16 int b = __sanitizer_get_heap_size();
17 assert(b - a > s / 2);
18 free(g);
19 int c = __sanitizer_get_heap_size();
20 fprintf(stderr, "%d %d\n", a, c);
21 if (atoi(argv[1]) == 1)
22 assert(c - a > s / 2); // NODRAIN
23 else
24 assert(c - a < s / 2); // DRAIN