qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, Laurent Vivier <lvivier@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH] tests/qtest/rtl8139-test: Make the test less verbose by default
Date: Wed, 15 Feb 2023 12:46:43 +0000	[thread overview]
Message-ID: <Y+zUMygZUSwiPRwG@redhat.com> (raw)
In-Reply-To: <20230215124122.72037-1-thuth@redhat.com>

On Wed, Feb 15, 2023 at 01:41:22PM +0100, Thomas Huth wrote:
> We are facing the issues that some test logs in the gitlab CI are
> too big (and thus cut off). The rtl8139-test is one of the few qtests
> that prints many lines of output by default when running with V=1, so
> it contributes to this problem. Almost all other qtests are silent
> with V=1 and only print debug messages with V=2 and higher. Thus let's
> change the rtl8139-test to behave more like the other tests and only
> print the debug messages with V=2 (or higher).
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/qtest/rtl8139-test.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

> 
> diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c
> index 8fa3313cc3..1beb83805c 100644
> --- a/tests/qtest/rtl8139-test.c
> +++ b/tests/qtest/rtl8139-test.c
> @@ -12,6 +12,8 @@
>  #include "libqos/pci-pc.h"
>  #include "qemu/timer.h"
>  
> +static int verbosity_level;
> +
>  /* Tests only initialization so far. TODO: Replace with functional tests */
>  static void nop(void)
>  {
> @@ -45,12 +47,16 @@ static QPCIDevice *get_device(void)
>  static unsigned __attribute__((unused)) in_##name(void) \
>  { \
>      unsigned res = qpci_io_read##len(dev, dev_bar, (val));     \
> -    g_test_message("*%s -> %x", #name, res); \
> +    if (verbosity_level >= 2) { \
> +        g_test_message("*%s -> %x", #name, res); \
> +    } \
>      return res; \
>  } \
>  static void out_##name(unsigned v) \
>  { \
> -    g_test_message("%x -> *%s", v, #name); \
> +    if (verbosity_level >= 2) { \
> +        g_test_message("%x -> *%s", v, #name); \
> +    } \
>      qpci_io_write##len(dev, dev_bar, (val), v);        \
>  }
>  
> @@ -195,6 +201,11 @@ static void test_init(void)
>  int main(int argc, char **argv)
>  {
>      int ret;
> +    char *v_env = getenv("V");
> +
> +    if (v_env) {
> +        verbosity_level = atoi(v_env);
> +    }

*Not* something I'm requesting you to do now, just an observation / idea.

We've copied this pattern into several tests.

It is starting to feel like we should have a header with a
'qtests_env_setup()' method we call as first thing in main,
and exporting 'verbosity_level' from the header.

Perhaps also with a  'qtest_verbose(...)' macro that wraps

  if (verbosity_level >= 2) {
     g_test_message(...)
  }


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2023-02-15 12:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 12:41 [PATCH] tests/qtest/rtl8139-test: Make the test less verbose by default Thomas Huth
2023-02-15 12:46 ` Daniel P. Berrangé [this message]
2023-02-15 13:38   ` Fabiano Rosas
2023-02-15 14:10     ` Thomas Huth

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=Y+zUMygZUSwiPRwG@redhat.com \
    --to=berrange@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).