From nobody Thu Nov 13 14:57:00 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; 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=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581431226254631.2359965385573; Tue, 11 Feb 2020 06:27:06 -0800 (PST) Received: from localhost ([::1]:50512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1WVB-0002eS-Ho for importer@patchew.org; Tue, 11 Feb 2020 09:27:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50384) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1WUB-0001Ne-VJ for qemu-devel@nongnu.org; Tue, 11 Feb 2020 09:26:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1WUA-0002Ra-O9 for qemu-devel@nongnu.org; Tue, 11 Feb 2020 09:25:59 -0500 Received: from relay.sw.ru ([185.231.240.75]:45006) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1WUA-0002QB-Gg for qemu-devel@nongnu.org; Tue, 11 Feb 2020 09:25:58 -0500 Received: from dptest2.qa.sw.ru ([10.94.4.71]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j1WU4-00009Q-D7; Tue, 11 Feb 2020 17:25:52 +0300 From: Denis Plotnikov To: qemu-devel@nongnu.org Subject: [PATCH v1 1/2] tests/acceptance/virtio_check_params: remove excluded machine types carefully Date: Tue, 11 Feb 2020 17:25:50 +0300 Message-Id: <20200211142551.13072-2-dplotnikov@virtuozzo.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20200211142551.13072-1-dplotnikov@virtuozzo.com> References: <20200211142551.13072-1-dplotnikov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 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: cohuck@redhat.com, philmd@redhat.com, wainersm@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Before, the test failed if an excluded machine type was absent in the machi= ne types lists. Signed-off-by: Denis Plotnikov --- tests/acceptance/virtio_check_params.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/vir= tio_check_params.py index 87e6c839d1..deec89bf86 100644 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -40,6 +40,8 @@ VM_DEV_PARAMS =3D {'virtio-scsi-pci': ['-device', 'virtio= -scsi-pci,id=3Dscsi0'], '-drive', 'driver=3Dnull-co,id=3Ddrive0,if=3Dnon= e']} =20 +EXCLUDED_MACHINES =3D ['none', 'isapc', 'microvm'] + =20 class VirtioMaxSegSettingsCheck(Test): @staticmethod @@ -117,6 +119,13 @@ class VirtioMaxSegSettingsCheck(Test): return True return False =20 + @staticmethod + def filter_machines(machines): + for mt in EXCLUDED_MACHINES: + if mt in machines: + machines.remove(mt) + return machines + @skip("break multi-arch CI") def test_machine_types(self): # collect all machine types except 'none', 'isapc', 'microvm' @@ -124,9 +133,8 @@ class VirtioMaxSegSettingsCheck(Test): vm.launch() machines =3D [m['name'] for m in vm.command('query-machines')] vm.shutdown() - machines.remove('none') - machines.remove('isapc') - machines.remove('microvm') + + machines =3D self.filter_machines(machines) =20 for dev_type in DEV_TYPES: # create the list of machine types and their parameters. --=20 2.17.0 From nobody Thu Nov 13 14:57:00 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; 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=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581431225796460.97496519851506; Tue, 11 Feb 2020 06:27:05 -0800 (PST) Received: from localhost ([::1]:50510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1WVA-0002aM-UX for importer@patchew.org; Tue, 11 Feb 2020 09:27:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50388) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1WUC-0001Nf-2U for qemu-devel@nongnu.org; Tue, 11 Feb 2020 09:26:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1WUA-0002Rq-SR for qemu-devel@nongnu.org; Tue, 11 Feb 2020 09:26:00 -0500 Received: from relay.sw.ru ([185.231.240.75]:45002) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1WUA-0002QC-LY for qemu-devel@nongnu.org; Tue, 11 Feb 2020 09:25:58 -0500 Received: from dptest2.qa.sw.ru ([10.94.4.71]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j1WU4-00009Q-IT; Tue, 11 Feb 2020 17:25:52 +0300 From: Denis Plotnikov To: qemu-devel@nongnu.org Subject: [PATCH v1 2/2] tests/acceptance/virtio_check_params: prepare to check different params Date: Tue, 11 Feb 2020 17:25:51 +0300 Message-Id: <20200211142551.13072-3-dplotnikov@virtuozzo.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20200211142551.13072-1-dplotnikov@virtuozzo.com> References: <20200211142551.13072-1-dplotnikov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 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: cohuck@redhat.com, philmd@redhat.com, wainersm@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Denis Plotnikov --- tests/acceptance/virtio_check_params.py | 38 ++++++++++++++----------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/acceptance/virtio_check_params.py b/tests/acceptance/vir= tio_check_params.py index deec89bf86..e578952a97 100644 --- a/tests/acceptance/virtio_check_params.py +++ b/tests/acceptance/virtio_check_params.py @@ -43,7 +43,7 @@ VM_DEV_PARAMS =3D {'virtio-scsi-pci': ['-device', 'virtio= -scsi-pci,id=3Dscsi0'], EXCLUDED_MACHINES =3D ['none', 'isapc', 'microvm'] =20 =20 -class VirtioMaxSegSettingsCheck(Test): +class VirtioParamsCheck(Test): @staticmethod def make_pattern(props): pattern_items =3D ['{0} =3D \w+'.format(prop) for prop in props] @@ -75,12 +75,12 @@ class VirtioMaxSegSettingsCheck(Test): props[p[0]] =3D p[1] return query_ok, props, error =20 - def check_mt(self, mt, dev_type_name): - mt['device'] =3D dev_type_name # Only for the debug() call. + def check_mt(self, mt, expected_vals, dev_type_name): + msg =3D "mt: %s dev: %s" % (mt, dev_type_name) # For debug() call = only. logger =3D logging.getLogger('machine') - logger.debug(mt) + logger.debug(msg) with QEMUMachine(self.qemu_bin) as vm: - vm.set_machine(mt["name"]) + vm.set_machine(mt) vm.add_args('-nodefaults') for s in VM_DEV_PARAMS[dev_type_name]: vm.add_args(s) @@ -92,11 +92,15 @@ class VirtioMaxSegSettingsCheck(Test): error =3D sys.exc_info()[0] =20 if not query_ok: - self.fail('machine type {0}: {1}'.format(mt['name'], error)) + self.fail('machine type {0}: {1}'.format(mt, error)) =20 for prop_name, prop_val in props.items(): - expected_val =3D mt[prop_name] - self.assertEqual(expected_val, prop_val) + expected_val =3D expected_vals[prop_name] + msg =3D 'Property value mismatch for (MT: {0}, '\ + 'property name: {1}): expected value: "{2}" '\ + 'actual value: "{3}"'\ + .format(mt, prop_name, expected_val, prop_val) + self.assertEqual(expected_val, prop_val, msg) =20 @staticmethod def seg_max_adjust_enabled(mt): @@ -128,25 +132,27 @@ class VirtioMaxSegSettingsCheck(Test): =20 @skip("break multi-arch CI") def test_machine_types(self): - # collect all machine types except 'none', 'isapc', 'microvm' + # collect all machine types with QEMUMachine(self.qemu_bin) as vm: vm.launch() machines =3D [m['name'] for m in vm.command('query-machines')] vm.shutdown() =20 + # ..and exclude non-relevant ones machines =3D self.filter_machines(machines) =20 for dev_type in DEV_TYPES: - # create the list of machine types and their parameters. - mtypes =3D list() + # define expected parameters for each machine type + mt_expected_vals =3D dict() for m in machines: if self.seg_max_adjust_enabled(m): enabled =3D 'true' else: enabled =3D 'false' - mtypes.append({'name': m, - DEV_TYPES[dev_type]['seg_max_adjust']: enab= led}) =20 - # test each machine type for a device type - for mt in mtypes: - self.check_mt(mt, dev_type) + mt_expected_vals[m] =3D { + DEV_TYPES[dev_type]['seg_max_adjust']: enabled } + + # test each machine type + for mt in mt_expected_vals: + self.check_mt(mt, mt_expected_vals[mt], dev_type) --=20 2.17.0