Move MSan lit-tests under test/msan
[blocksruntime.git] / lib / asan / lit_tests / TestCases / malloc_fill.cc
blob57f50d1438b79119e357ecf2e45a9ea7fa3d0e97
1 // Check that we fill malloc-ed memory correctly.
2 // RUN: %clangxx_asan %s -o %t
3 // RUN: %t | FileCheck %s
4 // RUN: ASAN_OPTIONS=max_malloc_fill_size=10:malloc_fill_byte=8 %t | FileCheck %s --check-prefix=CHECK-10-8
5 // RUN: ASAN_OPTIONS=max_malloc_fill_size=20:malloc_fill_byte=171 %t | FileCheck %s --check-prefix=CHECK-20-ab
7 #include <stdio.h>
8 int main(int argc, char **argv) {
9 // With asan allocator this makes sure we get memory from mmap.
10 static const int kSize = 1 << 25;
11 unsigned char *x = new unsigned char[kSize];
12 printf("-");
13 for (int i = 0; i <= 32; i++) {
14 printf("%02x", x[i]);
16 printf("-\n");
17 delete [] x;
20 // CHECK: -bebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebe-
21 // CHECK-10-8: -080808080808080808080000000000000000000000000000000000000000000000-
22 // CHECK-20-ab: -abababababababababababababababababababab00000000000000000000000000-