Show More
@@ -1,44 +1,44 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 | # Some tests for hgweb. Tests static files, plain files and different 404's. |
|
2 | # Some tests for hgweb. Tests static files, plain files and different 404's. | |
3 |
|
3 | |||
4 | hg init test |
|
4 | hg init test | |
5 | cd test |
|
5 | cd test | |
6 | mkdir da |
|
6 | mkdir da | |
7 | echo foo > da/foo |
|
7 | echo foo > da/foo | |
8 | echo foo > foo |
|
8 | echo foo > foo | |
9 | hg ci -Ambase -d '0 0' |
|
9 | hg ci -Ambase -d '0 0' | |
10 | hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
10 | hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
11 | cat hg.pid >> $DAEMON_PIDS |
|
11 | cat hg.pid >> $DAEMON_PIDS | |
12 | echo % manifest |
|
12 | echo % manifest | |
13 | ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') |
|
13 | ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') | |
14 | ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw') |
|
14 | ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw') | |
15 |
|
15 | |||
16 | echo % plain file |
|
16 | echo % plain file | |
17 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw' |
|
17 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw' | |
18 |
|
18 | |||
19 | echo % should give a 404 - static file that does not exist |
|
19 | echo % should give a 404 - static file that does not exist | |
20 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus' |
|
20 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus' | |
21 |
|
21 | |||
22 | echo % should give a 404 - bad revision |
|
22 | echo % should give a 404 - bad revision | |
23 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw' |
|
23 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw' | |
24 |
|
24 | |||
25 | echo % should give a 400 - bad command |
|
25 | echo % should give a 400 - bad command | |
26 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/' |
|
26 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/' | |
27 |
|
27 | |||
28 | echo % should give a 404 - file does not exist |
|
28 | echo % should give a 404 - file does not exist | |
29 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' |
|
29 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' | |
30 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork' |
|
30 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork' | |
31 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw' |
|
31 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw' | |
32 |
|
32 | |||
33 | echo % stop and restart |
|
33 | echo % stop and restart | |
34 | kill `cat hg.pid` |
|
34 | "$TESTDIR/killdaemons.py" | |
35 | hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log |
|
35 | hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log | |
36 | cat hg.pid >> $DAEMON_PIDS |
|
36 | cat hg.pid >> $DAEMON_PIDS | |
37 | # Test the access/error files are opened in append mode |
|
37 | # Test the access/error files are opened in append mode | |
38 | python -c "print len(file('access.log').readlines()), 'log lines written'" |
|
38 | python -c "print len(file('access.log').readlines()), 'log lines written'" | |
39 |
|
39 | |||
40 | echo % static file |
|
40 | echo % static file | |
41 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css' |
|
41 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css' | |
42 |
|
42 | |||
43 | echo % errors |
|
43 | echo % errors | |
44 | cat errors.log |
|
44 | cat errors.log |
@@ -1,34 +1,34 b'' | |||||
1 | echo % setting up repo |
|
1 | echo % setting up repo | |
2 | hg init test |
|
2 | hg init test | |
3 | cd test |
|
3 | cd test | |
4 | echo a > a |
|
4 | echo a > a | |
5 | echo b > b |
|
5 | echo b > b | |
6 | hg ci -Ama |
|
6 | hg ci -Ama | |
7 |
|
7 | |||
8 | echo % change permissions for git diffs |
|
8 | echo % change permissions for git diffs | |
9 | chmod 755 a |
|
9 | chmod 755 a | |
10 | hg ci -Amb |
|
10 | hg ci -Amb | |
11 |
|
11 | |||
12 | echo % set up hgweb |
|
12 | echo % set up hgweb | |
13 | hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
13 | hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
14 | cat hg.pid >> $DAEMON_PIDS |
|
14 | cat hg.pid >> $DAEMON_PIDS | |
15 |
|
15 | |||
16 | echo % revision |
|
16 | echo % revision | |
17 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0' |
|
17 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0' | |
18 |
|
18 | |||
19 | echo % diff removed file |
|
19 | echo % diff removed file | |
20 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' |
|
20 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' | |
21 |
|
21 | |||
22 | echo % set up hgweb with git diffs |
|
22 | echo % set up hgweb with git diffs | |
23 | kill `cat hg.pid` |
|
23 | "$TESTDIR/killdaemons.py" | |
24 | hg serve --config 'diff.git=1' -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
24 | hg serve --config 'diff.git=1' -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
25 | cat hg.pid >> $DAEMON_PIDS |
|
25 | cat hg.pid >> $DAEMON_PIDS | |
26 |
|
26 | |||
27 | echo % revision |
|
27 | echo % revision | |
28 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0' |
|
28 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/0' | |
29 |
|
29 | |||
30 | echo % diff removed file |
|
30 | echo % diff removed file | |
31 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' |
|
31 | "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a' | |
32 |
|
32 | |||
33 | echo % errors |
|
33 | echo % errors | |
34 | cat errors.log |
|
34 | cat errors.log |
General Comments 0
You need to be logged in to leave comments.
Login now