summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-03-22 00:11:51 +0000
committerReid Kleckner <rnk@google.com>2016-03-22 00:11:51 +0000
commitc35d402aeb5736ebd3ce003861a006048a84810e (patch)
tree4051d76a1bc6739901c26f233a691e569103e1b9 /compiler-rt/test
parent717d2b0a0dd420fa7734396b89b22c03bb572be9 (diff)
downloadbcm5719-llvm-c35d402aeb5736ebd3ce003861a006048a84810e.tar.gz
bcm5719-llvm-c35d402aeb5736ebd3ce003861a006048a84810e.zip
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. llvm-svn: 264010
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc4
-rw-r--r--compiler-rt/test/asan/TestCases/coverage-reset.cc7
2 files changed, 9 insertions, 2 deletions
diff --git a/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc b/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc
index 0ff105d1624..918872f18f9 100644
--- a/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc
+++ b/compiler-rt/test/asan/TestCases/Windows/coverage-basic.cc
@@ -6,8 +6,8 @@
// RUN: %sancov print *.sancov | FileCheck %s
#include <stdio.h>
-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/compiler-rt/test/asan/TestCases/coverage-reset.cc b/compiler-rt/test/asan/TestCases/coverage-reset.cc
index eb8da8c1aa0..11c5ef66ecf 100644
--- a/compiler-rt/test/asan/TestCases/coverage-reset.cc
+++ b/compiler-rt/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++) \
OpenPOWER on IntegriCloud