##// END OF EJS Templates
tests: make one of 'worker process exited' line option in test-chg.t...
Pulkit Goyal -
r45761:83784001 stable
parent child Browse files
Show More
@@ -1,461 +1,461 b''
1 #require chg
1 #require chg
2
2
3 $ mkdir log
3 $ mkdir log
4 $ cp $HGRCPATH $HGRCPATH.unconfigured
4 $ cp $HGRCPATH $HGRCPATH.unconfigured
5 $ cat <<'EOF' >> $HGRCPATH
5 $ cat <<'EOF' >> $HGRCPATH
6 > [cmdserver]
6 > [cmdserver]
7 > log = $TESTTMP/log/server.log
7 > log = $TESTTMP/log/server.log
8 > max-log-files = 1
8 > max-log-files = 1
9 > max-log-size = 10 kB
9 > max-log-size = 10 kB
10 > EOF
10 > EOF
11 $ cp $HGRCPATH $HGRCPATH.orig
11 $ cp $HGRCPATH $HGRCPATH.orig
12
12
13 $ filterlog () {
13 $ filterlog () {
14 > sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!' \
14 > sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!' \
15 > -e 's!\(setprocname\|received fds\|setenv\): .*!\1: ...!' \
15 > -e 's!\(setprocname\|received fds\|setenv\): .*!\1: ...!' \
16 > -e 's!\(confighash\|mtimehash\) = [0-9a-f]*!\1 = ...!g' \
16 > -e 's!\(confighash\|mtimehash\) = [0-9a-f]*!\1 = ...!g' \
17 > -e 's!\(in \)[0-9.]*s\b!\1 ...s!g' \
17 > -e 's!\(in \)[0-9.]*s\b!\1 ...s!g' \
18 > -e 's!\(pid\)=[0-9]*!\1=...!g' \
18 > -e 's!\(pid\)=[0-9]*!\1=...!g' \
19 > -e 's!\(/server-\)[0-9a-f]*!\1...!g'
19 > -e 's!\(/server-\)[0-9a-f]*!\1...!g'
20 > }
20 > }
21
21
22 init repo
22 init repo
23
23
24 $ chg init foo
24 $ chg init foo
25 $ cd foo
25 $ cd foo
26
26
27 ill-formed config
27 ill-formed config
28
28
29 $ chg status
29 $ chg status
30 $ echo '=brokenconfig' >> $HGRCPATH
30 $ echo '=brokenconfig' >> $HGRCPATH
31 $ chg status
31 $ chg status
32 hg: parse error at * (glob)
32 hg: parse error at * (glob)
33 [255]
33 [255]
34
34
35 $ cp $HGRCPATH.orig $HGRCPATH
35 $ cp $HGRCPATH.orig $HGRCPATH
36
36
37 long socket path
37 long socket path
38
38
39 $ sockpath=$TESTTMP/this/path/should/be/longer/than/one-hundred-and-seven/characters/where/107/is/the/typical/size/limit/of/unix-domain-socket
39 $ sockpath=$TESTTMP/this/path/should/be/longer/than/one-hundred-and-seven/characters/where/107/is/the/typical/size/limit/of/unix-domain-socket
40 $ mkdir -p $sockpath
40 $ mkdir -p $sockpath
41 $ bakchgsockname=$CHGSOCKNAME
41 $ bakchgsockname=$CHGSOCKNAME
42 $ CHGSOCKNAME=$sockpath/server
42 $ CHGSOCKNAME=$sockpath/server
43 $ export CHGSOCKNAME
43 $ export CHGSOCKNAME
44 $ chg root
44 $ chg root
45 $TESTTMP/foo
45 $TESTTMP/foo
46 $ rm -rf $sockpath
46 $ rm -rf $sockpath
47 $ CHGSOCKNAME=$bakchgsockname
47 $ CHGSOCKNAME=$bakchgsockname
48 $ export CHGSOCKNAME
48 $ export CHGSOCKNAME
49
49
50 $ cd ..
50 $ cd ..
51
51
52 editor
52 editor
53 ------
53 ------
54
54
55 $ cat >> pushbuffer.py <<EOF
55 $ cat >> pushbuffer.py <<EOF
56 > def reposetup(ui, repo):
56 > def reposetup(ui, repo):
57 > repo.ui.pushbuffer(subproc=True)
57 > repo.ui.pushbuffer(subproc=True)
58 > EOF
58 > EOF
59
59
60 $ chg init editor
60 $ chg init editor
61 $ cd editor
61 $ cd editor
62
62
63 by default, system() should be redirected to the client:
63 by default, system() should be redirected to the client:
64
64
65 $ touch foo
65 $ touch foo
66 $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \
66 $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \
67 > | egrep "HG:|run 'cat"
67 > | egrep "HG:|run 'cat"
68 chg: debug: * run 'cat "*"' at '$TESTTMP/editor' (glob)
68 chg: debug: * run 'cat "*"' at '$TESTTMP/editor' (glob)
69 HG: Enter commit message. Lines beginning with 'HG:' are removed.
69 HG: Enter commit message. Lines beginning with 'HG:' are removed.
70 HG: Leave message empty to abort commit.
70 HG: Leave message empty to abort commit.
71 HG: --
71 HG: --
72 HG: user: test
72 HG: user: test
73 HG: branch 'default'
73 HG: branch 'default'
74 HG: added foo
74 HG: added foo
75
75
76 but no redirection should be made if output is captured:
76 but no redirection should be made if output is captured:
77
77
78 $ touch bar
78 $ touch bar
79 $ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \
79 $ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \
80 > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \
80 > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \
81 > | egrep "HG:|run 'cat"
81 > | egrep "HG:|run 'cat"
82 [1]
82 [1]
83
83
84 check that commit commands succeeded:
84 check that commit commands succeeded:
85
85
86 $ hg log -T '{rev}:{desc}\n'
86 $ hg log -T '{rev}:{desc}\n'
87 1:bufferred
87 1:bufferred
88 0:channeled
88 0:channeled
89
89
90 $ cd ..
90 $ cd ..
91
91
92 pager
92 pager
93 -----
93 -----
94
94
95 $ cat >> fakepager.py <<EOF
95 $ cat >> fakepager.py <<EOF
96 > import sys
96 > import sys
97 > for line in sys.stdin:
97 > for line in sys.stdin:
98 > sys.stdout.write('paged! %r\n' % line)
98 > sys.stdout.write('paged! %r\n' % line)
99 > EOF
99 > EOF
100
100
101 enable pager extension globally, but spawns the master server with no tty:
101 enable pager extension globally, but spawns the master server with no tty:
102
102
103 $ chg init pager
103 $ chg init pager
104 $ cd pager
104 $ cd pager
105 $ cat >> $HGRCPATH <<EOF
105 $ cat >> $HGRCPATH <<EOF
106 > [extensions]
106 > [extensions]
107 > pager =
107 > pager =
108 > [pager]
108 > [pager]
109 > pager = "$PYTHON" $TESTTMP/fakepager.py
109 > pager = "$PYTHON" $TESTTMP/fakepager.py
110 > EOF
110 > EOF
111 $ chg version > /dev/null
111 $ chg version > /dev/null
112 $ touch foo
112 $ touch foo
113 $ chg ci -qAm foo
113 $ chg ci -qAm foo
114
114
115 pager should be enabled if the attached client has a tty:
115 pager should be enabled if the attached client has a tty:
116
116
117 $ chg log -l1 -q --config ui.formatted=True
117 $ chg log -l1 -q --config ui.formatted=True
118 paged! '0:1f7b0de80e11\n'
118 paged! '0:1f7b0de80e11\n'
119 $ chg log -l1 -q --config ui.formatted=False
119 $ chg log -l1 -q --config ui.formatted=False
120 0:1f7b0de80e11
120 0:1f7b0de80e11
121
121
122 chg waits for pager if runcommand raises
122 chg waits for pager if runcommand raises
123
123
124 $ cat > $TESTTMP/crash.py <<EOF
124 $ cat > $TESTTMP/crash.py <<EOF
125 > from mercurial import registrar
125 > from mercurial import registrar
126 > cmdtable = {}
126 > cmdtable = {}
127 > command = registrar.command(cmdtable)
127 > command = registrar.command(cmdtable)
128 > @command(b'crash')
128 > @command(b'crash')
129 > def pagercrash(ui, repo, *pats, **opts):
129 > def pagercrash(ui, repo, *pats, **opts):
130 > ui.write(b'going to crash\n')
130 > ui.write(b'going to crash\n')
131 > raise Exception('.')
131 > raise Exception('.')
132 > EOF
132 > EOF
133
133
134 $ cat > $TESTTMP/fakepager.py <<EOF
134 $ cat > $TESTTMP/fakepager.py <<EOF
135 > from __future__ import absolute_import
135 > from __future__ import absolute_import
136 > import sys
136 > import sys
137 > import time
137 > import time
138 > for line in iter(sys.stdin.readline, ''):
138 > for line in iter(sys.stdin.readline, ''):
139 > if 'crash' in line: # only interested in lines containing 'crash'
139 > if 'crash' in line: # only interested in lines containing 'crash'
140 > # if chg exits when pager is sleeping (incorrectly), the output
140 > # if chg exits when pager is sleeping (incorrectly), the output
141 > # will be captured by the next test case
141 > # will be captured by the next test case
142 > time.sleep(1)
142 > time.sleep(1)
143 > sys.stdout.write('crash-pager: %s' % line)
143 > sys.stdout.write('crash-pager: %s' % line)
144 > EOF
144 > EOF
145
145
146 $ cat >> .hg/hgrc <<EOF
146 $ cat >> .hg/hgrc <<EOF
147 > [extensions]
147 > [extensions]
148 > crash = $TESTTMP/crash.py
148 > crash = $TESTTMP/crash.py
149 > EOF
149 > EOF
150
150
151 $ chg crash --pager=on --config ui.formatted=True 2>/dev/null
151 $ chg crash --pager=on --config ui.formatted=True 2>/dev/null
152 crash-pager: going to crash
152 crash-pager: going to crash
153 [255]
153 [255]
154
154
155 no stdout data should be printed after pager quits, and the buffered data
155 no stdout data should be printed after pager quits, and the buffered data
156 should never persist (issue6207)
156 should never persist (issue6207)
157
157
158 "killed!" may be printed if terminated by SIGPIPE, which isn't important
158 "killed!" may be printed if terminated by SIGPIPE, which isn't important
159 in this test.
159 in this test.
160
160
161 $ cat > $TESTTMP/bulkwrite.py <<'EOF'
161 $ cat > $TESTTMP/bulkwrite.py <<'EOF'
162 > import time
162 > import time
163 > from mercurial import error, registrar
163 > from mercurial import error, registrar
164 > cmdtable = {}
164 > cmdtable = {}
165 > command = registrar.command(cmdtable)
165 > command = registrar.command(cmdtable)
166 > @command(b'bulkwrite')
166 > @command(b'bulkwrite')
167 > def bulkwrite(ui, repo, *pats, **opts):
167 > def bulkwrite(ui, repo, *pats, **opts):
168 > ui.write(b'going to write massive data\n')
168 > ui.write(b'going to write massive data\n')
169 > ui.flush()
169 > ui.flush()
170 > t = time.time()
170 > t = time.time()
171 > while time.time() - t < 2:
171 > while time.time() - t < 2:
172 > ui.write(b'x' * 1023 + b'\n') # will be interrupted by SIGPIPE
172 > ui.write(b'x' * 1023 + b'\n') # will be interrupted by SIGPIPE
173 > raise error.Abort(b"write() doesn't block")
173 > raise error.Abort(b"write() doesn't block")
174 > EOF
174 > EOF
175
175
176 $ cat > $TESTTMP/fakepager.py <<'EOF'
176 $ cat > $TESTTMP/fakepager.py <<'EOF'
177 > import sys
177 > import sys
178 > import time
178 > import time
179 > sys.stdout.write('paged! %r\n' % sys.stdin.readline())
179 > sys.stdout.write('paged! %r\n' % sys.stdin.readline())
180 > time.sleep(1) # new data will be written
180 > time.sleep(1) # new data will be written
181 > EOF
181 > EOF
182
182
183 $ cat >> .hg/hgrc <<EOF
183 $ cat >> .hg/hgrc <<EOF
184 > [extensions]
184 > [extensions]
185 > bulkwrite = $TESTTMP/bulkwrite.py
185 > bulkwrite = $TESTTMP/bulkwrite.py
186 > EOF
186 > EOF
187
187
188 $ chg bulkwrite --pager=on --color no --config ui.formatted=True
188 $ chg bulkwrite --pager=on --color no --config ui.formatted=True
189 paged! 'going to write massive data\n'
189 paged! 'going to write massive data\n'
190 killed! (?)
190 killed! (?)
191 [255]
191 [255]
192
192
193 $ chg bulkwrite --pager=on --color no --config ui.formatted=True
193 $ chg bulkwrite --pager=on --color no --config ui.formatted=True
194 paged! 'going to write massive data\n'
194 paged! 'going to write massive data\n'
195 killed! (?)
195 killed! (?)
196 [255]
196 [255]
197
197
198 $ cd ..
198 $ cd ..
199
199
200 server lifecycle
200 server lifecycle
201 ----------------
201 ----------------
202
202
203 chg server should be restarted on code change, and old server will shut down
203 chg server should be restarted on code change, and old server will shut down
204 automatically. In this test, we use the following time parameters:
204 automatically. In this test, we use the following time parameters:
205
205
206 - "sleep 1" to make mtime different
206 - "sleep 1" to make mtime different
207 - "sleep 2" to notice mtime change (polling interval is 1 sec)
207 - "sleep 2" to notice mtime change (polling interval is 1 sec)
208
208
209 set up repository with an extension:
209 set up repository with an extension:
210
210
211 $ chg init extreload
211 $ chg init extreload
212 $ cd extreload
212 $ cd extreload
213 $ touch dummyext.py
213 $ touch dummyext.py
214 $ cat <<EOF >> .hg/hgrc
214 $ cat <<EOF >> .hg/hgrc
215 > [extensions]
215 > [extensions]
216 > dummyext = dummyext.py
216 > dummyext = dummyext.py
217 > EOF
217 > EOF
218
218
219 isolate socket directory for stable result:
219 isolate socket directory for stable result:
220
220
221 $ OLDCHGSOCKNAME=$CHGSOCKNAME
221 $ OLDCHGSOCKNAME=$CHGSOCKNAME
222 $ mkdir chgsock
222 $ mkdir chgsock
223 $ CHGSOCKNAME=`pwd`/chgsock/server
223 $ CHGSOCKNAME=`pwd`/chgsock/server
224
224
225 warm up server:
225 warm up server:
226
226
227 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
227 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
228 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
228 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
229
229
230 new server should be started if extension modified:
230 new server should be started if extension modified:
231
231
232 $ sleep 1
232 $ sleep 1
233 $ touch dummyext.py
233 $ touch dummyext.py
234 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
234 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
235 chg: debug: * instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob)
235 chg: debug: * instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob)
236 chg: debug: * instruction: reconnect (glob)
236 chg: debug: * instruction: reconnect (glob)
237 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
237 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
238
238
239 old server will shut down, while new server should still be reachable:
239 old server will shut down, while new server should still be reachable:
240
240
241 $ sleep 2
241 $ sleep 2
242 $ CHGDEBUG= chg log 2>&1 | (egrep 'instruction|start' || true)
242 $ CHGDEBUG= chg log 2>&1 | (egrep 'instruction|start' || true)
243
243
244 socket file should never be unlinked by old server:
244 socket file should never be unlinked by old server:
245 (simulates unowned socket by updating mtime, which makes sure server exits
245 (simulates unowned socket by updating mtime, which makes sure server exits
246 at polling cycle)
246 at polling cycle)
247
247
248 $ ls chgsock/server-*
248 $ ls chgsock/server-*
249 chgsock/server-* (glob)
249 chgsock/server-* (glob)
250 $ touch chgsock/server-*
250 $ touch chgsock/server-*
251 $ sleep 2
251 $ sleep 2
252 $ ls chgsock/server-*
252 $ ls chgsock/server-*
253 chgsock/server-* (glob)
253 chgsock/server-* (glob)
254
254
255 since no server is reachable from socket file, new server should be started:
255 since no server is reachable from socket file, new server should be started:
256 (this test makes sure that old server shut down automatically)
256 (this test makes sure that old server shut down automatically)
257
257
258 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
258 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
259 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
259 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
260
260
261 shut down servers and restore environment:
261 shut down servers and restore environment:
262
262
263 $ rm -R chgsock
263 $ rm -R chgsock
264 $ sleep 2
264 $ sleep 2
265 $ CHGSOCKNAME=$OLDCHGSOCKNAME
265 $ CHGSOCKNAME=$OLDCHGSOCKNAME
266 $ cd ..
266 $ cd ..
267
267
268 check that server events are recorded:
268 check that server events are recorded:
269
269
270 $ ls log
270 $ ls log
271 server.log
271 server.log
272 server.log.1
272 server.log.1
273
273
274 print only the last 10 lines, since we aren't sure how many records are
274 print only the last 10 lines, since we aren't sure how many records are
275 preserved (since setprocname isn't available on py3 and pure version,
275 preserved (since setprocname isn't available on py3 and pure version,
276 the 10th-most-recent line is different when using py3):
276 the 10th-most-recent line is different when using py3):
277
277
278 $ cat log/server.log.1 log/server.log | tail -10 | filterlog
278 $ cat log/server.log.1 log/server.log | tail -10 | filterlog
279 YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ... (no-setprocname !)
279 YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ... (no-setprocname !)
280 YYYY/MM/DD HH:MM:SS (PID)> forked worker process (pid=...)
280 YYYY/MM/DD HH:MM:SS (PID)> forked worker process (pid=...)
281 YYYY/MM/DD HH:MM:SS (PID)> setprocname: ... (setprocname !)
281 YYYY/MM/DD HH:MM:SS (PID)> setprocname: ... (setprocname !)
282 YYYY/MM/DD HH:MM:SS (PID)> received fds: ...
282 YYYY/MM/DD HH:MM:SS (PID)> received fds: ...
283 YYYY/MM/DD HH:MM:SS (PID)> chdir to '$TESTTMP/extreload'
283 YYYY/MM/DD HH:MM:SS (PID)> chdir to '$TESTTMP/extreload'
284 YYYY/MM/DD HH:MM:SS (PID)> setumask 18
284 YYYY/MM/DD HH:MM:SS (PID)> setumask 18
285 YYYY/MM/DD HH:MM:SS (PID)> setenv: ...
285 YYYY/MM/DD HH:MM:SS (PID)> setenv: ...
286 YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ...
286 YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ...
287 YYYY/MM/DD HH:MM:SS (PID)> validate: []
287 YYYY/MM/DD HH:MM:SS (PID)> validate: []
288 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
288 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
289 YYYY/MM/DD HH:MM:SS (PID)> $TESTTMP/extreload/chgsock/server-... is not owned, exiting.
289 YYYY/MM/DD HH:MM:SS (PID)> $TESTTMP/extreload/chgsock/server-... is not owned, exiting.
290
290
291 global data mutated by schems
291 global data mutated by schems
292 -----------------------------
292 -----------------------------
293
293
294 $ hg init schemes
294 $ hg init schemes
295 $ cd schemes
295 $ cd schemes
296
296
297 initial state
297 initial state
298
298
299 $ cat > .hg/hgrc <<'EOF'
299 $ cat > .hg/hgrc <<'EOF'
300 > [extensions]
300 > [extensions]
301 > schemes =
301 > schemes =
302 > [schemes]
302 > [schemes]
303 > foo = https://foo.example.org/
303 > foo = https://foo.example.org/
304 > EOF
304 > EOF
305 $ hg debugexpandscheme foo://expanded
305 $ hg debugexpandscheme foo://expanded
306 https://foo.example.org/expanded
306 https://foo.example.org/expanded
307 $ hg debugexpandscheme bar://unexpanded
307 $ hg debugexpandscheme bar://unexpanded
308 bar://unexpanded
308 bar://unexpanded
309
309
310 add bar
310 add bar
311
311
312 $ cat > .hg/hgrc <<'EOF'
312 $ cat > .hg/hgrc <<'EOF'
313 > [extensions]
313 > [extensions]
314 > schemes =
314 > schemes =
315 > [schemes]
315 > [schemes]
316 > foo = https://foo.example.org/
316 > foo = https://foo.example.org/
317 > bar = https://bar.example.org/
317 > bar = https://bar.example.org/
318 > EOF
318 > EOF
319 $ hg debugexpandscheme foo://expanded
319 $ hg debugexpandscheme foo://expanded
320 https://foo.example.org/expanded
320 https://foo.example.org/expanded
321 $ hg debugexpandscheme bar://expanded
321 $ hg debugexpandscheme bar://expanded
322 https://bar.example.org/expanded
322 https://bar.example.org/expanded
323
323
324 remove foo
324 remove foo
325
325
326 $ cat > .hg/hgrc <<'EOF'
326 $ cat > .hg/hgrc <<'EOF'
327 > [extensions]
327 > [extensions]
328 > schemes =
328 > schemes =
329 > [schemes]
329 > [schemes]
330 > bar = https://bar.example.org/
330 > bar = https://bar.example.org/
331 > EOF
331 > EOF
332 $ hg debugexpandscheme foo://unexpanded
332 $ hg debugexpandscheme foo://unexpanded
333 foo://unexpanded
333 foo://unexpanded
334 $ hg debugexpandscheme bar://expanded
334 $ hg debugexpandscheme bar://expanded
335 https://bar.example.org/expanded
335 https://bar.example.org/expanded
336
336
337 $ cd ..
337 $ cd ..
338
338
339 repository cache
339 repository cache
340 ----------------
340 ----------------
341
341
342 $ rm log/server.log*
342 $ rm log/server.log*
343 $ cp $HGRCPATH.unconfigured $HGRCPATH
343 $ cp $HGRCPATH.unconfigured $HGRCPATH
344 $ cat <<'EOF' >> $HGRCPATH
344 $ cat <<'EOF' >> $HGRCPATH
345 > [cmdserver]
345 > [cmdserver]
346 > log = $TESTTMP/log/server.log
346 > log = $TESTTMP/log/server.log
347 > max-repo-cache = 1
347 > max-repo-cache = 1
348 > track-log = command, repocache
348 > track-log = command, repocache
349 > EOF
349 > EOF
350
350
351 isolate socket directory for stable result:
351 isolate socket directory for stable result:
352
352
353 $ OLDCHGSOCKNAME=$CHGSOCKNAME
353 $ OLDCHGSOCKNAME=$CHGSOCKNAME
354 $ mkdir chgsock
354 $ mkdir chgsock
355 $ CHGSOCKNAME=`pwd`/chgsock/server
355 $ CHGSOCKNAME=`pwd`/chgsock/server
356
356
357 create empty repo and cache it:
357 create empty repo and cache it:
358
358
359 $ hg init cached
359 $ hg init cached
360 $ hg id -R cached
360 $ hg id -R cached
361 000000000000 tip
361 000000000000 tip
362 $ sleep 1
362 $ sleep 1
363
363
364 modify repo (and cache will be invalidated):
364 modify repo (and cache will be invalidated):
365
365
366 $ touch cached/a
366 $ touch cached/a
367 $ hg ci -R cached -Am 'add a'
367 $ hg ci -R cached -Am 'add a'
368 adding a
368 adding a
369 $ sleep 1
369 $ sleep 1
370
370
371 read cached repo:
371 read cached repo:
372
372
373 $ hg log -R cached
373 $ hg log -R cached
374 changeset: 0:ac82d8b1f7c4
374 changeset: 0:ac82d8b1f7c4
375 tag: tip
375 tag: tip
376 user: test
376 user: test
377 date: Thu Jan 01 00:00:00 1970 +0000
377 date: Thu Jan 01 00:00:00 1970 +0000
378 summary: add a
378 summary: add a
379
379
380 $ sleep 1
380 $ sleep 1
381
381
382 discard cached from LRU cache:
382 discard cached from LRU cache:
383
383
384 $ hg clone cached cached2
384 $ hg clone cached cached2
385 updating to branch default
385 updating to branch default
386 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
387 $ hg id -R cached2
387 $ hg id -R cached2
388 ac82d8b1f7c4 tip
388 ac82d8b1f7c4 tip
389 $ sleep 1
389 $ sleep 1
390
390
391 read uncached repo:
391 read uncached repo:
392
392
393 $ hg log -R cached
393 $ hg log -R cached
394 changeset: 0:ac82d8b1f7c4
394 changeset: 0:ac82d8b1f7c4
395 tag: tip
395 tag: tip
396 user: test
396 user: test
397 date: Thu Jan 01 00:00:00 1970 +0000
397 date: Thu Jan 01 00:00:00 1970 +0000
398 summary: add a
398 summary: add a
399
399
400 $ sleep 1
400 $ sleep 1
401
401
402 shut down servers and restore environment:
402 shut down servers and restore environment:
403
403
404 $ rm -R chgsock
404 $ rm -R chgsock
405 $ sleep 2
405 $ sleep 2
406 $ CHGSOCKNAME=$OLDCHGSOCKNAME
406 $ CHGSOCKNAME=$OLDCHGSOCKNAME
407
407
408 check server log:
408 check server log:
409
409
410 $ cat log/server.log | filterlog
410 $ cat log/server.log | filterlog
411 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
411 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
412 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
412 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...) (?)
413 YYYY/MM/DD HH:MM:SS (PID)> init cached
413 YYYY/MM/DD HH:MM:SS (PID)> init cached
414 YYYY/MM/DD HH:MM:SS (PID)> id -R cached
414 YYYY/MM/DD HH:MM:SS (PID)> id -R cached
415 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
415 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
416 YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached
416 YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached
417 YYYY/MM/DD HH:MM:SS (PID)> ci -R cached -Am 'add a'
417 YYYY/MM/DD HH:MM:SS (PID)> ci -R cached -Am 'add a'
418 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
418 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
419 YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached
419 YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached
420 YYYY/MM/DD HH:MM:SS (PID)> log -R cached
420 YYYY/MM/DD HH:MM:SS (PID)> log -R cached
421 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
421 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
422 YYYY/MM/DD HH:MM:SS (PID)> clone cached cached2
422 YYYY/MM/DD HH:MM:SS (PID)> clone cached cached2
423 YYYY/MM/DD HH:MM:SS (PID)> id -R cached2
423 YYYY/MM/DD HH:MM:SS (PID)> id -R cached2
424 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached2 (in ...s)
424 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached2 (in ...s)
425 YYYY/MM/DD HH:MM:SS (PID)> log -R cached
425 YYYY/MM/DD HH:MM:SS (PID)> log -R cached
426 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
426 YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
427
427
428 Test that chg works (sets to the user's actual LC_CTYPE) even when python
428 Test that chg works (sets to the user's actual LC_CTYPE) even when python
429 "coerces" the locale (py3.7+)
429 "coerces" the locale (py3.7+)
430
430
431 $ cat > $TESTTMP/debugenv.py <<EOF
431 $ cat > $TESTTMP/debugenv.py <<EOF
432 > from mercurial import encoding
432 > from mercurial import encoding
433 > from mercurial import registrar
433 > from mercurial import registrar
434 > cmdtable = {}
434 > cmdtable = {}
435 > command = registrar.command(cmdtable)
435 > command = registrar.command(cmdtable)
436 > @command(b'debugenv', [], b'', norepo=True)
436 > @command(b'debugenv', [], b'', norepo=True)
437 > def debugenv(ui):
437 > def debugenv(ui):
438 > for k in [b'LC_ALL', b'LC_CTYPE', b'LANG']:
438 > for k in [b'LC_ALL', b'LC_CTYPE', b'LANG']:
439 > v = encoding.environ.get(k)
439 > v = encoding.environ.get(k)
440 > if v is not None:
440 > if v is not None:
441 > ui.write(b'%s=%s\n' % (k, encoding.environ[k]))
441 > ui.write(b'%s=%s\n' % (k, encoding.environ[k]))
442 > EOF
442 > EOF
443 (hg keeps python's modified LC_CTYPE, chg doesn't)
443 (hg keeps python's modified LC_CTYPE, chg doesn't)
444 $ (unset LC_ALL; unset LANG; LC_CTYPE= "$CHGHG" \
444 $ (unset LC_ALL; unset LANG; LC_CTYPE= "$CHGHG" \
445 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
445 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
446 LC_CTYPE=C.UTF-8 (py37 !)
446 LC_CTYPE=C.UTF-8 (py37 !)
447 LC_CTYPE= (no-py37 !)
447 LC_CTYPE= (no-py37 !)
448 $ (unset LC_ALL; unset LANG; LC_CTYPE= chg \
448 $ (unset LC_ALL; unset LANG; LC_CTYPE= chg \
449 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
449 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
450 LC_CTYPE=
450 LC_CTYPE=
451 $ (unset LC_ALL; unset LANG; LC_CTYPE=unsupported_value chg \
451 $ (unset LC_ALL; unset LANG; LC_CTYPE=unsupported_value chg \
452 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
452 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
453 LC_CTYPE=unsupported_value
453 LC_CTYPE=unsupported_value
454 $ (unset LC_ALL; unset LANG; LC_CTYPE= chg \
454 $ (unset LC_ALL; unset LANG; LC_CTYPE= chg \
455 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
455 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
456 LC_CTYPE=
456 LC_CTYPE=
457 $ LANG= LC_ALL= LC_CTYPE= chg \
457 $ LANG= LC_ALL= LC_CTYPE= chg \
458 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv
458 > --config extensions.debugenv=$TESTTMP/debugenv.py debugenv
459 LC_ALL=
459 LC_ALL=
460 LC_CTYPE=
460 LC_CTYPE=
461 LANG=
461 LANG=
General Comments 0
You need to be logged in to leave comments. Login now