From ac8fb636a13b22a038b2d9e9805711898125804b Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Tue, 4 Oct 2016 12:48:24 -0400 Subject: [PATCH] Add option to set test timeout Some tests take 20 or more minutes to run before they timeout, this allows to limit their runtime if needed. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e46741e..f6f74e6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,6 +251,8 @@ target_link_modules(toxencryptsave toxcore) # ################################################################################ +set(TEST_TIMEOUT_SECONDS "" CACHE STRING "Limit runtime of each test to the number of seconds specified") + if(APIDSL AND ASTYLE) add_test( NAME format_test @@ -258,6 +260,7 @@ if(APIDSL AND ASTYLE) "${CMAKE_SOURCE_DIR}" "${APIDSL}" "${ASTYLE}") + set_tests_properties(format_test PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}") endif() function(auto_test target) @@ -271,6 +274,7 @@ function(auto_test target) target_link_modules(auto_${target}_test toxav) endif() add_test(NAME ${target} COMMAND auto_${target}_test) + set_tests_properties(${target} PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}") endif() endfunction()