summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-02-05 14:08:57 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-02-05 14:10:16 (GMT)
commit94be195a5462f4d15e722333263f9a2eef09458f (patch)
tree2432ae9093b2776d3e928463c42b4c23ee03bfaa /Tests/RunCMake/CommandLine/RunCMakeTest.cmake
parent12a72ba71a15e96c2040cee0cae99bbece440215 (diff)
parent1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9 (diff)
downloadCMake-94be195a5462f4d15e722333263f9a2eef09458f.zip
CMake-94be195a5462f4d15e722333263f9a2eef09458f.tar.gz
CMake-94be195a5462f4d15e722333263f9a2eef09458f.tar.bz2
Merge topic 'llvm-rc-preprocess'
1c2d031cbd Add -E cmake_llvm_rc to preprocess files for llvm-rc Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4219
Diffstat (limited to 'Tests/RunCMake/CommandLine/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake30
1 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 4bdc759..087ef21 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -667,3 +667,33 @@ if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN")
run_cmake_command(closed_stderr sh -c "\"${CMAKE_COMMAND}\" --version 2>&-")
run_cmake_command(closed_stdall sh -c "\"${CMAKE_COMMAND}\" --version <&- >&- 2>&-")
endif()
+
+function(run_llvm_rc)
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/llvm_rc-build")
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake_command(llvm_rc_no_args ${CMAKE_COMMAND} -E cmake_llvm_rc)
+ run_cmake_command(llvm_rc_no_-- ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test")
+ run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp -- ${CMAKE_COMMAND} -E echo "This is a test")
+ run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E false -- ${CMAKE_COMMAND} -E echo "This is a test")
+ run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E false )
+ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp)
+ message(SEND_ERROR "${test} - FAILED:\n"
+ "test.tmp was not deleted")
+ endif()
+ run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E copy test.tmp llvmrc.result )
+ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp)
+ message(SEND_ERROR "${test} - FAILED:\n"
+ "test.tmp was not deleted")
+ endif()
+ file(READ ${RunCMake_TEST_BINARY_DIR}/llvmrc.result LLVMRC_RESULT)
+ if(NOT "${LLVMRC_RESULT}" STREQUAL "This is a test\n")
+ message(SEND_ERROR "${test} - FAILED:\n"
+ "llvmrc.result was not created")
+ endif()
+ # file(REMOVE ${RunCMake_TEST_BINARY_DIR}/llvmrc.result)
+ unset(LLVMRC_RESULT)
+endfunction()
+run_llvm_rc()