[Cmake-commits] [cmake-commits] hoffman committed CMakeLists.txt 1.17.2.1 1.17.2.2 CMakeMinimumRequiredTest.cmake.in NONE 1.1.2.2 CMakeMinimumRequiredTestScript.cmake NONE 1.1.2.2 EndStuffTest.cmake.in NONE 1.1.2.2 EndStuffTestScript.cmake NONE 1.1.2.2 ExecuteScriptTests.cmake NONE 1.2.2.2 ImplicitLinkInfoTest.cmake.in 1.6 1.6.2.1 MathTest.cmake.in NONE 1.1.2.2 MathTestScript.cmake NONE 1.1.2.2 StringTest.cmake.in NONE 1.2.2.2 StringTestScript.cmake NONE 1.2.2.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Oct 9 16:11:45 EDT 2009
Update of /cvsroot/CMake/CMake/Tests/CMakeTests
In directory public:/mounts/ram/cvs-serv13963/Tests/CMakeTests
Modified Files:
Tag: CMake-2-8
CMakeLists.txt ImplicitLinkInfoTest.cmake.in
Added Files:
Tag: CMake-2-8
CMakeMinimumRequiredTest.cmake.in
CMakeMinimumRequiredTestScript.cmake EndStuffTest.cmake.in
EndStuffTestScript.cmake ExecuteScriptTests.cmake
MathTest.cmake.in MathTestScript.cmake StringTest.cmake.in
StringTestScript.cmake
Log Message:
Merge in changes for RC 3
Index: ImplicitLinkInfoTest.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C 2 -d -r1.6 -r1.6.2.1
*** ImplicitLinkInfoTest.cmake.in 29 Jul 2009 20:38:12 -0000 1.6
--- ImplicitLinkInfoTest.cmake.in 9 Oct 2009 20:11:43 -0000 1.6.2.1
***************
*** 78,81 ****
--- 78,89 ----
list(APPEND platforms linux64_pgf90)
+ # gcc dummy.c -v # in strange path
+ set(linux64_test1_text "
+ /this/might/match/as/a/linker/ld/but/it/is/not because the ld is not the last path component
+ ${linux64_gcc_text}")
+ set(linux64_test1_libs "${linux64_gcc_libs}")
+ set(linux64_test1_dirs "${linux64_gcc_dirs}")
+ list(APPEND platforms linux64_test1)
+
#-----------------------------------------------------------------------------
# Sun
***************
*** 340,344 ****
foreach(p IN LISTS platforms)
! cmake_parse_implicit_link_info("${${p}_text}" libs dirs)
foreach(v libs dirs)
--- 348,352 ----
foreach(p IN LISTS platforms)
! cmake_parse_implicit_link_info("${${p}_text}" libs dirs log)
foreach(v libs dirs)
***************
*** 350,353 ****
--- 358,363 ----
"but got\n"
" [${${v}}]\n"
+ "Parse log was:\n"
+ "${log}"
)
endif()
--- NEW FILE: ExecuteScriptTests.cmake ---
# This function calls the ${scriptname} file to execute one test case:
#
function(execute_one_script_test scriptname testname expected_result)
message("execute_one_script_test")
message("testname=[${testname}]")
execute_process(
COMMAND ${CMAKE_COMMAND}
-D "dir:STRING=${dir}"
-D "testname:STRING=${testname}"
-P "${scriptname}"
OUTPUT_VARIABLE out
ERROR_VARIABLE err
RESULT_VARIABLE result
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
message("out=[${out}]")
message("err=[${err}]")
if(expected_result STREQUAL "fail")
# case expected to fail, result should be non-0...
# error if it's 0
if("${result}" STREQUAL "0")
message(SEND_ERROR "script failed: testname='${testname}' [${result}] actually passed, but expected to fail...")
endif()
else()
# case expected to pass, result should be 0...
# error if it's non-0
if(NOT "${result}" STREQUAL "0")
message(SEND_ERROR "script failed: testname='${testname}' [${result}] actually failed, but expected to pass...")
endif()
endif()
message("")
endfunction()
# This function reads the script file and calls execute_one_script_test for
# each testname case listed in the script. To add new cases, simply edit the
# script file and add an elseif() clause that matches 'regex' below.
#
function(execute_all_script_tests scriptname result)
file(READ "${scriptname}" script)
string(REPLACE ";" "\\\\;" script "${script}")
string(REPLACE "\n" "E;" script "${script}")
set(count 0)
set(regex "^ *(if|elseif) *\\( *testname +STREQUAL +\\\"*([^\\\"\\)]+)\\\"* *\\) *# *(fail|pass) *E$")
foreach(line ${script})
if(line MATCHES "${regex}")
math(EXPR count "${count} + 1")
string(REGEX REPLACE "${regex}" "\\2" testname "${line}")
string(REGEX REPLACE "${regex}" "\\3" expected_result "${line}")
execute_one_script_test(${scriptname} ${testname} ${expected_result})
endif()
endforeach()
set(${result} ${count} PARENT_SCOPE)
endfunction()
--- NEW FILE: StringTestScript.cmake ---
message(STATUS "testname='${testname}'")
if(testname STREQUAL empty) # fail
string()
elseif(testname STREQUAL bogus) # fail
string(BOGUS)
elseif(testname STREQUAL random) # pass
string(RANDOM r)
message(STATUS "r='${r}'")
elseif(testname STREQUAL toupper_no_variable) # fail
string(TOUPPER)
elseif(testname STREQUAL ascii_no_variable) # fail
string(ASCII)
elseif(testname STREQUAL ascii_code_too_small) # fail
string(ASCII -1 bummer)
elseif(testname STREQUAL ascii_code_too_large) # fail
string(ASCII 288 bummer)
elseif(testname STREQUAL configure_no_input) # fail
string(CONFIGURE)
elseif(testname STREQUAL configure_no_variable) # fail
string(CONFIGURE "this is @testname@")
elseif(testname STREQUAL configure_escape_quotes) # pass
string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES)
message(STATUS "v='${v}'")
elseif(testname STREQUAL configure_bogus) # fail
string(CONFIGURE "this is @testname@" v ESCAPE_QUOTES BOGUS)
elseif(testname STREQUAL regex_no_mode) # fail
string(REGEX)
elseif(testname STREQUAL regex_match_not_enough_args) # fail
string(REGEX MATCH)
elseif(testname STREQUAL regex_matchall_not_enough_args) # fail
string(REGEX MATCHALL)
elseif(testname STREQUAL regex_replace_not_enough_args) # fail
string(REGEX REPLACE)
elseif(testname STREQUAL regex_bogus_mode) # fail
string(REGEX BOGUS)
elseif(testname STREQUAL regex_match_multiple_inputs) # pass
string(REGEX MATCH ".*" v input1 input2 input3 input4)
message(STATUS "v='${v}'")
elseif(testname STREQUAL regex_match_bad_regex) # fail
string(REGEX MATCH "(.*" v input)
elseif(testname STREQUAL regex_match_empty_string) # fail
string(REGEX MATCH "x*" v "")
elseif(testname STREQUAL regex_match_no_match) # pass
string(REGEX MATCH "xyz" v "abc")
message(STATUS "v='${v}'")
elseif(testname STREQUAL regex_matchall_multiple_inputs) # pass
string(REGEX MATCHALL "input" v input1 input2 input3 input4)
message(STATUS "v='${v}'")
elseif(testname STREQUAL regex_matchall_bad_regex) # fail
string(REGEX MATCHALL "(.*" v input)
elseif(testname STREQUAL regex_matchall_empty_string) # fail
string(REGEX MATCHALL "x*" v "")
elseif(testname STREQUAL regex_replace_ends_with_backslash) # fail
string(REGEX REPLACE "input" "output\\" v input1 input2 input3 input4)
elseif(testname STREQUAL regex_replace_ends_with_escaped_backslash) # pass
string(REGEX REPLACE "input" "output\\\\" v input1 input2 input3 input4)
message(STATUS "v='${v}'")
elseif(testname STREQUAL regex_replace_has_linefeed) # pass
string(REGEX REPLACE "input" "output\\n" v input1 input2 input3 input4)
message(STATUS "v='${v}'")
elseif(testname STREQUAL regex_replace_has_bogus_escape) # fail
string(REGEX REPLACE "input" "output\\a" v input1 input2 input3 input4)
elseif(testname STREQUAL regex_replace_bad_regex) # fail
string(REGEX REPLACE "this (.*" "with that" v input)
elseif(testname STREQUAL regex_replace_empty_string) # fail
string(REGEX REPLACE "x*" "that" v "")
elseif(testname STREQUAL regex_replace_index_too_small) # fail
string(REGEX REPLACE "^this (.*)$" "with \\1 \\-1" v "this input")
elseif(testname STREQUAL regex_replace_index_too_large) # fail
string(REGEX REPLACE "^this (.*)$" "with \\1 \\2" v "this input")
elseif(testname STREQUAL compare_no_mode) # fail
string(COMPARE)
elseif(testname STREQUAL compare_bogus_mode) # fail
string(COMPARE BOGUS)
elseif(testname STREQUAL compare_not_enough_args) # fail
string(COMPARE EQUAL)
elseif(testname STREQUAL replace_not_enough_args) # fail
string(REPLACE)
elseif(testname STREQUAL replace_multiple_inputs) # pass
string(REPLACE "input" "output" v input1 input2 input3 input4)
message(STATUS "v='${v}'")
elseif(testname STREQUAL substring_not_enough_args) # fail
string(SUBSTRING)
elseif(testname STREQUAL substring_begin_too_large) # fail
string(SUBSTRING "abcdefg" 25 100 v)
elseif(testname STREQUAL substring_end_too_large) # fail
string(SUBSTRING "abcdefg" 1 100 v)
elseif(testname STREQUAL substring_begin_less_than_zero) # fail
string(SUBSTRING "abcdefg" -2 4 v)
elseif(testname STREQUAL substring_end_less_than_begin) # fail
string(SUBSTRING "abcdefg" 6 3 v)
elseif(testname STREQUAL length_not_enough_args) # fail
string(LENGTH)
elseif(testname STREQUAL strip_not_enough_args) # fail
string(STRIP)
elseif(testname STREQUAL random_not_enough_args) # fail
string(RANDOM)
elseif(testname STREQUAL random_3_args) # fail
string(RANDOM LENGTH 9)
elseif(testname STREQUAL random_5_args) # fail
string(RANDOM LENGTH 9 ALPHABET "aceimnorsuvwxz")
elseif(testname STREQUAL random_with_length) # pass
string(RANDOM LENGTH 9 v)
message(STATUS "v='${v}'")
elseif(testname STREQUAL random_with_alphabet) # pass
string(RANDOM ALPHABET "aceimnorsuvwxz" v)
message(STATUS "v='${v}'")
elseif(testname STREQUAL random_bad_length) # fail
string(RANDOM LENGTH 0 v)
elseif(testname STREQUAL random_empty_alphabet) # pass
string(RANDOM ALPHABET "" v)
message(STATUS "v='${v}'")
elseif(testname STREQUAL random_with_length_and_alphabet) # pass
string(RANDOM LENGTH 9 ALPHABET "aceimnorsuvwxz" v)
message(STATUS "v='${v}'")
elseif(testname STREQUAL random_with_various_alphabets) # pass
# small alphabet
string(RANDOM LENGTH 32 ALPHABET "ACGT" v)
message(STATUS "v='${v}'")
# smaller alphabet
string(RANDOM LENGTH 32 ALPHABET "AB" v)
message(STATUS "v='${v}'")
# smallest alphabet
string(RANDOM LENGTH 32 ALPHABET "Z" v)
message(STATUS "v='${v}'")
# smallest length and alphabet
string(RANDOM LENGTH 1 ALPHABET "Q" v)
message(STATUS "v='${v}'")
# alphabet of many colors - use all the crazy keyboard characters
string(RANDOM LENGTH 78 ALPHABET "~`!@#$%^&*()_-+={}[]\\|:\\;'\",.<>/?" v)
message(STATUS "v='${v}'")
else() # fail
message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
endif()
--- NEW FILE: CMakeMinimumRequiredTestScript.cmake ---
message(STATUS "testname='${testname}'")
if(testname STREQUAL empty) # pass
cmake_minimum_required()
elseif(testname STREQUAL bogus) # fail
cmake_minimum_required(BOGUS)
elseif(testname STREQUAL no_version) # fail
cmake_minimum_required(VERSION)
elseif(testname STREQUAL no_version_before_fatal_error) # fail
cmake_minimum_required(VERSION FATAL_ERROR)
elseif(testname STREQUAL bad_version) # fail
cmake_minimum_required(VERSION 2.blah.blah)
elseif(testname STREQUAL worse_version) # fail
cmake_minimum_required(VERSION blah.blah.blah)
elseif(testname STREQUAL future_version) # fail
math(EXPR major "${CMAKE_MAJOR_VERSION} + 1")
cmake_minimum_required(VERSION ${major}.2.1)
elseif(testname STREQUAL unknown_arg) # fail
cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.0.0 SILLY)
else() # fail
message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
endif()
--- NEW FILE: CMakeMinimumRequiredTest.cmake.in ---
# Execute each test listed in:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/CMakeMinimumRequiredTestScript.cmake")
set(number_of_tests_expected 8)
include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)
# And verify that number_of_tests_executed is at least as many as we know
# about as of this writing...
#
message(STATUS "scriptname='${scriptname}'")
message(STATUS "number_of_tests_executed='${number_of_tests_executed}'")
message(STATUS "number_of_tests_expected='${number_of_tests_expected}'")
if(number_of_tests_executed LESS number_of_tests_expected)
message(FATAL_ERROR "error: some test cases were skipped")
endif()
--- NEW FILE: MathTest.cmake.in ---
# Execute each test listed in:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/MathTestScript.cmake")
set(number_of_tests_expected 4)
include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)
# And verify that number_of_tests_executed is at least as many as we know
# about as of this writing...
#
message(STATUS "scriptname='${scriptname}'")
message(STATUS "number_of_tests_executed='${number_of_tests_executed}'")
message(STATUS "number_of_tests_expected='${number_of_tests_expected}'")
if(number_of_tests_executed LESS number_of_tests_expected)
message(FATAL_ERROR "error: some test cases were skipped")
endif()
--- NEW FILE: EndStuffTestScript.cmake ---
message(STATUS "testname='${testname}'")
if(testname STREQUAL bad_else) # fail
file(WRITE "${dir}/${testname}.cmake"
"else()
")
execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake"
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(FATAL_ERROR "${testname} failed")
endif()
elseif(testname STREQUAL bad_elseif) # fail
file(WRITE "${dir}/${testname}.cmake"
"elseif()
")
execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake"
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(FATAL_ERROR "${testname} failed")
endif()
elseif(testname STREQUAL bad_endforeach) # fail
endforeach()
elseif(testname STREQUAL bad_endfunction) # fail
endfunction()
elseif(testname STREQUAL bad_endif) # fail
file(WRITE "${dir}/${testname}.cmake"
"cmake_minimum_required(VERSION 2.8)
endif()
")
execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake"
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(FATAL_ERROR "${testname} failed")
endif()
elseif(testname STREQUAL endif_low_min_version) # pass
file(WRITE "${dir}/${testname}.cmake"
"cmake_minimum_required(VERSION 1.2)
endif()
")
execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake"
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(FATAL_ERROR "${testname} failed")
endif()
elseif(testname STREQUAL endif_no_min_version) # pass
file(WRITE "${dir}/${testname}.cmake"
"endif()
")
execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake"
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(FATAL_ERROR "${testname} failed")
endif()
elseif(testname STREQUAL bad_endmacro) # fail
endmacro()
elseif(testname STREQUAL bad_endwhile) # fail
endwhile()
else() # fail
message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
endif()
--- NEW FILE: MathTestScript.cmake ---
message(STATUS "testname='${testname}'")
if(testname STREQUAL empty) # fail
math()
elseif(testname STREQUAL bogus) # fail
math(BOGUS)
elseif(testname STREQUAL not_enough_args) # fail
math(EXPR x)
elseif(testname STREQUAL cannot_parse) # fail
math(EXPR x "1 + 2 +")
else() # fail
message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
endif()
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeTests/CMakeLists.txt,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -C 2 -d -r1.17.2.1 -r1.17.2.2
*** CMakeLists.txt 1 Oct 2009 21:21:22 -0000 1.17.2.1
--- CMakeLists.txt 9 Oct 2009 20:11:43 -0000 1.17.2.2
***************
*** 23,26 ****
--- 23,34 ----
AddCMakeTest(ImplicitLinkInfo "")
AddCMakeTest(ModuleNotices "")
+ AddCMakeTest(String "")
+ AddCMakeTest(Math "")
+ AddCMakeTest(CMakeMinimumRequired "")
+
+ SET(EndStuff_PreArgs
+ "-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest"
+ )
+ AddCMakeTest(EndStuff "${EndStuff_PreArgs}")
SET(GetPrerequisites_PreArgs
--- NEW FILE: StringTest.cmake.in ---
# Execute each test listed in StringTestScript.cmake:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake")
set(number_of_tests_expected 52)
include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)
# And verify that number_of_tests_executed is at least as many as we know
# about as of this writing...
#
message(STATUS "scriptname='${scriptname}'")
message(STATUS "number_of_tests_executed='${number_of_tests_executed}'")
message(STATUS "number_of_tests_expected='${number_of_tests_expected}'")
if(number_of_tests_executed LESS number_of_tests_expected)
message(FATAL_ERROR "error: some test cases were skipped")
endif()
--- NEW FILE: EndStuffTest.cmake.in ---
# Execute each test listed in:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/EndStuffTestScript.cmake")
set(number_of_tests_expected 9)
include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
execute_all_script_tests(${scriptname} number_of_tests_executed)
# And verify that number_of_tests_executed is at least as many as we know
# about as of this writing...
#
message(STATUS "scriptname='${scriptname}'")
message(STATUS "number_of_tests_executed='${number_of_tests_executed}'")
message(STATUS "number_of_tests_expected='${number_of_tests_expected}'")
if(number_of_tests_executed LESS number_of_tests_expected)
message(FATAL_ERROR "error: some test cases were skipped")
endif()
More information about the Cmake-commits
mailing list