From nobody Tue Feb 10 16:22:25 2026 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 152415753919133.52459983034248; Thu, 19 Apr 2018 10:05:39 -0700 (PDT) Received: from localhost ([::1]:60832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9D05-0001Xl-W4 for importer@patchew.org; Thu, 19 Apr 2018 13:05:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9CiN-0003TI-7a for qemu-devel@nongnu.org; Thu, 19 Apr 2018 12:47:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9CiM-0007WH-2i for qemu-devel@nongnu.org; Thu, 19 Apr 2018 12:47:19 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:41458) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f9CiL-0007WB-U9 for qemu-devel@nongnu.org; Thu, 19 Apr 2018 12:47:18 -0400 Received: by mail-qt0-x243.google.com with SMTP id d3-v6so6478408qth.8 for ; Thu, 19 Apr 2018 09:47:17 -0700 (PDT) Received: from x1.local ([138.117.48.212]) by smtp.gmail.com with ESMTPSA id k126sm3040039qkd.34.2018.04.19.09.47.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 09:47:16 -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=rj2GYQyn/sOuOjA9ca3Q5zopdYgrSee64mEenvGH0/A=; b=Q0puxMHhaub3GaPcwpdxzyRPChVhBRd47rVuI7w9TXg/EEt48nH7byASC3d8aT7S4w IO0TadIe4boiFP0vNrVT0tKsTPyB3W/Q75V0dENZH92ZsrOZ0IqbeQdThdsX+x0HtIo9 59qNmPS0VTmgN7w0CvB1OP7dFQD56b5zsNHMgn1iU/wLWoy28f3e4Vke8hy7FduAW/04 EgnGO7CW2LF9P7QRKeFgAbtJtjeDLiz7VBVby31pjSbhrVtGCOEgMXmox7zz84cFc8eO rK1ZnnA8pE1NIayelKANy10v3GXaCiQpm/Lyo6+456Os8HVb8VCyLIBorGU850GsIeFJ D8Rw== 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=rj2GYQyn/sOuOjA9ca3Q5zopdYgrSee64mEenvGH0/A=; b=o3YD2PVXyVsVCeOT+RSSbqxOFnguF38ADZVCPa7ymVmySV8kb+4b7MPIbTHyjM9Fl6 3XVX+vtcYYz41eSmMRCSiKbkiTSsAe4wUsNgtCRzn4Y7wqzjfUUbRFEr2fPDxEiqkB+G 2ZYkhAU8Z2TKZTPqsg+cgzCDDzAO/iW5z/Wykfj9LJermJN57Aa9xhwo8AplRA+Rsnp2 PE02mGtQs4VC5fhIl3hi67M3+Lvp/bTOIhtxONhOPjzXVwxDf+wsfbwALU9ZwW9dhhXT FMcUakxv/zlOASde2bOcV0Kd2UT1E41puoK1aQ2wOypXWXcgwMGXL4zBH74Ni/2wttKI y8OQ== X-Gm-Message-State: ALQs6tAfveNv/ILkmR/Yc0ikvm/m9WEVSn4AoIWTkzg0YaGXeZrypK9X 5/U0gDvug64IqS7kjw7dt68= X-Google-Smtp-Source: AIpwx49MAYV/7AKLnYAVhteZ4BFQc4HtTieWjtRZiqO0SICUSzBfepMyG2Xp72SsZyjZIDxdVegTfA== X-Received: by 2002:aed:2aa3:: with SMTP id t32-v6mr7139040qtd.33.1524156437352; Thu, 19 Apr 2018 09:47:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Cleber Rosa , Amador Pahim , Stefan Hajnoczi , Zheng Xiang Date: Thu, 19 Apr 2018 13:46:41 -0300 Message-Id: <20180419164642.9536-7-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180419164642.9536-1-f4bug@amsat.org> References: <20180419164642.9536-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: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [RFC PATCH 6/7] avocado: Add a test parsing Linux kernel booting console 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: Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Alistair Francis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson 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 Booting an Alpha DP264 machine. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Richard Henderson --- tests/avocado/test_linux-boot-console.py | 88 +++++++++++++++++++ .../parameters.yaml | 3 + 2 files changed, 91 insertions(+) create mode 100644 tests/avocado/test_linux-boot-console.py create mode 100644 tests/avocado/test_linux-boot-console.py.data/parameter= s.yaml diff --git a/tests/avocado/test_linux-boot-console.py b/tests/avocado/test_= linux-boot-console.py new file mode 100644 index 0000000000..f54d10dd79 --- /dev/null +++ b/tests/avocado/test_linux-boot-console.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +# +# Boot a Linux kernel on the Malta board and check the serial console outp= ut +# +# Copyright (C) 2018 Philippe Mathieu-Daud=C3=A9 +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Run with: +# +# avocado run test_linux-boot-console.py \ +# --mux-yaml test_linux-boot-console.py.data/parameters.yaml +# [--filter-by-tags arch_alpha ...] + +import os +import tempfile +import hashlib +import urllib2 +import gzip +import shutil + +from avocado import skipUnless +from avocado_qemu import test + +# XXX Use a cleaner CacheStorage or avocado.utils.[archive|kernel]? +def cachedfile(url, cachedir=3D'/tmp/mycachedir', gzip_compressed=3DFalse): + if not os.path.isdir(cachedir): + os.mkdir(cachedir) + key =3D hashlib.md5(url).hexdigest() + fbin =3D cachedir + "/" + key + ".bin" + if not os.path.isfile(fbin): + with open(cachedir + "/" + key + ".url", "w") as f: + f.write(url + '\n') + with open(fbin, "wb") as f: + content =3D urllib2.urlopen(url).read() + f.write(content) + if gzip_compressed: + fgz =3D cachedir + "/" + key + ".gz" + shutil.move(fbin, fgz) + with gzip.open(fgz, 'rb') as f_in, open(fbin, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + return fbin + + +class TestAlphaClipperBoot2_6(test.QemuTest): + """ + :avocado: enable + :avocado: tags=3Darch_alpha + """ + ARCH =3D "alpha" + + def kernel_url(self): + return 'http://archive.debian.org/debian/dists/lenny/main/installe= r-alpha/current/images/cdrom/vmlinuz' + + def setUp(self): + self.console_path =3D tempfile.mkstemp()[1] + kernel_path =3D cachedfile(self.kernel_url(), gzip_compressed=3DTr= ue) + self.vm._args.extend(['-machine', 'clipper']) + self.vm._args.extend(['-m', '64']) + self.vm._args.extend(['-kernel', kernel_path]) + self.vm._args.extend(['-append', '"console=3DttyS0 printk.time=3D0= "']) + self.vm._args.extend(['-chardev', 'socket,id=3Dsrm,server,nowait,p= ath=3D' + self.console_path]) + self.vm._args.extend(['-serial', 'chardev:srm']) + # This kernel crashes without VGA display + self.vm._args.extend(['-vga', 'std']) + + def test_boot_console(self): + """ + :avocado: tags=3Duart,printk + """ + # TODO use skipUnless() + if self.params.get('arch') !=3D self.ARCH: + return + + self.vm.launch(self.console_path) + console =3D self.vm.get_console(console_address=3Dself.console_pat= h, login=3DFalse) + # no filesystem provided on purpose, wait for the Kernel panic + bootlog =3D console.read_until_any_line_matches(["Kernel panic - n= ot syncing: VFS: Unable to mount root fs"], timeout=3D30.0)[1] + console.close() + # check Super I/O + self.assertIn(u'ttyS0 at I/O 0x3f8 (irq =3D 4) is a 16550A', bootl= og) + self.assertIn(u'ttyS1 at I/O 0x2f8 (irq =3D 3) is a 16550A', bootl= og) + self.assertIn(u'i8042 KBD port at 0x60,0x64 irq 1', bootlog) + self.assertIn(u'i8042 AUX port at 0x60,0x64 irq 12', bootlog) + self.vm.shutdown() + + def tearDown(self): + os.remove(self.console_path) diff --git a/tests/avocado/test_linux-boot-console.py.data/parameters.yaml = b/tests/avocado/test_linux-boot-console.py.data/parameters.yaml new file mode 100644 index 0000000000..ed8c08058c --- /dev/null +++ b/tests/avocado/test_linux-boot-console.py.data/parameters.yaml @@ -0,0 +1,3 @@ +architecture: !mux + alpha: + arch: alpha --=20 2.17.0