diff options
Diffstat (limited to 'Tests')
45 files changed, 239 insertions, 20 deletions
diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake index 9c9fe09..07a65bf 100644 --- a/Tests/BootstrapTest.cmake +++ b/Tests/BootstrapTest.cmake @@ -1,7 +1,12 @@ file(MAKE_DIRECTORY "${bin_dir}") -message(STATUS "running bootstrap: ${bootstrap}") +include(ProcessorCount) +ProcessorCount(nproc) +if(NOT nproc EQUAL 0) + set(parallel_arg --parallel=${nproc}) +endif() +message(STATUS "running bootstrap: ${bootstrap} ${parallel_arg}") execute_process( - COMMAND ${bootstrap} + COMMAND ${bootstrap} ${parallel_arg} WORKING_DIRECTORY "${bin_dir}" RESULT_VARIABLE result ) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7df9403..5d72e5c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3081,8 +3081,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release -P ${CMAKE_CURRENT_SOURCE_DIR}/BootstrapTest.cmake ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest") - # Make this test run early during parallel execution - set_tests_properties(BootstrapTest PROPERTIES COST 5000) + # This test will use all processors. + set_tests_properties(BootstrapTest PROPERTIES RUN_SERIAL 1) # provide more time for the bootstrap test get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT) diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 56fcc5d..23832da 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -20,16 +20,9 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile" AND configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY) # now set up the test: - if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" - CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n" - ) - else() - get_target_property(cmakeLocation cmake LOCATION) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" - "CMAKE = \"${cmakeLocation}\"\n" - ) - endif() + file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" + CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n" + ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 27f33a2..4f2f434 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -171,6 +171,13 @@ add_executable(Alias::SomeExe ALIAS someexe) add_library(Alias::SomeLib ALIAS empty1) +add_library(importedFallback STATIC IMPORTED) +set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET importedFallback PROPERTY IMPORTED_LOCATION fallback_loc) +set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG) +set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_RELEASE "") + add_custom_target(check-part3 ALL COMMAND ${CMAKE_COMMAND} -Dtest_version_greater_1=$<VERSION_GREATER:1.0,1.1.1> @@ -184,6 +191,7 @@ add_custom_target(check-part3 ALL -Dtest_imported_release=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -Dtest_imported_relwithdebinfo=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -Dtest_imported_minsizerel=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> + -Dtest_imported_fallback=$<STREQUAL:$<TARGET_FILE_NAME:importedFallback>,fallback_loc> -Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>> -Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>> -Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>> diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 70ccfe1..e12d8c6 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -21,6 +21,8 @@ foreach(c debug release relwithdebinfo minsizerel) endif() endforeach() +check(test_imported_fallback "1") + check(test_alias_file_exe "1") check(test_alias_file_lib "1") check(test_alias_target_name "1") diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt index ade0a3c..bf937e6 100644 --- a/Tests/MacRuntimePath/A/CMakeLists.txt +++ b/Tests/MacRuntimePath/A/CMakeLists.txt @@ -40,21 +40,30 @@ target_link_libraries(test3 framework) add_executable(test4 test1.cpp) target_link_libraries(test4 shared2) +# executable to test a shared library dependency with build rpath +add_executable(test5 test1.cpp) + +# avoid linking by 'target_link_libraries' so CMake +# will not be able to set correct RPATH automatically +add_dependencies(test5 shared) +target_link_libraries(test5 "$<TARGET_FILE:shared>") +set_target_properties(test5 PROPERTIES BUILD_RPATH "@loader_path/../lib") + set_target_properties(shared shared2 framework PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") -set_target_properties(test1 test2 test3 test4 PROPERTIES +set_target_properties(test1 test2 test3 test4 test5 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config} CONFIG) set_target_properties(shared shared2 framework PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${CONFIG} "${CMAKE_CURRENT_BINARY_DIR}/${config}/lib") - set_target_properties(test1 test2 test3 test4 PROPERTIES + set_target_properties(test1 test2 test3 test4 test5 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${CONFIG} "${CMAKE_CURRENT_BINARY_DIR}/${config}/bin") endforeach() -foreach(test test1 test2 test3 test4) +foreach(test test1 test2 test3 test4 test5) add_custom_target(${test}_run ALL COMMAND ${test} DEPENDS ${test} diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt index ed2c7d4..f764b3a 100644 --- a/Tests/MathTest/CMakeLists.txt +++ b/Tests/MathTest/CMakeLists.txt @@ -10,6 +10,9 @@ set(expressions "1 +(3*4) + 10 >> 2" "10000 / 20 / 4" "10000 / (20 / 4)" + "-1 + +1" + "+1 - -1" + "+1 - - + + -(-3 + - - +1)" ) set(FILE_EXPRESSIONS "") diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index 1018dd8..737e17a 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -45,6 +45,8 @@ ExternalData_Add_Test(Data1 -D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat} -D Directory=DATA{Directory/,A.dat,REGEX:[BC].dat} -D DirRecurse=DATA{DirRecurse/,RECURSE:,A.dat,REGEX:[BC].dat} + -D MultipleAlgorithmNoSHA1=DATA{MultipleAlgorithmNoSHA1.dat} + -D MultipleAlgorithmNoMD5=DATA{MultipleAlgorithmNoMD5.dat} -D "Semicolons=DATA{Data.dat}\\;DATA{Data.dat}" -P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake ) diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5 b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5 new file mode 100644 index 0000000..a956f36 --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.md5 @@ -0,0 +1 @@ +29848e54a4d0343f138ab14419b863de diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1 b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1 new file mode 100644 index 0000000..43a3540 --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoMD5.dat.sha1 @@ -0,0 +1 @@ +2af59a7022024974f3b8521b7ed8137c996a79f1 diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5 b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5 new file mode 100644 index 0000000..1906cbf --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.md5 @@ -0,0 +1 @@ +08cfcf221f76ace7b906b312284e73d7 diff --git a/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1 b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1 new file mode 100644 index 0000000..65781b2 --- /dev/null +++ b/Tests/Module/ExternalData/MultipleAlgorithmNoSHA1.dat.sha1 @@ -0,0 +1 @@ +223b134e6e3a9bf34aa7531c009d97cff6b0d8a3 diff --git a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake new file mode 100644 index 0000000..99c6cae --- /dev/null +++ b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake @@ -0,0 +1,14 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") + set(CPACK_RPM_MAIN_COMPONENT "") +else() + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() + +set(CPACK_PACKAGE_NAME "main_component") diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake new file mode 100644 index 0000000..69603dd --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake @@ -0,0 +1,13 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "0") + +if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") + set(EXPECTED_FILES_COUNT "3") + set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") + set(EXPECTED_FILE_2 "main_component*-headers.rpm") + set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") + set(EXPECTED_FILE_3 "main_component*-libs.rpm") + set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/CMakeLists.txt$") +endif() diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt new file mode 100644 index 0000000..dff163d --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt @@ -0,0 +1,3 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-headers.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-libs.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component.spec$ diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt new file mode 100644 index 0000000..4d8ac6e --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt @@ -0,0 +1 @@ +CPACK_RPM_MAIN_COMPONENT set to non existing component. diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake new file mode 100644 index 0000000..dc49343 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake @@ -0,0 +1,30 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "0") + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + set(EXPECTED_FILES_COUNT "4") + set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") + set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm") + set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$") + set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm") + set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$") + + set(EXPECTED_FILE_4 "single_debuginfo-debuginfo*.rpm") + set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") + set(EXPECTED_FILES_COUNT "2") + set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") + + set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") + set(EXPECTED_FILES_COUNT "2") + set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm") + set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$") + + set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +endif() diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt new file mode 100644 index 0000000..d80939f --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_components-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt new file mode 100644 index 0000000..86396db --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt @@ -0,0 +1,3 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt new file mode 100644 index 0000000..454283c --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt @@ -0,0 +1 @@ +CPack Error: CPACK_RPM_MAIN_COMPONENT not set but it is mandatory with CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE being set. diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt new file mode 100644 index 0000000..080c4ff --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt new file mode 100644 index 0000000..665597c --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_main-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt new file mode 100644 index 0000000..b64b1f5 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt @@ -0,0 +1 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$ diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt new file mode 100644 index 0000000..f4c1bef --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt @@ -0,0 +1,3 @@ +^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec +CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 60d42ac..474ee33 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -12,11 +12,13 @@ run_cpack_test(DEPENDENCIES "RPM;DEB" true) run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(CUSTOM_NAMES "RPM;DEB" true) +run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false) run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) run_cpack_test(RPM_DIST "RPM" false) run_cpack_test(INSTALL_SCRIPTS "RPM" false) run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true) run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true) run_cpack_test(DEBUGINFO "RPM" true) +run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true) run_cpack_test(LONG_FILENAMES "DEB" false) run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false) diff --git a/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake b/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake new file mode 100644 index 0000000..ae4995e --- /dev/null +++ b/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake @@ -0,0 +1,56 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# PGI compiler doesn't add build id to binaries by default +if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") + string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") +endif() + +if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") + set(CPACK_RPM_COMPONENT_INSTALL "ON") +endif() + +set(CMAKE_BUILD_TYPE Debug) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) + install(TARGETS test_lib DESTINATION bas COMPONENT libs) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") + set(CPACK_COMPONENTS_ALL applications) +endif() + +set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component") + set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) + set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) +endif() + +set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") + +set(CPACK_PACKAGE_NAME "single_debuginfo") diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 8bc2a58..ad2a651 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -27,10 +27,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) expected_content_list "${PACKAGE_CONTENT}") if(NOT expected_content_list) + string(REPLACE "\n" "\n actual> " msg_actual "\n${PACKAGE_CONTENT}") + string(REPLACE "\n" "\n expect> " msg_expected "\n${EXPECTED_FILE_CONTENT_${file_no_}}") message(FATAL_ERROR "Unexpected file content for file No. '${file_no_}'!\n" - " Content: '${PACKAGE_CONTENT}'\n\n" - " Expected: '${EXPECTED_FILE_CONTENT_${file_no_}}'" + "The content was:${msg_actual}\n" + "which does not match:${msg_expected}\n" "${output_error_message}") endif() else() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt index e4dbb71..d4e5b29 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) in CMakeLists.txt: +CMake Warning \(dev\) at TARGET_PROPERTY-LOCATION.cmake:2 \(add_library\): Policy CMP0026 is not set: Disallow use of the LOCATION target property. Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy command to set the policy and suppress this warning. @@ -7,4 +7,6 @@ CMake Warning \(dev\) in CMakeLists.txt: name directly with add_custom_command, or use the generator expression \$<TARGET_FILE>, as appropriate. +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/GeneratorToolset/BadToolsetHostArch-result.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt new file mode 100644 index 0000000..5737e95 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + .* + + does not recognize the toolset + + Test Toolset,host=x6[45] + + that was specified\.$ diff --git a/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/BadToolsetHostArch.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index 283a2a0..e8ce47d 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -6,6 +6,21 @@ run_cmake(NoToolset) if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) + if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[245]") + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") + run_cmake(TestToolsetHostArchBoth) + set(RunCMake_GENERATOR_TOOLSET ",host=x64") + run_cmake(TestToolsetHostArchOnly) + set(RunCMake_GENERATOR_TOOLSET "host=x64") + run_cmake(TestToolsetHostArchOnly) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset") + run_cmake(TestToolsetHostArchNone) + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x65") + run_cmake(BadToolsetHostArch) + else() + set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64") + run_cmake(BadToolsetHostArch) + endif() else() set(RunCMake_GENERATOR_TOOLSET "Bad Toolset") run_cmake(BadToolset) diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt new file mode 100644 index 0000000..f0b6d46 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='x64' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake new file mode 100644 index 0000000..26926f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchBoth.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt new file mode 100644 index 0000000..576b40c --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake new file mode 100644 index 0000000..26926f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchNone.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'") diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt new file mode 100644 index 0000000..8271bd4 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_VS_PLATFORM_TOOLSET='v[0-9]+' +-- CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='x64' diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake new file mode 100644 index 0000000..26926f9 --- /dev/null +++ b/Tests/RunCMake/GeneratorToolset/TestToolsetHostArchOnly.cmake @@ -0,0 +1,2 @@ +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE='${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}'") diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt b/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Ninja/NinjaToolMissing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt b/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt new file mode 100644 index 0000000..1214288 --- /dev/null +++ b/Tests/RunCMake/Ninja/NinjaToolMissing-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Running + + 'ninja-tool-missing' '--version' + + failed with: diff --git a/Tests/RunCMake/Ninja/NinjaToolMissing.cmake b/Tests/RunCMake/Ninja/NinjaToolMissing.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Ninja/NinjaToolMissing.cmake diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 1d3639d..7b4e51e 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -15,6 +15,12 @@ else() message(FATAL_ERROR "'ninja --version' reported:\n${ninja_out}") endif() +function(run_NinjaToolMissing) + set(RunCMake_MAKE_PROGRAM ninja-tool-missing) + run_cmake(NinjaToolMissing) +endfunction() +run_NinjaToolMissing() + function(run_CMP0058 case) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build) diff --git a/Tests/RunCMake/ctest_build/CMakeLists.txt.in b/Tests/RunCMake/ctest_build/CMakeLists.txt.in index 82cb7c4..133ae36 100644 --- a/Tests/RunCMake/ctest_build/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_build/CMakeLists.txt.in @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.1) +@CASE_CMAKELISTS_PREFIX_CODE@ project(CTestBuild@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 324f25c..1092d2a 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -13,6 +13,11 @@ function(run_BuildFailure) set(CASE_CMAKELISTS_SUFFIX_CODE [[ add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) ]]) + set(CASE_CMAKELISTS_PREFIX_CODE [[ +if(NOT CTEST_USE_LAUNCHERS) + message(FATAL_ERROR "CTEST_USE_LAUNCHERS not set") +endif() +]]) set(CASE_TEST_PREFIX_CODE [[ cmake_policy(SET CMP0061 NEW) ]]) diff --git a/Tests/RunCMake/ctest_build/test.cmake.in b/Tests/RunCMake/ctest_build/test.cmake.in index 768f1c6..6f15ec9 100644 --- a/Tests/RunCMake/ctest_build/test.cmake.in +++ b/Tests/RunCMake/ctest_build/test.cmake.in @@ -9,6 +9,7 @@ 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_USE_LAUNCHERS TRUE) set(ctest_build_args "@CASE_CTEST_BUILD_ARGS@") ctest_start(Experimental) |