equal
deleted
inserted
replaced
|
1 ATTENTION: logtoprocess runs commands asynchronously. Be sure to append "| cat" |
|
2 to hg commands, to wait for the output, if you want to test its output. |
|
3 Otherwise the test will be flaky. |
|
4 |
1 Test if logtoprocess correctly captures command-related log calls. |
5 Test if logtoprocess correctly captures command-related log calls. |
2 |
6 |
3 $ hg init |
7 $ hg init |
4 $ cat > $TESTTMP/foocommand.py << EOF |
8 $ cat > $TESTTMP/foocommand.py << EOF |
5 > from mercurial import cmdutil |
9 > from mercurial import cmdutil |
32 > EOF |
36 > EOF |
33 |
37 |
34 Running a command triggers both a ui.log('command') and a |
38 Running a command triggers both a ui.log('command') and a |
35 ui.log('commandfinish') call. The foo command also uses ui.log. |
39 ui.log('commandfinish') call. The foo command also uses ui.log. |
36 |
40 |
37 Use head to ensure we wait for all lines to be produced, and sort to avoid |
41 Use sort to avoid ordering issues between the various processes we spawn: |
38 ordering issues between the various processes we spawn: |
42 $ hg foo | cat | sort |
39 $ hg foo | head -n 17 | sort |
|
40 |
43 |
41 |
44 |
42 |
45 |
43 0 |
46 0 |
44 a message: spam |
47 a message: spam |
64 > uiblocked=echo "\$EVENT stdio \$OPT_STDIO_BLOCKED ms command \$OPT_COMMAND_DURATION ms" |
67 > uiblocked=echo "\$EVENT stdio \$OPT_STDIO_BLOCKED ms command \$OPT_COMMAND_DURATION ms" |
65 > [ui] |
68 > [ui] |
66 > logblockedtimes=True |
69 > logblockedtimes=True |
67 > EOF |
70 > EOF |
68 |
71 |
69 $ hg log |
72 $ hg log | cat |
70 uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re) |
73 uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re) |