about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorChristian Hesse2020-02-26 09:19:00 +0100
committerJason A. Donenfeld2020-03-12 19:56:39 -0600
commitcc230bf04456cc0ca82c6251b1624425eb7a7153 (patch)
tree39f5399517c6e15f9d09a28f8457deddfd4f314c
parentui-snapshot: add support for lzip compression (diff)
downloadcgit-cc230bf04456cc0ca82c6251b1624425eb7a7153.tar.gz
cgit-cc230bf04456cc0ca82c6251b1624425eb7a7153.zip
tests: add tests for xz compressed snapshots
Signed-off-by: Christian Hesse <mail@eworm.de>
-rwxr-xr-xtests/setup.sh2
-rwxr-xr-xtests/t0107-snapshot.sh42
2 files changed, 43 insertions, 1 deletions
diff --git a/tests/setup.sh b/tests/setup.sh index 69e47e6..334cca6 100755 --- a/tests/setup.sh +++ b/tests/setup.sh
@@ -104,7 +104,7 @@ virtual-root=/
104cache-root=$PWD/cache 104cache-root=$PWD/cache
105 105
106cache-size=1021 106cache-size=1021
107snapshots=tar.gz tar.bz tar.lz zip 107snapshots=tar.gz tar.bz tar.lz tar.xz zip
108enable-log-filecount=1 108enable-log-filecount=1
109enable-log-linecount=1 109enable-log-linecount=1
110summary-log=5 110summary-log=5
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index a845ad9..84995d1 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh
@@ -80,6 +80,48 @@ test_expect_success LZIP 'verify untarred file-5' '
80 test_line_count = 1 master/file-5 80 test_line_count = 1 master/file-5
81' 81'
82 82
83if test -n "$(which xz 2>/dev/null)"; then
84 test_set_prereq XZ
85else
86 say 'Skipping XZ validation tests: xz not found'
87fi
88
89test_expect_success XZ 'get foo/snapshot/master.tar.xz' '
90 cgit_url "foo/snapshot/master.tar.xz" >tmp
91'
92
93test_expect_success XZ 'check html headers' '
94 head -n 1 tmp |
95 grep "Content-Type: application/x-xz" &&
96
97 head -n 2 tmp |
98 grep "Content-Disposition: inline; filename=.master.tar.xz."
99'
100
101test_expect_success XZ 'strip off the header lines' '
102 strip_headers <tmp >master.tar.xz
103'
104
105test_expect_success XZ 'verify xz format' '
106 xz --test master.tar.xz &&
107 cp master.tar.xz /tmp/.
108'
109
110test_expect_success XZ 'untar' '
111 rm -rf master &&
112 tar --xz -xf master.tar.xz
113'
114
115test_expect_success XZ 'count files' '
116 ls master/ >output &&
117 test_line_count = 5 output
118'
119
120test_expect_success XZ 'verify untarred file-5' '
121 grep "^5$" master/file-5 &&
122 test_line_count = 1 master/file-5
123'
124
83test_expect_success 'get foo/snapshot/master.zip' ' 125test_expect_success 'get foo/snapshot/master.zip' '
84 cgit_url "foo/snapshot/master.zip" >tmp 126 cgit_url "foo/snapshot/master.zip" >tmp
85' 127'