test-hgweb
44 lines
| 1.5 KiB
| text/plain
|
TextLexer
/ tests / test-hgweb
Brendan Cully
|
r3942 | #!/bin/sh | ||
Dirkjan Ochtman
|
r5580 | # Some tests for hgweb. Tests static files, plain files and different 404's. | ||
Brendan Cully
|
r3942 | |||
hg init test | ||||
cd test | ||||
mkdir da | ||||
echo foo > da/foo | ||||
echo foo > foo | ||||
hg ci -Ambase -d '0 0' | ||||
Matt Mackall
|
r7341 | hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | ||
Bryan O'Sullivan
|
r5561 | cat hg.pid >> $DAEMON_PIDS | ||
Brendan Cully
|
r3942 | echo % manifest | ||
Bryan O'Sullivan
|
r5384 | ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') | ||
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw') | ||||
Bryan O'Sullivan
|
r5561 | |||
echo % plain file | ||||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw' | ||||
echo % should give a 404 - static file that does not exist | ||||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus' | ||||
echo % should give a 404 - bad revision | ||||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw' | ||||
echo % should give a 400 - bad command | ||||
Bryan O'Sullivan
|
r5564 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/' | ||
Bryan O'Sullivan
|
r5561 | |||
echo % should give a 404 - file does not exist | ||||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' | ||||
Dirkjan Ochtman
|
r6368 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork' | ||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw' | ||||
Bryan O'Sullivan
|
r5561 | |||
Mirko Friedenhagen
|
r5690 | echo % stop and restart | ||
Mads Kiilerich
|
r7428 | "$TESTDIR/killdaemons.py" | ||
Mirko Friedenhagen
|
r5690 | hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log | ||
cat hg.pid >> $DAEMON_PIDS | ||||
# Test the access/error files are opened in append mode | ||||
python -c "print len(file('access.log').readlines()), 'log lines written'" | ||||
Bryan O'Sullivan
|
r5561 | echo % static file | ||
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css' | ||||
Dirkjan Ochtman
|
r5924 | |||
echo % errors | ||||
cat errors.log | ||||