]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc
New upstream version 1.19.0+dfsg3
[rustc.git] / src / compiler-rt / test / lsan / TestCases / leak_check_at_exit.cc
CommitLineData
1a4d82fc
JJ
1// Test for the leak_check_at_exit flag.
2// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
3// RUN: %clangxx_lsan %s -o %t
4// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
5// RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-do
92a42be0
SL
6// RUN: LSAN_OPTIONS=$LSAN_BASE:"leak_check_at_exit=0" not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
7// RUN: LSAN_OPTIONS=$LSAN_BASE:"leak_check_at_exit=0" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont
1a4d82fc
JJ
8
9#include <stdio.h>
10#include <stdlib.h>
11#include <sanitizer/lsan_interface.h>
12
13int main(int argc, char *argv[]) {
14 fprintf(stderr, "Test alloc: %p.\n", malloc(1337));
15 if (argc > 1)
16 __lsan_do_leak_check();
17 return 0;
18}
19
20// CHECK-do: SUMMARY: {{(Leak|Address)}}Sanitizer:
21// CHECK-dont-NOT: SUMMARY: {{(Leak|Address)}}Sanitizer: