From patchwork Thu Apr 19 16:46:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 901404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Q0puxMHh"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RlhB1vRgz9s1w for ; Fri, 20 Apr 2018 03:04:10 +1000 (AEST) Received: from localhost ([::1]:60827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9Cye-0000Hr-9X for incoming@patchwork.ozlabs.org; Thu, 19 Apr 2018 13:04:08 -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) 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: =?utf-8?b?THVrw6HFoSBEb2t0b3I=?= , 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 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_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Booting an Alpha DP264 machine. Signed-off-by: Philippe Mathieu-Daudé 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/parameters.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 output +# +# Copyright (C) 2018 Philippe Mathieu-Daudé +# +# 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='/tmp/mycachedir', gzip_compressed=False): + if not os.path.isdir(cachedir): + os.mkdir(cachedir) + key = hashlib.md5(url).hexdigest() + fbin = 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 = urllib2.urlopen(url).read() + f.write(content) + if gzip_compressed: + fgz = 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=arch_alpha + """ + ARCH = "alpha" + + def kernel_url(self): + return 'http://archive.debian.org/debian/dists/lenny/main/installer-alpha/current/images/cdrom/vmlinuz' + + def setUp(self): + self.console_path = tempfile.mkstemp()[1] + kernel_path = cachedfile(self.kernel_url(), gzip_compressed=True) + 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=ttyS0 printk.time=0"']) + self.vm._args.extend(['-chardev', 'socket,id=srm,server,nowait,path=' + 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=uart,printk + """ + # TODO use skipUnless() + if self.params.get('arch') != self.ARCH: + return + + self.vm.launch(self.console_path) + console = self.vm.get_console(console_address=self.console_path, login=False) + # no filesystem provided on purpose, wait for the Kernel panic + bootlog = console.read_until_any_line_matches(["Kernel panic - not syncing: VFS: Unable to mount root fs"], timeout=30.0)[1] + console.close() + # check Super I/O + self.assertIn(u'ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A', bootlog) + self.assertIn(u'ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A', bootlog) + 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