1 | // Test retries option of lsan. |
2 | // RUN: %clang_lsan %s -o %t |
3 | // RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0 %run %t foo 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK1 |
4 | // RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0:tries=12 %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK12 |
5 | |
6 | #include <assert.h> |
7 | #include <sanitizer/lsan_interface.h> |
8 | #include <stdio.h> |
9 | #include <stdlib.h> |
10 | #include <unistd.h> |
11 | |
12 | void *p; |
13 | |
14 | int main(int argc, char *argv[]) { |
15 | fprintf(stderr, format: "Test alloc: %p.\n" , malloc(size: 1337)); |
16 | // CHECK: Test alloc: |
17 | |
18 | assert(__lsan_do_recoverable_leak_check() == 1); |
19 | // CHECK1-COUNT-1: SUMMARY: {{.*}}Sanitizer: 1337 byte |
20 | // CHECK12-COUNT-12: SUMMARY: {{.*}}Sanitizer: 1337 byte |
21 | |
22 | _exit(status: 0); |
23 | } |
24 | |