diff options
Diffstat (limited to 'Tests/RunCMake')
15 files changed, 132 insertions, 0 deletions
diff --git a/Tests/RunCMake/separate_arguments/MultipleArguments-result.txt b/Tests/RunCMake/separate_arguments/MultipleArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/MultipleArguments-stderr.txt b/Tests/RunCMake/separate_arguments/MultipleArguments-stderr.txt new file mode 100644 index 0000000..bbf1cf2 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleArguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at MultipleArguments.cmake:[0-9]+ \(separate_arguments\): + separate_arguments given unexpected argument\(s\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/MultipleArguments.cmake b/Tests/RunCMake/separate_arguments/MultipleArguments.cmake new file mode 100644 index 0000000..d38a03b --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleArguments.cmake @@ -0,0 +1,2 @@ + +separate_arguments (var UNIX_COMMAND arg1 arg2) diff --git a/Tests/RunCMake/separate_arguments/MultipleCommands-result.txt b/Tests/RunCMake/separate_arguments/MultipleCommands-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleCommands-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/MultipleCommands-stderr.txt b/Tests/RunCMake/separate_arguments/MultipleCommands-stderr.txt new file mode 100644 index 0000000..9dca8f6 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleCommands-stderr.txt @@ -0,0 +1,19 @@ +CMake Error at MultipleCommands.cmake:[0-9]+ \(separate_arguments\): + separate_arguments 'UNIX_COMMAND', 'WINDOWS_COMMAND' and 'NATIVE_COMMAND' + are mutually exclusive +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at MultipleCommands.cmake:[0-9]+ \(separate_arguments\): + separate_arguments 'UNIX_COMMAND', 'WINDOWS_COMMAND' and 'NATIVE_COMMAND' + are mutually exclusive +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at MultipleCommands.cmake:[0-9]+ \(separate_arguments\): + separate_arguments 'UNIX_COMMAND', 'WINDOWS_COMMAND' and 'NATIVE_COMMAND' + are mutually exclusive +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/MultipleCommands.cmake b/Tests/RunCMake/separate_arguments/MultipleCommands.cmake new file mode 100644 index 0000000..cb71fcb --- /dev/null +++ b/Tests/RunCMake/separate_arguments/MultipleCommands.cmake @@ -0,0 +1,6 @@ + +separate_arguments(var UNIX_COMMAND WINDOWS_COMMAND) + +separate_arguments(var UNIX_COMMAND NATIVE_COMMAND) + +separate_arguments(var WINDOWS_COMMAND NATIVE_COMMAND) diff --git a/Tests/RunCMake/separate_arguments/ProgramCommand.cmake b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake new file mode 100644 index 0000000..bdf5810 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake @@ -0,0 +1,48 @@ + +separate_arguments (out UNIX_COMMAND PROGRAM "xx a b c") +if (out) + message (SEND_ERROR "unexpected result with nonexistent program") +endif() + +set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe") +file(MAKE_DIRECTORY "${TEST_EXE_DIR}") +file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}") +cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe) + +set (ENV{PATH} "${TEST_EXE_DIR}") + + +separate_arguments (out UNIX_COMMAND PROGRAM "${cmake_exe}") +list (LENGTH out length) +if (length EQUAL 0) + message(FATAL_ERROR "existent program not found") +endif() +if (NOT length EQUAL 2) + message(FATAL_ERROR "unexpected arguments") +endif() +list(GET out 0 cmake) +list(GET out 1 args) +if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}") + message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'") +endif() +if (NOT args STREQUAL "") + message (SEND_ERROR "bad value for args: '${args}' instead of ''") +endif() + + +separate_arguments (out UNIX_COMMAND PROGRAM "${cmake_exe} a b c") +list (LENGTH out length) +if (length EQUAL 0) + message(FATAL_ERROR "existent program not found") +endif() +if (NOT length EQUAL 2) + message(FATAL_ERROR "unexpected arguments") +endif() +list(GET out 0 cmake) +list(GET out 1 args) +if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}") + message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'") +endif() +if (NOT args STREQUAL " a b c") + message (SEND_ERROR "bad value for args: '${args}' instead of ' a b c'") +endif() diff --git a/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake new file mode 100644 index 0000000..2826cc9 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake @@ -0,0 +1,28 @@ + +separate_arguments (out UNIX_COMMAND PROGRAM SEPARATE_ARGS "xx a b c") +if (out) + message (SEND_ERROR "unexpected result with nonexistent program") +endif() + +set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe") +file(MAKE_DIRECTORY "${TEST_EXE_DIR}") +file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}") +cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe) + +set (ENV{PATH} "${TEST_EXE_DIR}") + +separate_arguments (out UNIX_COMMAND PROGRAM SEPARATE_ARGS "${cmake_exe} a b c") +list (LENGTH out length) +if (length EQUAL 0) + message(FATAL_ERROR "existent program not found") +endif() +if (NOT length EQUAL 4) + message(FATAL_ERROR "unexpected arguments") +endif() +list(POP_FRONT out cmake) +if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}") + message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'") +endif() +if (NOT out STREQUAL "a;b;c") + message (SEND_ERROR "bad path for args: '${out}' instead of 'a;b;c'") +endif() diff --git a/Tests/RunCMake/separate_arguments/ProgramOnly-result.txt b/Tests/RunCMake/separate_arguments/ProgramOnly-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramOnly-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/ProgramOnly-stderr.txt b/Tests/RunCMake/separate_arguments/ProgramOnly-stderr.txt new file mode 100644 index 0000000..e34ca4c --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramOnly-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at ProgramOnly.cmake:[0-9]+ \(separate_arguments\): + separate_arguments missing required option: 'UNIX_COMMAND' or + 'WINDOWS_COMMAND' or 'NATIVE_COMMAND' +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/ProgramOnly.cmake b/Tests/RunCMake/separate_arguments/ProgramOnly.cmake new file mode 100644 index 0000000..cc21d2b --- /dev/null +++ b/Tests/RunCMake/separate_arguments/ProgramOnly.cmake @@ -0,0 +1,2 @@ + +separate_arguments (var PROGRAM arg) diff --git a/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake index 07951bb..3c02c49 100644 --- a/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake +++ b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake @@ -1,7 +1,15 @@ include(RunCMake) +run_cmake(MultipleCommands) +run_cmake(MultipleArguments) +run_cmake(ProgramOnly) +run_cmake(SeparateArgsOnly) + run_cmake(EmptyCommand) run_cmake(PlainCommand) run_cmake(UnixCommand) run_cmake(WindowsCommand) run_cmake(NativeCommand) + +run_cmake(ProgramCommand) +run_cmake(ProgramCommandWithSeparateArgs) diff --git a/Tests/RunCMake/separate_arguments/SeparateArgsOnly-result.txt b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/separate_arguments/SeparateArgsOnly-stderr.txt b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-stderr.txt new file mode 100644 index 0000000..e87b1cb --- /dev/null +++ b/Tests/RunCMake/separate_arguments/SeparateArgsOnly-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SeparateArgsOnly.cmake:[0-9]+ \(separate_arguments\): + separate_arguments `SEPARATE_ARGS` option requires `PROGRAM' option +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/separate_arguments/SeparateArgsOnly.cmake b/Tests/RunCMake/separate_arguments/SeparateArgsOnly.cmake new file mode 100644 index 0000000..876fd7c --- /dev/null +++ b/Tests/RunCMake/separate_arguments/SeparateArgsOnly.cmake @@ -0,0 +1,2 @@ + +separate_arguments (var UNIX_COMMAND SEPARATE_ARGS arg) |