fix: breakpad use miniz
Some checks failed
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 1m34s
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Successful in 2m46s
sm-rpc / build (Debug, host.gcc) (push) Failing after 1m28s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Successful in 2m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Successful in 2m8s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Successful in 5m35s
sm-rpc / build (Release, host.gcc) (push) Failing after 1m55s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Successful in 7m21s
Some checks failed
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 1m34s
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Successful in 2m46s
sm-rpc / build (Debug, host.gcc) (push) Failing after 1m28s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Successful in 2m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Successful in 2m8s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Successful in 5m35s
sm-rpc / build (Release, host.gcc) (push) Failing after 1m55s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Successful in 7m21s
This commit is contained in:
287
third_party/zlib-ng/test/cmake/compress-and-verify.cmake
vendored
Normal file
287
third_party/zlib-ng/test/cmake/compress-and-verify.cmake
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
# compress-and-verify.cmake -- Runs a test against an input file to make sure that the specified
|
||||
# targets are able to to compress and then decompress successfully. Optionally verify
|
||||
# the results with gzip. Output files are generated with unique names to prevent parallel
|
||||
# tests from corrupting one another. Default target arguments are compatible with minigzip.
|
||||
|
||||
# Copyright (C) 2021 Nathan Moinvaziri
|
||||
# Licensed under the Zlib license, see LICENSE.md for details
|
||||
|
||||
# that test a specific input file for compression or decompression.
|
||||
|
||||
# Required Variables
|
||||
# INPUT - Input file to test
|
||||
# TARGET or - Command to run for both compress and decompress
|
||||
# COMPRESS_TARGET and - Command to run to compress input file
|
||||
# DECOMPRESS_TARGET - Command to run to decompress output file
|
||||
|
||||
# Optional Variables
|
||||
# TEST_NAME - Name of test to use when constructing output file paths
|
||||
# COMPRESS_ARGS - Arguments to pass for compress command (default: -c -k)
|
||||
# DECOMPRESS_ARGS - Arguments to pass to decompress command (default: -d -c)
|
||||
|
||||
# GZIP_VERIFY - Verify that gzip can decompress the COMPRESS_TARGET output and
|
||||
# verify that DECOMPRESS_TARGET can decompress gzip output of INPUT
|
||||
# COMPARE - Verify decompressed output is the same as input
|
||||
# FILEMODE - Pass data to/from (de)compressor using files instead of stdin/stdout
|
||||
# SUCCESS_EXIT - List of successful exit codes (default: 0, ie: 0;1)
|
||||
|
||||
if(TARGET)
|
||||
set(COMPRESS_TARGET ${TARGET})
|
||||
set(DECOMPRESS_TARGET ${TARGET})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED INPUT OR NOT DEFINED COMPRESS_TARGET OR NOT DEFINED DECOMPRESS_TARGET)
|
||||
message(FATAL_ERROR "Compress test arguments missing")
|
||||
endif()
|
||||
|
||||
# Set default values
|
||||
if(NOT DEFINED COMPARE)
|
||||
set(COMPARE ON)
|
||||
endif()
|
||||
if(NOT DEFINED FILEMODE)
|
||||
set(FILEMODE OFF)
|
||||
endif()
|
||||
if(NOT DEFINED COMPRESS_ARGS)
|
||||
set(COMPRESS_ARGS -3 -k)
|
||||
if(NOT FILEMODE)
|
||||
list(APPEND COMPRESS_ARGS -c)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT DEFINED DECOMPRESS_ARGS)
|
||||
set(DECOMPRESS_ARGS -d -k)
|
||||
if(NOT FILEMODE)
|
||||
list(APPEND DECOMPRESS_ARGS -c)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT DEFINED GZIP_VERIFY)
|
||||
set(GZIP_VERIFY ON)
|
||||
endif()
|
||||
if(NOT DEFINED SUCCESS_EXIT)
|
||||
set(SUCCESS_EXIT 0)
|
||||
endif()
|
||||
|
||||
# Use test name from input file name
|
||||
if(NOT DEFINED TEST_NAME)
|
||||
get_filename_component(TEST_NAME "${INPUT}" NAME)
|
||||
endif()
|
||||
|
||||
# Generate unique output path so multiple tests can be executed at the same time
|
||||
string(RANDOM LENGTH 6 UNIQUE_ID)
|
||||
string(REPLACE "." "-" TEST_NAME "${TEST_NAME}")
|
||||
set(OUTPUT_BASE "${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/${TEST_NAME}-${UNIQUE_ID}")
|
||||
|
||||
# Ensure directory exists for output files
|
||||
get_filename_component(OUTPUT_DIR "${OUTPUT_BASE}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${OUTPUT_DIR}")
|
||||
|
||||
# Cleanup temporary files
|
||||
macro(cleanup_always)
|
||||
file(GLOB TEMP_FILES ${OUTPUT_BASE}*)
|
||||
file(REMOVE ${TEMP_FILES})
|
||||
endmacro()
|
||||
# Clean up temporary files if not on CI
|
||||
macro(cleanup)
|
||||
if(NOT DEFINED ENV{CI})
|
||||
cleanup_always()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Show differences between two files
|
||||
macro(diff src1 src2)
|
||||
find_program(XXD xxd)
|
||||
if(XXD)
|
||||
find_program(DIFF diff)
|
||||
if(DIFF)
|
||||
set(XXD_COMMAND ${XXD} ${src1} ${src1}.hex)
|
||||
execute_process(COMMAND ${XXD_COMMAND})
|
||||
set(XXD_COMMAND ${XXD} ${src2} ${src2}.hex)
|
||||
execute_process(COMMAND ${XXD_COMMAND})
|
||||
|
||||
set(DIFF_COMMAND ${DIFF} -u ${src1}.hex ${src2}.hex)
|
||||
execute_process(COMMAND ${DIFF_COMMAND}
|
||||
OUTPUT_FILE ${src2}.diff)
|
||||
|
||||
file(READ ${src2}.diff DIFF_OUTPUT)
|
||||
message(STATUS "Diff:\n${DIFF_OUTPUT}")
|
||||
|
||||
if(NOT DEFINED ENV{CI})
|
||||
file(REMOVE ${src1}.hex ${src2}.hex ${src2}.diff)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(exec_streams tcmd tsrc tdst)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${tcmd}"
|
||||
-DINPUT=${tsrc}
|
||||
-DOUTPUT=${tdst}
|
||||
"-DSUCCESS_EXIT=${SUCCESS_EXIT}"
|
||||
-P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
endmacro()
|
||||
|
||||
macro(exec_files tcmd tsrc)
|
||||
execute_process(COMMAND
|
||||
${tcmd} ${tsrc}
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
endmacro()
|
||||
|
||||
# Compress input file
|
||||
if(NOT EXISTS ${INPUT})
|
||||
message(FATAL_ERROR "Cannot find compress input: ${INPUT}")
|
||||
endif()
|
||||
|
||||
set(COMPRESS_COMMAND ${COMPRESS_TARGET} ${COMPRESS_ARGS})
|
||||
|
||||
set(INPUT_FILE ${OUTPUT_BASE})
|
||||
|
||||
# Make CMake copy and rename file in one operation
|
||||
# The copied file permissions is standard 644 (-rw-r--r--)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.19")
|
||||
set(CONFIGURE_NO_SOURCE_PERMISSIONS NO_SOURCE_PERMISSIONS)
|
||||
endif()
|
||||
configure_file(${INPUT} ${INPUT_FILE} COPYONLY ${CONFIGURE_NO_SOURCE_PERMISSIONS})
|
||||
|
||||
message(STATUS "Compress ${COMPRESS_COMMAND}")
|
||||
message(STATUS " Source file: ${INPUT}")
|
||||
message(STATUS " Compression input file: ${INPUT_FILE}")
|
||||
message(STATUS " Output: ${OUTPUT_BASE}.gz")
|
||||
|
||||
if(FILEMODE)
|
||||
exec_files("${COMPRESS_COMMAND}" "${INPUT_FILE}")
|
||||
else()
|
||||
exec_streams("${COMPRESS_COMMAND}" "${INPUT_FILE}" "${OUTPUT_BASE}.gz")
|
||||
endif()
|
||||
|
||||
if(CMD_RESULT)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Compress failed: ${CMD_RESULT}")
|
||||
endif()
|
||||
|
||||
# Decompress output
|
||||
if(NOT EXISTS ${OUTPUT_BASE}.gz)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Cannot find decompress input: ${OUTPUT_BASE}.gz")
|
||||
endif()
|
||||
|
||||
set(DECOMPRESS_COMMAND ${DECOMPRESS_TARGET} ${DECOMPRESS_ARGS})
|
||||
|
||||
message(STATUS "Decompress ${DECOMPRESS_COMMAND}")
|
||||
message(STATUS " Input: ${OUTPUT_BASE}.gz")
|
||||
message(STATUS " Output: ${OUTPUT_BASE}")
|
||||
|
||||
if(FILEMODE)
|
||||
exec_files("${DECOMPRESS_COMMAND}" "${OUTPUT_BASE}.gz")
|
||||
else()
|
||||
exec_streams("${DECOMPRESS_COMMAND}" "${OUTPUT_BASE}.gz" "${OUTPUT_BASE}")
|
||||
endif()
|
||||
|
||||
if(CMD_RESULT)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Decompress failed: ${CMD_RESULT}")
|
||||
endif()
|
||||
|
||||
if(COMPARE)
|
||||
message(STATUS "Diff comparison")
|
||||
message(STATUS " Input: ${INPUT}")
|
||||
message(STATUS " Output: ${OUTPUT_BASE}")
|
||||
|
||||
# Compare decompressed output with original input file
|
||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
||||
-E compare_files ${INPUT} ${OUTPUT_BASE}
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
|
||||
if(CMD_RESULT)
|
||||
diff(${INPUT} ${OUTPUT_BASE})
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Compare decompress failed: ${CMD_RESULT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T")
|
||||
# Transparent writing does not use gzip format
|
||||
find_program(GZIP gzip)
|
||||
if(GZIP)
|
||||
if(NOT EXISTS ${OUTPUT_BASE}.gz)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Cannot find gzip decompress input: ${OUTPUT_BASE}.gz")
|
||||
endif()
|
||||
|
||||
# Check gzip can decompress our compressed output
|
||||
set(GZ_DECOMPRESS_COMMAND ${GZIP} -d)
|
||||
|
||||
message(STATUS "Gzip decompress ${GZ_DECOMPRESS_COMMAND}")
|
||||
message(STATUS " Input: ${OUTPUT_BASE}.gz")
|
||||
message(STATUS " Output: ${OUTPUT_BASE}-ungzip")
|
||||
|
||||
exec_streams("${GZ_DECOMPRESS_COMMAND}" "${OUTPUT_BASE}.gz" "${OUTPUT_BASE}-ungzip")
|
||||
|
||||
if(CMD_RESULT)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Gzip decompress failed: ${CMD_RESULT}")
|
||||
endif()
|
||||
|
||||
# Compare gzip output with original input file
|
||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
||||
-E compare_files ${INPUT} ${OUTPUT_BASE}-ungzip
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
|
||||
if(CMD_RESULT)
|
||||
diff(${INPUT} ${OUTPUT_BASE}-ungzip)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Compare gzip decompress failed: ${CMD_RESULT}")
|
||||
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")
|
||||
|
||||
exec_streams("${GZ_COMPRESS_COMMAND}" "${INPUT}" "${OUTPUT_BASE}-gzip.gz")
|
||||
|
||||
if(CMD_RESULT)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Gzip compress failed: ${CMD_RESULT}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${OUTPUT_BASE}-gzip.gz)
|
||||
cleanup()
|
||||
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
|
||||
if(FILEMODE)
|
||||
exec_files("${DECOMPRESS_COMMAND}" "${OUTPUT_BASE}-gzip.gz")
|
||||
else()
|
||||
exec_streams("${DECOMPRESS_COMMAND}" "${OUTPUT_BASE}-gzip.gz" "${OUTPUT_BASE}-gzip")
|
||||
endif()
|
||||
|
||||
if(CMD_RESULT)
|
||||
cleanup()
|
||||
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
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
|
||||
if(CMD_RESULT)
|
||||
diff(${INPUT} ${OUTPUT_BASE}-gzip)
|
||||
cleanup()
|
||||
message(FATAL_ERROR "Compare decompress gzip failed: ${CMD_RESULT}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
cleanup_always()
|
72
third_party/zlib-ng/test/cmake/run-and-compare.cmake
vendored
Normal file
72
third_party/zlib-ng/test/cmake/run-and-compare.cmake
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# run-and-compare.cmake -- Runs a command and compares its output to an expected value
|
||||
|
||||
# Copyright (C) 2021 Nathan Moinvaziri
|
||||
# Licensed under the Zlib license, see LICENSE.md for details
|
||||
|
||||
# Required Variables
|
||||
# COMMAND - Command to run
|
||||
# OUTPUT - Standard output
|
||||
# COMPARE - String to compare output against
|
||||
|
||||
# Optional Variables
|
||||
# INPUT - Standard input
|
||||
# IGNORE_LINE_ENDINGS - Ignore line endings when comparing output
|
||||
|
||||
if(NOT DEFINED OUTPUT OR NOT DEFINED COMPARE OR NOT DEFINED COMMAND)
|
||||
message(FATAL_ERROR "Run and compare arguments missing")
|
||||
endif()
|
||||
|
||||
# Ensure directory exists for output files
|
||||
get_filename_component(OUTPUT_DIR "${OUTPUT}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${OUTPUT_DIR}")
|
||||
|
||||
if(INPUT)
|
||||
# Run command with stdin input and redirect stdout to output
|
||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${COMMAND}"
|
||||
-DINPUT=${INPUT}
|
||||
-DOUTPUT=${OUTPUT}
|
||||
"-DSUCCESS_EXIT=${SUCCESS_EXIT}"
|
||||
-P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
else()
|
||||
# Run command and redirect stdout to output
|
||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${COMMAND}"
|
||||
-DOUTPUT=${OUTPUT}
|
||||
"-DSUCCESS_EXIT=${SUCCESS_EXIT}"
|
||||
-P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
endif()
|
||||
|
||||
if(CMD_RESULT)
|
||||
message(FATAL_ERROR "Run before compare failed: ${CMD_RESULT}")
|
||||
endif()
|
||||
|
||||
# Use configure_file to normalize line-endings
|
||||
if(IGNORE_LINE_ENDINGS)
|
||||
# Rewrite files with normalized line endings to temporary directory
|
||||
get_filename_component(COMPARE_NAME ${COMPARE} NAME)
|
||||
set(COMPARE_TEMP ${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/${COMPARE_NAME}.cmp)
|
||||
configure_file(${COMPARE} ${COMPARE_TEMP} NEWLINE_STYLE LF)
|
||||
set(COMPARE ${COMPARE_TEMP})
|
||||
|
||||
get_filename_component(OUTPUT_NAME ${OUTPUT} NAME)
|
||||
set(OUTPUT_TEMP ${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/${OUTPUT_NAME}.cmp)
|
||||
configure_file(${OUTPUT} ${OUTPUT_TEMP} NEWLINE_STYLE LF)
|
||||
set(OUTPUT ${OUTPUT_TEMP})
|
||||
endif()
|
||||
|
||||
# Compare that output is equal to specified file
|
||||
execute_process(COMMAND ${CMAKE_COMMAND}
|
||||
-E compare_files ${COMPARE} ${OUTPUT}
|
||||
RESULT_VARIABLE CMD_RESULT)
|
||||
|
||||
# Delete temporary files used to normalize line-endings
|
||||
if(IGNORE_LINE_ENDINGS)
|
||||
file(REMOVE ${COMPARE} ${OUTPUT})
|
||||
endif()
|
||||
|
||||
if(CMD_RESULT)
|
||||
message(FATAL_ERROR "Run compare failed: ${CMD_RESULT}")
|
||||
endif()
|
54
third_party/zlib-ng/test/cmake/run-and-redirect.cmake
vendored
Normal file
54
third_party/zlib-ng/test/cmake/run-and-redirect.cmake
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# run-and-redirect.cmake -- Runs a command and validates exit code
|
||||
|
||||
# Copyright (C) 2021 Nathan Moinvaziri
|
||||
# Licensed under the Zlib license, see LICENSE.md for details
|
||||
|
||||
# Normally ctest will always fail with non-zero exit code, but we have tests
|
||||
# that need to check specific exit codes.
|
||||
|
||||
# Required Variables
|
||||
# COMMAND - Command to run
|
||||
|
||||
# Optional Variables
|
||||
# INPUT - Standard input
|
||||
# OUTPUT - Standard output (default: /dev/null)
|
||||
# SUCCESS_EXIT - List of successful exit codes (default: 0, ie: 0;1)
|
||||
|
||||
# If no output is specified, discard output
|
||||
if(NOT DEFINED OUTPUT)
|
||||
if(WIN32)
|
||||
set(OUTPUT NUL)
|
||||
else()
|
||||
set(OUTPUT /dev/null)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(INPUT)
|
||||
# Check to see that input file exists
|
||||
if(NOT EXISTS ${INPUT})
|
||||
message(FATAL_ERROR "Cannot find input: ${INPUT}")
|
||||
endif()
|
||||
# Execute with both stdin and stdout file
|
||||
execute_process(COMMAND ${COMMAND}
|
||||
RESULT_VARIABLE CMD_RESULT
|
||||
INPUT_FILE ${INPUT}
|
||||
OUTPUT_FILE ${OUTPUT})
|
||||
else()
|
||||
# Execute with only stdout file
|
||||
execute_process(COMMAND ${COMMAND}
|
||||
RESULT_VARIABLE CMD_RESULT
|
||||
OUTPUT_FILE ${OUTPUT})
|
||||
endif()
|
||||
|
||||
# Check if exit code is in list of successful exit codes
|
||||
if(SUCCESS_EXIT)
|
||||
list(FIND SUCCESS_EXIT ${CMD_RESULT} _INDEX)
|
||||
if (${_INDEX} GREATER -1)
|
||||
set(CMD_RESULT 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check to see if successful
|
||||
if(CMD_RESULT)
|
||||
message(FATAL_ERROR "${COMMAND} failed: ${CMD_RESULT}")
|
||||
endif()
|
33
third_party/zlib-ng/test/cmake/test-cves.cmake
vendored
Normal file
33
third_party/zlib-ng/test/cmake/test-cves.cmake
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# test-cves.cmake -- Tests targeting common vulnerabilities and exposures
|
||||
|
||||
set(CVES CVE-2002-0059 CVE-2004-0797 CVE-2005-1849 CVE-2005-2096)
|
||||
foreach(cve ${CVES})
|
||||
set(CVE_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:minigzip> -d)
|
||||
add_test(NAME ${cve}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${CVE_COMMAND}"
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/${cve}/test.gz
|
||||
"-DSUCCESS_EXIT=0;1"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake)
|
||||
endforeach()
|
||||
|
||||
set(CVE_COMPRESS_LEVELS 6 1 2)
|
||||
foreach(cve_compress_level ${CVE_COMPRESS_LEVELS})
|
||||
add_test(NAME CVE-2018-25032-fixed-level-${cve_compress_level}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIDEFLATE_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=-c;-k;-m;1;-w;-15;-s;4;-F;-${cve_compress_level}"
|
||||
"-DDECOMPRESS_ARGS=-c;-k;-d;-m;1;-w;-15;-${cve_compress_level}"
|
||||
-DGZIP_VERIFY=OFF
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/CVE-2018-25032/fixed.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME CVE-2018-25032-default-level-${cve_compress_level}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIDEFLATE_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=-c;-k;-m;1;-w;-15;-s;4;-${cve_compress_level}"
|
||||
"-DDECOMPRESS_ARGS=-c;-k;-d;-m;1;-w;-15;-${cve_compress_level}"
|
||||
-DGZIP_VERIFY=OFF
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/CVE-2018-25032/default.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
endforeach()
|
68
third_party/zlib-ng/test/cmake/test-data.cmake
vendored
Normal file
68
third_party/zlib-ng/test/cmake/test-data.cmake
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# test-data.cmake - Tests targeting data files in the data directory
|
||||
|
||||
# Test compress and verify test against data file using extra args
|
||||
macro(test_minigzip name path)
|
||||
# Construct compression arguments for minigzip
|
||||
set(compress_args -k -c)
|
||||
foreach(extra_arg IN ITEMS "${ARGN}")
|
||||
list(APPEND compress_args ${extra_arg})
|
||||
endforeach()
|
||||
|
||||
# Create unique friendly string for test
|
||||
string(REPLACE ";" "" arg_list "${ARGN}")
|
||||
string(REPLACE " " "" arg_list "${arg_list}")
|
||||
string(REPLACE "-" "" arg_list "${arg_list}")
|
||||
|
||||
set(test_id minigzip-${name}-${arg_list})
|
||||
|
||||
if(NOT TEST ${test_id})
|
||||
add_test(NAME ${test_id}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIGZIP_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=${compress_args}"
|
||||
"-DDECOMPRESS_ARGS=-d;-c"
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/${path}
|
||||
-DTEST_NAME=${test_id}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# List of arg combinations to use during compression
|
||||
set(TEST_CONFIGS
|
||||
-R # Z_RLE
|
||||
-h # Z_HUFFMAN_ONLY
|
||||
-T # Direct store
|
||||
-0 # No compression
|
||||
-1 # Deflate quick
|
||||
-2 # Deflate fast
|
||||
-4 # Deflate medium (lazy matches)
|
||||
"-5;-F" # Deflate medium (Z_FIXED)
|
||||
-6 # Deflate medium
|
||||
-9 # Deflate slow
|
||||
"-9;-f" # Deflate slow (Z_FILTERED)
|
||||
)
|
||||
|
||||
# Enumerate all files in data directory to run tests against
|
||||
file(GLOB_RECURSE TEST_FILE_PATHS
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/data/*)
|
||||
|
||||
# For all files in the data directory, run tests against them
|
||||
foreach(test_file_path ${TEST_FILE_PATHS})
|
||||
if("${test_file_path}" MATCHES ".gz$" OR "${test_file_path}" MATCHES ".out$" OR
|
||||
"${test_file_path}" MATCHES "/.git/" OR "${test_file_path}" MATCHES ".md$")
|
||||
continue()
|
||||
endif()
|
||||
foreach(test_config ${TEST_CONFIGS})
|
||||
get_filename_component(test_name ${test_file_path} NAME)
|
||||
if (test_name STREQUAL "")
|
||||
continue()
|
||||
endif()
|
||||
test_minigzip(${test_name} ${test_file_path} ${test_config})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# Additional tests to verify with automatic data type detection arg
|
||||
test_minigzip("detect-text" "data/lcet10.txt" -A)
|
||||
test_minigzip("detect-binary" "data/paper-100k.pdf" -A)
|
84
third_party/zlib-ng/test/cmake/test-issues.cmake
vendored
Normal file
84
third_party/zlib-ng/test/cmake/test-issues.cmake
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
# test-issues.cmake -- Tests targeting specific GitHub issues
|
||||
|
||||
add_test(NAME GH-361
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIGZIP_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=-c;-k;-4"
|
||||
-DTEST_NAME=GH-361-test-txt
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/GH-361/test.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME GH-364
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=1;5;9;3"
|
||||
"-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}"
|
||||
-DTEST_NAME=GH-364-test-bin
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/GH-364/test.bin
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME GH-382
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIDEFLATE_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=-c;-m;1;-w;-15;-1;-s;4"
|
||||
"-DDECOMPRESS_ARGS=-c;-d;-m;1;-w;-15"
|
||||
-DGZIP_VERIFY=OFF
|
||||
-DTEST_NAME=GH-382-defneg3-dat
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/GH-382/defneg3.dat
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME GH-536-segfault
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=6;9744;1;91207"
|
||||
"-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}"
|
||||
-DCOMPARE=OFF
|
||||
-DGZIP_VERIFY=OFF
|
||||
-DTEST_NAME=GH-536-segfault-lcet10-txt
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/data/lcet10.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME GH-536-incomplete-read
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=6;88933;1;195840;2;45761"
|
||||
"-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}"
|
||||
-DCOMPARE=OFF
|
||||
-DGZIP_VERIFY=OFF
|
||||
-DTEST_NAME=GH-536-incomplete-read-lcet10-txt
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/data/lcet10.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME GH-536-zero-stored-block
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}"
|
||||
"-DCOMPRESS_ARGS=6;15248;1;1050;2;25217"
|
||||
"-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}"
|
||||
-DCOMPARE=OFF
|
||||
-DGZIP_VERIFY=OFF
|
||||
-DTEST_NAME=GH-536-zero-stored-block-lcet10-txt
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/data/lcet10.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME GH-751
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIGZIP_COMMAND}"
|
||||
-DTEST_NAME=GH-751-test-txt
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/GH-751/test.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
set(TEST_COMMAND "${MINIDEFLATE_COMMAND};-c;-d;-k;-s;4")
|
||||
add_test(NAME GH-1600-no-window-check
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${TEST_COMMAND}"
|
||||
"-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/GH-1600/packobj.gz"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake
|
||||
)
|
||||
|
||||
set(TEST_COMMAND "${MINIDEFLATE_COMMAND};-c;-d;-k;-s;4;-r;25")
|
||||
add_test(NAME GH-1600-no-window-no-check
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${TEST_COMMAND}"
|
||||
"-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/GH-1600/packobj.gz"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake
|
||||
)
|
80
third_party/zlib-ng/test/cmake/test-tools.cmake
vendored
Normal file
80
third_party/zlib-ng/test/cmake/test-tools.cmake
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# test-tools.cmake -- Tests targeting tool coverage
|
||||
|
||||
# Compress and decompress using file_compress/file_decompress, optionally also testing MMAP
|
||||
add_test(NAME minigzip-file_compress
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIGZIP_COMMAND}"
|
||||
-DFILEMODE=ON
|
||||
-DGZIP_VERIFY=ON
|
||||
-DTEST_NAME=minigzip-file_compress
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/data/paper-100k.pdf
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
add_test(NAME minideflate-file_compress
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DTARGET=${MINIDEFLATE_COMMAND}"
|
||||
-DFILEMODE=ON
|
||||
-DGZIP_VERIFY=OFF
|
||||
-DTEST_NAME=minideflate-file_compress
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/data/paper-100k.pdf
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
# Test --help and invalid parameters for our tools
|
||||
set(TEST_COMMAND ${MINIGZIP_COMMAND} "--help")
|
||||
add_test(NAME minigzip-help
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${TEST_COMMAND}"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake)
|
||||
|
||||
set(TEST_COMMAND ${MINIGZIP_COMMAND} "--invalid")
|
||||
add_test(NAME minigzip-invalid
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${TEST_COMMAND}"
|
||||
-DSUCCESS_EXIT=64
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake)
|
||||
|
||||
set(TEST_COMMAND ${MINIDEFLATE_COMMAND} "--help")
|
||||
add_test(NAME minideflate-help
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${TEST_COMMAND}"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake)
|
||||
|
||||
set(TEST_COMMAND ${MINIDEFLATE_COMMAND} "--invalid")
|
||||
add_test(NAME minideflate-invalid
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${TEST_COMMAND}"
|
||||
-DSUCCESS_EXIT=64
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake)
|
||||
|
||||
set(TEST_COMMAND ${SWITCHLEVELS_COMMAND} "--help")
|
||||
add_test(NAME switchlevels-help
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${TEST_COMMAND}"
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake)
|
||||
|
||||
# Test generated crc32 tables match tables in source directory
|
||||
add_test(NAME makecrct
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${MAKECRCT_COMMAND}"
|
||||
-DOUTPUT=${PROJECT_BINARY_DIR}/Testing/Temporary/crc32_braid_tbl._h
|
||||
-DCOMPARE=${PROJECT_SOURCE_DIR}/crc32_braid_tbl.h
|
||||
-DIGNORE_LINE_ENDINGS=ON
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake)
|
||||
|
||||
# Test generated inflate tables match tables in source directory
|
||||
add_test(NAME makefixed
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${MAKEFIXED_COMMAND}"
|
||||
-DOUTPUT=${PROJECT_BINARY_DIR}/Testing/Temporary/inffixed_tbl._h
|
||||
-DCOMPARE=${PROJECT_SOURCE_DIR}/inffixed_tbl.h
|
||||
-DIGNORE_LINE_ENDINGS=ON
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake)
|
||||
|
||||
# Test generated tree tables match tables in source directory
|
||||
add_test(NAME maketrees
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCOMMAND=${MAKETREES_COMMAND}"
|
||||
-DOUTPUT=${PROJECT_BINARY_DIR}/Testing/Temporary/trees_tbl._h
|
||||
-DCOMPARE=${PROJECT_SOURCE_DIR}/trees_tbl.h
|
||||
-DIGNORE_LINE_ENDINGS=ON
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake)
|
Reference in New Issue
Block a user