All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
To: Nicholas Piggin <npiggin@gmail.com>,
	Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"John Snow" <jsnow@redhat.com>, "Cleber Rosa" <crosa@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 2/4] tests/avocado: replay_linux.py add replay-dump.py test
Date: Fri, 18 Aug 2023 07:23:11 +0300	[thread overview]
Message-ID: <7af8a4f7-06f8-436f-e125-d6389fcdbbda@ispras.ru> (raw)
In-Reply-To: <20230814163135.187882-3-npiggin@gmail.com>

On 14.08.2023 19:31, Nicholas Piggin wrote:
> This runs replay-dump.py after recording a trace, and fails the test if
> the script fails.
> 
> replay-dump.py is modified to exit with non-zero if an error is
> encountered while parsing.

I would like to have separate test for replay-dump, because
replay-linux tests are very heavy to replay and knowing the exact
reason of the failure in advance would be more convenient.

What do you think of splitting the test?

> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> It's possible this could introduce failures to existing test if an
> unimplemented event gets recorded. I would make a new test for this but
> it takes quite a while to record such a long trace that includes some
> block and net events to excercise the script.
> 
> Thanks,
> Nick
> 
>   scripts/replay-dump.py        |  6 ++++--
>   tests/avocado/replay_linux.py | 16 +++++++++++++++-
>   2 files changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
> index 937ae19ff1..8f4715632a 100755
> --- a/scripts/replay-dump.py
> +++ b/scripts/replay-dump.py
> @@ -21,6 +21,7 @@
>   import argparse
>   import struct
>   import os
> +import sys
>   from collections import namedtuple
>   
>   # This mirrors some of the global replay state which some of the
> @@ -97,7 +98,7 @@ def call_decode(table, index, dumpfile):
>           print("Could not decode index: %d" % (index))
>           print("Entry is: %s" % (decoder))
>           print("Decode Table is:\n%s" % (table))
> -        return False
> +        sys.exit(1)
>       else:
>           return decoder.fn(decoder.eid, decoder.name, dumpfile)
>   
> @@ -118,7 +119,7 @@ def print_event(eid, name, string=None, event_count=None):
>   def decode_unimp(eid, name, _unused_dumpfile):
>       "Unimplimented decoder, will trigger exit"
>       print("%s not handled - will now stop" % (name))
> -    return False
> +    sys.exit(1)
>   
>   # Checkpoint decoder
>   def swallow_async_qword(eid, name, dumpfile):
> @@ -401,3 +402,4 @@ def decode_file(filename):
>   if __name__ == "__main__":
>       args = parse_arguments()
>       decode_file(args.file)
> +    sys.exit(0)
> diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py
> index a76dd507fc..12937ce0ec 100644
> --- a/tests/avocado/replay_linux.py
> +++ b/tests/avocado/replay_linux.py
> @@ -11,6 +11,7 @@
>   import os
>   import logging
>   import time
> +import subprocess
>   
>   from avocado import skipUnless
>   from avocado_qemu import BUILD_DIR
> @@ -21,6 +22,11 @@
>   from avocado.utils.path import find_command
>   from avocado_qemu import LinuxTest
>   
> +from pathlib import Path
> +
> +self_dir = Path(__file__).parent
> +src_dir = self_dir.parent.parent
> +
>   class ReplayLinux(LinuxTest):
>       """
>       Boots a Linux system, checking for a successful initialization
> @@ -94,7 +100,7 @@ def launch_and_wait(self, record, args, shift):
>           else:
>               vm.event_wait('SHUTDOWN', self.timeout)
>               vm.shutdown(True)
> -            logger.info('successfully fihished the replay')
> +            logger.info('successfully finished the replay')
>           elapsed = time.time() - start_time
>           logger.info('elapsed time %.2f sec' % elapsed)
>           return elapsed
> @@ -105,6 +111,14 @@ def run_rr(self, args=None, shift=7):
>           logger = logging.getLogger('replay')
>           logger.info('replay overhead {:.2%}'.format(t2 / t1 - 1))
>   
> +        try:
> +            replay_path = os.path.join(self.workdir, 'replay.bin')
> +            subprocess.check_call(["./scripts/replay-dump.py",
> +                                   "-f", replay_path],
> +                                  cwd=src_dir, stdout=subprocess.DEVNULL)
> +        except subprocess.CalledProcessError:
> +            self.fail('replay-dump.py failed')
> +
>   @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
>   class ReplayLinuxX8664(ReplayLinux):
>       """



  reply	other threads:[~2023-08-18  4:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 16:31 [PATCH for-8.2 0/4] Assorted replay patches Nicholas Piggin
2023-08-14 16:31 ` [PATCH 1/4] scripts/replay_dump.sh: Update to current rr record format Nicholas Piggin
2023-08-18  4:19   ` Pavel Dovgalyuk
2023-08-14 16:31 ` [PATCH 2/4] tests/avocado: replay_linux.py add replay-dump.py test Nicholas Piggin
2023-08-18  4:23   ` Pavel Dovgalyuk [this message]
2023-08-14 16:31 ` [PATCH 3/4] replay: allow runstate shutdown->running when replaying trace Nicholas Piggin
2023-08-18  4:25   ` Pavel Dovgalyuk
2023-08-14 16:31 ` [PATCH 4/4] replay: simple auto-snapshot mode for record Nicholas Piggin
2023-08-18  4:36   ` Pavel Dovgalyuk
2024-02-26  7:36     ` Nicholas Piggin
2024-02-28  5:07       ` Pavel Dovgalyuk
2024-02-29  6:32         ` Nicholas Piggin
2024-03-04 16:33         ` Nicholas Piggin

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=7af8a4f7-06f8-436f-e125-d6389fcdbbda@ispras.ru \
    --to=pavel.dovgalyuk@ispras.ru \
    --cc=bleal@redhat.com \
    --cc=crosa@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@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.