diff options
author | Brad King <brad.king@kitware.com> | 2015-04-13 13:05:14 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-13 13:05:14 (GMT) |
commit | 341b8953b1730f192f849640b4deeef404583df3 (patch) | |
tree | 21488dda2edb5d291fd040970196f7a18046c890 /Tests | |
parent | bf5028f88dda612fbc63217cbd9ab06674fefacb (diff) | |
parent | 4e039a9a9814fd13142ae2c9876420ddf2414b8e (diff) | |
download | CMake-341b8953b1730f192f849640b4deeef404583df3.zip CMake-341b8953b1730f192f849640b4deeef404583df3.tar.gz CMake-341b8953b1730f192f849640b4deeef404583df3.tar.bz2 |
Merge topic 'move-command-line-tests'
4e039a9a Tests: Move more command line tests into RunCMake.CommandLine
Diffstat (limited to 'Tests')
40 files changed, 108 insertions, 94 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index aa6a993..1e60abe 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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() diff --git a/Tests/CMakeTestBadCommandLines/RunCMake.cmake b/Tests/CMakeTestBadCommandLines/RunCMake.cmake deleted file mode 100644 index 08549cc..0000000 --- a/Tests/CMakeTestBadCommandLines/RunCMake.cmake +++ /dev/null @@ -1,79 +0,0 @@ -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 .) diff --git a/Tests/RunCMake/CommandLine/C-no-arg-result.txt b/Tests/RunCMake/CommandLine/C-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt new file mode 100644 index 0000000..0570d8f --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: -C must be followed by a file name. +CMake Error: Problem processing arguments. Aborting.$ diff --git a/Tests/RunCMake/CommandLine/C-no-file-result.txt b/Tests/RunCMake/CommandLine/C-no-file-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt new file mode 100644 index 0000000..5315f59 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt @@ -0,0 +1,3 @@ +^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.$ diff --git a/Tests/RunCMake/CommandLine/D-no-arg-result.txt b/Tests/RunCMake/CommandLine/D-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/D-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt new file mode 100644 index 0000000..5e43bca --- /dev/null +++ b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: -D must be followed with VAR=VALUE. +CMake Error: Problem processing arguments. Aborting.$ diff --git a/Tests/RunCMake/CommandLine/E-no-arg-result.txt b/Tests/RunCMake/CommandLine/E-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt new file mode 100644 index 0000000..056ce05 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt new file mode 100644 index 0000000..056ce05 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_rename-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_rename-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rename-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt new file mode 100644 index 0000000..056ce05 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt new file mode 100644 index 0000000..056ce05 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[command\] \[arguments ...\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/G_bad-arg-result.txt b/Tests/RunCMake/CommandLine/G_bad-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_bad-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt new file mode 100644 index 0000000..511208f --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_bad-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Could not create named generator NoSuchGenerator$ diff --git a/Tests/RunCMake/CommandLine/G_no-arg-result.txt b/Tests/RunCMake/CommandLine/G_no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt new file mode 100644 index 0000000..56d23c2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/G_no-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: No generator specified for -G$ diff --git a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt new file mode 100644 index 0000000..1cd3469 --- /dev/null +++ b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt @@ -0,0 +1,10 @@ +^Usage + + cmake \[options\] <path-to-source> + cmake \[options\] <path-to-existing-build> + +Specify a source directory to \(re-\)generate a build system for it in the +current working directory. Specify an existing build directory to +re-generate its build system. + +Run 'cmake --help' for more information.$ diff --git a/Tests/RunCMake/CommandLine/P_no-arg-result.txt b/Tests/RunCMake/CommandLine/P_no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/P_no-arg-stderr.txt b/Tests/RunCMake/CommandLine/P_no-arg-stderr.txt new file mode 100644 index 0000000..8af3a53 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-arg-stderr.txt @@ -0,0 +1 @@ +^CMake Error: No script specified for argument -P$ diff --git a/Tests/RunCMake/CommandLine/P_no-file-result.txt b/Tests/RunCMake/CommandLine/P_no-file-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/P_no-file-stderr.txt b/Tests/RunCMake/CommandLine/P_no-file-stderr.txt new file mode 100644 index 0000000..2e12399 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_no-file-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Error processing file: nosuchscriptfile.cmake$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f879ee6..f047baf 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1,5 +1,22 @@ include(RunCMake) +run_cmake_command(NoArgs ${CMAKE_COMMAND}) +run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C) +run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt) +run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt) +run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt) +run_cmake_command(D-no-arg ${CMAKE_COMMAND} -D) +run_cmake_command(U-no-arg ${CMAKE_COMMAND} -U) +run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) +run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) +run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) +run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate) + +run_cmake_command(G_no-arg ${CMAKE_COMMAND} -G) +run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) +run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) +run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) + run_cmake_command(build-no-cache ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}) run_cmake_command(build-no-generator @@ -24,6 +41,9 @@ if(RunCMake_GENERATOR STREQUAL "Ninja") endif() if(UNIX) + run_cmake_command(E_create_symlink-no-arg + ${CMAKE_COMMAND} -E create_symlink + ) run_cmake_command(E_create_symlink-missing-dir ${CMAKE_COMMAND} -E create_symlink T missing-dir/L ) @@ -70,6 +90,26 @@ set(RunCMake_TEST_OPTIONS "-DFOO:STRING=-DBAR:BOOL=BAZ") run_cmake(D_typed_nested_cache) +set(RunCMake_TEST_OPTIONS -Wno-dev) +run_cmake(Wno-dev) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev) +run_cmake(Wdev) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS --debug-output) +run_cmake(debug-output) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS --trace) +run_cmake(trace) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS --debug-trycompile) +run_cmake(debug-trycompile) +unset(RunCMake_TEST_OPTIONS) + function(run_cmake_depends) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build") diff --git a/Tests/RunCMake/CommandLine/U-no-arg-result.txt b/Tests/RunCMake/CommandLine/U-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/U-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt new file mode 100644 index 0000000..c34ef94 --- /dev/null +++ b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: -U must be followed with VAR. +CMake Error: Problem processing arguments. Aborting.$ diff --git a/Tests/RunCMake/CommandLine/Wdev-stderr.txt b/Tests/RunCMake/CommandLine/Wdev-stderr.txt new file mode 100644 index 0000000..f427303 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wdev-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at Wdev.cmake:1 \(message\): + Some Author Warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Wdev.cmake b/Tests/RunCMake/CommandLine/Wdev.cmake new file mode 100644 index 0000000..0242086 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wdev.cmake @@ -0,0 +1 @@ +message(AUTHOR_WARNING "Some Author Warning") diff --git a/Tests/RunCMake/CommandLine/Wno-dev.cmake b/Tests/RunCMake/CommandLine/Wno-dev.cmake new file mode 100644 index 0000000..0242086 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-dev.cmake @@ -0,0 +1 @@ +message(AUTHOR_WARNING "Some Author Warning") diff --git a/Tests/RunCMake/CommandLine/cache-no-file-result.txt b/Tests/RunCMake/CommandLine/cache-no-file-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/cache-no-file-stderr.txt b/Tests/RunCMake/CommandLine/cache-no-file-stderr.txt new file mode 100644 index 0000000..da3a0c3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-no-file-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/cache-no-file-build/nosuchsubdir" does not exist. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/debug-output-stdout.txt b/Tests/RunCMake/CommandLine/debug-output-stdout.txt new file mode 100644 index 0000000..96f2aae --- /dev/null +++ b/Tests/RunCMake/CommandLine/debug-output-stdout.txt @@ -0,0 +1 @@ +Running with debug output on. diff --git a/Tests/RunCMake/CommandLine/debug-output.cmake b/Tests/RunCMake/CommandLine/debug-output.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/debug-output.cmake diff --git a/Tests/RunCMake/CommandLine/debug-trycompile.cmake b/Tests/RunCMake/CommandLine/debug-trycompile.cmake new file mode 100644 index 0000000..a3835a7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/debug-trycompile.cmake @@ -0,0 +1,5 @@ +enable_language(C) +# Look for a source tree left by enable_language internal checks. +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt) + message(FATAL_ERROR "--debug-trycompile should leave the source behind") +endif() diff --git a/Tests/RunCMake/CommandLine/lists-no-file-result.txt b/Tests/RunCMake/CommandLine/lists-no-file-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/lists-no-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/lists-no-file-stderr.txt b/Tests/RunCMake/CommandLine/lists-no-file-stderr.txt new file mode 100644 index 0000000..3465e89 --- /dev/null +++ b/Tests/RunCMake/CommandLine/lists-no-file-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/lists-no-file-build/nosuchsubdir" does not exist. +Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/trace-stderr.txt b/Tests/RunCMake/CommandLine/trace-stderr.txt new file mode 100644 index 0000000..8e8ddfa --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace-stderr.txt @@ -0,0 +1,2 @@ +^.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(1\): cmake_minimum_required\(VERSION 3.0 \) +.*/Tests/RunCMake/CommandLine/CMakeLists.txt\(2\): project\(\${RunCMake_TEST} NONE \) diff --git a/Tests/RunCMake/CommandLine/trace.cmake b/Tests/RunCMake/CommandLine/trace.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/trace.cmake |