Show More
@@ -1,418 +1,554 | |||||
1 | ============================================================================== |
|
1 | ============================================================================== | |
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 |
|
5 | #testcases dirstate-v1 dirstate-v2-append dirstate-v2-rewrite | |
|
6 | #testcases pre-all-read pre-some-read | |||
6 |
|
7 | |||
7 | Some commands, like `hg status`, do not need to take the wlock but need to |
|
8 | Some commands, like `hg status`, do not need to take the wlock but need to | |
8 | access dirstate data. |
|
9 | access dirstate data. | |
9 | Other commands might update the dirstate data while this happens. |
|
10 | Other commands might update the dirstate data while this happens. | |
10 |
|
11 | |||
11 | This can create issues if repository data is read in the wrong order, or for |
|
12 | This can create issues if repository data is read in the wrong order, or for | |
12 | the dirstate-v2 format where the data is contained in multiple files. |
|
13 | the dirstate-v2 format where the data is contained in multiple files. | |
13 |
|
14 | |||
14 | This test file is meant to test various cases where such parallel operations |
|
15 | This test file is meant to test various cases where such parallel operations | |
15 | happen and make sure the reading process behaves fine. We do so with a `hg |
|
16 | happen and make sure the reading process behaves fine. We do so with a `hg | |
16 | status` command since it is probably the most advanced of such read-only |
|
17 | status` command since it is probably the most advanced of such read-only | |
17 | command. |
|
18 | command. | |
18 |
|
19 | |||
19 | It bears simililarity with `tests/test-dirstate-status-race.t ` but tests a |
|
20 | It bears simililarity with `tests/test-dirstate-status-race.t ` but tests a | |
20 | different type of race. |
|
21 | different type of race. | |
21 |
|
22 | |||
22 | Setup |
|
23 | Setup | |
23 | ===== |
|
24 | ===== | |
24 |
|
25 | |||
25 | $ cat >> $HGRCPATH << EOF |
|
26 | $ cat >> $HGRCPATH << EOF | |
26 | > [storage] |
|
27 | > [storage] | |
27 | > dirstate-v2.slow-path=allow |
|
28 | > dirstate-v2.slow-path=allow | |
28 | > EOF |
|
29 | > EOF | |
29 |
|
30 | |||
30 | #if no-dirstate-v1 |
|
31 | #if no-dirstate-v1 | |
31 | $ cat >> $HGRCPATH << EOF |
|
32 | $ cat >> $HGRCPATH << EOF | |
32 | > [format] |
|
33 | > [format] | |
33 | > use-dirstate-v2=yes |
|
34 | > use-dirstate-v2=yes | |
34 | > EOF |
|
35 | > EOF | |
35 | #else |
|
36 | #else | |
36 | $ cat >> $HGRCPATH << EOF |
|
37 | $ cat >> $HGRCPATH << EOF | |
37 | > [format] |
|
38 | > [format] | |
38 | > use-dirstate-v2=no |
|
39 | > use-dirstate-v2=no | |
39 | > EOF |
|
40 | > EOF | |
40 | #endif |
|
41 | #endif | |
41 |
|
42 | |||
42 | #if dirstate-v2-rewrite |
|
43 | #if dirstate-v2-rewrite | |
43 | $ d2args="--config devel.dirstate.v2.data_update_mode=force-new" |
|
44 | $ d2args="--config devel.dirstate.v2.data_update_mode=force-new" | |
44 | #endif |
|
45 | #endif | |
45 | #if dirstate-v2-append |
|
46 | #if dirstate-v2-append | |
46 | $ d2args="--config devel.dirstate.v2.data_update_mode=force-append" |
|
47 | $ d2args="--config devel.dirstate.v2.data_update_mode=force-append" | |
47 | #endif |
|
48 | #endif | |
48 |
|
49 | |||
|
50 | ||||
|
51 | #if dirstate-v1 | |||
|
52 | $ cfg="devel.sync.dirstate.pre-read-file" | |||
|
53 | #else | |||
|
54 | #if pre-all-read | |||
|
55 | $ cfg="devel.sync.dirstate.pre-read-file" | |||
|
56 | #else | |||
|
57 | $ cfg="devel.sync.dirstate.post-docket-read-file" | |||
|
58 | #endif | |||
|
59 | #endif | |||
|
60 | ||||
49 | $ directories="dir dir/nested dir2" |
|
61 | $ directories="dir dir/nested dir2" | |
50 | $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" |
|
62 | $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" | |
51 | $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" |
|
63 | $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" | |
52 | $ extra_files="dir/n dir/o p q" |
|
64 | $ extra_files="dir/n dir/o p q" | |
53 |
|
65 | |||
54 | $ hg init reference-repo |
|
66 | $ hg init reference-repo | |
55 | $ cd reference-repo |
|
67 | $ cd reference-repo | |
56 | $ mkdir -p dir/nested dir2 |
|
68 | $ mkdir -p dir/nested dir2 | |
57 | $ touch -t 200001010000 $first_files $directories |
|
69 | $ touch -t 200001010000 $first_files $directories | |
58 | $ hg commit -Aqm "recreate a bunch of files to facilitate dirstate-v2 append" |
|
70 | $ hg commit -Aqm "recreate a bunch of files to facilitate dirstate-v2 append" | |
59 | $ touch -t 200001010010 $second_files $directories |
|
71 | $ touch -t 200001010010 $second_files $directories | |
60 | $ hg commit -Aqm "more files to have two commit" |
|
72 | $ hg commit -Aqm "more files to have two commit" | |
61 | $ hg log -G -v |
|
73 | $ hg log -G -v | |
62 | @ changeset: 1:9a86dcbfb938 |
|
74 | @ changeset: 1:9a86dcbfb938 | |
63 | | tag: tip |
|
75 | | tag: tip | |
64 | | user: test |
|
76 | | user: test | |
65 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
77 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
66 | | files: dir/i dir/j dir/nested/h dir/nested/m dir2/k dir2/l g |
|
78 | | files: dir/i dir/j dir/nested/h dir/nested/m dir2/k dir2/l g | |
67 | | description: |
|
79 | | description: | |
68 | | more files to have two commit |
|
80 | | more files to have two commit | |
69 | | |
|
81 | | | |
70 | | |
|
82 | | | |
71 | o changeset: 0:4f23db756b09 |
|
83 | o changeset: 0:4f23db756b09 | |
72 | user: test |
|
84 | user: test | |
73 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
85 | date: Thu Jan 01 00:00:00 1970 +0000 | |
74 | files: dir/b dir/c dir/d dir/nested/a dir2/e f |
|
86 | files: dir/b dir/c dir/d dir/nested/a dir2/e f | |
75 | description: |
|
87 | description: | |
76 | recreate a bunch of files to facilitate dirstate-v2 append |
|
88 | recreate a bunch of files to facilitate dirstate-v2 append | |
77 |
|
89 | |||
78 |
|
90 | |||
79 | $ hg manifest |
|
91 | $ hg manifest | |
80 | dir/b |
|
92 | dir/b | |
81 | dir/c |
|
93 | dir/c | |
82 | dir/d |
|
94 | dir/d | |
83 | dir/i |
|
95 | dir/i | |
84 | dir/j |
|
96 | dir/j | |
85 | dir/nested/a |
|
97 | dir/nested/a | |
86 | dir/nested/h |
|
98 | dir/nested/h | |
87 | dir/nested/m |
|
99 | dir/nested/m | |
88 | dir2/e |
|
100 | dir2/e | |
89 | dir2/k |
|
101 | dir2/k | |
90 | dir2/l |
|
102 | dir2/l | |
91 | f |
|
103 | f | |
92 | g |
|
104 | g | |
93 |
|
105 | |||
94 | Add some unknown files and refresh the dirstate |
|
106 | Add some unknown files and refresh the dirstate | |
95 |
|
107 | |||
96 | $ touch -t 200001010020 $extra_files |
|
108 | $ touch -t 200001010020 $extra_files | |
97 | $ hg add dir/o |
|
109 | $ hg add dir/o | |
98 | $ hg remove dir/nested/m |
|
110 | $ hg remove dir/nested/m | |
99 |
|
111 | |||
100 | $ hg st --config devel.dirstate.v2.data_update_mode=force-new |
|
112 | $ hg st --config devel.dirstate.v2.data_update_mode=force-new | |
101 | A dir/o |
|
113 | A dir/o | |
102 | R dir/nested/m |
|
114 | R dir/nested/m | |
103 | ? dir/n |
|
115 | ? dir/n | |
104 | ? p |
|
116 | ? p | |
105 | ? q |
|
117 | ? q | |
106 | $ hg debugstate |
|
118 | $ hg debugstate | |
107 | n 644 0 2000-01-01 00:00:00 dir/b |
|
119 | n 644 0 2000-01-01 00:00:00 dir/b | |
108 | n 644 0 2000-01-01 00:00:00 dir/c |
|
120 | n 644 0 2000-01-01 00:00:00 dir/c | |
109 | n 644 0 2000-01-01 00:00:00 dir/d |
|
121 | n 644 0 2000-01-01 00:00:00 dir/d | |
110 | n 644 0 2000-01-01 00:10:00 dir/i |
|
122 | n 644 0 2000-01-01 00:10:00 dir/i | |
111 | n 644 0 2000-01-01 00:10:00 dir/j |
|
123 | n 644 0 2000-01-01 00:10:00 dir/j | |
112 | n 644 0 2000-01-01 00:00:00 dir/nested/a |
|
124 | n 644 0 2000-01-01 00:00:00 dir/nested/a | |
113 | n 644 0 2000-01-01 00:10:00 dir/nested/h |
|
125 | n 644 0 2000-01-01 00:10:00 dir/nested/h | |
114 | r ?????????????????????????????????? dir/nested/m (glob) |
|
126 | r ?????????????????????????????????? dir/nested/m (glob) | |
115 | a ?????????????????????????????????? dir/o (glob) |
|
127 | a ?????????????????????????????????? dir/o (glob) | |
116 | n 644 0 2000-01-01 00:00:00 dir2/e |
|
128 | n 644 0 2000-01-01 00:00:00 dir2/e | |
117 | n 644 0 2000-01-01 00:10:00 dir2/k |
|
129 | n 644 0 2000-01-01 00:10:00 dir2/k | |
118 | n 644 0 2000-01-01 00:10:00 dir2/l |
|
130 | n 644 0 2000-01-01 00:10:00 dir2/l | |
119 | n 644 0 2000-01-01 00:00:00 f |
|
131 | n 644 0 2000-01-01 00:00:00 f | |
120 | n 644 0 2000-01-01 00:10:00 g |
|
132 | n 644 0 2000-01-01 00:10:00 g | |
121 | $ hg debugstate > ../reference |
|
133 | $ hg debugstate > ../reference | |
122 | $ cd .. |
|
134 | $ cd .. | |
123 |
|
135 | |||
124 | Actual Testing |
|
136 | Actual Testing | |
125 | ============== |
|
137 | ============== | |
126 |
|
138 | |||
127 | Race with a `hg add` |
|
139 | Race with a `hg add` | |
128 | ------------------- |
|
140 | ------------------- | |
129 |
|
141 | |||
130 | $ cp -a reference-repo race-with-add |
|
142 | $ cp -a reference-repo race-with-add | |
131 | $ cd race-with-add |
|
143 | $ cd race-with-add | |
132 |
|
144 | |||
133 | spin a `hg status` with some caches to update |
|
145 | spin a `hg status` with some caches to update | |
134 |
|
146 | |||
135 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
147 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
136 | > --config rhg.on-unsupported=abort \ |
|
148 | > --config rhg.on-unsupported=abort \ | |
137 |
> --config |
|
149 | > --config ${cfg}=$TESTTMP/status-race-lock \ | |
138 | > & |
|
150 | > & | |
139 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
151 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
140 |
|
152 | |||
141 | Add a file |
|
153 | Add a file | |
142 |
|
154 | |||
143 | $ hg $d2args add dir/n |
|
155 | $ hg $d2args add dir/n | |
144 | $ touch $TESTTMP/status-race-lock |
|
156 | $ touch $TESTTMP/status-race-lock | |
145 | $ wait |
|
157 | $ wait | |
146 |
|
158 | |||
147 | The file should in a "added" state |
|
159 | The file should in a "added" state | |
148 |
|
160 | |||
149 | $ hg status |
|
161 | $ hg status | |
150 | A dir/n |
|
162 | A dir/n | |
151 | A dir/o |
|
163 | A dir/o | |
152 | R dir/nested/m |
|
164 | R dir/nested/m | |
153 | ? p |
|
165 | ? p | |
154 | ? q |
|
166 | ? q | |
155 |
|
167 | |||
156 | The status process should return a consistent result and not crash. |
|
168 | The status process should return a consistent result and not crash. | |
157 |
|
169 | |||
158 | #if dirstate-v1 |
|
170 | #if dirstate-v1 | |
159 | $ cat $TESTTMP/status-race-lock.out |
|
171 | $ cat $TESTTMP/status-race-lock.out | |
160 | A dir/n |
|
172 | A dir/n | |
161 | A dir/o |
|
173 | A dir/o | |
162 | R dir/nested/m |
|
174 | R dir/nested/m | |
163 | ? p |
|
175 | ? p | |
164 | ? q |
|
176 | ? q | |
165 | $ cat $TESTTMP/status-race-lock.log |
|
177 | $ cat $TESTTMP/status-race-lock.log | |
166 | #else |
|
178 | #else | |
167 | #if rhg |
|
179 | #if rhg | |
|
180 | #if pre-all-read | |||
168 | $ cat $TESTTMP/status-race-lock.out |
|
181 | $ cat $TESTTMP/status-race-lock.out | |
169 | A dir/n |
|
182 | A dir/n | |
170 | A dir/o |
|
183 | A dir/o | |
171 | R dir/nested/m |
|
184 | R dir/nested/m | |
172 | ? p |
|
185 | ? p | |
173 | ? q |
|
186 | ? q | |
174 | $ cat $TESTTMP/status-race-lock.log |
|
187 | $ cat $TESTTMP/status-race-lock.log | |
175 | #else |
|
188 | #else | |
|
189 | #if dirstate-v2-append | |||
|
190 | $ cat $TESTTMP/status-race-lock.out | |||
|
191 | A dir/o | |||
|
192 | R dir/nested/m | |||
|
193 | ? dir/n | |||
|
194 | ? p | |||
|
195 | ? q | |||
|
196 | $ cat $TESTTMP/status-race-lock.log | |||
|
197 | #else | |||
|
198 | $ cat $TESTTMP/status-race-lock.out | |||
|
199 | $ cat $TESTTMP/status-race-lock.log | |||
|
200 | abort: dirstate-v2 parse error: not enough bytes on disk | |||
|
201 | #endif | |||
|
202 | #endif | |||
|
203 | #else | |||
176 | #if rust |
|
204 | #if rust | |
177 | #if dirstate-v2-rewrite |
|
205 | #if dirstate-v2-rewrite | |
178 | $ cat $TESTTMP/status-race-lock.out |
|
206 | $ cat $TESTTMP/status-race-lock.out | |
179 | $ cat $TESTTMP/status-race-lock.log |
|
207 | $ cat $TESTTMP/status-race-lock.log | |
180 | abort: $ENOENT$: '$TESTTMP/race-with-add/.hg/dirstate.* (glob) |
|
208 | abort: $ENOENT$: '$TESTTMP/race-with-add/.hg/dirstate.* (glob) | |
181 | #else |
|
209 | #else | |
|
210 | $ cat $TESTTMP/status-race-lock.out | |||
|
211 | A dir/o | |||
|
212 | R dir/nested/m | |||
|
213 | ? dir/n | |||
|
214 | ? p | |||
|
215 | ? q | |||
|
216 | $ cat $TESTTMP/status-race-lock.log | |||
182 | #endif |
|
217 | #endif | |
183 | #else |
|
218 | #else | |
184 | $ cat $TESTTMP/status-race-lock.out |
|
219 | $ cat $TESTTMP/status-race-lock.out | |
185 | $ cat $TESTTMP/status-race-lock.log |
|
220 | $ cat $TESTTMP/status-race-lock.log | |
186 | abort: $ENOENT$: '$TESTTMP/race-with-add/.hg/dirstate.* (glob) |
|
221 | abort: $ENOENT$: '$TESTTMP/race-with-add/.hg/dirstate.* (glob) | |
187 | #endif |
|
222 | #endif | |
188 | #endif |
|
223 | #endif | |
189 | #endif |
|
224 | #endif | |
190 |
|
225 | |||
191 | final cleanup |
|
226 | final cleanup | |
192 |
|
227 | |||
193 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
228 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
194 | $ cd .. |
|
229 | $ cd .. | |
195 |
|
230 | |||
196 | Race with a `hg commit` |
|
231 | Race with a `hg commit` | |
197 | ----------------------- |
|
232 | ----------------------- | |
198 |
|
233 | |||
199 | $ cp -a reference-repo race-with-commit |
|
234 | $ cp -a reference-repo race-with-commit | |
200 | $ cd race-with-commit |
|
235 | $ cd race-with-commit | |
201 |
|
236 | |||
202 | spin a `hg status with some cache to update |
|
237 | spin a `hg status with some cache to update | |
203 |
|
238 | |||
204 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
239 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
205 | > --config rhg.on-unsupported=abort \ |
|
240 | > --config rhg.on-unsupported=abort \ | |
206 |
> --config |
|
241 | > --config ${cfg}=$TESTTMP/status-race-lock \ | |
207 | > & |
|
242 | > & | |
208 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
243 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
209 |
|
244 | |||
210 | Add a do a commit |
|
245 | Add a do a commit | |
211 |
|
246 | |||
212 | $ hg status |
|
247 | $ hg status | |
213 | A dir/o |
|
248 | A dir/o | |
214 | R dir/nested/m |
|
249 | R dir/nested/m | |
215 | ? dir/n |
|
250 | ? dir/n | |
216 | ? p |
|
251 | ? p | |
217 | ? q |
|
252 | ? q | |
218 | $ hg $d2args commit -m 'racing commit' |
|
253 | $ hg $d2args commit -m 'racing commit' | |
219 | $ touch $TESTTMP/status-race-lock |
|
254 | $ touch $TESTTMP/status-race-lock | |
220 | $ wait |
|
255 | $ wait | |
221 |
|
256 | |||
222 | commit was created, and status is now clean |
|
257 | commit was created, and status is now clean | |
223 |
|
258 | |||
224 | $ hg log -GT '{node|short} {desc}\n' |
|
259 | $ hg log -GT '{node|short} {desc}\n' | |
225 | @ 02a67a77ee9b racing commit |
|
260 | @ 02a67a77ee9b racing commit | |
226 | | |
|
261 | | | |
227 | o 9a86dcbfb938 more files to have two commit |
|
262 | o 9a86dcbfb938 more files to have two commit | |
228 | | |
|
263 | | | |
229 | o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append |
|
264 | o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append | |
230 |
|
265 | |||
231 | $ hg status |
|
266 | $ hg status | |
232 | ? dir/n |
|
267 | ? dir/n | |
233 | ? p |
|
268 | ? p | |
234 | ? q |
|
269 | ? q | |
235 |
|
270 | |||
236 | The status process should return a consistent result and not crash. |
|
271 | The status process should return a consistent result and not crash. | |
237 |
|
272 | |||
238 | #if dirstate-v1 |
|
273 | #if dirstate-v1 | |
239 | $ cat $TESTTMP/status-race-lock.out |
|
274 | $ cat $TESTTMP/status-race-lock.out | |
240 | M dir/o (no-rhg !) |
|
275 | M dir/o (no-rhg !) | |
241 | ? dir/n |
|
276 | ? dir/n | |
242 | ? p |
|
277 | ? p | |
243 | ? q |
|
278 | ? q | |
244 | $ cat $TESTTMP/status-race-lock.log |
|
279 | $ cat $TESTTMP/status-race-lock.log | |
245 | warning: ignoring unknown working parent 02a67a77ee9b! (no-rhg !) |
|
280 | warning: ignoring unknown working parent 02a67a77ee9b! (no-rhg !) | |
246 | #else |
|
281 | #else | |
247 | #if rhg |
|
282 | #if rhg | |
|
283 | #if pre-all-read | |||
248 | $ cat $TESTTMP/status-race-lock.out |
|
284 | $ cat $TESTTMP/status-race-lock.out | |
249 | ? dir/n |
|
285 | ? dir/n | |
250 | ? p |
|
286 | ? p | |
251 | ? q |
|
287 | ? q | |
252 | $ cat $TESTTMP/status-race-lock.log |
|
288 | $ cat $TESTTMP/status-race-lock.log | |
253 | #else |
|
289 | #else | |
|
290 | #if dirstate-v2-append | |||
|
291 | $ cat $TESTTMP/status-race-lock.out | |||
|
292 | A dir/o | |||
|
293 | R dir/nested/m | |||
|
294 | ? dir/n | |||
|
295 | ? p | |||
|
296 | ? q | |||
|
297 | $ cat $TESTTMP/status-race-lock.log | |||
|
298 | #else | |||
|
299 | $ cat $TESTTMP/status-race-lock.out | |||
|
300 | $ cat $TESTTMP/status-race-lock.log | |||
|
301 | abort: dirstate-v2 parse error: not enough bytes on disk | |||
|
302 | #endif | |||
|
303 | #endif | |||
|
304 | #else | |||
254 | #if rust |
|
305 | #if rust | |
255 | #if dirstate-v2-rewrite |
|
306 | #if dirstate-v2-rewrite | |
256 | $ cat $TESTTMP/status-race-lock.out |
|
307 | $ cat $TESTTMP/status-race-lock.out | |
257 | $ cat $TESTTMP/status-race-lock.log |
|
308 | $ cat $TESTTMP/status-race-lock.log | |
258 | abort: $ENOENT$: '$TESTTMP/race-with-commit/.hg/dirstate.* (glob) |
|
309 | abort: $ENOENT$: '$TESTTMP/race-with-commit/.hg/dirstate.* (glob) | |
259 | #else |
|
310 | #else | |
|
311 | $ cat $TESTTMP/status-race-lock.out | |||
|
312 | A dir/o | |||
|
313 | R dir/nested/m | |||
|
314 | ? dir/n | |||
|
315 | ? p | |||
|
316 | ? q | |||
|
317 | $ cat $TESTTMP/status-race-lock.log | |||
260 | #endif |
|
318 | #endif | |
261 | #else |
|
319 | #else | |
262 | $ cat $TESTTMP/status-race-lock.out |
|
320 | $ cat $TESTTMP/status-race-lock.out | |
263 | $ cat $TESTTMP/status-race-lock.log |
|
321 | $ cat $TESTTMP/status-race-lock.log | |
264 | abort: $ENOENT$: '$TESTTMP/race-with-commit/.hg/dirstate.* (glob) |
|
322 | abort: $ENOENT$: '$TESTTMP/race-with-commit/.hg/dirstate.* (glob) | |
265 | #endif |
|
323 | #endif | |
266 | #endif |
|
324 | #endif | |
267 | #endif |
|
325 | #endif | |
268 |
|
326 | |||
269 | final cleanup |
|
327 | final cleanup | |
270 |
|
328 | |||
271 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
329 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
272 | $ cd .. |
|
330 | $ cd .. | |
273 |
|
331 | |||
274 | Race with a `hg update` |
|
332 | Race with a `hg update` | |
275 | ----------------------- |
|
333 | ----------------------- | |
276 |
|
334 | |||
277 | $ cp -a reference-repo race-with-update |
|
335 | $ cp -a reference-repo race-with-update | |
278 | $ cd race-with-update |
|
336 | $ cd race-with-update | |
279 |
|
337 | |||
280 | spin a `hg status` with some caches to update |
|
338 | spin a `hg status` with some caches to update | |
281 |
|
339 | |||
282 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
340 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
283 | > --config rhg.on-unsupported=abort \ |
|
341 | > --config rhg.on-unsupported=abort \ | |
284 |
> --config |
|
342 | > --config ${cfg}=$TESTTMP/status-race-lock \ | |
285 | > & |
|
343 | > & | |
286 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
344 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
287 | do an update |
|
345 | do an update | |
288 |
|
346 | |||
289 | $ hg status |
|
347 | $ hg status | |
290 | A dir/o |
|
348 | A dir/o | |
291 | R dir/nested/m |
|
349 | R dir/nested/m | |
292 | ? dir/n |
|
350 | ? dir/n | |
293 | ? p |
|
351 | ? p | |
294 | ? q |
|
352 | ? q | |
295 | $ hg log -GT '{node|short} {desc}\n' |
|
353 | $ hg log -GT '{node|short} {desc}\n' | |
296 | @ 9a86dcbfb938 more files to have two commit |
|
354 | @ 9a86dcbfb938 more files to have two commit | |
297 | | |
|
355 | | | |
298 | o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append |
|
356 | o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append | |
299 |
|
357 | |||
300 | $ hg $d2args update --merge ".~1" |
|
358 | $ hg $d2args update --merge ".~1" | |
301 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
359 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |
302 | $ touch $TESTTMP/status-race-lock |
|
360 | $ touch $TESTTMP/status-race-lock | |
303 | $ wait |
|
361 | $ wait | |
|
362 | #if rhg dirstate-v2-append pre-some-read | |||
|
363 | $ hg log -GT '{node|short} {desc}\n' | |||
|
364 | @ 9a86dcbfb938 more files to have two commit | |||
|
365 | | | |||
|
366 | o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append | |||
|
367 | ||||
|
368 | $ hg status | |||
|
369 | A dir/o | |||
|
370 | R dir/nested/m | |||
|
371 | ! dir/i | |||
|
372 | ! dir/j | |||
|
373 | ! dir/nested/h | |||
|
374 | ! dir2/k | |||
|
375 | ! dir2/l | |||
|
376 | ! g | |||
|
377 | ? dir/n | |||
|
378 | ? p | |||
|
379 | ? q | |||
|
380 | #else | |||
304 |
$ |
|
381 | $ hg log -GT '{node|short} {desc}\n' | |
305 | o 9a86dcbfb938 more files to have two commit |
|
382 | o 9a86dcbfb938 more files to have two commit | |
306 | | |
|
383 | | | |
307 | @ 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append |
|
384 | @ 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append | |
308 |
|
385 | |||
309 | $ hg status |
|
386 | $ hg status | |
310 | A dir/o |
|
387 | A dir/o | |
311 | ? dir/n |
|
388 | ? dir/n | |
312 | ? p |
|
389 | ? p | |
313 | ? q |
|
390 | ? q | |
|
391 | #endif | |||
314 |
|
392 | |||
315 | The status process should return a consistent result and not crash. |
|
393 | The status process should return a consistent result and not crash. | |
316 |
|
394 | |||
317 | #if dirstate-v1 |
|
395 | #if dirstate-v1 | |
318 | $ cat $TESTTMP/status-race-lock.out |
|
396 | $ cat $TESTTMP/status-race-lock.out | |
319 | A dir/o |
|
397 | A dir/o | |
320 | ? dir/n |
|
398 | ? dir/n | |
321 | ? p |
|
399 | ? p | |
322 | ? q |
|
400 | ? q | |
323 | $ cat $TESTTMP/status-race-lock.log |
|
401 | $ cat $TESTTMP/status-race-lock.log | |
324 | #else |
|
402 | #else | |
325 | #if rhg |
|
403 | #if rhg | |
|
404 | #if pre-all-read | |||
326 | $ cat $TESTTMP/status-race-lock.out |
|
405 | $ cat $TESTTMP/status-race-lock.out | |
327 | A dir/o |
|
406 | A dir/o | |
328 | ? dir/n |
|
407 | ? dir/n | |
329 | ? p |
|
408 | ? p | |
330 | ? q |
|
409 | ? q | |
331 | $ cat $TESTTMP/status-race-lock.log |
|
410 | $ cat $TESTTMP/status-race-lock.log | |
332 | #else |
|
411 | #else | |
|
412 | #if dirstate-v2-append | |||
|
413 | $ cat $TESTTMP/status-race-lock.out | |||
|
414 | A dir/o | |||
|
415 | R dir/nested/m | |||
|
416 | ! dir/i | |||
|
417 | ! dir/j | |||
|
418 | ! dir/nested/h | |||
|
419 | ! dir2/k | |||
|
420 | ! dir2/l | |||
|
421 | ! g | |||
|
422 | ? dir/n | |||
|
423 | ? p | |||
|
424 | ? q | |||
|
425 | $ cat $TESTTMP/status-race-lock.log | |||
|
426 | #else | |||
|
427 | $ cat $TESTTMP/status-race-lock.out | |||
|
428 | $ cat $TESTTMP/status-race-lock.log | |||
|
429 | abort: dirstate-v2 parse error: not enough bytes on disk | |||
|
430 | #endif | |||
|
431 | #endif | |||
|
432 | #else | |||
333 | #if rust |
|
433 | #if rust | |
334 | #if dirstate-v2-rewrite |
|
434 | #if dirstate-v2-rewrite | |
335 | $ cat $TESTTMP/status-race-lock.out |
|
435 | $ cat $TESTTMP/status-race-lock.out | |
336 | $ cat $TESTTMP/status-race-lock.log |
|
436 | $ cat $TESTTMP/status-race-lock.log | |
337 | abort: $ENOENT$: '$TESTTMP/race-with-update/.hg/dirstate.* (glob) |
|
437 | abort: $ENOENT$: '$TESTTMP/race-with-update/.hg/dirstate.* (glob) | |
338 | #else |
|
438 | #else | |
|
439 | $ cat $TESTTMP/status-race-lock.out | |||
|
440 | A dir/o | |||
|
441 | R dir/nested/m | |||
|
442 | ! dir/i | |||
|
443 | ! dir/j | |||
|
444 | ! dir/nested/h | |||
|
445 | ! dir2/k | |||
|
446 | ! dir2/l | |||
|
447 | ! g | |||
|
448 | ? dir/n | |||
|
449 | ? p | |||
|
450 | ? q | |||
|
451 | $ cat $TESTTMP/status-race-lock.log | |||
339 | #endif |
|
452 | #endif | |
340 | #else |
|
453 | #else | |
341 | $ cat $TESTTMP/status-race-lock.out |
|
454 | $ cat $TESTTMP/status-race-lock.out | |
342 | $ cat $TESTTMP/status-race-lock.log |
|
455 | $ cat $TESTTMP/status-race-lock.log | |
343 | abort: $ENOENT$: '$TESTTMP/race-with-update/.hg/dirstate.* (glob) |
|
456 | abort: $ENOENT$: '$TESTTMP/race-with-update/.hg/dirstate.* (glob) | |
344 | #endif |
|
457 | #endif | |
345 | #endif |
|
458 | #endif | |
346 | #endif |
|
459 | #endif | |
347 |
|
460 | |||
348 | final cleanup |
|
461 | final cleanup | |
349 |
|
462 | |||
350 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
463 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
351 | $ cd .. |
|
464 | $ cd .. | |
352 |
|
465 | |||
353 | Race with a cache updating `hg status` |
|
466 | Race with a cache updating `hg status` | |
354 | -------------------------------------- |
|
467 | -------------------------------------- | |
355 |
|
468 | |||
356 | It is interesting to race with "read-only" operation (that still update its cache) |
|
469 | It is interesting to race with "read-only" operation (that still update its cache) | |
357 |
|
470 | |||
358 | $ cp -a reference-repo race-with-status |
|
471 | $ cp -a reference-repo race-with-status | |
359 | $ cd race-with-status |
|
472 | $ cd race-with-status | |
360 |
|
473 | |||
361 | spin a `hg status` with some caches to update |
|
474 | spin a `hg status` with some caches to update | |
362 |
|
475 | |||
363 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
476 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
364 | > --config rhg.on-unsupported=abort \ |
|
477 | > --config rhg.on-unsupported=abort \ | |
365 |
> --config |
|
478 | > --config ${cfg}=$TESTTMP/status-race-lock \ | |
366 | > & |
|
479 | > & | |
367 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
480 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
368 | do an update |
|
481 | do an update | |
369 |
|
482 | |||
370 | $ touch -t 200001020006 f |
|
483 | $ touch -t 200001020006 f | |
371 | $ hg $d2args status |
|
484 | $ hg $d2args status | |
372 | A dir/o |
|
485 | A dir/o | |
373 | R dir/nested/m |
|
486 | R dir/nested/m | |
374 | ? dir/n |
|
487 | ? dir/n | |
375 | ? p |
|
488 | ? p | |
376 | ? q |
|
489 | ? q | |
377 | $ touch $TESTTMP/status-race-lock |
|
490 | $ touch $TESTTMP/status-race-lock | |
378 | $ wait |
|
491 | $ wait | |
379 |
|
492 | |||
380 | The status process should return a consistent result and not crash. |
|
493 | The status process should return a consistent result and not crash. | |
381 |
|
494 | |||
382 | #if dirstate-v1 |
|
495 | #if dirstate-v1 | |
383 | $ cat $TESTTMP/status-race-lock.out |
|
496 | $ cat $TESTTMP/status-race-lock.out | |
384 | A dir/o |
|
497 | A dir/o | |
385 | R dir/nested/m |
|
498 | R dir/nested/m | |
386 | ? dir/n |
|
499 | ? dir/n | |
387 | ? p |
|
500 | ? p | |
388 | ? q |
|
501 | ? q | |
389 | $ cat $TESTTMP/status-race-lock.log |
|
502 | $ cat $TESTTMP/status-race-lock.log | |
390 | #else |
|
503 | #else | |
391 | #if rhg |
|
504 | #if rhg | |
|
505 | #if pre-all-read | |||
|
506 | $ cat $TESTTMP/status-race-lock.out | |||
|
507 | A dir/o | |||
|
508 | R dir/nested/m | |||
|
509 | ? dir/n | |||
|
510 | ? p | |||
|
511 | ? q | |||
|
512 | $ cat $TESTTMP/status-race-lock.log | |||
|
513 | #else | |||
|
514 | #if dirstate-v2-append | |||
392 | $ cat $TESTTMP/status-race-lock.out |
|
515 | $ cat $TESTTMP/status-race-lock.out | |
393 | A dir/o |
|
516 | A dir/o | |
394 | R dir/nested/m |
|
517 | R dir/nested/m | |
395 | ? dir/n |
|
518 | ? dir/n | |
396 | ? p |
|
519 | ? p | |
397 | ? q |
|
520 | ? q | |
398 | $ cat $TESTTMP/status-race-lock.log |
|
521 | $ cat $TESTTMP/status-race-lock.log | |
399 | #else |
|
522 | #else | |
|
523 | $ cat $TESTTMP/status-race-lock.out | |||
|
524 | $ cat $TESTTMP/status-race-lock.log | |||
|
525 | abort: dirstate-v2 parse error: not enough bytes on disk | |||
|
526 | #endif | |||
|
527 | #endif | |||
|
528 | #else | |||
400 | #if rust |
|
529 | #if rust | |
401 | #if dirstate-v2-rewrite |
|
530 | #if dirstate-v2-rewrite | |
402 | $ cat $TESTTMP/status-race-lock.out |
|
531 | $ cat $TESTTMP/status-race-lock.out | |
403 | $ cat $TESTTMP/status-race-lock.log |
|
532 | $ cat $TESTTMP/status-race-lock.log | |
404 | abort: $ENOENT$: '$TESTTMP/race-with-status/.hg/dirstate.* (glob) |
|
533 | abort: $ENOENT$: '$TESTTMP/race-with-status/.hg/dirstate.* (glob) | |
405 | #else |
|
534 | #else | |
|
535 | $ cat $TESTTMP/status-race-lock.out | |||
|
536 | A dir/o | |||
|
537 | R dir/nested/m | |||
|
538 | ? dir/n | |||
|
539 | ? p | |||
|
540 | ? q | |||
|
541 | $ cat $TESTTMP/status-race-lock.log | |||
406 | #endif |
|
542 | #endif | |
407 | #else |
|
543 | #else | |
408 | $ cat $TESTTMP/status-race-lock.out |
|
544 | $ cat $TESTTMP/status-race-lock.out | |
409 | $ cat $TESTTMP/status-race-lock.log |
|
545 | $ cat $TESTTMP/status-race-lock.log | |
410 | abort: $ENOENT$: '$TESTTMP/race-with-status/.hg/dirstate.* (glob) |
|
546 | abort: $ENOENT$: '$TESTTMP/race-with-status/.hg/dirstate.* (glob) | |
411 | #endif |
|
547 | #endif | |
412 | #endif |
|
548 | #endif | |
413 | #endif |
|
549 | #endif | |
414 |
|
550 | |||
415 | final cleanup |
|
551 | final cleanup | |
416 |
|
552 | |||
417 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
553 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
418 | $ cd .. |
|
554 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now