Skip to content

Commit 9d87736

Browse files
author
Siva Chandra Reddy
committed
[libc] Remove *TestMain libraries and combine them with the main test libraries.
There are not tests currently which use the main test framework but not the `main` function from LibcTestMain.cpp. So, this change essentially simplifies by merging the *TestMain libraries with the main test libraries. Reviewed By: michaelrj, jhuber6 Differential Revision: https://reviews.llvm.org/D150698
1 parent 3ae4265 commit 9d87736

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

libc/cmake/modules/LLVMLibCTestRules.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function(create_libc_unittest fq_target_name)
179179
)
180180

181181
# LibcUnitTest should not depend on anything in LINK_LIBRARIES.
182-
list(APPEND link_libraries LibcUnitTestMain LibcUnitTest)
182+
list(APPEND link_libraries LibcUnitTest)
183183

184184
target_link_libraries(${fq_build_target_name} PRIVATE ${link_libraries})
185185

@@ -669,7 +669,7 @@ function(add_libc_hermetic_test test_name)
669669
PRIVATE
670670
${HERMETIC_TEST_LINK_LIBRARIES}
671671
libc.startup.${LIBC_TARGET_OS}.crt1
672-
LibcHermeticTestMain LibcHermeticTest
672+
LibcHermeticTest
673673
# The NVIDIA 'nvlink' linker does not currently support static libraries.
674674
$<$<NOT:$<BOOL:${LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX}>>:${fq_target_name}.__libc__>)
675675
add_dependencies(${fq_build_target_name}

libc/test/UnitTest/CMakeLists.txt

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
set(libc_test_srcs_common
2-
Test.h
3-
LibcTest.cpp
42
CmakeFilePath.cpp
5-
LibcTest.h
3+
LibcTest.cpp
4+
LibcTestMain.cpp
65
TestLogger.cpp
6+
LibcTest.h
7+
Test.h
78
TestLogger.h
89
)
910

@@ -36,23 +37,7 @@ add_library(
3637
HermeticTestUtils.cpp
3738
)
3839

39-
add_library(
40-
LibcUnitTestMain
41-
${library_type}
42-
EXCLUDE_FROM_ALL
43-
LibcTestMain.cpp
44-
)
45-
add_dependencies(LibcUnitTestMain LibcUnitTest)
46-
47-
add_library(
48-
LibcHermeticTestMain
49-
${library_type}
50-
EXCLUDE_FROM_ALL
51-
LibcTestMain.cpp
52-
)
53-
add_dependencies(LibcHermeticTestMain LibcHermeticTest)
54-
55-
foreach(lib LibcUnitTest LibcUnitTestMain LibcHermeticTest LibcHermeticTestMain)
40+
foreach(lib LibcUnitTest LibcHermeticTest)
5641
target_include_directories(${lib} PUBLIC ${LIBC_SOURCE_DIR})
5742
target_compile_options(${lib} PRIVATE -fno-exceptions -fno-rtti)
5843
add_dependencies(${lib}
@@ -65,11 +50,9 @@ foreach(lib LibcUnitTest LibcUnitTestMain LibcHermeticTest LibcHermeticTestMain)
6550
)
6651
endforeach()
6752

68-
foreach(lib LibcHermeticTest LibcHermeticTestMain)
69-
target_include_directories(${lib} PRIVATE ${LIBC_BUILD_DIR}/include)
70-
target_compile_options(${lib}
71-
PRIVATE ${LIBC_HERMETIC_TEST_COMPILE_OPTIONS} -ffreestanding -nostdlib -nostdlib++)
72-
endforeach()
53+
target_include_directories(LibcHermeticTest PRIVATE ${LIBC_BUILD_DIR}/include)
54+
target_compile_options(LibcHermeticTest
55+
PRIVATE ${LIBC_HERMETIC_TEST_COMPILE_OPTIONS} -ffreestanding -nostdlib -nostdlib++)
7356

7457
add_header_library(
7558
string_utils

0 commit comments

Comments
 (0)