diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CTestTest2/test.cmake.in | 8 | ||||
-rw-r--r-- | Tests/CTestTest3/test.cmake.in | 8 | ||||
-rw-r--r-- | Tests/CTestTestScheduler/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/CTestTestScheduler/sleep.c | 4 | ||||
-rw-r--r-- | Tests/CTestUpdateBZR.cmake.in | 7 | ||||
-rw-r--r-- | Tests/CTestUpdateCommon.cmake | 4 | ||||
-rw-r--r-- | Tests/CTestUpdateGIT.cmake.in | 69 | ||||
-rw-r--r-- | Tests/CheckCompilerRelatedVariables/CMakeLists.txt | 85 |
9 files changed, 187 insertions, 8 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6e3e094..330cf9f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -159,7 +159,7 @@ IF(BUILD_TESTING) IF(CTEST_TEST_OSX_ARCH) ADD_TEST_MACRO(Architecture Architecture) SET_TESTS_PROPERTIES(Architecture PROPERTIES - PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype)") + PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked)") ENDIF(CTEST_TEST_OSX_ARCH) LIST(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) @@ -980,6 +980,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ADD_TEST_MACRO(ModuleDefinition example_exe) ENDIF(CMAKE_TEST_MSVC) + ADD_TEST_MACRO(CheckCompilerRelatedVariables CheckCompilerRelatedVariables) + IF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") ADD_TEST(MakeClean ${CMAKE_CTEST_COMMAND} --build-and-test @@ -1303,7 +1305,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/testOutput.log" ) SET_TESTS_PROPERTIES(CTestTestScheduler PROPERTIES - PASS_REGULAR_EXPRESSION "Start 1.*Start 2.*Start 3.*Start 4.*Start 5.*Start 5.*Start 4.*Start 3.*Start 2.*Start 1") + PASS_REGULAR_EXPRESSION "Start 1.*Start 2.*Start 3.*Start 4.*Start 4.*Start 3.*Start 2.*Start 1") CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestStopTime/test.cmake.in" diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index cccd8c1..f6ec198 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -15,6 +15,14 @@ SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") +# for unix purify has to be used as a linker, and +# will not work with ctest. So disable it so +# that it is not attempted. +IF(UNIX) + IF("${CTEST_MEMORYCHECK_COMMAND}" MATCHES purify) + SET(CTEST_MEMORYCHECK_COMMAND) + ENDIF() +ENDIF() #CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) diff --git a/Tests/CTestTest3/test.cmake.in b/Tests/CTestTest3/test.cmake.in index 1cf5a88..1e8ea50 100644 --- a/Tests/CTestTest3/test.cmake.in +++ b/Tests/CTestTest3/test.cmake.in @@ -25,6 +25,14 @@ SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") +# for unix purify has to be used as a linker, and +# will not work with ctest. So disable it so +# that it is not attempted. +IF(UNIX) + IF("${CTEST_MEMORYCHECK_COMMAND}" MATCHES purify) + SET(CTEST_MEMORYCHECK_COMMAND) + ENDIF() +ENDIF() SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") SET(CTEST_CHECKOUT_COMMAND "\"${CTEST_UPDATE_COMMAND}\" -q -z3 \"-d:pserver:anoncvs@www.cmake.org:/cvsroot/KWSys\" co -r CTest-Testing-Tag KWSys") diff --git a/Tests/CTestTestScheduler/CMakeLists.txt b/Tests/CTestTestScheduler/CMakeLists.txt index 8e7678d..882988f 100644 --- a/Tests/CTestTestScheduler/CMakeLists.txt +++ b/Tests/CTestTestScheduler/CMakeLists.txt @@ -4,6 +4,6 @@ INCLUDE (CTest) ADD_EXECUTABLE (Sleep sleep.c) -FOREACH (time RANGE 1 5) +FOREACH (time RANGE 1 4) ADD_TEST (TestSleep${time} Sleep ${time}) -ENDFOREACH (time RANGE 1 5) +ENDFOREACH (time RANGE 1 4) diff --git a/Tests/CTestTestScheduler/sleep.c b/Tests/CTestTestScheduler/sleep.c index b06776c..9631a68 100644 --- a/Tests/CTestTestScheduler/sleep.c +++ b/Tests/CTestTestScheduler/sleep.c @@ -4,13 +4,13 @@ # include <unistd.h> #endif -/* sleeps for 2n seconds, where n is the argument to the program */ +/* sleeps for 4n seconds, where n is the argument to the program */ int main(int argc, char** argv) { int time; if(argc > 1) { - time = 3 * atoi(argv[1]); + time = 4 * atoi(argv[1]); } #if defined(_WIN32) Sleep(time * 1000); diff --git a/Tests/CTestUpdateBZR.cmake.in b/Tests/CTestUpdateBZR.cmake.in index eebb4f6..7f90b50 100644 --- a/Tests/CTestUpdateBZR.cmake.in +++ b/Tests/CTestUpdateBZR.cmake.in @@ -39,6 +39,9 @@ create_content(import) run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${BZR} init ) +run_child(WORKING_DIRECTORY ${TOP}/import + COMMAND ${BZR} whoami --branch "Test Author <testauthor@cmake.org>" + ) run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${BZR} add . @@ -57,6 +60,10 @@ run_child( WORKING_DIRECTORY ${TOP} COMMAND ${BZR} branch "${REPO}" user-source ) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${BZR} whoami --branch "Test Author <testauthor@cmake.org>" + ) #----------------------------------------------------------------------------- # Make changes in the working tree. diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 94c37fe..266f4b3 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -41,8 +41,8 @@ function(check_updates build) # Compare expected and actual entries set(EXTRA "${UPDATE_XML_ENTRIES}") - list(REMOVE_ITEM EXTRA ${ARGN} ${UPDATE_MAYBE}) - set(MISSING "${ARGN}") + list(REMOVE_ITEM EXTRA ${ARGN} ${UPDATE_EXTRA} ${UPDATE_MAYBE}) + set(MISSING "${ARGN}" ${UPDATE_EXTRA}) list(REMOVE_ITEM MISSING ${UPDATE_XML_ENTRIES}) if(NOT UPDATE_NOT_GLOBAL) diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index c721bb4..f0a5770 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -5,6 +5,7 @@ # Test in a directory next to this script. get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH) set(TOP "${TOP}/@CTestUpdateGIT_DIR@") +set(UPDATE_EXTRA Updated{module}) # Include code common to all update tests. include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake") @@ -42,6 +43,35 @@ run_child( file(REMOVE_RECURSE ${TOP}/repo.git/hooks) set(REPO file://${TOP}/repo.git) +# Create submodule repository. +message("Creating submodule...") +file(MAKE_DIRECTORY ${TOP}/module.git) +run_child( + WORKING_DIRECTORY ${TOP}/module.git + COMMAND ${GIT} --bare init + ) +file(REMOVE_RECURSE ${TOP}/module.git/hooks) +set(MOD_REPO file://${TOP}/module.git) +create_content(module) +run_child(WORKING_DIRECTORY ${TOP}/module + COMMAND ${GIT} init + ) +file(REMOVE_RECURSE ${TOP}/module/.git/hooks) +file(APPEND ${TOP}/module/.git/config " +[remote \"origin\"] +\turl = ${MOD_REPO} +\tfetch = +refs/heads/*:refs/remotes/origin/* +${AUTHOR_CONFIG}") +run_child(WORKING_DIRECTORY ${TOP}/module + COMMAND ${GIT} add . + ) +run_child(WORKING_DIRECTORY ${TOP}/module + COMMAND ${GIT} commit -m "Initial content" + ) +run_child(WORKING_DIRECTORY ${TOP}/module + COMMAND ${GIT} push origin master:refs/heads/master + ) + #----------------------------------------------------------------------------- # Import initial content into the repository. message("Importing content...") @@ -61,6 +91,9 @@ run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} add . ) run_child(WORKING_DIRECTORY ${TOP}/import + COMMAND ${GIT} submodule add ${MOD_REPO} module + ) +run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} commit -m "Initial content" ) run_child(WORKING_DIRECTORY ${TOP}/import @@ -68,6 +101,19 @@ run_child(WORKING_DIRECTORY ${TOP}/import ) #----------------------------------------------------------------------------- +# Modify the submodule. +change_content(module) +run_child(WORKING_DIRECTORY ${TOP}/module + COMMAND ${GIT} add -u + ) +run_child(WORKING_DIRECTORY ${TOP}/module + COMMAND ${GIT} commit -m "Changed content" + ) +run_child(WORKING_DIRECTORY ${TOP}/module + COMMAND ${GIT} push origin master:refs/heads/master + ) + +#----------------------------------------------------------------------------- # Create a working tree. message("Checking out revision 1...") run_child( @@ -76,6 +122,14 @@ run_child( ) file(REMOVE_RECURSE ${TOP}/user-source/.git/hooks) file(APPEND ${TOP}/user-source/.git/config "${AUTHOR_CONFIG}") +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${GIT} submodule init + ) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${GIT} submodule update + ) #----------------------------------------------------------------------------- # Make changes in the working tree. @@ -95,6 +149,9 @@ run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${GIT} rm ${files_removed} ) +run_child(WORKING_DIRECTORY ${TOP}/user-source/module + COMMAND ${GIT} checkout master + ) run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${GIT} add -u @@ -140,6 +197,10 @@ run_child( WORKING_DIRECTORY ${TOP}/user-source COMMAND ${GIT} reset --hard master~2 ) +run_child( + WORKING_DIRECTORY ${TOP}/user-source + COMMAND ${GIT} submodule update + ) # Make sure pull does not try to rebase (which does not work with # modified files) even if ~/.gitconfig sets "branch.master.rebase". @@ -181,6 +242,14 @@ execute_process( WORKING_DIRECTORY \"${TOP}/dash-source\" COMMAND \"${GIT}\" reset --hard master~2 ) +execute_process( + WORKING_DIRECTORY \"${TOP}/dash-source\" + COMMAND \"${GIT}\" submodule init + ) +execute_process( + WORKING_DIRECTORY \"${TOP}/dash-source\" + COMMAND \"${GIT}\" submodule update + ) ") # Run the dashboard script with CTest. diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt new file mode 100644 index 0000000..7206f1d --- /dev/null +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -0,0 +1,85 @@ +cmake_minimum_required(VERSION 2.8) +project(CheckCompilerRelatedVariables) + + +function(echo_var var) + if(DEFINED ${var}) + message("${var}='${${var}}' is defined") + else() + message("${var}='${${var}}' is NOT defined") + endif() +endfunction() + + +# +# Check that the correct number of MSVC** variables are defined... +# +set(msvc_total 0) + +if(DEFINED MSVC60) + math(EXPR msvc_total "${msvc_total} + 1") +endif() +if(DEFINED MSVC70) + math(EXPR msvc_total "${msvc_total} + 1") +endif() +if(DEFINED MSVC71) + math(EXPR msvc_total "${msvc_total} + 1") +endif() +if(DEFINED MSVC80) + math(EXPR msvc_total "${msvc_total} + 1") +endif() +if(DEFINED MSVC90) + math(EXPR msvc_total "${msvc_total} + 1") +endif() +if(DEFINED MSVC10) + math(EXPR msvc_total "${msvc_total} + 1") +endif() + +echo_var(MSVC) +echo_var(MSVC60) +echo_var(MSVC70) +echo_var(MSVC71) +echo_var(MSVC80) +echo_var(MSVC90) +echo_var(MSVC10) + +if(MSVC) + # + # MSVC is set in cl.cmake when cl is the compiler... + # + # Exactly one of the numbered variables should also be set + # indicating which version of the cl compiler / Visual Studio + # is in use... + # + if(msvc_total EQUAL 1) + message("test passes: exactly one MSVC** variable is defined...") + else() + message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 1 expected") + endif() +else() + # + # The compiler is something other than cl... None of the MSVC** variables + # should be defined... + # + if(msvc_total EQUAL 0) + message("test passes: no MSVC** variables are defined on non-MSVC build...") + else() + message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 0 expected") + endif() +endif() + + +# +# This is a no-op executable... If this test is going to fail, it fails during +# the configure step while cmake is configuring this CMakeLists.txt file... +# + +file(WRITE + "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" + "int main() { return 0; }" + ) + +add_executable( + CheckCompilerRelatedVariables + "${CMAKE_CURRENT_BINARY_DIR}/main.cxx" + ) |