Skip to content

Commit 49ba302

Browse files
committed
[libc] Use LIBC_COPT_PUBLIC_PACKAGING for hermetic and integration tests.
1 parent d9dd5f0 commit 49ba302

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

libc/cmake/modules/LLVMLibCTestRules.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
# Usage:
66
# get_object_files_for_test(<result var>
77
# <skipped_entrypoints_var>
8+
# <internal_obj>
89
# <target0> [<target1> ...])
910
#
1011
# The list of object files is collected in <result_var>.
1112
# If skipped entrypoints were found, then <skipped_entrypoints_var> is
1213
# set to a true value.
1314
# targetN is either an "add_entrypoint_target" target or an
1415
# "add_object_library" target.
15-
function(get_object_files_for_test result skipped_entrypoints_list)
16+
# If internal_obj is TRUE, then we collect `target.__internal__` for entry points.
17+
function(get_object_files_for_test result skipped_entrypoints_list internal_obj)
1618
set(object_files "")
1719
set(skipped_list "")
1820
set(checked_list "")
@@ -49,7 +51,7 @@ function(get_object_files_for_test result skipped_entrypoints_list)
4951
set(dep_skip "")
5052

5153
get_target_property(indirect_deps ${dep} "DEPS")
52-
get_object_files_for_test(dep_obj dep_skip ${indirect_deps})
54+
get_object_files_for_test(dep_obj dep_skip ${internal_obj} ${indirect_deps})
5355

5456
if(${dep_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})
5557
get_target_property(dep_object_files ${dep} "OBJECT_FILES")
@@ -62,7 +64,11 @@ function(get_object_files_for_test result skipped_entrypoints_list)
6264
list(APPEND dep_skip ${dep})
6365
list(REMOVE_ITEM dep_obj ${dep})
6466
endif()
65-
get_target_property(object_file_raw ${dep} "OBJECT_FILE_RAW")
67+
if(${internal_obj})
68+
get_target_property(object_file_raw ${dep} "OBJECT_FILE_RAW")
69+
else()
70+
get_target_property(object_file_raw ${dep} "OBJECT_FILE")
71+
endif()
6672
if(object_file_raw)
6773
list(APPEND dep_obj ${object_file_raw})
6874
endif()
@@ -140,7 +146,7 @@ function(create_libc_unittest fq_target_name)
140146
endif()
141147

142148
get_object_files_for_test(
143-
link_object_files skipped_entrypoints_list ${fq_deps_list})
149+
link_object_files skipped_entrypoints_list TRUE ${fq_deps_list})
144150
if(skipped_entrypoints_list)
145151
# If a test is OS/target machine independent, it has to be skipped if the
146152
# OS/target machine combination does not provide any dependent entrypoints.
@@ -389,7 +395,7 @@ function(add_libc_fuzzer target_name)
389395
get_fq_target_name(${target_name} fq_target_name)
390396
get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS})
391397
get_object_files_for_test(
392-
link_object_files skipped_entrypoints_list ${fq_deps_list})
398+
link_object_files skipped_entrypoints_list TRUE ${fq_deps_list})
393399
if(skipped_entrypoints_list)
394400
if(LIBC_CMAKE_VERBOSE_LOGGING)
395401
set(msg "Skipping fuzzer target ${fq_target_name} as it has missing deps: "
@@ -519,7 +525,7 @@ function(add_integration_test test_name)
519525
# TODO: Instead of gathering internal object files from entrypoints,
520526
# collect the object files with public names of entrypoints.
521527
get_object_files_for_test(
522-
link_object_files skipped_entrypoints_list ${fq_deps_list})
528+
link_object_files skipped_entrypoints_list FALSE ${fq_deps_list})
523529
if(skipped_entrypoints_list)
524530
if(LIBC_CMAKE_VERBOSE_LOGGING)
525531
set(msg "Skipping integration test ${fq_target_name} as it has missing deps: "
@@ -703,7 +709,7 @@ function(add_libc_hermetic_test test_name)
703709
# TODO: Instead of gathering internal object files from entrypoints,
704710
# collect the object files with public names of entrypoints.
705711
get_object_files_for_test(
706-
link_object_files skipped_entrypoints_list ${fq_deps_list})
712+
link_object_files skipped_entrypoints_list FALSE ${fq_deps_list})
707713
if(skipped_entrypoints_list)
708714
set(msg "Skipping hermetic test ${fq_target_name} as it has missing deps: "
709715
"${skipped_entrypoints_list}.")

libc/test/integration/startup/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function(add_startup_test target_name)
3838
if(ADD_STARTUP_TEST_DEPENDS)
3939
get_fq_deps_list(fq_deps_list ${ADD_STARTUP_TEST_DEPENDS})
4040
add_dependencies(${fq_target_name} ${fq_deps_list})
41-
get_object_files_for_test(link_object_files has_skipped_entrypoint_list ${fq_deps_list})
41+
get_object_files_for_test(link_object_files has_skipped_entrypoint_list TRUE ${fq_deps_list})
4242
target_link_libraries(${fq_target_name} ${link_object_files})
4343
endif()
4444

libc/test/src/math/differential_testing/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function(add_diff_binary target_name)
2727
get_fq_target_name(${target_name} fq_target_name)
2828
get_fq_deps_list(fq_deps_list ${DIFF_DEPENDS})
2929
get_object_files_for_test(
30-
link_object_files skipped_entrypoints_list ${fq_deps_list})
30+
link_object_files skipped_entrypoints_list TRUE ${fq_deps_list})
3131
if(skipped_entrypoints_list)
3232
if(LIBC_CMAKE_VERBOSE_LOGGING)
3333
set(msg "Will not build ${fq_target_name} as it has missing deps: "

0 commit comments

Comments
 (0)