Skip to content

Commit e73f0bc

Browse files
i#5888: Avoid fatal error on lib copy collision (#7264)
Switches from "cmake -E copy" to "cmake -E copy_if_different" for the Windows library copies used for API standalone tests. We have seen sporadic fatal errors from drconfiglib.dll failing to copy, presumably because another rule already copied it. It has proven difficult to figure out which rules are colliding, so we solve this by making it a non-fatal error. Fixes #5888
1 parent 7036e72 commit e73f0bc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

suite/tests/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,15 +970,19 @@ function(add_api_exe test source use_decoder use_static_DR)
970970
COMMAND ${CMAKE_COMMAND} ARGS
971971
-E touch "${drcopy_stamp}"
972972
COMMAND ${CMAKE_COMMAND} ARGS
973-
-E copy "${MAIN_LIBRARY_OUTPUT_DIRECTORY}/dynamorio.dll"
973+
-E copy_if_different "${MAIN_LIBRARY_OUTPUT_DIRECTORY}/dynamorio.dll"
974974
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dynamorio.dll"
975975
# libutil.drconfig_test needs drconfiglib.
976976
COMMAND ${CMAKE_COMMAND} ARGS
977-
-E copy "${MAIN_LIBRARY_OUTPUT_DIRECTORY}/../drconfiglib.dll"
977+
# XXX i#5888: There is a race somewhere causing this copy to sometimes
978+
# fail, presumably because another target already copied it. We use
979+
# copy_if_different to avoid failure if it exists, here and in the other
980+
# copy commands above and below.
981+
-E copy_if_different "${MAIN_LIBRARY_OUTPUT_DIRECTORY}/../drconfiglib.dll"
978982
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/drconfiglib.dll"
979983
# We copy drsyms.dll too, for api.symtest
980984
COMMAND ${CMAKE_COMMAND} ARGS
981-
-E copy "${PROJECT_BINARY_DIR}/ext/${INSTALL_LIB}/drsyms.dll"
985+
-E copy_if_different "${PROJECT_BINARY_DIR}/ext/${INSTALL_LIB}/drsyms.dll"
982986
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/drsyms.dll"
983987
VERBATIM)
984988
add_custom_target(drcopy DEPENDS "${drcopy_stamp}")

0 commit comments

Comments
 (0)