2007-11-10 23:40:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_description='Verify snapshot'
|
2007-11-10 23:40:58 +00:00
|
|
|
. ./setup.sh
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'get foo/snapshot/master.tar.gz' '
|
|
|
|
cgit_url "foo/snapshot/master.tar.gz" >tmp
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'check html headers' '
|
|
|
|
head -n 1 tmp |
|
2013-03-04 21:58:50 +00:00
|
|
|
grep "Content-Type: application/x-gzip" &&
|
2007-11-10 23:40:58 +00:00
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
head -n 2 tmp |
|
2013-03-04 21:58:50 +00:00
|
|
|
grep "Content-Disposition: inline; filename=.master.tar.gz."
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'strip off the header lines' '
|
2013-05-18 17:46:38 +00:00
|
|
|
strip_headers <tmp >master.tar.gz
|
2013-03-04 21:58:50 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'verify gzip format' '
|
|
|
|
gunzip --test master.tar.gz
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'untar' '
|
|
|
|
rm -rf master &&
|
2013-04-08 22:13:52 +00:00
|
|
|
tar -xzf master.tar.gz
|
2008-10-05 11:13:03 +00:00
|
|
|
'
|
2007-11-10 23:40:58 +00:00
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'count files' '
|
|
|
|
ls master/ >output &&
|
|
|
|
test_line_count = 5 output
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'verify untarred file-5' '
|
|
|
|
grep "^5$" master/file-5 &&
|
|
|
|
test_line_count = 1 master/file-5
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2019-08-16 21:40:19 +00:00
|
|
|
if test -n "$(which lzip 2>/dev/null)"; then
|
|
|
|
test_set_prereq LZIP
|
|
|
|
else
|
|
|
|
say 'Skipping LZIP validation tests: lzip not found'
|
|
|
|
fi
|
|
|
|
|
|
|
|
test_expect_success LZIP 'get foo/snapshot/master.tar.lz' '
|
|
|
|
cgit_url "foo/snapshot/master.tar.lz" >tmp
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success LZIP 'check html headers' '
|
|
|
|
head -n 1 tmp |
|
|
|
|
grep "Content-Type: application/x-lzip" &&
|
|
|
|
|
|
|
|
head -n 2 tmp |
|
|
|
|
grep "Content-Disposition: inline; filename=.master.tar.lz."
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success LZIP 'strip off the header lines' '
|
|
|
|
strip_headers <tmp >master.tar.lz
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success LZIP 'verify lzip format' '
|
|
|
|
lzip --test master.tar.lz &&
|
|
|
|
cp master.tar.lz /tmp/.
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success LZIP 'untar' '
|
|
|
|
rm -rf master &&
|
|
|
|
tar --lzip -xf master.tar.lz
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success LZIP 'count files' '
|
|
|
|
ls master/ >output &&
|
|
|
|
test_line_count = 5 output
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success LZIP 'verify untarred file-5' '
|
|
|
|
grep "^5$" master/file-5 &&
|
|
|
|
test_line_count = 1 master/file-5
|
|
|
|
'
|
|
|
|
|
2020-02-26 08:19:00 +00:00
|
|
|
if test -n "$(which xz 2>/dev/null)"; then
|
|
|
|
test_set_prereq XZ
|
|
|
|
else
|
|
|
|
say 'Skipping XZ validation tests: xz not found'
|
|
|
|
fi
|
|
|
|
|
|
|
|
test_expect_success XZ 'get foo/snapshot/master.tar.xz' '
|
|
|
|
cgit_url "foo/snapshot/master.tar.xz" >tmp
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success XZ 'check html headers' '
|
|
|
|
head -n 1 tmp |
|
|
|
|
grep "Content-Type: application/x-xz" &&
|
|
|
|
|
|
|
|
head -n 2 tmp |
|
|
|
|
grep "Content-Disposition: inline; filename=.master.tar.xz."
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success XZ 'strip off the header lines' '
|
|
|
|
strip_headers <tmp >master.tar.xz
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success XZ 'verify xz format' '
|
|
|
|
xz --test master.tar.xz &&
|
|
|
|
cp master.tar.xz /tmp/.
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success XZ 'untar' '
|
|
|
|
rm -rf master &&
|
|
|
|
tar --xz -xf master.tar.xz
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success XZ 'count files' '
|
|
|
|
ls master/ >output &&
|
|
|
|
test_line_count = 5 output
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success XZ 'verify untarred file-5' '
|
|
|
|
grep "^5$" master/file-5 &&
|
|
|
|
test_line_count = 1 master/file-5
|
|
|
|
'
|
|
|
|
|
2020-02-26 08:12:21 +00:00
|
|
|
if test -n "$(which zstd 2>/dev/null)"; then
|
|
|
|
test_set_prereq ZSTD
|
|
|
|
else
|
|
|
|
say 'Skipping ZSTD validation tests: zstd not found'
|
|
|
|
fi
|
|
|
|
|
|
|
|
test_expect_success ZSTD 'get foo/snapshot/master.tar.zst' '
|
|
|
|
cgit_url "foo/snapshot/master.tar.zst" >tmp
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success ZSTD 'check html headers' '
|
|
|
|
head -n 1 tmp |
|
|
|
|
grep "Content-Type: application/x-zstd" &&
|
|
|
|
|
|
|
|
head -n 2 tmp |
|
|
|
|
grep "Content-Disposition: inline; filename=.master.tar.zst."
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success ZSTD 'strip off the header lines' '
|
|
|
|
strip_headers <tmp >master.tar.zst
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success ZSTD 'verify zstd format' '
|
|
|
|
zstd --test master.tar.zst &&
|
|
|
|
cp master.tar.zst /tmp/.
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success ZSTD 'untar' '
|
|
|
|
rm -rf master &&
|
|
|
|
tar --zstd -xf master.tar.zst
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success ZSTD 'count files' '
|
|
|
|
ls master/ >output &&
|
|
|
|
test_line_count = 5 output
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success ZSTD 'verify untarred file-5' '
|
|
|
|
grep "^5$" master/file-5 &&
|
|
|
|
test_line_count = 1 master/file-5
|
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'get foo/snapshot/master.zip' '
|
|
|
|
cgit_url "foo/snapshot/master.zip" >tmp
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'check HTML headers (zip)' '
|
|
|
|
head -n 1 tmp |
|
2013-03-04 21:58:51 +00:00
|
|
|
grep "Content-Type: application/x-zip" &&
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
head -n 2 tmp |
|
2013-03-04 21:58:51 +00:00
|
|
|
grep "Content-Disposition: inline; filename=.master.zip."
|
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'strip off the header lines (zip)' '
|
2013-05-18 17:46:38 +00:00
|
|
|
strip_headers <tmp >master.zip
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-09 18:02:33 +00:00
|
|
|
if test -n "$(which unzip 2>/dev/null)"; then
|
|
|
|
test_set_prereq UNZIP
|
|
|
|
else
|
|
|
|
say 'Skipping ZIP validation tests: unzip not found'
|
|
|
|
fi
|
|
|
|
|
|
|
|
test_expect_success UNZIP 'verify zip format' '
|
2013-04-01 14:09:05 +00:00
|
|
|
unzip -t master.zip
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-09 18:02:33 +00:00
|
|
|
test_expect_success UNZIP 'unzip' '
|
2013-04-01 14:09:05 +00:00
|
|
|
rm -rf master &&
|
|
|
|
unzip master.zip
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-09 18:02:33 +00:00
|
|
|
test_expect_success UNZIP 'count files (zip)' '
|
2013-04-01 14:09:05 +00:00
|
|
|
ls master/ >output &&
|
|
|
|
test_line_count = 5 output
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-09 18:02:33 +00:00
|
|
|
test_expect_success UNZIP 'verify unzipped file-5' '
|
2013-04-01 14:09:05 +00:00
|
|
|
grep "^5$" master/file-5 &&
|
|
|
|
test_line_count = 1 master/file-5
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_done
|