summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-07-13 21:01:39 (GMT)
committerBrad King <brad.king@kitware.com>2010-07-13 21:01:39 (GMT)
commit38c762c7283aef70080e3edd6bc03fd5b5032b9a (patch)
tree75c778e7efb318d437dcf8d1e5f4f5de6e2d945f /Tests
parent46df0b44ac97859ab40dd0aa03ceca297a455587 (diff)
parent199e7f2f331aded0c7cb3f666bd2c996e2b4aa5e (diff)
downloadCMake-38c762c7283aef70080e3edd6bc03fd5b5032b9a.zip
CMake-38c762c7283aef70080e3edd6bc03fd5b5032b9a.tar.gz
CMake-38c762c7283aef70080e3edd6bc03fd5b5032b9a.tar.bz2
Merge 'remove-CTestTest3' into ctest-file-checksum
Conflicts: Tests/CMakeLists.txt
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt48
-rw-r--r--Tests/CMakeTests/CMakeLists.txt10
-rw-r--r--Tests/CMakeTests/CheckSourceTreeTest.cmake.in224
-rw-r--r--Tests/CMakeTests/FileDownloadInput.pngbin0 -> 358 bytes
-rw-r--r--Tests/CMakeTests/FileDownloadTest.cmake.in41
-rw-r--r--Tests/CTestSubmitLargeOutput/test.cmake.in1
-rw-r--r--Tests/ExternalProject/CMakeLists.txt150
-rw-r--r--Tests/ExternalProject/Example/CMakeLists.txt11
-rw-r--r--Tests/ExternalProject/Step1.tar.bz2bin0 -> 904 bytes
-rw-r--r--Tests/ExternalProject/Step1.zipbin0 -> 1074 bytes
-rw-r--r--Tests/ExternalProject/Step1NoDir.tar.bz2bin0 -> 852 bytes
-rw-r--r--Tests/ExternalProject/Step1NoDir.zipbin0 -> 1038 bytes
-rw-r--r--Tests/ExternalProject/gitrepo.tgzbin0 -> 1934 bytes
-rw-r--r--Tests/LinkFlags/CMakeLists.txt28
-rw-r--r--Tests/LinkFlags/LinkFlags.c1
-rw-r--r--Tests/LinkFlags/LinkFlagsExe.c6
-rw-r--r--Tests/LinkFlags/LinkFlagsLib.c6
17 files changed, 454 insertions, 72 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index c1cc8b8..300b531 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -174,6 +174,34 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize)
+ ADD_TEST(LinkFlags-prepare
+ ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/LinkFlags"
+ "${CMake_BINARY_DIR}/Tests/LinkFlags"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-project LinkFlags
+ --build-target LinkFlags
+ --build-options -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE}
+ )
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags")
+
+ MACRO(ADD_LINK_FLAGS_TEST name depends)
+ ADD_TEST(LinkFlags-${name}
+ ${CMAKE_CMAKE_COMMAND} --build "${CMake_BINARY_DIR}/Tests/LinkFlags"
+ --target LinkFlags_${name} --config \${CTEST_CONFIGURATION_TYPE}
+ )
+ SET_TESTS_PROPERTIES(LinkFlags-${name} PROPERTIES
+ PASS_REGULAR_EXPRESSION "BADFLAG" DEPENDS LinkFlags-${depends})
+ ENDMACRO()
+ ADD_LINK_FLAGS_TEST(lib prepare)
+ ADD_LINK_FLAGS_TEST(dll lib)
+ ADD_LINK_FLAGS_TEST(exe dll)
+ ADD_LINK_FLAGS_TEST(lib_config exe)
+ ADD_LINK_FLAGS_TEST(dll_config lib_config)
+ ADD_LINK_FLAGS_TEST(exe_config dll_config)
+
# If we are running right now with a UnixMakefiles based generator,
# build the "Simple" test with the ExtraGenerators, if available
# This doesn't test whether the generated project files work (unfortunately),
@@ -270,7 +298,7 @@ IF(BUILD_TESTING)
FILE(MAKE_DIRECTORY "${_TEST_DIR}")
FILE(WRITE "${_TEST_DIR}/nightly-cmake.sh"
"cd ${_TEST_DIR}
-${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/${script}
+${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=next -P ${CMake_SOURCE_DIR}/Utilities/Release/${script}
${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake
")
ADD_TEST(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh)
@@ -1442,13 +1470,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log"
)
- CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest3/test.cmake.in"
- "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" @ONLY ESCAPE_QUOTES)
- ADD_TEST(CTestTest3 ${CMAKE_CTEST_COMMAND}
- -S "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" -V
- --output-log "${CMake_BINARY_DIR}/Tests/CTestTest3/testOutput.log"
- )
-
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTestChecksum/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" @ONLY
ESCAPE_QUOTES)
@@ -1473,12 +1494,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
SET_TESTS_PROPERTIES ( CTestTest2
PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
-
- GET_TEST_PROPERTY(CTestTest3 TIMEOUT PREVIOUS_TIMEOUT)
- IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
- SET_TESTS_PROPERTIES ( CTestTest3
- PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
- ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER)
IF(NOT DEFINED CTEST_RUN_CTestSubmitLargeOutput)
@@ -1504,6 +1519,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
#
SET_TESTS_PROPERTIES(CTestSubmitLargeOutput PROPERTIES
PASS_REGULAR_EXPRESSION "Errors occurred during submission")
+
+ # Give this test plenty of time to run on slower machines:
+ #
+ SET_TESTS_PROPERTIES(CTestSubmitLargeOutput PROPERTIES
+ TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
ENDIF(CTEST_RUN_CTestSubmitLargeOutput)
IF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH)
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 7a176e9..8fd52df 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -28,6 +28,11 @@ AddCMakeTest(Math "")
AddCMakeTest(CMakeMinimumRequired "")
AddCMakeTest(CompilerIdVendor "")
+AddCMakeTest(FileDownload "")
+set_property(TEST CMake.FileDownload PROPERTY
+ PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum"
+ )
+
if(HAVE_ELF_H)
AddCMakeTest(ELF "")
endif()
@@ -46,13 +51,14 @@ AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}")
# suite. It detects if any changes have been made to the CMake source tree
# by any previous configure, build or test steps.
#
-if(do_cvs_tests)
+if(do_cvs_tests OR GIT_EXECUTABLE)
string(REPLACE "\\" "/" ENV_HOME "$ENV{HOME}")
set(CheckSourceTree_PreArgs
"-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}"
"-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
"-DCVS_EXECUTABLE:STRING=${CVS_EXECUTABLE}"
+ "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}"
"-DHOME:STRING=${ENV_HOME}"
)
AddCMakeTest(CheckSourceTree "${CheckSourceTree_PreArgs}")
-endif(do_cvs_tests)
+endif(do_cvs_tests OR GIT_EXECUTABLE)
diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
index 1cfadcb..39289f0 100644
--- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
+++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
@@ -6,6 +6,7 @@ message("")
message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'")
message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
+message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
message("HOME='${HOME}'")
message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'")
message("")
@@ -42,55 +43,161 @@ message("in_source_build='${in_source_build}'")
message("")
-# If this does not appear to be a CVS checkout, just pass the test here and now.
-# (Do not let the test fail if it is run in a tree *exported* from CVS or
-# unpacked from a .zip file source installer...)
+# If this does not appear to be a git or CVS checkout, just pass the test here
+# and now. (Do not let the test fail if it is run in a tree *exported* from a
+# repository or unpacked from a .zip file source installer...)
#
-if(NOT EXISTS "${CMake_SOURCE_DIR}/CVS/Root")
- message("source tree is not a CVS checkout... test passes by early return...")
- return()
+set(is_git_checkout 0)
+if(EXISTS "${CMake_SOURCE_DIR}/.git")
+ set(is_git_checkout 1)
endif()
+set(is_cvs_checkout 0)
+if(EXISTS "${CMake_SOURCE_DIR}/CVS/Root")
+ set(is_cvs_checkout 1)
+endif()
-# Check with "cvs -q -n up -dP" if there are any local modifications to the
-# CMake source tree:
-#
-message("=============================================================================")
-message("Copy/paste this command to reproduce:")
-message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP")
+message("is_git_checkout='${is_git_checkout}'")
+message("is_cvs_checkout='${is_cvs_checkout}'")
message("")
-# Use the HOME value passed in to the script for calling cvs so it can find
-# its .cvspass and other file(s)
-#
-set(original_ENV_HOME "$ENV{HOME}")
-set(ENV{HOME} "${HOME}")
-
-execute_process(COMMAND ${CVS_EXECUTABLE} -q -n up -dP
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- OUTPUT_VARIABLE ov
- ERROR_VARIABLE ev
- RESULT_VARIABLE rv)
-
-set(ENV{HOME} "${original_ENV_HOME}")
-
-message("Results of running '${CVS_EXECUTABLE} -q -n up -dP'")
-message("rv='${rv}'")
-message("ov='${ov}'")
-message("ev='${ev}'")
-message("")
+if(NOT is_cvs_checkout)
+if(NOT is_git_checkout)
+ message("source tree is neither git nor CVS checkout... test passes by early return...")
+ return()
+endif()
+endif()
-if(NOT rv STREQUAL 0)
- message(FATAL_ERROR "error: 'cvs -q -n up -dP' attempt failed... (see output above)")
+if(is_cvs_checkout)
+if(is_git_checkout)
+ message("warning: source tree has both git *and* CVS file system bits???")
+ # should this condition be a FATAL_ERROR test failure...?
endif()
+endif()
+
-# Analyze cvs output:
+# This test looks for the following types of changes in the source tree:
#
set(additions 0)
set(conflicts 0)
set(modifications 0)
set(nonadditions 0)
+# ov == output variable... conditionally filled in by either cvs or git below:
+#
+set(cmd "")
+set(ov "")
+set(ev "")
+set(rv "")
+
+
+if(is_cvs_checkout AND CVS_EXECUTABLE)
+ # Check with "cvs -q -n up -dP" if there are any local modifications to the
+ # CMake source tree:
+ #
+ message("=============================================================================")
+ message("This is a cvs checkout, using cvs to verify source tree....")
+ message("")
+
+ execute_process(COMMAND ${CVS_EXECUTABLE} --version
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ OUTPUT_VARIABLE version_output
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message("=== output of 'cvs --version' ===")
+ message("${version_output}")
+ message("=== end output ===")
+ message("")
+
+ file(READ "${CMake_SOURCE_DIR}/CVS/Root" contents)
+ message("=== content of CVS/Root ===")
+ message("${contents}")
+ message("=== end content ===")
+ message("")
+
+ file(READ "${CMake_SOURCE_DIR}/CVS/Repository" contents)
+ message("=== content of CVS/Repository ===")
+ message("${contents}")
+ message("=== end content ===")
+ message("")
+
+ message("Copy/paste this command to reproduce:")
+ message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP")
+ message("")
+
+ set(cmd ${CVS_EXECUTABLE} -q -n up -dP)
+endif()
+
+
+if(is_git_checkout AND GIT_EXECUTABLE)
+ # Check with "git status" if there are any local modifications to the
+ # CMake source tree:
+ #
+ message("=============================================================================")
+ message("This is a git checkout, using git to verify source tree....")
+ message("")
+
+ execute_process(COMMAND ${GIT_EXECUTABLE} --version
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ OUTPUT_VARIABLE version_output
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message("=== output of 'git --version' ===")
+ message("${version_output}")
+ message("=== end output ===")
+ message("")
+
+ execute_process(COMMAND ${GIT_EXECUTABLE} branch -a
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ OUTPUT_VARIABLE git_branch_output
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message("=== output of 'git branch -a' ===")
+ message("${git_branch_output}")
+ message("=== end output ===")
+ message("")
+
+ message("Copy/paste this command to reproduce:")
+ message("cd \"${CMake_SOURCE_DIR}\" && \"${GIT_EXECUTABLE}\" status")
+ message("")
+
+ set(cmd ${GIT_EXECUTABLE} status)
+endif()
+
+
+if(cmd)
+ # Use the HOME value passed in to the script for calling cvs/git so it can
+ # find its .cvspass or user/global config settings...
+ #
+ set(original_ENV_HOME "$ENV{HOME}")
+ set(ENV{HOME} "${HOME}")
+
+ execute_process(COMMAND ${cmd}
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ OUTPUT_VARIABLE ov
+ ERROR_VARIABLE ev
+ RESULT_VARIABLE rv)
+
+ set(ENV{HOME} "${original_ENV_HOME}")
+
+ message("Results of running ${cmd}")
+ message("rv='${rv}'")
+ message("ov='${ov}'")
+ message("ev='${ev}'")
+ message("")
+
+ if(NOT rv STREQUAL 0)
+ if(is_git_checkout AND (rv STREQUAL "1"))
+ # Many builds of git return "1" from a "nothing is changed" git status call...
+ # Do not fail with an error for rv==1 with git...
+ else()
+ message(FATAL_ERROR "error: ${cmd} attempt failed... (see output above)")
+ endif()
+ endif()
+else()
+ message(FATAL_ERROR "error: no COMMAND to run to analyze source tree...")
+endif()
+
+
+# Analyze output:
+#
if(NOT ov STREQUAL "")
string(REPLACE ";" "\\\\;" lines "${ov}")
string(REPLACE "\n" "E;" lines "${lines}")
@@ -110,29 +217,44 @@ if(NOT ov STREQUAL "")
endif()
if(consider)
- if(line MATCHES "^A ")
- message(" locally added file/directory detected...")
- set(additions 1)
+ if(is_cvs_checkout)
+ if(line MATCHES "^A ")
+ message(" locally added file/directory detected...")
+ set(additions 1)
+ endif()
+
+ if(line MATCHES "^C ")
+ message(" conflict detected...")
+ set(conflicts 1)
+ endif()
+
+ if(line MATCHES "^M ")
+ message(" locally modified file detected...")
+ set(modifications 1)
+ endif()
+
+ if(line MATCHES "^\\? ")
+ message(" locally non-added file/directory detected...")
+ set(nonadditions 1)
+ endif()
endif()
- if(line MATCHES "^C ")
- message(" conflict detected...")
- set(conflicts 1)
- endif()
+ if(is_git_checkout)
+ if(line MATCHES "^#[ \t]*modified:")
+ message(" locally modified file detected...")
+ set(modifications 1)
+ endif()
- if(line MATCHES "^M ")
- message(" locally modified file detected...")
- set(modifications 1)
- endif()
-
- if(line MATCHES "^\\? ")
- message(" locally non-added file/directory detected...")
- set(nonadditions 1)
+ if(line MATCHES "^# Untracked")
+ message(" locally non-added file/directory detected...")
+ set(nonadditions 1)
+ endif()
endif()
endif()
endforeach()
endif()
+
message("=============================================================================")
message("additions='${additions}'")
message("conflicts='${conflicts}'")
@@ -185,14 +307,14 @@ if(nonadditions)
message("
warning: test results confounded because this is an 'in-source' build - cannot
distinguish between non-added files that are in-source build products and
-non-added source files that somebody forgot to 'cvs add'... - this is only ok
+non-added source files that somebody forgot to 'git add'... - this is only ok
if this is intentionally an in-source dashboard build... Developers should
use out-of-source builds to verify a clean source tree with this test...
Allowing test to pass despite the warning message...
")
else()
- message(FATAL_ERROR "test fails: local source tree non-additions: use cvs add before committing, or remove the files from the source tree")
+ message(FATAL_ERROR "test fails: local source tree non-additions: use git add before committing, or remove the files from the source tree")
endif()
endif()
diff --git a/Tests/CMakeTests/FileDownloadInput.png b/Tests/CMakeTests/FileDownloadInput.png
new file mode 100644
index 0000000..7bbcee4
--- /dev/null
+++ b/Tests/CMakeTests/FileDownloadInput.png
Binary files differ
diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in
new file mode 100644
index 0000000..578f510
--- /dev/null
+++ b/Tests/CMakeTests/FileDownloadTest.cmake.in
@@ -0,0 +1,41 @@
+set(url "file://@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png")
+set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads")
+
+message(STATUS "FileDownload:1")
+file(DOWNLOAD
+ ${url}
+ ${dir}/file1.png
+ TIMEOUT 2
+ )
+
+message(STATUS "FileDownload:2")
+file(DOWNLOAD
+ ${url}
+ ${dir}/file2.png
+ TIMEOUT 2
+ SHOW_PROGRESS
+ )
+
+# Two calls in a row, exactly the same arguments.
+# Since downloaded file should exist already for 2nd call,
+# the 2nd call will short-circuit and return early...
+#
+if(EXISTS ${dir}/file3.png)
+ file(REMOVE ${dir}/file3.png)
+endif()
+
+message(STATUS "FileDownload:3")
+file(DOWNLOAD
+ ${url}
+ ${dir}/file3.png
+ TIMEOUT 2
+ EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1
+ )
+
+message(STATUS "FileDownload:4")
+file(DOWNLOAD
+ ${url}
+ ${dir}/file3.png
+ TIMEOUT 2
+ EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1
+ )
diff --git a/Tests/CTestSubmitLargeOutput/test.cmake.in b/Tests/CTestSubmitLargeOutput/test.cmake.in
index bc094b0..17a7c7d 100644
--- a/Tests/CTestSubmitLargeOutput/test.cmake.in
+++ b/Tests/CTestSubmitLargeOutput/test.cmake.in
@@ -16,6 +16,7 @@ CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1000000000)
SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000000)
+SET(CTEST_TEST_TIMEOUT @CMAKE_LONG_TEST_TIMEOUT@)
CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index f02f2f7..99da9c4 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -1,10 +1,11 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8)
project(ExternalProjectTest NONE)
include(ExternalProject)
find_package(CVS)
find_package(Subversion)
+find_package(Git)
set(base "${CMAKE_BINARY_DIR}/CMakeExternals")
set(binary_base "${base}/Build")
@@ -37,8 +38,6 @@ if(NOT DEFINED can_build_tutorial_step5)
endif()
endif()
-message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'")
-
# Empty projects that test all the known ExternalProject_Add argument key words:
#
@@ -65,7 +64,9 @@ ExternalProject_Add(${proj}
SVN_REPOSITORY ""
SVN_REVISION ""
TEST_COMMAND ""
+ TIMEOUT ""
URL ""
+ URL_MD5 ""
UPDATE_COMMAND ""
)
@@ -96,6 +97,7 @@ endif()
set(proj TutorialStep1-LocalTAR)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar"
+ URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3
LIST_SEPARATOR ::
PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
@@ -107,6 +109,7 @@ ExternalProject_Add(${proj}
set(proj TutorialStep1-LocalNoDirTAR)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar"
+ URL_MD5 d09e3d370c5c908fa035c30939ee438e
LIST_SEPARATOR @@
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR>
-DTEST_LIST:STRING=1@@2@@3
@@ -126,6 +129,7 @@ ExternalProject_Add_Step(${proj} mypatch
set(proj TutorialStep1-LocalTGZ)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz"
+ URL_MD5 38c648e817339c356f6be00eeed79bd0
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR>
INSTALL_COMMAND ""
)
@@ -133,12 +137,63 @@ ExternalProject_Add(${proj}
set(proj TutorialStep1-LocalNoDirTGZ)
ExternalProject_Add(${proj}
URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz"
+ URL_MD5 0b8182edcecdf40bf1c9d71d7d259f78
CMAKE_GENERATOR "${CMAKE_GENERATOR}"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
INSTALL_COMMAND ""
)
+# Local BZ2:
+#
+# (The bz2 tests are here just to verify that the bz2 decompression is executed
+# during a test suite run... The configure and build commands are set to
+# nothing to make the test quicker. To make this more complete, I should add
+# a diff between this and the TGZ source tree since that one does build...)
+#
+set(proj TutorialStep1-LocalBZ2)
+ExternalProject_Add(${proj}
+ URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+)
+
+set(proj TutorialStep1-LocalNoDirBZ2)
+ExternalProject_Add(${proj}
+ URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+)
+
+
+# Local ZIP:
+#
+# (The zip tests are here just to verify that the zip decompression is executed
+# during a test suite run... The configure and build commands are set to
+# nothing to make the test quicker. To make this more complete, I should add
+# a diff between this and the TGZ source tree since that one does build...)
+#
+set(proj TutorialStep1-LocalZIP)
+ExternalProject_Add(${proj}
+ URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+)
+
+set(proj TutorialStep1-LocalNoDirZIP)
+ExternalProject_Add(${proj}
+ URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+)
+
+
+# CVS-based tests:
+#
set(do_cvs_tests 0)
if(CVS_EXECUTABLE)
@@ -161,8 +216,9 @@ if(do_cvs_tests)
ExternalProject_Add(${proj}
SOURCE_DIR ${local_cvs_repo}
URL ${CMAKE_CURRENT_SOURCE_DIR}/cvsrepo.tgz
+ URL_MD5 55fc85825ffdd9ed2597123c68b79f7e
BUILD_COMMAND ""
- CONFIGURE_COMMAND ${CVS_EXECUTABLE} --version
+ CONFIGURE_COMMAND "${CVS_EXECUTABLE}" --version
INSTALL_COMMAND ""
)
@@ -215,6 +271,8 @@ if(do_cvs_tests)
endif()
+# SVN-based tests:
+#
set(do_svn_tests 0)
if(Subversion_SVN_EXECUTABLE)
@@ -257,8 +315,9 @@ if(do_svn_tests)
ExternalProject_Add(${proj}
SOURCE_DIR ${local_svn_repo}
URL ${CMAKE_CURRENT_SOURCE_DIR}/svnrepo.tgz
+ URL_MD5 2f468be4ed1fa96377fca0cc830819c4
BUILD_COMMAND ""
- CONFIGURE_COMMAND ${Subversion_SVN_EXECUTABLE} --version
+ CONFIGURE_COMMAND "${Subversion_SVN_EXECUTABLE}" --version
INSTALL_COMMAND ""
)
@@ -301,6 +360,80 @@ if(do_svn_tests)
endif()
+set(do_git_tests 0)
+
+if(GIT_EXECUTABLE)
+ set(do_git_tests 1)
+
+ execute_process(
+ COMMAND "${GIT_EXECUTABLE}" --version
+ OUTPUT_VARIABLE ov
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ string(REGEX REPLACE "^git version (.+)$" "\\1" git_version "${ov}")
+ message(STATUS "git_version='${git_version}'")
+
+ if(git_version VERSION_LESS 1.6.5)
+ message(STATUS "No ExternalProject git tests with git client less than version 1.6.5")
+ set(do_git_tests 0)
+ endif()
+endif()
+
+
+if(do_git_tests)
+ set(local_git_repo "../../LocalRepositories/GIT")
+
+ # Unzip/untar the git repository in our source folder so that other
+ # projects below may use it to test git args of ExternalProject_Add
+ #
+ set(proj SetupLocalGITRepository)
+ ExternalProject_Add(${proj}
+ SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz
+ BUILD_COMMAND ""
+ CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version
+ INSTALL_COMMAND ""
+ )
+
+ # git by commit id:
+ #
+ set(proj TutorialStep1-GIT-byhash)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ GIT_TAG d1970730310fe8bc07e73f15dc570071f9f9654a
+ UPDATE_COMMAND ""
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ )
+
+ # git by explicit branch/tag name:
+ #
+ set(proj TutorialStep1-GIT-bytag)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ GIT_TAG "origin/master"
+ UPDATE_COMMAND ""
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ )
+
+ # Live git / master (no GIT_TAG):
+ #
+ set(proj TutorialStep1-GIT-master)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ )
+endif()
+
+
# Test the testable built/installed products:
#
enable_testing()
@@ -365,3 +498,10 @@ if(can_build_tutorial_step5)
set_property(TEST TutorialStep5-InstallTreeTest
APPEND PROPERTY LABELS Step5 InstallTree)
endif()
+
+
+message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'")
+message(STATUS "do_cvs_tests='${do_cvs_tests}'")
+message(STATUS "do_svn_tests='${do_svn_tests}'")
+message(STATUS "do_git_tests='${do_git_tests}'")
+message(STATUS "GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
diff --git a/Tests/ExternalProject/Example/CMakeLists.txt b/Tests/ExternalProject/Example/CMakeLists.txt
new file mode 100644
index 0000000..2cadd7d
--- /dev/null
+++ b/Tests/ExternalProject/Example/CMakeLists.txt
@@ -0,0 +1,11 @@
+# This is the canonical simplest ExternalProject example CMakeLists.txt file:
+cmake_minimum_required(VERSION 2.8)
+project(ExternalProjectExample NONE)
+include(ExternalProject)
+
+ExternalProject_Add(
+ cmake281
+ URL http://www.cmake.org/files/v2.8/cmake-2.8.1.tar.gz
+ CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+ BUILD_COMMAND ""
+)
diff --git a/Tests/ExternalProject/Step1.tar.bz2 b/Tests/ExternalProject/Step1.tar.bz2
new file mode 100644
index 0000000..49b5f23
--- /dev/null
+++ b/Tests/ExternalProject/Step1.tar.bz2
Binary files differ
diff --git a/Tests/ExternalProject/Step1.zip b/Tests/ExternalProject/Step1.zip
new file mode 100644
index 0000000..49dac24
--- /dev/null
+++ b/Tests/ExternalProject/Step1.zip
Binary files differ
diff --git a/Tests/ExternalProject/Step1NoDir.tar.bz2 b/Tests/ExternalProject/Step1NoDir.tar.bz2
new file mode 100644
index 0000000..92eb480
--- /dev/null
+++ b/Tests/ExternalProject/Step1NoDir.tar.bz2
Binary files differ
diff --git a/Tests/ExternalProject/Step1NoDir.zip b/Tests/ExternalProject/Step1NoDir.zip
new file mode 100644
index 0000000..b42d318
--- /dev/null
+++ b/Tests/ExternalProject/Step1NoDir.zip
Binary files differ
diff --git a/Tests/ExternalProject/gitrepo.tgz b/Tests/ExternalProject/gitrepo.tgz
new file mode 100644
index 0000000..0a84bda
--- /dev/null
+++ b/Tests/ExternalProject/gitrepo.tgz
Binary files differ
diff --git a/Tests/LinkFlags/CMakeLists.txt b/Tests/LinkFlags/CMakeLists.txt
new file mode 100644
index 0000000..e06020c
--- /dev/null
+++ b/Tests/LinkFlags/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required(VERSION 2.8)
+project(LinkFlags C)
+
+string(TOUPPER "${TEST_CONFIG}" TEST_CONFIG_UPPER)
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+ set(pre -)
+endif()
+
+add_library(LinkFlags_lib STATIC LinkFlagsLib.c)
+set_property(TARGET LinkFlags_lib PROPERTY STATIC_LIBRARY_FLAGS ${pre}BADFLAG${obj})
+
+add_library(LinkFlags_dll SHARED LinkFlagsLib.c)
+set_property(TARGET LinkFlags_dll PROPERTY LINK_FLAGS ${pre}BADFLAG${obj})
+
+add_executable(LinkFlags_exe LinkFlagsExe.c)
+set_property(TARGET LinkFlags_exe PROPERTY LINK_FLAGS ${pre}BADFLAG${obj})
+
+add_library(LinkFlags_lib_config STATIC LinkFlagsLib.c)
+set_property(TARGET LinkFlags_lib_config PROPERTY STATIC_LIBRARY_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj})
+
+add_library(LinkFlags_dll_config SHARED LinkFlagsLib.c)
+set_property(TARGET LinkFlags_dll_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj})
+
+add_executable(LinkFlags_exe_config LinkFlagsExe.c)
+set_property(TARGET LinkFlags_exe_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj})
+
+add_executable(LinkFlags LinkFlags.c)
diff --git a/Tests/LinkFlags/LinkFlags.c b/Tests/LinkFlags/LinkFlags.c
new file mode 100644
index 0000000..78f2de1
--- /dev/null
+++ b/Tests/LinkFlags/LinkFlags.c
@@ -0,0 +1 @@
+int main(void) { return 0; }
diff --git a/Tests/LinkFlags/LinkFlagsExe.c b/Tests/LinkFlags/LinkFlagsExe.c
new file mode 100644
index 0000000..123587a
--- /dev/null
+++ b/Tests/LinkFlags/LinkFlagsExe.c
@@ -0,0 +1,6 @@
+int main(void) { return 0; }
+
+/* Intel compiler does not reject bad flags or objects! */
+#if defined(__INTEL_COMPILER)
+# error BADFLAG
+#endif
diff --git a/Tests/LinkFlags/LinkFlagsLib.c b/Tests/LinkFlags/LinkFlagsLib.c
new file mode 100644
index 0000000..9d8d088
--- /dev/null
+++ b/Tests/LinkFlags/LinkFlagsLib.c
@@ -0,0 +1,6 @@
+int flags_lib(void) { return 0; }
+
+/* Intel compiler does not reject bad flags or objects! */
+#if defined(__INTEL_COMPILER)
+# error BADFLAG
+#endif