Mercurial > hg
annotate tests/printenv.py @ 21424:d13b4ecdb680
test: split test-largefile.t in multiple file
The `test-largefiles.t` unified test is significantly longer (about 30%) than
any other tests in the mercurial test suite. As a result, its is alway the last
test my test runner is waiting for at the end of a run.
In practice, this means that `test-largefile.t` is wasting half a minute of my
life every times I'm running the mercurial test suites. This probably mean more
a few cumulated day by now.
I've finally decided to split it up in multiple smaller tests to bring it back in
reasonable length.
This changeset extracts independent test cases in two files. One dedicated to
wire protocole testing, and another one dedicated to all other tests that could
be independently extracted.
No test case were haltered in the making of this changeset.
Various timing available below. All timing have been done on a with 90 jobs on a
64 cores machine. Similar result are shown on firefly (20 jobs on 12 core).
General timing of the whole run
--------------------------------
We see a 25% real time improvement for no significant cpu time impact.
Before split:
real 2m1.149s
user 58m4.662s
sys 11m28.563s
After split:
real 1m31.977s
user 57m45.993s
sys 11m33.634s
Last test to finish (using run-test.py --time)
----------------------------------------------
test-largefile.t is now finishing at the same time than other slow tests.
Before split:
Time Test
119.280 test-largefiles.t
93.995 test-mq.t
89.897 test-subrepo.t
86.920 test-glog.t
85.508 test-rename-merge2.t
83.594 test-revset.t
79.824 test-keyword.t
78.077 test-mq-header-date.t
After split:
Time Test
90.414 test-mq.t
88.594 test-largefiles.t
85.363 test-subrepo.t
81.059 test-glog.t
78.927 test-rename-merge2.t
78.021 test-revset.t
77.777 test-command-template.t
Timing of largefile test themself
-----------------------------------
Running only tests prefixed with "test-largefiles".
No significant change in cumulated time.
Before:
Time Test
58.673 test-largefiles.t
2.931 test-largefiles-cache.t
0.583 test-largefiles-small-disk.t
After:
Time Test
31.754 test-largefiles.t
17.460 test-largefiles-misc.t
8.888 test-largefiles-wireproto.t
2.864 test-largefiles-cache.t
0.580 test-largefiles-small-disk.t
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 16 May 2014 13:18:57 -0700 |
parents | e7fdfc702d9f |
children | a372f7b4463b |
rev | line source |
---|---|
4285
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
1 # simple script to be used in hooks |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
2 # |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
3 # put something like this in the repo .hg/hgrc: |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
4 # |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
5 # [hooks] |
17018
e7fdfc702d9f
tests: consistently use printenv.py the same MSYS/Windows-compatible way
Mads Kiilerich <mads@kiilerich.com>
parents:
16982
diff
changeset
|
6 # changegroup = python "$TESTDIR/printenv.py" <hookname> [exit] [output] |
4285
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
7 # |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
8 # - <hookname> is a mandatory argument (e.g. "changegroup") |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
9 # - [exit] is the exit code of the hook (default: 0) |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
10 # - [output] is the name of the output file (default: use sys.stdout) |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
11 # the file will be opened in append mode. |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
12 # |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
13 import os |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
14 import sys |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
15 |
7080
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
4659
diff
changeset
|
16 try: |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
4659
diff
changeset
|
17 import msvcrt |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
4659
diff
changeset
|
18 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
4659
diff
changeset
|
19 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
7186
f77c8d8331ca
clean up trailing spaces, leading spaces in C
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7080
diff
changeset
|
20 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
7080
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
4659
diff
changeset
|
21 except ImportError: |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
4659
diff
changeset
|
22 pass |
a6477aa893b8
tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents:
4659
diff
changeset
|
23 |
4285
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
24 exitcode = 0 |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
25 out = sys.stdout |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
26 |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
27 name = sys.argv[1] |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
28 if len(sys.argv) > 2: |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
29 exitcode = int(sys.argv[2]) |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
30 if len(sys.argv) > 3: |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
31 out = open(sys.argv[3], "ab") |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
32 |
4643
a39cec1d5cb8
printenv: filter empty environment variables for portability.
Patrick Mezard <pmezard@gmail.com>
parents:
4285
diff
changeset
|
33 # variables with empty values may not exist on all platforms, filter |
a39cec1d5cb8
printenv: filter empty environment variables for portability.
Patrick Mezard <pmezard@gmail.com>
parents:
4285
diff
changeset
|
34 # them now for portability sake. |
16963
c19113e842d3
tests/printenv.py: replace \ with / in output
Adrian Buehlmann <adrian@cadifra.com>
parents:
13405
diff
changeset
|
35 env = [(k, v) for k, v in os.environ.iteritems() |
4643
a39cec1d5cb8
printenv: filter empty environment variables for portability.
Patrick Mezard <pmezard@gmail.com>
parents:
4285
diff
changeset
|
36 if k.startswith("HG_") and v] |
4285
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
37 env.sort() |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
38 |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
39 out.write("%s hook: " % name) |
16982
9c892c830a72
tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents:
16963
diff
changeset
|
40 if os.name == 'nt': |
9c892c830a72
tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents:
16963
diff
changeset
|
41 filter = lambda x: x.replace('\\', '/') |
9c892c830a72
tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents:
16963
diff
changeset
|
42 else: |
9c892c830a72
tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents:
16963
diff
changeset
|
43 filter = lambda x: x |
9c892c830a72
tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents:
16963
diff
changeset
|
44 vars = ["%s=%s" % (k, filter(v)) for k, v in env] |
9c892c830a72
tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents:
16963
diff
changeset
|
45 out.write(" ".join(vars)) |
4285
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
46 out.write("\n") |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
47 out.close() |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
48 |
4fd6f7e60894
Add tests/printenv.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
49 sys.exit(exitcode) |