[PATCH] test-logtoprocess: fix flaky test

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] test-logtoprocess: fix flaky test

Jun Wu
# HG changeset patch
# User Jun Wu <[hidden email]>
# Date 1487270039 28800
#      Thu Feb 16 10:33:59 2017 -0800
# Node ID 070d9b1d8c2528e8c247b5bcaeb69aea509619a1
# Parent  6e6a461b5b60dc48a9e49cab2f3994b1345531fc
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 070d9b1d8c25
test-logtoprocess: fix flaky test

Commands started by logtoprocess are running asynchronously. To be able to
test the output, we need to block and wait for the output.

The patch adds "| head -n 1" to the "hg log" command so its "asynchronous"
output is waited and can be tested reliably.

diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
--- a/tests/test-logtoprocess.t
+++ b/tests/test-logtoprocess.t
@@ -67,4 +67,4 @@ Confirm that logging blocked time catche
   > EOF
 
-  $ hg log
+  $ hg log | head -n 1
   uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re)
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] test-logtoprocess: fix flaky test

Martin von Zweigbergk via Mercurial-devel
On Thu, Feb 16, 2017 at 10:34 AM, Jun Wu <[hidden email]> wrote:

> # HG changeset patch
> # User Jun Wu <[hidden email]>
> # Date 1487270039 28800
> #      Thu Feb 16 10:33:59 2017 -0800
> # Node ID 070d9b1d8c2528e8c247b5bcaeb69aea509619a1
> # Parent  6e6a461b5b60dc48a9e49cab2f3994b1345531fc
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 070d9b1d8c25
> test-logtoprocess: fix flaky test
>
> Commands started by logtoprocess are running asynchronously. To be able to
> test the output, we need to block and wait for the output.
>
> The patch adds "| head -n 1" to the "hg log" command so its "asynchronous"
> output is waited and can be tested reliably.

Why not "cat"? Maybe also add a comment in the test case explaining
why it's needed?

>
> diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
> --- a/tests/test-logtoprocess.t
> +++ b/tests/test-logtoprocess.t
> @@ -67,4 +67,4 @@ Confirm that logging blocked time catche
>    > EOF
>
> -  $ hg log
> +  $ hg log | head -n 1
>    uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re)
> _______________________________________________
> Mercurial-devel mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] test-logtoprocess: fix flaky test

Jun Wu
Excerpts from Martin von Zweigbergk's message of 2017-02-16 10:40:09 -0800:

> On Thu, Feb 16, 2017 at 10:34 AM, Jun Wu <[hidden email]> wrote:
> > # HG changeset patch
> > # User Jun Wu <[hidden email]>
> > # Date 1487270039 28800
> > #      Thu Feb 16 10:33:59 2017 -0800
> > # Node ID 070d9b1d8c2528e8c247b5bcaeb69aea509619a1
> > # Parent  6e6a461b5b60dc48a9e49cab2f3994b1345531fc
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r 070d9b1d8c25
> > test-logtoprocess: fix flaky test
> >
> > Commands started by logtoprocess are running asynchronously. To be able to
> > test the output, we need to block and wait for the output.
> >
> > The patch adds "| head -n 1" to the "hg log" command so its "asynchronous"
> > output is waited and can be tested reliably.
>
> Why not "cat"? Maybe also add a comment in the test case explaining
> why it's needed?

Good advice. Will send a V2.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel