blob: d38603ac7378291ab06507a132cdd4fdc508ae74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
https://github.com/zlib-ng/minizip-ng/issues/623
https://github.com/zlib-ng/minizip-ng/commit/6261d6f5ec5bd275257354c048f68ad9723c3231
From 6261d6f5ec5bd275257354c048f68ad9723c3231 Mon Sep 17 00:00:00 2001
From: Nathan Moinvaziri <nathan@solidstatenetworks.com>
Date: Sat, 11 Jun 2022 10:36:42 -0700
Subject: [PATCH] Generate test files in binary temp directory.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -804,6 +804,8 @@ if(MZ_BUILD_TESTS AND MZ_BUILD_UNIT_TESTS)
endif()
endif()
+ set(TEST_TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary)
+
add_test(NAME test_cmd COMMAND test_cmd WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
function(create_compress_tests EXTRA_NAME EXTRA_ARGS)
@@ -840,33 +842,43 @@ if(MZ_BUILD_TESTS AND MZ_BUILD_UNIT_TESTS)
foreach(INDEX RANGE ${COMPRESS_METHOD_COUNT})
list(GET COMPRESS_METHOD_NAMES ${INDEX} COMPRESS_METHOD_NAME)
list(GET COMPRESS_METHOD_ARGS ${INDEX} COMPRESS_METHOD_ARG)
+
+ set(COMPRESS_METHOD_DEST_DIR
+ ${TEST_TEMP_DIR}/${COMPRESS_METHOD_NAME}-${EXTRA_NAME})
+ set(COMPRESS_METHOD_PATH
+ ${TEST_TEMP_DIR}/${COMPRESS_METHOD_NAME}-${EXTRA_NAME}.zip)
+
add_test(NAME ${COMPRESS_METHOD_NAME}-zip-${EXTRA_NAME}
COMMAND minizip_cmd ${COMPRESS_METHOD_ARG} -o ${EXTRA_ARGS}
- result.zip test.c test.h empty.txt random.bin uniform.bin fuzz
+ ${COMPRESS_METHOD_PATH}
+ test.c test.h empty.txt random.bin uniform.bin fuzz
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
add_test(NAME ${COMPRESS_METHOD_NAME}-list-${EXTRA_NAME}
- COMMAND minizip_cmd -l ${EXTRA_ARGS} result.zip
+ COMMAND minizip_cmd -l ${EXTRA_ARGS} ${COMPRESS_METHOD_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
if(NOT MZ_COMPRESS_ONLY)
add_test(NAME ${COMPRESS_METHOD_NAME}-unzip-${EXTRA_NAME}
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out result.zip
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${COMPRESS_METHOD_DEST_DIR} ${COMPRESS_METHOD_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
add_test(NAME ${COMPRESS_METHOD_NAME}-append-${EXTRA_NAME}
COMMAND minizip_cmd ${COMPRESS_METHOD_ARG} -a ${EXTRA_ARGS}
- result.zip single.txt
+ ${COMPRESS_METHOD_PATH} single.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
if(NOT MZ_COMPRESS_ONLY)
add_test(NAME ${COMPRESS_METHOD_NAME}-append-unzip-${EXTRA_NAME}
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out result.zip
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${COMPRESS_METHOD_DEST_DIR} ${COMPRESS_METHOD_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
add_test(NAME ${COMPRESS_METHOD_NAME}-erase-${EXTRA_NAME}
- COMMAND minizip_cmd -o -e result.zip test.c test.h
+ COMMAND minizip_cmd -o -e ${COMPRESS_METHOD_PATH} test.c test.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
if(NOT MZ_COMPRESS_ONLY)
add_test(NAME ${COMPRESS_METHOD_NAME}-erase-unzip-${EXTRA_NAME}
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out result.zip
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${COMPRESS_METHOD_DEST_DIR} ${COMPRESS_METHOD_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
endforeach()
@@ -891,43 +903,49 @@ if(MZ_BUILD_TESTS AND MZ_BUILD_UNIT_TESTS)
if(NOT MZ_COMPRESS_ONLY)
if(MZ_ZLIB OR MZ_LIBCOMP)
add_test(NAME unzip-tiny
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${TEST_TEMP_DIR}/unzip-tiny
fuzz/unzip_fuzzer_seed_corpus/tiny.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
if(MZ_BZIP2)
add_test(NAME unzip-bzip2
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${TEST_TEMP_DIR}/unzip-bzip2
fuzz/unzip_fuzzer_seed_corpus/bzip2.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
if(MZ_LZMA)
add_test(NAME unzip-lzma
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${TEST_TEMP_DIR}/unzip-lzma
fuzz/unzip_fuzzer_seed_corpus/lzma.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
if(MZ_PKCRYPT)
add_test(NAME unzip-pkcrypt
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out -p test123
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${TEST_TEMP_DIR}/unzip-pkcrypt -p test123
fuzz/unzip_fuzzer_seed_corpus/encrypted_pkcrypt.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
if(MZ_WZAES)
add_test(NAME unzip-wzaes
- COMMAND minizip_cmd -x -o ${EXTRA_ARGS} -d out -p test123
+ COMMAND minizip_cmd -x -o ${EXTRA_ARGS}
+ -d ${TEST_TEMP_DIR}/unzip-wzaes -p test123
fuzz/unzip_fuzzer_seed_corpus/encrypted_wzaes.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
endif()
if(NOT MZ_COMPRESS_ONLY AND NOT MZ_DECOMPRESS_ONLY)
if(MZ_ZLIB AND NOT MZ_LIBCOMP)
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/random.bin DESTINATION ${TEST_TEMP_DIR})
add_test(NAME gz
COMMAND minigzip_cmd random.bin
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
+ WORKING_DIRECTORY ${TEST_TEMP_DIR})
add_test(NAME ungz
- COMMAND minigzip_cmd -x -d out random.bin.gz
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
+ COMMAND minigzip_cmd -x -d ${TEST_TEMP_DIR} random.bin.gz
+ WORKING_DIRECTORY ${TEST_TEMP_DIR})
endif()
endif()
endif()
|