From nobody Thu Nov 6 06:17:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539444209403952.5873410323512; Sat, 13 Oct 2018 08:23:29 -0700 (PDT) Received: from localhost ([::1]:45336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBLlI-0002mU-8d for importer@patchew.org; Sat, 13 Oct 2018 11:23:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBLe7-0006Uo-Cs for qemu-devel@nongnu.org; Sat, 13 Oct 2018 11:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBLe6-0004Um-6j for qemu-devel@nongnu.org; Sat, 13 Oct 2018 11:16:03 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:45980) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gBLe5-0004Tq-UU for qemu-devel@nongnu.org; Sat, 13 Oct 2018 11:16:02 -0400 Received: by mail-wr1-x42e.google.com with SMTP id q5-v6so16446547wrw.12 for ; Sat, 13 Oct 2018 08:16:01 -0700 (PDT) Received: from x1.local (62.red-88-24-165.staticip.rima-tde.net. [88.24.165.62]) by smtp.gmail.com with ESMTPSA id g3-v6sm2470446wrw.81.2018.10.13.08.15.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Oct 2018 08:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B29ROZh5iCjOAxsncmr1hPq6+PXLf8L+u9zpA6n4iVE=; b=V6BDspuLrilKWK3pYFMFCF0r7V1YQ6OphOc+HYNVqcM/irKaGo7GSDTeOmRnkteFL3 QqG0sPG8ZJgsyMRphhdrVVJ+Si/BcZL7zW3Mvo/DtKxlyDoXc9m+ckYl4/4r9whmWvZJ 3HO+NemOuHHtheAAJKRSJgmoDMm2LG/3FzF7FhHoLOwzOpIHXOVHQb5sF8jCmiU9X4vg UibVuLHue8hrezlTSvWPfZg+ic0iC32YSaAeuGYIBttbCk46JbDyBzLrNFLbELvhVAdl oIMIDyeMhCpbmeBf7tMRcn9Y1Noy65YnzYCzMOrsBvyiHuzxR604IwLt4v2UHHwy6S7/ vb5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=B29ROZh5iCjOAxsncmr1hPq6+PXLf8L+u9zpA6n4iVE=; b=XdRZ/+qfv+y3Ix+P1s6CgALuntkrbWXWb0SXS3iY4JRZQK7sblE4gx58bdk6Q6vGaL 3b9nLr7T7MZ76x/Yw54Xuf4BgwIHBhX7jKYa4gdU2trQ6MecIm5WX19s2iO3JRH8UEvN H8kJQ0EF9dBGdeVGFQ0ER10sTIi0DrTwAYDOgU5VfMJ38nx22jQaFpKcgunE7RmyFDu8 EaH8TzarL6klXg++KXeaQsR/GLyihJ1YdObkFIw0vizEFC2riuy5N5fk1dSjjton5goG eUpLBE5WhTnecSYxTriZfV9C8/xiuitlx/dK1MPLmA2Xv/Vjq/hwMdtHjxp0Futabhwh afRQ== X-Gm-Message-State: ABuFfohVZ1Nw0e77+HLa2n0nd78HeztkXYE4mXbZnb548KUsYJSj/DTg 5yGjEpMYAhxTinkQnbA4nRA= X-Google-Smtp-Source: ACcGV63zJatNsWajvr1DerP8yF8sggUk7GFHcxipdDnpm9wkhAh+3g+B7uLkgt9e1KDktJ4/5+JTuQ== X-Received: by 2002:adf:9dc9:: with SMTP id q9-v6mr8293137wre.12.1539443760914; Sat, 13 Oct 2018 08:16:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Cleber Rosa , Eduardo Habkost , BALATON Zoltan , Magnus Damm Date: Sat, 13 Oct 2018 17:15:45 +0200 Message-Id: <20181013151545.3731-7-f4bug@amsat.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181013151545.3731-1-f4bug@amsat.org> References: <20181013151545.3731-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e Subject: [Qemu-devel] [RFC PATCH v3 6/6] tests/acceptance: Add test_sh4_r2d in BootLinuxTracing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Similar to the test_x86_64_pc test, this boots a Linux kernel on a R2D board (SH4 little-endian) and verify the usb is working by looking at the usb trace events. Thus this test requires the QEMU binary to be compiled with: $ configure ... --enable-trace-backends=3Dlog This test also requires the dpkg-deb tool (apt/dnf install dpkg) to extract the kernel from the Debian package. $ avocado --show=3Dapp,trace run -p arch=3Dsh4 tests/acceptance/boot_linu= x_console.py JOB ID : dc45be27f5d1edb8289a1ede139e107bbc55b045 JOB LOG : /home/phil/avocado/job-results/job-2018-10-13T14.46-dc45be2/= job.log (1/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_6= 4_pc: CANCEL: Currently specific to the x86_64 target arch (0.00 s) (2/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mips_= 4kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s) (3/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_mipse= l_5kc_malta: CANCEL: Currently specific to the sh4 target arch (0.00 s) (4/5) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_sh4_r= 2d: SKIP: console not working on r2d machine (5/5) tests/acceptance/boot_linux_console.py:BootLinuxTracing.test_sh4_r= 2d: / trace: 22770@1539434809.450006:usb_ohci_init_time usb_bit_time=3D1000000 = usb_frame_time=3D83 trace: 22770@1539434809.453017:usb_ohci_port_attach port #0 trace: 22770@1539434809.454827:usb_ohci_reset sysbus-ohci trace: 22770@1539434809.454833:usb_ohci_stop sysbus-ohci: USB Suspended trace: 22770@1539434809.454835:usb_ohci_stop sysbus-ohci: USB Suspended trace: 22770@1539434809.454837:usb_ohci_port_detach port #0 trace: 22770@1539434809.454839:usb_ohci_port_attach port #0 trace: 22770@1539434811.588702:usb_ohci_reset sysbus-ohci trace: 22770@1539434811.588711:usb_ohci_stop sysbus-ohci: USB Suspended trace: 22770@1539434811.589062:usb_ohci_set_ctl sysbus-ohci: new state 0x= 80 trace: 22770@1539434811.589067:usb_ohci_start sysbus-ohci: USB Operational trace: 22770@1539434811.589253:usb_ohci_hub_power_up powered up all ports PASS (2.43 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | = CANCEL 3 JOB TIME : 2.67 s Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/acceptance/boot_linux_console.py | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 8f99cc0d7c..e11993bf98 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -8,11 +8,22 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 +import os import logging import subprocess =20 from avocado import skip from avocado_qemu import Test +from avocado.utils.wait import wait_for + + +def read_stream_for_string(stream, expected_string, logger=3DNone): + msg =3D stream.readline() + if len(msg) =3D=3D 0: + return False + if logger: + logger.debug(msg.strip()) + return expected_string in msg =20 =20 class BootLinuxConsole(Test): @@ -185,3 +196,56 @@ class BootLinuxConsole(Test): break if 'Kernel panic - not syncing' in msg: self.fail("Kernel panic reached") + +class BootLinuxTracing(Test): + """ + Boots a Linux kernel and checks that via the Tracing framework that + a specific trace events occured, demostrating the kernel is operationa= l. + + :avocado: enable + """ + + timeout =3D 60 + + def test_sh4_r2d(self): + """ + This test requires the dpkg-deb tool (apt/dnf install dpkg) to ext= ract + the kernel from the Debian package. + This test also requires the QEMU binary to be compiled with: + + $ configure ... --enable-trace-backends=3Dlog + + The kernel can be rebuilt using this Debian kernel source [1] and + following the instructions on [2]. + + [1] https://kernel-team.pages.debian.net/kernel-handbook/ch-common= -tasks.html#s-common-official + [2] http://snapshot.debian.org/package/linux-2.6/2.6.32-30/#linux-= source-2.6.32_2.6.32-30 + + :avocado: tags=3Darch:sh4 + """ + if self.arch !=3D 'sh4': + self.cancel('Currently specific to the %s target arch' % self.= arch) + + deb_url =3D ('http://snapshot.debian.org/archive/' + 'debian-ports/20110116T065852Z/pool-sh4/main/l/' + 'linux-2.6/linux-image-2.6.32-5-sh7751r_2.6.32-30_sh4.d= eb') + deb_hash =3D '8025e503319dc8ad786756e3afaa8eb868e9ef59' + deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) + subprocess.check_call(['dpkg-deb', '--extract', deb_path, self.wor= kdir]) + kernel_path =3D self.workdir + '/boot/vmlinuz-2.6.32-5-sh7751r' + trace_path =3D os.path.join(self.workdir, 'trace.log') + trace_logger =3D logging.getLogger('trace') + + self.vm.set_arch(self.arch) + self.vm.set_machine('r2d') + kernel_command_line =3D 'noiotrap' + self.vm.add_args('-trace', "enable=3Dusb_ohci_*,file=3D" + trace_p= ath, + '-kernel', kernel_path, + '-append', kernel_command_line) + + self.vm.launch() + if not wait_for(read_stream_for_string, timeout=3D15, step=3D0, + args=3D(open(trace_path), + 'usb_ohci_hub_power_up powered up all ports', + trace_logger)): + self.fail("Machine failed to boot") --=20 2.19.1