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