2007-11-10 23:40:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. ./setup.sh
|
|
|
|
|
|
|
|
prepare_tests "Verify snapshot"
|
|
|
|
|
2008-12-28 09:52:35 +00:00
|
|
|
run_test 'get foo/snapshot/master.tar.gz' '
|
|
|
|
cgit_url "foo/snapshot/master.tar.gz" >trash/tmp
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
run_test 'check html headers' '
|
|
|
|
head -n 1 trash/tmp |
|
2008-12-26 10:33:59 +00:00
|
|
|
grep -e "Content-Type: application/x-gzip" &&
|
2007-11-10 23:40:58 +00:00
|
|
|
|
|
|
|
head -n 2 trash/tmp |
|
2008-12-28 09:52:35 +00:00
|
|
|
grep -e "Content-Disposition: inline; filename=.master.tar.gz."
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
run_test 'strip off the header lines' '
|
2008-12-28 09:52:35 +00:00
|
|
|
tail -n +6 trash/tmp > trash/master.tar.gz
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2008-12-28 09:52:35 +00:00
|
|
|
run_test 'verify gzip format' 'gunzip --test trash/master.tar.gz'
|
2008-10-05 11:13:03 +00:00
|
|
|
run_test 'untar' '
|
2008-12-28 09:52:35 +00:00
|
|
|
rm -rf trash/master &&
|
|
|
|
tar -xf trash/master.tar.gz -C trash
|
2008-10-05 11:13:03 +00:00
|
|
|
'
|
2007-11-10 23:40:58 +00:00
|
|
|
|
|
|
|
run_test 'count files' '
|
2008-12-28 09:52:35 +00:00
|
|
|
c=$(ls -1 trash/master/ | wc -l) &&
|
2007-11-10 23:40:58 +00:00
|
|
|
test $c = 5
|
|
|
|
'
|
|
|
|
|
|
|
|
run_test 'verify untarred file-5' '
|
2008-12-28 09:52:35 +00:00
|
|
|
grep -e "^5$" trash/master/file-5 &&
|
|
|
|
test $(cat trash/master/file-5 | wc -l) = 1
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
tests_done
|