From: Nicholas Piggin <npiggin@gmail.com>
To: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
"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: [PATCH 2/4] tests/avocado: replay_linux.py add replay-dump.py test
Date: Tue, 15 Aug 2023 02:31:33 +1000 [thread overview]
Message-ID: <20230814163135.187882-3-npiggin@gmail.com> (raw)
In-Reply-To: <20230814163135.187882-1-npiggin@gmail.com>
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.
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):
"""
--
2.40.1
next prev parent reply other threads:[~2023-08-14 16:32 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 ` Nicholas Piggin [this message]
2023-08-18 4:23 ` [PATCH 2/4] tests/avocado: replay_linux.py add replay-dump.py test Pavel Dovgalyuk
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=20230814163135.187882-3-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=jsnow@redhat.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.