diff options
author | Christian Hesse | 2020-02-26 09:12:21 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2020-03-12 19:56:39 -0600 |
commit | 892ba8c3cc0617d2087a2337d8c6e71524d7b49c (patch) | |
tree | 9f230da21b5cb0443a3058da543da6b13c959f71 /tests/t0107-snapshot.sh | |
parent | cc230bf04456cc0ca82c6251b1624425eb7a7153 (diff) | |
download | cgit-892ba8c3cc0617d2087a2337d8c6e71524d7b49c.tar.gz cgit-892ba8c3cc0617d2087a2337d8c6e71524d7b49c.tar.bz2 cgit-892ba8c3cc0617d2087a2337d8c6e71524d7b49c.zip |
ui-snapshot: add support for zstd compression
This patch adds support for zstd [0] compressed snapshots (*.tar.zst).
We enable multiple working threads (-T0), but keep default compression
level. The latter can be influenced by environment variable.
[0] https://www.zstd.net/
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'tests/t0107-snapshot.sh')
-rwxr-xr-x | tests/t0107-snapshot.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index 84995d1..c164d3e 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh | |||
@@ -122,6 +122,48 @@ test_expect_success XZ 'verify untarred file-5' ' | |||
122 | test_line_count = 1 master/file-5 | 122 | test_line_count = 1 master/file-5 |
123 | ' | 123 | ' |
124 | 124 | ||
125 | if test -n "$(which zstd 2>/dev/null)"; then | ||
126 | test_set_prereq ZSTD | ||
127 | else | ||
128 | say 'Skipping ZSTD validation tests: zstd not found' | ||
129 | fi | ||
130 | |||
131 | test_expect_success ZSTD 'get foo/snapshot/master.tar.zst' ' | ||
132 | cgit_url "foo/snapshot/master.tar.zst" >tmp | ||
133 | ' | ||
134 | |||
135 | test_expect_success ZSTD 'check html headers' ' | ||
136 | head -n 1 tmp | | ||
137 | grep "Content-Type: application/x-zstd" && | ||
138 | |||
139 | head -n 2 tmp | | ||
140 | grep "Content-Disposition: inline; filename=.master.tar.zst." | ||
141 | ' | ||
142 | |||
143 | test_expect_success ZSTD 'strip off the header lines' ' | ||
144 | strip_headers <tmp >master.tar.zst | ||
145 | ' | ||
146 | |||
147 | test_expect_success ZSTD 'verify zstd format' ' | ||
148 | zstd --test master.tar.zst && | ||
149 | cp master.tar.zst /tmp/. | ||
150 | ' | ||
151 | |||
152 | test_expect_success ZSTD 'untar' ' | ||
153 | rm -rf master && | ||
154 | tar --zstd -xf master.tar.zst | ||
155 | ' | ||
156 | |||
157 | test_expect_success ZSTD 'count files' ' | ||
158 | ls master/ >output && | ||
159 | test_line_count = 5 output | ||
160 | ' | ||
161 | |||
162 | test_expect_success ZSTD 'verify untarred file-5' ' | ||
163 | grep "^5$" master/file-5 && | ||
164 | test_line_count = 1 master/file-5 | ||
165 | ' | ||
166 | |||
125 | test_expect_success 'get foo/snapshot/master.zip' ' | 167 | test_expect_success 'get foo/snapshot/master.zip' ' |
126 | cgit_url "foo/snapshot/master.zip" >tmp | 168 | cgit_url "foo/snapshot/master.zip" >tmp |
127 | ' | 169 | ' |