diff options
author | Nathan Moinvaziri <nathan@nathanm.com> | 2021-04-29 18:18:36 -0700 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2021-05-03 10:48:24 +0200 |
commit | 1cdd7dfad8cdaf36cb7a471346dcbeb2b419b212 (patch) | |
tree | 3822e454116c5d5379b4c0904526b05d19497401 /cmake | |
parent | 8e7087d32a70df4d85e8305811263ad0a4e21a22 (diff) |
Add status messages in test-compress cmake script.
Change filenames used during test to make it more clear what stage they are apart of.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/test-compress.cmake | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/cmake/test-compress.cmake b/cmake/test-compress.cmake index 89f0a7b..321fa54 100644 --- a/cmake/test-compress.cmake +++ b/cmake/test-compress.cmake @@ -92,7 +92,7 @@ macro(diff src1 src2) OUTPUT_FILE ${src2}.diff) file(READ ${src2}.diff DIFF_OUTPUT) - message(STATUS ${DIFF_OUTPUT}) + message(STATUS "Diff:\n${DIFF_OUTPUT}") if(NOT DEFINED ENV{CI}) file(REMOVE ${src1}.hex ${src2}.hex ${src2}.diff) @@ -108,6 +108,10 @@ endif() set(COMPRESS_COMMAND ${COMPRESS_TARGET} ${COMPRESS_ARGS}) +message(STATUS "Compress ${COMPRESS_COMMAND}") +message(STATUS " Input: ${INPUT}") +message(STATUS " Output: ${OUTPUT_BASE}.gz") + execute_process(COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${COMPRESS_COMMAND}" -DINPUT=${INPUT} @@ -129,10 +133,14 @@ endif() set(DECOMPRESS_COMMAND ${DECOMPRESS_TARGET} ${DECOMPRESS_ARGS}) +message(STATUS "Decompress ${DECOMPRESS_COMMAND}") +message(STATUS " Input: ${OUTPUT_BASE}.gz") +message(STATUS " Output: ${OUTPUT_BASE}") + execute_process(COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${DECOMPRESS_COMMAND}" -DINPUT=${OUTPUT_BASE}.gz - -DOUTPUT=${OUTPUT_BASE}.out + -DOUTPUT=${OUTPUT_BASE} "-DSUCCESS_EXIT=${SUCCESS_EXIT}" -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake RESULT_VARIABLE CMD_RESULT) @@ -145,13 +153,13 @@ endif() if(COMPARE) # Compare decompressed output with original input file execute_process(COMMAND ${CMAKE_COMMAND} - -E compare_files ${INPUT} ${OUTPUT_BASE}.out + -E compare_files ${INPUT} ${OUTPUT_BASE} RESULT_VARIABLE CMD_RESULT) if(CMD_RESULT) - diff(${INPUT} ${OUTPUT_BASE}.out) + diff(${INPUT} ${OUTPUT_BASE}) cleanup() - message(FATAL_ERROR "Compare minigzip decompress failed: ${CMD_RESULT}") + message(FATAL_ERROR "Compare decompress failed: ${CMD_RESULT}") endif() endif() @@ -167,10 +175,14 @@ if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T") # Check gzip can decompress our compressed output set(GZ_DECOMPRESS_COMMAND ${GZIP} --decompress) + message(STATUS "Gzip decompress ${GZ_DECOMPRESS_COMMAND}") + message(STATUS " Input: ${OUTPUT_BASE}.gz") + message(STATUS " Output: ${OUTPUT_BASE}-ungzip") + execute_process(COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${GZ_DECOMPRESS_COMMAND}" -DINPUT=${OUTPUT_BASE}.gz - -DOUTPUT=${OUTPUT_BASE}.gzip.out + -DOUTPUT=${OUTPUT_BASE}-ungzip "-DSUCCESS_EXIT=${SUCCESS_EXIT}" -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake RESULT_VARIABLE CMD_RESULT) @@ -182,27 +194,26 @@ if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T") # Compare gzip output with original input file execute_process(COMMAND ${CMAKE_COMMAND} - -E compare_files ${INPUT} ${OUTPUT_BASE}.gzip.out + -E compare_files ${INPUT} ${OUTPUT_BASE}-ungzip RESULT_VARIABLE CMD_RESULT) if(CMD_RESULT) - diff(${INPUT} ${OUTPUT_BASE}.gzip.out) + diff(${INPUT} ${OUTPUT_BASE}-ungzip) cleanup() message(FATAL_ERROR "Compare gzip decompress failed: ${CMD_RESULT}") endif() - if(NOT EXISTS ${OUTPUT_BASE}.gz) - cleanup() - message(FATAL_ERROR "Cannot find gzip compress input: ${INPUT}") - endif() - # Compress input file with gzip set(GZ_COMPRESS_COMMAND ${GZIP} --stdout) + message(STATUS "Gzip compress ${GZ_COMPRESS_COMMAND}") + message(STATUS " Input: ${INPUT}") + message(STATUS " Output: ${OUTPUT_BASE}-gzip.gz") + execute_process(COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${GZ_COMPRESS_COMMAND}" -DINPUT=${INPUT} - -DOUTPUT=${OUTPUT_BASE}.gzip.gz + -DOUTPUT=${OUTPUT_BASE}-gzip.gz "-DSUCCESS_EXIT=${SUCCESS_EXIT}" -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake RESULT_VARIABLE CMD_RESULT) @@ -212,16 +223,20 @@ if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T") message(FATAL_ERROR "Gzip compress failed: ${CMD_RESULT}") endif() - if(NOT EXISTS ${OUTPUT_BASE}.gzip.gz) + if(NOT EXISTS ${OUTPUT_BASE}-gzip.gz) cleanup() - message(FATAL_ERROR "Cannot find decompress gzip input: ${OUTPUT_BASE}.gzip.gz") + message(FATAL_ERROR "Cannot find decompress gzip input: ${OUTPUT_BASE}-gzip.gz") endif() + message(STATUS "Decompress gzip ${DECOMPRESS_COMMAND}") + message(STATUS " Input: ${OUTPUT_BASE}-gzip.gz") + message(STATUS " Output: ${OUTPUT_BASE}-gzip") + # Check decompress target can handle gzip compressed output execute_process(COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${DECOMPRESS_COMMAND}" - -DINPUT=${OUTPUT_BASE}.gzip.gz - -DOUTPUT=${OUTPUT_BASE}.gzip + -DINPUT=${OUTPUT_BASE}-gzip.gz + -DOUTPUT=${OUTPUT_BASE}-gzip "-DSUCCESS_EXIT=${SUCCESS_EXIT}" -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake RESULT_VARIABLE CMD_RESULT) @@ -234,11 +249,11 @@ if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T") if(COMPARE) # Compare original input file with gzip decompressed output execute_process(COMMAND ${CMAKE_COMMAND} - -E compare_files ${INPUT} ${OUTPUT_BASE}.gzip + -E compare_files ${INPUT} ${OUTPUT_BASE}-gzip RESULT_VARIABLE CMD_RESULT) if(CMD_RESULT) - diff(${INPUT} ${OUTPUT_BASE}.gzip) + diff(${INPUT} ${OUTPUT_BASE}-gzip) cleanup() message(FATAL_ERROR "Compare decompress gzip failed: ${CMD_RESULT}") endif() @@ -246,5 +261,4 @@ if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T") endif() endif() - cleanup_always()
\ No newline at end of file |