[libc] Remove startup option from integration tests

This generalizes handling of the integration tests. We now implicitly
depend on the `libc.startup.${LIBC_TARGET_OS}.crt1` file rather than
passing it in manually. This simplifies the interface.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D146237
This commit is contained in:
Joseph Huber 2023-03-16 11:50:39 -05:00
parent 4c2299003f
commit d9c1dbc204
9 changed files with 7 additions and 66 deletions

View File

@ -402,7 +402,6 @@ endfunction(add_libc_fuzzer)
# SUITE <the suite to which the test should belong>
# SRCS <src1.cpp> [src2.cpp ...]
# HDRS [hdr1.cpp ...]
# STARTUP <fully qualified startup system target name>
# DEPENDS <list of entrypoint or other object targets>
# ARGS <list of command line arguments to be passed to the test>
# ENV <list of environment variables to set before running the test>
@ -420,7 +419,7 @@ function(add_integration_test test_name)
cmake_parse_arguments(
"INTEGRATION_TEST"
"" # No optional arguments
"SUITE;STARTUP" # Single value arguments
"SUITE" # Single value arguments
"SRCS;HDRS;DEPENDS;ARGS;ENV;COMPILE_OPTIONS" # Multi-value arguments
${ARGN}
)
@ -428,20 +427,20 @@ function(add_integration_test test_name)
if(NOT INTEGRATION_TEST_SUITE)
message(FATAL_ERROR "SUITE not specified for ${fq_target_name}")
endif()
if(NOT INTEGRATION_TEST_STARTUP)
message(FATAL_ERROR "The STARTUP to link to the integration test is missing.")
endif()
if(NOT INTEGRATION_TEST_SRCS)
message(FATAL_ERROR "The SRCS list for add_integration_test is missing.")
endif()
if(NOT TARGET libc.startup.${LIBC_TARGET_OS}.crt1)
message(FATAL_ERROR "The 'crt1' target for the integration test is missing.")
endif()
get_fq_target_name(${test_name}.libc fq_libc_target_name)
get_fq_deps_list(fq_deps_list ${INTEGRATION_TEST_DEPENDS})
list(APPEND fq_deps_list
# All integration tests need to inherit the same dependencies as the
# startup code.
${INTEGRATION_TEST_STARTUP}
# All integration tests use the operating system's startup object and need
# to inherit the same dependencies.
libc.startup.${LIBC_TARGET_OS}.crt1
# We always add the memory functions objects. This is because the
# compiler's codegen can emit calls to the C memory functions.
libc.src.string.bcmp

View File

@ -11,8 +11,6 @@ add_integration_test(
libc-support-threads-integration-tests
SRCS
thread_detach_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.src.__support.threads.mutex
libc.src.__support.threads.thread
@ -24,8 +22,6 @@ add_integration_test(
libc-support-threads-integration-tests
SRCS
thread_tls_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.src.__support.threads.thread
)

View File

@ -6,8 +6,6 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_mutex_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.errno.errno
@ -25,8 +23,6 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_create
@ -39,8 +35,6 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_equal_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.errno.errno
@ -60,8 +54,6 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_name_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.errno
libc.include.pthread
@ -83,8 +75,6 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_exit_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_create
@ -98,8 +88,6 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_tss_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_create
@ -117,8 +105,6 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_once_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_once

View File

@ -26,8 +26,6 @@ add_integration_test(
spawn-integration-tests
SRCS
posix_spawn_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc_posix_spawn_test_binary
libc.test.integration.src.spawn.test_binary_properties

View File

@ -9,8 +9,6 @@ add_integration_test(
stdio-integration-tests
SRCS
sprintf_size_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.src.stdio.sprintf
ARGS
@ -26,8 +24,6 @@ add_integration_test(
stdio-integration-tests
SRCS
sprintf_size_test.cpp
STARTUP
libc.startup.linux.crt1
ARGS
"%s %c %d"
"First arg"

View File

@ -7,8 +7,6 @@ add_integration_test(
stdlib-integration-tests
SRCS
getenv_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.src.stdlib.getenv
ENV

View File

@ -6,8 +6,6 @@ add_integration_test(
libc-threads-integration-tests
SRCS
mtx_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.errno.errno
@ -25,8 +23,6 @@ add_integration_test(
libc-threads-integration-tests
SRCS
thrd_equal_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.mtx_destroy
@ -45,8 +41,6 @@ add_integration_test(
libc-threads-integration-tests
SRCS
thrd_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.errno.errno
@ -60,8 +54,6 @@ add_integration_test(
libc-threads-integration-tests
SRCS
thrd_exit_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.thrd_create
@ -75,8 +67,6 @@ add_integration_test(
libc-threads-integration-tests
SRCS
tss_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.thrd_create
@ -94,8 +84,6 @@ add_integration_test(
libc-threads-integration-tests
SRCS
call_once_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.call_once
@ -114,8 +102,6 @@ add_integration_test(
libc-threads-integration-tests
SRCS
cnd_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.cnd_init

View File

@ -7,8 +7,6 @@ add_integration_test(
unistd-integration-tests
SRCS
getcwd_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.src.__support.CPP.string_view
libc.src.errno.errno
@ -22,8 +20,6 @@ add_integration_test(
unistd-integration-tests
SRCS
fork_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.errno
libc.include.signal
@ -67,8 +63,6 @@ add_integration_test(
unistd-integration-tests
SRCS
execv_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc_execv_test_normal_exit
libc_execv_test_signal_exit
@ -86,8 +80,6 @@ add_integration_test(
unistd-integration-tests
SRCS
execve_test.cpp
STARTUP
libc.startup.linux.crt1
DEPENDS
libc_execv_test_normal_exit
libc_execv_test_signal_exit

View File

@ -9,8 +9,6 @@ add_dependencies(libc-integration-tests libc-startup-tests)
add_integration_test(
startup_args_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
args_test.cpp
ARGS
@ -23,8 +21,6 @@ add_integration_test(
add_integration_test(
startup_no_envp_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
main_without_envp.cpp
)
@ -32,8 +28,6 @@ add_integration_test(
add_integration_test(
startup_no_args_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
main_without_args.cpp
)
@ -41,8 +35,6 @@ add_integration_test(
add_integration_test(
startup_tls_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
tls_test.cpp
DEPENDS
@ -55,8 +47,6 @@ add_integration_test(
add_integration_test(
init_fini_array_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
init_fini_array_test.cpp
)