From patchwork Wed Oct 3 18:30:36 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: 978485 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=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QPx06Pscz9s7W for ; Thu, 4 Oct 2018 04:41:08 +1000 (AEST) Received: from localhost ([::1]:51884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7m54-0001Le-HO for incoming@patchwork.ozlabs.org; Wed, 03 Oct 2018 14:41:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7m12-0006nB-Qm for qemu-devel@nongnu.org; Wed, 03 Oct 2018 14:36:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g7lve-0000tE-63 for qemu-devel@nongnu.org; Wed, 03 Oct 2018 14:31:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59112) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g7lvc-0000rH-7L for qemu-devel@nongnu.org; Wed, 03 Oct 2018 14:31:20 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C579308FBA4; Wed, 3 Oct 2018 18:31:15 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-135.brq.redhat.com [10.40.204.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C4DF67158; Wed, 3 Oct 2018 18:31:04 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Cleber Rosa , Eduardo Habkost , Caio Carrara Date: Wed, 3 Oct 2018 20:30:36 +0200 Message-Id: <20181003183036.6716-4-philmd@redhat.com> In-Reply-To: <20181003183036.6716-1-philmd@redhat.com> References: <20181003183036.6716-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 03 Oct 2018 18:31:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH v2 3/3] acceptance tests: Add EDK2 ArmVirtQemu boot and console checking test 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: Ard Biesheuvel , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , qemu-devel@nongnu.org, Laszlo Ersek , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This test boots EDK2 ArmVirtQemu and check the debug console (PL011) reports enough information on the initialized devices. $ avocado run -p qemu_bin=aarch64-softmmu/qemu-system-aarch64 tests/acceptance/boot_firmware.py JOB ID : cb1c5bd9e0312483eabeffbb37885a5273ef23bf JOB LOG : /home/phil/avocado/job-results/job-2018-10-03T19.39-cb1c5bd/job.log (1/1) tests/acceptance/boot_firmware.py:BootFirmware.test_ovmf_virt: PASS (5.02 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 5.30 s Signed-off-by: Philippe Mathieu-Daudé --- The '-p' option requires Avocado >= 65.0 --- tests/acceptance/boot_firmware.py | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/acceptance/boot_firmware.py b/tests/acceptance/boot_firmware.py index 2053b1a4b6..42f0672963 100644 --- a/tests/acceptance/boot_firmware.py +++ b/tests/acceptance/boot_firmware.py @@ -121,3 +121,39 @@ class BootFirmware(Test): debugcon_logger.debug(line.strip()) for exp in expected: self.assertIn(exp + '\r\n', content) + + def test_ovmf_virt(self): + """ + Boots OVMF on the default virt machine, checks the debug console + + :avocado: tags=arch:aarch64 + :avocado: tags=maxtime:20s + """ + image_url = ('http://snapshots.linaro.org/components/kernel/' + 'leg-virt-tianocore-edk2-upstream/latest/' + 'QEMU-AARCH64/DEBUG_GCC5/QEMU_EFI.img.gz') + image_path_gz = self.fetch_asset(image_url) + image_path = os.path.join(self.workdir, 'flash.img') + + # kludge until Avocado support gzip files + import gzip, shutil + with gzip.open(image_path_gz) as gz, open(image_path, 'wb') as img: + shutil.copyfileobj(gz, img) + + serial_path = os.path.join(self.workdir, 'serial.log') + self.vm.set_machine('virt') + self.vm.add_args('-nographic', + '-cpu', 'cortex-a57', + '-m', '1G', # 1GB min to boot fw? + '-drive', 'file=%s,format=raw,if=pflash' % image_path, + '-chardev', 'file,path=%s,id=console' % serial_path, + '-serial', 'chardev:console') + self.vm.launch() + serial_logger = logging.getLogger('serial') + + # serial console checks + if not wait_for(read_console_for_string, timeout=15, step=0, + args=(open(serial_path), + 'Start PXE over IPv4', + serial_logger)): + self.fail("OVMF failed to boot")