From nobody Sat May 4 21:07:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1606312805; cv=none; d=zohomail.com; s=zohoarc; b=fi2yeeGy7UBGJXB3gAVxUr75iq5SfaSuNluLhorQgzVnR0qEHYY27/Hm7RV811ofVSOENsqHJgxixC89juBNDGHYco0YcP6+w+NXWhd6ULFiF09DFBbbaDAOh/hes8TO1u1dwpoRVqLwyVSkPCvHCUlkJNRt6q8n0B03Y5Q3saE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606312805; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=lnrzkWdauGMCBJecHCperF3gbRhY0hklLvH+S/65hlc=; b=cc7M4g5Awdk23P63ne77tGBzq2zL0CiUnkVC+vA2odazoEyTA6YCUqEIu4ucJAdioQK2/IrP2LZQ844lpDdJsPrrfwTxiTXSuxBq365dp4gBFomu0oRXP5pFx4/CAM++v47hmX/bsiyp9LI8aiPwnSwXxxlnKWvoeM9p0wH0/E8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1606312805275530.8533768186286; Wed, 25 Nov 2020 06:00:05 -0800 (PST) Received: from localhost ([::1]:35514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khvL1-0004VV-5W for importer@patchew.org; Wed, 25 Nov 2020 09:00:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khvJZ-0003eU-4i for qemu-devel@nongnu.org; Wed, 25 Nov 2020 08:58:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50033) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1khvJX-0003fW-7h for qemu-devel@nongnu.org; Wed, 25 Nov 2020 08:58:32 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-39-56uXGi0ZMMOBJ9v8Z7ucLQ-1; Wed, 25 Nov 2020 08:58:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D665A87308A; Wed, 25 Nov 2020 13:58:26 +0000 (UTC) Received: from gondolin.redhat.com (ovpn-113-39.ams2.redhat.com [10.36.113.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id F39D160854; Wed, 25 Nov 2020 13:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606312710; 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; bh=lnrzkWdauGMCBJecHCperF3gbRhY0hklLvH+S/65hlc=; b=Iy0eA5Z//3BiWVcWsBLpqYur/Fz35gmLBB07HOgszAGHz2CVMO5vN9KsPr18jJbrpAXLBq /mj1g6I3+TV0/HiS2i040FE82uKypZ0ZRwJoY+vavZ/QzTO3GUnf+RAAkC6cwjNBUK5mEJ Z1xcQhL0ym4NXylVYF7Eh0T74e3YHPk= X-MC-Unique: 56uXGi0ZMMOBJ9v8Z7ucLQ-1 From: Cornelia Huck To: qemu-devel@nongnu.org Subject: [PATCH RFC] tests/acceptance: add a test for devices on s390x Date: Wed, 25 Nov 2020 14:58:20 +0100 Message-Id: <20201125135820.1442611-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Cornelia Huck , Wainer dos Santos Moschetta , qemu-s390x@nongnu.org, Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This adds a very basic test for checking that we present devices in a way that Linux can consume: boot with both virtio-net-ccw and virtio-net-pci attached and then verify that Linux is able to see and detect these devices. Signed-off-by: Cornelia Huck --- A very basic test, but it would have caught the recent zPCI regression. If anyone has a better idea than using early debug shells in the Debian install image, please let me know. At least it's quick, as we can check for the devices quite early in the boot sequence. Not sure if running under both kvm and tcg on an s390 host would add useful extra coverage. Also not sure if this needs fencing on any of the public CIs (have not tried yet). --- tests/acceptance/s390_devices.py | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/acceptance/s390_devices.py diff --git a/tests/acceptance/s390_devices.py b/tests/acceptance/s390_devic= es.py new file mode 100644 index 000000000000..6ce47061f35d --- /dev/null +++ b/tests/acceptance/s390_devices.py @@ -0,0 +1,68 @@ +# Functional test that boots an s390x Linux guest with ccw and PCI devices +# attached and checks whether the devices are recognized by Linux +# +# Copyright (c) 2020 Red Hat, Inc. +# +# Author: +# Cornelia Huck +# +# 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 + +from avocado_qemu import Test +from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import wait_for_console_pattern + +class CheckS390xDevices(Test): + KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' + + def wait_for_console_pattern(self, success_message, vm=3DNone): + wait_for_console_pattern(self, success_message, + failure_message=3D'Kernel panic - not syn= cing', + vm=3Dvm) + + timeout =3D 60 + + def test(self): + + """ + :avocado: tags=3Darch:s390x + :avocado: tags=3Dmachine:s390-ccw-virtio + """ + + # XXX: switch to https when debian fixes their certificate + kernel_url =3D ('http://archive.debian.org/debian/dists/jessie/mai= n' + '/installer-s390x/current/images/generic/kernel.debi= an') + kernel_hash =3D '5af1aa839754f4d8817fb5878b4d55dfc887f45d' + kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + + initrd_url =3D ('http://archive.debian.org/debian/dists/jessie/mai= n' + '/installer-s390x/current/images/generic/initrd.debi= an') + initrd_hash =3D '99252b28306184b876f979585e2d4bfe96b27464' + initrd_path =3D self.fetch_asset(initrd_url, asset_hash=3Dinitrd_h= ash) + + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3Dsclp0 root=3D/dev/ram0 BOOT_DEBUG= =3D3') + self.vm.add_args('-nographic', + '-kernel', kernel_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-device', 'virtio-net-ccw,devno=3Dfe.1.1111', + '-device', 'virtio-net-pci') + self.vm.launch() + + shell_ready =3D "sh: can't access tty; job control turned off" + self.wait_for_console_pattern(shell_ready) + # first debug shell is too early, we need to wait for device detec= tion + exec_command_and_wait_for_pattern(self, 'exit', shell_ready) + + ccw_bus_id=3D"0.1.1111" + pci_bus_id=3D"0000:00:00.0" + exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', + ccw_bus_id) + exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', + pci_bus_id) --=20 2.26.2