Show More
@@ -2,6 +2,8 b'' | |||||
2 | Check potential race conditions between a dirstate's read and other operations |
|
2 | Check potential race conditions between a dirstate's read and other operations | |
3 | ============================================================================== |
|
3 | ============================================================================== | |
4 |
|
4 | |||
|
5 | #testcases dirstate-v1 dirstate-v2-append dirstate-v2-rewrite | |||
|
6 | ||||
5 | Some commands, like `hg status`, do not need to take the wlock but need to |
|
7 | Some commands, like `hg status`, do not need to take the wlock but need to | |
6 | access dirstate data. |
|
8 | access dirstate data. | |
7 | Other commands might update the dirstate data while this happens. |
|
9 | Other commands might update the dirstate data while this happens. | |
@@ -20,6 +22,30 b' different type of race.' | |||||
20 | Setup |
|
22 | Setup | |
21 | ===== |
|
23 | ===== | |
22 |
|
24 | |||
|
25 | $ cat >> $HGRCPATH << EOF | |||
|
26 | > [storage] | |||
|
27 | > dirstate-v2.slow-path=allow | |||
|
28 | > EOF | |||
|
29 | ||||
|
30 | #if no-dirstate-v1 | |||
|
31 | $ cat >> $HGRCPATH << EOF | |||
|
32 | > [format] | |||
|
33 | > use-dirstate-v2=yes | |||
|
34 | > EOF | |||
|
35 | #else | |||
|
36 | $ cat >> $HGRCPATH << EOF | |||
|
37 | > [format] | |||
|
38 | > use-dirstate-v2=no | |||
|
39 | > EOF | |||
|
40 | #endif | |||
|
41 | ||||
|
42 | #if dirstate-v2-rewrite | |||
|
43 | $ d2args="--config devel.dirstate.v2.data_update_mode=force-new" | |||
|
44 | #endif | |||
|
45 | #if dirstate-v2-append | |||
|
46 | $ d2args="--config devel.dirstate.v2.data_update_mode=force-append" | |||
|
47 | #endif | |||
|
48 | ||||
23 | $ directories="dir dir/nested dir2" |
|
49 | $ directories="dir dir/nested dir2" | |
24 | $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" |
|
50 | $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" | |
25 | $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" |
|
51 | $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" | |
@@ -114,7 +140,7 b' spin a `hg status` with some caches to u' | |||||
114 |
|
140 | |||
115 | Add a file |
|
141 | Add a file | |
116 |
|
142 | |||
117 |
$ hg add dir/n |
|
143 | $ hg $d2args add dir/n | |
118 | $ touch $TESTTMP/status-race-lock |
|
144 | $ touch $TESTTMP/status-race-lock | |
119 | $ wait |
|
145 | $ wait | |
120 |
|
146 | |||
@@ -129,6 +155,7 b' The file should in a "added" state' | |||||
129 |
|
155 | |||
130 | The status process should return a consistent result and not crash. |
|
156 | The status process should return a consistent result and not crash. | |
131 |
|
157 | |||
|
158 | #if dirstate-v1 | |||
132 | $ cat $TESTTMP/status-race-lock.out |
|
159 | $ cat $TESTTMP/status-race-lock.out | |
133 | A dir/n |
|
160 | A dir/n | |
134 | A dir/o |
|
161 | A dir/o | |
@@ -136,6 +163,30 b' The status process should return a consi' | |||||
136 | ? p |
|
163 | ? p | |
137 | ? q |
|
164 | ? q | |
138 | $ cat $TESTTMP/status-race-lock.log |
|
165 | $ cat $TESTTMP/status-race-lock.log | |
|
166 | #else | |||
|
167 | #if rhg | |||
|
168 | $ cat $TESTTMP/status-race-lock.out | |||
|
169 | A dir/n | |||
|
170 | A dir/o | |||
|
171 | R dir/nested/m | |||
|
172 | ? p | |||
|
173 | ? q | |||
|
174 | $ cat $TESTTMP/status-race-lock.log | |||
|
175 | #else | |||
|
176 | #if rust | |||
|
177 | #if dirstate-v2-rewrite | |||
|
178 | $ cat $TESTTMP/status-race-lock.out | |||
|
179 | $ cat $TESTTMP/status-race-lock.log | |||
|
180 | abort: $ENOENT$: '$TESTTMP/race-with-add/.hg/dirstate.* (glob) | |||
|
181 | #else | |||
|
182 | #endif | |||
|
183 | #else | |||
|
184 | $ cat $TESTTMP/status-race-lock.out | |||
|
185 | $ cat $TESTTMP/status-race-lock.log | |||
|
186 | abort: $ENOENT$: '$TESTTMP/race-with-add/.hg/dirstate.* (glob) | |||
|
187 | #endif | |||
|
188 | #endif | |||
|
189 | #endif | |||
139 |
|
190 | |||
140 | final cleanup |
|
191 | final cleanup | |
141 |
|
192 | |||
@@ -164,7 +215,7 b' Add a do a commit' | |||||
164 | ? dir/n |
|
215 | ? dir/n | |
165 | ? p |
|
216 | ? p | |
166 | ? q |
|
217 | ? q | |
167 |
$ hg |
|
218 | $ hg $d2args commit -m 'racing commit' | |
168 | $ touch $TESTTMP/status-race-lock |
|
219 | $ touch $TESTTMP/status-race-lock | |
169 | $ wait |
|
220 | $ wait | |
170 |
|
221 | |||
@@ -184,13 +235,36 b' commit was created, and status is now cl' | |||||
184 |
|
235 | |||
185 | The status process should return a consistent result and not crash. |
|
236 | The status process should return a consistent result and not crash. | |
186 |
|
237 | |||
|
238 | #if dirstate-v1 | |||
187 | $ cat $TESTTMP/status-race-lock.out |
|
239 | $ cat $TESTTMP/status-race-lock.out | |
188 |
M dir/o ( |
|
240 | M dir/o (no-rhg !) | |
|
241 | ? dir/n | |||
|
242 | ? p | |||
|
243 | ? q | |||
|
244 | $ cat $TESTTMP/status-race-lock.log | |||
|
245 | warning: ignoring unknown working parent 02a67a77ee9b! (no-rhg !) | |||
|
246 | #else | |||
|
247 | #if rhg | |||
|
248 | $ cat $TESTTMP/status-race-lock.out | |||
189 | ? dir/n |
|
249 | ? dir/n | |
190 | ? p |
|
250 | ? p | |
191 | ? q |
|
251 | ? q | |
192 | $ cat $TESTTMP/status-race-lock.log |
|
252 | $ cat $TESTTMP/status-race-lock.log | |
193 | warning: ignoring unknown working parent 02a67a77ee9b! (known-bad-output no-rhg !) |
|
253 | #else | |
|
254 | #if rust | |||
|
255 | #if dirstate-v2-rewrite | |||
|
256 | $ cat $TESTTMP/status-race-lock.out | |||
|
257 | $ cat $TESTTMP/status-race-lock.log | |||
|
258 | abort: $ENOENT$: '$TESTTMP/race-with-commit/.hg/dirstate.* (glob) | |||
|
259 | #else | |||
|
260 | #endif | |||
|
261 | #else | |||
|
262 | $ cat $TESTTMP/status-race-lock.out | |||
|
263 | $ cat $TESTTMP/status-race-lock.log | |||
|
264 | abort: $ENOENT$: '$TESTTMP/race-with-commit/.hg/dirstate.* (glob) | |||
|
265 | #endif | |||
|
266 | #endif | |||
|
267 | #endif | |||
194 |
|
268 | |||
195 | final cleanup |
|
269 | final cleanup | |
196 |
|
270 | |||
@@ -223,7 +297,7 b' do an update' | |||||
223 | | |
|
297 | | | |
224 | o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append |
|
298 | o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append | |
225 |
|
299 | |||
226 |
$ hg update --merge |
|
300 | $ hg $d2args update --merge ".~1" | |
227 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
301 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |
228 | $ touch $TESTTMP/status-race-lock |
|
302 | $ touch $TESTTMP/status-race-lock | |
229 | $ wait |
|
303 | $ wait | |
@@ -240,12 +314,36 b' do an update' | |||||
240 |
|
314 | |||
241 | The status process should return a consistent result and not crash. |
|
315 | The status process should return a consistent result and not crash. | |
242 |
|
316 | |||
|
317 | #if dirstate-v1 | |||
|
318 | $ cat $TESTTMP/status-race-lock.out | |||
|
319 | A dir/o | |||
|
320 | ? dir/n | |||
|
321 | ? p | |||
|
322 | ? q | |||
|
323 | $ cat $TESTTMP/status-race-lock.log | |||
|
324 | #else | |||
|
325 | #if rhg | |||
243 | $ cat $TESTTMP/status-race-lock.out |
|
326 | $ cat $TESTTMP/status-race-lock.out | |
244 | A dir/o |
|
327 | A dir/o | |
245 | ? dir/n |
|
328 | ? dir/n | |
246 | ? p |
|
329 | ? p | |
247 | ? q |
|
330 | ? q | |
248 | $ cat $TESTTMP/status-race-lock.log |
|
331 | $ cat $TESTTMP/status-race-lock.log | |
|
332 | #else | |||
|
333 | #if rust | |||
|
334 | #if dirstate-v2-rewrite | |||
|
335 | $ cat $TESTTMP/status-race-lock.out | |||
|
336 | $ cat $TESTTMP/status-race-lock.log | |||
|
337 | abort: $ENOENT$: '$TESTTMP/race-with-update/.hg/dirstate.* (glob) | |||
|
338 | #else | |||
|
339 | #endif | |||
|
340 | #else | |||
|
341 | $ cat $TESTTMP/status-race-lock.out | |||
|
342 | $ cat $TESTTMP/status-race-lock.log | |||
|
343 | abort: $ENOENT$: '$TESTTMP/race-with-update/.hg/dirstate.* (glob) | |||
|
344 | #endif | |||
|
345 | #endif | |||
|
346 | #endif | |||
249 |
|
347 | |||
250 | final cleanup |
|
348 | final cleanup | |
251 |
|
349 | |||
@@ -270,7 +368,7 b' spin a `hg status` with some caches to u' | |||||
270 | do an update |
|
368 | do an update | |
271 |
|
369 | |||
272 | $ touch -t 200001020006 f |
|
370 | $ touch -t 200001020006 f | |
273 | $ hg status |
|
371 | $ hg $d2args status | |
274 | A dir/o |
|
372 | A dir/o | |
275 | R dir/nested/m |
|
373 | R dir/nested/m | |
276 | ? dir/n |
|
374 | ? dir/n | |
@@ -281,6 +379,16 b' do an update' | |||||
281 |
|
379 | |||
282 | The status process should return a consistent result and not crash. |
|
380 | The status process should return a consistent result and not crash. | |
283 |
|
381 | |||
|
382 | #if dirstate-v1 | |||
|
383 | $ cat $TESTTMP/status-race-lock.out | |||
|
384 | A dir/o | |||
|
385 | R dir/nested/m | |||
|
386 | ? dir/n | |||
|
387 | ? p | |||
|
388 | ? q | |||
|
389 | $ cat $TESTTMP/status-race-lock.log | |||
|
390 | #else | |||
|
391 | #if rhg | |||
284 | $ cat $TESTTMP/status-race-lock.out |
|
392 | $ cat $TESTTMP/status-race-lock.out | |
285 | A dir/o |
|
393 | A dir/o | |
286 | R dir/nested/m |
|
394 | R dir/nested/m | |
@@ -288,6 +396,21 b' The status process should return a consi' | |||||
288 | ? p |
|
396 | ? p | |
289 | ? q |
|
397 | ? q | |
290 | $ cat $TESTTMP/status-race-lock.log |
|
398 | $ cat $TESTTMP/status-race-lock.log | |
|
399 | #else | |||
|
400 | #if rust | |||
|
401 | #if dirstate-v2-rewrite | |||
|
402 | $ cat $TESTTMP/status-race-lock.out | |||
|
403 | $ cat $TESTTMP/status-race-lock.log | |||
|
404 | abort: $ENOENT$: '$TESTTMP/race-with-status/.hg/dirstate.* (glob) | |||
|
405 | #else | |||
|
406 | #endif | |||
|
407 | #else | |||
|
408 | $ cat $TESTTMP/status-race-lock.out | |||
|
409 | $ cat $TESTTMP/status-race-lock.log | |||
|
410 | abort: $ENOENT$: '$TESTTMP/race-with-status/.hg/dirstate.* (glob) | |||
|
411 | #endif | |||
|
412 | #endif | |||
|
413 | #endif | |||
291 |
|
414 | |||
292 | final cleanup |
|
415 | final cleanup | |
293 |
|
416 |
General Comments 0
You need to be logged in to leave comments.
Login now