cmake: add automation and platform test without simd

main
Anonymous Maarten 2024-02-23 23:38:07 +01:00 committed by Sam Lantinga
parent 1d0e5286aa
commit 89b135e570
1 changed files with 24 additions and 13 deletions

View File

@ -583,41 +583,52 @@ set(TESTS_ENVIRONMENT
PATH=$<TARGET_FILE_DIR:SDL3::${sdl_name_component}> PATH=$<TARGET_FILE_DIR:SDL3::${sdl_name_component}>
) )
foreach(TEST ${SDL_TEST_EXECUTABLES}) function(add_sdl_test TEST TARGET)
get_property(noninteractive TARGET ${TEST} PROPERTY SDL_NONINTERACTIVE) cmake_parse_arguments(ast "INSTALL" "" "" ${ARGN})
get_property(noninteractive TARGET ${TARGET} PROPERTY SDL_NONINTERACTIVE)
if(noninteractive) if(noninteractive)
set(command ${TEST}) set(command ${TARGET})
get_property(noninteractive_arguments TARGET ${TEST} PROPERTY SDL_NONINTERACTIVE_ARGUMENTS) get_property(noninteractive_arguments TARGET ${TARGET} PROPERTY SDL_NONINTERACTIVE_ARGUMENTS)
if(noninteractive_arguments) if(noninteractive_arguments)
list(APPEND command ${noninteractive_arguments}) list(APPEND command ${noninteractive_arguments})
endif() endif()
add_test( add_test(
NAME ${TEST} NAME ${TEST}
COMMAND ${command} COMMAND ${command}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
) )
set_tests_properties(${TEST} PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}") set_tests_properties(${TEST} PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}")
get_property(noninteractive_timeout TARGET ${TEST} PROPERTY SDL_NONINTERACTIVE_TIMEOUT) get_property(noninteractive_timeout TARGET ${TARGET} PROPERTY SDL_NONINTERACTIVE_TIMEOUT)
if(NOT noninteractive_timeout) if(NOT noninteractive_timeout)
set(noninteractive_timeout 10) set(noninteractive_timeout 10)
endif() endif()
math(EXPR noninteractive_timeout "${noninteractive_timeout}*${SDL_TESTS_TIMEOUT_MULTIPLIER}") math(EXPR noninteractive_timeout "${noninteractive_timeout}*${SDL_TESTS_TIMEOUT_MULTIPLIER}")
set_tests_properties(${TEST} PROPERTIES TIMEOUT "${noninteractive_timeout}") set_tests_properties(${TEST} PROPERTIES TIMEOUT "${noninteractive_timeout}")
if(SDL_INSTALL_TESTS) if(ast_INSTALL AND SDL_INSTALL_TESTS)
set(exe ${TEST}) set(exe ${TARGET})
set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL3") set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL3")
configure_file(template.test.in "${exe}.test" @ONLY) configure_file(template.test.in "${exe}.test" @ONLY)
install( install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${exe}.test" FILES "${CMAKE_CURRENT_BINARY_DIR}/${exe}.test"
DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL3 DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL3
) )
endif() endif()
if(TARGET pretest AND NOT "${TEST}" MATCHES "pretest") if(TARGET pretest AND NOT "${TARGET}" MATCHES "pretest")
set_property(TEST ${TEST} APPEND PROPERTY DEPENDS pretest) set_property(TEST ${TEST} APPEND PROPERTY DEPENDS pretest)
endif() endif()
endif() endif()
endfunction()
foreach(TARGET ${SDL_TEST_EXECUTABLES})
add_sdl_test(${TARGET} ${TARGET} INSTALL)
endforeach() endforeach()
add_sdl_test(testautomation-no-simd testautomation)
set_property(TEST testautomation-no-simd APPEND PROPERTY ENVIRONMENT "SDL_CPU_FEATURE_MASK=-all")
add_sdl_test(testplatform-no-simd testplatform)
set_property(TEST testplatform-no-simd APPEND PROPERTY ENVIRONMENT "SDL_CPU_FEATURE_MASK=-all")
if(SDL_INSTALL_TESTS) if(SDL_INSTALL_TESTS)
if(RISCOS) if(RISCOS)
install( install(