[libc] Convert test framework libraries to standard target infrastructure - #216931
[libc] Convert test framework libraries to standard target infrastructure#216931labath wants to merge 2 commits into
Conversation
…ture This makes the test libraries use the same patterns as the regular libc code. This includes using dot-separated names of libraries and explicit dependency tracking (although this patch does not make use that yet). Since this changes the name of the libraries anyway, I took the opportunity to rename some of them: libraries containing only a single file now have the same name as that file. This also resolves the dependency issues in hermetic tests, as everything now gets packaged into the same .a library (the library itself could also be removed, but I'm saving that for another patch). Other changes include: - moving the C test framework to a separate library, to avoid it getting pulled in (and causing undefined references) when not used - moving sched_test's static_assert into a TEST, as the test framework requires having at least one test. The trick with overriding main() no longer works because overlay tests no longer create a .a file for the test frameworks. - for the same reason, I have removed the main function from testfilter_test.cpp - for the same reason, avoid compiling LibcDeathTestExecutors.cpp when subprocess tests are not enabled
|
@llvm/pr-subscribers-libc Author: Pavel Labath (labath) ChangesThis makes the test libraries use the same patterns as the regular libc code. This includes using dot-separated names of libraries and explicit dependency tracking (although this patch does not make use that yet). Since this changes the name of the libraries anyway, I took the opportunity to rename some of them: libraries containing only a single file now have the same name as that file. This also resolves the dependency issues in hermetic tests, as everything now gets packaged into the same .a library (the library itself could also be removed, but I'm saving that for another patch). Other changes include:
Patch is 23.62 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/216931.diff 15 Files Affected:
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 "$<TARGET_OBJECTS:${fq_target_name}>"
+ )
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 <sched.h>
template <typename T, typename U> struct SameType {
@@ -16,19 +17,22 @@ template <typename T> struct SameType<T, T> {
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<decltype(CPU_ZERO((cpu_set_t *)0)), void>::value, "");
-static_assert(SameType<decltype(CPU_COUNT((cpu_set_t *)0)), int>::value, "");
-static_assert(SameType<decltype(CPU_SET(0, (cpu_set_t *)0)), void>::value, "");
-static_assert(SameType<decltype(CPU_ISSET(0, (cpu_set_t *)0)), int>::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<decltype(CPU_ZERO((cpu_set_t *)0)), void>::value, "");
+ static_assert(SameType<decltype(CPU_COUNT((cpu_set_t *)0)), int>::value, "");
+ static_assert(SameType<decltype(CPU_SET(0, (cpu_set_t *)0)), void>::value,
+ "");
+ static_assert(SameType<decltype(CPU_ISSET(0, (cpu_set_t *)0)), int>::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<decltype(sched_getscheduler), SchedGetSchedulerT>::value,
- "");
-static_assert(SameType<decltype(sched_setscheduler), SchedSetSchedulerT>::value,
- "");
-
-extern "C" int main() { return 0; }
+ static_assert(
+ SameType<decltype(sched_getscheduler), SchedGetSchedulerT>::value, "");
+ static_assert(
+ SameType<decltype(sched_setscheduler), SchedSetSchedulerT>::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/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.ErrnoChecking...
[truncated]
|
vhscampos
left a comment
There was a problem hiding this comment.
This also resolves the dependency issues in hermetic tests, as everything now gets packaged into the same .a library (the library itself could also be removed, but I'm saving that for another patch).
What dependency issues?
vhscampos
left a comment
There was a problem hiding this comment.
I have no objections, but please wait for another approval
This makes the test libraries use the same patterns as the regular libc code. This includes using dot-separated names of libraries and explicit dependency tracking (although this patch does not make use that yet).
Since this changes the name of the libraries anyway, I took the opportunity to rename some of them: libraries containing only a single file now have the same name as that file.
This also resolves the dependency issues in hermetic tests, as everything now gets packaged into the same .a library (the library itself could also be removed, but I'm saving that for another patch).
Other changes include:
subprocess tests are not enabled