view tests/test-archive @ 2571:83cfd95eafb5

tests: add timeouts, make clean up dead daemon processes test timeout feature is needed for test with python 2.5 beta. if test does not complete in time (30 seconds is default), it is killed. some times daemon process used in test can be alive after the test is killed by user or by timeout. tests now record daemon pids into $DAEMON_PIDS and kills all living daemons after every test. final little change is to add newline to end of pid file printed by "hg serve", else "cat >> $DAEMON_FILES" gives garbage.
author Vadim Gelfer <>
date Thu, 06 Jul 2006 11:45:34 -0700
parents 76ff5efe8181
line wrap: on
line source


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 "[web]" >> .hg/hgrc
echo "name = test-archive" >> .hg/hgrc
echo "allow_archive = gz bz2, zip" >> .hg/hgrc
hg serve -p 20059 -d

TIP=`hg id -v | cut -f1 -d' '`
QTIP=`hg id -q`
cat > <<EOF
import sys, urllib2
node, archive = sys.argv[1:]
f = urllib2.urlopen(';node=%s;type=%s'
                    % (node, archive))
http_proxy= python "$TIP" gz | gunzip | tar tf - | sed "s/$QTIP/TIP/"
http_proxy= python "$TIP" bz2 | bunzip2 | tar tf - | sed "s/$QTIP/TIP/"
http_proxy= python "$TIP" zip >
unzip -t | sed "s/$QTIP/TIP/"

hg archive -t tar test.tar
tar tf test.tar

hg archive -t tbz2 -X baz test.tar.bz2
bunzip2 -dc test.tar.bz2 | tar tf -

hg archive -t tgz -p %b-%h test-%h.tar.gz
gzip -dc test-$QTIP.tar.gz | tar tf - | sed "s/$QTIP/TIP/"

hg archive -t zip -p /illegal
hg archive -t zip -p very/../bad

hg archive -t zip -r 2
unzip -t

hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/"