diff options
| author | Matt Morehouse <mascasa@google.com> | 2018-08-29 18:08:34 +0000 |
|---|---|---|
| committer | Matt Morehouse <mascasa@google.com> | 2018-08-29 18:08:34 +0000 |
| commit | 245ebd71ef2f4c015a58fe0c6c625fb650bbf502 (patch) | |
| tree | 4015cbf26ed70bc484f6b23dc76b7c01fd7c23aa /compiler-rt/lib/fuzzer/tests | |
| parent | 22e0bdf4ed81bca641203d8f4ac3e632b4f13259 (diff) | |
| download | bcm5719-llvm-245ebd71ef2f4c015a58fe0c6c625fb650bbf502.tar.gz bcm5719-llvm-245ebd71ef2f4c015a58fe0c6c625fb650bbf502.zip | |
[libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.
Reviewers: morehouse, rnk
Reviewed By: morehouse, rnk
Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman
Differential Revision: https://reviews.llvm.org/D51022
llvm-svn: 340949
Diffstat (limited to 'compiler-rt/lib/fuzzer/tests')
| -rw-r--r-- | compiler-rt/lib/fuzzer/tests/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt index ed580716830..0b561c170ec 100644 --- a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt @@ -17,6 +17,8 @@ list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS --driver-mode=g++) if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lc++ -lpthread) +elseif(WIN32) + list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lstdc++) else() list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lstdc++ -lpthread) endif() diff --git a/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp b/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp index e3b06702603..7cdd4458232 100644 --- a/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp +++ b/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp @@ -34,6 +34,13 @@ TEST(Fuzzer, Basename) { EXPECT_EQ(Basename("/bar"), "bar"); EXPECT_EQ(Basename("foo/x"), "x"); EXPECT_EQ(Basename("foo/"), ""); +#if LIBFUZZER_WINDOWS + EXPECT_EQ(Basename("foo\\bar"), "bar"); + EXPECT_EQ(Basename("foo\\bar/baz"), "baz"); + EXPECT_EQ(Basename("\\bar"), "bar"); + EXPECT_EQ(Basename("foo\\x"), "x"); + EXPECT_EQ(Basename("foo\\"), ""); +#endif } TEST(Fuzzer, CrossOver) { |

