diff options
Diffstat (limited to 'Tests')
141 files changed, 2043 insertions, 98 deletions
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index fdc5c00..fb17ebb 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -9,7 +9,7 @@ set(SRCS) # and also generate assembler files from C: if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND NOT CMAKE_OSX_ARCHITECTURES) - if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) + if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND UNIX)) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};") diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 8df331e..6209bb8 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -28,10 +28,6 @@ function(help_xcode_depends) endif() endfunction() -if("${CMAKE_GENERATOR}" MATCHES "Ninja") - set(HELP_NINJA 1) # TODO Why is this needed? -endif() - # The Intel compiler causes the MSVC linker to crash during # incremental linking, so avoid the /INCREMENTAL:YES flag. if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel") @@ -218,7 +214,7 @@ try_compile(RESULT OUTPUT_VARIABLE OUTPUT) # Xcode is in serious need of help here -if(HELP_XCODE OR HELP_NINJA) +if(HELP_XCODE) try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 25cc846..c9d9568 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -292,11 +292,11 @@ if(BUILD_TESTING) endif() ADD_TEST_MACRO(SourcesProperty SourcesProperty) if(CMAKE_CXX_COMPILER_ID STREQUAL GNU - AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) + AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) set(runCxxDialectTest 1) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL Clang - AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9) + AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) if(NOT APPLE OR POLICY CMP0025) set(runCxxDialectTest 1) endif() @@ -690,7 +690,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release FAIL_REGULAR_EXPRESSION "Unexpected: ") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ArgumentExpansion") - add_test(GeneratorExpression ${CMAKE_CTEST_COMMAND} + add_test(GeneratorExpression + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/GeneratorExpression" "${CMake_BINARY_DIR}/Tests/GeneratorExpression" @@ -715,6 +716,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand") + ADD_TEST_MACRO(CustomCommandByproducts CustomCommandByproducts) + ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND}) add_test(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} @@ -950,7 +953,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CPackRun_CPackGen "-DCPackGen=${CPackGen}") foreach(CPackComponentWay ${CWAYLST}) set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}") - add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND} + add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll" "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" @@ -1501,7 +1505,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall) # Test static linking on toolchains known to support it. - if("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU)$" + if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT APPLE AND NOT WIN32 AND NOT CYGWIN AND EXISTS "/usr/lib/libm.a") add_test(LinkStatic ${CMAKE_CTEST_COMMAND} @@ -1781,6 +1785,27 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if(WIN32) + # Macro to search for available Windows CE SDKs in the windows Registry + macro(select_wince_sdk selected_reg selected_sdk) + if(CMAKE_HOST_WIN32) + execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs" + OUTPUT_VARIABLE sdk_reg + ERROR_VARIABLE my_err) + string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") + list(LENGTH sdk_list sdk_list_len) + if (${sdk_list_len} GREATER 1) + list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above + string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name + endif() + # Build a key to be used by get_filename_component that is pointing to the SDK directory + set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]") + + # Set return values + set(${selected_reg} ${_reg}) + set(${selected_sdk} ${_sdk}) + endif(CMAKE_HOST_WIN32) + endmacro(select_wince_sdk) + set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") @@ -1788,8 +1813,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") + select_wince_sdk(reg_wince wince_sdk) set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") - foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 tegra) + foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 wince tegra) get_filename_component(r "${reg_${reg}}" ABSOLUTE) if(IS_DIRECTORY "${r}") set(${reg} 1) @@ -1835,6 +1861,35 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(WIN32 AND wince) + macro(add_test_VSWinCE name generator systemName systemVersion generatorPlatform) + # TODO: Fix the tutorial to make it work in cross compile + # currently the MakeTable is build for target and can not be used on the host + # This happens in part 5 so we build only part 1-4 of the tutorial + foreach(STP RANGE 1 4) + add_test(NAME "TutorialStep${STP}.${name}" COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}" + "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}_${name}" + --build-generator "${generator}" + --build-project Tutorial + --build-config $<CONFIGURATION> + --build-options -DCMAKE_SYSTEM_NAME=${systemName} + -DCMAKE_SYSTEM_VERSION=${systemVersion} + -DCMAKE_GENERATOR_PLATFORM=${generatorPlatform}) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}_${name}") + endforeach() + endmacro() + + if(vs11) + add_test_VSWinCE(vs11-ce80-ARM "Visual Studio 11 2012" WindowsCE 8.0 ${wince_sdk}) + endif() + + if(vs12) + add_test_VSWinCE(vs12-ce80-ARM "Visual Studio 12 2013" WindowsCE 8.0 ${wince_sdk}) + endif() + endif() + if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND} @@ -1990,7 +2045,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release PASS_REGULAR_EXPRESSION "uninitialized variable 'USED_VARIABLE'") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized") - add_test(TestsWorkingDirectory ${CMAKE_CTEST_COMMAND} + add_test(TestsWorkingDirectory + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/TestsWorkingDirectory" "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" @@ -2339,6 +2395,42 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "Process file.*CoverageTest.java.*Total LOC:.*17.*Percentage Coverage: 76.47*" ENVIRONMENT COVFILE=) + # Adding a test case for Javascript Coverage + configure_file( + "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/DartConfiguration.tcl.in" + "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/DartConfiguration.tcl") + configure_file( + "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/output.json.in" + "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/output.json") + file(COPY "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/" + DESTINATION "${CMake_BINARY_DIR}/Testing/JavascriptCoverage" + FILES_MATCHING PATTERN "*.js") + add_test(NAME CTestJavascriptCoverage + COMMAND cmake -E chdir + ${CMake_BINARY_DIR}/Testing/JavascriptCoverage + $<TARGET_FILE:ctest> -T Coverage --debug) + set_tests_properties(CTestJavascriptCoverage PROPERTIES + PASS_REGULAR_EXPRESSION + "Process file.*test3.js.*Total LOC:.*49.*Percentage Coverage: 79.59*" + ENVIRONMENT COVFILE=) + + # test coverage for Delphi-code-Coverage + configure_file( + "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/DartConfiguration.tcl.in" + "${CMake_BINARY_DIR}/Testing/DelphiCoverage/DartConfiguration.tcl") + file(COPY "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/src" + DESTINATION "${CMake_BINARY_DIR}/Testing/DelphiCoverage") + file(COPY "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html" + DESTINATION "${CMake_BINARY_DIR}/Testing/DelphiCoverage") + add_test(NAME CTestDelphiCoverage + COMMAND cmake -E chdir + ${CMake_BINARY_DIR}/Testing/DelphiCoverage + $<TARGET_FILE:ctest> -T Coverage --debug) + set_tests_properties(CTestDelphiCoverage PROPERTIES + PASS_REGULAR_EXPRESSION + "Process file.*UTCovTest.pas.*Total LOC:.*20.*Percentage Coverage: 95.*" + ENVIRONMENT COVFILE=) + function(add_config_tests cfg) set(base "${CMake_BINARY_DIR}/Tests/CTestConfig") @@ -2639,6 +2731,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(regex "${regex}([Cc]ould *n.t resolve host") set(regex "${regex}|[Cc]ould *n.t connect to host") set(regex "${regex}|Failed *t*o* connect to") + set(regex "${regex}|Connection timed out after [0-9]+ milliseconds") set(regex "${regex}|Empty reply from server") set(regex "${regex}|The requested URL returned error") set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)") diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index a9fe428..92e70c3 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -63,7 +63,7 @@ check_cmake_test(String # Execute each test listed in StringTestScript.cmake: # set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake") -set(number_of_tests_expected 69) +set(number_of_tests_expected 70) include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") execute_all_script_tests(${scriptname} number_of_tests_executed) @@ -75,6 +75,6 @@ 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) +if(NOT number_of_tests_executed EQUAL number_of_tests_expected) message(FATAL_ERROR "error: some test cases were skipped") endif() diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake index a562e71..44d5653 100644 --- a/Tests/CMakeTests/StringTestScript.cmake +++ b/Tests/CMakeTests/StringTestScript.cmake @@ -122,14 +122,17 @@ elseif(testname STREQUAL substring_not_enough_args) # fail elseif(testname STREQUAL substring_begin_too_large) # fail string(SUBSTRING "abcdefg" 25 100 v) -elseif(testname STREQUAL substring_end_too_large) # fail +elseif(testname STREQUAL substring_end_larger_than_strlen) # pass string(SUBSTRING "abcdefg" 1 100 v) elseif(testname STREQUAL substring_begin_less_than_zero) # fail - string(SUBSTRING "abcdefg" -2 4 v) + string(SUBSTRING "abcdefg" -1 4 v) -elseif(testname STREQUAL substring_end_less_than_begin) # fail - string(SUBSTRING "abcdefg" 6 3 v) +elseif(testname STREQUAL substring_end_less_than_zero) # pass + string(SUBSTRING "abcdefg" 0 -1 v) + +elseif(testname STREQUAL substring_end_less_than_begin) # pass + string(SUBSTRING "abcdefg" 6 0 v) elseif(testname STREQUAL length_not_enough_args) # fail string(LENGTH) diff --git a/Tests/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in index 9e31cb4..4e946ab 100644 --- a/Tests/CMakeTests/VersionTest.cmake.in +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -8,9 +8,85 @@ else() message("CMAKE_VERSION=[${CMAKE_VERSION}] is not less than [${min_ver}]") endif() -set(v 1.2.3.4.5.6.7) -if("${v}.8" VERSION_LESS "${v}.9") - message(STATUS "${v}.8 is less than ${v}.9") -else() - message(FATAL_ERROR "${v}.8 is not less than ${v}.9?") -endif() +set(EQUALV "1 1") +list(APPEND EQUALV "1.0 1") +list(APPEND EQUALV "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 1") +list(APPEND EQUALV "1.2.3.4.5.6.7 1.2.3.4.5.6.7") +list(APPEND EQUALV "1.2.3.4.5.6.7.8.9 1.2.3.4.5.6.7.8.9") + +foreach(v IN LISTS EQUALV) + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + # modify any of the operands to see the negative check also works + if("${CMAKE_MATCH_1}.2" VERSION_EQUAL CMAKE_MATCH_2) + message(FATAL_ERROR "${CMAKE_MATCH_1}.2 is equal ${CMAKE_MATCH_2}?") + else() + message(STATUS "${CMAKE_MATCH_1}.2 is not equal ${CMAKE_MATCH_2}") + endif() + + if(CMAKE_MATCH_1 VERSION_EQUAL "${CMAKE_MATCH_2}.2") + message(FATAL_ERROR "${CMAKE_MATCH_1} is equal ${CMAKE_MATCH_2}.2?") + else() + message(STATUS "${CMAKE_MATCH_1} is not equal ${CMAKE_MATCH_2}.2") + endif() +endforeach() + +# test the negative outcomes first, due to the implementation the positive +# allow some additional strings to pass that would not fail for the negative +# tests + +list(APPEND EQUALV "1a 1") +list(APPEND EQUALV "1.1a 1.1") +list(APPEND EQUALV "1.0a 1") +list(APPEND EQUALV "1a 1.0") + +foreach(v IN LISTS EQUALV) + # check equal versions + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + if(CMAKE_MATCH_1 VERSION_EQUAL CMAKE_MATCH_2) + message(STATUS "${CMAKE_MATCH_1} is equal ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_1} is not equal ${CMAKE_MATCH_2}?") + endif() + + # still equal, but inverted order of operands + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + if(CMAKE_MATCH_2 VERSION_EQUAL CMAKE_MATCH_1) + message(STATUS "${CMAKE_MATCH_2} is equal ${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_2} is not equal ${CMAKE_MATCH_1}?") + endif() +endforeach() + +set(LESSV "1.2.3.4.5.6.7.8 1.2.3.4.5.6.7.9") +list(APPEND LESSV "1.2.3.4.5.6.7 1.2.3.4.5.6.7.9") +list(APPEND LESSV "1 1.0.0.1") +foreach(v IN LISTS LESSV) + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + # check less + if(CMAKE_MATCH_1 VERSION_LESS CMAKE_MATCH_2) + message(STATUS "${CMAKE_MATCH_1} is less than ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_1} is not less than ${CMAKE_MATCH_2}?") + endif() + + # check greater + if(CMAKE_MATCH_2 VERSION_GREATER CMAKE_MATCH_1) + message(STATUS "${CMAKE_MATCH_2} is greater than ${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_2} is not greater than ${CMAKE_MATCH_1}?") + endif() + + # check less negative case + if(NOT CMAKE_MATCH_2 VERSION_LESS CMAKE_MATCH_1) + message(STATUS "${CMAKE_MATCH_2} is not less than ${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_2} is less than ${CMAKE_MATCH_1}?") + endif() + + # check greater negative case + if(NOT CMAKE_MATCH_1 VERSION_GREATER CMAKE_MATCH_2) + message(STATUS "${CMAKE_MATCH_1} is not greater than ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_1} is greater than ${CMAKE_MATCH_2}?") + endif() +endforeach() diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 450c204..8c01b32 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -8,6 +8,13 @@ endif() if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") + + # test package summary override + set(CPACK_RPM_PACKAGE_SUMMARY "default summary") + set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + + # test package description override + set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") endif() if(CPACK_GENERATOR MATCHES "DEB") @@ -20,4 +27,4 @@ endif() #set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE) #set(CPACK_COMPONENTS_GROUPING) set(CPACK_COMPONENTS_IGNORE_GROUPS 1) -#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
\ No newline at end of file +#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 0b6d07d..4d56218 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -123,3 +123,62 @@ if(expected_file_mask) message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") endif() endif() + +# Validate content +if(CPackGen MATCHES "RPM") + find_program(RPM_EXECUTABLE rpm) + if(NOT RPM_EXECUTABLE) + message(FATAL_ERROR "error: missing rpm executable required by the test") + endif() + + set(CPACK_RPM_PACKAGE_SUMMARY "default summary") + set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION + "An extremely useful application that makes use of MyLib") + set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C\\+\\+ header files for use with MyLib") + + if(${CPackComponentWay} STREQUAL "IgnoreGroup") + foreach(check_file ${expected_file}) + string(REGEX MATCH ".*libraries.*" check_file_libraries_match ${check_file}) + string(REGEX MATCH ".*headers.*" check_file_headers_match ${check_file}) + string(REGEX MATCH ".*applications.*" check_file_applications_match ${check_file}) + string(REGEX MATCH ".*Unspecified.*" check_file_Unspecified_match ${check_file}) + + execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${check_file} + OUTPUT_VARIABLE check_file_content + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(check_file_libraries_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") + elseif(check_file_headers_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") + elseif(check_file_applications_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") + elseif(check_file_Unspecified_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*DESCRIPTION.*") + else() + message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") + endif() + + string(REGEX MATCH ${check_file_match_expected_summary} check_file_match_summary ${check_file_content}) + + if(NOT check_file_match_summary) + message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'") + endif() + + string(REGEX MATCH ${check_file_match_expected_description} check_file_match_description ${check_file_content}) + + if(NOT check_file_match_description) + message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'") + endif() + endforeach() + elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") + endif() +endif() diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index d02ddaf..ff5d745 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -77,36 +77,60 @@ foreach(lang CXX C) endif() endforeach() -add_executable(CompileFeatures main.cpp) -set_property(TARGET CompileFeatures - PROPERTY COMPILE_FEATURES "cxx_auto_type" -) -set_property(TARGET CompileFeatures - PROPERTY CXX_STANDARD_REQUIRED TRUE -) +if (CMAKE_C_COMPILE_FEATURES) + string(FIND "${CMAKE_C_FLAGS}" "-std=" std_flag_idx) + if (std_flag_idx EQUAL -1) + add_executable(default_dialect_C default_dialect.c) + target_compile_definitions(default_dialect_C PRIVATE + DEFAULT_C11=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},11> + DEFAULT_C99=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},99> + DEFAULT_C90=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},90> + ) + endif() +endif() + +if (CMAKE_CXX_COMPILE_FEATURES) + string(FIND "${CMAKE_CXX_FLAGS}" "-std=" std_flag_idx) + if (std_flag_idx EQUAL -1) + add_executable(default_dialect default_dialect.cpp) + target_compile_definitions(default_dialect PRIVATE + DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14> + DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11> + DEFAULT_CXX98=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},98> + ) + endif() -add_executable(GenexCompileFeatures main.cpp) -set_property(TARGET GenexCompileFeatures - PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>" -) + add_executable(CompileFeatures main.cpp) + set_property(TARGET CompileFeatures + PROPERTY COMPILE_FEATURES "cxx_auto_type" + ) + set_property(TARGET CompileFeatures + PROPERTY CXX_STANDARD_REQUIRED TRUE + ) + + add_executable(GenexCompileFeatures main.cpp) + set_property(TARGET GenexCompileFeatures + PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>" + ) -add_library(iface INTERFACE) -set_property(TARGET iface - PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type" -) -add_executable(IfaceCompileFeatures main.cpp) -target_link_libraries(IfaceCompileFeatures iface) + add_library(iface INTERFACE) + set_property(TARGET iface + PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type" + ) + add_executable(IfaceCompileFeatures main.cpp) + target_link_libraries(IfaceCompileFeatures iface) -add_executable(CompileFeaturesGenex genex_test.cpp) -set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) -target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_executable(CompileFeaturesGenex genex_test.cpp) + set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) + target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) -add_executable(CompileFeaturesGenex2 genex_test.cpp) -target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr) -target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_executable(CompileFeaturesGenex2 genex_test.cpp) + target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr) + target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) -add_library(noexcept_iface INTERFACE) -target_compile_features(noexcept_iface INTERFACE cxx_noexcept) -add_executable(CompileFeaturesGenex3 genex_test.cpp) -target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface) -target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_library(noexcept_iface INTERFACE) + target_compile_features(noexcept_iface INTERFACE cxx_noexcept) + add_executable(CompileFeaturesGenex3 genex_test.cpp) + target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface) + target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) +endif() diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c new file mode 100644 index 0000000..1b39dec --- /dev/null +++ b/Tests/CompileFeatures/default_dialect.c @@ -0,0 +1,22 @@ + +#if DEFAULT_C11 +# if __STDC_VERSION__ != 201112L +# error Unexpected value for __STDC_VERSION__. +# endif +#elif DEFAULT_C99 +# if __STDC_VERSION__ != 199901L +# error Unexpected value for __STDC_VERSION__. +# endif +#else +# if !DEFAULT_C90 +# error Buildsystem error +# endif +# if defined(__STDC_VERSION__) +# error Unexpected __STDC_VERSION__ definition +# endif +#endif + +int main() +{ + return 0; +} diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp new file mode 100644 index 0000000..8d97926 --- /dev/null +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -0,0 +1,25 @@ + +template<long l> +struct Outputter; + +#if DEFAULT_CXX14 +# if __cplusplus != 201402L +Outputter<__cplusplus> o; +# endif +#elif DEFAULT_CXX11 +# if __cplusplus != 201103L +Outputter<__cplusplus> o; +# endif +#else +# if !DEFAULT_CXX98 +# error Buildsystem error +# endif +# if __cplusplus != 199711L +Outputter<__cplusplus> o; +# endif +#endif + +int main() +{ + return 0; +} diff --git a/Tests/CompileFeatures/main.c b/Tests/CompileFeatures/main.c deleted file mode 100644 index 831c5eb2..0000000 --- a/Tests/CompileFeatures/main.c +++ /dev/null @@ -1,12 +0,0 @@ - -int foo(int * restrict a, int * restrict b) -{ - (void)a; - (void)b; - return 0; -} - -int main() -{ - return 0; -} diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index b97cd16..915da0a 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -117,6 +117,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1pre.txt to doc2post.txt." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1pre.txt ${PROJECT_BINARY_DIR}/doc2post.txt + BYPRODUCTS ${PROJECT_BINARY_DIR}/doc2post.txt COMMENT "Running TDocument post-build commands" ) @@ -483,3 +484,26 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}") add_library(NormDepends "${gen_file}") + +# Test that USES_TERMINAL is parsed correctly. +# It seems much more difficult to test that USES_TERMINAL actually gives +# the subprocess console access, as test output is piped through CTest, +# and CTest itself might not be connected to the console. + +set(gen_file "${gen_path}/bar2.cxx") + +add_custom_command( + OUTPUT "${gen_file}" + DEPENDS "${gen_path}" + COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}" + VERBATIM + USES_TERMINAL +) + +add_library(UseConsole "${gen_file}") + +add_custom_target(UseConsoleTarget ALL + COMMAND ${CMAKE_COMMAND} -E echo "Custom console target." + VERBATIM + USES_TERMINAL +) diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt new file mode 100644 index 0000000..884f8c2 --- /dev/null +++ b/Tests/CustomCommandByproducts/CMakeLists.txt @@ -0,0 +1,127 @@ +cmake_minimum_required(VERSION 3.1) +project(CustomCommandByproducts C) + +# Generate a byproduct in a rule that runs in the target consuming it. +add_custom_command( + OUTPUT timestamp1.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct1.c.in byproduct1.c + BYPRODUCTS byproduct1.c + COMMAND ${CMAKE_COMMAND} -E touch timestamp1.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/byproduct1.c.in + ) + +# Generate a byproduct in a rule that runs in a dependency of the consumer. +add_custom_command( + OUTPUT timestamp2.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct2.c.in byproduct2.c + BYPRODUCTS byproduct2.c + COMMAND ${CMAKE_COMMAND} -E touch timestamp2.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/byproduct2.c.in + ) +add_custom_target(Producer2 DEPENDS timestamp2.txt) + +# Generate a byproduct in a custom target. +add_custom_target(Producer3_4 + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct3.c.in byproduct3.c + BYPRODUCTS byproduct3.c + ) + +# Generate a byproduct in a custom target POST_BUILD command. +add_custom_command( + TARGET Producer3_4 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct4.c.in byproduct4.c + BYPRODUCTS byproduct4.c + ) + +add_executable(ProducerExe ProducerExe.c) + +# Generate a byproduct in an executable POST_BUILD command. +add_custom_command( + TARGET ProducerExe POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct5.c.in byproduct5.c + BYPRODUCTS byproduct5.c + ) + +# Generate a byproduct in an executable PRE_LINK command. +add_custom_command( + TARGET ProducerExe PRE_LINK + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct6.c.in byproduct6.c + BYPRODUCTS byproduct6.c + ) + +# Generate a byproduct in an executable PRE_BUILD command. +add_custom_command( + TARGET ProducerExe PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct7.c.in byproduct7.c + BYPRODUCTS byproduct7.c + ) + +# Generate a byproduct in a custom command that consumes other byproducts. +add_custom_command(OUTPUT timestamp8.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct8.c.in byproduct8.c + COMMAND ${CMAKE_COMMAND} -E touch timestamp8.txt + BYPRODUCTS byproduct8.c + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/byproduct2.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct3.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct4.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct5.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct6.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct7.c + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct8.c.in + ) + +# Generate the library file of an imported target as a byproduct +# of an external project. +if(CMAKE_CONFIGURATION_TYPES) + set(cfg /${CMAKE_CFG_INTDIR}) +else() + set(cfg) +endif() +set(ExternalLibrary_LIBRARY + ${CMAKE_CURRENT_BINARY_DIR}/External-build${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX} + ) +include(ExternalProject) +ExternalProject_Add(ExternalTarget + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/External-build" + PREFIX "${CMAKE_CURRENT_BINARY_DIR}/External-build/root" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" + BUILD_BYPRODUCTS "${ExternalLibrary_LIBRARY}" + ) +add_library(ExternalLibrary STATIC IMPORTED) +set_property(TARGET ExternalLibrary PROPERTY IMPORTED_LOCATION ${ExternalLibrary_LIBRARY}) +add_dependencies(ExternalLibrary ExternalTarget) + +# Add an executable consuming all the byproducts. +add_executable(CustomCommandByproducts + CustomCommandByproducts.c + byproduct1.c timestamp1.txt + byproduct2.c + byproduct3.c + byproduct4.c + byproduct5.c + byproduct6.c + byproduct7.c + byproduct8.c timestamp8.txt + ) +add_dependencies(CustomCommandByproducts Producer2) +add_dependencies(CustomCommandByproducts Producer3_4) +add_dependencies(CustomCommandByproducts ProducerExe) +target_link_libraries(CustomCommandByproducts ExternalLibrary) + +if(CMAKE_GENERATOR STREQUAL "Ninja") + add_custom_target(CheckNinja ALL + COMMENT "Checking build.ninja" + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/ninja-check.cmake + ) +endif() diff --git a/Tests/CustomCommandByproducts/CustomCommandByproducts.c b/Tests/CustomCommandByproducts/CustomCommandByproducts.c new file mode 100644 index 0000000..1916427 --- /dev/null +++ b/Tests/CustomCommandByproducts/CustomCommandByproducts.c @@ -0,0 +1,23 @@ +extern int byproduct1(void); +extern int byproduct2(void); +extern int byproduct3(void); +extern int byproduct4(void); +extern int byproduct5(void); +extern int byproduct6(void); +extern int byproduct7(void); +extern int byproduct8(void); +extern int ExternalLibrary(void); +int main(void) +{ + return ( + byproduct1() + + byproduct2() + + byproduct3() + + byproduct4() + + byproduct5() + + byproduct6() + + byproduct7() + + byproduct8() + + ExternalLibrary() + + 0); +} diff --git a/Tests/CustomCommandByproducts/External/CMakeLists.txt b/Tests/CustomCommandByproducts/External/CMakeLists.txt new file mode 100644 index 0000000..feaa12e --- /dev/null +++ b/Tests/CustomCommandByproducts/External/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(External C) + +add_library(ExternalLibrary STATIC ExternalLibrary.c) diff --git a/Tests/CustomCommandByproducts/External/ExternalLibrary.c b/Tests/CustomCommandByproducts/External/ExternalLibrary.c new file mode 100644 index 0000000..a1dacf0 --- /dev/null +++ b/Tests/CustomCommandByproducts/External/ExternalLibrary.c @@ -0,0 +1 @@ +int ExternalLibrary(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/ProducerExe.c b/Tests/CustomCommandByproducts/ProducerExe.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/CustomCommandByproducts/ProducerExe.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct1.c.in b/Tests/CustomCommandByproducts/byproduct1.c.in new file mode 100644 index 0000000..5c3cc24 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct1.c.in @@ -0,0 +1 @@ +int byproduct1(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct2.c.in b/Tests/CustomCommandByproducts/byproduct2.c.in new file mode 100644 index 0000000..eeb69ef --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct2.c.in @@ -0,0 +1 @@ +int byproduct2(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct3.c.in b/Tests/CustomCommandByproducts/byproduct3.c.in new file mode 100644 index 0000000..7d15310 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct3.c.in @@ -0,0 +1 @@ +int byproduct3(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct4.c.in b/Tests/CustomCommandByproducts/byproduct4.c.in new file mode 100644 index 0000000..8b243dd --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct4.c.in @@ -0,0 +1 @@ +int byproduct4(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct5.c.in b/Tests/CustomCommandByproducts/byproduct5.c.in new file mode 100644 index 0000000..47f5990 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct5.c.in @@ -0,0 +1 @@ +int byproduct5(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct6.c.in b/Tests/CustomCommandByproducts/byproduct6.c.in new file mode 100644 index 0000000..d70c14f --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct6.c.in @@ -0,0 +1 @@ +int byproduct6(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct7.c.in b/Tests/CustomCommandByproducts/byproduct7.c.in new file mode 100644 index 0000000..0be5006 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct7.c.in @@ -0,0 +1 @@ +int byproduct7(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct8.c.in b/Tests/CustomCommandByproducts/byproduct8.c.in new file mode 100644 index 0000000..abefd62 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct8.c.in @@ -0,0 +1 @@ +int byproduct8(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/ninja-check.cmake b/Tests/CustomCommandByproducts/ninja-check.cmake new file mode 100644 index 0000000..2fc3cc2 --- /dev/null +++ b/Tests/CustomCommandByproducts/ninja-check.cmake @@ -0,0 +1,20 @@ +file(READ build.ninja build_ninja) +if("${build_ninja}" MATCHES [====[ +# Unknown Build Time Dependencies. +# Tell Ninja that they may appear as side effects of build rules +# otherwise ordered by order-only dependencies. + +((build [^:]*: phony [^\n]* +)*)# ========]====]) + set(phony "${CMAKE_MATCH_1}") + if(NOT phony) + message(STATUS "build.ninja correctly does not have extra phony rules") + else() + string(REGEX REPLACE "\n+$" "" phony "${phony}") + string(REGEX REPLACE "\n" "\n " phony " ${phony}") + message(FATAL_ERROR "build.ninja incorrectly has extra phony rules:\n" + "${phony}") + endif() +else() + message(FATAL_ERROR "build.ninja is incorrectly missing expected block") +endif() diff --git a/Tests/DelphiCoverage/DartConfiguration.tcl.in b/Tests/DelphiCoverage/DartConfiguration.tcl.in new file mode 100644 index 0000000..4edcea6 --- /dev/null +++ b/Tests/DelphiCoverage/DartConfiguration.tcl.in @@ -0,0 +1,8 @@ +# This file is configured by CMake automatically as DartConfiguration.tcl +# If you choose not to use CMake, this file may be hand configured, by +# filling in the required variables. + + +# Configuration directories and files +SourceDirectory: ${CMake_BINARY_DIR}/Testing/DelphiCoverage +BuildDirectory: ${CMake_BINARY_DIR}/Testing/DelphiCoverage diff --git a/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html b/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html new file mode 100644 index 0000000..9caaea3 --- /dev/null +++ b/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html @@ -0,0 +1,117 @@ +<!DOCTYPE html> +<html> +<head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Delphi CodeCoverage Coverage Report</title> +<style type="text/css"> +table {border-spacing:0; border-collapse:collapse;} +table, td, th {border: 1px solid black;} +td, th {background: white; margin: 0; padding: 2px 0.5em 2px 0.5em} +td {border-width: 0 1px 0 0;} +th {border-width: 1px 1px 1px 0;} +p, h1, h2, h3, th {font-family: verdana,arial,sans-serif; font-size: 10pt;} +td {font-family: courier,monospace; font-size: 10pt;} +th {background: #CCCCCC;} +table.o tr td:nth-child(1) {font-weight: bold;} +table.o tr td:nth-child(2) {text-align: right;} +table.o tr td {border-width: 1px;} +table.s {width: 100%;} +table.s tr td {padding: 0 0.25em 0 0.25em;} +table.s tr td:first-child {text-align: right; font-weight: bold;} +table.s tr.notcovered td {background: #DDDDFF;} +table.s tr.nocodegen td {background: #FFFFEE;} +table.s tr.covered td {background: #CCFFCC;} +table.s tr.covered td:first-child {color: green;} +table.s {border-width: 1px 0 1px 1px;} +table.sum tr td {border-width: 1px;} +table.sum tr th {text-align:right;} +table.sum tr th:first-child {text-align:center;} +table.sum tr td {text-align:right;} +table.sum tr td:first-child {text-align:left;} +</style> +</head> +<body> +<p>Coverage report for <strong>UTCovTest (C:\Users\joe.snyder\Work\OSEHRA\VistA\Packages\Order Entry Results Reporting\CPRS\Testing\Tests\UTCovTest.pas)</strong>.</p> +<p> Generated at 10/3/2014 12:24:11 PM by <a href="http://code.google.com/p/delphi-code-coverage/" title="Code Coverage for Delphi 5+">DelphiCodeCoverage</a> - an open source tool for Delphi Code Coverage.</p> +<p> Statistics for C:\Users\joe.snyder\Work\OSEHRA\VistA\Packages\Order Entry Results Reporting\CPRS\Testing\Tests\UTCovTest.pas </p> +<table class="o"><tr><td>Number of lines covered</td><td>19</td></tr><tr><td>Number of lines with code gen</td><td>19</td></tr><tr><td>Line coverage</td><td>100%</td></tr></table> +<br /><br /> +<table class="s"> +<tr class="nocodegen"><td>1</td><td><pre style="display:inline;">//---------------------------------------------------------------------------</pre></td></tr> +<tr class="nocodegen"><td>2</td><td><pre style="display:inline;">// Copyright 2012 The Open Source Electronic Health Record Agent</pre></td></tr> +<tr class="nocodegen"><td>3</td><td><pre style="display:inline;">//</pre></td></tr> +<tr class="nocodegen"><td>4</td><td><pre style="display:inline;">// Licensed under the Apache License, Version 2.0 (the "License");</pre></td></tr> +<tr class="nocodegen"><td>5</td><td><pre style="display:inline;">// you may not use this file except in compliance with the License.</pre></td></tr> +<tr class="nocodegen"><td>6</td><td><pre style="display:inline;">// You may obtain a copy of the License at</pre></td></tr> +<tr class="nocodegen"><td>7</td><td><pre style="display:inline;">//</pre></td></tr> +<tr class="nocodegen"><td>8</td><td><pre style="display:inline;">// http://www.apache.org/licenses/LICENSE-2.0</pre></td></tr> +<tr class="nocodegen"><td>9</td><td><pre style="display:inline;">//</pre></td></tr> +<tr class="nocodegen"><td>10</td><td><pre style="display:inline;">// Unless required by applicable law or agreed to in writing, software</pre></td></tr> +<tr class="nocodegen"><td>11</td><td><pre style="display:inline;">// distributed under the License is distributed on an "AS IS" BASIS,</pre></td></tr> +<tr class="nocodegen"><td>12</td><td><pre style="display:inline;">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</pre></td></tr> +<tr class="nocodegen"><td>13</td><td><pre style="display:inline;">// See the License for the specific language governing permissions and</pre></td></tr> +<tr class="nocodegen"><td>14</td><td><pre style="display:inline;">// limitations under the License.</pre></td></tr> +<tr class="nocodegen"><td>15</td><td><pre style="display:inline;">//---------------------------------------------------------------------------</pre></td></tr> +<tr class="nocodegen"><td>16</td><td><pre style="display:inline;">unit UTCovTest;</pre></td></tr> +<tr class="nocodegen"><td>17</td><td><pre style="display:inline;">interface</pre></td></tr> +<tr class="nocodegen"><td>18</td><td><pre style="display:inline;">uses UnitTest, TestFrameWork,SysUtils,Windows;</pre></td></tr> +<tr class="nocodegen"><td>19</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>20</td><td><pre style="display:inline;">implementation</pre></td></tr> +<tr class="nocodegen"><td>21</td><td><pre style="display:inline;">type</pre></td></tr> +<tr class="nocodegen"><td>22</td><td><pre style="display:inline;">UTCovTestTests=class(TTestCase)</pre></td></tr> +<tr class="nocodegen"><td>23</td><td><pre style="display:inline;"> public</pre></td></tr> +<tr class="nocodegen"><td>24</td><td><pre style="display:inline;"> procedure SetUp; override;</pre></td></tr> +<tr class="nocodegen"><td>25</td><td><pre style="display:inline;"> procedure TearDown; override;</pre></td></tr> +<tr class="nocodegen"><td>26</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>27</td><td><pre style="display:inline;"> published</pre></td></tr> +<tr class="nocodegen"><td>28</td><td><pre style="display:inline;"> procedure TestCov1;</pre></td></tr> +<tr class="nocodegen"><td>29</td><td><pre style="display:inline;"> procedure TestCov2;</pre></td></tr> +<tr class="nocodegen"><td>30</td><td><pre style="display:inline;"> procedure TestCov3;</pre></td></tr> +<tr class="nocodegen"><td>31</td><td><pre style="display:inline;"> end;</pre></td></tr> +<tr class="nocodegen"><td>32</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>33</td><td><pre style="display:inline;">procedure NotRun;</pre></td></tr> +<tr class="nocodegen"><td>34</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="nocodegen"><td>35</td><td><pre style="display:inline;"> WriteLn('This line will never run');</pre></td></tr> +<tr class="nocodegen"><td>36</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>37</td><td><pre style="display:inline;">procedure UTCovTestTests.SetUp;</pre></td></tr> +<tr class="nocodegen"><td>38</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>39</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>40</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>41</td><td><pre style="display:inline;">procedure UTCovTestTests.TearDown;</pre></td></tr> +<tr class="nocodegen"><td>42</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>43</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>44</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>45</td><td><pre style="display:inline;">procedure UTCovTestTests.TestCov1;</pre></td></tr> +<tr class="covered"><td>46</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="nocodegen"><td>47</td><td><pre style="display:inline;"> {</pre></td></tr> +<tr class="nocodegen"><td>48</td><td><pre style="display:inline;"> Block comment lines</pre></td></tr> +<tr class="nocodegen"><td>49</td><td><pre style="display:inline;"> }</pre></td></tr> +<tr class="covered"><td>50</td><td><pre style="display:inline;"> CheckEquals(1,2-1);</pre></td></tr> +<tr class="covered"><td>51</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>52</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>53</td><td><pre style="display:inline;">procedure UTCovTestTests.TestCov2;</pre></td></tr> +<tr class="nocodegen"><td>54</td><td><pre style="display:inline;">var</pre></td></tr> +<tr class="nocodegen"><td>55</td><td><pre style="display:inline;"> i:DWORD;</pre></td></tr> +<tr class="covered"><td>56</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>57</td><td><pre style="display:inline;"> for i := 0 to 1 do</pre></td></tr> +<tr class="covered"><td>58</td><td><pre style="display:inline;"> WriteLn( IntToStr(i));</pre></td></tr> +<tr class="nocodegen"><td>59</td><td><pre style="display:inline;"> // Comment</pre></td></tr> +<tr class="covered"><td>60</td><td><pre style="display:inline;"> CheckEquals(i,2);</pre></td></tr> +<tr class="covered"><td>61</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>62</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>63</td><td><pre style="display:inline;">procedure UTCovTestTests.TestCov3;</pre></td></tr> +<tr class="nocodegen"><td>64</td><td><pre style="display:inline;">var</pre></td></tr> +<tr class="nocodegen"><td>65</td><td><pre style="display:inline;"> i : DWORD;</pre></td></tr> +<tr class="covered"><td>66</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>67</td><td><pre style="display:inline;"> i := 0;</pre></td></tr> +<tr class="covered"><td>68</td><td><pre style="display:inline;"> while i < 5 do</pre></td></tr> +<tr class="covered"><td>69</td><td><pre style="display:inline;"> i := i+1;</pre></td></tr> +<tr class="covered"><td>70</td><td><pre style="display:inline;"> CheckEquals(i,5);</pre></td></tr> +<tr class="covered"><td>71</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>72</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="covered"><td>73</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>74</td><td><pre style="display:inline;"> UnitTest.addSuite(UTCovTestTests.Suite);</pre></td></tr> +<tr class="covered"><td>75</td><td><pre style="display:inline;">end.</pre></td></tr> +</table> +</body> +</html> diff --git a/Tests/DelphiCoverage/src/UTCovTest.pas b/Tests/DelphiCoverage/src/UTCovTest.pas new file mode 100644 index 0000000..66db3c0 --- /dev/null +++ b/Tests/DelphiCoverage/src/UTCovTest.pas @@ -0,0 +1,75 @@ +//--------------------------------------------------------------------------- +// Copyright 2012 The Open Source Electronic Health Record Agent +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +unit UTCovTest; +interface +uses UnitTest, TestFrameWork,SysUtils,Windows; + +implementation +type +UTCovTestTests=class(TTestCase) + public + procedure SetUp; override; + procedure TearDown; override; + + published + procedure TestCov1; + procedure TestCov2; + procedure TestCov3; + end; + +procedure NotRun; +begin + WriteLn('This line will never run'); +end; +procedure UTCovTestTests.SetUp; +begin +end; + +procedure UTCovTestTests.TearDown; +begin +end; + +procedure UTCovTestTests.TestCov1; +begin + { + Block comment lines + } + CheckEquals(1,2-1); +end; + +procedure UTCovTestTests.TestCov2; +var + i:DWORD; +begin + for i := 0 to 1 do + WriteLn( IntToStr(i)); + // Comment + CheckEquals(i,2); +end; + +procedure UTCovTestTests.TestCov3; +var + i : DWORD; +begin + i := 0; + while i < 5 do + i := i+1; + CheckEquals(i,5); +end; + +begin + UnitTest.addSuite(UTCovTestTests.Suite); +end.
\ No newline at end of file diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index f942197..cbbb555 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -66,6 +66,7 @@ if(can_build_tutorial_step5) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF TEST_AFTER_INSTALL 1 LOG_TEST 1 ) diff --git a/Tests/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt index c33e90b..fbb3388 100644 --- a/Tests/ExternalProjectUpdate/CMakeLists.txt +++ b/Tests/ExternalProjectUpdate/CMakeLists.txt @@ -19,6 +19,7 @@ set(base "${CMAKE_BINARY_DIR}/CMakeExternals") set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) +set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS update) set(do_git_tests 0) @@ -68,8 +69,20 @@ if(do_git_tests) CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> INSTALL_COMMAND "" - DEPENDS "SetupLocalGITRepository" ) + ExternalProject_Add_StepDependencies(${proj} download SetupLocalGITRepository) + set_property(TARGET ${proj} PROPERTY FOLDER "GIT") + + set(proj TutorialStep2-GIT) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_TAG ${TEST_GIT_TAG} + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + UPDATE_DISCONNECTED 1 + ) + ExternalProject_Add_StepDependencies(${proj} download SetupLocalGITRepository) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") endif() diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake index 6c7bcfe..7065f36 100644 --- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -59,6 +59,102 @@ was expected." if( EXISTS ${FETCH_HEAD_file} AND NOT ${fetch_expected}) message( FATAL_ERROR "Fetch DID occur when it was not expected.") endif() + + message( STATUS "Checking ExternalProjectUpdate to tag: ${desired_tag} (disconnected)" ) + + # Remove the FETCH_HEAD file, so we can check if it gets replaced with a 'git + # fetch'. + set( FETCH_HEAD_file ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep2-GIT/.git/FETCH_HEAD ) + file( REMOVE ${FETCH_HEAD_file} ) + + # Check initial SHA + execute_process(COMMAND ${GIT_EXECUTABLE} + rev-list --max-count=1 HEAD + WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep2-GIT + RESULT_VARIABLE error_code + OUTPUT_VARIABLE initial_sha + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # Configure + execute_process(COMMAND ${CMAKE_COMMAND} + -G ${CMAKE_GENERATOR} -T "${CMAKE_GENERATOR_TOOLSET}" + -A "${CMAKE_GENERATOR_PLATFORM}" + -DTEST_GIT_TAG:STRING=${desired_tag} + ${ExternalProjectUpdate_SOURCE_DIR} + WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR} + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR "Could not configure the project.") + endif() + + # Build + execute_process(COMMAND ${CMAKE_COMMAND} + --build ${ExternalProjectUpdate_BINARY_DIR} + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR "Could not build the project.") + endif() + + if( EXISTS ${FETCH_HEAD_file} ) + message( FATAL_ERROR "Fetch occured when it was not expected.") + endif() + + # Check the resulting SHA + execute_process(COMMAND ${GIT_EXECUTABLE} + rev-list --max-count=1 HEAD + WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep2-GIT + RESULT_VARIABLE error_code + OUTPUT_VARIABLE tag_sha + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(error_code) + message(FATAL_ERROR "Could not check the sha.") + endif() + + if(NOT (${tag_sha} STREQUAL ${initial_sha})) + message(FATAL_ERROR "Update occurred when it was not expected.") + endif() + + # Update + execute_process(COMMAND ${CMAKE_COMMAND} + --build ${ExternalProjectUpdate_BINARY_DIR} + --target TutorialStep2-GIT-update + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR "Could not build the project.") + endif() + + # Check the resulting SHA + execute_process(COMMAND ${GIT_EXECUTABLE} + rev-list --max-count=1 HEAD + WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep2-GIT + RESULT_VARIABLE error_code + OUTPUT_VARIABLE tag_sha + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(error_code) + message(FATAL_ERROR "Could not check the sha.") + endif() + + if(NOT (${tag_sha} STREQUAL ${resulting_sha})) + message(FATAL_ERROR "UPDATE_COMMAND produced + ${tag_sha} +when + ${resulting_sha} +was expected." + ) + endif() + + if( NOT EXISTS ${FETCH_HEAD_file} AND ${fetch_expected}) + message( FATAL_ERROR "Fetch did NOT occur when it was expected.") + endif() + if( EXISTS ${FETCH_HEAD_file} AND NOT ${fetch_expected}) + message( FATAL_ERROR "Fetch DID occur when it was not expected.") + endif() endmacro() find_package(Git) diff --git a/Tests/ForceInclude/CMakeLists.txt b/Tests/ForceInclude/CMakeLists.txt index 5c02ebb..e231054 100644 --- a/Tests/ForceInclude/CMakeLists.txt +++ b/Tests/ForceInclude/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3.20110103) project(ForceInclude C) # Make sure the proper compiler is in use. -if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") message(FATAL_ERROR "The ForceInclude test works only with MSVC or Intel") endif() diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 1982a60..8700c94 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -13,11 +13,11 @@ message("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}") message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}") set(_SHARED SHARED) -if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(XL|VisualAge)$") +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(XL|VisualAge)$") # We do not implement SHARED Fortran libs on AIX yet! # Workaround: Set LINKER_LANGUAGE to C, which uses 'xlc' and Fortran implicits. set(_SHARED STATIC) -elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") +elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") # g77 2.96 does not support shared libs on Itanium because g2c is not -fPIC execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version OUTPUT_VARIABLE output ERROR_VARIABLE output) @@ -29,10 +29,10 @@ endif() # Pick a module .def file with the properly mangled symbol name. set(world_def "") if(WIN32 AND NOT CYGWIN) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(world_def world_gnu.def) - elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel" OR - "${CMAKE_GENERATOR}" MATCHES "Visual Studio") # Intel plugin + elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR + CMAKE_GENERATOR MATCHES "Visual Studio") # Intel plugin set(world_def world_icl.def) endif() endif() @@ -119,7 +119,7 @@ endfunction() # call the test_fortran_c_interface_module function if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES "(Intel:MSVC|Absoft:GNU)" - OR ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" )) + OR (CMAKE_Fortran_COMPILER_ID MATCHES CMAKE_C_COMPILER_ID )) test_fortran_c_interface_module() else() message("Fortran does not match c compiler") @@ -128,7 +128,7 @@ else() # hack to make g77 work after CL has been enabled # as a languge, cmake needs language specific versions # of these variables.... - if(WIN32 AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(WIN32 AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_CREATE_CONSOLE_EXE ) set(CMAKE_LIBRARY_PATH_FLAG "-L") set(CMAKE_LINK_LIBRARY_FLAG "-l") @@ -137,8 +137,8 @@ else() # gnu and sunpro do not use the same flags here... # however if LDFLAGS is used to set -m64 it causes odd stuf # with the fortran build - if( ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") - AND ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "SunPro")) + if( (CMAKE_C_COMPILER_ID MATCHES "GNU") + AND (CMAKE_Fortran_COMPILER_ID MATCHES "SunPro")) set(CMAKE_EXE_LINKER_FLAGS "") set(CMAKE_Fortran_FLAGS "") endif() diff --git a/Tests/FortranC/CMakeLists.txt b/Tests/FortranC/CMakeLists.txt index f335583..79c670d 100644 --- a/Tests/FortranC/CMakeLists.txt +++ b/Tests/FortranC/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) project(FortranC C Fortran) # Skip this test for compilers not known to be compatible. -if(NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "${CMAKE_Fortran_COMPILER_ID}" OR +if(NOT (CMAKE_C_COMPILER_ID STREQUAL CMAKE_Fortran_COMPILER_ID OR "${CMAKE_C_COMPILER_ID}-${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(MSVC-Intel)$")) message(STATUS "${CMAKE_C_COMPILER_ID} C and ${CMAKE_Fortran_COMPILER_ID} Fortran not known to be compatible!") return() diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index f55e727..1b2651d 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -66,3 +66,29 @@ if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL) "${err}") endif() endif() + +# Test generation of preprocessed sources. +if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) + if(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) + # Skip running this part of the test on certain platforms + # until they are fixed. + set(MAYBE_ALL ALL) + list(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT) + if(ARCH_COUNT GREATER 1) + # OSX does not support preprocessing more than one architecture. + set(MAYBE_ALL) + endif() + + add_executable(preprocess preprocess.F) + + # Custom target to try preprocessing invocation. + add_custom_target(test_preprocess ${MAYBE_ALL} + COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/preprocess.dir/preprocess.F.i + COMMAND ${CMAKE_MAKE_PROGRAM} preprocess.i + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake + # Remove bogus file some compilers leave behind. + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_SOURCE_DIR}/preprocess.s + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + endif() +endif() diff --git a/Tests/FortranOnly/preprocess.F b/Tests/FortranOnly/preprocess.F new file mode 100644 index 0000000..f7df457 --- /dev/null +++ b/Tests/FortranOnly/preprocess.F @@ -0,0 +1,5 @@ + PROGRAM PREPRO +#ifndef TEST_PREPROCESSOR + PRINT *, 'Hello' +#endif + END diff --git a/Tests/FortranOnly/test_preprocess.cmake b/Tests/FortranOnly/test_preprocess.cmake new file mode 100644 index 0000000..29ebdac --- /dev/null +++ b/Tests/FortranOnly/test_preprocess.cmake @@ -0,0 +1,7 @@ +set(TEST_FILE CMakeFiles/preprocess.dir/preprocess.F.i) +file(READ ${TEST_FILE} CONTENTS) +if("${CONTENTS}" MATCHES "PRINT *") + message(STATUS "${TEST_FILE} created successfully!") +else() + message(FATAL_ERROR "${TEST_FILE} creation failed!") +endif() diff --git a/Tests/JavascriptCoverage/DartConfiguration.tcl.in b/Tests/JavascriptCoverage/DartConfiguration.tcl.in new file mode 100644 index 0000000..f94d988 --- /dev/null +++ b/Tests/JavascriptCoverage/DartConfiguration.tcl.in @@ -0,0 +1,8 @@ +# This file is configured by CMake automatically as DartConfiguration.tcl +# If you choose not to use CMake, this file may be hand configured, by +# filling in the required variables. + + +# Configuration directories and files +SourceDirectory: ${CMake_BINARY_DIR}/Testing/JavascriptCoverage +BuildDirectory: ${CMake_BINARY_DIR}/Testing/JavascriptCoverage diff --git a/Tests/JavascriptCoverage/output.json.in b/Tests/JavascriptCoverage/output.json.in new file mode 100644 index 0000000..717cffe --- /dev/null +++ b/Tests/JavascriptCoverage/output.json.in @@ -0,0 +1,448 @@ +{ + "instrumentation": "node-jscoverage", + "sloc": 29, + "hits": 28, + "misses": 1, + "coverage": 96.55172413793103, + "files": [ + { + "filename": "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/test.js", + "coverage": 96.55172413793103, + "hits": 28, + "misses": 1, + "sloc": 29, + "source": { + "1": { + "source": "var assert = require(\"assert\")", + "coverage": 1 + }, + "2": { + "source": "var test = {", + "coverage": 1 + }, + "3": { + "source": " version: \"1.0.0\"", + "coverage": "" + }, + "4": { + "source": "}", + "coverage": "" + }, + "5": { + "source": "function covTest(p1,p2) {", + "coverage": 1 + }, + "6": { + "source": " if (p1 > 3) {", + "coverage": 2 + }, + "7": { + "source": " return 1;", + "coverage": 1 + }, + "8": { + "source": " }", + "coverage": "" + }, + "9": { + "source": " else {", + "coverage": "" + }, + "10": { + "source": " return p1 + p2;", + "coverage": 1 + }, + "11": { + "source": " }", + "coverage": "" + }, + "12": { + "source": "}", + "coverage": "" + }, + "13": { + "source": "", + "coverage": "" + }, + "14": { + "source": "function covTest2(p1,p2) {", + "coverage": 1 + }, + "15": { + "source": " return 0;", + "coverage": 0 + }, + "16": { + "source": "}", + "coverage": "" + }, + "17": { + "source": "", + "coverage": "" + }, + "18": { + "source": "function covTest3(p1) {", + "coverage": 1 + }, + "19": { + "source": " for(i=0;i < p1;i++){", + "coverage": 1 + }, + "20": { + "source": " }", + "coverage": "" + }, + "21": { + "source": " return i;", + "coverage": 1 + }, + "22": { + "source": "}", + "coverage": "" + }, + "23": { + "source": "function covTest4(p1) {", + "coverage": 1 + }, + "24": { + "source": " i=0;", + "coverage": 1 + }, + "25": { + "source": " while(i < p1){", + "coverage": 1 + }, + "26": { + "source": " i++;", + "coverage": 5 + }, + "27": { + "source": " }", + "coverage": "" + }, + "28": { + "source": " return i;", + "coverage": 1 + }, + "29": { + "source": "}", + "coverage": "" + }, + "30": { + "source": "", + "coverage": "" + }, + "31": { + "source": "describe('Array', function(){", + "coverage": 1 + }, + "32": { + "source": " describe('CovTest', function(){", + "coverage": 1 + }, + "33": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "34": { + "source": " assert.equal(4,covTest(2,2));", + "coverage": 1 + }, + "35": { + "source": " })", + "coverage": "" + }, + "36": { + "source": " })", + "coverage": "" + }, + "37": { + "source": " ", + "coverage": "" + }, + "38": { + "source": " describe('CovTest>3', function(){", + "coverage": 1 + }, + "39": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "40": { + "source": " assert.equal(1,covTest(4,2));", + "coverage": 1 + }, + "41": { + "source": " })", + "coverage": "" + }, + "42": { + "source": " })", + "coverage": "" + }, + "43": { + "source": " describe('covTest4', function(){", + "coverage": 1 + }, + "44": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "45": { + "source": " assert.equal(5,covTest4(5));", + "coverage": 1 + }, + "46": { + "source": " })", + "coverage": "" + }, + "47": { + "source": " })", + "coverage": "" + }, + "48": { + "source": " describe('covTest3', function(){", + "coverage": 1 + }, + "49": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "50": { + "source": " assert.equal(5,covTest3(5));", + "coverage": 1 + }, + "51": { + "source": " })", + "coverage": "" + }, + "52": { + "source": " })", + "coverage": "" + }, + "53": { + "source": "})", + "coverage": "" + }, + "54": { + "source": "", + "coverage": "" + } + } + "filename": "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/test3.js", + "coverage": 55.00000000000001, + "hits": 11, + "misses": 9, + "sloc": 20, + "source": { + "1": { + "source": "var assert = require(\"assert\")", + "coverage": 1 + }, + "2": { + "source": "var test = {", + "coverage": 1 + }, + "3": { + "source": " version: \"1.0.0\"", + "coverage": "" + }, + "4": { + "source": "}", + "coverage": "" + }, + "5": { + "source": "function covTest(p1,p2) {", + "coverage": 1 + }, + "6": { + "source": " if (p1 > 3) {", + "coverage": 0 + }, + "7": { + "source": " return 1;", + "coverage": 0 + }, + "8": { + "source": " }", + "coverage": "" + }, + "9": { + "source": " else {", + "coverage": "" + }, + "10": { + "source": " return p1 + p2;", + "coverage": 0 + }, + "11": { + "source": " }", + "coverage": "" + }, + "12": { + "source": "}", + "coverage": "" + }, + "13": { + "source": "", + "coverage": "" + }, + "14": { + "source": "function covTest2(p1,p2) {", + "coverage": 1 + }, + "15": { + "source": " return 0;", + "coverage": 1 + }, + "16": { + "source": "}", + "coverage": "" + }, + "17": { + "source": "", + "coverage": "" + }, + "18": { + "source": "function covTest3(p1) {", + "coverage": 1 + }, + "19": { + "source": " for(i=0;i < p1;i++){", + "coverage": 0 + }, + "20": { + "source": " }", + "coverage": "" + }, + "21": { + "source": " return i;", + "coverage": 0 + }, + "22": { + "source": "}", + "coverage": "" + }, + "23": { + "source": "function covTest4(p1) {", + "coverage": 1 + }, + "24": { + "source": " i=0;", + "coverage": 0 + }, + "25": { + "source": " while(i < p1){", + "coverage": 0 + }, + "26": { + "source": " i++;", + "coverage": 0 + }, + "27": { + "source": " }", + "coverage": "" + }, + "28": { + "source": " return i;", + "coverage": 0 + }, + "29": { + "source": "}", + "coverage": "" + }, + "30": { + "source": "", + "coverage": "" + }, + "31": { + "source": "describe('Array', function(){", + "coverage": 1 + }, + "32": { + "source": " describe('CovTest2', function(){", + "coverage": 1 + }, + "33": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "34": { + "source": " assert.equal(0,covTest2(2,2));", + "coverage": 1 + }, + "35": { + "source": " })", + "coverage": "" + }, + "36": { + "source": " })", + "coverage": "" + }, + "37": { + "source": "})", + "coverage": "" + }, + "38": { + "source": "", + "coverage": "" + } + } + } + ], + "stats": { + "suites": 5, + "tests": 4, + "passes": 4, + "pending": 0, + "failures": 0, + "start": "2014-10-23T17:56:02.339Z", + "end": "2014-10-23T17:56:02.344Z", + "duration": 5 + }, + "tests": [ + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest>3 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest4 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest3 should return when the value is not present", + "duration": 0 + } + ], + "failures": [], + "passes": [ + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest>3 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest4 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest3 should return when the value is not present", + "duration": 0 + } + ] +}
\ No newline at end of file diff --git a/Tests/JavascriptCoverage/test.js b/Tests/JavascriptCoverage/test.js new file mode 100644 index 0000000..273e921c --- /dev/null +++ b/Tests/JavascriptCoverage/test.js @@ -0,0 +1,53 @@ +var assert = require("assert") +var test = { + version: "1.0.0" +} +function covTest(p1,p2) { + if (p1 > 3) { + return 1; + } + else { + return p1 + p2; + } +} + +function covTest2(p1,p2) { + return 0; +} + +function covTest3(p1) { + for(i=0;i < p1;i++){ + } + return i; +} +function covTest4(p1) { + i=0; + while(i < p1){ + i++; + } + return i; +} + +describe('Array', function(){ + describe('CovTest', function(){ + it('should return when the value is not present', function(){ + assert.equal(4,covTest(2,2)); + }) + }) + + describe('CovTest>3', function(){ + it('should return when the value is not present', function(){ + assert.equal(1,covTest(4,2)); + }) + }) + describe('covTest4', function(){ + it('should return when the value is not present', function(){ + assert.equal(5,covTest4(5)); + }) + }) + describe('covTest3', function(){ + it('should return when the value is not present', function(){ + assert.equal(5,covTest3(5)); + }) + }) +}) diff --git a/Tests/JavascriptCoverage/test3.js b/Tests/JavascriptCoverage/test3.js new file mode 100644 index 0000000..a1e31bc --- /dev/null +++ b/Tests/JavascriptCoverage/test3.js @@ -0,0 +1,37 @@ +var assert = require("assert") +var test = { + version: "1.0.0" +} +function covTest(p1,p2) { + if (p1 > 3) { + return 1; + } + else { + return p1 + p2; + } +} + +function covTest2(p1,p2) { + return 0; +} + +function covTest3(p1) { + for(i=0;i < p1;i++){ + } + return i; +} +function covTest4(p1) { + i=0; + while(i < p1){ + i++; + } + return i; +} + +describe('Array', function(){ + describe('CovTest2', function(){ + it('should return when the value is not present', function(){ + assert.equal(0,covTest2(2,2)); + }) + }) +}) diff --git a/Tests/LinkStatic/CMakeLists.txt b/Tests/LinkStatic/CMakeLists.txt index 2062c43..200d4e5 100644 --- a/Tests/LinkStatic/CMakeLists.txt +++ b/Tests/LinkStatic/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8.4.20110303 FATAL_ERROR) project(LinkStatic C) -if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU)$") +if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU") message(FATAL_ERROR "This test works only with the GNU compiler!") endif() diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt index a30f643..bfbb343 100644 --- a/Tests/ModuleDefinition/CMakeLists.txt +++ b/Tests/ModuleDefinition/CMakeLists.txt @@ -13,7 +13,7 @@ add_custom_command(OUTPUT example_dll_gen.def add_library(example_dll_gen SHARED example_dll_gen.c example_dll_gen.def) # Test /DEF:<file> flag recognition for VS. -if(MSVC OR "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel") add_library(example_dll_2 SHARED example_dll_2.c) set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS /DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def") diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index 90af600..180f9fe 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) project(PDBDirectoryAndName C) # Make sure the proper compiler is in use. -if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC or Intel") endif() diff --git a/Tests/PrecompiledHeader/CMakeLists.txt b/Tests/PrecompiledHeader/CMakeLists.txt index 6958131..98bdd88 100644 --- a/Tests/PrecompiledHeader/CMakeLists.txt +++ b/Tests/PrecompiledHeader/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(PrecompiledHeader C) # Make sure the proper compiler is in use. -if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") message(FATAL_ERROR "The PrecompiledHeader test works only with MSVC or Intel") endif() diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index cdfdcc1..8ff0cfd 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -114,7 +114,7 @@ endif() set(EXPR_OP1 "/") if((NOT MSVC OR PP_NMAKE) AND - NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") # MSVC cl, Intel icl: % # When the cl compiler is invoked from the command line then % must # be written %% (to distinguish from %ENV% syntax). However cl does diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 3fd00b8..a60b556 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -113,3 +113,35 @@ set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) qtx_wrap_cpp(uicOnlyMoc sub/uiconly.h) add_executable(uiconly sub/uiconly.cpp ${uicOnlyMoc}) target_link_libraries(uiconly ${QT_LIBRARIES}) + +try_compile(RCC_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" + "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends" + autorcc_depends + CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + OUTPUT_VARIABLE output +) +if (NOT RCC_DEPENDS) + message(SEND_ERROR "Initial build of autorcc_depends failed. Output: ${output}") +endif() + +file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/info_file.txt" qrc_files) + +list(GET qrc_files 0 qrc_file1) + +set(timeformat "%Y%j%H%M%S") + +file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}") + +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends/res1_input.txt") + +execute_process(COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" +) + +file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}") + +if (NOT file1_step1 GREATER file1_before) + message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!") +endif() diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt new file mode 100644 index 0000000..afd95bc --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 2.8) +project(autorcc_depends) + +set(CMAKE_AUTORCC ON) + +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + set(QT_CORE_TARGET Qt4::QtCore) +else() + if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") + endif() + + find_package(Qt5Core REQUIRED) + set(QT_CORE_TARGET Qt5::Core) +endif() + +add_executable(test_res1 + test_res1.cpp + res1.qrc +) +target_link_libraries(test_res1 ${QT_CORE_TARGET}) +add_custom_command(TARGET test_res1 POST_BUILD COMMAND + ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test_res1>" > info_file.txt) diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc b/Tests/QtAutogen/autorcc_depends/res1.qrc new file mode 100644 index 0000000..cfea618 --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/res1.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>res1_input.txt</file> + </qresource> +</RCC> diff --git a/Tests/QtAutogen/autorcc_depends/res1_input.txt b/Tests/QtAutogen/autorcc_depends/res1_input.txt new file mode 100644 index 0000000..da62762 --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/res1_input.txt @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/autorcc_depends/test_res1.cpp b/Tests/QtAutogen/autorcc_depends/test_res1.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/test_res1.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index fd3bb03..c5825fe 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -95,6 +95,8 @@ endif() add_RunCMake_test(CompatibleInterface) add_RunCMake_test(Syntax) +add_RunCMake_test(add_custom_command) +add_RunCMake_test(add_custom_target) add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) add_RunCMake_test(export) @@ -153,3 +155,4 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) +add_RunCMake_test(ExternalProject) diff --git a/Tests/RunCMake/CommandLine/CMakeLists.txt b/Tests/RunCMake/CommandLine/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/CommandLine/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt b/Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt new file mode 100644 index 0000000..bba64bc --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt @@ -0,0 +1 @@ +^-->-DBAR:BOOL=BAZ<--$ diff --git a/Tests/RunCMake/CommandLine/D_nested_cache.cmake b/Tests/RunCMake/CommandLine/D_nested_cache.cmake new file mode 100644 index 0000000..9b57284 --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_nested_cache.cmake @@ -0,0 +1 @@ +message("-->${FOO}<--") diff --git a/Tests/RunCMake/CommandLine/D_typed_nested_cache-stderr.txt b/Tests/RunCMake/CommandLine/D_typed_nested_cache-stderr.txt new file mode 100644 index 0000000..bba64bc --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_typed_nested_cache-stderr.txt @@ -0,0 +1 @@ +^-->-DBAR:BOOL=BAZ<--$ diff --git a/Tests/RunCMake/CommandLine/D_typed_nested_cache.cmake b/Tests/RunCMake/CommandLine/D_typed_nested_cache.cmake new file mode 100644 index 0000000..9b57284 --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_typed_nested_cache.cmake @@ -0,0 +1 @@ +message("-->${FOO}<--") diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 5622a5b..84e3614 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -43,3 +43,11 @@ run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}) + +set(RunCMake_TEST_OPTIONS + "-DFOO=-DBAR:BOOL=BAZ") +run_cmake(D_nested_cache) + +set(RunCMake_TEST_OPTIONS + "-DFOO:STRING=-DBAR:BOOL=BAZ") +run_cmake(D_typed_nested_cache) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake new file mode 100644 index 0000000..38683f1 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION ${CMAKE_VERSION}) + +include(ExternalProject) + +ExternalProject_Add(BAR URL https://cmake.org/bar.tar.gz) + +ExternalProject_Add(FOO URL https://cmake.org/foo.tar.gz STEP_TARGETS update) +ExternalProject_Add_Step(FOO do_something COMMAND ${CMAKE_COMMAND} -E echo "Doing something") +ExternalProject_Add_Step(FOO do_something_else COMMAND ${CMAKE_COMMAND} -E echo "Doing something else") +ExternalProject_Add_StepTargets(FOO do_something) + +# download and do_something_else are not targets, but the file-level +# dependency are set. +ExternalProject_Add_StepDependencies(FOO download BAR) +ExternalProject_Add_StepDependencies(FOO do_something_else BAR) + +# update and do_something are targets, therefore both file-level and +# target-level dependencies are set. +ExternalProject_Add_StepDependencies(FOO update BAR) +ExternalProject_Add_StepDependencies(FOO do_something BAR) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake new file mode 100644 index 0000000..264c3f0 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION ${CMAKE_VERSION}) + +include(ExternalProject) + +ExternalProject_Add(BAR URL https://cmake.org/bar.tar.gz) + +ExternalProject_Add(FOO URL https://cmake.org/foo.tar.gz STEP_TARGETS update) +ExternalProject_Add_Step(FOO do_something COMMAND ${CMAKE_COMMAND} -E echo "Doing something") +ExternalProject_Add_Step(FOO do_something_else COMMAND ${CMAKE_COMMAND} -E echo "Doing something else") +ExternalProject_Add_StepTargets(FOO do_something) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake new file mode 100644 index 0000000..bf9b12d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake @@ -0,0 +1,21 @@ +include(ExternalProject) + +set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") +set(_cache_file "${_tmp_dir}/FOO-cache.cmake") + +ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" + DOWNLOAD_COMMAND "" + CMAKE_CACHE_ARGS "-DFOO:STRING=BAR") + +if(NOT EXISTS "${_cache_file}") + message(FATAL_ERROR "Initial cache not created") +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find FOO argument in cache") +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected forced FOO argument") +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake new file mode 100644 index 0000000..c216664 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake @@ -0,0 +1,21 @@ +include(ExternalProject) + +set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") +set(_cache_file "${_tmp_dir}/FOO-cache.cmake") + +ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" + DOWNLOAD_COMMAND "" + CMAKE_CACHE_DEFAULT_ARGS "-DFOO:STRING=BAR") + +if(NOT EXISTS "${_cache_file}") + message(FATAL_ERROR "Initial cache not created") +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find FOO argument in cache") +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected not forced FOO argument") +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake new file mode 100644 index 0000000..894e183 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake @@ -0,0 +1,29 @@ +include(ExternalProject) + +set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") +set(_cache_file "${_tmp_dir}/FOO-cache.cmake") + +ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" + DOWNLOAD_COMMAND "" + CMAKE_CACHE_ARGS "-DFOO:STRING=BAR" + CMAKE_CACHE_DEFAULT_ARGS "-DBAR:STRING=BAZ") + +if(NOT EXISTS "${_cache_file}") + message(FATAL_ERROR "Initial cache not created") +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find FOO argument in cache") +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected forced FOO argument") +endif() + +if(NOT "${_cache}" MATCHES "set\\(BAR \"BAZ\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find BAR argument in cache") +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected not forced BAR argument") +endif() diff --git a/Tests/RunCMake/ExternalProject/CMakeLists.txt b/Tests/RunCMake/ExternalProject/CMakeLists.txt new file mode 100644 index 0000000..c585733 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION ${CMAKE_VERSION}) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt new file mode 100644 index 0000000..4cb051d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt @@ -0,0 +1,36 @@ +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "configure" step might break parallel builds +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "build" step might break parallel builds +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "install" step might break parallel builds +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "test" step might break parallel builds +Call Stack \(most recent call first\): + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake new file mode 100644 index 0000000..57626d6 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 2.8.12) + +include(ExternalProject RESULT_VARIABLE GOO) + +set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS download patch update configure build) + +ExternalProject_Add(FOO + URL https://example.org/foo.tar.gz) + +ExternalProject_Add(BAR + URL https://example.org/bar.tar.gz + TEST_COMMAND echo test + INDEPENDENT_STEP_TARGETS install) +# This one should not give a warning +ExternalProject_Add_Step(BAR bar + COMMAND echo bar) + +ExternalProject_Add_StepTargets(BAR NO_DEPENDS test bar) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake new file mode 100644 index 0000000..0f5dcef --- /dev/null +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMAKE_CACHE_ARGS) +run_cmake(CMAKE_CACHE_DEFAULT_ARGS) +run_cmake(CMAKE_CACHE_mix) +run_cmake(NO_DEPENDS) +run_cmake(Add_StepDependencies) +run_cmake(Add_StepDependencies_no_target) diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt b/Tests/RunCMake/File_Generate/CarryPermissions-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/CarryPermissions-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt b/Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/CarryPermissions-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/CarryPermissions.cmake b/Tests/RunCMake/File_Generate/CarryPermissions.cmake new file mode 100644 index 0000000..a04334f --- /dev/null +++ b/Tests/RunCMake/File_Generate/CarryPermissions.cmake @@ -0,0 +1,5 @@ + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output_script.sh" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/input_script.sh" +) diff --git a/Tests/RunCMake/File_Generate/GenerateSource-result.txt b/Tests/RunCMake/File_Generate/GenerateSource-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/GenerateSource-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/GenerateSource-stderr.txt b/Tests/RunCMake/File_Generate/GenerateSource-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/GenerateSource-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/GenerateSource.cmake b/Tests/RunCMake/File_Generate/GenerateSource.cmake new file mode 100644 index 0000000..147a7f6 --- /dev/null +++ b/Tests/RunCMake/File_Generate/GenerateSource.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX) + +# Ensure re-generation +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + CONTENT "int main() { return 0; }\n" +) + +add_executable(mn "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt new file mode 100644 index 0000000..d3aa973 --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at OutputNameMatchesObjects.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_OBJECTS:foo> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. +Call Stack \(most recent call first\): + CMakeLists.txt:6 \(include\) diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake new file mode 100644 index 0000000..d807450 --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesObjects.cmake @@ -0,0 +1,10 @@ + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<BOOL:$<TARGET_OBJECTS:foo>>somefile.cpp" + CONTENT "static const char content[] = \"$<TARGET_OBJECTS:foo>\";\n" +) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/input.txt" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/input.txt" "${CMAKE_CURRENT_BINARY_DIR}") + +add_executable(foo empty.cpp "${CMAKE_CURRENT_BINARY_DIR}/1somefile.cpp" "${CMAKE_CURRENT_BINARY_DIR}/input.txt") diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources.cmake b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources.cmake new file mode 100644 index 0000000..ce601da --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources.cmake @@ -0,0 +1,14 @@ + +enable_language(CXX) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<BOOL:$<TARGET_PROPERTY:foo,SOURCES>>somefile.cpp" + CONTENT "static const char content[] = \"$<TARGET_PROPERTY:foo,SOURCES>\";\n" +) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated.cpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/generated.cpp" "${CMAKE_CURRENT_BINARY_DIR}") + +add_executable(foo empty.cpp "${CMAKE_CURRENT_BINARY_DIR}/generated.cpp") + +add_executable(bar "${CMAKE_CURRENT_BINARY_DIR}/1somefile.cpp") diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesSources-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesSources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesSources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesSources-stderr.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesSources-stderr.txt new file mode 100644 index 0000000..cefb4e5 --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesSources-stderr.txt @@ -0,0 +1,7 @@ +CMake Error in CMakeLists.txt: + Evaluation output file + + ".*Tests/RunCMake/File_Generate/OutputNameMatchesSources-build/1somefile.cpp" + + depends on the sources of a target it is used in. This is a dependency + loop and is not allowed. diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesSources.cmake b/Tests/RunCMake/File_Generate/OutputNameMatchesSources.cmake new file mode 100644 index 0000000..2feb9d1 --- /dev/null +++ b/Tests/RunCMake/File_Generate/OutputNameMatchesSources.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<BOOL:$<TARGET_PROPERTY:foo,SOURCES>>somefile.cpp" + CONTENT "static const char content[] = \"$<TARGET_PROPERTY:foo,SOURCES>\";\n" +) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/renamed.cpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" "${CMAKE_CURRENT_BINARY_DIR}/renamed.cpp") + +add_executable(foo "${CMAKE_CURRENT_BINARY_DIR}/1somefile.cpp" "${CMAKE_CURRENT_BINARY_DIR}/renamed.cpp") diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/ReRunCMake.cmake b/Tests/RunCMake/File_Generate/ReRunCMake.cmake new file mode 100644 index 0000000..109d60e --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake.cmake @@ -0,0 +1,5 @@ + +file(GENERATE + OUTPUT output_file.txt + INPUT "${CMAKE_CURRENT_BINARY_DIR}/input_file.txt" +) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index dee0692..97f93d5 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -8,6 +8,14 @@ run_cmake(EmptyCondition1) run_cmake(EmptyCondition2) run_cmake(BadCondition) run_cmake(DebugEvaluate) +run_cmake(GenerateSource) +run_cmake(OutputNameMatchesSources) +run_cmake(OutputNameMatchesObjects) +run_cmake(OutputNameMatchesOtherSources) +file(READ "${RunCMake_BINARY_DIR}/OutputNameMatchesOtherSources-build/1somefile.cpp" file_contents) +if (NOT file_contents MATCHES "generated.cpp.rule") + message(SEND_ERROR "Rule file not in target sources! ${file_contents}") +endif() set(timeformat "%Y%j%H%M%S") @@ -35,3 +43,52 @@ unset(RunCMake_TEST_NO_CLEAN) if (NOT timestamp_after STREQUAL timestamp) message(SEND_ERROR "WriteIfDifferent changed output file.") endif() + +if (UNIX AND EXISTS /bin/sh) + set(RunCMake_TEST_NO_CLEAN ON) + run_cmake(CarryPermissions) + execute_process( + COMMAND "${RunCMake_BINARY_DIR}/CarryPermissions-build/output_script.sh" + OUTPUT_VARIABLE script_output + RESULT_VARIABLE script_result + ERROR_VARIABLE script_error + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if (script_result) + message(SEND_ERROR "Generated script did not execute correctly: [${script_result}]\n${script_output}\n====\n${script_error}") + endif() + if (NOT script_output STREQUAL SUCCESS) + message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}") + endif() +endif() + +if (RunCMake_GENERATOR MATCHES Makefiles) + file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "InitialContent\n") + + set(RunCMake_TEST_NO_CLEAN ON) + run_cmake(ReRunCMake) + unset(RunCMake_TEST_NO_CLEAN) + file(TIMESTAMP "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" timestamp ${timeformat}) + if(NOT timestamp) + message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) + + file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "ChangedContent\n") + execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content) + + if(NOT out_content STREQUAL "ChangedContent\n") + message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() + + + file(REMOVE "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") + execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + + if (NOT EXISTS "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") + message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() +endif() diff --git a/Tests/RunCMake/File_Generate/empty.cpp b/Tests/RunCMake/File_Generate/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/File_Generate/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/File_Generate/input_script.sh b/Tests/RunCMake/File_Generate/input_script.sh new file mode 100755 index 0000000..2cc0983 --- /dev/null +++ b/Tests/RunCMake/File_Generate/input_script.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "$<$<STREQUAL:foo,foo>:SUCCESS>" diff --git a/Tests/RunCMake/add_custom_command/AppendNoOutput-result.txt b/Tests/RunCMake/add_custom_command/AppendNoOutput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNoOutput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/AppendNoOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNoOutput-stderr.txt new file mode 100644 index 0000000..abbfc5a --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNoOutput-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AppendNoOutput.cmake:1 \(add_custom_command\): + add_custom_command given APPEND option with no OUTPUT. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/AppendNoOutput.cmake b/Tests/RunCMake/add_custom_command/AppendNoOutput.cmake new file mode 100644 index 0000000..c6c716b --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNoOutput.cmake @@ -0,0 +1 @@ +add_custom_command(TARGET x APPEND DEPENDS a b c d) diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-result.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt new file mode 100644 index 0000000..96d0972 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\): + add_custom_command given APPEND option with output.* + which is not already a custom command output. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput.cmake b/Tests/RunCMake/add_custom_command/AppendNotOutput.cmake new file mode 100644 index 0000000..cc16129 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput.cmake @@ -0,0 +1 @@ +add_custom_command(OUTPUT out APPEND DEPENDS dep) diff --git a/Tests/RunCMake/add_custom_command/BadArgument-result.txt b/Tests/RunCMake/add_custom_command/BadArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/BadArgument-stderr.txt b/Tests/RunCMake/add_custom_command/BadArgument-stderr.txt new file mode 100644 index 0000000..04c5350 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BadArgument.cmake:1 \(add_custom_command\): + add_custom_command Wrong syntax. Unknown type of argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/BadArgument.cmake b/Tests/RunCMake/add_custom_command/BadArgument.cmake new file mode 100644 index 0000000..d9e7bd4 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadArgument.cmake @@ -0,0 +1 @@ +add_custom_command(bad_arg OUTPUT a b c d) diff --git a/Tests/RunCMake/add_custom_command/CMakeLists.txt b/Tests/RunCMake/add_custom_command/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/add_custom_command/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_custom_command/NoArguments-result.txt b/Tests/RunCMake/add_custom_command/NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/NoArguments-stderr.txt b/Tests/RunCMake/add_custom_command/NoArguments-stderr.txt new file mode 100644 index 0000000..11e0cb0 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoArguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoArguments.cmake:1 \(add_custom_command\): + add_custom_command called with wrong number of arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/NoArguments.cmake b/Tests/RunCMake/add_custom_command/NoArguments.cmake new file mode 100644 index 0000000..8781a87 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoArguments.cmake @@ -0,0 +1 @@ +add_custom_command() diff --git a/Tests/RunCMake/add_custom_command/NoOutputOrTarget-result.txt b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/NoOutputOrTarget-stderr.txt b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-stderr.txt new file mode 100644 index 0000000..6a5c0a3 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoOutputOrTarget.cmake:1 \(add_custom_command\): + add_custom_command Wrong syntax. A TARGET or OUTPUT must be specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/NoOutputOrTarget.cmake b/Tests/RunCMake/add_custom_command/NoOutputOrTarget.cmake new file mode 100644 index 0000000..933ee32 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoOutputOrTarget.cmake @@ -0,0 +1 @@ +add_custom_command(COMMAND echo a b c d) diff --git a/Tests/RunCMake/add_custom_command/OutputAndTarget-result.txt b/Tests/RunCMake/add_custom_command/OutputAndTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/OutputAndTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/OutputAndTarget-stderr.txt b/Tests/RunCMake/add_custom_command/OutputAndTarget-stderr.txt new file mode 100644 index 0000000..632880e --- /dev/null +++ b/Tests/RunCMake/add_custom_command/OutputAndTarget-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at OutputAndTarget.cmake:1 \(add_custom_command\): + add_custom_command Wrong syntax. A TARGET and OUTPUT can not both be + specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/OutputAndTarget.cmake b/Tests/RunCMake/add_custom_command/OutputAndTarget.cmake new file mode 100644 index 0000000..55806f3 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/OutputAndTarget.cmake @@ -0,0 +1 @@ +add_custom_command(OUTPUT out TARGET target) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake new file mode 100644 index 0000000..2f5c938 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) + +run_cmake(AppendNoOutput) +run_cmake(AppendNotOutput) +run_cmake(BadArgument) +run_cmake(NoArguments) +run_cmake(NoOutputOrTarget) +run_cmake(OutputAndTarget) +run_cmake(SourceByproducts) +run_cmake(SourceUsesTerminal) diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt b/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt b/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt new file mode 100644 index 0000000..a9cd64c --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceByproducts.cmake:1 \(add_custom_command\): + add_custom_command BYPRODUCTS may not be specified with SOURCE signatures +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts.cmake b/Tests/RunCMake/add_custom_command/SourceByproducts.cmake new file mode 100644 index 0000000..824f41d --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceByproducts.cmake @@ -0,0 +1 @@ +add_custom_command(SOURCE t TARGET t BYPRODUCTS b) diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt new file mode 100644 index 0000000..1a76c54 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceUsesTerminal.cmake:1 \(add_custom_command\): + add_custom_command USES_TERMINAL may not be used with SOURCE signatures +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake b/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake new file mode 100644 index 0000000..295fab1 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake @@ -0,0 +1 @@ +add_custom_command(SOURCE t TARGET t USES_TERMINAL) diff --git a/Tests/RunCMake/add_custom_target/BadTargetName-result.txt b/Tests/RunCMake/add_custom_target/BadTargetName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadTargetName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt new file mode 100644 index 0000000..f352457 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadTargetName.cmake:1 \(add_custom_target\): + add_custom_target called with target name containing a "#". This character + is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetName.cmake:2 \(add_custom_target\): + add_custom_target called with target name containing a "<". This character + is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetName.cmake:3 \(add_custom_target\): + add_custom_target called with target name containing a ">". This character + is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/BadTargetName.cmake b/Tests/RunCMake/add_custom_target/BadTargetName.cmake new file mode 100644 index 0000000..c4381a2 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadTargetName.cmake @@ -0,0 +1,3 @@ +add_custom_target("#") +add_custom_target("<") +add_custom_target(">") diff --git a/Tests/RunCMake/add_custom_target/ByproductsNoCommand-result.txt b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/ByproductsNoCommand-stderr.txt b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-stderr.txt new file mode 100644 index 0000000..6c80ca6 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at ByproductsNoCommand.cmake:1 \(add_custom_target\): + BYPRODUCTS may not be specified without any COMMAND +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/ByproductsNoCommand.cmake b/Tests/RunCMake/add_custom_target/ByproductsNoCommand.cmake new file mode 100644 index 0000000..6c142a2 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/ByproductsNoCommand.cmake @@ -0,0 +1 @@ +add_custom_target(MyTarget BYPRODUCTS a b c d) diff --git a/Tests/RunCMake/add_custom_target/CMakeLists.txt b/Tests/RunCMake/add_custom_target/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/add_custom_target/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_custom_target/NoArguments-result.txt b/Tests/RunCMake/add_custom_target/NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/NoArguments-stderr.txt b/Tests/RunCMake/add_custom_target/NoArguments-stderr.txt new file mode 100644 index 0000000..2230093 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/NoArguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoArguments.cmake:1 \(add_custom_target\): + add_custom_target called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/NoArguments.cmake b/Tests/RunCMake/add_custom_target/NoArguments.cmake new file mode 100644 index 0000000..ec6a212 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/NoArguments.cmake @@ -0,0 +1 @@ +add_custom_target() diff --git a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake new file mode 100644 index 0000000..92c4a38 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(NoArguments) +run_cmake(BadTargetName) +run_cmake(ByproductsNoCommand) +run_cmake(UsesTerminalNoCommand) diff --git a/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-result.txt b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-stderr.txt b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-stderr.txt new file mode 100644 index 0000000..beafa7c --- /dev/null +++ b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UsesTerminalNoCommand.cmake:1 \(add_custom_target\): + USES_TERMINAL may not be specified without any COMMAND +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand.cmake b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand.cmake new file mode 100644 index 0000000..b0c207b --- /dev/null +++ b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand.cmake @@ -0,0 +1 @@ +add_custom_target(MyTarget USES_TERMINAL) diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake index c8bfa57..c010256 100644 --- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -6,3 +6,4 @@ run_cmake(UTF16LE-BOM) run_cmake(UTF16BE-BOM) run_cmake(UTF32LE-BOM) run_cmake(UTF32BE-BOM) +run_cmake(UnknownArg) diff --git a/Tests/RunCMake/configure_file/UnknownArg-stderr.txt b/Tests/RunCMake/configure_file/UnknownArg-stderr.txt new file mode 100644 index 0000000..46930c0 --- /dev/null +++ b/Tests/RunCMake/configure_file/UnknownArg-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at UnknownArg.cmake:1 \(configure_file\): + configure_file called with unknown argument\(s\): + + COPY_ONLY + COPYFILE + COPY_FILE + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/configure_file/UnknownArg.cmake b/Tests/RunCMake/configure_file/UnknownArg.cmake new file mode 100644 index 0000000..5125c83 --- /dev/null +++ b/Tests/RunCMake/configure_file/UnknownArg.cmake @@ -0,0 +1,2 @@ +configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in UnknownArg.txt + @ONLY COPYONLY COPY_ONLY COPYFILE COPY_FILE) diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index e6c6152..faf3bc9 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -189,7 +189,7 @@ string(CONFIGURE "${infile}" infile+-/out @ONLY) set(infile "${infile+-/out}") # Write include file to a file -string(REGEX REPLACE "includefile" "${file}" outfile "${infile}") +string(REGEX REPLACE "includefile" "Includes/Values.h" outfile "${infile}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${outfile}") file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h") diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index a4d9490..e497503 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -265,7 +265,7 @@ TEST_FAIL(CXX_RUN_SHOULD_FAIL "CHECK_CXX_SOURCE_RUNS() succeeded, but should hav TEST_ASSERT(CXX_RUN_SHOULD_WORK "CHECK_CXX_SOURCE_RUNS() failed") foreach(lang C CXX) - if(NOT "${CMAKE_${lang}_COMPILER_ID}" MATCHES "^(PathScale)$") + if(NOT CMAKE_${lang}_COMPILER_ID STREQUAL "PathScale") set(${lang}_DD --) endif() endforeach() @@ -280,7 +280,7 @@ include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG) TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed") -if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") unset(C_STRICT_PROTOTYPES CACHE) CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES) TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes") diff --git a/Tests/Tutorial/Step2/tutorial.cxx b/Tests/Tutorial/Step2/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step2/tutorial.cxx +++ b/Tests/Tutorial/Step2/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step3/tutorial.cxx b/Tests/Tutorial/Step3/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step3/tutorial.cxx +++ b/Tests/Tutorial/Step3/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step4/tutorial.cxx b/Tests/Tutorial/Step4/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step4/tutorial.cxx +++ b/Tests/Tutorial/Step4/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step5/tutorial.cxx b/Tests/Tutorial/Step5/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step5/tutorial.cxx +++ b/Tests/Tutorial/Step5/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step6/tutorial.cxx b/Tests/Tutorial/Step6/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step6/tutorial.cxx +++ b/Tests/Tutorial/Step6/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step7/tutorial.cxx b/Tests/Tutorial/Step7/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step7/tutorial.cxx +++ b/Tests/Tutorial/Step7/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); |