##// END OF EJS Templates
tests: fix test-hgweb to not leak directory name
Matt Mackall -
r7341:6cb522c5 default
parent child Browse files
Show More
@@ -1,44 +1,44
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 -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 kill `cat hg.pid`
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,279 +1,279
1 adding da/foo
1 adding da/foo
2 adding foo
2 adding foo
3 % manifest
3 % manifest
4 200 Script output follows
4 200 Script output follows
5
5
6
6
7 drwxr-xr-x da
7 drwxr-xr-x da
8 -rw-r--r-- 4 foo
8 -rw-r--r-- 4 foo
9
9
10
10
11 200 Script output follows
11 200 Script output follows
12
12
13
13
14 -rw-r--r-- 4 foo
14 -rw-r--r-- 4 foo
15
15
16
16
17 % plain file
17 % plain file
18 200 Script output follows
18 200 Script output follows
19
19
20 foo
20 foo
21 % should give a 404 - static file that does not exist
21 % should give a 404 - static file that does not exist
22 404 Not Found
22 404 Not Found
23
23
24 <!-- quirksmode -->
24 <!-- quirksmode -->
25 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
25 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
26 <html>
26 <html>
27 <head>
27 <head>
28 <link rel="icon" href="/static/hgicon.png" type="image/png">
28 <link rel="icon" href="/static/hgicon.png" type="image/png">
29 <meta name="robots" content="index, nofollow" />
29 <meta name="robots" content="index, nofollow" />
30 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
30 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
31
31
32 <title>/tmp/hgtests.N4Sjj6/test-hgweb/test: error</title>
32 <title>test: error</title>
33 </head>
33 </head>
34 <body>
34 <body>
35
35
36 <div class="container">
36 <div class="container">
37 <div class="menu">
37 <div class="menu">
38 <div class="logo">
38 <div class="logo">
39 <a href="http://www.selenic.com/mercurial/">
39 <a href="http://www.selenic.com/mercurial/">
40 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
40 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
41 </div>
41 </div>
42 <ul>
42 <ul>
43 <li><a href="/log">log</a></li>
43 <li><a href="/log">log</a></li>
44 <li><a href="/graph">graph</a></li>
44 <li><a href="/graph">graph</a></li>
45 <li><a href="/tags">tags</a></li>
45 <li><a href="/tags">tags</a></li>
46 </ul>
46 </ul>
47 </div>
47 </div>
48
48
49 <div class="main">
49 <div class="main">
50
50
51 <h2><a href="/">/tmp/hgtests.N4Sjj6/test-hgweb/test</a></h2>
51 <h2><a href="/">test</a></h2>
52 <h3>error</h3>
52 <h3>error</h3>
53
53
54 <form class="search" action="/log">
54 <form class="search" action="/log">
55
55
56 <p><input name="rev" id="search1" type="text" size="30"></p>
56 <p><input name="rev" id="search1" type="text" size="30"></p>
57 <span>find changesets by author, revision,
57 <span>find changesets by author, revision,
58 files, or words in the commit message</span>
58 files, or words in the commit message</span>
59 </form>
59 </form>
60
60
61 <div class="description">
61 <div class="description">
62 <p>
62 <p>
63 An error occurred while processing your request:
63 An error occurred while processing your request:
64 </p>
64 </p>
65 <p>
65 <p>
66 Not Found
66 Not Found
67 </p>
67 </p>
68 </div>
68 </div>
69 </div>
69 </div>
70 </div>
70 </div>
71
71
72
72
73
73
74 </body>
74 </body>
75 </html>
75 </html>
76
76
77 % should give a 404 - bad revision
77 % should give a 404 - bad revision
78 404 Not Found
78 404 Not Found
79
79
80
80
81 error: revision not found: spam
81 error: revision not found: spam
82 % should give a 400 - bad command
82 % should give a 400 - bad command
83 400
83 400
84
84
85
85
86 error: no such method: spam
86 error: no such method: spam
87 % should give a 404 - file does not exist
87 % should give a 404 - file does not exist
88 404 Not Found
88 404 Not Found
89
89
90
90
91 error: bork@2ef0ac749a14: not found in manifest
91 error: bork@2ef0ac749a14: not found in manifest
92 404 Not Found
92 404 Not Found
93
93
94 <!-- quirksmode -->
94 <!-- quirksmode -->
95 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
95 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
96 <html>
96 <html>
97 <head>
97 <head>
98 <link rel="icon" href="/static/hgicon.png" type="image/png">
98 <link rel="icon" href="/static/hgicon.png" type="image/png">
99 <meta name="robots" content="index, nofollow" />
99 <meta name="robots" content="index, nofollow" />
100 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
100 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
101
101
102 <title>/tmp/hgtests.N4Sjj6/test-hgweb/test: error</title>
102 <title>test: error</title>
103 </head>
103 </head>
104 <body>
104 <body>
105
105
106 <div class="container">
106 <div class="container">
107 <div class="menu">
107 <div class="menu">
108 <div class="logo">
108 <div class="logo">
109 <a href="http://www.selenic.com/mercurial/">
109 <a href="http://www.selenic.com/mercurial/">
110 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
110 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
111 </div>
111 </div>
112 <ul>
112 <ul>
113 <li><a href="/log">log</a></li>
113 <li><a href="/log">log</a></li>
114 <li><a href="/graph">graph</a></li>
114 <li><a href="/graph">graph</a></li>
115 <li><a href="/tags">tags</a></li>
115 <li><a href="/tags">tags</a></li>
116 </ul>
116 </ul>
117 </div>
117 </div>
118
118
119 <div class="main">
119 <div class="main">
120
120
121 <h2><a href="/">/tmp/hgtests.N4Sjj6/test-hgweb/test</a></h2>
121 <h2><a href="/">test</a></h2>
122 <h3>error</h3>
122 <h3>error</h3>
123
123
124 <form class="search" action="/log">
124 <form class="search" action="/log">
125
125
126 <p><input name="rev" id="search1" type="text" size="30"></p>
126 <p><input name="rev" id="search1" type="text" size="30"></p>
127 <span>find changesets by author, revision,
127 <span>find changesets by author, revision,
128 files, or words in the commit message</span>
128 files, or words in the commit message</span>
129 </form>
129 </form>
130
130
131 <div class="description">
131 <div class="description">
132 <p>
132 <p>
133 An error occurred while processing your request:
133 An error occurred while processing your request:
134 </p>
134 </p>
135 <p>
135 <p>
136 bork@2ef0ac749a14: not found in manifest
136 bork@2ef0ac749a14: not found in manifest
137 </p>
137 </p>
138 </div>
138 </div>
139 </div>
139 </div>
140 </div>
140 </div>
141
141
142
142
143
143
144 </body>
144 </body>
145 </html>
145 </html>
146
146
147 404 Not Found
147 404 Not Found
148
148
149
149
150 error: bork@2ef0ac749a14: not found in manifest
150 error: bork@2ef0ac749a14: not found in manifest
151 % stop and restart
151 % stop and restart
152 9 log lines written
152 9 log lines written
153 % static file
153 % static file
154 200 Script output follows
154 200 Script output follows
155
155
156 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; }
156 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; }
157 a { color:#0000cc; }
157 a { color:#0000cc; }
158 a:hover, a:visited, a:active { color:#880000; }
158 a:hover, a:visited, a:active { color:#880000; }
159 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
159 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
160 div.page_header a:visited { color:#0000cc; }
160 div.page_header a:visited { color:#0000cc; }
161 div.page_header a:hover { color:#880000; }
161 div.page_header a:hover { color:#880000; }
162 div.page_nav { padding:8px; }
162 div.page_nav { padding:8px; }
163 div.page_nav a:visited { color:#0000cc; }
163 div.page_nav a:visited { color:#0000cc; }
164 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
164 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px}
165 div.page_footer { padding:4px 8px; background-color: #d9d8d1; }
165 div.page_footer { padding:4px 8px; background-color: #d9d8d1; }
166 div.page_footer_text { float:left; color:#555555; font-style:italic; }
166 div.page_footer_text { float:left; color:#555555; font-style:italic; }
167 div.page_body { padding:8px; }
167 div.page_body { padding:8px; }
168 div.title, a.title {
168 div.title, a.title {
169 display:block; padding:6px 8px;
169 display:block; padding:6px 8px;
170 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
170 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000;
171 }
171 }
172 a.title:hover { background-color: #d9d8d1; }
172 a.title:hover { background-color: #d9d8d1; }
173 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; }
173 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; }
174 div.log_body { padding:8px 8px 8px 150px; }
174 div.log_body { padding:8px 8px 8px 150px; }
175 .age { white-space:nowrap; }
175 .age { white-space:nowrap; }
176 span.age { position:relative; float:left; width:142px; font-style:italic; }
176 span.age { position:relative; float:left; width:142px; font-style:italic; }
177 div.log_link {
177 div.log_link {
178 padding:0px 8px;
178 padding:0px 8px;
179 font-size:10px; font-family:sans-serif; font-style:normal;
179 font-size:10px; font-family:sans-serif; font-style:normal;
180 position:relative; float:left; width:136px;
180 position:relative; float:left; width:136px;
181 }
181 }
182 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; }
182 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; }
183 a.list { text-decoration:none; color:#000000; }
183 a.list { text-decoration:none; color:#000000; }
184 a.list:hover { text-decoration:underline; color:#880000; }
184 a.list:hover { text-decoration:underline; color:#880000; }
185 table { padding:8px 4px; }
185 table { padding:8px 4px; }
186 th { padding:2px 5px; font-size:12px; text-align:left; }
186 th { padding:2px 5px; font-size:12px; text-align:left; }
187 tr.light:hover, .parity0:hover { background-color:#edece6; }
187 tr.light:hover, .parity0:hover { background-color:#edece6; }
188 tr.dark, .parity1 { background-color:#f6f6f0; }
188 tr.dark, .parity1 { background-color:#f6f6f0; }
189 tr.dark:hover, .parity1:hover { background-color:#edece6; }
189 tr.dark:hover, .parity1:hover { background-color:#edece6; }
190 td { padding:2px 5px; font-size:12px; vertical-align:top; }
190 td { padding:2px 5px; font-size:12px; vertical-align:top; }
191 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
191 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
192 td.indexlinks { white-space: nowrap; }
192 td.indexlinks { white-space: nowrap; }
193 td.indexlinks a {
193 td.indexlinks a {
194 padding: 2px 5px; line-height: 10px;
194 padding: 2px 5px; line-height: 10px;
195 border: 1px solid;
195 border: 1px solid;
196 color: #ffffff; background-color: #7777bb;
196 color: #ffffff; background-color: #7777bb;
197 border-color: #aaaadd #333366 #333366 #aaaadd;
197 border-color: #aaaadd #333366 #333366 #aaaadd;
198 font-weight: bold; text-align: center; text-decoration: none;
198 font-weight: bold; text-align: center; text-decoration: none;
199 font-size: 10px;
199 font-size: 10px;
200 }
200 }
201 td.indexlinks a:hover { background-color: #6666aa; }
201 td.indexlinks a:hover { background-color: #6666aa; }
202 div.pre { font-family:monospace; font-size:12px; white-space:pre; }
202 div.pre { font-family:monospace; font-size:12px; white-space:pre; }
203 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
203 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; }
204 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
204 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; }
205 div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
205 div.search { margin:4px 8px; position:absolute; top:56px; right:12px }
206 .linenr { color:#999999; text-decoration:none }
206 .linenr { color:#999999; text-decoration:none }
207 div.rss_logo { float: right; white-space: nowrap; }
207 div.rss_logo { float: right; white-space: nowrap; }
208 div.rss_logo a {
208 div.rss_logo a {
209 padding:3px 6px; line-height:10px;
209 padding:3px 6px; line-height:10px;
210 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
210 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
211 color:#ffffff; background-color:#ff6600;
211 color:#ffffff; background-color:#ff6600;
212 font-weight:bold; font-family:sans-serif; font-size:10px;
212 font-weight:bold; font-family:sans-serif; font-size:10px;
213 text-align:center; text-decoration:none;
213 text-align:center; text-decoration:none;
214 }
214 }
215 div.rss_logo a:hover { background-color:#ee5500; }
215 div.rss_logo a:hover { background-color:#ee5500; }
216 pre { margin: 0; }
216 pre { margin: 0; }
217 span.logtags span {
217 span.logtags span {
218 padding: 0px 4px;
218 padding: 0px 4px;
219 font-size: 10px;
219 font-size: 10px;
220 font-weight: normal;
220 font-weight: normal;
221 border: 1px solid;
221 border: 1px solid;
222 background-color: #ffaaff;
222 background-color: #ffaaff;
223 border-color: #ffccff #ff00ee #ff00ee #ffccff;
223 border-color: #ffccff #ff00ee #ff00ee #ffccff;
224 }
224 }
225 span.logtags span.tagtag {
225 span.logtags span.tagtag {
226 background-color: #ffffaa;
226 background-color: #ffffaa;
227 border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
227 border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
228 }
228 }
229 span.logtags span.branchtag {
229 span.logtags span.branchtag {
230 background-color: #aaffaa;
230 background-color: #aaffaa;
231 border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
231 border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
232 }
232 }
233 span.logtags span.inbranchtag {
233 span.logtags span.inbranchtag {
234 background-color: #d5dde6;
234 background-color: #d5dde6;
235 border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4;
235 border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4;
236 }
236 }
237
237
238 /* Graph */
238 /* Graph */
239 div#wrapper {
239 div#wrapper {
240 position: relative;
240 position: relative;
241 margin: 0;
241 margin: 0;
242 padding: 0;
242 padding: 0;
243 margin-top: 3px;
243 margin-top: 3px;
244 }
244 }
245
245
246 canvas {
246 canvas {
247 position: absolute;
247 position: absolute;
248 z-index: 5;
248 z-index: 5;
249 top: -0.9em;
249 top: -0.9em;
250 margin: 0;
250 margin: 0;
251 }
251 }
252
252
253 ul#nodebgs {
253 ul#nodebgs {
254 list-style: none inside none;
254 list-style: none inside none;
255 padding: 0;
255 padding: 0;
256 margin: 0;
256 margin: 0;
257 top: -0.7em;
257 top: -0.7em;
258 }
258 }
259
259
260 ul#graphnodes li, ul#nodebgs li {
260 ul#graphnodes li, ul#nodebgs li {
261 height: 39px;
261 height: 39px;
262 }
262 }
263
263
264 ul#graphnodes {
264 ul#graphnodes {
265 position: absolute;
265 position: absolute;
266 z-index: 10;
266 z-index: 10;
267 top: -0.8em;
267 top: -0.8em;
268 list-style: none inside none;
268 list-style: none inside none;
269 padding: 0;
269 padding: 0;
270 }
270 }
271
271
272 ul#graphnodes li .info {
272 ul#graphnodes li .info {
273 display: block;
273 display: block;
274 font-size: 100%;
274 font-size: 100%;
275 position: relative;
275 position: relative;
276 top: -3px;
276 top: -3px;
277 font-style: italic;
277 font-style: italic;
278 }
278 }
279 % errors
279 % errors
General Comments 0
You need to be logged in to leave comments. Login now