]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Add status messages in test-compress cmake script.
authorNathan Moinvaziri <nathan@nathanm.com>
Fri, 30 Apr 2021 01:18:36 +0000 (18:18 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 3 May 2021 08:48:24 +0000 (10:48 +0200)
Change filenames used during test to make it more clear what stage they are apart of.

cmake/test-compress.cmake

index 89f0a7b256c4ea4146dfd2087795b78a2e9f1b71..321fa543018f7b563dff9c3e4cc8a567238bf92e 100644 (file)
@@ -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