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