Use resource lock to avoid concurrent execution of tests requiring Syncthing test instance

This is likely the cleaner approach compared to just enforcing a serial run
for the CLI test.
This commit is contained in:
Martchus 2021-10-13 00:14:35 +02:00
parent 1f74a82ecb
commit 3b50d78f1e
4 changed files with 17 additions and 2 deletions

View File

@ -44,7 +44,7 @@ include(ShellCompletion)
include(Doxygen)
include(ConfigHeader)
# avoid running this test in parallel with other tests as it interferes with the connector test
# avoid running this test in parallel with other tests spawning a Syncthing test instance
if (META_MAIN_TEST_NAME)
set_tests_properties("${META_MAIN_TEST_NAME}" PROPERTIES RUN_SERIAL TRUE)
set_tests_properties("${META_MAIN_TEST_NAME}" PROPERTIES RESOURCE_LOCK "syncthingtestinstance")
endif ()

View File

@ -137,5 +137,10 @@ include(LibraryTarget)
list(APPEND TEST_LIBRARIES syncthingtesthelper)
include(TestTarget)
# avoid running this test in parallel with other tests spawning a Syncthing test instance
if (META_MAIN_TEST_NAME)
set_tests_properties("${META_MAIN_TEST_NAME}" PROPERTIES RESOURCE_LOCK "syncthingtestinstance")
endif ()
include(Doxygen)
include(ConfigHeader)

View File

@ -248,3 +248,8 @@ if (NOT BUILD_SHARED_LIBS
DESTINATION "lib${SELECTED_LIB_SUFFIX}"
COMPONENT binary)
endif ()
# avoid running this test in parallel with other tests spawning a Syncthing test instance
if (META_MAIN_TEST_NAME)
set_tests_properties("${META_MAIN_TEST_NAME}" PROPERTIES RESOURCE_LOCK "syncthingtestinstance")
endif ()

View File

@ -49,3 +49,8 @@ include(ConfigHeader)
# exclude the target from 'all' target so it is only built when tests are built
set_target_properties("${META_TARGET_NAME}" PROPERTIES EXCLUDE_FROM_ALL ON)
# avoid running this test in parallel with other tests spawning a Syncthing test instance
if (META_MAIN_TEST_NAME)
set_tests_properties("${META_MAIN_TEST_NAME}" PROPERTIES RESOURCE_LOCK "syncthingtestinstance")
endif ()