Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions cmake/modules/RootCTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,19 @@ foreach(d ${test_list})
endif()
endforeach()

# When ninja is in use, tests that compile an executable might try to rebuild the entire build tree.
# If multiple of these are invoked in parallel, ninja will suffer from race conditions.
# When ninja or the Microsoft generator are in use, tests that compile an executable might try
# to rebuild the entire build tree. If multiple of these are invoked in parallel, ninja will
# suffer from race conditions.
# To solve this, do the following:
# - Add a test that updates the build tree (equivalent to "ninja all"). This one will run in complete isolation.
# - Make all tests that require a ninja build depend on the above test.
# - Use a RESOURCE_LOCK on all tests that invoke ninja, so no two tests will invoke ninja in parallel
if(CMAKE_GENERATOR MATCHES Ninja)
add_test(NAME ninja-build-all
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR})
set_tests_properties(ninja-build-all PROPERTIES
RESOURCE_LOCK NINJA_BUILD
FIXTURES_SETUP NINJA_BUILD_ALL
if(GeneratorNeedsBuildSerialization)
add_test(NAME cmake-build-all
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config ${build_configuration})
set_tests_properties(cmake-build-all PROPERTIES
RESOURCE_LOCK CMAKE_BUILD
FIXTURES_SETUP CMAKE_BUILD_ALL
RUN_SERIAL True)
set(GeneratorNeedsBuildSerialization True)
endif()
18 changes: 9 additions & 9 deletions cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2641,9 +2641,9 @@ macro(ROOTTEST_GENERATE_DICTIONARY dictname)
-- ${always-make})

set_property(TEST ${GENERATE_DICTIONARY_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT})
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()

if (ARG_FIXTURES_SETUP)
Expand Down Expand Up @@ -2749,9 +2749,9 @@ macro(ROOTTEST_GENERATE_REFLEX_DICTIONARY dictionary)
-- ${always-make})

set_property(TEST ${GENERATE_REFLEX_TEST} PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT})
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST ${GENERATE_REFLEX_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()

if (ARG_FIXTURES_SETUP)
Expand Down Expand Up @@ -2861,9 +2861,9 @@ macro(ROOTTEST_GENERATE_EXECUTABLE executable)
RESOURCE_LOCK ${ARG_RESOURCE_LOCK})
endif()

if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST ${GENERATE_EXECUTABLE_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()

if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
Expand Down
6 changes: 3 additions & 3 deletions roottest/cling/dict/ROOT-8096/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ add_test(NAME roottest-cling-dict-ROOT-8096-build
-- ${always-make})
# --target ${targetname_libgen}${fast})
set_property(TEST roottest-cling-dict-ROOT-8096-build PROPERTY ENVIRONMENT ${ROOTTEST_ENVIRONMENT})
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST roottest-cling-dict-ROOT-8096-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()

if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
Expand Down
6 changes: 3 additions & 3 deletions roottest/cling/stl/dicts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ROOTTEST_LINKER_LIBRARY(stldictTest TEST MyClass1.cpp MyClass2.cpp MyClass3.cpp
# of targets. Doing so right now would build the dictionaries twice.
ROOT_ADD_TEST(roottest-cling-stl-dicts-build
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target stldictTest${fast} -- ${always-make})
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST roottest-cling-stl-dicts-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()
6 changes: 3 additions & 3 deletions roottest/root/io/rootcint/sigbug/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ add_test(NAME ${GENERATE_DICTIONARY_TEST}
${build_config}
--target ${dictname}${fast}
-- ${always-make})
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST ${GENERATE_DICTIONARY_TEST} APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()
6 changes: 3 additions & 3 deletions roottest/root/io/tmpifile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ ROOTTEST_ADD_TEST(split-fail

ROOTTEST_ADD_TEST(libjetevent-build
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target JetEvent${fast} -- ${always-make})
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST roottest-root-io-tmpifile-libjetevent-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()

ROOTTEST_ADD_TEST(sync-rate
Expand Down
6 changes: 3 additions & 3 deletions roottest/root/io/transient/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ add_test(NAME roottest-root-io-transient-base-build
--target base${fast}
-- ${always-make})
set_property(TEST roottest-root-io-transient-base-build PROPERTY FIXTURES_SETUP root-io-transient-base-build)
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST roottest-root-io-transient-base-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()

ROOTTEST_ADD_TEST(WriteFile
Expand Down
6 changes: 3 additions & 3 deletions roottest/root/meta/genreflex/ROOT-5768/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ if(NOT MSVC OR win_broken_tests)
ROOTTEST_ADD_TEST(PyCoolLib-build
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} ${build_config} --target PyCoolLib${fast} -- ${always-make}
FIXTURES_REQUIRED PyCool-reflex-dict)
if(CMAKE_GENERATOR MATCHES Ninja)
set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY RESOURCE_LOCK NINJA_BUILD)
set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY FIXTURES_REQUIRED NINJA_BUILD_ALL)
if(GeneratorNeedsBuildSerialization)
set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY RESOURCE_LOCK CMAKE_BUILD)
set_property(TEST roottest-root-meta-genreflex-ROOT-5768-PyCoolLib-build APPEND PROPERTY FIXTURES_REQUIRED CMAKE_BUILD_ALL)
endif()
endif()
Loading