author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
Wed, 12 Apr 2017 16:34:05 +0200 | |
changeset 32031 | 11a2461fc9b1 |
parent 31696 | 9d3d56aa1a9f |
child 32041 | 38963a53ab0d |
permissions | -rw-r--r-- |
31696
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
1 |
Test UI worker interaction |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
2 |
|
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
3 |
$ cat > t.py <<EOF |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
4 |
> from __future__ import absolute_import, print_function |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
5 |
> from mercurial import ( |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
6 |
> cmdutil, |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
7 |
> ui as uimod, |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
8 |
> worker, |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
9 |
> ) |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
10 |
> def runme(ui, args): |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
11 |
> for arg in args: |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
12 |
> ui.status('run\n') |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
13 |
> yield 1, arg |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
14 |
> cmdtable = {} |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
15 |
> command = cmdutil.command(cmdtable) |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
16 |
> @command('test', [], 'hg test [COST]') |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
17 |
> def t(ui, repo, cost=1.0): |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
18 |
> cost = float(cost) |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
19 |
> ui.status('start\n') |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
20 |
> runs = worker.worker(ui, cost, runme, (ui,), range(8)) |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
21 |
> for n, i in runs: |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
22 |
> pass |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
23 |
> ui.status('done\n') |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
24 |
> EOF |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
25 |
$ abspath=`pwd`/t.py |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
26 |
$ hg init |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
27 |
|
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
28 |
Run tests with worker enable by forcing a heigh cost |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
29 |
|
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
30 |
$ hg --config "extensions.t=$abspath" test 100000.0 |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
31 |
start |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
32 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
33 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
34 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
35 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
36 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
37 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
38 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
39 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
40 |
done |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
41 |
|
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
42 |
Run tests without worker by forcing a low cost |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
43 |
|
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
44 |
$ hg --config "extensions.t=$abspath" test 0.0000001 |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
45 |
start |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
46 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
47 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
48 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
49 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
50 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
51 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
52 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
53 |
run |
9d3d56aa1a9f
worker: flush ui buffers before running the worker
David Soria Parra <davidsp@fb.com>
parents:
diff
changeset
|
54 |
done |