Commit 341b8953 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'move-command-line-tests'

4e039a9a Tests: Move more command line tests into RunCMake.CommandLine
parents bf5028f8 4e039a9a
......@@ -1095,21 +1095,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
"${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators")
endif()
if(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines)
set(CTEST_RUN_CMakeTestBadCommandLines ON)
endif()
if(CTEST_RUN_CMakeTestBadCommandLines)
add_test(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND}
-D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines
-D gen=${CMAKE_GENERATOR}
-D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
-P ${CMake_SOURCE_DIR}/Tests/CMakeTestBadCommandLines/RunCMake.cmake
)
list(APPEND TEST_BUILD_DIRS
"${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines")
endif()
if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
set(CTEST_RUN_CMakeTestMultipleConfigures ON)
endif()
......
if(NOT DEFINED CMake_SOURCE_DIR)
message(FATAL_ERROR "CMake_SOURCE_DIR not defined")
endif()
if(NOT DEFINED dir)
message(FATAL_ERROR "dir not defined")
endif()
if(NOT DEFINED gen)
message(FATAL_ERROR "gen not defined")
endif()
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
# First setup a source tree to run CMake on.
#
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast
${dir}/Source
)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
${dir}/Build
)
function(RunCMakeWithArgs)
message(STATUS "info: running cmake with ARGN='${ARGN}'")
execute_process(COMMAND ${CMAKE_COMMAND} ${ARGN}
RESULT_VARIABLE result
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr
WORKING_DIRECTORY ${dir}/Build
)
message(STATUS "result='${result}'")
message(STATUS "stdout='${stdout}'")
message(STATUS "stderr='${stderr}'")
message(STATUS "")
endfunction()
# Run cmake once with no errors to get a good build tree:
#
RunCMakeWithArgs(-G ${gen} ../Source)
# Run cmake with args that produce some sort of problem to cover the error
# cases in cmake.cxx...
#
# (These are not good examples of cmake command lines. Do not copy and
# paste them elsewhere and expect them to work... See the cmake
# documentation or other real examples of usage instead.)
#
RunCMakeWithArgs()
RunCMakeWithArgs(-C)
RunCMakeWithArgs(-C nosuchcachefile.txt)
RunCMakeWithArgs(--check-stamp-file nostampfile)
RunCMakeWithArgs(--check-stamp-list nostamplist)
RunCMakeWithArgs(nosuchsubdir/CMakeCache.txt)
RunCMakeWithArgs(nosuchsubdir/CMakeLists.txt)
RunCMakeWithArgs(-D)
RunCMakeWithArgs(--debug-output .)
RunCMakeWithArgs(--debug-trycompile .)
RunCMakeWithArgs(-E)
RunCMakeWithArgs(-E create_symlink)
RunCMakeWithArgs(-E echo_append)
RunCMakeWithArgs(-E rename)
RunCMakeWithArgs(-E touch_nocreate)
RunCMakeWithArgs(-G)
RunCMakeWithArgs(--graphviz= ../Source)
RunCMakeWithArgs(--graphviz=g.dot .)
RunCMakeWithArgs(-P)
RunCMakeWithArgs(-P nosuchscriptfile.cmake)
RunCMakeWithArgs(--trace .)
RunCMakeWithArgs(-U)
RunCMakeWithArgs(-U nosuchvariable .)
RunCMakeWithArgs(-V)
RunCMakeWithArgs(-V .)
RunCMakeWithArgs(-Wno-dev .)
RunCMakeWithArgs(-Wdev .)
^CMake Error: -C must be followed by a file name.
CMake Error: Problem processing arguments. Aborting.$
^CMake Error: Error processing file: nosuchcachefile.txt
CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build/nosuchcachefile.txt" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.$
^CMake Error: -D must be followed with VAR=VALUE.
CMake Error: Problem processing arguments. Aborting.$
^CMake Error: cmake version .*
Usage: .* -E \[command\] \[arguments ...\]
Available commands:
^CMake Error: cmake version .*
Usage: .* -E \[command\] \[arguments ...\]
Available commands:
^CMake Error: cmake version .*
Usage: .* -E \[command\] \[arguments ...\]
Available commands:
^CMake Error: cmake version .*
Usage: .* -E \[command\] \[arguments ...\]
Available commands:
^CMake Error: Could not create named generator NoSuchGenerator$
^CMake Error: No generator specified for -G$
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment