diff options
author | Brad King <brad.king@kitware.com> | 2023-11-30 18:08:47 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-11-30 18:09:06 (GMT) |
commit | 3496cb3a00d4857c880a02ca09b875c0e7f2584c (patch) | |
tree | 55403387970715e0b0de083e1da0b2a68d84dbfc /Tests/RunCMake/execute_process | |
parent | 8d6dcaa4b0e22abd152a58b413cbe3fdd9306cc3 (diff) | |
parent | f6d2efa752d5e823011951c6e642c27334f9377f (diff) | |
download | CMake-3496cb3a00d4857c880a02ca09b875c0e7f2584c.zip CMake-3496cb3a00d4857c880a02ca09b875c0e7f2584c.tar.gz CMake-3496cb3a00d4857c880a02ca09b875c0e7f2584c.tar.bz2 |
Merge topic 'execute_process-no-extension'
f6d2efa752 Tests: Add case to cover execute_process support for no extension on Windows
da9df7425a libuv: win/spawn: run executables with no file extension
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !9017
Diffstat (limited to 'Tests/RunCMake/execute_process')
6 files changed, 56 insertions, 0 deletions
diff --git a/Tests/RunCMake/execute_process/RunCMakeTest.cmake b/Tests/RunCMake/execute_process/RunCMakeTest.cmake index 1e9e10a..a3a3a9a 100644 --- a/Tests/RunCMake/execute_process/RunCMakeTest.cmake +++ b/Tests/RunCMake/execute_process/RunCMakeTest.cmake @@ -46,3 +46,10 @@ if(UNIX AND Python_EXECUTABLE) run_cmake_command(LastCommandAbnormalExit-1 ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-1.cmake) run_cmake_command(LastCommandAbnormalExit-2 ${CMAKE_COMMAND} -DPython_EXECUTABLE=${Python_EXECUTABLE} -P ${RunCMake_SOURCE_DIR}/LastCommandAbnormalExit-2.cmake) endif() + +if(WIN32 OR CYGWIN) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/WindowsNoExtension-build) + run_cmake(WindowsNoExtension) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(WindowsNoExtension-build ${CMAKE_COMMAND} --build . --config Debug --target RunScript) +endif() diff --git a/Tests/RunCMake/execute_process/WindowsNoExtension-build-stdout.txt b/Tests/RunCMake/execute_process/WindowsNoExtension-build-stdout.txt new file mode 100644 index 0000000..22318b2 --- /dev/null +++ b/Tests/RunCMake/execute_process/WindowsNoExtension-build-stdout.txt @@ -0,0 +1,6 @@ +[^ +]*This executable does not have an extension +[^ +]*This executable does not have an extension +[^ +]*This executable has an extension diff --git a/Tests/RunCMake/execute_process/WindowsNoExtension.cmake b/Tests/RunCMake/execute_process/WindowsNoExtension.cmake new file mode 100644 index 0000000..8aec89d --- /dev/null +++ b/Tests/RunCMake/execute_process/WindowsNoExtension.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +add_executable(exe_extension exe_extension.c) +add_executable(exe_no_extension exe_no_extension.c) + +add_custom_target(RunScript + ${CMAKE_COMMAND} + -Dexe_extension=$<TARGET_FILE:exe_extension> + -Dexe_no_extension=$<TARGET_FILE:exe_no_extension> + -P ${CMAKE_CURRENT_SOURCE_DIR}/WindowsNoExtensionRunScript.cmake + DEPENDS exe_extension exe_no_extension + ) diff --git a/Tests/RunCMake/execute_process/WindowsNoExtensionRunScript.cmake b/Tests/RunCMake/execute_process/WindowsNoExtensionRunScript.cmake new file mode 100644 index 0000000..8e640a0 --- /dev/null +++ b/Tests/RunCMake/execute_process/WindowsNoExtensionRunScript.cmake @@ -0,0 +1,17 @@ +file(COPY_FILE "${exe_no_extension}" "${CMAKE_CURRENT_BINARY_DIR}/exe" INPUT_MAY_BE_RECENT) +execute_process( + COMMAND "${CMAKE_CURRENT_BINARY_DIR}/exe" + COMMAND_ERROR_IS_FATAL ANY + ) + +file(COPY_FILE "${exe_extension}" "${CMAKE_CURRENT_BINARY_DIR}/exe.exe" INPUT_MAY_BE_RECENT) +execute_process( + COMMAND "${CMAKE_CURRENT_BINARY_DIR}/exe" + COMMAND_ERROR_IS_FATAL ANY + ) + +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/exe") +execute_process( + COMMAND "${CMAKE_CURRENT_BINARY_DIR}/exe" + COMMAND_ERROR_IS_FATAL ANY + ) diff --git a/Tests/RunCMake/execute_process/exe_extension.c b/Tests/RunCMake/execute_process/exe_extension.c new file mode 100644 index 0000000..b00d7f9 --- /dev/null +++ b/Tests/RunCMake/execute_process/exe_extension.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(void) +{ + printf("This executable has an extension\n"); + return 0; +} diff --git a/Tests/RunCMake/execute_process/exe_no_extension.c b/Tests/RunCMake/execute_process/exe_no_extension.c new file mode 100644 index 0000000..b0596c3 --- /dev/null +++ b/Tests/RunCMake/execute_process/exe_no_extension.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(void) +{ + printf("This executable does not have an extension\n"); + return 0; +} |