From 3bbf114266d8acae85f990a940ec6de1385dd057 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Wed, 17 Jan 2018 17:24:56 +0000 Subject: Revert "[libFuzzer] Support using libc++" This reverts commit r322604: test is failing for standalone compiler-rt. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322689 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/fuzzer/CMakeLists.txt | 69 +++++++++++++-------------------------------- test/fuzzer/lit.cfg | 11 ++------ test/fuzzer/lit.site.cfg.in | 2 -- 3 files changed, 22 insertions(+), 60 deletions(-) (limited to 'test') diff --git a/test/fuzzer/CMakeLists.txt b/test/fuzzer/CMakeLists.txt index 25b1a44de..bd5111232 100644 --- a/test/fuzzer/CMakeLists.txt +++ b/test/fuzzer/CMakeLists.txt @@ -8,65 +8,36 @@ if(COMPILER_RT_INCLUDE_TESTS) list(APPEND LIBFUZZER_TEST_DEPS FuzzerUnitTests) endif() -add_custom_target(check-fuzzer) +set(LIBFUZZER_TESTSUITES) + if(COMPILER_RT_INCLUDE_TESTS) # libFuzzer unit tests. configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/unit/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/unit/lit.site.cfg) - add_lit_testsuite(check-fuzzer-unit "Running Fuzzer unit tests" - ${CMAKE_CURRENT_BINARY_DIR}/unit - DEPENDS ${LIBFUZZER_TEST_DEPS}) - set_target_properties(check-fuzzer-unit PROPERTIES FOLDER "Compiler-RT Tests") - add_dependencies(check-fuzzer check-fuzzer-unit) + list(APPEND LIBFUZZER_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/unit) endif() -macro(test_fuzzer stdlib) - cmake_parse_arguments(TEST "" "" "DEPS" ${ARGN}) - string(REPLACE "+" "x" stdlib_name ${stdlib}) - string(REPLACE "-" ";" stdlib_list ${stdlib_name}) - set(STDLIB_CAPITALIZED "") - foreach(part IN LISTS stdlib_list) - string(SUBSTRING ${part} 0 1 first_letter) - string(TOUPPER ${first_letter} first_letter) - string(REGEX REPLACE "^.(.*)" "${first_letter}\\1" part "${part}") - set(STDLIB_CAPITALIZED "${STDLIB_CAPITALIZED}${part}") - endforeach() - foreach(arch ${FUZZER_SUPPORTED_ARCH}) - set(LIBFUZZER_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER}) - get_test_cc_for_arch(${arch} LIBFUZZER_TEST_COMPILER LIBFUZZER_TEST_FLAGS) - - set(LIBFUZZER_TEST_STDLIB ${stdlib}) - - string(TOUPPER ${arch} ARCH_UPPER_CASE) - set(CONFIG_NAME ${ARCH_UPPER_CASE}${STDLIB_CAPITALIZED}${OS_NAME}Config) +foreach(arch ${FUZZER_SUPPORTED_ARCH}) + set(LIBFUZZER_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER}) + get_test_cc_for_arch(${arch} LIBFUZZER_TEST_COMPILER LIBFUZZER_TEST_FLAGS) - # LIT-based libFuzzer tests. - configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg - ) + string(TOUPPER ${arch} ARCH_UPPER_CASE) + set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config) - add_lit_testsuite(check-fuzzer-${stdlib_name} "Running Fuzzer ${stdlib} tests" - ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME} - DEPENDS ${LIBFUZZER_TEST_DEPS}) - if(TEST_DEPS) - add_dependencies(check-fuzzer-${stdlib_name} ${TEST_DEPS}) - endif() - set_target_properties(check-fuzzer-${stdlib_name} PROPERTIES FOLDER "Compiler-RT Tests") - add_dependencies(check-fuzzer check-fuzzer-${stdlib_name}) - endforeach() -endmacro() + # LIT-based libFuzzer tests. + configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg + ) + list(APPEND LIBFUZZER_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}) -test_fuzzer("default") -if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - if(TARGET cxx_shared) - test_fuzzer("libc++" DEPS cxx_shared) - endif() - if(TARGET cxx_static) - test_fuzzer("static-libc++" DEPS cxx_static) - endif() -endif() +endforeach() set(EXCLUDE_FROM_ALL ON) + +add_lit_testsuite(check-fuzzer "Running Fuzzer tests" + ${LIBFUZZER_TESTSUITES} + DEPENDS ${LIBFUZZER_TEST_DEPS}) +set_target_properties(check-fuzzer PROPERTIES FOLDER "Compiler-RT Tests") diff --git a/test/fuzzer/lit.cfg b/test/fuzzer/lit.cfg index 8a1d3eeb9..19be31d1a 100644 --- a/test/fuzzer/lit.cfg +++ b/test/fuzzer/lit.cfg @@ -7,8 +7,6 @@ config.test_format = lit.formats.ShTest(True) config.suffixes = ['.test'] config.test_source_root = os.path.dirname(__file__) -config.environment['LD_LIBRARY_PATH'] = config.llvm_library_dir - # Choose between lit's internal shell pipeline runner and a real shell. If # LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override. use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL") @@ -53,13 +51,8 @@ config.substitutions.append(('%libfuzzer_src', libfuzzer_src_root)) def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True): compiler_cmd = config.c_compiler - if config.clang and config.stdlib == 'libc++': - link_cmd = '-stdlib=libc++' - elif config.clang and config.stdlib == 'static-libc++': - link_cmd = '-stdlib=libc++ -lc++abi -static-libstdc++' - else: - link_cmd = '-lc++' if any(x in config.target_triple for x in ('darwin', 'freebsd')) else '-lstdc++' - std_cmd = '--driver-mode=g++ -std=c++11' if is_cpp else '' + link_cmd = '-lc++' if any(x in config.target_triple for x in ('darwin', 'freebsd')) else '-lstdc++' + std_cmd = '-std=c++11' if is_cpp else '' sanitizers = ['address'] if fuzzer_enabled: sanitizers.append('fuzzer') diff --git a/test/fuzzer/lit.site.cfg.in b/test/fuzzer/lit.site.cfg.in index 41f146666..7f70c8f67 100644 --- a/test/fuzzer/lit.site.cfg.in +++ b/test/fuzzer/lit.site.cfg.in @@ -5,11 +5,9 @@ config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@" config.cpp_compiler = "@LIBFUZZER_TEST_COMPILER@" config.target_flags = "@LIBFUZZER_TEST_FLAGS@" config.c_compiler = "@LIBFUZZER_TEST_COMPILER@" -config.stdlib = "@LIBFUZZER_TEST_STDLIB@" config.osx_sysroot_flag = "@OSX_SYSROOT_FLAG@" config.cmake_binary_dir = "@CMAKE_BINARY_DIR@" -config.llvm_library_dir = "@LLVM_LIBRARY_DIR@" config.target_triple = "@TARGET_TRIPLE@" # Load common config for all compiler-rt lit tests. -- cgit v1.2.3