Debian Codegraph @

Tests/RunCMake/NinjaMultiConfig/CustomCommandDepfile-check.cmake

raw
1 set(log "${RunCMake_BINARY_DIR}/CustomCommandDepfile-build/CMakeFiles/impl-Debug.ninja")
2 file(READ "${log}" build_file)
3
4 set(RunCMake_TEST_FAILED)
5 if(NOT "${build_file}" MATCHES "depfile = test\\.d")
6 string(CONCAT no_test_d "Log file:\n ${log}\n" "does not have expected line: depfile = test.d")
7 list(APPEND RunCMake_TEST_FAILED "${no_test_d}")
8 endif()
9 if(NOT "${build_file}" MATCHES "depfile = test_Debug\\.d")
10 string(CONCAT no_test_Debug_d "\nLog file:\n ${log}\n" "does not have expected line: depfile = test_Debug.d")
11 list(APPEND RunCMake_TEST_FAILED "${no_test_Debug_d}")
12 endif()
13
14 function(_run_ninja dir)
15 execute_process(
16 COMMAND "${RunCMake_MAKE_PROGRAM}" ${ARGN}
17 WORKING_DIRECTORY "${dir}"
18 OUTPUT_VARIABLE ninja_stdout
19 ERROR_VARIABLE ninja_stderr
20 RESULT_VARIABLE ninja_result
21 )
22 if(NOT ninja_result EQUAL 0)
23 message(STATUS "
24 ============ beginning of ninja's stdout ============
25 ${ninja_stdout}
26 =============== end of ninja's stdout ===============
27 ")
28 message(STATUS "
29 ============ beginning of ninja's stderr ============
30 ${ninja_stderr}
31 =============== end of ninja's stderr ===============
32 ")
33 message(FATAL_ERROR
34 "top ninja build failed exited with status ${ninja_result}")
35 endif()
36 set(ninja_stdout "${ninja_stdout}" PARENT_SCOPE)
37 endfunction()
38
39 _run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build")
40 _run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps main.copy.c)
41 if (ninja_stdout MATCHES "deps not found")
42 list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of main.copy.c in the database")
43 endif ()
44 _run_ninja("${RunCMake_BINARY_DIR}/CustomCommandDepfile-build" -t deps main.copy2.c)
45 if (ninja_stdout MATCHES "deps not found")
46 list(APPEND RunCMake_TEST_FAILED "Ninja did not track the deps of main.copy2.c in the database")
47 endif ()