##// END OF EJS Templates
worker: flush ui buffers before running the worker...
David Soria Parra -
r31696:9d3d56aa default
parent child Browse files
Show More
@@ -0,0 +1,54 b''
1 Test UI worker interaction
2
3 $ cat > t.py <<EOF
4 > from __future__ import absolute_import, print_function
5 > from mercurial import (
6 > cmdutil,
7 > ui as uimod,
8 > worker,
9 > )
10 > def runme(ui, args):
11 > for arg in args:
12 > ui.status('run\n')
13 > yield 1, arg
14 > cmdtable = {}
15 > command = cmdutil.command(cmdtable)
16 > @command('test', [], 'hg test [COST]')
17 > def t(ui, repo, cost=1.0):
18 > cost = float(cost)
19 > ui.status('start\n')
20 > runs = worker.worker(ui, cost, runme, (ui,), range(8))
21 > for n, i in runs:
22 > pass
23 > ui.status('done\n')
24 > EOF
25 $ abspath=`pwd`/t.py
26 $ hg init
27
28 Run tests with worker enable by forcing a heigh cost
29
30 $ hg --config "extensions.t=$abspath" test 100000.0
31 start
32 run
33 run
34 run
35 run
36 run
37 run
38 run
39 run
40 done
41
42 Run tests without worker by forcing a low cost
43
44 $ hg --config "extensions.t=$abspath" test 0.0000001
45 start
46 run
47 run
48 run
49 run
50 run
51 run
52 run
53 run
54 done
@@ -133,6 +133,7 b' def _posixworker(ui, func, staticargs, a'
133 if problem[0]:
133 if problem[0]:
134 killworkers()
134 killworkers()
135 oldchldhandler = signal.signal(signal.SIGCHLD, sigchldhandler)
135 oldchldhandler = signal.signal(signal.SIGCHLD, sigchldhandler)
136 ui.flush()
136 for pargs in partition(args, workers):
137 for pargs in partition(args, workers):
137 pid = os.fork()
138 pid = os.fork()
138 if pid == 0:
139 if pid == 0:
General Comments 0
You need to be logged in to leave comments. Login now