]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Print matched suppressions only if print_suppressions=1 AND at least one is |
2 | // matched. Default is print_suppressions=true. | |
3 | // RUN: LSAN_BASE="use_registers=0:use_stacks=0" | |
4 | // RUN: %clangxx_lsan %s -o %t | |
2c00a5a8 XL |
5 | // RUN: %env_lsan_opts=$LSAN_BASE:print_suppressions=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print |
6 | // RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print | |
7 | // RUN: %env_lsan_opts=$LSAN_BASE:print_suppressions=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print | |
8 | // RUN: %env_lsan_opts=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-print | |
1a4d82fc JJ |
9 | |
10 | #include <stdio.h> | |
11 | #include <stdlib.h> | |
12 | ||
13 | #include "sanitizer/lsan_interface.h" | |
14 | ||
15 | extern "C" | |
16 | const char *__lsan_default_suppressions() { | |
17 | return "leak:*LSanTestLeakingFunc*"; | |
18 | } | |
19 | ||
20 | void LSanTestLeakingFunc() { | |
21 | void *p = malloc(666); | |
22 | fprintf(stderr, "Test alloc: %p.\n", p); | |
23 | } | |
24 | ||
25 | int main(int argc, char **argv) { | |
26 | printf("print for nonempty output\n"); | |
27 | if (argc > 1) | |
28 | LSanTestLeakingFunc(); | |
29 | return 0; | |
30 | } | |
31 | // CHECK-print: Suppressions used: | |
32 | // CHECK-print: 1 666 *LSanTestLeakingFunc* | |
33 | // CHECK-dont-print-NOT: Suppressions used: |