From 8f40f03024f7257140afcc47effa681f0cd63956 Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Thu, 9 Apr 2015 15:58:38 +0000 Subject: [PATCH] [ASan/Win] Add a test that makes sure coverage works at least in the simple cases llvm-svn: 234496 --- .../asan/TestCases/Windows/coverage-basic.cc | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc diff --git a/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc b/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc new file mode 100644 index 000000000000..3081d7cdee60 --- /dev/null +++ b/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc @@ -0,0 +1,25 @@ +// RUN: rm -rf %T/coverage-basic +// RUN: mkdir %T/coverage-basic && cd %T/coverage-basic +// RUN: %clangxx_asan -fsanitize-coverage=1 %s -o test.exe +// RUN: env ASAN_OPTIONS=coverage=1 %run test.exe +// +// RUN: %sancov print *.sancov | FileCheck %s +#include + +void foo() { fprintf(stderr, "FOO\n"); } +void bar() { fprintf(stderr, "BAR\n"); } + +int main(int argc, char **argv) { + if (argc == 2) { + foo(); + bar(); + } else { + bar(); + foo(); + } +} + +// CHECK: 0x{{[0-9a-f]*}} +// CHECK: 0x{{[0-9a-f]*}} +// CHECK: 0x{{[0-9a-f]*}} +// CHECK-NOT: 0x{{[0-9a-f]*}}