annotate tests/test-logtoprocess.t @ 40343:a69d5823af6d

tests: add test for widening from an empty clone Narrow clones that track no paths currently don't even include the root manifest (which is the only manifest when using flat manifests). That means that when we widen from such a clone, we need to make sure that we send the root manifest (and other manifests if using tree manifests). That currently works because we always resend all manifest that match the new narrowspec. However, we're about to stop resending manifests that the client already has and there's a risk of this breaking then, so let's add a test. Differential Revision: https://phab.mercurial-scm.org/D5143
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 17 Oct 2018 09:30:07 -0700
parents c4a3d3c67c4f
children 18da306e92b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32915
0afc4206d02b test-logtoprocess: don't run on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 32337
diff changeset
1 #require no-windows
0afc4206d02b test-logtoprocess: don't run on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 32337
diff changeset
2
30991
3844b3299a53 test-logtoprocess: use cat to wait for outputs
Jun Wu <quark@fb.com>
parents: 30978
diff changeset
3 ATTENTION: logtoprocess runs commands asynchronously. Be sure to append "| cat"
3844b3299a53 test-logtoprocess: use cat to wait for outputs
Jun Wu <quark@fb.com>
parents: 30978
diff changeset
4 to hg commands, to wait for the output, if you want to test its output.
3844b3299a53 test-logtoprocess: use cat to wait for outputs
Jun Wu <quark@fb.com>
parents: 30978
diff changeset
5 Otherwise the test will be flaky.
3844b3299a53 test-logtoprocess: use cat to wait for outputs
Jun Wu <quark@fb.com>
parents: 30978
diff changeset
6
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
7 Test if logtoprocess correctly captures command-related log calls.
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
8
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
9 $ hg init
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
10 $ cat > $TESTTMP/foocommand.py << EOF
33966
e98dab3fafbc tests: update test-logtoprocess to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33097
diff changeset
11 > from __future__ import absolute_import
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 30991
diff changeset
12 > from mercurial import registrar
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
13 > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 30991
diff changeset
14 > command = registrar.command(cmdtable)
34764
af43cb56af4e configitems: register the test 'logtoprocess.foo' config
Boris Feld <boris.feld@octobus.net>
parents: 34444
diff changeset
15 > configtable = {}
af43cb56af4e configitems: register the test 'logtoprocess.foo' config
Boris Feld <boris.feld@octobus.net>
parents: 34444
diff changeset
16 > configitem = registrar.configitem(configtable)
af43cb56af4e configitems: register the test 'logtoprocess.foo' config
Boris Feld <boris.feld@octobus.net>
parents: 34444
diff changeset
17 > configitem('logtoprocess', 'foo',
af43cb56af4e configitems: register the test 'logtoprocess.foo' config
Boris Feld <boris.feld@octobus.net>
parents: 34444
diff changeset
18 > default=None,
af43cb56af4e configitems: register the test 'logtoprocess.foo' config
Boris Feld <boris.feld@octobus.net>
parents: 34444
diff changeset
19 > )
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32915
diff changeset
20 > @command(b'foo', [])
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
21 > def foo(ui, repo):
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
22 > ui.log('foo', 'a message: %(bar)s\n', bar='spam')
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
23 > EOF
30976
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
24 $ cp $HGRCPATH $HGRCPATH.bak
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
25 $ cat >> $HGRCPATH << EOF
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
26 > [extensions]
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
27 > logtoprocess=
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
28 > foocommand=$TESTTMP/foocommand.py
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
29 > [logtoprocess]
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
30 > command=(echo 'logtoprocess command output:';
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
31 > echo "\$EVENT";
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
32 > echo "\$MSG1";
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
33 > echo "\$MSG2") > $TESTTMP/command.log
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
34 > commandfinish=(echo 'logtoprocess commandfinish output:';
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
35 > echo "\$EVENT";
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
36 > echo "\$MSG1";
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
37 > echo "\$MSG2";
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
38 > echo "\$MSG3") > $TESTTMP/commandfinish.log
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
39 > foo=(echo 'logtoprocess foo output:';
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
40 > echo "\$EVENT";
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
41 > echo "\$MSG1";
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
42 > echo "\$OPT_BAR") > $TESTTMP/foo.log
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
43 > EOF
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
44
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
45 Running a command triggers both a ui.log('command') and a
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
46 ui.log('commandfinish') call. The foo command also uses ui.log.
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
47
30991
3844b3299a53 test-logtoprocess: use cat to wait for outputs
Jun Wu <quark@fb.com>
parents: 30978
diff changeset
48 Use sort to avoid ordering issues between the various processes we spawn:
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
49 $ hg foo
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
50 $ sleep 0.2
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
51 $ cat $TESTTMP/command.log | sort
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
52
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
53 command
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
54 foo
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
55 foo
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
56 logtoprocess command output:
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
57
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
58 #if no-chg
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
59 $ cat $TESTTMP/commandfinish.log | sort
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
60
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
61 0
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
62 commandfinish
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
63 foo
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
64 foo exited 0 after * seconds (glob)
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
65 logtoprocess commandfinish output:
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
66 $ cat $TESTTMP/foo.log | sort
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
67
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
68 a message: spam
28901
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
69 foo
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
70 logtoprocess foo output:
a368da441b32 logtoprocess: new experimental extension
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
71 spam
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
72 #endif
30976
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
73
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
74 Confirm that logging blocked time catches stdio properly:
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
75 $ cp $HGRCPATH.bak $HGRCPATH
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
76 $ cat >> $HGRCPATH << EOF
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
77 > [extensions]
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
78 > logtoprocess=
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
79 > pager=
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
80 > [logtoprocess]
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
81 > uiblocked=echo "\$EVENT stdio \$OPT_STDIO_BLOCKED ms command \$OPT_COMMAND_DURATION ms" > $TESTTMP/uiblocked.log
30976
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
82 > [ui]
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
83 > logblockedtimes=True
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
84 > EOF
e92daf156d5c ui: provide a mechanism to track and log blocked time
Simon Farnsworth <simonfar@fb.com>
parents: 28901
diff changeset
85
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
86 $ hg log
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
87 $ sleep 0.2
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
88 $ cat $TESTTMP/uiblocked.log
30978
fdecd24ca4dc ui: log time spent blocked on stdio
Simon Farnsworth <simonfar@fb.com>
parents: 30976
diff changeset
89 uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re)
39925
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
90
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
91 Try to confirm that pager wait on logtoprocess:
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
92
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
93 Add a script that wait on a file to appears for 5 seconds, if it sees it touch
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
94 another file or die after 5 seconds. If the scripts is awaited by hg, the
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
95 script will die after the timeout before we could touch the file and the
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
96 resulting file will not exists. If not, we will touch the file and see it.
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
97
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
98 $ cat > $TESTTMP/wait-output.sh << EOF
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
99 > #!/bin/sh
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
100 > for i in \`$TESTDIR/seq.py 50\`; do
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
101 > if [ -f "$TESTTMP/wait-for-touched" ];
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
102 > then
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
103 > touch "$TESTTMP/touched";
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
104 > break;
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
105 > else
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
106 > sleep 0.1;
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
107 > fi
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
108 > done
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
109 > EOF
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
110 $ chmod +x $TESTTMP/wait-output.sh
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
111
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
112 $ cat >> $HGRCPATH << EOF
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
113 > [extensions]
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
114 > logtoprocess=
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
115 > pager=
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
116 > [logtoprocess]
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
117 > commandfinish=$TESTTMP/wait-output.sh
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
118 > EOF
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
119 $ hg version -q --pager=always
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
120 Mercurial Distributed SCM (version *) (glob)
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
121 $ touch $TESTTMP/wait-for-touched
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
122 $ sleep 0.2
dfca83594145 logtoprocess: add a test to show pager and ltp bad interaction
Boris Feld <boris.feld@octobus.net>
parents: 34764
diff changeset
123 $ test -f $TESTTMP/touched && echo "SUCCESS Pager is not waiting on ltp" || echo "FAIL Pager is waiting on ltp"
39926
c4a3d3c67c4f logtoprocess: connect all fds to /dev/null to avoid bad interaction with pager
Boris Feld <boris.feld@octobus.net>
parents: 39925
diff changeset
124 SUCCESS Pager is not waiting on ltp