comparison tests/test-archive @ 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
children 4603eef60237
comparison
equal deleted inserted replaced
1165:04be5eb73bb3 1166:bd66294b7a9b
1 #!/bin/sh
2
3 mkdir test
4 cd test
5 hg init
6 echo foo>foo
7 hg addremove
8 hg commit -m 1
9 echo bar>bar
10 hg addremove
11 hg commit -m 2
12 mkdir baz
13 echo bletch>baz/bletch
14 hg addremove
15 hg commit -m 3
16 echo "name = test-archive" >> .hg/hgrc
17 echo "allowzip = true" >> .hg/hgrc
18 echo "allowgz = true" >> .hg/hgrc
19 echo "allowbz2 = true" >> .hg/hgrc
20 hg serve -p 20059 > /dev/null &
21 sleep 1 # wait for server to be started
22
23 TIP=`hg id -v | cut -f1 -d' '`
24 QTIP=`hg id -q`
25 cat > getarchive.py <<EOF
26 import sys, urllib2
27 node, archive = sys.argv[1:]
28 f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s'
29 % (node, archive))
30 sys.stdout.write(f.read())
31 EOF
32 http_proxy= python getarchive.py "$TIP" gz | tar tzf - | sed "s/$QTIP/TIP/"
33 http_proxy= python getarchive.py "$TIP" bz2 | tar tjf - | sed "s/$QTIP/TIP/"
34 http_proxy= python getarchive.py "$TIP" zip > archive.zip
35 unzip -t archive.zip | sed "s/$QTIP/TIP/"
36
37 kill $!