Merge branch 'escape-regex-specials-in-path' into release

This commit is contained in:
Brad King 2013-06-03 13:59:44 -04:00
commit 49cc8f44b3
7 changed files with 52 additions and 36 deletions

View File

@ -15,10 +15,7 @@ macro(ADD_TEST_MACRO NAME COMMAND)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
endmacro() endmacro()
macro(REGEX_ESCAPE_STRING _OUT _IN) include(${CMAKE_CURRENT_SOURCE_DIR}/RegexEscapeString.cmake)
# Escape special regex metacharacters with a backslash
string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}")
endmacro()
include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)

View File

@ -28,92 +28,95 @@ if(NOT result STREQUAL "alpha")
message(SEND_ERROR "bad value of VARIABLE PROPERTY test_var: got '${result}' instead of 'alpha'") message(SEND_ERROR "bad value of VARIABLE PROPERTY test_var: got '${result}' instead of 'alpha'")
endif() endif()
include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake")
REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(Missing-Argument-RESULT 1) set(Missing-Argument-RESULT 1)
set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*") set(Missing-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Missing-Argument Missing-Argument
) )
set(Bad-Scope-RESULT 1) set(Bad-Scope-RESULT 1)
set(Bad-Scope-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Scope.cmake:1 \\(get_property\\):.*get_property given invalid scope FOO\\..*") set(Bad-Scope-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Scope.cmake:1 \\(get_property\\):.*get_property given invalid scope FOO\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Bad-Scope Bad-Scope
) )
set(Bad-Argument-RESULT 1) set(Bad-Argument-RESULT 1)
set(Bad-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Argument.cmake:1 \\(get_property\\):.*get_property given invalid argument \"FOO\"\\..*") set(Bad-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Argument.cmake:1 \\(get_property\\):.*get_property given invalid argument \"FOO\"\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Bad-Argument Bad-Argument
) )
set(No-Property-RESULT 1) set(No-Property-RESULT 1)
set(No-Property-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Property.cmake:1 \\(get_property\\):.*get_property not given a PROPERTY <name> argument\\..*") set(No-Property-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Property.cmake:1 \\(get_property\\):.*get_property not given a PROPERTY <name> argument\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
No-Property No-Property
) )
set(Global-Name-RESULT 1) set(Global-Name-RESULT 1)
set(Global-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*") set(Global-Name-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Global-Name Global-Name
) )
set(Bad-Directory-RESULT 1) set(Bad-Directory-RESULT 1)
set(Bad-Directory-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Directory.cmake:1 \\(get_property\\):.*get_property DIRECTORY scope provided but requested directory was not.*found\\..*") set(Bad-Directory-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Directory.cmake:1 \\(get_property\\):.*get_property DIRECTORY scope provided but requested directory was not.*found\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Bad-Directory Bad-Directory
) )
set(No-Target-RESULT 1) set(No-Target-RESULT 1)
set(No-Target-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Target.cmake:1 \\(get_property\\):.*get_property not given name for TARGET scope\\..*") set(No-Target-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Target.cmake:1 \\(get_property\\):.*get_property not given name for TARGET scope\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
No-Target No-Target
) )
set(Bad-Target-RESULT 1) set(Bad-Target-RESULT 1)
set(Bad-Target-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Target.cmake:1 \\(get_property\\):.*get_property could not find TARGET FOO\\..*") set(Bad-Target-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Target.cmake:1 \\(get_property\\):.*get_property could not find TARGET FOO\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Bad-Target Bad-Target
) )
set(No-Source-RESULT 1) set(No-Source-RESULT 1)
set(No-Source-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Source.cmake:1 \\(get_property\\):.*get_property not given name for SOURCE scope\\..*") set(No-Source-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Source.cmake:1 \\(get_property\\):.*get_property not given name for SOURCE scope\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
No-Source No-Source
) )
set(No-Test-RESULT 1) set(No-Test-RESULT 1)
set(No-Test-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Test.cmake:1 \\(get_property\\):.*get_property not given name for TEST scope\\..*") set(No-Test-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Test.cmake:1 \\(get_property\\):.*get_property not given name for TEST scope\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
No-Test No-Test
) )
set(Bad-Test-RESULT 1) set(Bad-Test-RESULT 1)
set(Bad-Test-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Test.cmake:1 \\(get_property\\):.*get_property given TEST name that does not exist: FOO.*") set(Bad-Test-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Bad-Test.cmake:1 \\(get_property\\):.*get_property given TEST name that does not exist: FOO.*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Bad-Test Bad-Test
) )
set(Variable-Name-RESULT 1) set(Variable-Name-RESULT 1)
set(Variable-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Variable-Name.cmake:1 \\(get_property\\):.*get_property given name for VARIABLE scope\\..*") set(Variable-Name-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-Variable-Name.cmake:1 \\(get_property\\):.*get_property given name for VARIABLE scope\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
Variable-Name Variable-Name
) )
set(No-Cache-RESULT 1) set(No-Cache-RESULT 1)
set(No-Cache-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Cache.cmake:1 \\(get_property\\):.*get_property not given name for CACHE scope\\..*") set(No-Cache-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?GetProperty-No-Cache.cmake:1 \\(get_property\\):.*get_property not given name for CACHE scope\\..*")
check_cmake_test(GetProperty check_cmake_test(GetProperty
No-Cache No-Cache

View File

@ -7,6 +7,9 @@ foreach(_arg "" 0 1 2 ${TRUE_NAMES} ${FALSE_NAMES})
set(VAR_${_arg} "${_arg}") set(VAR_${_arg} "${_arg}")
endforeach() endforeach()
include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake")
REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
macro(test_vars _old) macro(test_vars _old)
# Variables set to false or not set. # Variables set to false or not set.
foreach(_var "" 0 ${FALSE_NAMES} UNDEFINED) foreach(_var "" 0 ${FALSE_NAMES} UNDEFINED)
@ -158,7 +161,7 @@ endforeach()
test_vars("") test_vars("")
set(Invalid-Argument-RESULT 1) set(Invalid-Argument-RESULT 1)
set(Invalid-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?If-Invalid-Argument.cmake:1 \\(if\\):.*Unknown arguments specified.*") set(Invalid-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?If-Invalid-Argument.cmake:1 \\(if\\):.*Unknown arguments specified.*")
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
check_cmake_test(If check_cmake_test(If

View File

@ -1,5 +1,8 @@
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake")
REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
macro(TEST command expected) macro(TEST command expected)
if("x${result}" STREQUAL "x${expected}") if("x${result}" STREQUAL "x${expected}")
#message("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") #message("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"")
@ -101,7 +104,7 @@ list(SORT result)
TEST("SORT empty result" "") TEST("SORT empty result" "")
set(No-Arguments-RESULT 1) set(No-Arguments-RESULT 1)
set(No-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*") set(No-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-No-Arguments.cmake:1 \\(list\\):.*list must be called with at least two arguments.*")
# these trigger top-level condition # these trigger top-level condition
foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort) foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort)
@ -130,33 +133,33 @@ foreach(cmd IN ITEMS Find Get Insert Length Remove_At Remove_Item)
endforeach() endforeach()
set(Length-Too-Many-Arguments-RESULT 1) set(Length-Too-Many-Arguments-RESULT 1)
set(Length-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Length-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command LENGTH requires two arguments.*") set(Length-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Length-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command LENGTH requires two arguments.*")
set(Reverse-Too-Many-Arguments-RESULT 1) set(Reverse-Too-Many-Arguments-RESULT 1)
set(Reverse-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Reverse-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REVERSE only takes one argument.*") set(Reverse-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Reverse-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REVERSE only takes one argument.*")
set(Remove_Duplicates-Too-Many-Arguments-RESULT 1) set(Remove_Duplicates-Too-Many-Arguments-RESULT 1)
set(Remove_Duplicates-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Remove_Duplicates-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REMOVE_DUPLICATES only takes one argument.*") set(Remove_Duplicates-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Remove_Duplicates-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command REMOVE_DUPLICATES only takes one argument.*")
set(Sort-Too-Many-Arguments-RESULT 1) set(Sort-Too-Many-Arguments-RESULT 1)
set(Sort-Too-Many-Arguments-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Sort-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command SORT only takes one argument.*") set(Sort-Too-Many-Arguments-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Sort-Too-Many-Arguments.cmake:1 \\(list\\):.*list sub-command SORT only takes one argument.*")
set(Invalid-Subcommand-RESULT 1) set(Invalid-Subcommand-RESULT 1)
set(Invalid-Subcommand-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Invalid-Subcommand.cmake:1 \\(list\\):.*list does not recognize sub-command NO_SUCH_SUBCOMMAND.*") set(Invalid-Subcommand-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Invalid-Subcommand.cmake:1 \\(list\\):.*list does not recognize sub-command NO_SUCH_SUBCOMMAND.*")
foreach(cmd Get Insert Remove_At) foreach(cmd Get Insert Remove_At)
set(${cmd}-Invalid-Index-RESULT 1) set(${cmd}-Invalid-Index-RESULT 1)
set(${cmd}-Invalid-Index-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-${cmd}-Invalid-Index.cmake:2 \\(list\\):.*list index: 3 out of range \\(-3, 2\\).*") set(${cmd}-Invalid-Index-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-${cmd}-Invalid-Index.cmake:2 \\(list\\):.*list index: 3 out of range \\(-3, 2\\).*")
endforeach() endforeach()
foreach(cmd Remove_Item Reverse Remove_Duplicates Sort Remove_At) foreach(cmd Remove_Item Reverse Remove_Duplicates Sort Remove_At)
string(TOUPPER ${cmd} Cmd) string(TOUPPER ${cmd} Cmd)
set(${cmd}-Nonexistent-List-RESULT 1) set(${cmd}-Nonexistent-List-RESULT 1)
set(${cmd}-Nonexistent-List-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-${cmd}-Nonexistent-List.cmake:2 \\(list\\):.*sub-command ${Cmd} requires list to be present.*") set(${cmd}-Nonexistent-List-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-${cmd}-Nonexistent-List.cmake:2 \\(list\\):.*sub-command ${Cmd} requires list to be present.*")
endforeach() endforeach()
set(Get-CMP0007-Warn-RESULT 0) set(Get-CMP0007-Warn-RESULT 0)
set(Get-CMP0007-Warn-STDERR ".*CMake Warning \\(dev\\) at (@CMAKE_CURRENT_SOURCE_DIR@/)?List-Get-CMP0007-Warn.cmake:3 \\(list\\):.*Policy CMP0007 is not set:.*") set(Get-CMP0007-Warn-STDERR ".*CMake Warning \\(dev\\) at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?List-Get-CMP0007-Warn.cmake:3 \\(list\\):.*Policy CMP0007 is not set:.*")
check_cmake_test(List check_cmake_test(List
No-Arguments No-Arguments

View File

@ -1,6 +1,9 @@
set(NUMBERS "") set(NUMBERS "")
set(COUNT 0) set(COUNT 0)
include("@CMAKE_CURRENT_SOURCE_DIR@/../RegexEscapeString.cmake")
REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
while(COUNT LESS 200) while(COUNT LESS 200)
set(NUMBERS "${NUMBERS} ${COUNT}") set(NUMBERS "${NUMBERS} ${COUNT}")
set(COUNT "2${COUNT}") set(COUNT "2${COUNT}")
@ -16,8 +19,9 @@ if(NOT NUMBERS STREQUAL " 0 3 30 20 3 30")
message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'") message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'")
endif() endif()
set(Missing-Argument-RESULT 1) set(Missing-Argument-RESULT 1)
set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Argument.cmake:1 \\(while\\):.*while called with incorrect number of arguments.*") set(Missing-Argument-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Argument.cmake:1 \\(while\\):.*while called with incorrect number of arguments.*")
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
check_cmake_test(While check_cmake_test(While
@ -25,28 +29,28 @@ check_cmake_test(While
) )
set(Missing-Endwhile-RESULT 1) set(Missing-Endwhile-RESULT 1)
set(Missing-Endwhile-STDERR ".*CMake Error in (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Endwhile.cmake:.*A logical block opening on the line.*(@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Endwhile.cmake:1 \\(while\\).*is not closed\\..*") set(Missing-Endwhile-STDERR ".*CMake Error in (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Endwhile.cmake:.*A logical block opening on the line.*(${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Missing-Endwhile.cmake:1 \\(while\\).*is not closed\\..*")
check_cmake_test(While check_cmake_test(While
Missing-Endwhile Missing-Endwhile
) )
set(Endwhile-Mismatch-RESULT 0) set(Endwhile-Mismatch-RESULT 0)
set(Endwhile-Mismatch-STDERR ".*CMake Warning \\(dev\\) in (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Mismatch.cmake:.*A logical block opening on the line.*(@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Mismatch.cmake:1 \\(while\\).*with mis-matching arguments\\..*") set(Endwhile-Mismatch-STDERR ".*CMake Warning \\(dev\\) in (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Mismatch.cmake:.*A logical block opening on the line.*(${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Mismatch.cmake:1 \\(while\\).*with mis-matching arguments\\..*")
check_cmake_test(While check_cmake_test(While
Endwhile-Mismatch Endwhile-Mismatch
) )
set(Endwhile-Alone-RESULT 1) set(Endwhile-Alone-RESULT 1)
set(Endwhile-Alone-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Alone.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\.\n.*$") set(Endwhile-Alone-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Alone.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\.\n.*$")
check_cmake_test(While check_cmake_test(While
Endwhile-Alone Endwhile-Alone
) )
set(Endwhile-Alone-Args-RESULT 1) set(Endwhile-Alone-Args-RESULT 1)
set(Endwhile-Alone-Args-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Alone-Args.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\. Or its arguments did not.*$") set(Endwhile-Alone-Args-STDERR ".*CMake Error at (${CTEST_ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/)?While-Endwhile-Alone-Args.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\. Or its arguments did not.*$")
check_cmake_test(While check_cmake_test(While
Endwhile-Alone-Args Endwhile-Alone-Args

View File

@ -1,3 +1,5 @@
REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
foreach (_retval 0 1) foreach (_retval 0 1)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.c" "int main(){return ${_retval};}\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.c" "int main(){return ${_retval};}\n")
endforeach () endforeach ()
@ -49,7 +51,7 @@ string(REPLACE "+" "\\+" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}")
foreach (_unkn Unknown UnknownQuoted) foreach (_unkn Unknown UnknownQuoted)
set_tests_properties(CTestTestMemcheck${_unkn} PROPERTIES set_tests_properties(CTestTestMemcheck${_unkn} PROPERTIES
PASS_REGULAR_EXPRESSION "Do not understand memory checker: ${CMAKE_COMMAND_ESCAPED}\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/${_unkn}/test.cmake\n") PASS_REGULAR_EXPRESSION "Do not understand memory checker: ${CMAKE_COMMAND_ESCAPED}\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${_unkn}/test.cmake\n")
endforeach () endforeach ()
set_tests_properties(CTestTestMemcheckNotExist PROPERTIES set_tests_properties(CTestTestMemcheckNotExist PROPERTIES
@ -67,7 +69,7 @@ foreach (_pp Pre Post)
string(TOLOWER ${_pp} _pp_lower) string(TOLOWER ${_pp} _pp_lower)
set_tests_properties(CTestTestMemcheckDummyValgrindFail${_pp} set_tests_properties(CTestTestMemcheckDummyValgrindFail${_pp}
PROPERTIES PROPERTIES
PASS_REGULAR_EXPRESSION "\nProblem running command: ${CMAKE_CURRENT_BINARY_DIR}[^\n]*fail[^\n]*\n(.*\n)?Problem executing ${_pp_lower}-memcheck command\\(s\\\).\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindFail${_pp}/test.cmake\n") PASS_REGULAR_EXPRESSION "\nProblem running command: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}[^\n]*fail[^\n]*\n(.*\n)?Problem executing ${_pp_lower}-memcheck command\\(s\\\).\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindFail${_pp}/test.cmake\n")
endforeach () endforeach ()
set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck
@ -75,7 +77,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck
PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*\n1/1 MemCheck #1: RunCMake .*${NORMAL_CTEST_OUTPUT}") PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*\n1/1 MemCheck #1: RunCMake .*${NORMAL_CTEST_OUTPUT}")
set_tests_properties(CTestTestMemcheckDummyPurify PROPERTIES set_tests_properties(CTestTestMemcheckDummyPurify PROPERTIES
PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/DummyPurify/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyPurify/test.cmake\n") PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyPurify/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyPurify/test.cmake\n")
set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES
PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CMAKE_CURRENT_BINARY_DIR}/DummyBC/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error parsing XML in stream at line 1: no element found\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyBC/test.cmake\n") PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyBC/Testing/Temporary/MemoryChecker.log\n(.*\n)?Error parsing XML in stream at line 1: no element found\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyBC/test.cmake\n")

View File

@ -0,0 +1,4 @@
macro(REGEX_ESCAPE_STRING _OUT _IN)
# Escape special regex metacharacters with a backslash
string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}")
endmacro()