Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: LSAN_BASE="use_registers=0:use_stacks=0" |
| 2 | // RUN: %clangxx_lsan %s -o %t |
| 3 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 4 | // RUN: rm -f %t.supp |
| 5 | // RUN: touch %t.supp |
| 6 | // RUN: LSAN_OPTIONS="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s --check-prefix=NOSUPP |
| 7 | |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 8 | // RUN: echo "leak:*LSanTestLeakingFunc*" > %t.supp |
| 9 | // RUN: LSAN_OPTIONS="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 10 | |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 11 | // RUN: echo "leak:%t" > %t.supp |
| 12 | // RUN: LSAN_OPTIONS="$LSAN_BASE:suppressions='%t.supp':symbolize=false" %run %t |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 13 | |
| 14 | #include <stdio.h> |
| 15 | #include <stdlib.h> |
| 16 | |
| 17 | void LSanTestLeakingFunc() { |
| 18 | void *p = malloc(666); |
| 19 | fprintf(stderr, "Test alloc: %p.\n", p); |
| 20 | } |
| 21 | |
| 22 | int main() { |
| 23 | LSanTestLeakingFunc(); |
| 24 | void *q = malloc(1337); |
| 25 | fprintf(stderr, "Test alloc: %p.\n", q); |
| 26 | return 0; |
| 27 | } |
| 28 | // CHECK: Suppressions used: |
| 29 | // CHECK: 1 666 *LSanTestLeakingFunc* |
| 30 | // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s) |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 31 | |
| 32 | // NOSUPP: SUMMARY: {{(Leak|Address)}}Sanitizer: 2003 byte(s) leaked in 2 allocation(s). |