1 // Print matched suppressions only if print_suppressions=1 AND at least one is
2 // matched. Default is print_suppressions=true.
3 // RUN: %clangxx_lsan %s -o %t
4 // RUN: %env_lsan_opts=use_registers=0:use_stacks=0:print_suppressions=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
5 // RUN: %env_lsan_opts=use_registers=0:use_stacks=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
6 // RUN: %env_lsan_opts=use_registers=0:use_stacks=0:print_suppressions=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
7 // RUN: %env_lsan_opts=use_registers=0:use_stacks=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-print
12 #include "sanitizer/lsan_interface.h"
15 const char *__lsan_default_suppressions() {
16 return "leak:*LSanTestLeakingFunc*";
19 void LSanTestLeakingFunc() {
20 void *p
= malloc(666);
21 fprintf(stderr
, "Test alloc: %p.\n", p
);
24 int main(int argc
, char **argv
) {
25 printf("print for nonempty output\n");
27 LSanTestLeakingFunc();
30 // CHECK-print: Suppressions used:
31 // CHECK-print: 1 666 *LSanTestLeakingFunc*
32 // CHECK-dont-print-NOT: Suppressions used: