annotate tests/test-hgwebdir @ 5580:f429e0e067a8

Fix style nit and add some comments to tests.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sun, 02 Dec 2007 10:12:26 +0100
parents 733b50883f73
children b90b72729a72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 #!/bin/sh
5580
f429e0e067a8 Fix style nit and add some comments to tests.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5578
diff changeset
2 # Tests some basic hgwebdir functionality. Tests setting up paths and
f429e0e067a8 Fix style nit and add some comments to tests.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5578
diff changeset
3 # collection, different forms of 404s and the subdirectory support.
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 mkdir webdir
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6 cd webdir
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 hg init a
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 echo a > a/a
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 hg --cwd a ci -Ama -d'1 0'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12 hg init b
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13 echo b > b/b
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14 hg --cwd b ci -Amb -d'2 0'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
15
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16 hg init c
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
17 echo c > c/c
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18 hg --cwd c ci -Amc -d'3 0'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 root=`pwd`
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 cd ..
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 cat > paths.conf <<EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
24 [paths]
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25 a=$root/a
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26 b=$root/b
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27 EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
28
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
30 -A access-paths.log -E error-paths.log
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31 cat hg.pid >> $DAEMON_PIDS
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
33 echo % should give a 404 - file does not exist
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
34 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36 echo % should succeed
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
38 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
39 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
40
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
41 echo % should give a 404 - repo is not published
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
42 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
43
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
44 cat > paths.conf <<EOF
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
45 [paths]
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
46 t/a=$root/a
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
47 b=$root/b
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
48 EOF
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
49
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
50 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
51 -A access-paths.log -E error-paths.log
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
52 cat hg.pid >> $DAEMON_PIDS
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
53
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
54 echo % should succeed, slashy names
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
55 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
56 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
57 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
58 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
59 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
60 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
61 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
62 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
63
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
64 cat > collections.conf <<EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
65 [collections]
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
66 $root=$root
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
67 EOF
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
68
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
69 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
70 -A access-collections.log -E error-collections.log
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
71 cat hg.pid >> $DAEMON_PIDS
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
72
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
73 echo % should succeed
5578
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
74 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
75 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
76 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
733b50883f73 Add tests for hgwebdir repository names with slashes in them.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5561
diff changeset
77 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'