Mercurial > hg
changeset 1166:bd66294b7a9b
Added test case for zip/gz/bz2 archive downloads.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Tue, 30 Aug 2005 19:17:05 +0200 |
parents | 04be5eb73bb3 |
children | 8787d2d5fc7d |
files | tests/test-archive tests/test-archive.out |
diffstat | 2 files changed, 52 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-archive Tue Aug 30 19:17:05 2005 +0200 @@ -0,0 +1,37 @@ +#!/bin/sh + +mkdir test +cd test +hg init +echo foo>foo +hg addremove +hg commit -m 1 +echo bar>bar +hg addremove +hg commit -m 2 +mkdir baz +echo bletch>baz/bletch +hg addremove +hg commit -m 3 +echo "name = test-archive" >> .hg/hgrc +echo "allowzip = true" >> .hg/hgrc +echo "allowgz = true" >> .hg/hgrc +echo "allowbz2 = true" >> .hg/hgrc +hg serve -p 20059 > /dev/null & +sleep 1 # wait for server to be started + +TIP=`hg id -v | cut -f1 -d' '` +QTIP=`hg id -q` +cat > getarchive.py <<EOF +import sys, urllib2 +node, archive = sys.argv[1:] +f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s' + % (node, archive)) +sys.stdout.write(f.read()) +EOF +http_proxy= python getarchive.py "$TIP" gz | tar tzf - | sed "s/$QTIP/TIP/" +http_proxy= python getarchive.py "$TIP" bz2 | tar tjf - | sed "s/$QTIP/TIP/" +http_proxy= python getarchive.py "$TIP" zip > archive.zip +unzip -t archive.zip | sed "s/$QTIP/TIP/" + +kill $!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-archive.out Tue Aug 30 19:17:05 2005 +0200 @@ -0,0 +1,15 @@ +adding foo +adding bar +adding baz/bletch +test-archive-TIP/bar +test-archive-TIP/baz/bletch +test-archive-TIP/foo +test-archive-TIP/bar +test-archive-TIP/baz/bletch +test-archive-TIP/foo +Archive: archive.zip + testing: test-archive-TIP/bar OK + testing: test-archive-TIP/baz/bletch OK + testing: test-archive-TIP/foo OK +No errors detected in compressed data of archive.zip. +killed!