1 # A rule to add startup system tests. When we have a complete startup system,
2 # we should be able to use the add_libc_unittest rule or an extension of it.
3 # But, while the system is being developed, we need to use a special rule like
5 function(add_startup_test target_name)
6 if(NOT CMAKE_HOST_UNIX)
9 "Test for the startup system currently assume a POSIX/Unix like "
10 "environment and may not work on your platform.")
13 cmake_parse_arguments(
15 "" # No option arguments
16 "SRC" # Single value arguments
17 "DEPENDS;ARGS;ENV" # Multivalue arguments.
21 get_fq_target_name(${target_name} fq_target_name)
25 ${ADD_STARTUP_TEST_SRC}
28 set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
30 target_include_directories(
35 ${LIBC_BUILD_DIR}/include
38 if(ADD_STARTUP_TEST_DEPENDS)
39 get_fq_deps_list(fq_deps_list ${ADD_STARTUP_TEST_DEPENDS})
40 add_dependencies(${fq_target_name} ${fq_deps_list})
41 get_object_files_for_test(link_object_files has_skipped_entrypoint_list ${fq_deps_list})
42 target_link_libraries(${fq_target_name} ${link_object_files})
52 TARGET ${fq_target_name}
54 COMMAND ${ADD_STARTUP_TEST_ENV} $<TARGET_FILE:${fq_target_name}> ${ADD_STARTUP_TEST_ARGS}
57 add_dependencies(libc_startup_tests ${fq_target_name})
58 endfunction(add_startup_test)
60 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
61 add_subdirectory(${LIBC_TARGET_OS})