From 7929912b371f8fc7ec7637a9e834e784b4a4414c Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 5 Jul 2019 12:16:48 +0200 Subject: [PATCH] CPackComponentsDEB test: simplify error reporting --- ...CPackVerifyResult-components-depend1.cmake | 18 ++++---------- ...CPackVerifyResult-components-depend2.cmake | 24 +++++-------------- ...nCPackVerifyResult-components-source.cmake | 11 ++------- .../RunCPackVerifyResult-compression.cmake | 8 +------ 4 files changed, 13 insertions(+), 48 deletions(-) diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake index fa8b5a4e4e..beccc4691e 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake @@ -36,7 +36,6 @@ endif() # dpkg-deb checks for the dependencies of the packages find_program(DPKGDEB_EXECUTABLE dpkg-deb) if(DPKGDEB_EXECUTABLE) - set(dpkgdeb_output_errors_all "") foreach(_f IN LISTS actual_output) # extracts the metadata from the package @@ -56,30 +55,21 @@ if(DPKGDEB_EXECUTABLE) if(dpkg_package_name STREQUAL "mylib-applications") if(NOT dpkg_depends STREQUAL "depend-application") - set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} - "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'depend-application'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'depend-application'\n") endif() elseif(dpkg_package_name STREQUAL "mylib-headers") if(NOT dpkg_depends STREQUAL "mylib-libraries (= 1.0.3), depend-headers") - set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} - "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'mylib-libraries (= 1.0.3), depend-headers'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'mylib-libraries (= 1.0.3), depend-headers'\n") endif() elseif(dpkg_package_name STREQUAL "mylib-libraries") if(NOT dpkg_depends STREQUAL "depend-default") - set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} - "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'depend-default'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'depend-default'\n") endif() else() - set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} - "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n") + message(SEND_ERROR "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n") endif() endforeach() - - - if(NOT dpkgdeb_output_errors_all STREQUAL "") - message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}") - endif() else() message("dpkg-deb executable not found - skipping dpkg-deb test") endif() diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake index 1d45b78a40..88f3248d9b 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake @@ -36,7 +36,6 @@ endif() # dpkg-deb checks for the summary of the packages find_program(DPKGDEB_EXECUTABLE dpkg-deb) if(DPKGDEB_EXECUTABLE) - set(dpkgdeb_output_errors_all "") foreach(_f IN LISTS actual_output) # extracts the metadata from the package @@ -57,10 +56,8 @@ if(DPKGDEB_EXECUTABLE) if(dpkg_package_name STREQUAL "mylib-applications") find_program(DPKG_SHLIBDEP_EXECUTABLE dpkg-shlibdeps) if(DPKG_SHLIBDEP_EXECUTABLE) - string(FIND "${dpkg_depends}" "lib" index_libwhatever) - if(NOT index_libwhatever GREATER "-1") - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' does not contain any 'lib'\n") + if(NOT dpkg_depends MATCHES "lib") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' does not contain any 'lib'\n") endif() else() message("dpkg-shlibdeps executable not found - skipping dpkg-shlibdeps test") @@ -69,29 +66,20 @@ if(DPKGDEB_EXECUTABLE) # should not contain the default string(FIND "${dpkg_depends}" "depend-default" index_default) if(index_default GREATER "0") - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' does contains 'depend-default'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' does contains 'depend-default'\n") endif() elseif(dpkg_package_name STREQUAL "mylib-headers") if(NOT dpkg_depends STREQUAL "mylib-libraries (= 1.0.3), depend-headers") - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'mylib-libraries (= 1.0.3), depend-headers'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'mylib-libraries (= 1.0.3), depend-headers'\n") endif() elseif(dpkg_package_name STREQUAL "mylib-libraries") if(NOT dpkg_depends STREQUAL "depend-default") - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'depend-default'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect dependencies for package ${dpkg_package_name}: '${dpkg_depends}' != 'depend-default'\n") endif() else() - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n") + message(SEND_ERROR "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n") endif() - endforeach() - - if(NOT dpkgdeb_output_errors_all STREQUAL "") - message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}") - endif() else() message("dpkg-deb executable not found - skipping dpkg-deb test") endif() diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake index 3830ca53e0..3454dca899 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake @@ -36,7 +36,6 @@ endif() # dpkg-deb checks for the summary of the packages find_program(DPKGDEB_EXECUTABLE dpkg-deb) if(DPKGDEB_EXECUTABLE) - set(dpkgdeb_output_errors_all "") foreach(_f IN LISTS actual_output) # extracts the metadata from the package @@ -56,20 +55,14 @@ if(DPKGDEB_EXECUTABLE) if(NOT dpkg_package_name STREQUAL "mylib-applications") if(NOT dpkg_package_source STREQUAL "test-source") - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: Incorrect source for package '${dpkg_package_name}': '${dpkg_package_source}' instead of 'test-source'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect source for package '${dpkg_package_name}': '${dpkg_package_source}' instead of 'test-source'\n") endif() else() if(NOT dpkg_package_source STREQUAL "test-other-source") - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: Incorrect source for package '${dpkg_package_name}': '${dpkg_package_source}' instead of 'test-other-source'\n") + message(SEND_ERROR "dpkg-deb: ${_f}: Incorrect source for package '${dpkg_package_name}': '${dpkg_package_source}' instead of 'test-other-source'\n") endif() endif() endforeach() - - if(NOT dpkgdeb_output_errors_all STREQUAL "") - message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}") - endif() else() message("dpkg-deb executable not found - skipping dpkg-deb test") endif() diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake index 06d24c49b0..764fe9df4b 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake @@ -33,7 +33,6 @@ endif() # dpkg-deb checks find_program(DPKGDEB_EXECUTABLE dpkg-deb) if(DPKGDEB_EXECUTABLE) - set(dpkgdeb_output_errors_all "") foreach(_f IN LISTS actual_output) run_dpkgdeb(dpkg_output FILENAME "${_f}" @@ -41,14 +40,9 @@ if(DPKGDEB_EXECUTABLE) # message(FATAL_ERROR "output = '${dpkg_output}'") if(dpkg_output STREQUAL "") - set(dpkgdeb_output_errors_all "${dpkgdeb_output_errors_all}" - "dpkg-deb: ${_f}: empty content returned by dpkg-deb") + message(SEND_ERROR "dpkg-deb: ${_f}: empty content returned by dpkg-deb") endif() endforeach() - - if(NOT dpkgdeb_output_errors_all STREQUAL "") - message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}") - endif() else() message("dpkg-deb executable not found - skipping dpkg-deb test") endif()