Tests/Ninja*/CustomCommandDepfile: check that deps are in the database
This commit is contained in:
parent
b0177003e1
commit
c22c473bde
@ -10,3 +10,38 @@ if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
|
||||
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
|
||||
endif()
|
||||
|
||||
function(_run_ninja dir)
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
OUTPUT_VARIABLE ninja_stdout
|
||||
ERROR_VARIABLE ninja_stderr
|
||||
RESULT_VARIABLE ninja_result
|
||||
)
|
||||
if(NOT ninja_result EQUAL 0)
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stdout ============
|
||||
${ninja_stdout}
|
||||
=============== end of ninja's stdout ===============
|
||||
")
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stderr ============
|
||||
${ninja_stderr}
|
||||
=============== end of ninja's stderr ===============
|
||||
")
|
||||
message(FATAL_ERROR
|
||||
"top ninja build failed exited with status ${ninja_result}")
|
||||
endif()
|
||||
set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build")
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps hello.copy.c)
|
||||
if (ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of hello.copy.c in the database")
|
||||
endif ()
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps hello.copy2.c)
|
||||
if (ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of hello.copy2.c in the database")
|
||||
endif ()
|
||||
|
@ -0,0 +1,47 @@
|
||||
set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build/build.ninja")
|
||||
file(READ "${log}" build_file)
|
||||
|
||||
set(RunCMake_TEST_FAILED)
|
||||
if(NOT "${build_file}" MATCHES "depfile = test\\.d")
|
||||
string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
|
||||
endif()
|
||||
if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
|
||||
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
|
||||
endif()
|
||||
|
||||
function(_run_ninja dir)
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
OUTPUT_VARIABLE ninja_stdout
|
||||
ERROR_VARIABLE ninja_stderr
|
||||
RESULT_VARIABLE ninja_result
|
||||
)
|
||||
if(NOT ninja_result EQUAL 0)
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stdout ============
|
||||
${ninja_stdout}
|
||||
=============== end of ninja's stdout ===============
|
||||
")
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stderr ============
|
||||
${ninja_stderr}
|
||||
=============== end of ninja's stderr ===============
|
||||
")
|
||||
message(FATAL_ERROR
|
||||
"top ninja build failed exited with status ${ninja_result}")
|
||||
endif()
|
||||
set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build")
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps hello.copy.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy.c in the database")
|
||||
endif ()
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps hello.copy2.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy2.c in the database")
|
||||
endif ()
|
24
Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct.cmake
Normal file
24
Tests/RunCMake/Ninja/CustomCommandDepfileAsByproduct.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
add_custom_command(
|
||||
OUTPUT hello.copy.c
|
||||
BYPRODUCTS "test.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
|
||||
hello.copy.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test.d"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT hello.copy2.c
|
||||
BYPRODUCTS "test_$<CONFIG>.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
|
||||
hello.copy2.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test_$<CONFIG>.d"
|
||||
)
|
||||
|
||||
add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/hello.copy2.c")
|
||||
|
||||
include(CheckNoPrefixSubDir.cmake)
|
@ -0,0 +1,47 @@
|
||||
set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build/build.ninja")
|
||||
file(READ "${log}" build_file)
|
||||
|
||||
set(RunCMake_TEST_FAILED)
|
||||
if(NOT "${build_file}" MATCHES "depfile = test\\.d")
|
||||
string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
|
||||
endif()
|
||||
if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
|
||||
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
|
||||
endif()
|
||||
|
||||
function(_run_ninja dir)
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
OUTPUT_VARIABLE ninja_stdout
|
||||
ERROR_VARIABLE ninja_stderr
|
||||
RESULT_VARIABLE ninja_result
|
||||
)
|
||||
if(NOT ninja_result EQUAL 0)
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stdout ============
|
||||
${ninja_stdout}
|
||||
=============== end of ninja's stdout ===============
|
||||
")
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stderr ============
|
||||
${ninja_stderr}
|
||||
=============== end of ninja's stderr ===============
|
||||
")
|
||||
message(FATAL_ERROR
|
||||
"top ninja build failed exited with status ${ninja_result}")
|
||||
endif()
|
||||
set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build")
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps hello.copy.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy.c in the database")
|
||||
endif ()
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps hello.copy2.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of hello.copy2.c in the database")
|
||||
endif ()
|
24
Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput.cmake
Normal file
24
Tests/RunCMake/Ninja/CustomCommandDepfileAsOutput.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
add_custom_command(
|
||||
OUTPUT hello.copy.c
|
||||
"test.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
|
||||
hello.copy.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test.d"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT hello.copy2.c
|
||||
"test_$<CONFIG>.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/hello.c"
|
||||
hello.copy2.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test_$<CONFIG>.d"
|
||||
)
|
||||
|
||||
add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hello.copy.c"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/hello.copy2.c")
|
||||
|
||||
include(CheckNoPrefixSubDir.cmake)
|
@ -100,6 +100,8 @@ run_CMP0058(NEW-no)
|
||||
run_CMP0058(NEW-by)
|
||||
|
||||
run_cmake_with_options(CustomCommandDepfile -DCMAKE_BUILD_TYPE=Debug)
|
||||
run_cmake_with_options(CustomCommandDepfileAsOutput -DCMAKE_BUILD_TYPE=Debug)
|
||||
run_cmake_with_options(CustomCommandDepfileAsByproduct -DCMAKE_BUILD_TYPE=Debug)
|
||||
run_cmake(CustomCommandJobPool)
|
||||
run_cmake(JobPoolUsesTerminal)
|
||||
|
||||
|
@ -10,3 +10,38 @@ if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
|
||||
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
|
||||
endif()
|
||||
|
||||
function(_run_ninja dir)
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
OUTPUT_VARIABLE ninja_stdout
|
||||
ERROR_VARIABLE ninja_stderr
|
||||
RESULT_VARIABLE ninja_result
|
||||
)
|
||||
if(NOT ninja_result EQUAL 0)
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stdout ============
|
||||
${ninja_stdout}
|
||||
=============== end of ninja's stdout ===============
|
||||
")
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stderr ============
|
||||
${ninja_stderr}
|
||||
=============== end of ninja's stderr ===============
|
||||
")
|
||||
message(FATAL_ERROR
|
||||
"top ninja build failed exited with status ${ninja_result}")
|
||||
endif()
|
||||
set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build")
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps main.copy.c)
|
||||
if (ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of main.copy.c in the database")
|
||||
endif ()
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps main.copy2.c)
|
||||
if (ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of main.copy2.c in the database")
|
||||
endif ()
|
||||
|
@ -0,0 +1,47 @@
|
||||
set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build/CMakeFiles/impl-Debug.ninja")
|
||||
file(READ "${log}" build_file)
|
||||
|
||||
set(RunCMake_TEST_FAILED)
|
||||
if(NOT "${build_file}" MATCHES "depfile = test\\.d")
|
||||
string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
|
||||
endif()
|
||||
if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
|
||||
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
|
||||
endif()
|
||||
|
||||
function(_run_ninja dir)
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
OUTPUT_VARIABLE ninja_stdout
|
||||
ERROR_VARIABLE ninja_stderr
|
||||
RESULT_VARIABLE ninja_result
|
||||
)
|
||||
if(NOT ninja_result EQUAL 0)
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stdout ============
|
||||
${ninja_stdout}
|
||||
=============== end of ninja's stdout ===============
|
||||
")
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stderr ============
|
||||
${ninja_stderr}
|
||||
=============== end of ninja's stderr ===============
|
||||
")
|
||||
message(FATAL_ERROR
|
||||
"top ninja build failed exited with status ${ninja_result}")
|
||||
endif()
|
||||
set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build")
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps main.copy.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy.c in the database")
|
||||
endif ()
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsByproduct-build" -t deps main.copy2.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy2.c in the database")
|
||||
endif ()
|
@ -0,0 +1,22 @@
|
||||
add_custom_command(
|
||||
OUTPUT main.copy.c
|
||||
BYPRODUCTS "test.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/main.c"
|
||||
main.copy.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test.d"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT main.copy2.c
|
||||
BYPRODUCTS "test_$<CONFIG>.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/main.c"
|
||||
main.copy2.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test_$<CONFIG>.d"
|
||||
)
|
||||
|
||||
add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/main.copy2.c")
|
@ -0,0 +1,47 @@
|
||||
set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build/CMakeFiles/impl-Debug.ninja")
|
||||
file(READ "${log}" build_file)
|
||||
|
||||
set(RunCMake_TEST_FAILED)
|
||||
if(NOT "${build_file}" MATCHES "depfile = test\\.d")
|
||||
string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
|
||||
endif()
|
||||
if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
|
||||
string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
|
||||
list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
|
||||
endif()
|
||||
|
||||
function(_run_ninja dir)
|
||||
execute_process(
|
||||
COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
OUTPUT_VARIABLE ninja_stdout
|
||||
ERROR_VARIABLE ninja_stderr
|
||||
RESULT_VARIABLE ninja_result
|
||||
)
|
||||
if(NOT ninja_result EQUAL 0)
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stdout ============
|
||||
${ninja_stdout}
|
||||
=============== end of ninja's stdout ===============
|
||||
")
|
||||
message(STATUS "
|
||||
============ beginning of ninja's stderr ============
|
||||
${ninja_stderr}
|
||||
=============== end of ninja's stderr ===============
|
||||
")
|
||||
message(FATAL_ERROR
|
||||
"top ninja build failed exited with status ${ninja_result}")
|
||||
endif()
|
||||
set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build")
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps main.copy.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy.c in the database")
|
||||
endif ()
|
||||
_run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfileAsOutput-build" -t deps main.copy2.c)
|
||||
if (NOT ninja_stdout MATCHES "deps not found")
|
||||
list(APPEND RunCMake_TEST_FAILED "Ninja tracked the deps of main.copy2.c in the database")
|
||||
endif ()
|
@ -0,0 +1,22 @@
|
||||
add_custom_command(
|
||||
OUTPUT main.copy.c
|
||||
"test.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/main.c"
|
||||
main.copy.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test.d"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT main.copy2.c
|
||||
"test_$<CONFIG>.d"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/main.c"
|
||||
main.copy2.c
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPFILE "test_$<CONFIG>.d"
|
||||
)
|
||||
|
||||
add_custom_target(copy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/main.copy.c"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/main.copy2.c")
|
@ -388,6 +388,8 @@ unset(RunCMake_TEST_NO_CLEAN)
|
||||
unset(RunCMake_TEST_BINARY_DIR)
|
||||
|
||||
run_cmake(CustomCommandDepfile)
|
||||
run_cmake(CustomCommandDepfileAsOutput)
|
||||
run_cmake(CustomCommandDepfileAsByproduct)
|
||||
|
||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
|
||||
run_cmake(PerConfigSources)
|
||||
|
Loading…
Reference in New Issue
Block a user