annotate tests/test-profile.t @ 31971:73e9328e5307

obsolescence: add test case D-3 for obsolescence markers exchange About 3 years ago, in August 2014, the logic to select what markers to select on push was ported from the evolve extension to Mercurial core. However, for some unclear reasons, the tests for that logic were not ported alongside. I realised it a couple of weeks ago while working on another push related issue. I've made a clean up pass on the tests and they are now ready to integrate the core test suite. This series of changesets do not change any logic. I just adds test for logic that has been around for about 10 versions of Mercurial. They are a patch for each test case. It makes it easier to review and postpone one with documentation issues without rejecting the wholes series. This patch introduce case D3: missing prune target (prune not in "pushed set") Each test case comes it in own test file. It help parallelism and does not introduce a significant overhead from having a single unified giant test file. Here are timing to support this claim. # Multiple test files version: # run-tests.py --local -j 1 test-exchange-*.t 53.40s user 6.82s system 85% cpu 1:10.76 total 52.79s user 6.97s system 85% cpu 1:09.97 total 52.94s user 6.82s system 85% cpu 1:09.69 total # Single test file version: # run-tests.py --local -j 1 test-exchange-obsmarkers.t 52.97s user 6.85s system 85% cpu 1:10.10 total 52.64s user 6.79s system 85% cpu 1:09.63 total 53.70s user 7.00s system 85% cpu 1:11.17 total
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 10 Apr 2017 16:54:43 +0200
parents 262c2be8ea5a
children 49145a2b2fb0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
1 test --time
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2
16933
30143c3dd102 dispatch: lowercase --time message
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
3 $ hg --time help -q help 2>&1 | grep time > /dev/null
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
4 $ hg init a
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
5 $ cd a
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
6
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
7 #if lsprof
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
8
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
9 test --profile
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
10
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
11 $ prof='hg --config profiling.type=ls --profile'
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
12
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
13 $ $prof st 2>../out
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
14 $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
15
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
16 $ $prof --config profiling.output=../out st
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
17 $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
18
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
19 $ $prof --config profiling.output=blackbox --config extensions.blackbox= st
26191
39a0b11158d8 profiling: allow logging profile to the blackbox
Durham Goode <durham@fb.com>
parents: 18765
diff changeset
20 $ grep CallCount .hg/blackbox.log > /dev/null || cat .hg/blackbox.log
39a0b11158d8 profiling: allow logging profile to the blackbox
Durham Goode <durham@fb.com>
parents: 18765
diff changeset
21
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
22 $ $prof --config profiling.format=text st 2>../out
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
23 $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
24
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
25 $ echo "[profiling]" >> $HGRCPATH
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
26 $ echo "format=kcachegrind" >> $HGRCPATH
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
27
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
28 $ $prof st 2>../out
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
29 $ grep 'events: Ticks' ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
30
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
31 $ $prof --config profiling.output=../out st
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
32 $ grep 'events: Ticks' ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
33
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
34 #endif
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16898
diff changeset
35
29787
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
36 #if lsprof serve
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
37
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
38 Profiling of HTTP requests works
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
39
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
40 $ $prof --config profiling.format=text --config profiling.output=../profile.log serve -d -p $HGPORT --pid-file ../hg.pid -A ../access.log
29787
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
41 $ cat ../hg.pid >> $DAEMON_PIDS
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
42 $ hg -q clone -U http://localhost:$HGPORT ../clone
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
43
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
44 A single profile is logged because file logging doesn't append
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
45 $ grep CallCount ../profile.log | wc -l
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
46 \s*1 (re)
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
47
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
48 #endif
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
49
30316
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
50 Install an extension that can sleep and guarantee a profiler has time to run
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
51
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
52 $ cat >> sleepext.py << EOF
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
53 > import time
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
54 > from mercurial import cmdutil, commands
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
55 > cmdtable = {}
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
56 > command = cmdutil.command(cmdtable)
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
57 > @command('sleep', [], 'hg sleep')
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
58 > def sleep(ui, *args, **kwargs):
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
59 > time.sleep(0.1)
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
60 > EOF
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
61
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
62 $ cat >> $HGRCPATH << EOF
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
63 > [extensions]
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
64 > sleep = `pwd`/sleepext.py
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
65 > EOF
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
66
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
67 statistical profiler works
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
68
30317
3fd53cc1aad8 profiling: make statprof the default profiler (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30316
diff changeset
69 $ hg --profile sleep 2>../out
30316
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
70 $ grep Sample ../out
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
71 Sample count: \d+ (re)
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
72
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
73 Various statprof formatters work
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
74
30317
3fd53cc1aad8 profiling: make statprof the default profiler (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30316
diff changeset
75 $ hg --profile --config profiling.statformat=byline sleep 2>../out
30316
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
76 $ head -n 1 ../out
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
77 % cumulative self
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
78 $ grep Sample ../out
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
79 Sample count: \d+ (re)
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
80
30317
3fd53cc1aad8 profiling: make statprof the default profiler (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30316
diff changeset
81 $ hg --profile --config profiling.statformat=bymethod sleep 2>../out
30316
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
82 $ head -n 1 ../out
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
83 % cumulative self
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
84 $ grep Sample ../out
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
85 Sample count: \d+ (re)
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
86
30317
3fd53cc1aad8 profiling: make statprof the default profiler (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30316
diff changeset
87 $ hg --profile --config profiling.statformat=hotpath sleep 2>../out
30316
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
88 $ grep Sample ../out
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
89 Sample count: \d+ (re)
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
90
30317
3fd53cc1aad8 profiling: make statprof the default profiler (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30316
diff changeset
91 $ hg --profile --config profiling.statformat=json sleep 2>../out
30316
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
92 $ cat ../out
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
93 \[\[\d+.* (re)
faf1b8923da2 profiling: use vendored statprof and upstream enhancements (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30259
diff changeset
94
30845
262c2be8ea5a statprof: require input file
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30317
diff changeset
95 statprof can be used as a standalone module
262c2be8ea5a statprof: require input file
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30317
diff changeset
96
262c2be8ea5a statprof: require input file
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30317
diff changeset
97 $ $PYTHON -m mercurial.statprof hotpath
262c2be8ea5a statprof: require input file
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30317
diff changeset
98 must specify --file to load
262c2be8ea5a statprof: require input file
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30317
diff changeset
99 [1]
262c2be8ea5a statprof: require input file
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30317
diff changeset
100
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16898
diff changeset
101 $ cd ..