summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-12-10 15:34:36 (GMT)
committerBrad King <brad.king@kitware.com>2009-12-10 15:34:36 (GMT)
commit6c79c96265e43416fbc8130e701830389ae6c01a (patch)
tree8380af51a36bac12e81e574f1ab63b7d178f07cb
parent9d823f78479b19a739c3bb9037a0f72f3a65535c (diff)
downloadCMake-6c79c96265e43416fbc8130e701830389ae6c01a.zip
CMake-6c79c96265e43416fbc8130e701830389ae6c01a.tar.gz
CMake-6c79c96265e43416fbc8130e701830389ae6c01a.tar.bz2
Test 'install' target of CMake itself
We create option CMake_TEST_INSTALL to enable a new CMake.Install test. It tests running the "make install" target to install CMake itself into a test directory. We enable the option by default for dashboard builds.
-rw-r--r--CMakeLists.txt4
-rw-r--r--Tests/CMakeInstall.cmake48
-rw-r--r--Tests/CMakeLists.txt2
3 files changed, 54 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fcb3174..ec31808 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -366,6 +366,10 @@ MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
STRING(REGEX REPLACE "^/" "" CMake_DATA_DEST "${CMAKE_DATA_DIR}")
STRING(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}")
+IF(BUILD_TESTING)
+ INCLUDE(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
+ENDIF()
+
# include special compile flags for some compilers
INCLUDE(CompileFlags.cmake)
diff --git a/Tests/CMakeInstall.cmake b/Tests/CMakeInstall.cmake
new file mode 100644
index 0000000..f141b53
--- /dev/null
+++ b/Tests/CMakeInstall.cmake
@@ -0,0 +1,48 @@
+# Define option CMake_TEST_INSTALL, and enable by default for dashboards.
+set(_default 0)
+if(DEFINED ENV{DASHBOARD_TEST_FROM_CTEST})
+ set(_default 1)
+endif()
+option(CMake_TEST_INSTALL "Test CMake Installation" ${_default})
+mark_as_advanced(CMake_TEST_INSTALL)
+
+if(CMake_TEST_INSTALL)
+ # Do not build during the test.
+ set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
+
+ # Install to a test directory.
+ set(CMake_TEST_INSTALL_PREFIX ${CMake_BINARY_DIR}/Tests/CMakeInstall)
+ set(CMAKE_INSTALL_PREFIX "${CMake_TEST_INSTALL_PREFIX}")
+
+ if(CMAKE_CONFIGURATION_TYPES)
+ # There are multiple configurations. Make sure the tested
+ # configuration is the one that is installed.
+ set(CMake_TEST_INSTALL_CONFIG -C "\${CTEST_CONFIGURATION_TYPE}")
+ else()
+ set(CMake_TEST_INSTALL_CONFIG)
+ endif()
+
+ # The CTest of the CMake used to build this CMake.
+ if(CMAKE_CTEST_COMMAND)
+ set(CMake_TEST_INSTALL_CTest ${CMAKE_CTEST_COMMAND})
+ else()
+ set(CMake_TEST_INSTALL_CTest ${CMake_BIN_DIR}/ctest)
+ endif()
+
+ # Add a test to install CMake through the build system install target.
+ add_test(CMake.Install
+ ${CMake_TEST_INSTALL_CTest}
+ ${CMake_TEST_INSTALL_CONFIG}
+ --build-and-test ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}
+ --build-generator ${CMAKE_GENERATOR} # Not CMAKE_TEST_GENERATOR
+ --build-project CMake
+ --build-makeprogram ${CMAKE_MAKE_PROGRAM} # Not CMAKE_TEST_MAKEPROGRAM
+ --build-nocmake
+ --build-noclean
+ --build-target install)
+
+ # TODO: Make all other tests depend on this one, and then drive them
+ # with the installed CTest.
+else()
+ set(CMake_TEST_INSTALL_PREFIX)
+endif()
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 5fa4059..3694daf 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -160,6 +160,8 @@ IF(BUILD_TESTING)
PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype)")
ENDIF(CTEST_TEST_OSX_ARCH)
+ LIST(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
+
SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly")
SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly")
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in"