aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t0107-snapshot.sh
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 /tests/t0107-snapshot.sh
parent06671f4b2167951c6b46401b0f5ac8af4d48d50a (diff)
downloadcgit-cc230bf04456cc0ca82c6251b1624425eb7a7153.tar.gz
cgit-cc230bf04456cc0ca82c6251b1624425eb7a7153.tar.bz2
cgit-cc230bf04456cc0ca82c6251b1624425eb7a7153.zip
tests: add tests for xz compressed snapshots
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'tests/t0107-snapshot.sh')
-rwxr-xr-xtests/t0107-snapshot.sh42
1 files changed, 42 insertions, 0 deletions
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'