blob: 395386ab5cd27f365cb18889a09ed9e1bccb7176 [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001// FIXME: This test infinite loops on darwin because it crashes
2// printing a stack trace repeatedly
3UNSUPPORTED: darwin
4
5// Verifies lib/fuzzer/scripts/unbalanced_allocs.py script
6
7RUN: %cpp_compiler %S/TraceMallocTest.cpp -o %t-TraceMallocTest
8
Kaido Kert788710a2023-06-05 07:50:22 -07009# Specify python because we can't use the shebang line on Windows.
Andrew Top61a84952019-04-30 15:07:33 -070010RUN: %run %t-TraceMallocTest -seed=1 -trace_malloc=1 -runs=200 2>&1 | \
Kaido Kert788710a2023-06-05 07:50:22 -070011RUN: %python %libfuzzer_src/scripts/unbalanced_allocs.py --skip=5 | FileCheck %s
Andrew Top61a84952019-04-30 15:07:33 -070012
13RUN: %run %t-TraceMallocTest -seed=1 -trace_malloc=2 -runs=200 2>&1 | \
Kaido Kert788710a2023-06-05 07:50:22 -070014RUN: %python %libfuzzer_src/scripts/unbalanced_allocs.py --skip=5 | FileCheck %s --check-prefixes=CHECK,CHECK2
Andrew Top61a84952019-04-30 15:07:33 -070015
16CHECK: MallocFreeTracer: START
Kaido Kert788710a2023-06-05 07:50:22 -070017# Behavior of the format string "%p" is implementation defined. Account for the
18# implementation on Windows and Linux.
19CHECK: Unbalanced MALLOC[{{[0-9]+}}] [[PTR:(:?0x)?[0-9a-fA-F]+]] 4
Andrew Top61a84952019-04-30 15:07:33 -070020CHECK2-NEXT: {{ #0 0x[0-9a-f]+ in }}
21CHECK2-NEXT: {{ #1 0x[0-9a-f]+ in }}
22CHECK2-NEXT: {{ #2 0x[0-9a-f]+ in }}
23CHECK: MallocFreeTracer: STOP
24
25CHECK: MallocFreeTracer: START
26CHECK: Unbalanced FREE[{{[0-9]+}}] [[PTR]]
27CHECK2-NEXT: {{ #0 0x[0-9a-f]+ in }}
28CHECK2-NEXT: {{ #1 0x[0-9a-f]+ in }}
29CHECK2-NEXT: {{ #2 0x[0-9a-f]+ in }}
30CHECK: MallocFreeTracer: STOP