mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Tests/Instrumentation: Split make cases out to separate suite
These tests experience frequent timeouts in CI, which are either actual timeouts due to low resource runners, or a platform-specific bug causing an indefinite hang. Either way, it's beneficial to locate these in their own test suite to reduce noise and ensure the rest of the tests pass regularly.
This commit is contained in:
@@ -134,5 +134,5 @@ list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
|
|||||||
|
|
||||||
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
|
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
|
||||||
kwsys.testProcess-10 # See Source/kwsys/CTestCustom.cmake.in
|
kwsys.testProcess-10 # See Source/kwsys/CTestCustom.cmake.in
|
||||||
RunCMake.InstrumentationInterrupt # interrupts cmake with a real signal
|
RunCMake.InstrumentationInterruptReal # interrupts cmake with a real signal
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -443,20 +443,27 @@ add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE}
|
|||||||
-DCMake_TEST_MODULE_COMPILATION_RULES=${CMake_TEST_MODULE_COMPILATION_RULES}
|
-DCMake_TEST_MODULE_COMPILATION_RULES=${CMake_TEST_MODULE_COMPILATION_RULES}
|
||||||
-DCMake_TEST_CXX_STDLIB_MODULES_JSON=${CMake_TEST_CXX_STDLIB_MODULES_JSON})
|
-DCMake_TEST_CXX_STDLIB_MODULES_JSON=${CMake_TEST_CXX_STDLIB_MODULES_JSON})
|
||||||
if(CMAKE_GENERATOR MATCHES "Make|Ninja|FASTBuild")
|
if(CMAKE_GENERATOR MATCHES "Make|Ninja|FASTBuild")
|
||||||
add_RunCMake_test(Instrumentation -DPython_EXECUTABLE=${Python_EXECUTABLE}
|
function(add_RunCMake_Instrumentation_test variant)
|
||||||
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
|
add_RunCMake_test(Instrumentation${variant}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
TEST_DIR Instrumentation
|
||||||
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}
|
-DPython_EXECUTABLE=${Python_EXECUTABLE}
|
||||||
-DCMAKE_EXECUTABLE_SUFFIX=${CMAKE_EXECUTABLE_SUFFIX}
|
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
|
||||||
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
# The real-signal/console-event interrupt case runs in its own suite so it can
|
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}
|
||||||
# be excluded from MemCheck (the interrupted cmake is killed by a real signal)
|
-DCMAKE_EXECUTABLE_SUFFIX=${CMAKE_EXECUTABLE_SUFFIX}
|
||||||
# without dropping leak coverage for the rest of the instrumentation tests.
|
-DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA}
|
||||||
add_RunCMake_test(InstrumentationInterrupt TEST_DIR Instrumentation
|
-DCMake_TEST_INSTRUMENTATION_VARIANT=${variant}
|
||||||
-DINSTRUMENTATION_INTERRUPT_REAL=1
|
)
|
||||||
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
|
set_property(TEST RunCMake.Instrumentation${variant} APPEND PROPERTY
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
LABELS "Instrumentation"
|
||||||
-DCMAKE_EXECUTABLE_SUFFIX=${CMAKE_EXECUTABLE_SUFFIX})
|
)
|
||||||
|
endfunction()
|
||||||
|
add_RunCMake_Instrumentation_test("")
|
||||||
|
add_RunCMake_Instrumentation_test(MakeProgram)
|
||||||
|
# The real-signal/console-event interrupt case runs in its own suite so it
|
||||||
|
# can be excluded from MemCheck (the interrupted cmake is killed by a real
|
||||||
|
# signal).
|
||||||
|
add_RunCMake_Instrumentation_test(InterruptReal)
|
||||||
endif()
|
endif()
|
||||||
add_RunCMake_test(ConfigDir)
|
add_RunCMake_test(ConfigDir)
|
||||||
if(CMake_TEST_FindPython2)
|
if(CMake_TEST_FindPython2)
|
||||||
|
|||||||
@@ -36,6 +36,25 @@ function(instrument test)
|
|||||||
"BAD_QUERY"
|
"BAD_QUERY"
|
||||||
)
|
)
|
||||||
cmake_parse_arguments(ARGS "${OPTIONS}" "CHECK_SCRIPT" "CONFIGURE_ARGS" ${ARGN})
|
cmake_parse_arguments(ARGS "${OPTIONS}" "CHECK_SCRIPT" "CONFIGURE_ARGS" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT CMake_TEST_INSTRUMENTATION_VARIANT)
|
||||||
|
if(ARGS_BUILD_MAKE_PROGRAM OR ARGS_INTERRUPT OR ARGS_INSTALL_INTERRUPT OR ARGS_CTEST_INTERRUPT)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMake_TEST_INSTRUMENTATION_VARIANT STREQUAL "MakeProgram")
|
||||||
|
if(NOT ARGS_BUILD_MAKE_PROGRAM)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMake_TEST_INSTRUMENTATION_VARIANT STREQUAL "InterruptReal")
|
||||||
|
if(NOT (ARGS_INTERRUPT OR ARGS_INSTALL_INTERRUPT OR ARGS_CTEST_INTERRUPT))
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test})
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test})
|
||||||
set(v1 ${RunCMake_TEST_BINARY_DIR}/.cmake/instrumentation/v1)
|
set(v1 ${RunCMake_TEST_BINARY_DIR}/.cmake/instrumentation/v1)
|
||||||
set(v1 ${v1} PARENT_SCOPE)
|
set(v1 ${v1} PARENT_SCOPE)
|
||||||
@@ -548,17 +567,21 @@ instrument(cmake-command-custom-content
|
|||||||
CONFIGURE_ARGS "-DN=2"
|
CONFIGURE_ARGS "-DN=2"
|
||||||
CHECK_SCRIPT check-custom-content.cmake
|
CHECK_SCRIPT check-custom-content.cmake
|
||||||
)
|
)
|
||||||
set(indexDir ${v1}/data/index)
|
if(NOT CMake_TEST_INSTRUMENTATION_VARIANT)
|
||||||
set(fakeIndex ${indexDir}/index-0.json)
|
set(indexDir ${v1}/data/index)
|
||||||
file(MAKE_DIRECTORY ${indexDir})
|
set(fakeIndex ${indexDir}/index-0.json)
|
||||||
file(TOUCH ${fakeIndex})
|
file(MAKE_DIRECTORY ${indexDir})
|
||||||
|
file(TOUCH ${fakeIndex})
|
||||||
|
endif()
|
||||||
# fakeIndex newer than all content files prevents their deletion
|
# fakeIndex newer than all content files prevents their deletion
|
||||||
set(EXPECTED_CONTENT_FILES 2)
|
set(EXPECTED_CONTENT_FILES 2)
|
||||||
instrument(cmake-command-custom-content
|
instrument(cmake-command-custom-content
|
||||||
NO_CONFIGURE MANUAL_HOOK PRESERVE_DATA
|
NO_CONFIGURE MANUAL_HOOK PRESERVE_DATA
|
||||||
CHECK_SCRIPT check-custom-content-removed.cmake
|
CHECK_SCRIPT check-custom-content-removed.cmake
|
||||||
)
|
)
|
||||||
file(REMOVE ${fakeIndex})
|
if(NOT CMake_TEST_INSTRUMENTATION_VARIANT)
|
||||||
|
file(REMOVE ${fakeIndex})
|
||||||
|
endif()
|
||||||
# old content files will be removed if no index file exists
|
# old content files will be removed if no index file exists
|
||||||
set(EXPECTED_CONTENT_FILES 1)
|
set(EXPECTED_CONTENT_FILES 1)
|
||||||
instrument(cmake-command-custom-content
|
instrument(cmake-command-custom-content
|
||||||
@@ -658,7 +681,7 @@ endif()
|
|||||||
# overall cmakeBuild/cmakeInstall snippet, recording the interrupting signal,
|
# overall cmakeBuild/cmakeInstall snippet, recording the interrupting signal,
|
||||||
# and skips the corresponding post-command hook. These cases use the
|
# and skips the corresponding post-command hook. These cases use the
|
||||||
# deterministic test seam (no OS event); the real OS-event counterparts run in
|
# deterministic test seam (no OS event); the real OS-event counterparts run in
|
||||||
# the separate RunCMake.InstrumentationInterrupt suite.
|
# the separate RunCMake.InstrumentationInterruptReal suite.
|
||||||
instrument(interrupt-build INTERRUPT_SEAM
|
instrument(interrupt-build INTERRUPT_SEAM
|
||||||
CHECK_SCRIPT check-interrupted.cmake
|
CHECK_SCRIPT check-interrupted.cmake
|
||||||
)
|
)
|
||||||
@@ -711,34 +734,32 @@ if(NOT Skip_BUILD_MAKE_PROGRAM_Case)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (INSTRUMENTATION_INTERRUPT_REAL)
|
# RunCMake.InstrumentationInterruptReal runs ONLY the real-signal/
|
||||||
# RunCMake.InstrumentationInterrupt runs ONLY the real-signal/
|
# console-event interrupt case, as it must be excluded from MemCheck.
|
||||||
# console-event interrupt case, as it must be excluded from MemCheck.
|
#
|
||||||
#
|
# POSIX delivers a real SIGINT to a contained process group. On Windows, only
|
||||||
# POSIX delivers a real SIGINT to a contained process group. On Windows, only
|
# the Ninja generator is exercised: its native tool reliably stops on the
|
||||||
# the Ninja generator is exercised: its native tool reliably stops on the
|
# console event and does not re-broadcast it to the runner; the other Windows
|
||||||
# console event and does not re-broadcast it to the runner; the other Windows
|
# make-family generators are covered by the injection seam instead.
|
||||||
# make-family generators are covered by the injection seam instead.
|
if (NOT WIN32 OR RunCMake_GENERATOR MATCHES "Ninja")
|
||||||
if (NOT WIN32 OR RunCMake_GENERATOR MATCHES "Ninja")
|
instrument(interrupt-build INTERRUPT
|
||||||
instrument(interrupt-build INTERRUPT
|
CHECK_SCRIPT check-interrupted.cmake
|
||||||
CHECK_SCRIPT check-interrupted.cmake
|
)
|
||||||
)
|
# Interrupt a parallel `cmake --install` with a real OS signal, proving the
|
||||||
# Interrupt a parallel `cmake --install` with a real OS signal, proving the
|
# cooperative cancellation stops pending install scripts and skips the hook.
|
||||||
# cooperative cancellation stops pending install scripts and skips the hook.
|
instrument(interrupt-install INSTALL_INTERRUPT
|
||||||
instrument(interrupt-install INSTALL_INTERRUPT
|
CHECK_SCRIPT check-installation-interrupted.cmake
|
||||||
CHECK_SCRIPT check-installation-interrupted.cmake
|
)
|
||||||
)
|
# Interrupt a `ctest` run with a real OS signal, proving the scheduler stops
|
||||||
# Interrupt a `ctest` run with a real OS signal, proving the scheduler stops
|
# launching pending tests, skips the hook, and preserves the `ctest -F`
|
||||||
# launching pending tests, skips the hook, and preserves the `ctest -F`
|
# checkpoint so the interrupted test set can be resumed.
|
||||||
# checkpoint so the interrupted test set can be resumed.
|
instrument(interrupt-test CTEST_INTERRUPT
|
||||||
instrument(interrupt-test CTEST_INTERRUPT
|
CHECK_SCRIPT check-test-interrupted.cmake
|
||||||
CHECK_SCRIPT check-test-interrupted.cmake
|
)
|
||||||
)
|
# Interrupt a `ctest` run and then resume it with `ctest -F`, proving the
|
||||||
# Interrupt a `ctest` run and then resume it with `ctest -F`, proving the
|
# checkpoint keeps the finished test (skipped on resume) but not the
|
||||||
# checkpoint keeps the finished test (skipped on resume) but not the
|
# in-flight test killed by the interrupt (re-run on resume).
|
||||||
# in-flight test killed by the interrupt (re-run on resume).
|
instrument(interrupt-test-failover CTEST_FAILOVER
|
||||||
instrument(interrupt-test-failover CTEST_FAILOVER
|
CHECK_SCRIPT check-test-failover.cmake
|
||||||
CHECK_SCRIPT check-test-failover.cmake
|
)
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user