diff --git a/src/mpt/CMakeLists.txt b/src/mpt/CMakeLists.txt index 4b759c7..5c9ec7f 100644 --- a/src/mpt/CMakeLists.txt +++ b/src/mpt/CMakeLists.txt @@ -16,6 +16,7 @@ option(MPT_ENABLE_SELFTEST "Enable multi-process test-framework self test" OFF) set(MPT_CMAKE "${CMAKE_CURRENT_SOURCE_DIR}/mpt/cmake/MPT.cmake") set(MPT_SOURCE_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(MPT_BINARY_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}") +set(MPT_DEFAULT_TIMEOUT "60") add_subdirectory(mpt) add_subdirectory(tests) diff --git a/src/mpt/mpt/cmake/MPT.cmake b/src/mpt/mpt/cmake/MPT.cmake index a9fad3d..fa57c2b 100644 --- a/src/mpt/mpt/cmake/MPT.cmake +++ b/src/mpt/mpt/cmake/MPT.cmake @@ -11,8 +11,6 @@ # set(MPT_DIR "${CMAKE_CURRENT_LIST_DIR}/..") - - function(parse_mpt_fixtures INPUT TEST_DISABLED TEST_TIMEOUT TEST_XFAIL) set(s "[ \t\r\n]") if(INPUT MATCHES ".disabled${s}*=${s}*([tT][rR][uU][eE]|[0-9]+)") @@ -24,7 +22,7 @@ function(parse_mpt_fixtures INPUT TEST_DISABLED TEST_TIMEOUT TEST_XFAIL) if(INPUT MATCHES ".timeout${s}*=${s}*([0-9]+)") set(${TEST_TIMEOUT} "${CMAKE_MATCH_1}" PARENT_SCOPE) else() - set(${TEST_TIMEOUT} "0" PARENT_SCOPE) + set(${TEST_TIMEOUT} "${MPT_DEFAULT_TIMEOUT}" PARENT_SCOPE) endif() if(INPUT MATCHES ".xfail${s}*=${s}*([tT][rR][uU][eE]|[0-9]+)") diff --git a/src/mpt/mpt/include/mpt/mpt.h b/src/mpt/mpt/include/mpt/mpt.h index 8d0522a..719c9d6 100644 --- a/src/mpt/mpt/include/mpt/mpt.h +++ b/src/mpt/mpt/include/mpt/mpt.h @@ -154,5 +154,4 @@ MPT_TestFiniDeclaration(suite, test) \ /* Helpful function to check for patterns in log callbacks. */ int mpt_patmatch(const char *pat, const char *str); - #endif /* MPT_H_INCLUDED */ diff --git a/src/mpt/mpt/include/mpt/resource.h.in b/src/mpt/mpt/include/mpt/resource.h.in index 13c5711..258e597 100644 --- a/src/mpt/mpt/include/mpt/resource.h.in +++ b/src/mpt/mpt/include/mpt/resource.h.in @@ -2,5 +2,6 @@ #define MPT_RESOURCE_H_INCLUDED #define MPT_SOURCE_ROOT_DIR "@MPT_SOURCE_ROOT_DIR@" +#define MPT_DEFAULT_TIMEOUT (@MPT_DEFAULT_TIMEOUT@) /* Seconds. */ #endif /* MPT_RESOURCE_H_INCLUDED */ diff --git a/src/mpt/mpt/src/main.c.in b/src/mpt/mpt/src/main.c.in index fb5aaba..14ca113 100644 --- a/src/mpt/mpt/src/main.c.in +++ b/src/mpt/mpt/src/main.c.in @@ -157,10 +157,9 @@ mpt_test_new(const char* name, int secs, bool xf) * So, make sure that the 'manual' timeout takes longer than the ctest * timeout. */ if (secs == 0) { - test->timeout = DDS_SECS(1600); - } else { - test->timeout = DDS_SECS(secs * 2); + secs = MPT_DEFAULT_TIMEOUT; } + test->timeout = DDS_SECS(secs + 5); return test; } diff --git a/src/mpt/tests/self/fixtures.c b/src/mpt/tests/self/fixtures.c index 25b5782..a07bc6f 100644 --- a/src/mpt/tests/self/fixtures.c +++ b/src/mpt/tests/self/fixtures.c @@ -70,3 +70,6 @@ MPT_Test(disabled, _false, .disabled=false); * This can only really be done manually, unfortunately. */ MPT_TestProcess(timeout, child_culling, id, proc_sleep, MPT_ArgValues(DDS_SECS(120))); MPT_Test(timeout, child_culling, .timeout=1); + +MPT_TestProcess(timeout, default_timeout, id, proc_sleep, MPT_ArgValues(DDS_SECS(120))); +MPT_Test(timeout, default_timeout);