summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@nathanm.com>2021-05-02 06:05:35 -0700
committerGitHub <noreply@github.com>2021-05-02 15:05:35 +0200
commit78f07cc2c4281276655956999cc6eee982f621e5 (patch)
treec022d6d2803e4453f635447cae1316353003f4bb
parentfc7719dbe979237b6348f7e3fdd9edd9921fae3e (diff)
Decompress gzip compressed archive to a separate file to prevent corruption issues on macOS. (#939)
* Decompress gzip compressed archive to a separate file to prevent corruption issues on macOS. * Clean up fatal error messages in test-compress cmake script.
-rw-r--r--cmake/test-compress.cmake23
1 files changed, 13 insertions, 10 deletions
diff --git a/cmake/test-compress.cmake b/cmake/test-compress.cmake
index e5b1f3b..4e90821 100644
--- a/cmake/test-compress.cmake
+++ b/cmake/test-compress.cmake
@@ -65,10 +65,13 @@ get_filename_component(OUTPUT_DIR "${OUTPUT_BASE}" DIRECTORY)
file(MAKE_DIRECTORY "${OUTPUT_DIR}")
macro(cleanup)
- # Cleanup temporary mingizip files
- file(REMOVE ${OUTPUT_BASE}.gz ${OUTPUT_BASE}.out)
- # Cleanup temporary gzip files
- file(REMOVE ${OUTPUT_BASE}.gzip.gz ${OUTPUT_BASE}.gzip.out)
+ # Cleanup temporary files
+ file(REMOVE
+ ${OUTPUT_BASE}.gz
+ ${OUTPUT_BASE}.out
+ ${OUTPUT_BASE}.gzip
+ ${OUTPUT_BASE}.gzip.gz
+ ${OUTPUT_BASE}.gzip.out)
endmacro()
# Compress input file
@@ -180,34 +183,34 @@ if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T")
message(FATAL_ERROR "Gzip compress failed: ${CMD_RESULT}")
endif()
- if(NOT EXISTS ${OUTPUT_BASE}.gz)
+ if(NOT EXISTS ${OUTPUT_BASE}.gzip.gz)
cleanup()
- message(FATAL_ERROR "Cannot find minigzip decompress input: ${OUTPUT_BASE}.gzip.gz")
+ message(FATAL_ERROR "Cannot find decompress gzip input: ${OUTPUT_BASE}.gzip.gz")
endif()
# 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.out
+ -DOUTPUT=${OUTPUT_BASE}.gzip
"-DSUCCESS_EXIT=${SUCCESS_EXIT}"
-P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake
RESULT_VARIABLE CMD_RESULT)
if(CMD_RESULT)
cleanup()
- message(FATAL_ERROR "Minigzip decompress gzip failed: ${CMD_RESULT}")
+ message(FATAL_ERROR "Decompress gzip failed: ${CMD_RESULT}")
endif()
if(COMPARE)
# Compare original input file with gzip decompressed output
execute_process(COMMAND ${CMAKE_COMMAND}
- -E compare_files ${INPUT} ${OUTPUT_BASE}.gzip.out
+ -E compare_files ${INPUT} ${OUTPUT_BASE}.gzip
RESULT_VARIABLE CMD_RESULT)
if(CMD_RESULT)
cleanup()
- message(FATAL_ERROR "Compare minigzip decompress gzip failed: ${CMD_RESULT}")
+ message(FATAL_ERROR "Compare decompress gzip failed: ${CMD_RESULT}")
endif()
endif()
endif()