##// END OF EJS Templates
tests: add more testing for webdir nesting
Dirkjan Ochtman -
r7202:268c582b default
parent child Browse files
Show More
@@ -1,84 +1,91 b''
1 1 #!/bin/sh
2 2 # Tests some basic hgwebdir functionality. Tests setting up paths and
3 3 # collection, different forms of 404s and the subdirectory support.
4 4
5 5 mkdir webdir
6 6 cd webdir
7 7
8 8 hg init a
9 9 echo a > a/a
10 10 hg --cwd a ci -Ama -d'1 0'
11 11
12 12 hg init b
13 13 echo b > b/b
14 14 hg --cwd b ci -Amb -d'2 0'
15 15
16 16 hg init c
17 17 echo c > c/c
18 18 hg --cwd c ci -Amc -d'3 0'
19
20 cd b
21 hg init d
22 echo d > d/d
23 hg --cwd d ci -Amd
24 cd ..
25
19 26 root=`pwd`
20
21 27 cd ..
22 28
23 29 cat > paths.conf <<EOF
24 30 [paths]
25 31 a=$root/a
26 32 b=$root/b
27 33 EOF
28 34
29 35 hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \
30 36 -A access-paths.log -E error-paths-1.log
31 37 cat hg.pid >> $DAEMON_PIDS
32 38
33 39 echo % should give a 404 - file does not exist
34 40 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw'
35 41
36 42 echo % should succeed
37 43 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw'
38 44 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw'
39 45 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw'
40 46
41 47 echo % should give a 404 - repo is not published
42 48 "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw'
43 49
44 50 cat > paths.conf <<EOF
45 51 [paths]
46 52 t/a/=$root/a
47 53 b=$root/b
48 54 EOF
49 55
50 56 hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf paths.conf \
51 57 -A access-paths.log -E error-paths-2.log
52 58 cat hg.pid >> $DAEMON_PIDS
53 59
54 60 echo % should succeed, slashy names
55 61 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw'
56 62 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t?style=raw'
57 63 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/?style=raw'
58 64 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a?style=atom' \
59 65 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
60 66 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/?style=atom' \
61 67 | sed "s/http:\/\/[^/]*\//http:\/\/127.0.0.1\//"
62 68 "$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/t/a/file/tip/a?style=raw'
63 69
64 70 cat > collections.conf <<EOF
65 71 [collections]
66 72 $root=$root
67 73 EOF
68 74
69 75 hg serve -p $HGPORT2 -d --pid-file=hg.pid --webdir-conf collections.conf \
70 76 -A access-collections.log -E error-collections.log
71 77 cat hg.pid >> $DAEMON_PIDS
72 78
73 79 echo % should succeed
74 80 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/?style=raw'
75 81 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/a/file/tip/a?style=raw'
76 82 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/file/tip/b?style=raw'
77 83 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/c/file/tip/c?style=raw'
84 "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 '/b/d/rev/tip/?style=raw'
78 85
79 86 echo % paths errors 1
80 87 cat error-paths-1.log
81 88 echo % paths errors 2
82 89 cat error-paths-2.log
83 90 echo % collections errors
84 91 cat error-collections.log
@@ -1,124 +1,141 b''
1 1 adding a
2 2 adding b
3 3 adding c
4 adding d
4 5 % should give a 404 - file does not exist
5 6 404 Not Found
6 7
7 8
8 9 error: bork@8580ff50825a: not found in manifest
9 10 % should succeed
10 11 200 Script output follows
11 12
12 13
13 14 /a/
14 15 /b/
15 16
16 17 200 Script output follows
17 18
18 19 a
19 20 200 Script output follows
20 21
21 22 b
22 23 % should give a 404 - repo is not published
23 24 404 Not Found
24 25
25 26
26 27 error: repository c not found
27 28 % should succeed, slashy names
28 29 200 Script output follows
29 30
30 31
31 32 /b/
32 33 /t/a/
33 34
34 35 200 Script output follows
35 36
36 37
37 38 /t/a/
38 39
39 40 200 Script output follows
40 41
41 42
42 43 /t/a/
43 44
44 45 200 Script output follows
45 46
46 47 <?xml version="1.0" encoding="ascii"?>
47 48 <feed xmlns="http://127.0.0.1/2005/Atom">
48 49 <!-- Changelog -->
49 50 <id>http://127.0.0.1/t/a/</id>
50 51 <link rel="self" href="http://127.0.0.1/t/a/atom-log"/>
51 52 <link rel="alternate" href="http://127.0.0.1/t/a/"/>
52 53 <title>t/a Changelog</title>
53 54 <updated>1970-01-01T00:00:01+00:00</updated>
54 55
55 56 <entry>
56 57 <title>a</title>
57 58 <id>http://127.0.0.1/mercurial/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id>
58 59 <link href="http://127.0.0.1/t/a/rev/8580ff50825a50c8f716709acdf8de0deddcd6ab"/>
59 60 <author>
60 61 <name>test</name>
61 62 <email>&#116;&#101;&#115;&#116;</email>
62 63 </author>
63 64 <updated>1970-01-01T00:00:01+00:00</updated>
64 65 <published>1970-01-01T00:00:01+00:00</published>
65 66 <content type="xhtml">
66 67 <div xmlns="http://127.0.0.1/1999/xhtml">
67 68 <pre xml:space="preserve">a</pre>
68 69 </div>
69 70 </content>
70 71 </entry>
71 72
72 73 </feed>
73 74 200 Script output follows
74 75
75 76 <?xml version="1.0" encoding="ascii"?>
76 77 <feed xmlns="http://127.0.0.1/2005/Atom">
77 78 <!-- Changelog -->
78 79 <id>http://127.0.0.1/t/a/</id>
79 80 <link rel="self" href="http://127.0.0.1/t/a/atom-log"/>
80 81 <link rel="alternate" href="http://127.0.0.1/t/a/"/>
81 82 <title>t/a Changelog</title>
82 83 <updated>1970-01-01T00:00:01+00:00</updated>
83 84
84 85 <entry>
85 86 <title>a</title>
86 87 <id>http://127.0.0.1/mercurial/#changeset-8580ff50825a50c8f716709acdf8de0deddcd6ab</id>
87 88 <link href="http://127.0.0.1/t/a/rev/8580ff50825a50c8f716709acdf8de0deddcd6ab"/>
88 89 <author>
89 90 <name>test</name>
90 91 <email>&#116;&#101;&#115;&#116;</email>
91 92 </author>
92 93 <updated>1970-01-01T00:00:01+00:00</updated>
93 94 <published>1970-01-01T00:00:01+00:00</published>
94 95 <content type="xhtml">
95 96 <div xmlns="http://127.0.0.1/1999/xhtml">
96 97 <pre xml:space="preserve">a</pre>
97 98 </div>
98 99 </content>
99 100 </entry>
100 101
101 102 </feed>
102 103 200 Script output follows
103 104
104 105 a
105 106 % should succeed
106 107 200 Script output follows
107 108
108 109
109 110 /a/
110 111 /b/
112 /b/d/
111 113 /c/
112 114
113 115 200 Script output follows
114 116
115 117 a
116 118 200 Script output follows
117 119
118 120 b
119 121 200 Script output follows
120 122
121 123 c
124 200 Script output follows
125
126
127 # HG changeset patch
128 # User test
129 # Date 0 0
130 # Node ID 43cb50608b2ae8635a62e2e8730adefc32a274ee
131
132 d
133
134 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
135 +++ b/d Thu Jan 01 00:00:00 1970 +0000
136 @@ -0,0 +1,1 @@
137 +d
138
122 139 % paths errors 1
123 140 % paths errors 2
124 141 % collections errors
General Comments 0
You need to be logged in to leave comments. Login now