All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com, peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH] tests: Silence migration-test 'bad' test
Date: Wed, 7 Mar 2018 13:10:29 +0800	[thread overview]
Message-ID: <20180307051029.GG17720@xz-mi> (raw)
In-Reply-To: <20180306173042.24572-1-dgilbert@redhat.com>

On Tue, Mar 06, 2018 at 05:30:42PM +0000, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> In 2c9bb29703c I added a migration test that purposely fails;
> unfortunately it prints a copy of the failure message to stderr
> which makes the output a bit messy.
> 
> Hide stderr for that test.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  tests/migration-test.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/migration-test.c b/tests/migration-test.c
> index 74f9361bdd..422bf1afdf 100644
> --- a/tests/migration-test.c
> +++ b/tests/migration-test.c
> @@ -382,7 +382,7 @@ static void migrate_start_postcopy(QTestState *who)
>  }
>  
>  static void test_migrate_start(QTestState **from, QTestState **to,
> -                               const char *uri)
> +                               const char *uri, bool hide_stderr)
>  {
>      gchar *cmd_src, *cmd_dst;
>      char *bootpath = g_strdup_printf("%s/bootsect", tmpfs);
> @@ -427,6 +427,17 @@ static void test_migrate_start(QTestState **from, QTestState **to,
>  
>      g_free(bootpath);
>  
> +    if (hide_stderr) {
> +        gchar *tmp;
> +        tmp = g_strdup_printf("%s 2>/dev/null", cmd_src);
> +        g_free(cmd_src);
> +        cmd_src = tmp;
> +
> +        tmp = g_strdup_printf("%s 2>/dev/null", cmd_dst);
> +        g_free(cmd_dst);
> +        cmd_dst = tmp;

I thought this would affect QTEST_LOG in
qtest_init_without_qmp_handshake() but I was wrong.  I think that's
because that "/dev/fd/2" is a string passed to QEMU process, so only
the stderr of test process is closed while we kept the QTEST_LOG
there, which seems to be ideal.

Reviewed-by: Peter Xu <peterx@redhat.com>
Tested-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu

  reply	other threads:[~2018-03-07  5:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 17:30 [Qemu-devel] [PATCH] tests: Silence migration-test 'bad' test Dr. David Alan Gilbert (git)
2018-03-07  5:10 ` Peter Xu [this message]
2018-03-09 15:12 ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180307051029.GG17720@xz-mi \
    --to=peterx@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.