[libc][NFC] Rename "loader" to "startup".
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D140049
This commit is contained in:
@@ -197,9 +197,9 @@ add_subdirectory(src)
|
||||
add_subdirectory(utils)
|
||||
|
||||
if(LLVM_LIBC_FULL_BUILD)
|
||||
# The loader can potentially depend on the library components so add it
|
||||
# after the library implementation directories.
|
||||
add_subdirectory(loader)
|
||||
# The startup system can potentially depend on the library components so add
|
||||
# it after the library implementation directories.
|
||||
add_subdirectory(startup)
|
||||
endif()
|
||||
|
||||
# The lib and test directories are added at the very end as tests
|
||||
|
||||
@@ -106,7 +106,7 @@ function(create_libc_unittest fq_target_name)
|
||||
# machine specific object library. Such a test would be testing internals of
|
||||
# the libc and it is assumed that they will be rare in practice. So, they
|
||||
# can be skipped in the corresponding CMake files using platform specific
|
||||
# logic. This pattern is followed in the loader tests for example.
|
||||
# logic. This pattern is followed in the startup tests for example.
|
||||
#
|
||||
# Another pattern that is present currently is to detect machine
|
||||
# capabilities and add entrypoints and tests accordingly. That approach is
|
||||
@@ -377,10 +377,10 @@ function(add_libc_fuzzer target_name)
|
||||
endfunction(add_libc_fuzzer)
|
||||
|
||||
# Rule to add an integration test. An integration test is like a unit test
|
||||
# but does not use the system libc. Not even the loader from the system libc
|
||||
# is linked to the final executable. The final exe is fully statically linked.
|
||||
# The libc that the final exe links to consists of only the object files of
|
||||
# the DEPENDS targets.
|
||||
# but does not use the system libc. Not even the startup objects from the
|
||||
# system libc are linked in to the final executable. The final exe is fully
|
||||
# statically linked. The libc that the final exe links to consists of only
|
||||
# the object files of the DEPENDS targets.
|
||||
#
|
||||
# Usage:
|
||||
# add_integration_test(
|
||||
@@ -388,15 +388,15 @@ endfunction(add_libc_fuzzer)
|
||||
# SUITE <the suite to which the test should belong>
|
||||
# SRCS <src1.cpp> [src2.cpp ...]
|
||||
# HDRS [hdr1.cpp ...]
|
||||
# LOADER <fully qualified loader target name>
|
||||
# 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>
|
||||
# COMPILE_OPTIONS <list of special compile options for this target>
|
||||
# )
|
||||
#
|
||||
# The loader target should provide a property named LOADER_OBJECT which is
|
||||
# the full path to the object file produces when the loader is built.
|
||||
# The startup target should provide a property named STARTUP_OBJECT which is
|
||||
# the full path to the object file produced when the startup system is built.
|
||||
#
|
||||
# The DEPENDS list can be empty. If not empty, it should be a list of
|
||||
# targets added with add_entrypoint_object or add_object_library.
|
||||
@@ -409,7 +409,7 @@ function(add_integration_test test_name)
|
||||
cmake_parse_arguments(
|
||||
"INTEGRATION_TEST"
|
||||
"" # No optional arguments
|
||||
"SUITE;LOADER" # Single value arguments
|
||||
"SUITE;STARTUP" # Single value arguments
|
||||
"SRCS;HDRS;DEPENDS;ARGS;ENV;COMPILE_OPTIONS" # Multi-value arguments
|
||||
${ARGN}
|
||||
)
|
||||
@@ -417,8 +417,8 @@ 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_LOADER)
|
||||
message(FATAL_ERROR "The LOADER to link to the integration test is missing.")
|
||||
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.")
|
||||
@@ -456,27 +456,27 @@ function(add_integration_test test_name)
|
||||
file(MAKE_DIRECTORY ${sysroot}/include)
|
||||
set(sysroot_lib ${sysroot}/lib)
|
||||
file(MAKE_DIRECTORY ${sysroot_lib})
|
||||
get_target_property(loader_object_file ${INTEGRATION_TEST_LOADER} LOADER_OBJECT)
|
||||
get_target_property(crti_object_file libc.loader.linux.crti LOADER_OBJECT)
|
||||
get_target_property(crtn_object_file libc.loader.linux.crtn LOADER_OBJECT)
|
||||
get_target_property(startup_object_file ${INTEGRATION_TEST_STARTUP} STARTUP_OBJECT)
|
||||
get_target_property(crti_object_file libc.startup.linux.crti STARTUP_OBJECT)
|
||||
get_target_property(crtn_object_file libc.startup.linux.crtn STARTUP_OBJECT)
|
||||
set(dummy_archive $<TARGET_PROPERTY:libc_integration_test_dummy,ARCHIVE_OUTPUT_DIRECTORY>/lib$<TARGET_PROPERTY:libc_integration_test_dummy,ARCHIVE_OUTPUT_NAME>.a)
|
||||
if(NOT loader_object_file)
|
||||
message(FATAL_ERROR "Missing LOADER_OBJECT property of ${INTEGRATION_TEST_LOADER}.")
|
||||
if(NOT startup_object_file)
|
||||
message(FATAL_ERROR "Missing STARTUP_OBJECT property of ${INTEGRATION_TEST_STARTUP}.")
|
||||
endif()
|
||||
set(loader_dst ${sysroot_lib}/${LIBC_TARGET_ARCHITECTURE}-linux-gnu/crt1.o)
|
||||
set(startup_dst ${sysroot_lib}/${LIBC_TARGET_ARCHITECTURE}-linux-gnu/crt1.o)
|
||||
add_custom_command(
|
||||
OUTPUT ${loader_dst} ${sysroot}/lib/crti.o ${sysroot}/lib/crtn.o ${sysroot}/lib/libm.a ${sysroot}/lib/libc++.a
|
||||
COMMAND cmake -E copy ${loader_object_file} ${loader_dst}
|
||||
OUTPUT ${startup_dst} ${sysroot}/lib/crti.o ${sysroot}/lib/crtn.o ${sysroot}/lib/libm.a ${sysroot}/lib/libc++.a
|
||||
COMMAND cmake -E copy ${startup_object_file} ${startup_dst}
|
||||
COMMAND cmake -E copy ${crti_object_file} ${sysroot}/lib
|
||||
COMMAND cmake -E copy ${crtn_object_file} ${sysroot}/lib
|
||||
# We copy the dummy archive as libm.a and libc++.a as the compiler drivers expect them.
|
||||
COMMAND cmake -E copy ${dummy_archive} ${sysroot}/lib/libm.a
|
||||
COMMAND cmake -E copy ${dummy_archive} ${sysroot}/lib/libc++.a
|
||||
DEPENDS ${INTEGRATION_TEST_LOADER} libc.loader.linux.crti libc.loader.linux.crtn libc_integration_test_dummy
|
||||
DEPENDS ${INTEGRATION_TEST_STARTUP} libc.startup.linux.crti libc.startup.linux.crtn libc_integration_test_dummy
|
||||
)
|
||||
add_custom_target(
|
||||
${fq_target_name}.__copy_loader__
|
||||
DEPENDS ${loader_dst}
|
||||
${fq_target_name}.__copy_startup__
|
||||
DEPENDS ${startup_dst}
|
||||
)
|
||||
|
||||
add_library(
|
||||
@@ -520,7 +520,7 @@ function(add_integration_test test_name)
|
||||
# as is (and not as paths like /usr/lib/.../crtbegin.o).
|
||||
target_link_options(${fq_target_name} PRIVATE --sysroot=${sysroot} -static -stdlib=libc++ --rtlib=compiler-rt)
|
||||
add_dependencies(${fq_target_name}
|
||||
${fq_target_name}.__copy_loader__
|
||||
${fq_target_name}.__copy_startup__
|
||||
${fq_libc_target_name}
|
||||
libc.utils.IntegrationTest.test
|
||||
${INTEGRATION_TEST_DEPENDS})
|
||||
|
||||
@@ -13,7 +13,7 @@ directories::
|
||||
- fuzzing
|
||||
- include
|
||||
- lib
|
||||
- loader
|
||||
- startup
|
||||
- src
|
||||
- test
|
||||
- utils
|
||||
@@ -58,11 +58,11 @@ The ``lib`` directory
|
||||
This directory contains a ``CMakeLists.txt`` file listing the targets for the
|
||||
public libraries ``libc.a``, ``libm.a`` etc.
|
||||
|
||||
The ``loader`` directory
|
||||
The ``startup`` directory
|
||||
------------------------
|
||||
|
||||
This directory contains the implementations of the application loaders like
|
||||
``crt1.o`` etc.
|
||||
This directory contains the implementations of the application startup objects
|
||||
like ``crt1.o`` etc.
|
||||
|
||||
The ``src`` directory
|
||||
---------------------
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function(add_loader_object name)
|
||||
function(add_startup_object name)
|
||||
cmake_parse_arguments(
|
||||
"ADD_LOADER_OBJECT"
|
||||
"ADD_STARTUP_OBJECT"
|
||||
"ALIAS" # Option argument
|
||||
"SRC" # Single value arguments
|
||||
"DEPENDS;COMPILE_OPTIONS" # Multi value arguments
|
||||
@@ -8,23 +8,23 @@ function(add_loader_object name)
|
||||
)
|
||||
|
||||
get_fq_target_name(${name} fq_target_name)
|
||||
get_fq_deps_list(fq_deps_list ${ADD_LOADER_OBJECT_DEPENDS})
|
||||
if(ADD_LOADER_OBJECT_ALIAS)
|
||||
list(LENGTH ADD_LOADER_OBJECT_DEPENDS deps_size)
|
||||
get_fq_deps_list(fq_deps_list ${ADD_STARTUP_OBJECT_DEPENDS})
|
||||
if(ADD_STARTUP_OBJECT_ALIAS)
|
||||
list(LENGTH ADD_STARTUP_OBJECT_DEPENDS deps_size)
|
||||
if(NOT (${deps_size} EQUAL "1"))
|
||||
message(FATAL_ERROR "A loader object alias should have exactly one dependency.")
|
||||
message(FATAL_ERROR "A startup object alias should have exactly one dependency.")
|
||||
endif()
|
||||
list(GET ADD_LOADER_OBJECT_DEPENDS 0 dep)
|
||||
list(GET ADD_STARTUP_OBJECT_DEPENDS 0 dep)
|
||||
get_fq_dep_name(fq_dep_name ${dep})
|
||||
|
||||
add_custom_target(${fq_target_name})
|
||||
add_dependencies(${fq_target_name} ${fq_dep_name})
|
||||
get_target_property(loader_object ${fq_dep_name} LOADER_OBJECT)
|
||||
get_target_property(startup_object ${fq_dep_name} STARTUP_OBJECT)
|
||||
set_target_properties(
|
||||
${fq_target_name}
|
||||
PROPERTIES
|
||||
"TARGET_TYPE" "${OBJECT_LIBRARY_TARGET_TYPE}"
|
||||
"LOADER_OBJECT" "${loader_object}"
|
||||
"STARTUP_OBJECT" "${startup_object}"
|
||||
"OBJECT_FILES" ""
|
||||
"DEPS" "${fq_dep_name}"
|
||||
)
|
||||
@@ -33,9 +33,9 @@ function(add_loader_object name)
|
||||
|
||||
add_object_library(
|
||||
${name}.__objects__
|
||||
SRCS ${ADD_LOADER_OBJECT_SRC}
|
||||
DEPENDS ${ADD_LOADER_OBJECT_DEPENDS}
|
||||
COMPILE_OPTIONS ${ADD_LOADER_OBJECT_COMPILE_OPTIONS}
|
||||
SRCS ${ADD_STARTUP_OBJECT_SRC}
|
||||
DEPENDS ${ADD_STARTUP_OBJECT_DEPENDS}
|
||||
COMPILE_OPTIONS ${ADD_STARTUP_OBJECT_COMPILE_OPTIONS}
|
||||
)
|
||||
|
||||
set(objfile ${LIBC_BUILD_DIR}/lib/${name}.o)
|
||||
@@ -52,33 +52,33 @@ function(add_loader_object name)
|
||||
${fq_target_name}
|
||||
PROPERTIES
|
||||
"TARGET_TYPE" "${OBJECT_LIBRARY_TARGET_TYPE}"
|
||||
"LOADER_OBJECT" "${objfile}"
|
||||
"STARTUP_OBJECT" "${objfile}"
|
||||
"OBJECT_FILES" ""
|
||||
"DEPS" "${fq_target_name}.__objects__"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
if(NOT (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE}))
|
||||
message(STATUS "Skipping loader for target architecture ${LIBC_TARGET_ARCHITECTURE}")
|
||||
message(STATUS "Skipping startup for target architecture ${LIBC_TARGET_ARCHITECTURE}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_subdirectory(${LIBC_TARGET_ARCHITECTURE})
|
||||
|
||||
add_loader_object(
|
||||
add_startup_object(
|
||||
crt1
|
||||
ALIAS
|
||||
DEPENDS
|
||||
.${LIBC_TARGET_ARCHITECTURE}.crt1
|
||||
)
|
||||
|
||||
add_loader_object(
|
||||
add_startup_object(
|
||||
crti
|
||||
SRC
|
||||
crti.cpp
|
||||
)
|
||||
|
||||
add_loader_object(
|
||||
add_startup_object(
|
||||
crtn
|
||||
SRC
|
||||
crtn.cpp
|
||||
@@ -87,10 +87,10 @@ add_loader_object(
|
||||
add_custom_target(libc-startup)
|
||||
set(startup_components crt1 crti crtn)
|
||||
foreach(target IN LISTS startup_components)
|
||||
set(fq_target_name libc.loader.linux.${target})
|
||||
set(fq_target_name libc.startup.linux.${target})
|
||||
add_dependencies(libc-startup ${fq_target_name})
|
||||
get_target_property(loader_object ${fq_target_name} LOADER_OBJECT)
|
||||
install(FILES ${loader_object}
|
||||
get_target_property(startup_object ${fq_target_name} STARTUP_OBJECT)
|
||||
install(FILES ${startup_object}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT ${LIBC_COMPONENT})
|
||||
endforeach()
|
||||
@@ -1,4 +1,4 @@
|
||||
add_loader_object(
|
||||
add_startup_object(
|
||||
crt1
|
||||
SRC
|
||||
start.cpp
|
||||
@@ -1,4 +1,4 @@
|
||||
add_loader_object(
|
||||
add_startup_object(
|
||||
crt1
|
||||
SRC
|
||||
start.cpp
|
||||
@@ -15,6 +15,6 @@ set_target_properties(libc_integration_test_dummy
|
||||
ARCHIVE_OUTPUT_NAME dummy
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_subdirectory(loader)
|
||||
add_subdirectory(startup)
|
||||
add_subdirectory(scudo)
|
||||
add_subdirectory(src)
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
if(NOT (EXISTS ${LIBC_SOURCE_DIR}/loader/linux/${LIBC_TARGET_ARCHITECTURE}))
|
||||
message("Skipping loader integration tests for target architecture ${LIBC_TARGET_ARCHITECTURE}.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_custom_target(libc-loader-tests)
|
||||
add_dependencies(libc-integration-tests libc-loader-tests)
|
||||
|
||||
add_integration_test(
|
||||
loader_args_test
|
||||
SUITE libc-loader-tests
|
||||
LOADER
|
||||
libc.loader.linux.crt1
|
||||
SRCS
|
||||
args_test.cpp
|
||||
ARGS
|
||||
1 2 3
|
||||
ENV
|
||||
FRANCE=Paris
|
||||
GERMANY=Berlin
|
||||
)
|
||||
|
||||
add_integration_test(
|
||||
loader_no_envp_test
|
||||
SUITE libc-loader-tests
|
||||
LOADER
|
||||
libc.loader.linux.crt1
|
||||
SRCS
|
||||
main_without_envp.cpp
|
||||
)
|
||||
|
||||
add_integration_test(
|
||||
loader_no_args_test
|
||||
SUITE libc-loader-tests
|
||||
LOADER
|
||||
libc.loader.linux.crt1
|
||||
SRCS
|
||||
main_without_args.cpp
|
||||
)
|
||||
|
||||
add_integration_test(
|
||||
loader_tls_test
|
||||
SUITE libc-loader-tests
|
||||
LOADER
|
||||
libc.loader.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-loader-tests
|
||||
LOADER
|
||||
libc.loader.linux.crt1
|
||||
SRCS
|
||||
init_fini_array_test.cpp
|
||||
)
|
||||
@@ -5,9 +5,9 @@ endif()
|
||||
# We use a special library consisting of only the SCUDO allocator
|
||||
# functions to link to the integration tests below. We could instead
|
||||
# link to libllvmlibc.a directly, but since libllvmlibc.a contains
|
||||
# functions which depend on the LLVM libc loader, the integration
|
||||
# test will have to link to the LLVM libc loader. LLVM libc's loader
|
||||
# is not complete enough to allow this. It is also desireable to
|
||||
# functions which depend on the LLVM libc startup system, the integration
|
||||
# test will have to link to the LLVM libc startup system. LLVM libc's startup
|
||||
# system is not complete enough to allow this. It is also desireable to
|
||||
# keep the dependencies as minimal as possible.
|
||||
add_entrypoint_library(
|
||||
libc_for_scudo_integration_test
|
||||
|
||||
@@ -11,8 +11,8 @@ add_integration_test(
|
||||
libc-support-threads-integration-tests
|
||||
SRCS
|
||||
thread_detach_test.cpp
|
||||
LOADER
|
||||
libc.loader.linux.crt1
|
||||
STARTUP
|
||||
libc.startup.linux.crt1
|
||||
DEPENDS
|
||||
libc.src.__support.threads.mutex
|
||||
libc.src.__support.threads.thread
|
||||
@@ -24,8 +24,8 @@ add_integration_test(
|
||||
libc-support-threads-integration-tests
|
||||
SRCS
|
||||
thread_tls_test.cpp
|
||||
LOADER
|
||||
libc.loader.linux.crt1
|
||||
STARTUP
|
||||
libc.startup.linux.crt1
|
||||
DEPENDS
|
||||
libc.src.__support.threads.thread
|
||||
)
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
@@ -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})
|
||||
@@ -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})
|
||||
@@ -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})
|
||||
62
libc/test/integration/startup/linux/CMakeLists.txt
Normal file
62
libc/test/integration/startup/linux/CMakeLists.txt
Normal file
@@ -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
|
||||
)
|
||||
@@ -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}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user