28 changes: 14 additions & 14 deletions libc/test/integration/src/pthread/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_mutex_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.errno.errno
Expand All @@ -25,8 +25,8 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_create
Expand All @@ -39,8 +39,8 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_equal_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.errno.errno
Expand All @@ -60,8 +60,8 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_name_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.errno
libc.include.pthread
Expand All @@ -83,8 +83,8 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_exit_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_create
Expand All @@ -98,8 +98,8 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_tss_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_create
Expand All @@ -117,8 +117,8 @@ add_integration_test(
libc-pthread-integration-tests
SRCS
pthread_once_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.pthread
libc.src.pthread.pthread_once
Expand Down
4 changes: 2 additions & 2 deletions libc/test/integration/src/spawn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ add_integration_test(
spawn-integration-tests
SRCS
posix_spawn_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc_posix_spawn_test_binary
libc.test.integration.src.spawn.test_binary_properties
Expand Down
8 changes: 4 additions & 4 deletions libc/test/integration/src/stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ add_integration_test(
stdio-integration-tests
SRCS
sprintf_size_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.src.stdio.sprintf
ARGS
Expand All @@ -26,8 +26,8 @@ add_integration_test(
stdio-integration-tests
SRCS
sprintf_size_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
ARGS
"%s %c %d"
"First arg"
Expand Down
4 changes: 2 additions & 2 deletions libc/test/integration/src/stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ add_integration_test(
stdlib-integration-tests
SRCS
getenv_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.src.stdlib.getenv
ENV
Expand Down
28 changes: 14 additions & 14 deletions libc/test/integration/src/threads/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ add_integration_test(
libc-threads-integration-tests
SRCS
mtx_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.errno.errno
Expand All @@ -25,8 +25,8 @@ add_integration_test(
libc-threads-integration-tests
SRCS
thrd_equal_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.mtx_destroy
Expand All @@ -45,8 +45,8 @@ add_integration_test(
libc-threads-integration-tests
SRCS
thrd_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.errno.errno
Expand All @@ -60,8 +60,8 @@ add_integration_test(
libc-threads-integration-tests
SRCS
thrd_exit_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.thrd_create
Expand All @@ -75,8 +75,8 @@ add_integration_test(
libc-threads-integration-tests
SRCS
tss_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.thrd_create
Expand All @@ -94,8 +94,8 @@ add_integration_test(
libc-threads-integration-tests
SRCS
call_once_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.call_once
Expand All @@ -114,8 +114,8 @@ add_integration_test(
libc-threads-integration-tests
SRCS
cnd_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.threads
libc.src.threads.cnd_init
Expand Down
16 changes: 8 additions & 8 deletions libc/test/integration/src/unistd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ add_integration_test(
unistd-integration-tests
SRCS
getcwd_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.errno
libc.src.__support.CPP.string_view
Expand All @@ -22,8 +22,8 @@ add_integration_test(
unistd-integration-tests
SRCS
fork_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc.include.errno
libc.include.signal
Expand Down Expand Up @@ -67,8 +67,8 @@ add_integration_test(
unistd-integration-tests
SRCS
execv_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc_execv_test_normal_exit
libc_execv_test_signal_exit
Expand All @@ -86,8 +86,8 @@ add_integration_test(
unistd-integration-tests
SRCS
execve_test.cpp
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
libc_execv_test_normal_exit
libc_execv_test_signal_exit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# A rule to add loader tests. When we have a complete loader, we should
# be able to use the add_libc_unittest rule or an extension of it. But,
# while the loader is getting built, we need to use a special rule like
# A rule to add startup system tests. When we have a complete startup system,
# we should be able to use the add_libc_unittest rule or an extension of it.
# But, while the system is being developed, we need to use a special rule like
# this.
function(add_loader_test target_name)
function(add_startup_test target_name)
if(NOT CMAKE_HOST_UNIX)
message(
WARNING
"Loader tests currently assume a POSIX/Unix like environment and "
"may not work on your platform.")
"Test for the startup system currently assume a POSIX/Unix like "
"environment and may not work on your platform.")
endif()

cmake_parse_arguments(
"ADD_LOADER_TEST"
"ADD_STARTUP_TEST"
"" # No option arguments
"SRC" # Single value arguments
"DEPENDS;ARGS;ENV" # Multivalue arguments.
Expand All @@ -22,7 +22,7 @@ function(add_loader_test target_name)
add_executable(
${fq_target_name}
EXCLUDE_FROM_ALL
${ADD_LOADER_TEST_SRC}
${ADD_STARTUP_TEST_SRC}
)

set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Expand All @@ -35,8 +35,8 @@ function(add_loader_test target_name)
${LIBC_BUILD_DIR}/include
)

if(ADD_LOADER_TEST_DEPENDS)
get_fq_deps_list(fq_deps_list ${ADD_LOADER_TEST_DEPENDS})
if(ADD_STARTUP_TEST_DEPENDS)
get_fq_deps_list(fq_deps_list ${ADD_STARTUP_TEST_DEPENDS})
add_dependencies(${fq_target_name} ${fq_deps_list})
get_object_files_for_test(link_object_files has_skipped_entrypoint_list ${fq_deps_list})
target_link_libraries(${fq_target_name} ${link_object_files})
Expand All @@ -51,11 +51,11 @@ function(add_loader_test target_name)
add_custom_command(
TARGET ${fq_target_name}
POST_BUILD
COMMAND ${ADD_LOADER_TEST_ENV} $<TARGET_FILE:${fq_target_name}> ${ADD_LOADER_TEST_ARGS}
COMMAND ${ADD_STARTUP_TEST_ENV} $<TARGET_FILE:${fq_target_name}> ${ADD_STARTUP_TEST_ARGS}
)

add_dependencies(libc_loader_tests ${fq_target_name})
endfunction(add_loader_test)
add_dependencies(libc_startup_tests ${fq_target_name})
endfunction(add_startup_test)

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
add_subdirectory(${LIBC_TARGET_OS})
Expand Down
62 changes: 62 additions & 0 deletions libc/test/integration/startup/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
if(NOT (EXISTS ${LIBC_SOURCE_DIR}/startup/linux/${LIBC_TARGET_ARCHITECTURE}))
message("Skipping startup integration tests for target architecture ${LIBC_TARGET_ARCHITECTURE}.")
return()
endif()

add_custom_target(libc-startup-tests)
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
1 2 3
ENV
FRANCE=Paris
GERMANY=Berlin
)

add_integration_test(
startup_no_envp_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
main_without_envp.cpp
)

add_integration_test(
startup_no_args_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
main_without_args.cpp
)

add_integration_test(
startup_tls_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
tls_test.cpp
DEPENDS
libc.include.errno
libc.include.sys_mman
libc.src.errno.errno
libc.src.sys.mman.mmap
)

add_integration_test(
init_fini_array_test
SUITE libc-startup-tests
STARTUP
libc.startup.linux.crt1
SRCS
init_fini_array_test.cpp
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions libc/test/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ add_integration_test(
libc-api-test
SRCS
${public_test}
LOADER
libc.loader.linux.crt1
STARTUP
libc.startup.linux.crt1
DEPENDS
${api-test-entrypoints}
)
Expand Down