diff options
Diffstat (limited to 'Tests/RunCMake/CommandLine/RunCMakeTest.cmake')
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 30 |
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() |