From 3eb0f08084173f344851a36876864c58a301d5ea Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sat, 13 May 2017 23:19:51 +0200 Subject: Improved CPack tests error logging --- Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake | 2 +- Tests/RunCMake/CPack/STGZ/Helpers.cmake | 2 +- Tests/RunCMake/CPack/VerifyResult.cmake | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake index ce039f5..99d3155 100644 --- a/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake +++ b/Tests/RunCMake/CPack/ArchiveCommon/common_helpers.cmake @@ -33,7 +33,7 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - findExpectedFile("${FILE_NO}" "file_") + findExpectedFile("${FILE_NO}" "file_" "glob_expr_") # component and monolithic packages differ for some reason by either having # package filename prefix in path or not diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake index 08224d3..68b1eab 100644 --- a/Tests/RunCMake/CPack/STGZ/Helpers.cmake +++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake @@ -35,7 +35,7 @@ function(getPackageContentList FILE RESULT_VAR) endfunction() function(toExpectedContentList FILE_NO CONTENT_VAR) - findExpectedFile("${FILE_NO}" "file_") + findExpectedFile("${FILE_NO}" "file_" "glob_expr_") get_filename_component(prefix_ "${file_}" NAME) # NAME_WE removes everything after the dot and dot is in version so replace instead diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 59751a7..470ebf7 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR) -function(findExpectedFile FILE_NO RESULT_VAR) +function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_VAR) if(NOT DEFINED EXPECTED_FILE_${FILE_NO}) # explicit file name regex was not provided - construct one from other data # set defaults if parameters are not provided if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_NAME) @@ -21,6 +21,7 @@ function(findExpectedFile FILE_NO RESULT_VAR) file(GLOB found_file_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${FILE_NO}}") set(${RESULT_VAR} "${found_file_}" PARENT_SCOPE) + set(${GLOBING_EXPR_VAR} "${EXPECTED_FILE_${FILE_NO}}" PARENT_SCOPE) endfunction() include("${config_file}") @@ -39,7 +40,8 @@ include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/ExpectedFiles.cmake") # check that expected generated files exist and contain expected content if(NOT EXPECTED_FILES_COUNT EQUAL 0) foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT}) - findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}") + findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}" + "EXPECTED_FILE_${file_no_}") list(APPEND foundFiles_ "${FOUND_FILE_${file_no_}}") list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_) -- cgit v0.12