diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-28 13:59:23 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-28 13:59:23 (GMT) |
commit | d2515f77e19959e2b8d92f9e313fb0b517a13916 (patch) | |
tree | fa1a1dbbd0817e072cd9f8fbfdb48826d99fd158 /Tests/RunCMake | |
parent | 26170ea3069238bfb287d6304cd2f65e1c3a7387 (diff) | |
parent | 6efdd7e81480bf48fa2daeb292a12c77e23d3a17 (diff) | |
download | CMake-d2515f77e19959e2b8d92f9e313fb0b517a13916.zip CMake-d2515f77e19959e2b8d92f9e313fb0b517a13916.tar.gz CMake-d2515f77e19959e2b8d92f9e313fb0b517a13916.tar.bz2 |
Merge branch 'master' into ctest-test-changing-labels
Diffstat (limited to 'Tests/RunCMake')
66 files changed, 454 insertions, 38 deletions
diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CMakeLists.txt b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CMakeLists.txt new file mode 100644 index 0000000..bbc08e6 --- /dev/null +++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.21) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar-build-stdout.txt b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar-build-stdout.txt new file mode 100644 index 0000000..f0f2efc --- /dev/null +++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar-build-stdout.txt @@ -0,0 +1 @@ +This message is printed by echo_message.bat diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar.cmake b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar.cmake new file mode 100644 index 0000000..63d6068 --- /dev/null +++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/CheckEnvironmentVar.cmake @@ -0,0 +1,2 @@ +set(CMAKE_MSVCIDE_RUN_PATH "${CMAKE_SOURCE_DIR}") +add_custom_target(main COMMAND echo_message) diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/RunCMakeTest.cmake b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/RunCMakeTest.cmake new file mode 100644 index 0000000..a424ff2 --- /dev/null +++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CheckEnvironmentVar-build) +run_cmake(CheckEnvironmentVar) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(CheckEnvironmentVar-build ${CMAKE_COMMAND} --build . --config Debug --target main) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/echo_message.bat b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/echo_message.bat new file mode 100755 index 0000000..9037d02 --- /dev/null +++ b/Tests/RunCMake/CMAKE_MSVCIDE_RUN_PATH/echo_message.bat @@ -0,0 +1 @@ +echo This message is printed by echo_message.bat diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 86cb849..ef797f7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -374,12 +374,11 @@ add_RunCMake_test(ctest_disabled_test) add_RunCMake_test(ctest_skipped_test) add_RunCMake_test(ctest_update) add_RunCMake_test(ctest_upload) +add_RunCMake_test(ctest_environment) add_RunCMake_test(ctest_fixtures) add_RunCMake_test(file -DMSYS=${MSYS}) add_RunCMake_test(file-CHMOD -DMSYS=${MSYS}) -if(HAVE_ELF_H OR CMAKE_SYSTEM_NAME STREQUAL "AIX") - add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DHAVE_ELF_H=${HAVE_ELF_H}) -endif() +add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(find_file) add_RunCMake_test(find_library -DCYGWIN=${CYGWIN} -DMSYS=${MSYS}) add_RunCMake_test(find_package -DMSYS=${MSYS}) @@ -557,6 +556,7 @@ if(CMake_TEST_FindGTK2) endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + add_RunCMake_test(CMAKE_MSVCIDE_RUN_PATH) add_RunCMake_test(include_external_msproject -DVS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME}) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio (9|10)" AND NOT CMAKE_VS_DEVENV_COMMAND) set(NO_USE_FOLDERS 1) diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 31bd8a4..c31a645 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -260,6 +260,7 @@ unset(CMakePresets_FILE) run_cmake_presets(GoodUserOnly) run_cmake_presets(GoodUserFromMain) run_cmake_presets(GoodUserFromUser) +run_cmake_presets(V2InheritV3Optional) # Test CMakeUserPresets.json errors run_cmake_presets(UserDuplicateInUser) diff --git a/Tests/RunCMake/CMakePresets/V2InheritV3Optional.cmake b/Tests/RunCMake/CMakePresets/V2InheritV3Optional.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/V2InheritV3Optional.cmake diff --git a/Tests/RunCMake/CMakePresets/V2InheritV3Optional.json.in b/Tests/RunCMake/CMakePresets/V2InheritV3Optional.json.in new file mode 100644 index 0000000..957b157 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/V2InheritV3Optional.json.in @@ -0,0 +1,8 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "default" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/V2InheritV3OptionalUser.json.in b/Tests/RunCMake/CMakePresets/V2InheritV3OptionalUser.json.in new file mode 100644 index 0000000..f18c1b9 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/V2InheritV3OptionalUser.json.in @@ -0,0 +1,11 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "V2InheritV3Optional", + "inherits": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 746ff8b..7997c78 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -7,6 +7,7 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT") run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT") run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT") +run_cpack_test(DEBUGINFO "DEB.DEBUGINFO" true "MONOLITHIC") run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT") run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT") run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC") diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index cf4aa51..b3e6485 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -1,8 +1,5 @@ set(whitespaces_ "[\t\n\r ]*") -set(EXPECTED_FILES_COUNT "6") -set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) - if(GENERATOR_TYPE STREQUAL "RPM") set(NAME "Debuginfo") set(DEBUG_SUFFIX "debuginfo") @@ -15,30 +12,49 @@ elseif(GENERATOR_TYPE STREQUAL "DEB") set(DEBUG_PKG "ddeb") endif() -set(EXPECTED_FILE_1_NAME "${NAME}") -set(EXPECTED_FILE_1_COMPONENT "applications") -set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") +set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE) -set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.${PKG}") -set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(EXPECTED_FILES_COUNT "6") -set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.${PKG}") -set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") + set(EXPECTED_FILE_1_NAME "${NAME}") + set(EXPECTED_FILE_1_COMPONENT "applications") + set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") -set(EXPECTED_FILE_4 "${NAME}-applications-${DEBUG_SUFFIX}*.${DEBUG_PKG}") -if(GENERATOR_TYPE STREQUAL "RPM") - set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") -elseif(GENERATOR_TYPE STREQUAL "DEB") - set(EXPECTED_FILE_CONTENT_4 ".*/usr/lib/debug/.build-id/.*\.debug.*") -endif() + set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.${PKG}") + set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt") -if(GENERATOR_TYPE STREQUAL "RPM") - set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm") - set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") -elseif(GENERATOR_TYPE STREQUAL "DEB") - set(EXPECTED_FILE_5 "TestDinfo-pkg-libs-dbgsym.ddeb") - set(EXPECTED_FILE_CONTENT_5 ".*/usr/lib/debug/.build-id/.*\.debug.*") -endif() + set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.${PKG}") + set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") + + set(EXPECTED_FILE_4 "${NAME}-applications-${DEBUG_SUFFIX}*.${DEBUG_PKG}") + if(GENERATOR_TYPE STREQUAL "RPM") + set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") + elseif(GENERATOR_TYPE STREQUAL "DEB") + set(EXPECTED_FILE_CONTENT_4 ".*/usr/lib/debug/.build-id/.*\.debug.*") + endif() + + if(GENERATOR_TYPE STREQUAL "RPM") + set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm") + set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") + elseif(GENERATOR_TYPE STREQUAL "DEB") + set(EXPECTED_FILE_5 "TestDinfo-pkg-libs-dbgsym.ddeb") + set(EXPECTED_FILE_CONTENT_5 ".*/usr/lib/debug/.build-id/.*\.debug.*") + endif() + + set(EXPECTED_FILE_6 "TestDinfo-pkg*-appheaders.${PKG}") + set(EXPECTED_FILE_CONTENT_6_LIST "/include;/include/test_lib.hpp") -set(EXPECTED_FILE_6 "TestDinfo-pkg*-appheaders.${PKG}") -set(EXPECTED_FILE_CONTENT_6_LIST "/include;/include/test_lib.hpp") +elseif(PACKAGING_TYPE STREQUAL "MONOLITHIC" AND GENERATOR_TYPE STREQUAL "DEB") + set(EXPECTED_FILES_COUNT "2") + + set(EXPECTED_FILE_1 "TestDinfo-pkg.deb") + set( + EXPECTED_FILE_CONTENT_1_LIST + "/bar;/bar/CMakeLists.txt;/bas;/bas/libtest_lib.so;/foo;/foo/test_prog;/include;/include/test_lib.hpp" + ) + + set(EXPECTED_FILE_2 "TestDinfo-pkg-dbgsym.ddeb") + set(EXPECTED_FILE_CONTENT_2 ".*/usr/lib/debug/.build-id/.*\.debug.*") + +endif() diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index 9ff1f8a..e9cebbf 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -28,6 +28,8 @@ install(TARGETS test_prog DESTINATION foo COMPONENT applications) install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) install(TARGETS test_lib DESTINATION bas COMPONENT libs) +set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON) + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) set(CPACK_DEBIAN_APPLICATIONS_FILE_NAME "DEB-DEFAULT") diff --git a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake index d1a3a5f..f859215 100644 --- a/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/MD5SUMS/ExpectedFiles.cmake @@ -1,2 +1,2 @@ set(EXPECTED_FILES_COUNT "1") -set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") +set(EXPECTED_FILE_CONTENT_1_LIST "/bar;/bar/CMakeLists.txt;/baz;/baz/CMakeLists.txt;/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/MD5SUMS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/MD5SUMS/VerifyResult.cmake index fbdda9c..13af097 100644 --- a/Tests/RunCMake/CPack/tests/MD5SUMS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/MD5SUMS/VerifyResult.cmake @@ -1,3 +1,4 @@ set(whitespaces_ "[\t\n\r ]*") -set(md5sums_md5sums "^.* usr/foo/CMakeLists\.txt${whitespaces_}$") +set(hashsyms_ "[a-f0-9]+") +set(md5sums_md5sums "^${hashsyms_} usr/bar/CMakeLists\.txt${whitespaces_}${hashsyms_} usr/baz/CMakeLists\.txt${whitespaces_}${hashsyms_} usr/foo/CMakeLists\.txt${whitespaces_}$") verifyDebControl("${FOUND_FILE_1}" "md5sums" "md5sums") diff --git a/Tests/RunCMake/CPack/tests/MD5SUMS/test.cmake b/Tests/RunCMake/CPack/tests/MD5SUMS/test.cmake index 15c5892..3c922d2 100644 --- a/Tests/RunCMake/CPack/tests/MD5SUMS/test.cmake +++ b/Tests/RunCMake/CPack/tests/MD5SUMS/test.cmake @@ -1,4 +1,6 @@ install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT test) +install(FILES CMakeLists.txt DESTINATION baz COMPONENT test) if(PACKAGING_TYPE STREQUAL "COMPONENT") set(CPACK_COMPONENTS_ALL test) diff --git a/Tests/RunCMake/CommandLine/EnvBuildType-stdout.txt b/Tests/RunCMake/CommandLine/EnvBuildType-stdout.txt new file mode 100644 index 0000000..03b92a7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvBuildType-stdout.txt @@ -0,0 +1,2 @@ +-- ENV{CMAKE_BUILD_TYPE}='BuildTypeEnv' +-- CMAKE_BUILD_TYPE='BuildTypeEnv' diff --git a/Tests/RunCMake/CommandLine/EnvBuildType.cmake b/Tests/RunCMake/CommandLine/EnvBuildType.cmake new file mode 100644 index 0000000..e5e6d04 --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvBuildType.cmake @@ -0,0 +1,2 @@ +message(STATUS "ENV{CMAKE_BUILD_TYPE}='$ENV{CMAKE_BUILD_TYPE}'") +message(STATUS "CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}'") diff --git a/Tests/RunCMake/CommandLine/EnvBuildTypeIgnore-stdout.txt b/Tests/RunCMake/CommandLine/EnvBuildTypeIgnore-stdout.txt new file mode 100644 index 0000000..4a26732 --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvBuildTypeIgnore-stdout.txt @@ -0,0 +1,2 @@ +-- ENV{CMAKE_BUILD_TYPE}='BuildTypeEnv' +-- CMAKE_BUILD_TYPE='BuildTypeOpt' diff --git a/Tests/RunCMake/CommandLine/EnvBuildTypeIgnore.cmake b/Tests/RunCMake/CommandLine/EnvBuildTypeIgnore.cmake new file mode 100644 index 0000000..f21666f --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvBuildTypeIgnore.cmake @@ -0,0 +1 @@ +include(EnvBuildType.cmake) diff --git a/Tests/RunCMake/CommandLine/EnvConfigTypes-stdout.txt b/Tests/RunCMake/CommandLine/EnvConfigTypes-stdout.txt new file mode 100644 index 0000000..bfec18f --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvConfigTypes-stdout.txt @@ -0,0 +1,2 @@ +-- ENV{CMAKE_CONFIGURATION_TYPES}='ConfigTypesEnv' +-- CMAKE_CONFIGURATION_TYPES='ConfigTypesEnv' diff --git a/Tests/RunCMake/CommandLine/EnvConfigTypes.cmake b/Tests/RunCMake/CommandLine/EnvConfigTypes.cmake new file mode 100644 index 0000000..8c9b63a --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvConfigTypes.cmake @@ -0,0 +1,2 @@ +message(STATUS "ENV{CMAKE_CONFIGURATION_TYPES}='$ENV{CMAKE_CONFIGURATION_TYPES}'") +message(STATUS "CMAKE_CONFIGURATION_TYPES='${CMAKE_CONFIGURATION_TYPES}'") diff --git a/Tests/RunCMake/CommandLine/EnvConfigTypesIgnore-stdout.txt b/Tests/RunCMake/CommandLine/EnvConfigTypesIgnore-stdout.txt new file mode 100644 index 0000000..7800a4f --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvConfigTypesIgnore-stdout.txt @@ -0,0 +1,2 @@ +-- ENV{CMAKE_CONFIGURATION_TYPES}='ConfigTypesEnv' +-- CMAKE_CONFIGURATION_TYPES='ConfigTypesOpt' diff --git a/Tests/RunCMake/CommandLine/EnvConfigTypesIgnore.cmake b/Tests/RunCMake/CommandLine/EnvConfigTypesIgnore.cmake new file mode 100644 index 0000000..fcbbaea --- /dev/null +++ b/Tests/RunCMake/CommandLine/EnvConfigTypesIgnore.cmake @@ -0,0 +1 @@ +include(EnvConfigTypes.cmake) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index c58b1d0..0b26b89 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -344,6 +344,26 @@ if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ni run_EnvironmentExportCompileCommands() endif() +function(run_EnvironmentBuildType) + set(ENV{CMAKE_BUILD_TYPE} "BuildTypeEnv") + run_cmake(EnvBuildType) + run_cmake_with_options(EnvBuildTypeIgnore -DCMAKE_BUILD_TYPE=BuildTypeOpt) + unset(ENV{CMAKE_BUILD_TYPE}) +endfunction() + +function(run_EnvironmentConfigTypes) + set(ENV{CMAKE_CONFIGURATION_TYPES} "ConfigTypesEnv") + run_cmake(EnvConfigTypes) + run_cmake_with_options(EnvConfigTypesIgnore -DCMAKE_CONFIGURATION_TYPES=ConfigTypesOpt) + unset(ENV{CMAKE_CONFIGURATION_TYPES}) +endfunction() + +if(RunCMake_GENERATOR MATCHES "Make|^Ninja$") + run_EnvironmentBuildType() +elseif(RunCMake_GENERATOR MATCHES "Ninja Multi-Config|Visual Studio|Xcode") + run_EnvironmentConfigTypes() +endif() + function(run_EnvironmentToolchain) set(ENV{CMAKE_TOOLCHAIN_FILE} "${RunCMake_SOURCE_DIR}/EnvToolchain-toolchain.cmake") run_cmake(EnvToolchainAbsolute) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_ARGN.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_ARGN.cmake new file mode 100644 index 0000000..e49ff22 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_MATCHING_ARGN.cmake @@ -0,0 +1,17 @@ +if(WIN32) + set(ENV{PKG_CONFIG} "\"${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat\" --static --print-errors") +else() + set(ENV{PKG_CONFIG} "\"${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh\" --static --print-errors") +endif() + +find_package(PkgConfig REQUIRED) + +if(NOT PKG_CONFIG_ARGN STREQUAL "--static;--print-errors") + message(SEND_ERROR "PKG_CONFIG_ARGN has wrong value '${PKG_CONFIG_ARGN}'") +endif() + +_pkgconfig_invoke("none" "prefix" "output" "") + +if(NOT prefix_output STREQUAL "Received;--static;Received;--print-errors") + message(SEND_ERROR "prefix_output has wrong value '${prefix_output}'") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt new file mode 100644 index 0000000..6615d80 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt @@ -0,0 +1,3 @@ +-- ZOT_LIBRARIES='zot' +-- ZOT_LINK_LIBRARIES='[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/zot/lib/prefix-zot-suffix' +-- ZOT_LDFLAGS='-L[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/zot/lib;-lzot' diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake new file mode 100644 index 0000000..9f654b5 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake @@ -0,0 +1,29 @@ +find_package(PkgConfig REQUIRED) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/zot/lib/pkgconfig/zot.pc" " +prefix=${CMAKE_CURRENT_BINARY_DIR}/zot +libdir=\${prefix}/lib + +Name: Zot +Description: Dummy packaget to test LIBRARY_DIR support +Version: 1.0 +Libs: -L\${libdir} -lzot +") + +# Create a "library" file to find in libdir. +set(CMAKE_FIND_LIBRARY_PREFIXES "prefix-") +set(CMAKE_FIND_LIBRARY_SUFFIXES "-suffix") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/zot/lib/prefix-zot-suffix") + +# 'pkg-config --libs' drops -L flags in PKG_CONFIG_SYSTEM_LIBRARY_PATH by default. +set(ENV{PKG_CONFIG_SYSTEM_LIBRARY_PATH} "${CMAKE_CURRENT_BINARY_DIR}/zot/lib") + +# 'pkgconf --libs' also drops -L flags in LIBRARY_PATH by default. +set(ENV{LIBRARY_PATH} "${CMAKE_CURRENT_BINARY_DIR}/zot/lib") + +set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_BINARY_DIR}/zot/lib/pkgconfig") +pkg_check_modules(ZOT REQUIRED zot) + +message(STATUS "ZOT_LIBRARIES='${ZOT_LIBRARIES}'") +message(STATUS "ZOT_LINK_LIBRARIES='${ZOT_LINK_LIBRARIES}'") +message(STATUS "ZOT_LDFLAGS='${ZOT_LDFLAGS}'") diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index e7f008c..81a4732 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -12,6 +12,7 @@ run_cmake(FindPkgConfig_PKGCONFIG_PATH) run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH) run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH) run_cmake(FindPkgConfig_extract_frameworks) +run_cmake(FindPkgConfig_GET_MATCHING_ARGN) if(APPLE) run_cmake(FindPkgConfig_extract_frameworks_target) @@ -30,4 +31,8 @@ if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_VERSION_OPERATORS) run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME) run_cmake(FindPkgConfig_empty_target) + + if(NOT RunCMake_BINARY_DIR MATCHES " ") + run_cmake(FindPkgConfig_LIBRARY_PATH) + endif() endif () diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat index b038370..c91713b 100755 --- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat @@ -1,5 +1,10 @@ @ECHO OFF +rem variables to get around `--static --version` printing the received +rem message and then version +set static=false +set print_errors=false + :LOOP IF "%1"=="" ( @@ -21,7 +26,19 @@ IF "%1"=="--exists" ( EXIT /B 0 ) ) +IF "%1"=="--static" ( + set static=true +) +IF "%1"=="--print-errors" ( + set print_errors=true +) SHIFT IF NOT "%~1"=="" GOTO LOOP +IF "%static%"=="true" ECHO Received --static +IF "%print_errors%"=="true" ECHO Received --print-errors + +IF "%static%"=="true" GOTO :EOF +IF "%print_errors%"=="true" GOTO :EOF + EXIT /B 255 diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh index 56bba30..4021bf7 100755 --- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh @@ -4,6 +4,11 @@ # to the --exists argument with the PKG_CONFIG_PATH environment variable # and returns 1 if they are different. +# variables to get around `--static --version` printing the received +# message and then version +static=false +print_errors=false + while [ $# -gt 0 ]; do case $1 in --version) @@ -17,7 +22,21 @@ while [ $# -gt 0 ]; do echo "Found: ${PKG_CONFIG_PATH}" [ "${last}" = "${PKG_CONFIG_PATH}" ] && exit 0 || exit 1 ;; + --static) + static=true + ;; + --print-errors) + print_errors=true + ;; esac shift done + +$static && echo "Received --static" +$print_errors && echo "Received --print-errors" + +if $static || $print_errors; then + exit 0 +fi + exit 255 diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-stderr.txt new file mode 100644 index 0000000..cae3679 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0085 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD.$ diff --git a/Tests/RunCMake/UseSWIG/CMP0086-OLD-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0086-OLD-stderr.txt new file mode 100644 index 0000000..fca7a73 --- /dev/null +++ b/Tests/RunCMake/UseSWIG/CMP0086-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0086-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0086 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt b/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt index 95fc5ca..39415af 100644 --- a/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt +++ b/Tests/RunCMake/VS10Project/VsDpiAwareBadParam-stderr.txt @@ -1,3 +1,3 @@ -CMake Error: Bad parameter for VS_DPI_AWARE: Bar CMake Error: Bad parameter for VS_DPI_AWARE: Foo +CMake Error: Bad parameter for VS_DPI_AWARE: Bar CMake Generate step failed. Build files cannot be regenerated correctly. diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-stderr.txt b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-stderr.txt new file mode 100644 index 0000000..50838c3 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists.txt:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0082 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD.$ diff --git a/Tests/RunCMake/ctest_environment/CMakeLists.txt.in b/Tests/RunCMake/ctest_environment/CMakeLists.txt.in new file mode 100644 index 0000000..c9c4a64 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/CMakeLists.txt.in @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.21.0) +project("@CASE_NAME@" NONE) +include("@CASE_SOURCE_DIR@/@CASE_NAME@.cmake") diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op-stderr.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op-stderr.txt new file mode 100644 index 0000000..5b56d6f --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op-stderr.txt @@ -0,0 +1 @@ +Error: Unrecognized environment manipulation argument: unknown diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op.cmake new file mode 100644 index 0000000..d6ca4b2 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-invalid-op.cmake @@ -0,0 +1,6 @@ +include(CTest) +add_test(NAME cmake_version COMMAND "${CMAKE_COMMAND}" --version) + +set_property(TEST cmake_version + PROPERTY ENVIRONMENT_MODIFICATION + INVALID_OP=unknown:) diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon-stderr.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon-stderr.txt new file mode 100644 index 0000000..3ba6ba7 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon-stderr.txt @@ -0,0 +1 @@ +Error: Missing `:` after the operation in: MISSING_COLON=unset diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon.cmake new file mode 100644 index 0000000..601dd8b --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-colon.cmake @@ -0,0 +1,6 @@ +include(CTest) + +add_test(NAME cmake_version COMMAND "${CMAKE_COMMAND}" --version) +set_property(TEST cmake_version + PROPERTY ENVIRONMENT_MODIFICATION + MISSING_COLON=unset) diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals-result.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals-stderr.txt b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals-stderr.txt new file mode 100644 index 0000000..20bc9a5 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals-stderr.txt @@ -0,0 +1 @@ +Error: Missing `=` after the variable name in: MISSING_EQUAL diff --git a/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals.cmake b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals.cmake new file mode 100644 index 0000000..18448cf --- /dev/null +++ b/Tests/RunCMake/ctest_environment/ENVIRONMENT_MODIFICATION-no-equals.cmake @@ -0,0 +1,6 @@ +include(CTest) + +add_test(NAME cmake_version COMMAND "${CMAKE_COMMAND}" --version) +set_property(TEST cmake_version + PROPERTY ENVIRONMENT_MODIFICATION + MISSING_EQUAL) diff --git a/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake new file mode 100644 index 0000000..3447779 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/RunCMakeTest.cmake @@ -0,0 +1,12 @@ +include(RunCTest) + +# Isolate our ctest runs from external environment. +unset(ENV{CTEST_PARALLEL_LEVEL}) +unset(ENV{CTEST_OUTPUT_ON_FAILURE}) + +set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}") +set(RunCTest_VERBOSE_FLAG "-VV") + +run_ctest(ENVIRONMENT_MODIFICATION-invalid-op) +run_ctest(ENVIRONMENT_MODIFICATION-no-colon) +run_ctest(ENVIRONMENT_MODIFICATION-no-equals) diff --git a/Tests/RunCMake/ctest_environment/test.cmake.in b/Tests/RunCMake/ctest_environment/test.cmake.in new file mode 100644 index 0000000..ca23c83 --- /dev/null +++ b/Tests/RunCMake/ctest_environment/test.cmake.in @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.7) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +set(ctest_test_args "@CASE_CTEST_TEST_ARGS@") +ctest_start(Experimental) +ctest_configure() +ctest_build() +ctest_test(${ctest_test_args}) diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 5f9b32d..de81049 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -158,13 +158,25 @@ add_test( COMMAND ${CMAKE_COMMAND} -E echo <DartMeasurement type="numeric/double" name="my_custom_value">1.4847</DartMeasurement>) add_test( + NAME double_measurement2 + COMMAND ${CMAKE_COMMAND} -E + echo <CTestMeasurement type="numeric/double" name="another_custom_value">1.8474</CTestMeasurement>) +add_test( NAME img_measurement COMMAND ${CMAKE_COMMAND} -E echo <DartMeasurementFile name="TestImage" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>) add_test( + NAME img_measurement2 + COMMAND ${CMAKE_COMMAND} -E + echo <CTestMeasurementFile name="TestImage2" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</CTestMeasurementFile>) +add_test( NAME file_measurement COMMAND ${CMAKE_COMMAND} -E echo <DartMeasurementFile name="my_test_input_data" type="file">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>) +add_test( + NAME file_measurement2 + COMMAND ${CMAKE_COMMAND} -E + echo <CTestMeasurementFile name="another_test_input_data" type="file">]] ${IMAGE_DIR}/cmake-logo-16.png [[</CTestMeasurementFile>) ]]) run_ctest(TestMeasurements) endfunction() @@ -194,3 +206,16 @@ set_property(TEST b PROPERTY LABELS b) run_ctest(TestChangingLabels) endfunction() run_changing_labels() + +# Verify that test output can add additional labels +function(run_extra_labels) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test( + NAME custom_labels + COMMAND ${CMAKE_COMMAND} -E + echo before\n<CTestLabel>label2</CTestLabel>\n<CTestLabel>label1</CTestLabel>\n<CTestLabel>label3</CTestLabel>\n<CTestLabel>label2</CTestLabel>\nafter) +set_tests_properties(custom_labels PROPERTIES LABELS "label1") + ]]) + run_ctest(TestExtraLabels) +endfunction() +run_extra_labels() diff --git a/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake b/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake new file mode 100644 index 0000000..eaa50d1 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake @@ -0,0 +1,25 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag) +string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}") +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents) + +# Check labels. +STRING(REGEX MATCHALL [[<Label>label1</Label>]] matches "${_test_contents}") +list(LENGTH matches n_matches) +if(NOT n_matches EQUAL 1) + string(APPEND RunCMake_TEST_FAILED "expected 1 match for label1, found ${n_matches}") +endif() +STRING(REGEX MATCHALL [[<Label>label2</Label>]] matches "${_test_contents}") +list(LENGTH matches n_matches) +if(NOT n_matches EQUAL 1) + string(APPEND RunCMake_TEST_FAILED "expected 1 match for label2, found ${n_matches}") +endif() +STRING(REGEX MATCHALL [[<Label>label3</Label>]] matches "${_test_contents}") +list(LENGTH matches n_matches) +if(NOT n_matches EQUAL 1) + string(APPEND RunCMake_TEST_FAILED "expected 1 match for label3, found ${n_matches}") +endif() + +# Check test output. +if(NOT _test_contents MATCHES "<Value>before\nafter\n</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected output in Test.xml") +endif() diff --git a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake index 0095db0..7e0928d 100644 --- a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake +++ b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake @@ -10,13 +10,31 @@ endif() if(NOT _test_contents MATCHES "<Value>1.4847</Value>") string(APPEND RunCMake_TEST_FAILED "Could not find expected measurement value in Test.xml") endif() +# Check the other double measurement. +if(NOT _test_contents MATCHES [[NamedMeasurement type="numeric/double" name="another_custom_value"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag(2) for type='numeric/double' in Test.xml") +endif() +if(NOT _test_contents MATCHES "<Value>1.8474</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected measurement value(2) in Test.xml") +endif() # Check img measurement. if(NOT _test_contents MATCHES [[NamedMeasurement name="TestImage" type="image/png" encoding="base64"]]) string(APPEND RunCMake_TEST_FAILED "Could not find expected <NamedMeasurement> tag for type='image/png' in Test.xml") endif() +# Check img measurement 2. +if(NOT _test_contents MATCHES [[NamedMeasurement name="TestImage2" type="image/png" encoding="base64"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag(2) for type='image/png' in Test.xml") +endif() # Check file measurement. if(NOT _test_contents MATCHES [[NamedMeasurement name="my_test_input_data" encoding="base64" compression="tar/gzip" filename="cmake-logo-16.png" type="file"]]) string(APPEND RunCMake_TEST_FAILED "Could not find expected <NamedMeasurement> tag for type='file' in Test.xml") endif() +# Check file measurement 2. +if(NOT _test_contents MATCHES [[NamedMeasurement name="another_test_input_data" encoding="base64" compression="tar/gzip" filename="cmake-logo-16.png" type="file"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag(2) for type='file' in Test.xml") +endif() diff --git a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake index eb7b497..1ca2e75 100644 --- a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake @@ -1,8 +1,6 @@ include(RunCMake) -if(HAVE_ELF_H) - run_cmake_command(ELF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ELF.cmake) -endif() +run_cmake_command(ELF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ELF.cmake) if(CMAKE_SYSTEM_NAME STREQUAL "AIX") run_cmake_command(XCOFF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/XCOFF.cmake) diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt new file mode 100644 index 0000000..185720b --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt @@ -0,0 +1,4 @@ +.*find_library considered the following locations.* +.*\(lib\)library_no_exist\(\\.tbd\|\\.dylib\|\\.so\|\\.a\).* +.*The item was found at.* +.*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr-windows.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr-windows.txt new file mode 100644 index 0000000..501ec0f --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr-windows.txt @@ -0,0 +1,4 @@ +.*find_library considered the following locations.* +.*\(\|lib\)library_no_exist\(\\.lib\|\\.dll\\.a\|\\.a\).* +.*The item was found at.* +.*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt new file mode 100644 index 0000000..046f680 --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt @@ -0,0 +1,4 @@ +.*find_library considered the following locations.* +.*\(lib\)library_no_exist\(\\.so\|\\.a\).* +.*The item was found at.* +.*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode.cmake b/Tests/RunCMake/find_library/FromScriptMode.cmake new file mode 100644 index 0000000..4d3c699 --- /dev/null +++ b/Tests/RunCMake/find_library/FromScriptMode.cmake @@ -0,0 +1,15 @@ + +if(TEMP_DIR) + file(REMOVE_RECURSE "${TEMP_DIR}") + file(MAKE_DIRECTORY "${TEMP_DIR}") + file(MAKE_DIRECTORY "${TEMP_DIR}/lib") + file(WRITE "${TEMP_DIR}/lib/libcreated.a" "created") +endif() + +set(CMAKE_FIND_DEBUG_MODE 1) +find_library(CREATED_LIBRARY NAMES library_no_exist) + +set(CMAKE_PREFIX_PATH "${TEMP_DIR}") +find_library(CREATED_LIBRARY NAMES created) +message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'") +set(CMAKE_FIND_DEBUG_MODE 0) diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index e297173..ad02c82 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -10,3 +10,5 @@ endif() run_cmake(PrefixInPATH) run_cmake(Required) run_cmake(NO_CACHE) + +run_cmake_script(FromScriptMode "-DTEMP_DIR=${RunCMake_BINARY_DIR}/FromScriptMode-temp") diff --git a/Tests/RunCMake/find_package/CMP0084-OLD-stderr.txt b/Tests/RunCMake/find_package/CMP0084-OLD-stderr.txt new file mode 100644 index 0000000..0db83aa --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0084-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0084-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0084 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/find_package/MissingNormalForceRequired-result.txt b/Tests/RunCMake/find_package/MissingNormalForceRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalForceRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/MissingNormalForceRequired-stderr.txt b/Tests/RunCMake/find_package/MissingNormalForceRequired-stderr.txt new file mode 100644 index 0000000..f6c0b44 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalForceRequired-stderr.txt @@ -0,0 +1,20 @@ +CMake Error at MissingNormalForceRequired.cmake:2 \(find_package\): + No "FindNotHere.cmake" found in CMAKE_MODULE_PATH\. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Warning \(dev\) at MissingNormalForceRequired.cmake:2 \(find_package\): + FindNotHere.cmake must either be part of this project itself, in this case + adjust CMAKE_MODULE_PATH so that it points to the correct location inside + its source tree\. + + Or it must be installed by a package which has already been found via + find_package\(\)\. In this case make sure that package has indeed been found + and adjust CMAKE_MODULE_PATH to contain the location where that package has + installed FindNotHere\.cmake\. This must be a location provided by that + package. This error in general means that the buildsystem of this project + is relying on a Find-module without ensuring that it is actually available\. + +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/find_package/MissingNormalForceRequired.cmake b/Tests/RunCMake/find_package/MissingNormalForceRequired.cmake new file mode 100644 index 0000000..5935316 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalForceRequired.cmake @@ -0,0 +1,3 @@ +set(CMAKE_REQUIRE_FIND_PACKAGE_NotHere ON) +find_package(NotHere MODULE) +message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/RunCMake/find_package/RequiredOptionValuesClash-result.txt b/Tests/RunCMake/find_package/RequiredOptionValuesClash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/RequiredOptionValuesClash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/RequiredOptionValuesClash-stderr.txt b/Tests/RunCMake/find_package/RequiredOptionValuesClash-stderr.txt new file mode 100644 index 0000000..b4fdd98 --- /dev/null +++ b/Tests/RunCMake/find_package/RequiredOptionValuesClash-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at RequiredOptionValuesClash.cmake:4 \(find_package\): + find_package for module Foo was made REQUIRED with + CMAKE_REQUIRE_FIND_PACKAGE_Foo but CMAKE_DISABLE_FIND_PACKAGE_Foo is + enabled. A REQUIRED package cannot be disabled. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RequiredOptionValuesClash.cmake:5 \(message\): + This error must not be reachable\. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/RequiredOptionValuesClash.cmake b/Tests/RunCMake/find_package/RequiredOptionValuesClash.cmake new file mode 100644 index 0000000..04fece7 --- /dev/null +++ b/Tests/RunCMake/find_package/RequiredOptionValuesClash.cmake @@ -0,0 +1,5 @@ +set(CMAKE_DISABLE_FIND_PACKAGE_Foo ON) +set(CMAKE_REQUIRE_FIND_PACKAGE_Foo ON) + +find_package(Foo) +message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 3ba04c8..b20a889 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(ComponentRequiredAndOptional) run_cmake(FromPATHEnv) run_cmake(FromPrefixPath) run_cmake(MissingNormal) +run_cmake(MissingNormalForceRequired) run_cmake(MissingNormalRequired) run_cmake(MissingNormalVersion) run_cmake(MissingNormalWarnNoModuleOld) @@ -23,6 +24,7 @@ run_cmake(PackageRootNestedConfig) run_cmake(PackageRootNestedModule) run_cmake(PolicyPush) run_cmake(PolicyPop) +run_cmake(RequiredOptionValuesClash) run_cmake(SetFoundFALSE) run_cmake(WrongVersion) run_cmake(WrongVersionConfig) diff --git a/Tests/RunCMake/install/CMP0087-OLD-stderr.txt b/Tests/RunCMake/install/CMP0087-OLD-stderr.txt new file mode 100644 index 0000000..5233ebc --- /dev/null +++ b/Tests/RunCMake/install/CMP0087-OLD-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMP0087-OLD/CMakeLists.txt:5 \(cmake_policy\): + The OLD behavior for policy CMP0087 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD.$ diff --git a/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt b/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt index 5b4761c..cf4c540 100644 --- a/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt +++ b/Tests/RunCMake/target_compile_features/cxx_not_enabled-stderr.txt @@ -1,4 +1,2 @@ -^CMake Error at cxx_not_enabled.cmake:[0-9]+ \(target_compile_features\): - target_compile_features cannot use features from non-enabled language CXX -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ +^CMake Error:.*CMake can not determine linker language for target: main.* +CMake Generate step failed. Build files cannot be regenerated correctly.$ |