##// END OF EJS Templates
tests: unify test-abort-checkin
tests: unify test-abort-checkin

File last commit:

r11677:8f8a7976 stable
r11848:f54ff493 default
Show More
test-hgwebdir
163 lines | 5.1 KiB | text/plain | TextLexer
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561 #!/bin/sh
Dirkjan Ochtman
Fix style nit and add some comments to tests.
r5580 # Tests some basic hgwebdir functionality. Tests setting up paths and
# collection, different forms of 404s and the subdirectory support.
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561
mkdir webdir
cd webdir
hg init a
echo a > a/a
hg --cwd a ci -Ama -d'1 0'
Benoit Allard
hgweb: recurse down collections only if ** in [paths]...
r7523 # create a mercurial queue repository
hg --cwd a qinit --config extensions.hgext.mq= -c
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561
hg init b
echo b > b/b
hg --cwd b ci -Amb -d'2 0'
Benoit Allard
hgweb: recurse down collections only if ** in [paths]...
r7523 # create a nested repository
cd b
hg init d
echo d > d/d
hg --cwd d ci -Amd -d'3 0'
cd ..
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561 hg init c
echo c > c/c
hg --cwd c ci -Amc -d'3 0'
Benoit Allard
hgweb: recurse down collections only if ** in [paths]...
r7523
Patrick Mezard
util: disable walkrepo() recursive behaviour...
r7494 root=`pwd`
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561 cd ..
Dirkjan Ochtman
hgweb: add web.descend configuration variable
r9363
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561 cat > paths.conf <<EOF
[paths]
a=$root/a
b=$root/b
EOF
hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
Dirkjan Ochtman
hgwebdir: split out makeindex function, facilitate test failure diagnosis
r5601 -A access-paths.log -E error-paths-1.log
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561 cat hg.pid >> $DAEMON_PIDS
echo % should give a 404 - file does not exist
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
echo % should succeed
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
echo % should give a 404 - repo is not published
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
Yuya Nishihara
hgweb: fix broken URLs of RSS/Atom feeds (issue1772)...
r10674 echo % atom-log without basedir
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/atom-log' \
Thomas Arendsen Hein
test-hgwebdir: correctly include '-' in sed expression....
r10878 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
Yuya Nishihara
hgweb: fix broken URLs of RSS/Atom feeds (issue1772)...
r10674
echo % rss-log without basedir
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/rss-log' \
Thomas Arendsen Hein
test-hgwebdir: correctly include '-' in sed expression....
r10878 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
Dirkjan Ochtman
hgweb: add web.descend configuration variable
r9363
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578 cat > paths.conf <<EOF
[paths]
Patrick Mezard
hgwebdir: test virtual paths leading or trailing separators are stripped
r5586 t/a/=$root/a
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578 b=$root/b
Patrick Mezard
hgweb: extend [paths] syntax to match repositories recursively (issue852)...
r7450 coll=$root/*
Benoit Allard
hgweb: recurse down collections only if ** in [paths]...
r7523 rcoll=$root/**
Mads Kiilerich
hgwebdir: allow pure relative globs in paths...
r11677 star=*
starstar=**
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578 EOF
hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
Dirkjan Ochtman
hgwebdir: split out makeindex function, facilitate test failure diagnosis
r5601 -A access-paths.log -E error-paths-2.log
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578 cat hg.pid >> $DAEMON_PIDS
echo % should succeed, slashy names
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
Dirkjan Ochtman
tests: add tests for styled hgwebdir pages
r8217 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=paper' \
Martijn Pieters
Don't use sed -r; instead use old-style regexp...
r8245 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
Dirkjan Ochtman
tests: add tests for styled hgwebdir pages
r8217 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=paper' \
Martijn Pieters
Don't use sed -r; instead use old-style regexp...
r8245 | sed "s/[0-9]\{1,\} seconds\{0,1\} ago/seconds ago/"
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
| sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
| sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
Patrick Mezard
hgweb: extend [paths] syntax to match repositories recursively (issue852)...
r7450 # Test [paths] '*' extension
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/coll/a/file/tip/a?style=raw'
Benoit Allard
hgweb: recurse down collections only if ** in [paths]...
r7523 #test [paths] '**' extension
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/rcoll/b/d/file/tip/d?style=raw'
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578
Dirkjan Ochtman
hgweb: add web.descend configuration variable
r9363 "$TESTDIR/killdaemons.py"
cat > paths.conf <<EOF
[paths]
t/a = $root/a
t/b = $root/b
c = $root/c
[web]
descend=false
EOF
hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
-A access-paths.log -E error-paths-3.log
cat hg.pid >> $DAEMON_PIDS
echo % test descend = False
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561 cat > collections.conf <<EOF
[collections]
$root=$root
EOF
Bryan O'Sullivan
Fix issue1679: path reconstruction in hgwebdir was mangling things badly
r9184 hg serve --config web.baseurl=http://hg.example.com:8080/ -p $HGPORT2 -d \
--pid-file=hg.pid --webdir-conf collections.conf \
Bryan O'Sullivan
hgweb: return meaningful HTTP status codes instead of nonsense
r5561 -A access-collections.log -E error-collections.log
cat hg.pid >> $DAEMON_PIDS
Benoit Allard
hgweb: recurse down collections only if ** in [paths]...
r7523 echo % collections: should succeed
Dirkjan Ochtman
Add tests for hgwebdir repository names with slashes in them.
r5578 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
Dirkjan Ochtman
hgwebdir: split out makeindex function, facilitate test failure diagnosis
r5601
Yuya Nishihara
hgweb: fix broken URLs of RSS/Atom feeds (issue1772)...
r10674 echo % atom-log with basedir /
"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \
Thomas Arendsen Hein
test-hgwebdir: correctly include '-' in sed expression....
r10878 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
Yuya Nishihara
hgweb: fix broken URLs of RSS/Atom feeds (issue1772)...
r10674
echo % rss-log with basedir /
"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \
Thomas Arendsen Hein
test-hgwebdir: correctly include '-' in sed expression....
r10878 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
Yuya Nishihara
hgweb: fix broken URLs of RSS/Atom feeds (issue1772)...
r10674
"$TESTDIR/killdaemons.py"
hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \
--pid-file=hg.pid --webdir-conf collections.conf \
-A access-collections-2.log -E error-collections-2.log
cat hg.pid >> $DAEMON_PIDS
echo % atom-log with basedir /foo/
"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/atom-log' \
Thomas Arendsen Hein
test-hgwebdir: correctly include '-' in sed expression....
r10878 | grep '<link' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
Yuya Nishihara
hgweb: fix broken URLs of RSS/Atom feeds (issue1772)...
r10674
echo % rss-log with basedir /foo/
"$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/rss-log' \
Thomas Arendsen Hein
test-hgwebdir: correctly include '-' in sed expression....
r10878 | grep '<guid' | sed 's|//[.a-zA-Z0-9_-]*:[0-9][0-9]*/|//example.com:8080/|'
Dirkjan Ochtman
hgweb: add web.descend configuration variable
r9363
Dirkjan Ochtman
hgwebdir: split out makeindex function, facilitate test failure diagnosis
r5601 echo % paths errors 1
cat error-paths-1.log
echo % paths errors 2
cat error-paths-2.log
Dirkjan Ochtman
hgweb: add web.descend configuration variable
r9363 echo % paths errors 3
cat error-paths-3.log
Dirkjan Ochtman
hgwebdir: split out makeindex function, facilitate test failure diagnosis
r5601 echo % collections errors
cat error-collections.log
Yuya Nishihara
hgweb: fix broken URLs of RSS/Atom feeds (issue1772)...
r10674 echo % collections errors 2
cat error-collections-2.log