##// END OF EJS Templates
tests: fix test-transaction-safety.t on Windows...
Matt Harbison -
r48094:b1ce93dc default
parent child Browse files
Show More
@@ -1,271 +1,269 b''
1 Test transaction safety
1 Test transaction safety
2 =======================
2 =======================
3
3
4 #testcases revlogv1 revlogv2 changelogv2
4 #testcases revlogv1 revlogv2 changelogv2
5
5
6 #if revlogv1
6 #if revlogv1
7
7
8 $ cat << EOF >> $HGRCPATH
8 $ cat << EOF >> $HGRCPATH
9 > [experimental]
9 > [experimental]
10 > revlogv2=no
10 > revlogv2=no
11 > EOF
11 > EOF
12
12
13 #endif
13 #endif
14
14
15 #if revlogv2
15 #if revlogv2
16
16
17 $ cat << EOF >> $HGRCPATH
17 $ cat << EOF >> $HGRCPATH
18 > [experimental]
18 > [experimental]
19 > revlogv2=enable-unstable-format-and-corrupt-my-data
19 > revlogv2=enable-unstable-format-and-corrupt-my-data
20 > EOF
20 > EOF
21
21
22 #endif
22 #endif
23
23
24 #if changelogv2
24 #if changelogv2
25
25
26 $ cat << EOF >> $HGRCPATH
26 $ cat << EOF >> $HGRCPATH
27 > [format]
27 > [format]
28 > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data
28 > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data
29 > EOF
29 > EOF
30
30
31 #endif
31 #endif
32
32
33 This test basic case to make sure external process do not see transaction
33 This test basic case to make sure external process do not see transaction
34 content until it is committed.
34 content until it is committed.
35
35
36 # TODO: also add an external reader accessing revlog files while they are written
36 # TODO: also add an external reader accessing revlog files while they are written
37 # (instead of during transaction finalisation)
37 # (instead of during transaction finalisation)
38
38
39 # TODO: also add stream clone and hardlink clone happening during these transaction.
39 # TODO: also add stream clone and hardlink clone happening during these transaction.
40
40
41 setup
41 setup
42 -----
42 -----
43
43
44 synchronisation+output script:
44 synchronisation+output script:
45
45
46 $ mkdir sync
46 $ mkdir sync
47 $ mkdir output
47 $ mkdir output
48 $ mkdir script
48 $ mkdir script
49 $ HG_TEST_FILE_EXT_WAITING=$TESTTMP/sync/ext_waiting
49 $ HG_TEST_FILE_EXT_WAITING=$TESTTMP/sync/ext_waiting
50 $ export HG_TEST_FILE_EXT_WAITING
50 $ export HG_TEST_FILE_EXT_WAITING
51 $ HG_TEST_FILE_EXT_UNLOCK=$TESTTMP/sync/ext_unlock
51 $ HG_TEST_FILE_EXT_UNLOCK=$TESTTMP/sync/ext_unlock
52 $ export HG_TEST_FILE_EXT_UNLOCK
52 $ export HG_TEST_FILE_EXT_UNLOCK
53 $ HG_TEST_FILE_EXT_DONE=$TESTTMP/sync/ext_done
53 $ HG_TEST_FILE_EXT_DONE=$TESTTMP/sync/ext_done
54 $ export HG_TEST_FILE_EXT_DONE
54 $ export HG_TEST_FILE_EXT_DONE
55 $ cat << EOF > script/external.sh
55 $ cat << EOF > script/external.sh
56 > #!/bin/sh
56 > #!/bin/sh
57 > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_UNLOCK $HG_TEST_FILE_EXT_WAITING
57 > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_UNLOCK" "$HG_TEST_FILE_EXT_WAITING"
58 > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > $TESTTMP/output/external.out
58 > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > "$TESTTMP/output/external.out"
59 > touch $HG_TEST_FILE_EXT_DONE
59 > touch "$HG_TEST_FILE_EXT_DONE"
60 > EOF
60 > EOF
61 $ chmod +x script/external.sh
62 $ cat << EOF > script/internal.sh
61 $ cat << EOF > script/internal.sh
63 > #!/bin/sh
62 > #!/bin/sh
64 > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > $TESTTMP/output/internal.out
63 > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > "$TESTTMP/output/internal.out"
65 > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_DONE $HG_TEST_FILE_EXT_UNLOCK
64 > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE" "$HG_TEST_FILE_EXT_UNLOCK"
66 > EOF
65 > EOF
67 $ chmod +x script/internal.sh
68
66
69
67
70 Automated commands:
68 Automated commands:
71
69
72 $ make_one_commit() {
70 $ make_one_commit() {
73 > rm -f $TESTTMP/sync/*
71 > rm -f $TESTTMP/sync/*
74 > rm -f $TESTTMP/output/*
72 > rm -f $TESTTMP/output/*
75 > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
73 > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
76 > echo x >> a
74 > echo x >> a
77 > $TESTTMP/script/external.sh & hg commit -m "$1"
75 > sh $TESTTMP/script/external.sh & hg commit -m "$1"
78 > cat $TESTTMP/output/external.out
76 > cat $TESTTMP/output/external.out
79 > cat $TESTTMP/output/internal.out
77 > cat $TESTTMP/output/internal.out
80 > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n'
78 > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n'
81 > }
79 > }
82
80
83
81
84 $ make_one_pull() {
82 $ make_one_pull() {
85 > rm -f $TESTTMP/sync/*
83 > rm -f $TESTTMP/sync/*
86 > rm -f $TESTTMP/output/*
84 > rm -f $TESTTMP/output/*
87 > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
85 > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
88 > echo x >> a
86 > echo x >> a
89 > $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force --quiet
87 > sh $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force --quiet
90 > cat $TESTTMP/output/external.out
88 > cat $TESTTMP/output/external.out
91 > cat $TESTTMP/output/internal.out
89 > cat $TESTTMP/output/internal.out
92 > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n'
90 > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n'
93 > }
91 > }
94
92
95 prepare a large source to which to pull from:
93 prepare a large source to which to pull from:
96
94
97 The source is large to unsure we don't use inline more after the pull
95 The source is large to unsure we don't use inline more after the pull
98
96
99 $ hg init other-repo
97 $ hg init other-repo
100 $ hg -R other-repo debugbuilddag .+500
98 $ hg -R other-repo debugbuilddag .+500
101
99
102
100
103 prepare an empty repository where to make test:
101 prepare an empty repository where to make test:
104
102
105 $ hg init repo
103 $ hg init repo
106 $ cd repo
104 $ cd repo
107 $ touch a
105 $ touch a
108 $ hg add a
106 $ hg add a
109
107
110 prepare a small extension to controll inline size
108 prepare a small extension to controll inline size
111
109
112 $ mkdir $TESTTMP/ext
110 $ mkdir $TESTTMP/ext
113 $ cat << EOF > $TESTTMP/ext/small_inline.py
111 $ cat << EOF > $TESTTMP/ext/small_inline.py
114 > from mercurial import revlog
112 > from mercurial import revlog
115 > revlog._maxinline = 64 * 100
113 > revlog._maxinline = 64 * 100
116 > EOF
114 > EOF
117
115
118
116
119
117
120
118
121 $ cat << EOF >> $HGRCPATH
119 $ cat << EOF >> $HGRCPATH
122 > [extensions]
120 > [extensions]
123 > small_inline=$TESTTMP/ext/small_inline.py
121 > small_inline=$TESTTMP/ext/small_inline.py
124 > [hooks]
122 > [hooks]
125 > pretxnclose = $TESTTMP/script/internal.sh
123 > pretxnclose = sh $TESTTMP/script/internal.sh
126 > EOF
124 > EOF
127
125
128 check this is true for the initial commit (inline → inline)
126 check this is true for the initial commit (inline → inline)
129 -----------------------------------------------------------
127 -----------------------------------------------------------
130
128
131 the repository should still be inline (for relevant format)
129 the repository should still be inline (for relevant format)
132
130
133 $ make_one_commit first
131 $ make_one_commit first
134 pre-commit: -1
132 pre-commit: -1
135 external: -1
133 external: -1
136 internal: 0 first
134 internal: 0 first
137 post-tr: 0 first
135 post-tr: 0 first
138
136
139 #if revlogv1
137 #if revlogv1
140
138
141 $ hg debugrevlog -c | grep inline
139 $ hg debugrevlog -c | grep inline
142 flags : inline
140 flags : inline
143
141
144 #endif
142 #endif
145
143
146 check this is true for extra commit (inline → inline)
144 check this is true for extra commit (inline → inline)
147 -----------------------------------------------------
145 -----------------------------------------------------
148
146
149 the repository should still be inline (for relevant format)
147 the repository should still be inline (for relevant format)
150
148
151 #if revlogv1
149 #if revlogv1
152
150
153 $ hg debugrevlog -c | grep inline
151 $ hg debugrevlog -c | grep inline
154 flags : inline
152 flags : inline
155
153
156 #endif
154 #endif
157
155
158 $ make_one_commit second
156 $ make_one_commit second
159 pre-commit: 0 first
157 pre-commit: 0 first
160 external: 0 first
158 external: 0 first
161 internal: 1 second
159 internal: 1 second
162 post-tr: 1 second
160 post-tr: 1 second
163
161
164 #if revlogv1
162 #if revlogv1
165
163
166 $ hg debugrevlog -c | grep inline
164 $ hg debugrevlog -c | grep inline
167 flags : inline
165 flags : inline
168
166
169 #endif
167 #endif
170
168
171 check this is true for a small pull (inline → inline)
169 check this is true for a small pull (inline → inline)
172 -----------------------------------------------------
170 -----------------------------------------------------
173
171
174 the repository should still be inline (for relevant format)
172 the repository should still be inline (for relevant format)
175
173
176 #if revlogv1
174 #if revlogv1
177
175
178 $ hg debugrevlog -c | grep inline
176 $ hg debugrevlog -c | grep inline
179 flags : inline
177 flags : inline
180
178
181 #endif
179 #endif
182
180
183 $ make_one_pull 3
181 $ make_one_pull 3
184 pre-commit: 1 second
182 pre-commit: 1 second
185 warning: repository is unrelated
183 warning: repository is unrelated
186 external: 1 second
184 external: 1 second
187 internal: 5 r3
185 internal: 5 r3
188 post-tr: 5 r3
186 post-tr: 5 r3
189
187
190 #if revlogv1
188 #if revlogv1
191
189
192 $ hg debugrevlog -c | grep inline
190 $ hg debugrevlog -c | grep inline
193 flags : inline
191 flags : inline
194
192
195 #endif
193 #endif
196
194
197 Make a large pull (inline → no-inline)
195 Make a large pull (inline → no-inline)
198 ---------------------------------------
196 ---------------------------------------
199
197
200 the repository should no longer be inline (for relevant format)
198 the repository should no longer be inline (for relevant format)
201
199
202 #if revlogv1
200 #if revlogv1
203
201
204 $ hg debugrevlog -c | grep inline
202 $ hg debugrevlog -c | grep inline
205 flags : inline
203 flags : inline
206
204
207 #endif
205 #endif
208
206
209 $ make_one_pull 400
207 $ make_one_pull 400
210 pre-commit: 5 r3
208 pre-commit: 5 r3
211 external: 5 r3
209 external: 5 r3
212 internal: 402 r400
210 internal: 402 r400
213 post-tr: 402 r400
211 post-tr: 402 r400
214
212
215 #if revlogv1
213 #if revlogv1
216
214
217 $ hg debugrevlog -c | grep inline
215 $ hg debugrevlog -c | grep inline
218 [1]
216 [1]
219
217
220 #endif
218 #endif
221
219
222 check this is true for extra commit (no-inline → no-inline)
220 check this is true for extra commit (no-inline → no-inline)
223 -----------------------------------------------------------
221 -----------------------------------------------------------
224
222
225 the repository should no longer be inline (for relevant format)
223 the repository should no longer be inline (for relevant format)
226
224
227 #if revlogv1
225 #if revlogv1
228
226
229 $ hg debugrevlog -c | grep inline
227 $ hg debugrevlog -c | grep inline
230 [1]
228 [1]
231
229
232 #endif
230 #endif
233
231
234 $ make_one_commit third
232 $ make_one_commit third
235 pre-commit: 402 r400
233 pre-commit: 402 r400
236 external: 402 r400
234 external: 402 r400
237 internal: 403 third
235 internal: 403 third
238 post-tr: 403 third
236 post-tr: 403 third
239
237
240 #if revlogv1
238 #if revlogv1
241
239
242 $ hg debugrevlog -c | grep inline
240 $ hg debugrevlog -c | grep inline
243 [1]
241 [1]
244
242
245 #endif
243 #endif
246
244
247
245
248 Make a pull (not-inline → no-inline)
246 Make a pull (not-inline → no-inline)
249 -------------------------------------
247 -------------------------------------
250
248
251 the repository should no longer be inline (for relevant format)
249 the repository should no longer be inline (for relevant format)
252
250
253 #if revlogv1
251 #if revlogv1
254
252
255 $ hg debugrevlog -c | grep inline
253 $ hg debugrevlog -c | grep inline
256 [1]
254 [1]
257
255
258 #endif
256 #endif
259
257
260 $ make_one_pull tip
258 $ make_one_pull tip
261 pre-commit: 403 third
259 pre-commit: 403 third
262 external: 403 third
260 external: 403 third
263 internal: 503 r500
261 internal: 503 r500
264 post-tr: 503 r500
262 post-tr: 503 r500
265
263
266 #if revlogv1
264 #if revlogv1
267
265
268 $ hg debugrevlog -c | grep inline
266 $ hg debugrevlog -c | grep inline
269 [1]
267 [1]
270
268
271 #endif
269 #endif
General Comments 0
You need to be logged in to leave comments. Login now