test-hgwebdir
77 lines
| 2.3 KiB
| text/plain
|
TextLexer
/ tests / test-hgwebdir
Bryan O'Sullivan
|
r5561 | #!/bin/sh | ||
Dirkjan Ochtman
|
r5580 | # Tests some basic hgwebdir functionality. Tests setting up paths and | ||
# collection, different forms of 404s and the subdirectory support. | ||||
Bryan O'Sullivan
|
r5561 | |||
mkdir webdir | ||||
cd webdir | ||||
hg init a | ||||
echo a > a/a | ||||
hg --cwd a ci -Ama -d'1 0' | ||||
hg init b | ||||
echo b > b/b | ||||
hg --cwd b ci -Amb -d'2 0' | ||||
hg init c | ||||
echo c > c/c | ||||
hg --cwd c ci -Amc -d'3 0' | ||||
root=`pwd` | ||||
cd .. | ||||
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 \ | ||||
-A access-paths.log -E error-paths.log | ||||
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' | ||||
Dirkjan Ochtman
|
r5578 | cat > paths.conf <<EOF | ||
[paths] | ||||
Patrick Mezard
|
r5586 | t/a/=$root/a | ||
Dirkjan Ochtman
|
r5578 | b=$root/b | ||
EOF | ||||
hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \ | ||||
-A access-paths.log -E error-paths.log | ||||
cat hg.pid >> $DAEMON_PIDS | ||||
echo % should succeed, slashy names | ||||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' | ||||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw' | ||||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw' | ||||
"$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' | ||||
Bryan O'Sullivan
|
r5561 | cat > collections.conf <<EOF | ||
[collections] | ||||
$root=$root | ||||
EOF | ||||
Dirkjan Ochtman
|
r5578 | hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \ | ||
Bryan O'Sullivan
|
r5561 | -A access-collections.log -E error-collections.log | ||
cat hg.pid >> $DAEMON_PIDS | ||||
echo % should succeed | ||||
Dirkjan Ochtman
|
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' | ||||