summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Metzman <metzman@chromium.org>2018-09-07 01:11:31 +0000
committerJonathan Metzman <metzman@chromium.org>2018-09-07 01:11:31 +0000
commit6167c4ee74fc6109569fd4dd10115387c81f80a5 (patch)
tree7428141edf84cc42bd44314731fe4376d0e875e0
parentbb313b797dbdda4d2a18ed409bafe9dd559789c3 (diff)
downloadbcm5719-llvm-6167c4ee74fc6109569fd4dd10115387c81f80a5.tar.gz
bcm5719-llvm-6167c4ee74fc6109569fd4dd10115387c81f80a5.zip
[libfuzzer] Use cl driver mode for tests and enable another test on Windows
Summary: When targeting MSVC: compile using clang's cl driver mode (this is needed for libfuzzer's exit_on_src_pos feature). Don't use -lstdc++ when linking, it isn't needed and causes a warning. On Windows: Fix exit_on_src_pos.test by making sure debug info isn't overwritten during compilation of second binary by using .exe extension. Reviewers: morehouse Reviewed By: morehouse Subscribers: aprantl, JDevlieghere Differential Revision: https://reviews.llvm.org/D51757 llvm-svn: 341622
-rw-r--r--compiler-rt/test/fuzzer/exit_on_src_pos.test12
-rw-r--r--compiler-rt/test/fuzzer/lit.cfg6
2 files changed, 11 insertions, 7 deletions
diff --git a/compiler-rt/test/fuzzer/exit_on_src_pos.test b/compiler-rt/test/fuzzer/exit_on_src_pos.test
index 02bb0c9afdf..c08c01410e2 100644
--- a/compiler-rt/test/fuzzer/exit_on_src_pos.test
+++ b/compiler-rt/test/fuzzer/exit_on_src_pos.test
@@ -1,11 +1,11 @@
-# FIXME: Disabled on Windows until symbolization works properly.
-UNSUPPORTED: windows
# Temporary use -mllvm -use-unknown-locations=Disable so that
# all instructions have debug info (file line numbers) attached.
# TODO: Find out why test fails on Darwin with -O2.
-RUN: %cpp_compiler -O0 %S/SimpleTest.cpp -o %t-SimpleTest -mllvm -use-unknown-locations=Disable
-RUN: %cpp_compiler -O0 %S/ShrinkControlFlowTest.cpp -o %t-ShrinkControlFlowTest
+# Binaries must end in .exe or else symbolization will break on Windows because of how periods
+# in expansion of %t cause the compiler to overwrite .lib and .exp files.
+RUN: %cpp_compiler -O0 %S/SimpleTest.cpp -o %t-SimpleTest.exe -mllvm -use-unknown-locations=Disable
+RUN: %cpp_compiler -O0 %S/ShrinkControlFlowTest.cpp -o %t-ShrinkControlFlowTest.exe
-RUN: %run %t-SimpleTest -exit_on_src_pos=SimpleTest.cpp:18 2>&1 | FileCheck %s --check-prefix=EXIT_ON_SRC_POS
-RUN: %run %t-ShrinkControlFlowTest -exit_on_src_pos=Foo 2>&1 | FileCheck %s --check-prefix=EXIT_ON_SRC_POS
+RUN: %run %t-SimpleTest.exe -exit_on_src_pos=SimpleTest.cpp:18 2>&1 | FileCheck %s --check-prefix=EXIT_ON_SRC_POS
+RUN: %run %t-ShrinkControlFlowTest.exe -exit_on_src_pos=Foo 2>&1 | FileCheck %s --check-prefix=EXIT_ON_SRC_POS
EXIT_ON_SRC_POS: INFO: found line matching '{{.*}}', exiting.
diff --git a/compiler-rt/test/fuzzer/lit.cfg b/compiler-rt/test/fuzzer/lit.cfg
index 81e73c21244..dff48cac2eb 100644
--- a/compiler-rt/test/fuzzer/lit.cfg
+++ b/compiler-rt/test/fuzzer/lit.cfg
@@ -69,10 +69,14 @@ def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False):
config.runtime_library_dir)
elif any(x in config.target_triple for x in ('darwin', 'freebsd')):
link_cmd = '-lc++'
+ elif 'windows-msvc' in config.target_triple:
+ link_cmd = ''
else:
link_cmd = '-lstdc++'
- if is_cpp and not sys.platform.startswith('win'):
+ if is_cpp and 'windows-msvc' in config.target_triple:
+ std_cmd = '--driver-mode=cl'
+ elif is_cpp:
std_cmd = '--driver-mode=g++ -std=c++11'
else:
std_cmd = ''
OpenPOWER on IntegriCloud