##// END OF EJS Templates
run-tests.py: make tests use same python interpreter as test harness....
run-tests.py: make tests use same python interpreter as test harness. this is wanted because some tests run python interpreter directly. must use same python interpreter in tests as in main harness or problems will happen because of e.g. different python abi if run-tests.py run with python 2.5 but system python is 2.4. fix is to see if system python is used and is named python. if no, put symlink called python at front of shell search path.

File last commit:

r2500:76ff5efe default
r2570:2264b2b0 default
Show More
test-archive
53 lines | 1.3 KiB | text/plain | TextLexer
#!/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 "[web]" >> .hg/hgrc
echo "name = test-archive" >> .hg/hgrc
echo "allow_archive = gz bz2, zip" >> .hg/hgrc
hg serve -p 20059 -d --pid-file=hg.pid
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 | gunzip | tar tf - | sed "s/$QTIP/TIP/"
http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - | sed "s/$QTIP/TIP/"
http_proxy= python getarchive.py "$TIP" zip > archive.zip
unzip -t archive.zip | sed "s/$QTIP/TIP/"
kill `cat hg.pid`
sleep 1 # wait for server to scream and die
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 test.zip
hg archive -t zip -p very/../bad test.zip
hg archive -t zip -r 2 test.zip
unzip -t test.zip
hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/"