diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake index dbd0cfe5b4e76..ada6b575d1746 100644 --- a/libc/cmake/modules/LLVMLibCTestRules.cmake +++ b/libc/cmake/modules/LLVMLibCTestRules.cmake @@ -273,7 +273,9 @@ function(create_libc_unittest fq_target_name) endif() get_fq_deps_list(fq_deps_list ${LIBC_UNITTEST_DEPENDS}) - if(NOT LIBC_UNITTEST_C_TEST) + if(LIBC_UNITTEST_C_TEST) + list(APPEND fq_deps_list libc.test.UnitTest.LibcCTest) + else() list(APPEND fq_deps_list libc.src.__support.StringUtil.error_to_string libc.test.UnitTest.ErrnoSetterMatcher) endif() @@ -298,6 +300,11 @@ function(create_libc_unittest fq_target_name) endif() endif() + list(APPEND fq_deps_list libc.test.UnitTest.LibcTest) + if(NOT LIBC_UNITTEST_C_TEST) + list(APPEND fq_deps_list libc.test.UnitTest.LibcDeathTestExecutors) + endif() + get_object_files_for_test( link_object_files skipped_entrypoints_list ${fq_deps_list}) if(skipped_entrypoints_list) @@ -365,12 +372,6 @@ function(create_libc_unittest fq_target_name) ${fq_deps_list} ) - # LibcTest should not depend on anything in LINK_LIBRARIES. - list(APPEND link_libraries LibcTest) - if(NOT LIBC_UNITTEST_C_TEST) - list(APPEND link_libraries LibcDeathTestExecutors) - endif() - target_link_libraries(${fq_build_target_name} PRIVATE ${link_libraries}) if(NOT LIBC_UNITTEST_NO_RUN_POSTBUILD) @@ -784,7 +785,13 @@ function(add_libc_hermetic test_name) libc.src.string.memset libc.src.strings.bcmp libc.src.strings.bzero + libc.test.UnitTest.ErrnoSetterMatcher + libc.test.UnitTest.LibcTest + libc.test.UnitTest.HermeticTestUtils ) + if(HERMETIC_TEST_C_TEST) + list(APPEND fq_deps_list libc.test.UnitTest.LibcCTest) + endif() if(LIBC_TARGET_ARCHITECTURE_IS_AARCH64 AND NOT(LIBC_TARGET_OS_IS_BAREMETAL)) list(APPEND fq_deps_list libc.src.sys.auxv.getauxval) endif() @@ -792,6 +799,7 @@ function(add_libc_hermetic test_name) # Syscalls used by death tests. if(LIBC_TEST_SUBPROCESS_TESTS AND NOT HERMETIC_TEST_C_TEST) list(APPEND fq_deps_list + libc.test.UnitTest.LibcDeathTestExecutors libc.src.poll.poll libc.src.signal.kill libc.src.stdio.fflush @@ -918,19 +926,9 @@ function(add_libc_hermetic test_name) libc.startup.${LIBC_TARGET_OS}.crt1 ${HERMETIC_TEST_LINK_LIBRARIES} ${fq_target_name}.__libc__ - LibcHermeticTestSupport - # Working around dependency issues caused by compiler introduced libcalls. - # We need to repeat the libc target so that we can resolve libcalls which - # pull in functions from LibcHermeticTestSupport (which then foward to - # internal implementations). - # TODO: clean this up - ${fq_target_name}.__libc__ ${compiler_runtime} ) - add_dependencies(${fq_build_target_name} - LibcTest - libc.test.UnitTest.ErrnoSetterMatcher - ${fq_deps_list}) + add_dependencies(${fq_build_target_name} ${fq_deps_list}) if(NOT HERMETIC_TEST_NO_RUN_POSTBUILD) if(LIBC_TEST_CMD) @@ -1017,13 +1015,7 @@ function(add_libc_test test_name) ) if(LLVM_LIBC_FULL_BUILD) if(NOT LIBC_TEST_OVERLAY_BUILD_ONLY) - add_libc_hermetic( - ${test_name} - LINK_LIBRARIES - LibcTest - LibcDeathTestExecutors - ${LIBC_TEST_UNPARSED_ARGUMENTS} - ) + add_libc_hermetic(${test_name} ${LIBC_TEST_UNPARSED_ARGUMENTS}) endif() else() # Overlay mode @@ -1049,12 +1041,11 @@ function(add_libc_multi_impl_test name suite) ${suite} COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_NATIVE} - LINK_LIBRARIES - LibcMemoryHelpers ${ARGN} DEPENDS ${fq_config_name} libc.src.__support.macros.sanitizer + libc.test.UnitTest.MemoryMatcher ) get_fq_target_name(${fq_config_name}_test fq_target_name) else() diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt index 5acf76251b44b..7c7e538e69453 100644 --- a/libc/test/UnitTest/CMakeLists.txt +++ b/libc/test/UnitTest/CMakeLists.txt @@ -1,9 +1,17 @@ -function(add_unittest_framework_library name) +function(add_unittest_framework_library target_name) + add_target_with_flags( + ${target_name} + CREATE_TARGET _create_unittest_framework_library + ${ARGN} + ) +endfunction() + +function(_create_unittest_framework_library fq_target_name) cmake_parse_arguments( "TEST_LIB" "" # No optional arguments "" # No single value arguments - "SRCS;HDRS;DEPENDS;COMPILE_OPTIONS" # Multi value arguments + "SRCS;HDRS;DEPENDS;COMPILE_OPTIONS;FLAGS" # Multi value arguments ${ARGN} ) if(NOT TEST_LIB_SRCS) @@ -11,16 +19,18 @@ function(add_unittest_framework_library name) "header only libraries, use 'add_header_library'") endif() + get_fq_deps_list(fq_deps_list ${TEST_LIB_DEPENDS}) + add_library( - ${name} - STATIC + ${fq_target_name} + OBJECT EXCLUDE_FROM_ALL ${TEST_LIB_SRCS} ${TEST_LIB_HDRS} ) - target_include_directories(${name} PRIVATE ${LIBC_SOURCE_DIR}) + target_include_directories(${fq_target_name} PRIVATE ${LIBC_SOURCE_DIR}) if(TARGET libc.src.time.clock) - target_compile_definitions(${name} PRIVATE TARGET_SUPPORTS_CLOCK) + target_compile_definitions(${fq_target_name} PRIVATE TARGET_SUPPORTS_CLOCK) endif() # Find out if the target supports catching signals. @@ -36,24 +46,33 @@ function(add_unittest_framework_library name) set(no_signal TRUE) endif() if(NOT no_signal) - target_compile_definitions(${name} PRIVATE TARGET_SUPPORTS_SIGNAL_CATCHING) + target_compile_definitions(${fq_target_name} PRIVATE TARGET_SUPPORTS_SIGNAL_CATCHING) endif() if(LLVM_LIBC_FULL_BUILD) - _get_hermetic_test_compile_options(compile_options "" "") - target_compile_options(${name} PRIVATE ${compile_options} -nostdinc++) + _get_hermetic_test_compile_options(compile_options "" "${TEST_LIB_FLAGS}") + target_compile_options(${fq_target_name} PRIVATE ${compile_options} -nostdinc++) else() - _get_common_test_compile_options(compile_options "" "") + _get_common_test_compile_options(compile_options "" "${TEST_LIB_FLAGS}") if(TEST_LIB_COMPILE_OPTIONS) list(APPEND compile_options ${TEST_LIB_COMPILE_OPTIONS}) endif() - target_compile_options(${name} PRIVATE ${compile_options}) + target_compile_options(${fq_target_name} PRIVATE ${compile_options}) endif() - if(TEST_LIB_DEPENDS) - add_dependencies(${name} ${TEST_LIB_DEPENDS}) + if(fq_deps_list) + add_dependencies(${fq_target_name} ${fq_deps_list}) + target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list}) endif() + set_target_properties( + ${fq_target_name} + PROPERTIES + DEPS "${fq_deps_list}" + FLAGS "${ADD_OBJECT_FLAGS}" + TARGET_TYPE ${OBJECT_LIBRARY_TARGET_TYPE} + OBJECT_FILES "$" + ) endfunction() if(NOT TARGET libc.src.__support.OSUtil.osutil OR NOT LLVM_LIBC_FULL_BUILD) @@ -69,12 +88,10 @@ add_unittest_framework_library( LibcTest SRCS CmakeFilePath.cpp - LibcCTest.cpp LibcTest.cpp LibcTestMain.cpp TestLogger.cpp HDRS - LibcCTest.h LibcTest.h Test.h TestLogger.h @@ -94,13 +111,21 @@ add_unittest_framework_library( ${test_logger_osutil} ) -set(libc_death_test_srcs LibcDeathTestExecutors.cpp) -set(libc_death_test_deps - libc.hdr.stdint_proxy - libc.src.__support.libc_assert +add_unittest_framework_library( + LibcCTest + SRCS + LibcCTest.cpp + HDRS + LibcCTest.h + DEPENDS + .LibcTest ) + if(LIBC_TEST_SUBPROCESS_TESTS) - list(APPEND libc_death_test_srcs ExecuteFunctionUnix.cpp) + set(libc_death_test_deps + libc.hdr.stdint_proxy + libc.src.__support.libc_assert + ) if(LLVM_LIBC_FULL_BUILD) list(APPEND libc_death_test_deps libc.include.llvm-libc-macros.poll-macros @@ -110,20 +135,28 @@ if(LIBC_TEST_SUBPROCESS_TESTS) libc.include.llvm-libc-types.struct_pollfd ) endif() + add_unittest_framework_library( + LibcDeathTestExecutors + SRCS + ExecuteFunctionUnix.cpp + LibcDeathTestExecutors.cpp + HDRS + ExecuteFunction.h + DEPENDS + ${libc_death_test_deps} + ) +else() + add_header_library( + LibcDeathTestExecutors + HDRS + ExecuteFunction.h + DEPENDS + libc.hdr.stdint_proxy + ) endif() add_unittest_framework_library( - LibcDeathTestExecutors - SRCS - ${libc_death_test_srcs} - HDRS - ExecuteFunction.h - DEPENDS - ${libc_death_test_deps} -) - -add_unittest_framework_library( - LibcHermeticTestSupport + HermeticTestUtils SRCS HermeticTestUtils.cpp DEPENDS @@ -141,7 +174,7 @@ add_header_library( ) add_unittest_framework_library( - LibcFPTestHelpers + FPTestHelpers SRCS FEnvSafeTest.cpp RoundingModeUtils.cpp @@ -150,9 +183,9 @@ add_unittest_framework_library( FPMatcher.h RoundingModeUtils.h DEPENDS - LibcTest - libc.test.UnitTest.ErrnoCheckingTest - libc.test.UnitTest.string_utils + .LibcTest + .ErrnoCheckingTest + .string_utils libc.src.__support.CPP.array libc.src.__support.FPUtil.fp_bits libc.src.__support.FPUtil.fpbits_str @@ -161,56 +194,56 @@ add_unittest_framework_library( ) add_unittest_framework_library( - LibcFPExceptionHelpers + FPExceptMatcher SRCS FPExceptMatcher.cpp HDRS FPExceptMatcher.h DEPENDS - LibcTest + .LibcTest libc.src.__support.FPUtil.fp_bits libc.src.__support.FPUtil.fenv_impl libc.hdr.types.fenv_t ) add_unittest_framework_library( - LibcMemoryHelpers + MemoryMatcher SRCS MemoryMatcher.cpp HDRS MemoryMatcher.h DEPENDS - LibcTest + .LibcTest libc.src.__support.CPP.span ) add_unittest_framework_library( - LibcPrintfHelpers + PrintfMatcher SRCS PrintfMatcher.cpp HDRS PrintfMatcher.h DEPENDS - LibcTest + .LibcTest + .string_utils libc.hdr.stdint_proxy libc.src.__support.FPUtil.fp_bits libc.src.__support.printf_core.core_structs libc.src.__support.printf_core.printf_config - libc.test.UnitTest.string_utils ) add_unittest_framework_library( - LibcScanfHelpers + ScanfMatcher SRCS ScanfMatcher.cpp HDRS ScanfMatcher.h DEPENDS - LibcTest + .LibcTest + .string_utils libc.hdr.stdint_proxy libc.src.__support.FPUtil.fp_bits libc.src.stdio.scanf_core.core_structs - libc.test.UnitTest.string_utils ) add_header_library( diff --git a/libc/test/include/sched_test.cpp b/libc/test/include/sched_test.cpp index 0838dbf24ad4c..b35e917094ba8 100644 --- a/libc/test/include/sched_test.cpp +++ b/libc/test/include/sched_test.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "test/UnitTest/Test.h" #include template struct SameType { @@ -16,19 +17,22 @@ template struct SameType { static constexpr bool value = true; }; -// Use unevaluated contexts to verify the public macro declarations without -// requiring this include test to link the helper entrypoints. -static_assert(SameType::value, ""); -static_assert(SameType::value, ""); -static_assert(SameType::value, ""); -static_assert(SameType::value, ""); +TEST(LlvmLibcSchedTest, HeaderInterface) { + // Use unevaluated contexts to verify the public macro declarations without + // requiring this include test to link the helper entrypoints. + static_assert(SameType::value, ""); + static_assert(SameType::value, ""); + static_assert(SameType::value, + ""); + static_assert(SameType::value, + ""); -using SchedGetSchedulerT = int(pid_t) noexcept; -using SchedSetSchedulerT = int(pid_t, int, const struct sched_param *) noexcept; + using SchedGetSchedulerT = int(pid_t) noexcept; + using SchedSetSchedulerT = + int(pid_t, int, const struct sched_param *) noexcept; -static_assert(SameType::value, - ""); -static_assert(SameType::value, - ""); - -extern "C" int main() { return 0; } + static_assert( + SameType::value, ""); + static_assert( + SameType::value, ""); +} diff --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt index 978446dba3837..cdd262aa36473 100644 --- a/libc/test/src/CMakeLists.txt +++ b/libc/test/src/CMakeLists.txt @@ -50,9 +50,8 @@ function(add_fp_unittest name) list(APPEND MATH_UNITTEST_LINK_LIBRARIES -latomic) endif() endif() - list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers) - set(deps libc.hdr.math_macros) + set(deps libc.hdr.math_macros libc.test.UnitTest.FPTestHelpers) if(MATH_UNITTEST_DEPENDS) list(APPEND deps ${MATH_UNITTEST_DEPENDS}) endif() diff --git a/libc/test/src/__support/File/CMakeLists.txt b/libc/test/src/__support/File/CMakeLists.txt index da36e190cef63..070ce4a9aed89 100644 --- a/libc/test/src/__support/File/CMakeLists.txt +++ b/libc/test/src/__support/File/CMakeLists.txt @@ -11,8 +11,6 @@ add_libc_test( libc-support-tests SRCS file_test.cpp - LINK_LIBRARIES - LibcMemoryHelpers DEPENDS libc.include.stdio libc.hdr.wchar_macros @@ -21,6 +19,7 @@ add_libc_test( libc.src.__support.CPP.new libc.src.__support.File.file libc.src.__support.error_or + libc.test.UnitTest.MemoryMatcher ) add_libc_test( diff --git a/libc/test/src/__support/printf_core/CMakeLists.txt b/libc/test/src/__support/printf_core/CMakeLists.txt index 0314b1d7cfd01..7fd35ac69a00b 100644 --- a/libc/test/src/__support/printf_core/CMakeLists.txt +++ b/libc/test/src/__support/printf_core/CMakeLists.txt @@ -4,13 +4,12 @@ add_libc_test( libc-support-tests SRCS parser_test.cpp - LINK_LIBRARIES - LibcPrintfHelpers DEPENDS libc.src.__support.printf_core.parser libc.src.__support.printf_core.core_structs libc.src.__support.CPP.string_view libc.src.__support.arg_list + libc.test.UnitTest.PrintfMatcher ) add_libc_test( diff --git a/libc/test/src/fenv/CMakeLists.txt b/libc/test/src/fenv/CMakeLists.txt index 73cbe4c2bc88b..3c4135bed8c94 100644 --- a/libc/test/src/fenv/CMakeLists.txt +++ b/libc/test/src/fenv/CMakeLists.txt @@ -9,8 +9,7 @@ add_libc_test( DEPENDS libc.src.fenv.fegetround libc.src.fenv.fesetround - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( @@ -25,8 +24,7 @@ add_libc_test( libc.src.fenv.fesetexcept libc.src.fenv.fetestexcept libc.src.__support.FPUtil.fenv_impl - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( @@ -42,8 +40,7 @@ add_libc_test( libc.src.fenv.fesetround libc.src.__support.FPUtil.fenv_impl libc.src.__support.macros.properties.os - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( @@ -57,8 +54,7 @@ add_libc_test( libc.src.fenv.fesetexceptflag libc.src.fenv.fetestexceptflag libc.src.__support.FPUtil.fenv_impl - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( @@ -71,8 +67,7 @@ add_libc_test( libc.include.signal libc.src.fenv.feupdateenv libc.src.__support.FPUtil.fenv_impl - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( @@ -84,8 +79,7 @@ add_libc_test( DEPENDS libc.src.fenv.feclearexcept libc.src.__support.FPUtil.fenv_impl - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( @@ -98,8 +92,7 @@ add_libc_test( libc.src.fenv.fedisableexcept libc.src.fenv.feenableexcept libc.src.fenv.fegetexcept - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) if(NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows") @@ -121,9 +114,8 @@ if(NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows") libc.src.fenv.feraiseexcept libc.src.fenv.fetestexcept libc.src.__support.FPUtil.fenv_impl - LINK_LIBRARIES - LibcFPExceptionHelpers - LibcFPTestHelpers + libc.test.UnitTest.FPExceptMatcher + libc.test.UnitTest.FPTestHelpers ) add_fp_unittest( @@ -136,8 +128,7 @@ if(NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows") libc.hdr.fenv_macros libc.src.fenv.feholdexcept libc.src.__support.FPUtil.fenv_impl - LINK_LIBRARIES - LibcFPExceptionHelpers - LibcFPTestHelpers + libc.test.UnitTest.FPExceptMatcher + libc.test.UnitTest.FPTestHelpers ) endif() diff --git a/libc/test/src/math/performance_testing/CMakeLists.txt b/libc/test/src/math/performance_testing/CMakeLists.txt index 5245551b6bbb8..534bd4384e39a 100644 --- a/libc/test/src/math/performance_testing/CMakeLists.txt +++ b/libc/test/src/math/performance_testing/CMakeLists.txt @@ -438,10 +438,9 @@ add_perf_binary( libc.src.math.roundevenf16 libc.src.math.truncf libc.src.math.truncf16 + libc.test.UnitTest.FPTestHelpers COMPILE_OPTIONS -fno-builtin - LINK_LIBRARIES - LibcFPTestHelpers ) add_perf_binary( diff --git a/libc/test/src/stdio/CMakeLists.txt b/libc/test/src/stdio/CMakeLists.txt index 6ec484129dee2..c524d51389b7b 100644 --- a/libc/test/src/stdio/CMakeLists.txt +++ b/libc/test/src/stdio/CMakeLists.txt @@ -132,8 +132,7 @@ add_libc_test( libc.src.stdio.fseek libc.src.stdio.fwrite libc.test.UnitTest.ErrnoCheckingTest - LINK_LIBRARIES - LibcMemoryHelpers + libc.test.UnitTest.MemoryMatcher ) if(LIBC_CONF_PRINTF_DISABLE_FLOAT) @@ -357,8 +356,7 @@ add_libc_test( sscanf_test.cpp DEPENDS libc.src.stdio.sscanf - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers COMPILE_OPTIONS ${sscanf_test_copts} ) @@ -371,8 +369,7 @@ add_libc_test( vsscanf_test.cpp DEPENDS libc.src.stdio.vsscanf - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers COMPILE_OPTIONS ${sscanf_test_copts} ) diff --git a/libc/test/src/stdio/scanf_core/CMakeLists.txt b/libc/test/src/stdio/scanf_core/CMakeLists.txt index d2931c9cc4821..6fdee7b3d5d51 100644 --- a/libc/test/src/stdio/scanf_core/CMakeLists.txt +++ b/libc/test/src/stdio/scanf_core/CMakeLists.txt @@ -9,13 +9,12 @@ add_libc_test( libc_stdio_unittests SRCS parser_test.cpp - LINK_LIBRARIES - LibcScanfHelpers DEPENDS libc.src.stdio.scanf_core.parser libc.src.stdio.scanf_core.core_structs libc.src.__support.CPP.string_view libc.src.__support.arg_list + libc.test.UnitTest.ScanfMatcher ) if(NOT(TARGET libc.src.__support.File.file) AND LLVM_LIBC_FULL_BUILD AND diff --git a/libc/test/src/strings/CMakeLists.txt b/libc/test/src/strings/CMakeLists.txt index 4265211101a83..48bde97c463cf 100644 --- a/libc/test/src/strings/CMakeLists.txt +++ b/libc/test/src/strings/CMakeLists.txt @@ -8,8 +8,7 @@ add_libc_test( bcopy_test.cpp DEPENDS libc.src.strings.bcopy - LINK_LIBRARIES - LibcMemoryHelpers + libc.test.UnitTest.MemoryMatcher ) add_libc_test( diff --git a/libc/test/src/time/CMakeLists.txt b/libc/test/src/time/CMakeLists.txt index 6d7494906e76d..58f19ebf0d060 100644 --- a/libc/test/src/time/CMakeLists.txt +++ b/libc/test/src/time/CMakeLists.txt @@ -9,7 +9,7 @@ add_header_library( libc.hdr.types.struct_tm libc.src.__support.macros.config libc.src.time.time_constants - LibcTest + libc.test.UnitTest.LibcTest ) add_libc_test( diff --git a/libc/test/src/wchar/CMakeLists.txt b/libc/test/src/wchar/CMakeLists.txt index 1f2d394634968..1183d5c44d685 100644 --- a/libc/test/src/wchar/CMakeLists.txt +++ b/libc/test/src/wchar/CMakeLists.txt @@ -487,8 +487,7 @@ add_libc_test( DEPENDS libc.src.wchar.wcstof libc.test.UnitTest.ErrnoCheckingTest - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( @@ -500,8 +499,7 @@ add_libc_test( DEPENDS libc.src.wchar.wcstod libc.test.UnitTest.ErrnoCheckingTest - LINK_LIBRARIES - LibcFPTestHelpers + libc.test.UnitTest.FPTestHelpers ) add_libc_test( diff --git a/libc/test/utils/UnitTest/testfilter_test.cpp b/libc/test/utils/UnitTest/testfilter_test.cpp index d7e68252cf2aa..b2638f2395ea2 100644 --- a/libc/test/utils/UnitTest/testfilter_test.cpp +++ b/libc/test/utils/UnitTest/testfilter_test.cpp @@ -32,9 +32,3 @@ TEST(LlvmLibcTestFilterTest, CheckCorrectFilter) { Options.TestFilter = "LlvmLibcTestFilterTest.CorrectFilter2"; ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(Options), 0); } - -int main() { - TestOptions Options{"LlvmLibcTestFilterTest.NoFilter", /*PrintColor=*/true}; - LIBC_NAMESPACE::testing::Test::runTests(Options); - return 0; -} diff --git a/libc/utils/MPCWrapper/CMakeLists.txt b/libc/utils/MPCWrapper/CMakeLists.txt index 0c961d8583461..d06ec2b3664a5 100644 --- a/libc/utils/MPCWrapper/CMakeLists.txt +++ b/libc/utils/MPCWrapper/CMakeLists.txt @@ -17,7 +17,8 @@ if(LIBC_TESTS_CAN_USE_MPC) libc.src.__support.CPP.type_traits libc.src.__support.FPUtil.fp_bits libc.src.__support.complex_type - LibcTest + libc.test.UnitTest.FPTestHelpers + libc.test.UnitTest.LibcTest ) if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH}) target_include_directories(libcMPCWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/include) @@ -28,7 +29,7 @@ if(LIBC_TESTS_CAN_USE_MPC) target_link_directories(libcMPCWrapper PUBLIC ${LIBC_MPC_INSTALL_PATH}/lib) endif() target_include_directories(libcMPCWrapper PUBLIC ${LIBC_SOURCE_DIR}) - target_link_libraries(libcMPCWrapper PUBLIC libcMPCommon LibcFPTestHelpers LibcTest mpc) + target_link_libraries(libcMPCWrapper PUBLIC libcMPCommon mpc) elseif(NOT LIBC_TARGET_OS_IS_GPU AND NOT LLVM_LIBC_FULL_BUILD) message(WARNING "Math tests using MPC will be skipped.") endif() diff --git a/libc/utils/MPFRWrapper/CMakeLists.txt b/libc/utils/MPFRWrapper/CMakeLists.txt index be756005b512a..8efa6fc1f0b12 100644 --- a/libc/utils/MPFRWrapper/CMakeLists.txt +++ b/libc/utils/MPFRWrapper/CMakeLists.txt @@ -17,13 +17,14 @@ if(LIBC_TESTS_CAN_USE_MPFR OR LIBC_TESTS_CAN_USE_MPC) libc.src.__support.FPUtil.bfloat16 libc.src.__support.FPUtil.cast libc.src.__support.FPUtil.fp_bits + libc.test.UnitTest.FPTestHelpers ) if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH}) target_include_directories(libcMPCommon PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/include) target_link_directories(libcMPCommon PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/lib) endif() target_include_directories(libcMPCommon PUBLIC ${LIBC_SOURCE_DIR}) - target_link_libraries(libcMPCommon PUBLIC LibcFPTestHelpers mpfr gmp) + target_link_libraries(libcMPCommon PUBLIC mpfr gmp) elseif(NOT LIBC_TARGET_OS_IS_GPU AND NOT LLVM_LIBC_FULL_BUILD) message(WARNING "Math tests using MPFR will be skipped.") endif() @@ -46,14 +47,15 @@ if(LIBC_TESTS_CAN_USE_MPFR) libc.src.__support.FPUtil.bfloat16 libc.src.__support.FPUtil.fp_bits libc.src.__support.FPUtil.fpbits_str - LibcTest + libc.test.UnitTest.FPTestHelpers + libc.test.UnitTest.LibcTest ) if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH}) target_include_directories(libcMPFRWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/include) target_link_directories(libcMPFRWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/lib) endif() target_include_directories(libcMPFRWrapper PUBLIC ${LIBC_SOURCE_DIR}) - target_link_libraries(libcMPFRWrapper PUBLIC libcMPCommon LibcFPTestHelpers LibcTest) + target_link_libraries(libcMPFRWrapper PUBLIC libcMPCommon) elseif(NOT LIBC_TARGET_OS_IS_GPU AND NOT LLVM_LIBC_FULL_BUILD) message(WARNING "Math tests using MPFR will be skipped.") endif()