aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/coverage-and-lsan.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/coverage-and-lsan.cc')
-rw-r--r--test/asan/TestCases/coverage-and-lsan.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/asan/TestCases/coverage-and-lsan.cc b/test/asan/TestCases/coverage-and-lsan.cc
new file mode 100644
index 000000000000..f65889c0a1bf
--- /dev/null
+++ b/test/asan/TestCases/coverage-and-lsan.cc
@@ -0,0 +1,20 @@
+// Make sure coverage is dumped even if there are reported leaks.
+//
+// RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t
+//
+// RUN: rm -rf %T/coverage-and-lsan
+//
+// RUN: mkdir -p %T/coverage-and-lsan/normal
+// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:coverage=1:coverage_dir=%T/coverage-and-lsan:verbosity=1 not %run %t 2>&1 | FileCheck %s
+// RUN: %sancov print %T/coverage-and-lsan/*.sancov 2>&1
+//
+// REQUIRES: leak-detection
+
+int *g = new int;
+int main(int argc, char **argv) {
+ g = 0;
+ return 0;
+}
+
+// CHECK: LeakSanitizer: detected memory leaks
+// CHECK: CovDump: