From 95c57718162a15a050dbcba0f448ab532f761f51 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 22 Mar 2016 00:11:51 +0000 Subject: Fix coverage-related asan tests for VS 2015 printf is an inline function in VS 2015, giving these tests an unexpected extra point of coverage. This change works around that by avoiding printf. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264010 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/asan/TestCases/Windows/coverage-basic.cc | 4 ++-- test/asan/TestCases/coverage-reset.cc | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'test/asan') diff --git a/test/asan/TestCases/Windows/coverage-basic.cc b/test/asan/TestCases/Windows/coverage-basic.cc index 0ff105d16..918872f18 100644 --- a/test/asan/TestCases/Windows/coverage-basic.cc +++ b/test/asan/TestCases/Windows/coverage-basic.cc @@ -6,8 +6,8 @@ // RUN: %sancov print *.sancov | FileCheck %s #include -void foo() { fprintf(stderr, "FOO\n"); } -void bar() { fprintf(stderr, "BAR\n"); } +void foo() { fputs("FOO", stderr); } +void bar() { fputs("BAR", stderr); } int main(int argc, char **argv) { if (argc == 2) { diff --git a/test/asan/TestCases/coverage-reset.cc b/test/asan/TestCases/coverage-reset.cc index eb8da8c1a..11c5ef66e 100644 --- a/test/asan/TestCases/coverage-reset.cc +++ b/test/asan/TestCases/coverage-reset.cc @@ -13,6 +13,13 @@ static volatile int sink; __attribute__((noinline)) void bar() { sink = 2; } __attribute__((noinline)) void foo() { sink = 1; } +// In MSVC 2015, printf is an inline function, which causes this test to fail as +// it introduces an extra coverage point. Define away printf on that platform to +// avoid the issue. +#if _MSC_VER >= 1900 +# define printf(arg, ...) +#endif + #define GET_AND_PRINT_COVERAGE() \ bitset = 0; \ for (size_t i = 0; i < n_guards; i++) \ -- cgit v1.2.3