mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-28 11:57:24 +08:00
cmake: add SDL_TESTS_TIMEOUT_MULTIPLIER to account for slower machines
This commit is contained in:
committed by
Anonymous Maarten
parent
f85ef6fc3c
commit
0ab99ffb2a
+10
-7
@@ -23,6 +23,7 @@ if(EMSCRIPTEN OR N3DS OR PS2 OR PSP OR RISCOS OR VITA)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" ${SDL_TESTS_LINK_SHARED_DEFAULT})
|
option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" ${SDL_TESTS_LINK_SHARED_DEFAULT})
|
||||||
|
set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Timeout multiplier to account for really slow machines")
|
||||||
|
|
||||||
if(SDL_TESTS_LINK_SHARED)
|
if(SDL_TESTS_LINK_SHARED)
|
||||||
set(sdl_name_component SDL3)
|
set(sdl_name_component SDL3)
|
||||||
@@ -362,17 +363,19 @@ set(TESTS_ENVIRONMENT
|
|||||||
SDL_VIDEO_DRIVER=dummy
|
SDL_VIDEO_DRIVER=dummy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function(sdl_set_test_timeout TEST TIMEOUT)
|
||||||
|
math(EXPR TIMEOUT "${TIMEOUT}*${SDL_TESTS_TIMEOUT_MULTIPLIER}")
|
||||||
|
set_tests_properties(${test} PROPERTIES TIMEOUT "${TIMEOUT}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE})
|
foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE})
|
||||||
add_test(
|
add_test(
|
||||||
NAME ${TESTCASE}
|
NAME ${TESTCASE}
|
||||||
COMMAND ${TESTCASE}
|
COMMAND ${TESTCASE}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
set_tests_properties(${TESTCASE}
|
set_tests_properties(${TESTCASE} PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}")
|
||||||
PROPERTIES
|
sdl_set_test_timeout(${TESTCASE} 10)
|
||||||
ENVIRONMENT "${TESTS_ENVIRONMENT}"
|
|
||||||
TIMEOUT 10
|
|
||||||
)
|
|
||||||
if(SDL_INSTALL_TESTS)
|
if(SDL_INSTALL_TESTS)
|
||||||
set(exe ${TESTCASE})
|
set(exe ${TESTCASE})
|
||||||
set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL3")
|
set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL3")
|
||||||
@@ -384,8 +387,8 @@ foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE})
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set_tests_properties(testthread PROPERTIES TIMEOUT 40)
|
sdl_set_test_timeout(testthread 40)
|
||||||
set_tests_properties(testtimer PROPERTIES TIMEOUT 60)
|
sdl_set_test_timeout(testtimer 60)
|
||||||
|
|
||||||
if(SDL_INSTALL_TESTS)
|
if(SDL_INSTALL_TESTS)
|
||||||
if(RISCOS)
|
if(RISCOS)
|
||||||
|
|||||||
Reference in New Issue
Block a user