[compiler-rt] r333241 - [libFuzzer] Run libFuzzer unit tests only on host architecture.
George Karpenkov via llvm-commits
llvm-commits at lists.llvm.org
Thu May 24 16:55:52 PDT 2018
Author: george.karpenkov
Date: Thu May 24 16:55:52 2018
New Revision: 333241
URL: http://llvm.org/viewvc/llvm-project?rev=333241&view=rev
Log:
[libFuzzer] Run libFuzzer unit tests only on host architecture.
LIT tests are used to test other cross-compiled architectures,
unit tests are only run on the host.
NFC now as currently only a single architecture is supported.
Differential Revision: https://reviews.llvm.org/D47286
Modified:
compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt
Modified: compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt?rev=333241&r1=333240&r2=333241&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt Thu May 24 16:55:52 2018
@@ -22,35 +22,36 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linu
list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++ -D_LIBCPP_ABI_VERSION=Fuzzer)
endif()
-foreach(arch ${FUZZER_SUPPORTED_ARCH})
- set(LIBFUZZER_TEST_RUNTIME RTFuzzerTest.${arch})
- if(APPLE)
- set(LIBFUZZER_TEST_RUNTIME_OBJECTS
- $<TARGET_OBJECTS:RTfuzzer.osx>)
- else()
- set(LIBFUZZER_TEST_RUNTIME_OBJECTS
- $<TARGET_OBJECTS:RTfuzzer.${arch}>)
- endif()
- add_library(${LIBFUZZER_TEST_RUNTIME} STATIC
- ${LIBFUZZER_TEST_RUNTIME_OBJECTS})
- set_target_properties(${LIBFUZZER_TEST_RUNTIME} PROPERTIES
- ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- FOLDER "Compiler-RT Runtime tests")
+# libFuzzer unit tests are only run on the host machine.
+set(arch "x86_64")
- if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
- set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build)
- set(LIBFUZZER_TEST_RUNTIME_CFLAGS -isystem ${COMPILER_RT_LIBCXX_PATH}/include)
- set(LIBFUZZER_TEST_RUNTIME_LINK_FLAGS ${LIBCXX_${arch}_PREFIX}/lib/libc++.a)
- endif()
+set(LIBFUZZER_TEST_RUNTIME RTFuzzerTest.${arch})
+if(APPLE)
+ set(LIBFUZZER_TEST_RUNTIME_OBJECTS
+ $<TARGET_OBJECTS:RTfuzzer.osx>)
+else()
+ set(LIBFUZZER_TEST_RUNTIME_OBJECTS
+ $<TARGET_OBJECTS:RTfuzzer.${arch}>)
+endif()
+add_library(${LIBFUZZER_TEST_RUNTIME} STATIC
+ ${LIBFUZZER_TEST_RUNTIME_OBJECTS})
+set_target_properties(${LIBFUZZER_TEST_RUNTIME} PROPERTIES
+ ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ FOLDER "Compiler-RT Runtime tests")
+
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
+ set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build)
+ set(LIBFUZZER_TEST_RUNTIME_CFLAGS -isystem ${COMPILER_RT_LIBCXX_PATH}/include)
+ set(LIBFUZZER_TEST_RUNTIME_LINK_FLAGS ${LIBCXX_${arch}_PREFIX}/lib/libc++.a)
+endif()
- set(FuzzerTestObjects)
- generate_compiler_rt_tests(FuzzerTestObjects
- FuzzerUnitTests "Fuzzer-${arch}-Test" ${arch}
- SOURCES FuzzerUnittest.cpp ${COMPILER_RT_GTEST_SOURCE}
- RUNTIME ${LIBFUZZER_TEST_RUNTIME}
- DEPS gtest ${LIBFUZZER_TEST_RUNTIME_DEPS}
- CFLAGS ${LIBFUZZER_UNITTEST_CFLAGS} ${LIBFUZZER_TEST_RUNTIME_CFLAGS}
- LINK_FLAGS ${LIBFUZZER_UNITTEST_LINK_FLAGS} ${LIBFUZZER_TEST_RUNTIME_LINK_FLAGS})
- set_target_properties(FuzzerUnitTests PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-endforeach()
+set(FuzzerTestObjects)
+generate_compiler_rt_tests(FuzzerTestObjects
+ FuzzerUnitTests "Fuzzer-${arch}-Test" ${arch}
+ SOURCES FuzzerUnittest.cpp ${COMPILER_RT_GTEST_SOURCE}
+ RUNTIME ${LIBFUZZER_TEST_RUNTIME}
+ DEPS gtest ${LIBFUZZER_TEST_RUNTIME_DEPS}
+ CFLAGS ${LIBFUZZER_UNITTEST_CFLAGS} ${LIBFUZZER_TEST_RUNTIME_CFLAGS}
+ LINK_FLAGS ${LIBFUZZER_UNITTEST_LINK_FLAGS} ${LIBFUZZER_TEST_RUNTIME_LINK_FLAGS})
+set_target_properties(FuzzerUnitTests PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
More information about the llvm-commits
mailing list