diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CTestUpdateCommon.cmake | 48 | ||||
-rw-r--r-- | Tests/CTestUpdateGIT.cmake.in | 17 | ||||
-rw-r--r-- | Tests/CompileOptions/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CompileOptions/main.cpp | 3 | ||||
-rw-r--r-- | Tests/FortranOnly/CMakeLists.txt | 22 |
5 files changed, 89 insertions, 7 deletions
diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 857c6f5..97153f0 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -219,6 +219,36 @@ function(run_dashboard_command_line bin_dir) endfunction() #----------------------------------------------------------------------------- +# Function to find the Update.xml file and make sure +# it only has the Revision in it and no updates +function(check_no_update bin_dir) + set(PATTERN ${TOP}/${bin_dir}/Testing/*/Update.xml) + file(GLOB UPDATE_XML_FILE RELATIVE ${TOP} ${PATTERN}) + string(REGEX REPLACE "//Update.xml$" "/Update.xml" + UPDATE_XML_FILE "${UPDATE_XML_FILE}") + message(" found ${UPDATE_XML_FILE}") + set(rev_regex "Revision|PriorRevision") + file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_REVISIONS + REGEX "^\t<(${rev_regex})>[^<\n]+</(${rev_regex})>$" + ) + set(found_revisons FALSE) + foreach(r IN LISTS UPDATE_XML_REVISIONS) + if("${r}" MATCHES "PriorRevision") + message(FATAL_ERROR "Found PriorRevision in no update test") + endif() + if("${r}" MATCHES "<Revision>") + set(found_revisons TRUE) + endif() + endforeach() + if(found_revisons) + message(" found <Revision> in no update test") + else() + message(FATAL_ERROR " missing <Revision> in no update test") + endif() +endfunction() + + +#----------------------------------------------------------------------------- # Function to run the dashboard through a script function(run_dashboard_script bin_dir) run_child( @@ -228,13 +258,17 @@ function(run_dashboard_script bin_dir) # Verify the updates reported by CTest. list(APPEND UPDATE_MAYBE Updated{subdir} Updated{CTestConfig.cmake}) - check_updates(${bin_dir} - Updated{foo.txt} - Updated{bar.txt} - Updated{zot.txt} - Updated{subdir/foo.txt} - Updated{subdir/bar.txt} - ) + if(NO_UPDATE) + check_no_update(${bin_dir}) + else() + check_updates(${bin_dir} + Updated{foo.txt} + Updated{bar.txt} + Updated{zot.txt} + Updated{subdir/foo.txt} + Updated{subdir/bar.txt} + ) + endif() endfunction() #----------------------------------------------------------------------------- diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index f6939de..41b732b 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -317,3 +317,20 @@ set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) # Run the dashboard script with CTest. run_dashboard_script(dash-binary-custom) + + +rewind_source(dash-source) + +#----------------------------------------------------------------------------- +# Test no update with a dashboard script. +message("Running CTest Dashboard Script (No update)...") + +create_dashboard_script(dash-binary-no-update + "# git command configuration +set(CTEST_GIT_COMMAND \"${GIT}\") +set(CTEST_UPDATE_VERSION_ONLY TRUE) +") + +# Run the dashboard script with CTest. +set(NO_UPDATE 1) +run_dashboard_script(dash-binary-no-update) diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 9b6c9c2..05a5f82 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,6 +22,12 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") + set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS + "-DTEST_OCTOTHORPE=\"#\"" + ) +endif() + target_link_libraries(CompileOptions testlib) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 42f4cca..f3c1355 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -17,6 +17,9 @@ int main() { return (strcmp(NEEDS_ESCAPE, "E$CAPE") == 0 +#ifdef TEST_OCTOTHORPE + && strcmp(TEST_OCTOTHORPE, "#") == 0 +#endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0 && TEST_C_COMPILER_VERSION_EQUALITY == 1 diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index d57a8b2..a3f83c9 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -43,3 +43,25 @@ add_custom_target(checksayhello ALL COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checksayhello.cmake ) add_dependencies(checksayhello sayhello) + +# Exclude this test on IBM XL for now because the check strangely +# fails with 'ld: 0706-029 Use a number with the -H flag'. +if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL) + set(err_log ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log) + file(REMOVE "${err_log}") + include(CheckFortranSourceCompiles) + unset(HAVE_PRINT CACHE) + CHECK_Fortran_SOURCE_COMPILES([[ + PROGRAM TEST_HAVE_PRINT + PRINT *, 'Hello' + END +]] HAVE_PRINT) + if(NOT HAVE_PRINT) + if(EXISTS "${err_log}") + file(READ "${err_log}" err) + endif() + string(REPLACE "\n" "\n " err " ${err}") + message(SEND_ERROR "CHECK_Fortran_SOURCE_COMPILES for HAVE_PRINT failed:\n" + "${err}") + endif() +endif() |