summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-10-27 16:18:41 (GMT)
committerDavid Cole <david.cole@kitware.com>2009-10-27 16:18:41 (GMT)
commitae1e9900fa9d2e595b24505f3cf18f376a5b0814 (patch)
treeadd0df27ab55b1209abbae987bdadacf8caa8d35 /Tests
parent1bce13e2b3b19d3286fcaed31ceaa98ba24747c7 (diff)
downloadCMake-ae1e9900fa9d2e595b24505f3cf18f376a5b0814.zip
CMake-ae1e9900fa9d2e595b24505f3cf18f376a5b0814.tar.gz
CMake-ae1e9900fa9d2e595b24505f3cf18f376a5b0814.tar.bz2
Add test CMakeTestBadCommandLines. Also add --graphviz arg to cmake invoked during the CPackComponents test. The purpose of each is to increase coverage of cmake.cxx.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt16
-rw-r--r--Tests/CMakeTestBadCommandLines/RunCMake.cmake79
2 files changed, 95 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index dd39df0..ea63835 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -463,6 +463,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
-DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
-DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
${CPackComponents_EXTRA_OPTIONS}
+ --graphviz=CPackComponents.dot
--test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
-P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake")
@@ -535,6 +536,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
"${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators")
ENDIF(CTEST_RUN_CMakeTestAllGenerators)
+ if(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines)
+ set(CTEST_RUN_CMakeTestBadCommandLines ON)
+ endif(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines)
+
+ IF(CTEST_RUN_CMakeTestBadCommandLines)
+ ADD_TEST(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND}
+ -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines
+ -D gen=${CMAKE_TEST_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(CTEST_RUN_CMakeTestBadCommandLines)
+
if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
set(CTEST_RUN_CMakeTestMultipleConfigures ON)
endif(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
diff --git a/Tests/CMakeTestBadCommandLines/RunCMake.cmake b/Tests/CMakeTestBadCommandLines/RunCMake.cmake
new file mode 100644
index 0000000..08549cc
--- /dev/null
+++ b/Tests/CMakeTestBadCommandLines/RunCMake.cmake
@@ -0,0 +1,79 @@
+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 .)