diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 15:02:53 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2016-11-27 22:20:35 (GMT) |
commit | 2cc479bdac84843d0284573cf801ee526e798c54 (patch) | |
tree | 161a2df8d37a5ea79c25b07bc987372c69a63248 /Tests/RunCMake/CPack/tests/SUGGESTS | |
parent | 181e9bb6128c9ad4043c41ef270c79318146e1ad (diff) | |
download | CMake-2cc479bdac84843d0284573cf801ee526e798c54.zip CMake-2cc479bdac84843d0284573cf801ee526e798c54.tar.gz CMake-2cc479bdac84843d0284573cf801ee526e798c54.tar.bz2 |
Tests: remove generator prefix from CPack test name
Diffstat (limited to 'Tests/RunCMake/CPack/tests/SUGGESTS')
4 files changed, 37 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake new file mode 100644 index 0000000..6142eb3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake @@ -0,0 +1,2 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt new file mode 100644 index 0000000..feb296c --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt @@ -0,0 +1 @@ +^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake new file mode 100644 index 0000000..32cc6d1 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake @@ -0,0 +1,31 @@ +execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --querytags + OUTPUT_VARIABLE RPMBUILD_CAPS + RESULT_VARIABLE RPMBUILD_CAPS_RESULT) + +if(NOT RPMBUILD_CAPS_RESULT) + string(REPLACE "\n" ";" RPMBUILD_CAPS "${RPMBUILD_CAPS}") + cmake_policy(PUSH) + cmake_policy(SET CMP0057 NEW) + if(SUGGESTS IN_LIST RPMBUILD_CAPS) + set(should_contain_suggests_tag_ true) + endif() + cmake_policy(POP) +endif() + +# Only verify that suggests tag is present only if that tag is supported. +# If it is not supported the rpm package was corretly generated by ignoring +# that tag and that was already checked by expected files test. +if(should_contain_suggests_tag_) + execute_process(COMMAND ${RPM_EXECUTABLE} -q --suggests -p "${FOUND_FILE_1}" + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + RESULT_VARIABLE rpm_result_ + OUTPUT_VARIABLE rpm_output_ + ERROR_VARIABLE error_variable_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(rpm_result_ OR NOT rpm_output_ STREQUAL "libsuggested") + message(FATAL_ERROR "RPM_SUGGESTED package error: no suggested packages" + " (result: '${rpm_result_}'; output: '${rpm_output_}';" + " error: '${error_variable_}')") + endif() +endif() diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake new file mode 100644 index 0000000..dc90ae8 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested") |