1 #!/bin/sh |
|
2 # Some tests for hgweb. Tests static files, plain files and different 404's. |
|
3 |
|
4 hg init test |
|
5 cd test |
|
6 mkdir da |
|
7 echo foo > da/foo |
|
8 echo foo > foo |
|
9 hg ci -Ambase |
|
10 |
|
11 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
12 cat hg.pid >> $DAEMON_PIDS |
|
13 |
|
14 echo % manifest |
|
15 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') |
|
16 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw') |
|
17 |
|
18 echo % plain file |
|
19 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw' |
|
20 |
|
21 echo % should give a 404 - static file that does not exist |
|
22 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus' |
|
23 |
|
24 echo % should give a 404 - bad revision |
|
25 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw' |
|
26 |
|
27 echo % should give a 400 - bad command |
|
28 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/' |
|
29 |
|
30 echo % should give a 404 - file does not exist |
|
31 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' |
|
32 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork' |
|
33 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw' |
|
34 |
|
35 echo % try bad style |
|
36 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=foobar') |
|
37 |
|
38 echo % stop and restart |
|
39 "$TESTDIR/killdaemons.py" |
|
40 hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log |
|
41 cat hg.pid >> $DAEMON_PIDS |
|
42 # Test the access/error files are opened in append mode |
|
43 python -c "print len(file('access.log').readlines()), 'log lines written'" |
|
44 |
|
45 echo % static file |
|
46 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css' |
|
47 |
|
48 echo % errors |
|
49 cat errors.log |
|