Tests: Cover rebuild with multiple custom command outputs (#15116)
Extend the BuildDepends test with a case covering multiple custom command outputs with the second one consumed by another rule. With the old "multiple output pair" infrastructure used in the Makefile and Xcode generators this did not work. Now that it is fixed, test the case explicitly.
This commit is contained in:
parent
644b4688d7
commit
65ea5eb721
|
@ -65,6 +65,7 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h
|
|||
set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt)
|
||||
|
||||
file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n")
|
||||
file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n")
|
||||
|
||||
help_xcode_depends()
|
||||
|
||||
|
@ -177,6 +178,19 @@ else()
|
|||
"external.out is missing")
|
||||
endif()
|
||||
|
||||
if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt)
|
||||
file(STRINGS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt multi1_out)
|
||||
if("${multi1_out}" STREQUAL "multi1-in original")
|
||||
message(STATUS "multi1-out2-copy.txt contains '${multi1_out}'")
|
||||
else()
|
||||
message(SEND_ERROR "Project did not initially build properly: "
|
||||
"multi1-out2-copy.txt contains '${multi1_out}'")
|
||||
endif()
|
||||
else()
|
||||
message(SEND_ERROR "Project did not initially build properly: "
|
||||
"multi1-out2-copy.txt is missing")
|
||||
endif()
|
||||
|
||||
message("Waiting 3 seconds...")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 3)
|
||||
|
||||
|
@ -202,6 +216,7 @@ if(TEST_LINK_DEPENDS)
|
|||
endif()
|
||||
|
||||
file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external changed\n")
|
||||
file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in changed\n")
|
||||
|
||||
help_xcode_depends()
|
||||
|
||||
|
@ -319,3 +334,16 @@ else()
|
|||
message(SEND_ERROR "Project did not rebuild properly: "
|
||||
"external.out is missing")
|
||||
endif()
|
||||
|
||||
if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt)
|
||||
file(STRINGS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt multi1_out)
|
||||
if("${multi1_out}" STREQUAL "multi1-in changed")
|
||||
message(STATUS "multi1-out2-copy.txt contains '${multi1_out}'")
|
||||
else()
|
||||
message(SEND_ERROR "Project did not rebuild properly: "
|
||||
"multi1-out2-copy.txt contains '${multi1_out}'")
|
||||
endif()
|
||||
else()
|
||||
message(SEND_ERROR "Project did not rebuild properly: "
|
||||
"multi1-out2-copy.txt is missing")
|
||||
endif()
|
||||
|
|
|
@ -151,3 +151,16 @@ ExternalProject_Add(ExternalBuild
|
|||
-Dexternal_out=${CMAKE_CURRENT_BINARY_DIR}/external.out
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT multi1-out1.txt multi1-out2.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E copy multi1-in.txt multi1-out1.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E copy multi1-in.txt multi1-out2.txt
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/multi1-in.txt
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT multi1-out2-copy.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E copy multi1-out2.txt multi1-out2-copy.txt
|
||||
DEPENDS multi1-out2.txt
|
||||
)
|
||||
add_custom_target(multi1 ALL DEPENDS multi1-out2-copy.txt)
|
||||
|
|
Loading…
Reference in New Issue