#14584 Move ResInsight-tests out of the shared build root

ResInsight-tests linked into the build root and copied its full runtime DLL
set there as a POST_BUILD step, the same pattern that made
extract-projectfile-versions race against the generated_classes.py edge. The
set is a superset of the one that failed, covering Qt6Gui, Qt6Widgets and the
rest, and nothing orders it against the code generation edge either. It fires
rarely only because copy_if_different compares content, so windeployqt having
already placed identical DLLs makes it a no-op. On a cold build where the copy
wins that race it genuinely writes.

Give the target its own RUNTIME_OUTPUT_DIRECTORY, and point the companion
PreBuildFileCopyTest target at the same directory so the ODB, OpenVDS and HDF5
runtime files stay next to the executable. That target runs before the link
creates the directory, so create it first.

Update the three workflows that run the test executable by path.
This commit is contained in:
Magne Sjaastad
2026-08-22 11:50:55 +02:00
parent f68c0fe2cb
commit c6c5ff5808
4 changed files with 29 additions and 8 deletions
+23 -2
View File
@@ -222,7 +222,23 @@ set_property(
TARGET ResInsightDummyTestTarget PROPERTY FOLDER "FileCopyTargetsTest"
)
# create a custom target that copies the files to the build folder
# Keep the test executable out of the shared build root. The POST_BUILD step
# below copies the Qt runtime DLLs next to the executable, and the build root
# has ResInsight.exe running out of it during Python code generation with those
# same DLLs loaded. Overwriting a mapped DLL is a sharing violation on Windows,
# and nothing orders the two build edges relative to each other.
set(RESINSIGHT_TESTS_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# create a custom target that copies the files to the test output folder
list(
APPEND
copyCommands
COMMAND
${CMAKE_COMMAND}
-E
make_directory
${RESINSIGHT_TESTS_OUTPUT_DIRECTORY}
)
foreach(riFileName ${RI_FILENAMES})
list(
APPEND
@@ -232,7 +248,7 @@ foreach(riFileName ${RI_FILENAMES})
-E
copy_if_different
${riFileName}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
${RESINSIGHT_TESTS_OUTPUT_DIRECTORY}
)
endforeach()
add_custom_target(PreBuildFileCopyTest ${copyCommands})
@@ -243,6 +259,11 @@ qt_add_executable(ResInsight-tests ${SOURCE_UNITTEST_FILES} main.cpp)
# Make ResInsight-tests depend on the prebuild target.
add_dependencies(ResInsight-tests PreBuildFileCopyTest)
set_target_properties(
ResInsight-tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${RESINSIGHT_TESTS_OUTPUT_DIRECTORY}
)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/RiaTestDataDirectory.h.cmake
${CMAKE_BINARY_DIR}/Generated/RiaTestDataDirectory.h