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' '
|
|
|
|
tail -n +6 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 &&
|
|
|
|
tar -xf 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
|
|
|
'
|
|
|
|
|
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)' '
|
|
|
|
tail -n +6 tmp >master.zip
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'verify zip format' '
|
|
|
|
unzip -t master.zip
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'unzip' '
|
|
|
|
rm -rf master &&
|
|
|
|
unzip master.zip
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'count files (zip)' '
|
|
|
|
ls master/ >output &&
|
|
|
|
test_line_count = 5 output
|
2013-03-04 21:58:51 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'verify unzipped file-5' '
|
|
|
|
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
|