From nobody Mon Feb 9 12:43:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1632762178; cv=none; d=zohomail.com; s=zohoarc; b=hq7KTNP24rD8uj0LRanyUvD17dPxK5+flBOmAIjtlhMILRz3qM9qo+Tj7T2mCfRV/K+FrfH3iG2mUK5KaxwtF5IvdqYOMHmo6ZD6vlj97fZ0MeZ8sD1GKRJ001C25Q/6rUYwDqRygezIsFGMH+pGGdV+Qjy00GVAbar8t+pN1Fg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632762178; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=vRgWYEGsAgU7uIIj68INIPW3631NH105ds18Xph/6rE=; b=TGgK+l75ozXLKqzRxhgXjkjnVFQ1GKFhfKS9/dUyj0AhpJc0H7rEcwz7kgbSZFxV4ds6GlRzgumUDjdAyjs8HtRmHm0VFZZlAVoTyW4KbKwBkpRUxCqK2vGdT0WNbp4WBFn3HH8GuqJ4au1pFEiBZ2j2cL/CxxwBAC65NRIkTrY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1632762178522641.2709611507287; Mon, 27 Sep 2021 10:02:58 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-438-2pdkRqojPi-JS8ihQKkcDg-1; Mon, 27 Sep 2021 13:02:53 -0400 Received: by mail-wm1-f71.google.com with SMTP id p63-20020a1c2942000000b0030ccf0767baso460501wmp.6 for ; Mon, 27 Sep 2021 10:02:53 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id m2sm104958wmm.3.2021.09.27.10.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 10:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632762177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vRgWYEGsAgU7uIIj68INIPW3631NH105ds18Xph/6rE=; b=Bvzd5PrKmipTMqlUV72tSxtAxfwBDaoBS9Ct6IgpNbnOvui3bvSn2saJ7wJaNUwRqLZWHk 2WyexXxam1hr3bYVdTW+f1ysCnRlnBoxYAnC0t+0oaQdsbDI+EJP9DIZCFAQjBNsvjySTd 2vKFzj8/qe7w3h66aN/XSKHbiaE9dqE= X-MC-Unique: 2pdkRqojPi-JS8ihQKkcDg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vRgWYEGsAgU7uIIj68INIPW3631NH105ds18Xph/6rE=; b=wKwMyJXgHIDsaKZ+hQq42a8mY6lm02o8Z0rz4PtKPN8F9Upf9/y1iyY8HwZGKKt+Dz kfTjAMlL969ja0lG4/Gjzj3NXOrEAHIBdLUep00E3R5VQ4onk1v1d84dvwtXcdZW81wv KeBU8W75u3+gq7JeFibKAY1YsdTXqwOgD5C0xnJnUdid76HMAXq6sznCOJqtxtyMWbpe oP9aIrCBhj4OZXdMjrkWs+9UDgDoMry0TNaGZ/QzjBeZNrreooMTOyWvLaFjEoN3a+c0 pd5yUbM1beLIx1GuSrfxIX1CDflR+ZtAC6COVI7VzmusKNtFtzYvYDf6nz1/HeGW4llo 3viA== X-Gm-Message-State: AOAM531jwuVXWT6TkgWS88xwWUa0aAZJ9PqssPjBbdoaWnCcMfKHXqN2 FxePEA1smjZ0hXXPqWk9kSH+GKiVXbPDIW7J4kyjCmy/CfD8h5WDODjWyunrrcgAI/5UXwGUN3C 8gHd9F93s7sN6hA== X-Received: by 2002:adf:ded1:: with SMTP id i17mr1075160wrn.83.1632762171958; Mon, 27 Sep 2021 10:02:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqiLU35jXyGdjD/P8O5Tevc+W3mytoyTvWIX4B9mr1aQ8vyK7iZQXUrw5hCkv96HMKmRIdIQ== X-Received: by 2002:adf:ded1:: with SMTP id i17mr1075133wrn.83.1632762171773; Mon, 27 Sep 2021 10:02:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Pavel Dovgalyuk , Pavel Dovgalyuk , Willian Rampazzo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/21] tests/acceptance: Linux boot test for record/replay Date: Mon, 27 Sep 2021 19:02:11 +0200 Message-Id: <20210927170227.2014482-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210927170227.2014482-1-philmd@redhat.com> References: <20210927170227.2014482-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632762180016100001 From: Pavel Dovgalyuk This patch adds a test for record/replay, which boots Linux image from the disk and interacts with the network. The idea and code of this test is borrowed from boot_linux.py This test includes only x86_64 platform. Other platforms and machines will be added later after testing and improving record/replay to completely support them. Each test consists of the following phases: - downloading the disk image - recording the execution - replaying the execution Replay does not validates the output, but waits until QEMU finishes the execution. This is reasonable, because QEMU usually hangs when replay goes wrong. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Willian Rampazzo Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <162737554047.1735673.13133593401566029378.stgit@pasha-ThinkPad= -X280> --- MAINTAINERS | 1 + tests/acceptance/replay_linux.py | 116 +++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 tests/acceptance/replay_linux.py diff --git a/MAINTAINERS b/MAINTAINERS index d7915ec128e..069db6d2995 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2973,6 +2973,7 @@ F: include/sysemu/replay.h F: docs/replay.txt F: stubs/replay.c F: tests/acceptance/replay_kernel.py +F: tests/acceptance/replay_linux.py F: tests/acceptance/reverse_debugging.py F: qapi/replay.json =20 diff --git a/tests/acceptance/replay_linux.py b/tests/acceptance/replay_lin= ux.py new file mode 100644 index 00000000000..15953f9e496 --- /dev/null +++ b/tests/acceptance/replay_linux.py @@ -0,0 +1,116 @@ +# Record/replay test that boots a complete Linux system via a cloud image +# +# Copyright (c) 2020 ISP RAS +# +# Author: +# Pavel Dovgalyuk +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import os +import logging +import time + +from avocado import skipUnless +from avocado.utils import cloudinit +from avocado.utils import network +from avocado.utils import vmimage +from avocado.utils import datadrainer +from avocado.utils.path import find_command +from avocado_qemu import LinuxTest + +class ReplayLinux(LinuxTest): + """ + Boots a Linux system, checking for a successful initialization + """ + + timeout =3D 1800 + chksum =3D None + hdd =3D 'ide-hd' + cd =3D 'ide-cd' + bus =3D 'ide' + + def setUp(self): + super(ReplayLinux, self).setUp() + self.boot_path =3D self.download_boot() + self.cloudinit_path =3D self.prepare_cloudinit() + + def vm_add_disk(self, vm, path, id, device): + bus_string =3D '' + if self.bus: + bus_string =3D ',bus=3D%s.%d' % (self.bus, id,) + vm.add_args('-drive', 'file=3D%s,snapshot,id=3Ddisk%s,if=3Dnone' %= (path, id)) + vm.add_args('-drive', + 'driver=3Dblkreplay,id=3Ddisk%s-rr,if=3Dnone,image=3Ddisk%s' %= (id, id)) + vm.add_args('-device', + '%s,drive=3Ddisk%s-rr%s' % (device, id, bus_string)) + + def launch_and_wait(self, record, args, shift): + vm =3D self.get_vm() + vm.add_args('-smp', '1') + vm.add_args('-m', '1024') + vm.add_args('-object', 'filter-replay,id=3Dreplay,netdev=3Dhub0por= t0') + if args: + vm.add_args(*args) + self.vm_add_disk(vm, self.boot_path, 0, self.hdd) + self.vm_add_disk(vm, self.cloudinit_path, 1, self.cd) + logger =3D logging.getLogger('replay') + if record: + logger.info('recording the execution...') + mode =3D 'record' + else: + logger.info('replaying the execution...') + mode =3D 'replay' + replay_path =3D os.path.join(self.workdir, 'replay.bin') + vm.add_args('-icount', 'shift=3D%s,rr=3D%s,rrfile=3D%s' % + (shift, mode, replay_path)) + + start_time =3D time.time() + + vm.set_console() + vm.launch() + console_drainer =3D datadrainer.LineLogger(vm.console_socket.filen= o(), + logger=3Dself.log.getChild('console'), + stop_check=3D(lambda : not vm.is_runni= ng())) + console_drainer.start() + if record: + cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port= ), + self.name) + vm.shutdown() + logger.info('finished the recording with log size %s bytes' + % os.path.getsize(replay_path)) + else: + vm.event_wait('SHUTDOWN', self.timeout) + vm.shutdown(True) + logger.info('successfully fihished the replay') + elapsed =3D time.time() - start_time + logger.info('elapsed time %.2f sec' % elapsed) + return elapsed + + def run_rr(self, args=3DNone, shift=3D7): + t1 =3D self.launch_and_wait(True, args, shift) + t2 =3D self.launch_and_wait(False, args, shift) + logger =3D logging.getLogger('replay') + logger.info('replay overhead {:.2%}'.format(t2 / t1 - 1)) + +@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout') +class ReplayLinuxX8664(ReplayLinux): + """ + :avocado: tags=3Darch:x86_64 + :avocado: tags=3Daccel:tcg + """ + + chksum =3D 'e3c1b309d9203604922d6e255c2c5d098a309c2d46215d8fc026954f3c= 5c27a0' + + def test_pc_i440fx(self): + """ + :avocado: tags=3Dmachine:pc + """ + self.run_rr(shift=3D1) + + def test_pc_q35(self): + """ + :avocado: tags=3Dmachine:q35 + """ + self.run_rr(shift=3D3) --=20 2.31.1