diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-07-13 13:47:31 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-07-17 13:07:10 (GMT) |
commit | 36ef57a9392fb5b3e688ff95547836d433db01c9 (patch) | |
tree | 1a3b31d5d60c7e1cf19401f707030f2f357f2369 /Tests | |
parent | 11ca374b284603278eded2548bbc9d7de88706e9 (diff) | |
download | CMake-36ef57a9392fb5b3e688ff95547836d433db01c9.zip CMake-36ef57a9392fb5b3e688ff95547836d433db01c9.tar.gz CMake-36ef57a9392fb5b3e688ff95547836d433db01c9.tar.bz2 |
Tests: Add test for cmake --build . --target package
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CPack/CPackTestHelpers.cmake | 30 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RPM/default_expected_stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 |
3 files changed, 25 insertions, 8 deletions
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 447b08b..8c9f4b4 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -1,10 +1,14 @@ cmake_policy(SET CMP0057 NEW) -function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE) +function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - set(full_test_name_ "${TEST_NAME}") + if(package_target) + set(full_test_name_ "${TEST_NAME}-package-target") + else() + set(full_test_name_ "${TEST_NAME}") + endif() + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_test_name_}-build") if(SUBTEST_SUFFIX) set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest") @@ -67,9 +71,15 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK unset(pack_params_) endif() + if(package_target) + set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package) + else() + set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_}) + endif() + # execute cpack execute_process( - COMMAND ${CMAKE_CPACK_COMMAND} ${pack_params_} + COMMAND ${cpack_command_} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" RESULT_VARIABLE "result_" OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" @@ -113,18 +123,24 @@ endfunction() function(run_cpack_test TEST_NAME types build PACKAGING_TYPES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" false) + endforeach() +endfunction() + +function(run_cpack_test_package_target TEST_NAME types build PACKAGING_TYPES) + foreach(packaging_type_ IN LISTS PACKAGING_TYPES) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" true) endforeach() endfunction() function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES) foreach(suffix_ IN LISTS SUBTEST_SUFFIXES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}" false) endforeach() endforeach() endfunction() function(run_cpack_source_test TEST_NAME types) - run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "") + run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "" false) endfunction() diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index 4a0e4e6..f02f9d6 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index bc25b12..33ffa14 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -19,6 +19,7 @@ run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") |