From nobody Sun Nov 24 14:05:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1723525670; cv=none; d=zohomail.com; s=zohoarc; b=lRMhkpq64uCrpc0asiu0RQ/idK5cEXf4q+Xo8fuuPwjlGl/PzT6Pdqhm7+UJEjWwZ7Ph9Y+RmXd589RP40tqgl/mvnw15dCKwiy32HJ/PKMHl6hhhAvSStVIOPklMlSV7pya0Hk87Dytg5j3asx34jS9ZYQtusyZZ1TtUS/TQng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723525670; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GZaPFXsEwNSckHNrddAYL++URt7rrgqX0Xo18n20TXg=; b=DWAv172UEehk0q0ad7ko9vTzhhBqSSULjjdJP7by1UCsFQ4E/teptpUx1I63KDr3aJ3Y+F6FIaTEalV29ZfYd+bcH36W47UuxKLseomqKhuu8W74zXjDSaEXx+LNPqnqbk8xZ7KDuugBiEKzFdUrHHnh+lgybAPjAnlraVkhiFg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1723525670121928.2575891707802; Mon, 12 Aug 2024 22:07:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdjkX-0000Zv-RX; Tue, 13 Aug 2024 01:07:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdjkT-0000IO-9w for qemu-devel@nongnu.org; Tue, 13 Aug 2024 01:07:09 -0400 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdjkR-0007my-Hg for qemu-devel@nongnu.org; Tue, 13 Aug 2024 01:07:09 -0400 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-264a12e05b9so3411033fac.1 for ; Mon, 12 Aug 2024 22:07:07 -0700 (PDT) Received: from wheely.local0.net ([1.145.66.74]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710e5874ddcsm4846449b3a.28.2024.08.12.22.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 22:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723525625; x=1724130425; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GZaPFXsEwNSckHNrddAYL++URt7rrgqX0Xo18n20TXg=; b=lgNVOKoPnckTVPQS++49jvSUAUQYJrwcm1SIoM4GEd9uNPkY8yhvJQ0Rr4tysHRBUl 04Ve59J5pphVP56+pLHcTJ4O+kaWpQL2UdbXjoxoPqkaYrIo2q9jAgvRrZSyUMP98wYq QGlRVPx9itMgNr9E04P44Ua47e7y7B4bfgKTH+2KXWvLy51avqJTW7kF5NB7OWMkaie4 2rhz05wS2VIuV+tWNlj8uOh9wlGVlHPuXprlQw8x34hXlQ/T/FFtLd/5VjS7R8snV+bm 5ILi645+MmOIc9rO0PssOtCW5B7/yZYwaI8TaHuwiZlTdWBxzHBYjaZOQxCelcw3IsqK T6DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723525625; x=1724130425; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GZaPFXsEwNSckHNrddAYL++URt7rrgqX0Xo18n20TXg=; b=ALUW2nRNfDtzAX5PTH40Gt9SxAl9w6uumqh4fITrS0Gd++Y3eJG9m2gBgY4UkD9/fg 5iN0fZfpUzZrJCq1N9GbuTuJwF9+K7wooc57LyaAHiUdAXd/eiTvfu/ExSU0jOtyWXaO HuWiEuoqubMcx0gg3n0C77xbKNFgc4rDWmWCwTD6zN3+TNZiC+l/ZQ+jKKsycMpElAAN qIHNRC+DGxfhW1Zpd50yWjeynZ/h5f6wLWkTTeVCcmlHdghQL9BpQwG4txVyDF/Cn0zg 3FBlN64TwJKhEzupEH6GhB8JyYAb8V3/UNVyeSkSCVnacAeCfVbV35NexPfTlY1Xi+qd gOyw== X-Gm-Message-State: AOJu0YzAAkddP0Ch1DFuzoxzzqM7gv85ugQKTXcMAF1YcNHhFqR4paOH OYZjCyRF0obGWblxF05PsbdC6GAXs5/xv95ET/20lTdOHcGh1F7qk96auXw7 X-Google-Smtp-Source: AGHT+IFh6fvoUTrkPs2In5lppM55qpQ1GNN6hPpFp6ryOC3+KHCv8Ix9lQZgQsZfGt6S3YU1bCprDw== X-Received: by 2002:a05:6871:4309:b0:25a:eca3:6b5e with SMTP id 586e51a60fabf-26fcb61b240mr2563404fac.9.1723525625428; Mon, 12 Aug 2024 22:07:05 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Pavel Dovgalyuk , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , John Snow , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal , Michael Tokarev Subject: [PATCH v6 03/10] tests/avocado: excercise scripts/replay-dump.py in replay tests Date: Tue, 13 Aug 2024 15:06:30 +1000 Message-ID: <20240813050638.446172-4-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240813050638.446172-1-npiggin@gmail.com> References: <20240813050638.446172-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::2f; envelope-from=npiggin@gmail.com; helo=mail-oa1-x2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1723525672246116600 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, to support this. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Pavel Dovgalyuk Signed-off-by: Nicholas Piggin v5: Update timeout to 180s because x86 was just exceeding 120s in gitlab with this change --- scripts/replay-dump.py | 6 ++++-- tests/avocado/replay_kernel.py | 13 ++++++++++++- tests/avocado/replay_linux.py | 10 ++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index b82659cfb6..4ce7ff51cc 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 from os import path =20 @@ -100,7 +101,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 + raise(Exception("unknown event")) else: return decoder.fn(decoder.eid, decoder.name, dumpfile) =20 @@ -121,7 +122,7 @@ def print_event(eid, name, string=3DNone, event_count= =3DNone): def decode_unimp(eid, name, _unused_dumpfile): "Unimplemented decoder, will trigger exit" print("%s not handled - will now stop" % (name)) - return False + raise(Exception("unhandled event")) =20 def decode_plain(eid, name, _unused_dumpfile): "Plain events without additional data" @@ -434,6 +435,7 @@ def decode_file(filename): dumpfile) except Exception as inst: print(f"error {inst}") + sys.exit(1) =20 finally: print(f"Reached {dumpfile.tell()} of {dumpsize} bytes") diff --git a/tests/avocado/replay_kernel.py b/tests/avocado/replay_kernel.py index 232d287c27..a668af9d36 100644 --- a/tests/avocado/replay_kernel.py +++ b/tests/avocado/replay_kernel.py @@ -13,6 +13,7 @@ import shutil import logging import time +import subprocess =20 from avocado import skip from avocado import skipUnless @@ -31,7 +32,7 @@ class ReplayKernelBase(LinuxKernelTest): terminates. """ =20 - timeout =3D 120 + timeout =3D 180 KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D1 panic=3D-1 ' =20 def run_vm(self, kernel_path, kernel_command_line, console_pattern, @@ -63,6 +64,8 @@ def run_vm(self, kernel_path, kernel_command_line, consol= e_pattern, vm.shutdown() logger.info('finished the recording with log size %s bytes' % os.path.getsize(replay_path)) + self.run_replay_dump(replay_path) + logger.info('successfully tested replay-dump.py') else: vm.wait() logger.info('successfully finished the replay') @@ -70,6 +73,14 @@ def run_vm(self, kernel_path, kernel_command_line, conso= le_pattern, logger.info('elapsed time %.2f sec' % elapsed) return elapsed =20 + def run_replay_dump(self, replay_path): + try: + subprocess.check_call(["./scripts/replay-dump.py", + "-f", replay_path], + stdout=3Dsubprocess.DEVNULL) + except subprocess.CalledProcessError: + self.fail('replay-dump.py failed') + def run_rr(self, kernel_path, kernel_command_line, console_pattern, shift=3D7, args=3DNone): replay_path =3D os.path.join(self.workdir, 'replay.bin') diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py index b4673261ce..5916922435 100644 --- a/tests/avocado/replay_linux.py +++ b/tests/avocado/replay_linux.py @@ -94,6 +94,8 @@ def launch_and_wait(self, record, args, shift): vm.shutdown() logger.info('finished the recording with log size %s bytes' % os.path.getsize(replay_path)) + self.run_replay_dump(replay_path) + logger.info('successfully tested replay-dump.py') else: vm.event_wait('SHUTDOWN', self.timeout) vm.wait() @@ -108,6 +110,14 @@ def run_rr(self, args=3DNone, shift=3D7): logger =3D logging.getLogger('replay') logger.info('replay overhead {:.2%}'.format(t2 / t1 - 1)) =20 + def run_replay_dump(self, replay_path): + try: + subprocess.check_call(["./scripts/replay-dump.py", + "-f", replay_path], + stdout=3Dsubprocess.DEVNULL) + except subprocess.CalledProcessError: + self.fail('replay-dump.py failed') + @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') class ReplayLinuxX8664(ReplayLinux): """ --=20 2.45.2