From nobody Wed May 1 23:58:23 2024 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 1513201106060486.16055825572994; Wed, 13 Dec 2017 13:38:26 -0800 (PST) Received: from localhost ([::1]:37825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEjP-000202-6L for importer@patchew.org; Wed, 13 Dec 2017 16:38:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEhK-0000hS-QX for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePEhI-0001r3-53 for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:14 -0500 Received: from mail-qt0-x22c.google.com ([2607:f8b0:400d:c0d::22c]:43336) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePEhH-0001qQ-V4; Wed, 13 Dec 2017 16:36:12 -0500 Received: by mail-qt0-x22c.google.com with SMTP id w10so5524588qtb.10; Wed, 13 Dec 2017 13:36:11 -0800 (PST) Received: from x1.local ([138.117.48.211]) by smtp.gmail.com with ESMTPSA id x23sm1617150qkb.4.2017.12.13.13.36.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 13:36:10 -0800 (PST) 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=bRV17PTwz5nhCgGGgF0OMCNZNqgXHjf9AN1x7rWCxbc=; b=mL5OpZ70xpWcN/Rtu3bXK/pO4GVJ1wiPvIRz3Ui63FevSg8761xs6eFAOe4tsaSj7m b3El564AET5bBoalmV+gzlwVa7kUiZ+F7riBYuLDVjY6T781QUntTrVQzaHCzhBeAukJ lgh/LbL1rSJSb+9TJwQt9nPPmk6IJ3qB8JumLPS+ZRFEubiOcm0i0SJXYqHj9uAPFh7F IDdIKGyWfhqZIY3zYZQziq13HYFHa2bx20s2Zvq/ibLOOnpoVND4BFp9GqkgWZwj+BiM VkvD2a6bLa/E1MnnwBf8a44ah2oJI7Hxj/ehb1mafAAcfyPUDUJil57zO0h74D4FuvQX 1A/w== 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=bRV17PTwz5nhCgGGgF0OMCNZNqgXHjf9AN1x7rWCxbc=; b=FG/fKtWR9RLrR2cisCD50Wn4Lir0tYe4328TWsO91P660WA5j0X5d2tVF8jiXe0NLG i8j3TbR5bMZ4uSNbTSLJoYdRvrR68TYrvkVaOfhLdK2/RTEgyB79P+NQhJbBDcJ/b909 Ie+SoF0PUcOMLsy9w+ay9FivSUqD9dn+eh7gKigutN+nkUx8UNNDAre78qTNSL+TSSMA v3GFEHX58fHUUcXAHSH0+dqFNIKLVfOboraPWaDQkya5RA9UxRi0Bkiv3pncxFxBwRZc kudgYdgh2ZHdZrU3AO/hmtc5u12k/mVr+hpyO4aKrU9aUIY2lcE2HSGZMa5NvTR1ir6j A9qA== X-Gm-Message-State: AKGB3mJO83DLJca7d+wv6bfCFGDG1RbONT4b1FnX+zwgd2GPRloynHS+ hjBjQ/1sSEzZrKVg2Wba/Po= X-Google-Smtp-Source: ACJfBot+cOe+VjpAjvmhwEHCPNeMu5St8Mz9oENN7oZC97bESFEdboywQ/mMkAXCszYyvzO1cr/bJA== X-Received: by 10.200.2.160 with SMTP id p32mr13095807qtg.172.1513200971128; Wed, 13 Dec 2017 13:36:11 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Cleber Rosa , Kevin Wolf , Max Reitz , John Snow , Eduardo Habkost , =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , "Daniel P . Berrange" , Eric Blake , Stefan Hajnoczi , Fam Zheng Date: Wed, 13 Dec 2017 18:35:52 -0300 Message-Id: <20171213213557.26561-2-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213213557.26561-1-f4bug@amsat.org> References: <20171213213557.26561-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::22c Subject: [Qemu-devel] [PATCH 1/6] iotests.py: split BlockQMPTestCase class of QMPTestCase 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org 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 Add a new class BlockQMPTestCase based on QMPTestCase, which only contains = the block methods. This will allow to reuse the generic methods in the next pat= ch. Patch created mostly mechanically. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/qemu-iotests/iotests.py | 4 ++++ tests/qemu-iotests/030 | 14 +++++++------- tests/qemu-iotests/040 | 2 +- tests/qemu-iotests/041 | 20 ++++++++++---------- tests/qemu-iotests/044 | 2 +- tests/qemu-iotests/045 | 4 ++-- tests/qemu-iotests/055 | 8 ++++---- tests/qemu-iotests/056 | 4 ++-- tests/qemu-iotests/057 | 2 +- tests/qemu-iotests/065 | 2 +- tests/qemu-iotests/093 | 6 +++--- tests/qemu-iotests/096 | 2 +- tests/qemu-iotests/118 | 2 +- tests/qemu-iotests/124 | 2 +- tests/qemu-iotests/129 | 2 +- tests/qemu-iotests/132 | 2 +- tests/qemu-iotests/136 | 2 +- tests/qemu-iotests/139 | 2 +- tests/qemu-iotests/147 | 2 +- tests/qemu-iotests/148 | 2 +- tests/qemu-iotests/152 | 2 +- tests/qemu-iotests/155 | 2 +- tests/qemu-iotests/163 | 2 +- tests/qemu-iotests/165 | 2 +- tests/qemu-iotests/196 | 2 +- 25 files changed, 50 insertions(+), 46 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 457984b8e9..2bb96d5ea9 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -27,7 +27,7 @@ backing_img =3D os.path.join(iotests.test_dir, 'backing.i= mg') mid_img =3D os.path.join(iotests.test_dir, 'mid.img') test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 -class TestSingleDrive(iotests.QMPTestCase): +class TestSingleDrive(iotests.BlockQMPTestCase): image_len =3D 1 * 1024 * 1024 # MB =20 def setUp(self): @@ -153,7 +153,7 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') =20 =20 -class TestParallelOps(iotests.QMPTestCase): +class TestParallelOps(iotests.BlockQMPTestCase): num_ops =3D 4 # Number of parallel block-stream operations num_imgs =3D num_ops * 2 + 1 image_len =3D num_ops * 1024 * 1024 @@ -385,7 +385,7 @@ class TestParallelOps(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', self.i= mgs[3]), 'image file map matches backing file after stream= ing') =20 -class TestQuorum(iotests.QMPTestCase): +class TestQuorum(iotests.BlockQMPTestCase): num_children =3D 3 children =3D [] backing =3D [] @@ -441,7 +441,7 @@ class TestQuorum(iotests.QMPTestCase): qemu_io('-f', iotests.imgfmt, '-c', 'map', self.b= acking[0]), 'image file map does not match backing file after= streaming') =20 -class TestSmallerBackingFile(iotests.QMPTestCase): +class TestSmallerBackingFile(iotests.BlockQMPTestCase): backing_len =3D 1 * 1024 * 1024 # MB image_len =3D 2 * backing_len =20 @@ -464,7 +464,7 @@ class TestSmallerBackingFile(iotests.QMPTestCase): self.assert_no_active_block_jobs() self.vm.shutdown() =20 -class TestErrors(iotests.QMPTestCase): +class TestErrors(iotests.BlockQMPTestCase): image_len =3D 2 * 1024 * 1024 # MB =20 # this should match STREAM_BUFFER_SIZE/512 in block/stream.c @@ -694,7 +694,7 @@ class TestENOSPC(TestErrors): self.assert_no_active_block_jobs() self.vm.shutdown() =20 -class TestStreamStop(iotests.QMPTestCase): +class TestStreamStop(iotests.BlockQMPTestCase): image_len =3D 8 * 1024 * 1024 * 1024 # GB =20 def setUp(self): @@ -723,7 +723,7 @@ class TestStreamStop(iotests.QMPTestCase): =20 self.cancel_and_wait(resume=3DTrue) =20 -class TestSetSpeed(iotests.QMPTestCase): +class TestSetSpeed(iotests.BlockQMPTestCase): image_len =3D 80 * 1024 * 1024 # MB =20 def setUp(self): diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index 90b5b4f2ad..1da0e7afec 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -32,7 +32,7 @@ backing_img =3D os.path.join(iotests.test_dir, 'backing.i= mg') mid_img =3D os.path.join(iotests.test_dir, 'mid.img') test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 -class ImageCommitTestCase(iotests.QMPTestCase): +class ImageCommitTestCase(iotests.BlockQMPTestCase): '''Abstract base class for image commit test cases''' =20 def wait_for_complete(self, need_ready=3DFalse): diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index a860a31e9a..e7ff6d4ea1 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -34,7 +34,7 @@ quorum_img3 =3D os.path.join(iotests.test_dir, 'quorum3.i= mg') quorum_repair_img =3D os.path.join(iotests.test_dir, 'quorum_repair.img') quorum_snapshot_file =3D os.path.join(iotests.test_dir, 'quorum_snapshot.i= mg') =20 -class TestSingleDrive(iotests.QMPTestCase): +class TestSingleDrive(iotests.BlockQMPTestCase): image_len =3D 1 * 1024 * 1024 # MB qmp_cmd =3D 'drive-mirror' qmp_target =3D target_img @@ -254,7 +254,7 @@ class TestSingleDriveUnalignedLength(TestSingleDrive): class TestSingleBlockdevUnalignedLength(TestSingleBlockdev): image_len =3D 1025 * 1024 =20 -class TestMirrorNoBacking(iotests.QMPTestCase): +class TestMirrorNoBacking(iotests.BlockQMPTestCase): image_len =3D 2 * 1024 * 1024 # MB =20 def setUp(self): @@ -323,7 +323,7 @@ class TestMirrorNoBacking(iotests.QMPTestCase): self.assertTrue(iotests.compare_images(test_img, target_img), 'target image does not match source after mirrorin= g') =20 -class TestMirrorResized(iotests.QMPTestCase): +class TestMirrorResized(iotests.BlockQMPTestCase): backing_len =3D 1 * 1024 * 1024 # MB image_len =3D 2 * 1024 * 1024 # MB =20 @@ -371,7 +371,7 @@ class TestMirrorResized(iotests.QMPTestCase): self.assertTrue(iotests.compare_images(test_img, target_img), 'target image does not match source after mirrorin= g') =20 -class TestReadErrors(iotests.QMPTestCase): +class TestReadErrors(iotests.BlockQMPTestCase): image_len =3D 2 * 1024 * 1024 # MB =20 # this should be a multiple of twice the default granularity @@ -526,7 +526,7 @@ new_state =3D "1" self.assert_no_active_block_jobs() self.vm.shutdown() =20 -class TestWriteErrors(iotests.QMPTestCase): +class TestWriteErrors(iotests.BlockQMPTestCase): image_len =3D 2 * 1024 * 1024 # MB =20 # this should be a multiple of twice the default granularity @@ -653,7 +653,7 @@ new_state =3D "1" self.assert_no_active_block_jobs() self.vm.shutdown() =20 -class TestSetSpeed(iotests.QMPTestCase): +class TestSetSpeed(iotests.BlockQMPTestCase): image_len =3D 80 * 1024 * 1024 # MB =20 def setUp(self): @@ -719,7 +719,7 @@ class TestSetSpeed(iotests.QMPTestCase): =20 self.wait_ready_and_cancel() =20 -class TestUnbackedSource(iotests.QMPTestCase): +class TestUnbackedSource(iotests.BlockQMPTestCase): image_len =3D 2 * 1024 * 1024 # MB =20 def setUp(self): @@ -760,7 +760,7 @@ class TestUnbackedSource(iotests.QMPTestCase): self.complete_and_wait() self.assert_no_active_block_jobs() =20 -class TestGranularity(iotests.QMPTestCase): +class TestGranularity(iotests.BlockQMPTestCase): image_len =3D 10 * 1024 * 1024 # MB =20 def setUp(self): @@ -790,7 +790,7 @@ class TestGranularity(iotests.QMPTestCase): self.complete_and_wait(drive=3D'drive0', wait_ready=3DFalse) self.assert_no_active_block_jobs() =20 -class TestRepairQuorum(iotests.QMPTestCase): +class TestRepairQuorum(iotests.BlockQMPTestCase): """ This class test quorum file repair using drive-mirror. It's mostly a fork of TestSingleDrive """ image_len =3D 1 * 1024 * 1024 # MB @@ -1002,7 +1002,7 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 # Test mirroring with a source that does not have any parents (not even a # BlockBackend) -class TestOrphanedSource(iotests.QMPTestCase): +class TestOrphanedSource(iotests.BlockQMPTestCase): def setUp(self): blk0 =3D { 'node-name': 'src', 'driver': 'null-co' } diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044 index 11ea0f4d35..4237d5187a 100755 --- a/tests/qemu-iotests/044 +++ b/tests/qemu-iotests/044 @@ -29,7 +29,7 @@ import subprocess =20 test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 -class TestRefcountTableGrowth(iotests.QMPTestCase): +class TestRefcountTableGrowth(iotests.BlockQMPTestCase): '''Abstract base class for image mirroring test cases''' =20 def preallocate(self, name): diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index 6be8fc4912..c1f813b2cc 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -28,7 +28,7 @@ image2 =3D os.path.join(iotests.test_dir, 'image2') image3 =3D os.path.join(iotests.test_dir, 'image3') image4 =3D os.path.join(iotests.test_dir, 'image4') =20 -class TestFdSets(iotests.QMPTestCase): +class TestFdSets(iotests.BlockQMPTestCase): =20 def setUp(self): self.vm =3D iotests.VM() @@ -126,7 +126,7 @@ class TestFdSets(iotests.QMPTestCase): self.vm.shutdown() =20 # Add fd at runtime, there are two ways: monitor related or fdset related -class TestSCMFd(iotests.QMPTestCase): +class TestSCMFd(iotests.BlockQMPTestCase): def setUp(self): self.vm =3D iotests.VM() qemu_img('create', '-f', iotests.imgfmt, image0, '128K') diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index 8a5d9fd269..935c1e60a3 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -44,7 +44,7 @@ def tearDownModule(): os.remove(test_img) =20 =20 -class TestSingleDrive(iotests.QMPTestCase): +class TestSingleDrive(iotests.BlockQMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) =20 @@ -163,7 +163,7 @@ class TestSingleDrive(iotests.QMPTestCase): target=3D'drive0', sync=3D'full') self.assert_qmp(result, 'error/class', 'GenericError') =20 -class TestSetSpeed(iotests.QMPTestCase): +class TestSetSpeed(iotests.BlockQMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) =20 @@ -249,7 +249,7 @@ class TestSetSpeed(iotests.QMPTestCase): =20 # Note: We cannot use pause_drive() here, or the transaction command # would stall. Instead, we limit the block job speed here. -class TestSingleTransaction(iotests.QMPTestCase): +class TestSingleTransaction(iotests.BlockQMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) =20 @@ -453,7 +453,7 @@ class TestSingleTransaction(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 =20 -class TestDriveCompression(iotests.QMPTestCase): +class TestDriveCompression(iotests.BlockQMPTestCase): image_len =3D 64 * 1024 * 1024 # MB fmt_supports_compression =3D [{'type': 'qcow2', 'args': ()}, {'type': 'vmdk', 'args': ('-o', 'subformat= =3DstreamOptimized')}] diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index 04f2c3c841..dedebf1a66 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -29,7 +29,7 @@ backing_img =3D os.path.join(iotests.test_dir, 'backing.i= mg') test_img =3D os.path.join(iotests.test_dir, 'test.img') target_img =3D os.path.join(iotests.test_dir, 'target.img') =20 -class TestSyncModesNoneAndTop(iotests.QMPTestCase): +class TestSyncModesNoneAndTop(iotests.BlockQMPTestCase): image_len =3D 64 * 1024 * 1024 # MB =20 def setUp(self): @@ -82,7 +82,7 @@ class TestSyncModesNoneAndTop(iotests.QMPTestCase): time.sleep(1) self.assertEqual(-1, qemu_io('-c', 'read -P0x41 0 512', target_img= ).find("verification failed")) =20 -class TestBeforeWriteNotifier(iotests.QMPTestCase): +class TestBeforeWriteNotifier(iotests.BlockQMPTestCase): def setUp(self): self.vm =3D iotests.VM().add_drive_raw("file=3Dblkdebug::null-co:/= /,id=3Ddrive0,align=3D65536,driver=3Dblkdebug") self.vm.launch() diff --git a/tests/qemu-iotests/057 b/tests/qemu-iotests/057 index 9f0a5a3057..092fff8ed2 100755 --- a/tests/qemu-iotests/057 +++ b/tests/qemu-iotests/057 @@ -27,7 +27,7 @@ from iotests import qemu_img, qemu_io =20 test_drv_base_name =3D 'drive' =20 -class ImageSnapshotTestCase(iotests.QMPTestCase): +class ImageSnapshotTestCase(iotests.BlockQMPTestCase): image_len =3D 120 * 1024 * 1024 # MB =20 def __init__(self, *args): diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 index 72aa9707c7..a30f117a2e 100755 --- a/tests/qemu-iotests/065 +++ b/tests/qemu-iotests/065 @@ -28,7 +28,7 @@ import unittest =20 test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 -class TestImageInfoSpecific(iotests.QMPTestCase): +class TestImageInfoSpecific(iotests.BlockQMPTestCase): '''Abstract base class for ImageInfoSpecific tests''' =20 def setUp(self): diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 5c36a5fb4d..c8bca994ba 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -23,7 +23,7 @@ import iotests =20 nsec_per_sec =3D 1000000000 =20 -class ThrottleTestCase(iotests.QMPTestCase): +class ThrottleTestCase(iotests.BlockQMPTestCase): test_img =3D "null-aio://" max_drives =3D 3 =20 @@ -211,7 +211,7 @@ class ThrottleTestCase(iotests.QMPTestCase): class ThrottleTestCoroutine(ThrottleTestCase): test_img =3D "null-co://" =20 -class ThrottleTestGroupNames(iotests.QMPTestCase): +class ThrottleTestGroupNames(iotests.BlockQMPTestCase): test_img =3D "null-aio://" max_drives =3D 3 =20 @@ -308,7 +308,7 @@ class ThrottleTestGroupNames(iotests.QMPTestCase): groupname =3D "group%d" % i self.verify_name(devname, groupname) =20 -class ThrottleTestRemovableMedia(iotests.QMPTestCase): +class ThrottleTestRemovableMedia(iotests.BlockQMPTestCase): def setUp(self): self.vm =3D iotests.VM() if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': diff --git a/tests/qemu-iotests/096 b/tests/qemu-iotests/096 index aeeb3753cf..21368455e5 100644 --- a/tests/qemu-iotests/096 +++ b/tests/qemu-iotests/096 @@ -22,7 +22,7 @@ import iotests import os =20 -class TestLiveSnapshot(iotests.QMPTestCase): +class TestLiveSnapshot(iotests.BlockQMPTestCase): base_img =3D os.path.join(iotests.test_dir, 'base.img') target_img =3D os.path.join(iotests.test_dir, 'target.img') group =3D 'mygroup' diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index 8a9e838c90..5fccfd6bff 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -28,7 +28,7 @@ from iotests import qemu_img old_img =3D os.path.join(iotests.test_dir, 'test0.img') new_img =3D os.path.join(iotests.test_dir, 'test1.img') =20 -class ChangeBaseClass(iotests.QMPTestCase): +class ChangeBaseClass(iotests.BlockQMPTestCase): has_opened =3D False has_closed =3D False =20 diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 8e76e62f93..94a04caa51 100644 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -91,7 +91,7 @@ class Bitmap: try_remove(image) =20 =20 -class TestIncrementalBackupBase(iotests.QMPTestCase): +class TestIncrementalBackupBase(iotests.BlockQMPTestCase): def __init__(self, *args): super(TestIncrementalBackupBase, self).__init__(*args) self.bitmaps =3D list() diff --git a/tests/qemu-iotests/129 b/tests/qemu-iotests/129 index 9e87e1c8d9..4201094bc1 100644 --- a/tests/qemu-iotests/129 +++ b/tests/qemu-iotests/129 @@ -22,7 +22,7 @@ import os import iotests import time =20 -class TestStopWithBlockJob(iotests.QMPTestCase): +class TestStopWithBlockJob(iotests.BlockQMPTestCase): test_img =3D os.path.join(iotests.test_dir, 'test.img') target_img =3D os.path.join(iotests.test_dir, 'target.img') base_img =3D os.path.join(iotests.test_dir, 'base.img') diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index f53ef6e391..ec18274424 100644 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -26,7 +26,7 @@ from iotests import qemu_img, qemu_io test_img =3D os.path.join(iotests.test_dir, 'test.img') target_img =3D os.path.join(iotests.test_dir, 'target.img') =20 -class TestSingleDrive(iotests.QMPTestCase): +class TestSingleDrive(iotests.BlockQMPTestCase): image_len =3D 2 * 1024 * 1024 # MB =20 def setUp(self): diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136 index 88b97ea7c6..76ce358ea6 100644 --- a/tests/qemu-iotests/136 +++ b/tests/qemu-iotests/136 @@ -29,7 +29,7 @@ bad_sector =3D 8192 bad_offset =3D bad_sector * 512 blkdebug_file =3D os.path.join(iotests.test_dir, 'blkdebug.conf') =20 -class BlockDeviceStatsTestCase(iotests.QMPTestCase): +class BlockDeviceStatsTestCase(iotests.BlockQMPTestCase): test_img =3D "null-aio://" total_rd_bytes =3D 0 total_rd_ops =3D 0 diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index f8f02808a9..57457a8eab 100644 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -30,7 +30,7 @@ if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': else: default_virtio_blk =3D 'virtio-blk-pci' =20 -class TestBlockdevDel(iotests.QMPTestCase): +class TestBlockdevDel(iotests.BlockQMPTestCase): =20 def setUp(self): iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M') diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 90f40ed245..03603ca0ea 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -37,7 +37,7 @@ def flatten_sock_addr(crumpled_address): return result =20 =20 -class NBDBlockdevAddBase(iotests.QMPTestCase): +class NBDBlockdevAddBase(iotests.BlockQMPTestCase): def blockdev_add_options(self, address, export=3DNone): options =3D { 'node-name': 'nbd-blockdev', 'driver': 'raw', diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index e01b061fe7..1b1153e4d8 100644 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -34,7 +34,7 @@ event_rate =3D 1000000000 sector_size =3D 512 offset =3D 10 =20 -class TestQuorumEvents(iotests.QMPTestCase): +class TestQuorumEvents(iotests.BlockQMPTestCase): read_pattern =3D 'quorum' =20 def create_blkdebug_file(self, blkdebug_file, bad_sector): diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index fec546d033..f949a9a5cf 100644 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -25,7 +25,7 @@ from iotests import qemu_img test_img =3D os.path.join(iotests.test_dir, 'test.img') target_img =3D os.path.join(iotests.test_dir, 'target.img') =20 -class TestUnaligned(iotests.QMPTestCase): +class TestUnaligned(iotests.BlockQMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, test_img, '512') self.vm =3D iotests.VM().add_drive(test_img) diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155 index 0b86ea4e5c..5314205b72 100755 --- a/tests/qemu-iotests/155 +++ b/tests/qemu-iotests/155 @@ -46,7 +46,7 @@ target_img =3D os.path.join(iotests.test_dir, 'target.' += iotests.imgfmt) # target_blockdev_backing is not None # (None: same as target_backing) =20 -class BaseClass(iotests.QMPTestCase): +class BaseClass(iotests.BlockQMPTestCase): target_blockdev_backing =3D None target_real_backing =3D None =20 diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163 index 403842354e..b2ca3fa7d8 100644 --- a/tests/qemu-iotests/163 +++ b/tests/qemu-iotests/163 @@ -28,7 +28,7 @@ def size_to_int(str): suff =3D ['B', 'K', 'M', 'G', 'T'] return int(str[:-1]) * 1024**suff.index(str[-1:]) =20 -class ShrinkBaseClass(iotests.QMPTestCase): +class ShrinkBaseClass(iotests.BlockQMPTestCase): image_len =3D '128M' shrink_size =3D '10M' chunk_size =3D '16M' diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index a3932db3de..31b4e3e562 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -33,7 +33,7 @@ regions1 =3D ((0x0fff00, 0x10000), regions2 =3D ((0x10000000, 0x20000), (0x3fff0000, 0x10000)) =20 -class TestPersistentDirtyBitmap(iotests.QMPTestCase): +class TestPersistentDirtyBitmap(iotests.BlockQMPTestCase): =20 def setUp(self): qemu_img('create', '-f', iotests.imgfmt, disk, str(disk_size)) diff --git a/tests/qemu-iotests/196 b/tests/qemu-iotests/196 index 4116ebc92b..9c06095ac4 100755 --- a/tests/qemu-iotests/196 +++ b/tests/qemu-iotests/196 @@ -26,7 +26,7 @@ from iotests import qemu_img disk =3D os.path.join(iotests.test_dir, 'disk') migfile =3D os.path.join(iotests.test_dir, 'migfile') =20 -class TestInvalidateAutoclear(iotests.QMPTestCase): +class TestInvalidateAutoclear(iotests.BlockQMPTestCase): =20 def tearDown(self): self.vm_a.shutdown() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6f057904a9..e1f892c46f 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -315,6 +315,10 @@ class QMPTestCase(unittest.TestCase): result =3D self.dictpath(d, path) self.assertEqual(result, value, 'values not equal "%s" and "%s"' %= (str(result), str(value))) =20 + +class BlockQMPTestCase(QMPTestCase): + '''Abstract base class for Block QMP test cases''' + def assert_no_active_block_jobs(self): result =3D self.vm.qmp('query-block-jobs') self.assert_qmp(result, 'return', []) --=20 2.15.1 From nobody Wed May 1 23:58:23 2024 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 1513201225633929.9646755590696; Wed, 13 Dec 2017 13:40:25 -0800 (PST) Received: from localhost ([::1]:37834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePElM-0003Qs-P2 for importer@patchew.org; Wed, 13 Dec 2017 16:40:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEhO-0000kd-CW for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePEhM-0001v4-M1 for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:18 -0500 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:41295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePEhM-0001uW-HS; Wed, 13 Dec 2017 16:36:16 -0500 Received: by mail-qk0-x243.google.com with SMTP id 84so3854419qks.8; Wed, 13 Dec 2017 13:36:16 -0800 (PST) Received: from x1.local ([138.117.48.211]) by smtp.gmail.com with ESMTPSA id x23sm1617150qkb.4.2017.12.13.13.36.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 13:36:15 -0800 (PST) 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=allox2FpyNo2+7AkKJmML6CYvVV3Z6vh4X5/imb16bs=; b=hYkisTfZFH5sMG4KSjSeA0Wgcu+bnx13NegfJ6BtEh4dk81NtcoBcHHXi5SxI6LbT1 pVnl7A2y5e//PSQInotOt02UXwn0/Ww3P4BHeGLvnMStip3mwuxg8lJd7+uEVuHeQG5H Ic1o/MMuyXsNXuRIO3qoBmAaIOTHcG8TVdXtNG+OqqH8QtadvUhniuT219npDGCnXJ7n kpON3CuU1yjQxSgdpxfGs5QzAXNdX47c9TPgkDpAvMMtrckW6gQuWaWin6mgolajpvXA 8KKd132ijhWU6iem7Ihqw1LbMX5y4OR00nEHWVO6h7/vTrPQ0ktRTEJ7u0Z2LC2qQFPU NOzg== 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=allox2FpyNo2+7AkKJmML6CYvVV3Z6vh4X5/imb16bs=; b=Eq1yAer96t/aaZ1TX7YZD/HyNlI+0T8aGVYitoc3S7DhTSgtl6vz5L4Umoe/9Wy8DV OIYcqhEGVjmuAyIa6dCOp2RgU23wGJ2natyoMGcwjJHC3zfmaJe4HmveB4rsZvID2gkw VtMJC1fqC2NGikqEfWvMEwW6Np+2Jlc7WKbTd1541CXeQNw65p8TvmvdeFsWddmxbhx6 sCHho3yztizJmsqOH7nb7wT6mN0pr2gTfbumNYNPzmVh+95SiMfoH+Oq4k+fQfVwqLAB 14EEw1PKrjZ+z9ZYCBzFgOUVUnJiOANXPy7rsd4QXRZPJZh4azkzjGe+XO2nYiDjbr2a MJMQ== X-Gm-Message-State: AKGB3mKhyois4T8m6987sZF3tv3dabGYmdwhxm8na6LHnCAgMJhWCIMQ 63s3eIHuv/3UNQ68IcW/6sM= X-Google-Smtp-Source: ACJfBouaq/MpZMH414MXkDF8g7C/jLzGtdXOMLmfcUiodMr2ugE8QDNkJNnurLY1ztrZg7FW1yCtfA== X-Received: by 10.233.244.73 with SMTP id z9mr13384287qkl.300.1513200975901; Wed, 13 Dec 2017 13:36:15 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Cleber Rosa , Kevin Wolf , Max Reitz , John Snow , Eduardo Habkost , =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , "Daniel P . Berrange" , Eric Blake , Stefan Hajnoczi , Fam Zheng Date: Wed, 13 Dec 2017 18:35:53 -0300 Message-Id: <20171213213557.26561-3-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213213557.26561-1-f4bug@amsat.org> References: <20171213213557.26561-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:c09::243 Subject: [Qemu-devel] [PATCH 2/6] iotests.py: move the generic QMPTestCase to qtest.py 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org 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 All those methods are generic and can be reused. Add a few 'from qtest import ...' to keep the patch short. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- scripts/qtest.py | 102 ++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/iotests.py | 86 +++-------------------------------- 2 files changed, 107 insertions(+), 81 deletions(-) diff --git a/scripts/qtest.py b/scripts/qtest.py index df0daf26ca..78db8d02c0 100644 --- a/scripts/qtest.py +++ b/scripts/qtest.py @@ -12,10 +12,33 @@ # =20 import socket +import sys import os import qemu +import re +import unittest +import logging =20 =20 +qemu_prog =3D os.environ.get('QEMU_PROG', 'qemu') +qemu_opts =3D os.environ.get('QEMU_OPTIONS', '').strip().split(' ') + +test_dir =3D os.environ.get('TEST_DIR') +output_dir =3D os.environ.get('OUTPUT_DIR', '.') +qemu_default_machine =3D os.environ.get('QEMU_DEFAULT_MACHINE') + +socket_scm_helper =3D os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_help= er') +debug =3D False + + +def filter_qmp_event(event): + '''Filter a QMP event dict''' + event =3D dict(event) + if 'timestamp' in event: + event['timestamp']['seconds'] =3D 'SECS' + event['timestamp']['microseconds'] =3D 'USECS' + return event + class QEMUQtestProtocol(object): def __init__(self, address, server=3DFalse): """ @@ -107,3 +130,82 @@ class QEMUQtestMachine(qemu.QEMUMachine): def qtest(self, cmd): '''Send a qtest command to guest''' return self._qtest.cmd(cmd) + + +def createQtestMachine(path_suffix=3D''): + name =3D "qemu%s-%d" % (path_suffix, os.getpid()) + return QEMUQtestMachine(qemu_prog, qemu_opts, name=3Dname, + test_dir=3Dtest_dir, + socket_scm_helper=3Dsocket_scm_helper) + +class QMPTestCase(unittest.TestCase): + '''Abstract base class for QMP test cases''' + + index_re =3D re.compile(r'([^\[]+)\[([^\]]+)\]') + + def dictpath(self, d, path): + '''Traverse a path in a nested dict''' + for component in path.split('/'): + m =3D QMPTestCase.index_re.match(component) + if m: + component, idx =3D m.groups() + idx =3D int(idx) + + if not isinstance(d, dict) or component not in d: + self.fail('failed path traversal for "%s" in "%s"' % (path, + str(= d))) + d =3D d[component] + + if m: + if not isinstance(d, list): + self.fail(('path component "%s" in "%s" is not a list = ' + + 'in "%s"') % (component, path, str(d))) + try: + d =3D d[idx] + except IndexError: + self.fail(('invalid index "%s" in path "%s" ' + + 'in "%s"') % (idx, path, str(d))) + return d + + def flatten_qmp_object(self, obj, output=3DNone, basestr=3D''): + if output is None: + output =3D dict() + if isinstance(obj, list): + for i in range(len(obj)): + self.flatten_qmp_object(obj[i], output, basestr + str(i) += '.') + elif isinstance(obj, dict): + for key in obj: + self.flatten_qmp_object(obj[key], output, basestr + key + = '.') + else: + output[basestr[:-1]] =3D obj # Strip trailing '.' + return output + + def qmp_to_opts(self, obj): + obj =3D self.flatten_qmp_object(obj) + output_list =3D list() + for key in obj: + output_list +=3D [key + '=3D' + obj[key]] + return ','.join(output_list) + + def assert_qmp_absent(self, d, path): + try: + result =3D self.dictpath(d, path) + except AssertionError: + return + self.fail('path "%s" has value "%s"' % (path, str(result))) + + def assert_qmp(self, d, path, value): + '''Assert that the value for a specific path in a QMP dict matches= ''' + result =3D self.dictpath(d, path) + self.assertEqual(result, value, ('values not equal "%s" ' + + 'and "%s"') % (str(result), str(value))) + + +def notrun(reason): + '''Skip this test suite''' + print '%s not run: %s' % (seq, reason) + sys.exit(0) + +def verify_platform(supported_oses=3D['linux']): + if True not in [sys.platform.startswith(x) for x in supported_oses]: + notrun('not suitable for this OS: %s' % sys.platform) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index e1f892c46f..cb3d22855b 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -20,7 +20,6 @@ import errno import os import re import subprocess -import string import unittest import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scrip= ts')) @@ -30,6 +29,10 @@ import json import signal import logging =20 +# use the following imports from qtest instead of iotests. +from qtest import qemu_prog, qemu_opts, test_dir, output_dir +from qtest import qemu_default_machine, socket_scm_helper +from qtest import filter_qmp_event, verify_platform =20 # This will not work if arguments contain spaces but is necessary if we # want to support the override options that ./check supports. @@ -45,18 +48,10 @@ qemu_nbd_args =3D [os.environ.get('QEMU_NBD_PROG', 'qem= u-nbd')] if os.environ.get('QEMU_NBD_OPTIONS'): qemu_nbd_args +=3D os.environ['QEMU_NBD_OPTIONS'].strip().split(' ') =20 -qemu_prog =3D os.environ.get('QEMU_PROG', 'qemu') -qemu_opts =3D os.environ.get('QEMU_OPTIONS', '').strip().split(' ') - imgfmt =3D os.environ.get('IMGFMT', 'raw') imgproto =3D os.environ.get('IMGPROTO', 'file') -test_dir =3D os.environ.get('TEST_DIR') -output_dir =3D os.environ.get('OUTPUT_DIR', '.') cachemode =3D os.environ.get('CACHEMODE') -qemu_default_machine =3D os.environ.get('QEMU_DEFAULT_MACHINE') =20 -socket_scm_helper =3D os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_help= er') -debug =3D False =20 def qemu_img(*args): '''Run qemu-img and return the exit code''' @@ -134,14 +129,6 @@ chown_re =3D re.compile(r"chown [0-9]+:[0-9]+") def filter_chown(msg): return chown_re.sub("chown UID:GID", msg) =20 -def filter_qmp_event(event): - '''Filter a QMP event dict''' - event =3D dict(event) - if 'timestamp' in event: - event['timestamp']['seconds'] =3D 'SECS' - event['timestamp']['microseconds'] =3D 'USECS' - return event - def log(msg, filters=3D[]): for flt in filters: msg =3D flt(msg) @@ -257,66 +244,7 @@ class VM(qtest.QEMUQtestMachine): command_line=3D'qemu-io %s "%s"' % (drive, cmd)) =20 =20 -index_re =3D re.compile(r'([^\[]+)\[([^\]]+)\]') - -class QMPTestCase(unittest.TestCase): - '''Abstract base class for QMP test cases''' - - def dictpath(self, d, path): - '''Traverse a path in a nested dict''' - for component in path.split('/'): - m =3D index_re.match(component) - if m: - component, idx =3D m.groups() - idx =3D int(idx) - - if not isinstance(d, dict) or component not in d: - self.fail('failed path traversal for "%s" in "%s"' % (path= , str(d))) - d =3D d[component] - - if m: - if not isinstance(d, list): - self.fail('path component "%s" in "%s" is not a list i= n "%s"' % (component, path, str(d))) - try: - d =3D d[idx] - except IndexError: - self.fail('invalid index "%s" in path "%s" in "%s"' % = (idx, path, str(d))) - return d - - def flatten_qmp_object(self, obj, output=3DNone, basestr=3D''): - if output is None: - output =3D dict() - if isinstance(obj, list): - for i in range(len(obj)): - self.flatten_qmp_object(obj[i], output, basestr + str(i) += '.') - elif isinstance(obj, dict): - for key in obj: - self.flatten_qmp_object(obj[key], output, basestr + key + = '.') - else: - output[basestr[:-1]] =3D obj # Strip trailing '.' - return output - - def qmp_to_opts(self, obj): - obj =3D self.flatten_qmp_object(obj) - output_list =3D list() - for key in obj: - output_list +=3D [key + '=3D' + obj[key]] - return ','.join(output_list) - - def assert_qmp_absent(self, d, path): - try: - result =3D self.dictpath(d, path) - except AssertionError: - return - self.fail('path "%s" has value "%s"' % (path, str(result))) - - def assert_qmp(self, d, path, value): - '''Assert that the value for a specific path in a QMP dict matches= ''' - result =3D self.dictpath(d, path) - self.assertEqual(result, value, 'values not equal "%s" and "%s"' %= (str(result), str(value))) - - -class BlockQMPTestCase(QMPTestCase): +class BlockQMPTestCase(qtest.QMPTestCase): '''Abstract base class for Block QMP test cases''' =20 def assert_no_active_block_jobs(self): @@ -430,10 +358,6 @@ def verify_image_format(supported_fmts=3D[], unsupport= ed_fmts=3D[]): if unsupported_fmts and (imgfmt in unsupported_fmts): notrun('not suitable for this image format: %s' % imgfmt) =20 -def verify_platform(supported_oses=3D['linux']): - if True not in [sys.platform.startswith(x) for x in supported_oses]: - notrun('not suitable for this OS: %s' % sys.platform) - def supports_quorum(): return 'quorum' in qemu_img_pipe('--help') =20 --=20 2.15.1 From nobody Wed May 1 23:58:23 2024 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 1513201377579693.6870456698205; Wed, 13 Dec 2017 13:42:57 -0800 (PST) Received: from localhost ([::1]:37859 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEnm-0005OT-ON for importer@patchew.org; Wed, 13 Dec 2017 16:42:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEhS-0000n4-SW for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePEhQ-0001yv-Ve for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:22 -0500 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:34613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePEhQ-0001yd-Pg for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:20 -0500 Received: by mail-qk0-x243.google.com with SMTP id d66so3854232qkg.1 for ; Wed, 13 Dec 2017 13:36:20 -0800 (PST) Received: from x1.local ([138.117.48.211]) by smtp.gmail.com with ESMTPSA id x23sm1617150qkb.4.2017.12.13.13.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 13:36:19 -0800 (PST) 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=YHKNAGWC+knatq/zIDfXBqgMt02gM9s1u5Jf8aC8ZpU=; b=NfDvlWg8QgYTxUgrrYOBv3x41+y8a67icT5tO/bZ4lUm7ZRzLo0wZhrbk4I3DZ09hr wbJP1PMwgXbUhZ7fLPTFp3Ava3RdfOzvTlWGAVKLwMhqqr/uyE5n2FLmETU0hShtDErU scL+d2R3osHtdYog12gghDq9zYBak8I/gnU8FUdSOzvjZrDztcv3XZJn5na0lNCSPmxk H3q9tcCjOFzIm3fVpVNlPwTe12uMgfyRYQ2Asqf/RSO+GR0NFwCDxZmymhkra0jDn84J 2U05zYdUiNPHoN3el+eFtkAVVbEgySBdQQh/8h6j14PtwgFByQMTGRmaYXXmUdZRyLVf nKaw== 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=YHKNAGWC+knatq/zIDfXBqgMt02gM9s1u5Jf8aC8ZpU=; b=uAcqzOPsnYhkwC1841ELH/D+UIQah/BLNSXwlL+0AzLNiH5/2uXEgRs7nYNOFbKdQI 99fq8nqAWa1LXcuRC6lLEX3XMwbXbig+MSIvbxkxtxJlwI+X5eZBAQ6gVUEZjG3BXcj8 03pa58dYpI+VhKlBG1WVPX2l8SzkDVSl4+K8SABAEzDveNxES/9JqcEry7g/D36rmUdY GMACYdgg7hN7FYsseFx5ObBiEPxB2LTn8v0ZfDPdDdZrg8/GoSBHQqV+ewz2dJvn9Oew NaE4p6j8L7NUtMvGWTQQypyB9yPFLI+Z7BpHuhIpQCMoxgwhxnwsKKcMAZlDc+3AbQZP 22Uw== X-Gm-Message-State: AKGB3mJA9HVcKPJbmFkcAVe80iMRXazJH4IPjOXNaZyKjrGEVYptdxpn h0jhk+YBdhiL7vdtfJFKsm8= X-Google-Smtp-Source: ACJfBotDdgqfQdxkbgAOOIapMv6C9jIPG0M+686yJgjNfJpnWG57Sf+w8uFN5xfEx/Pc/1CRgahsew== X-Received: by 10.55.17.150 with SMTP id 22mr12683045qkr.208.1513200980369; Wed, 13 Dec 2017 13:36:20 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Cleber Rosa , Kevin Wolf , Max Reitz , John Snow , Eduardo Habkost , =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , "Daniel P . Berrange" , Eric Blake , Stefan Hajnoczi , Fam Zheng Date: Wed, 13 Dec 2017 18:35:54 -0300 Message-Id: <20171213213557.26561-4-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213213557.26561-1-f4bug@amsat.org> References: <20171213213557.26561-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:c09::243 Subject: [Qemu-devel] [PATCH 3/6] qtest.py: use TMPDIR/TEMP if the TEST_DIR env var is missing 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- scripts/qtest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/qtest.py b/scripts/qtest.py index 78db8d02c0..733686a6fe 100644 --- a/scripts/qtest.py +++ b/scripts/qtest.py @@ -18,12 +18,13 @@ import qemu import re import unittest import logging +import tempfile =20 =20 qemu_prog =3D os.environ.get('QEMU_PROG', 'qemu') qemu_opts =3D os.environ.get('QEMU_OPTIONS', '').strip().split(' ') =20 -test_dir =3D os.environ.get('TEST_DIR') +test_dir =3D os.environ.get('TEST_DIR', tempfile.gettempdir()) output_dir =3D os.environ.get('OUTPUT_DIR', '.') qemu_default_machine =3D os.environ.get('QEMU_DEFAULT_MACHINE') =20 --=20 2.15.1 From nobody Wed May 1 23:58:23 2024 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513201509146845.203561764764; Wed, 13 Dec 2017 13:45:09 -0800 (PST) Received: from localhost ([::1]:37873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEpm-0006mk-5p for importer@patchew.org; Wed, 13 Dec 2017 16:44:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEhY-0000se-Cn for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePEhV-00024e-9G for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:28 -0500 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:44002) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePEhV-00023x-5e for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:25 -0500 Received: by mail-qt0-x241.google.com with SMTP id w10so5525245qtb.10 for ; Wed, 13 Dec 2017 13:36:25 -0800 (PST) Received: from x1.local ([138.117.48.211]) by smtp.gmail.com with ESMTPSA id x23sm1617150qkb.4.2017.12.13.13.36.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 13:36:24 -0800 (PST) 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=bX+wDT1QNK/cjDvZnfBBX1BwVlWckDItF48G9eNAAyc=; b=N/03LCipZNVIHphJAhxb8lfOXQrKZNNHfLQ5cyF8Dlm7GE7gkajXinFEwUkJqeNt1U /60WRyZaB9MMJKHr50v9aePsg8ixOggAiSn1jS9s1NjG1JhtK6YjNFuk3TSYLSp4LVS/ tRR7s4UXCNpUbW18RlJNGAdk5D5GAnKZiDC7gk9mmyhnM9I4EiO3urDmntUjr77KYlhK 5u/G7FQokTGP3FqOqOog8N2Ktwmvylz7j1/7zVD4Rf38h/Ai1E7J8ZsnBpe7qmzlbEQ+ yJw4/JO8ou2HdVzw4J5uKKR9EnLE3e9oB2HX1uXYw6P73sY+mJhD5gZp8KhSthAFPVqi dJVw== 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=bX+wDT1QNK/cjDvZnfBBX1BwVlWckDItF48G9eNAAyc=; b=At4DlkD+9jMET/3aTvp9K+dPuOnCQISZwo6jdm6pJk4/KcJgRKaqGUuZiAE0UOqPWX S+41DfT7O6h3ijSPNe5wYJdnkq/4avIK6M7MdmDYMbe/sPnWH1f1J9wPAaDRXQPvsDlj fK1MlDxgafIM1leKUEKydf6WvL319FJOEc5v3/dhFsjYSjKXD0vJYZkR6WKgOZPmtA9f NteBChv5ioanmr2ZmPWhb/7b49b+yRdJv5iUMtaq7SUBxiRzM5IYZgdZIClXJSM5Chaf h+F7oR6rwUZNjs/BxeEKnM9uRhjyBFT3oVKNx12iMHVsuKH3EoeueFj71rHGNeuWz5Kx JrTQ== X-Gm-Message-State: AKGB3mJD5J3nqr+TDulE47fP/U20JzxZNhd3N1rSHG0jbgOVdYQsqs8K 2IgPGIeLQxs02n838052aFg= X-Google-Smtp-Source: ACJfBotmqUxF3FOkuAbP57ErD97Cfo3kQTozvY624egS60y3CzVKKxDdwjFVp9kxQRkKGre9wXKAXg== X-Received: by 10.237.55.9 with SMTP id i9mr13246490qtb.164.1513200984680; Wed, 13 Dec 2017 13:36:24 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Cleber Rosa , Kevin Wolf , Max Reitz , John Snow , Eduardo Habkost , =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , "Daniel P . Berrange" , Eric Blake , Stefan Hajnoczi , Fam Zheng Date: Wed, 13 Dec 2017 18:35:55 -0300 Message-Id: <20171213213557.26561-5-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213213557.26561-1-f4bug@amsat.org> References: <20171213213557.26561-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::241 Subject: [Qemu-devel] [PATCH 4/6] qtest.py: add verify_machine(supported_machines) 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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 We can now restrict tests to specific machines. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- scripts/qtest.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/qtest.py b/scripts/qtest.py index 733686a6fe..429eb67c2a 100644 --- a/scripts/qtest.py +++ b/scripts/qtest.py @@ -19,6 +19,7 @@ import re import unittest import logging import tempfile +import subprocess =20 =20 qemu_prog =3D os.environ.get('QEMU_PROG', 'qemu') @@ -210,3 +211,18 @@ def notrun(reason): def verify_platform(supported_oses=3D['linux']): if True not in [sys.platform.startswith(x) for x in supported_oses]: notrun('not suitable for this OS: %s' % sys.platform) + +def verify_machine(supported_machines): + if 'any' in supported_machines: + return + args =3D list((qemu_prog, "-machine", "help")) + subp =3D subprocess.Popen(args, stdout=3Dsubprocess.PIPE, + stderr=3Dsubprocess.STDOUT) + exitcode =3D subp.wait() + if exitcode < 0: + sys.stderr.write('qemu received signal %i: %s\n' % (-exitcode, + ' '.join(args)= )) + machines =3D re.split("\n([\w\.-]+)\s.*", subp.communicate()[0]) + + if True not in [x in machines for x in supported_machines]: + notrun('not machine suitable for this test') --=20 2.15.1 From nobody Wed May 1 23:58:23 2024 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 151320137102641.342647438856375; Wed, 13 Dec 2017 13:42:51 -0800 (PST) Received: from localhost ([::1]:37857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEng-0005JZ-C1 for importer@patchew.org; Wed, 13 Dec 2017 16:42:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEha-0000wE-Kh for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePEhZ-0002A4-Lx for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:30 -0500 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:36838) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePEhZ-00029c-Hp for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:29 -0500 Received: by mail-qt0-x242.google.com with SMTP id a16so5587469qtj.3 for ; Wed, 13 Dec 2017 13:36:29 -0800 (PST) Received: from x1.local ([138.117.48.211]) by smtp.gmail.com with ESMTPSA id x23sm1617150qkb.4.2017.12.13.13.36.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 13:36:28 -0800 (PST) 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=xlnNPUzEVA1lpnK1rmKktcHZctoU+0YTz97tIsFeJvQ=; b=Li7VWMNSXd+Bw5GixxYshvycEXkxW/tynMqQTpUKmTONzZFhxd4vfgIB/bWHd6/HZ1 mE7zGUQGzbJzeBv+dKUlP4SjlmdqJ52liXa5IAcGENVtvEWANX+VrvwN+KWwLV2e1wbM KO/khvX2gFpQNgI3HBdpt73je8jZUvGOgIiXOSA8jesfkU/r0a4UJ2H14TpPQMg2yig/ 3oNJlpZ1QQLxPKTt+/9Slil6IwvNGPJlnUsPhWib2FJj4qS1kFPSxxBtyoda/UTHdzDk WhVoouebEURUtj2J9QYCt6C2OTu8AEgRRG1BhcIgVhnLLrwk4EkRBKBC8voogqlCEr+m 12Kg== 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=xlnNPUzEVA1lpnK1rmKktcHZctoU+0YTz97tIsFeJvQ=; b=RIVD42taLJNQdL5D/beZaQ4wHU93aZ0EESL/Wh81rHlTaWRntPG9gk6m9tmyynM+ai 1dTc1djgkpUpaLQpslRbsNNUitrmO9GjuheLwQM1pSE0i8bRCXEGNOxMT//puCLa8EFy EV51QjjDr8Q4wdDWL8NqeQjhC+gact0GHWfdZNkHCdJ8R3aABDR/zXZD9e74VVlcHxmF dd8f/4s7IglxzA0LJ5e7CIgBXbcBU7eZ1x8O2ZqjO6A6oRMca2OQs9KWXQhm2lfYVuzF JIIp90VDsJ+iLDijlPfMhbT9cps28ranNtEMVPYPT4L+pfYYq5OUzMOACfG75rOiIO4j LaIw== X-Gm-Message-State: AKGB3mIdLvcZGqUBFZOJhwlftlFBuPZC+S6OaE7wjes8BiI2K6RPdyji 0HmcJNgCnliepprRcuFd224= X-Google-Smtp-Source: ACJfBot32VNwP88b51DvFIUCUDaOnd4H+sXTqRWVTsKvViO01ZCrhz28K8Z+v/megrWUnKphGOj+vw== X-Received: by 10.200.58.67 with SMTP id w61mr12944060qte.296.1513200989007; Wed, 13 Dec 2017 13:36:29 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Cleber Rosa , Kevin Wolf , Max Reitz , John Snow , Eduardo Habkost , =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , "Daniel P . Berrange" , Eric Blake , Stefan Hajnoczi , Fam Zheng Date: Wed, 13 Dec 2017 18:35:56 -0300 Message-Id: <20171213213557.26561-6-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213213557.26561-1-f4bug@amsat.org> References: <20171213213557.26561-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::242 Subject: [Qemu-devel] [PATCH 5/6] qtest.py: add a simple main() which calls unittest.main() 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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 We can now write complex qtests with a high-level language (Python). (partly copied from iotests::main) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- scripts/qtest.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/scripts/qtest.py b/scripts/qtest.py index 429eb67c2a..581451836c 100644 --- a/scripts/qtest.py +++ b/scripts/qtest.py @@ -226,3 +226,36 @@ def verify_machine(supported_machines): =20 if True not in [x in machines for x in supported_machines]: notrun('not machine suitable for this test') + +def main(supported_oses=3D['linux'], supported_machines=3D['any']): + '''Run tests''' + + global debug + + verify_platform(supported_oses) + verify_machine(supported_machines) + + verbosity =3D 0 + level =3D logging.WARN + if '-d' in sys.argv: + verbosity =3D 2 + level =3D logging.DEBUG + if '-v' in sys.argv: + verbosity =3D 1 + level =3D logging.INFO + if '-q' in sys.argv: + level =3D logging.NOTSET + + import StringIO + output =3D sys.stdout if verbosity else StringIO.StringIO() + + logging.basicConfig(level=3Dlevel) + + class MyTestRunner(unittest.TextTestRunner): + def __init__(self, stream=3Doutput, descriptions=3DTrue, + verbosity=3Dverbosity): + unittest.TextTestRunner.__init__(self, stream, descriptions, + verbosity) + + # unittest.main() will use sys.exit() so expect a SystemExit exception + unittest.main(testRunner=3DMyTestRunner) --=20 2.15.1 From nobody Wed May 1 23:58:23 2024 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513201587153530.0552108422714; Wed, 13 Dec 2017 13:46:27 -0800 (PST) Received: from localhost ([::1]:37886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEr7-0007g3-Gc for importer@patchew.org; Wed, 13 Dec 2017 16:46:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePEhh-00012m-N4 for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePEhe-0002HW-JF for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:37 -0500 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:46671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePEhe-0002H2-F9 for qemu-devel@nongnu.org; Wed, 13 Dec 2017 16:36:34 -0500 Received: by mail-qk0-x244.google.com with SMTP id b184so3858984qkc.13 for ; Wed, 13 Dec 2017 13:36:34 -0800 (PST) Received: from x1.local ([138.117.48.211]) by smtp.gmail.com with ESMTPSA id x23sm1617150qkb.4.2017.12.13.13.36.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 13:36:33 -0800 (PST) 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=r3k9x7IohuY82sgFUPa8p0EE4sIhiLYE2ewWjmyZWkM=; b=XLWxrlDgZeg6awmQjyJlTORBfAr5xeyKidWLH7mp2m3L1W/FariWeMEXgdgkQlIGqe QISYTg/sczi7hStLqcWvP86Qi20GQ1PF+1umUHNY0biKOjgzQ2BuHwLqbQ/AyflgdI2R 0SPX7ey0qZ7OQ3BnIeKV24LziDa7hshmfEH33+WleVlANLw8eWsmqVyFlPnU1PVI4BJk QsMSoq46GkMkocKmJKSGd/K3dV6CxKD0q+1WyOYtjntt0KukfBawJQylKkKd+KTvrjMP pa8OeEtkMkPNwJw8YesHySeHQAu43CsGiTLx6qb4Upe3IIYTFckyvTFpUd35KnK11DFH rHtA== 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=r3k9x7IohuY82sgFUPa8p0EE4sIhiLYE2ewWjmyZWkM=; b=IrrdVaTAvDMeG25Fz219VO3tjXcPuReuo4K5yYfwy8XhgXJiwSkDyYJ2vvrawtsqPl uTQf3aA1hE9RAl2vl4pG3jDiXUizNXRLcLvfg/G3+Eta4tDyullPYh+lUZNdKJqmJr+m gVXHvz8IwBZHeyc87g7AaGK45ZLBCfg16B8SCyACa0h7qeq39L96ku3+5baLdGL2PGqJ qtISg1dtTRk4bBMmERR9588JF4clkcj23sNoER32eL61ZR/VKc7P05agbshiBMB6+FmQ nk8zj+RBUazs+tjdXMvKArWigpHiBVsvEBppvOzVqQVrP5Qm48ZakrdcCyEyYXZKGUcG 8lkQ== X-Gm-Message-State: AKGB3mKjPGNJMXh/DUFlS7NnPfq3l0LbHYu5e5IVvGDpa81+gtDyKpRP 1seQisEgI4zXwKanY7eW3vs= X-Google-Smtp-Source: ACJfBouvnVGKiXRbEuBhDO3uVaePcUtv1+ER01vEXyi/4pwSwrvXHxiai58lTTBFuVPSv3vkI5Pw9A== X-Received: by 10.55.122.135 with SMTP id v129mr13122259qkc.104.1513200993933; Wed, 13 Dec 2017 13:36:33 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Alistair Francis , "Edgar E . Iglesias" , Cleber Rosa , Kevin Wolf , Max Reitz , John Snow , Eduardo Habkost , =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , "Daniel P . Berrange" , Eric Blake , Stefan Hajnoczi , Fam Zheng , Thomas Huth , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Date: Wed, 13 Dec 2017 18:35:57 -0300 Message-Id: <20171213213557.26561-7-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213213557.26561-1-f4bug@amsat.org> References: <20171213213557.26561-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:c09::244 Subject: [Qemu-devel] [PATCH 6/6] tests: add a Makefile rule to run Python qtests 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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 We can now add Python qtests to the common $(check-qtest-y) / $(check-qtest-$(TARGET)-y) variable. Using the $(filter...) function, the check-qtest-% rule splits between C/Py= thon qtests and can run both types. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/Makefile.include | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index c002352134..13673f6d1d 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -828,7 +828,7 @@ endif TARGETS=3D$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS))) ifeq ($(CONFIG_POSIX),y) QTEST_TARGETS =3D $(TARGETS) -check-qtest-y=3D$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y)) +check-qtest-y=3D$(foreach TARGET,$(TARGETS), $(filter-out %.py, $(check-qt= est-$(TARGET)-y))) check-qtest-y +=3D $(check-qtest-generic-y) else QTEST_TARGETS =3D @@ -843,6 +843,7 @@ tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y) SPEED =3D quick GTESTER_OPTIONS =3D -k $(if $(V),--verbose,-q) GCOV_OPTIONS =3D -n $(if $(V),-f,) +QPYTHONS_OPTIONS =3D $(if $(V),-v,) =20 # gtester tests, possibly with verbose output =20 @@ -852,11 +853,15 @@ $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check= -qtest-%: subdir-%-softmmu $(call quiet-command,QTEST_QEMU_BINARY=3D$*-softmmu/qemu-system-$* \ QTEST_QEMU_IMG=3Dqemu-img$(EXESUF) \ MALLOC_PERTURB_=3D$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ - gtester $(GTESTER_OPTIONS) -m=3D$(SPEED) $(check-qtest-$*-y) $(check-qte= st-generic-y),"GTESTER","$@") + gtester $(GTESTER_OPTIONS) -m=3D$(SPEED) $(filter-out %.py,$(check-qtest= -$*-y) $(check-qtest-generic-y)),"GTESTER","$@") $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y) $(gcov-files-generic-y);= do \ echo Gcov report for $$f:;\ $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \ done,) + $(if $(filter %.py,$(check-qtest-$*-y)), \ + $(call quiet-command,PYTHONPATH=3D$(SRC_PATH)/scripts \ + QEMU_PROG=3D$*-softmmu/qemu-system-$* \ + $(PYTHON) $(SRC_PATH)/$(filter %.py,$(check-qtest-$*-y)) $(QPYTHONS_OPT= IONS),"PYTEST","$@"),) =20 .PHONY: $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)) $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)): check-%: % @@ -874,7 +879,7 @@ $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)= ): check-%: % $(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qt= est-%.xml: $(check-qtest-y) $(call quiet-command,QTEST_QEMU_BINARY=3D$*-softmmu/qemu-system-$* \ QTEST_QEMU_IMG=3Dqemu-img$(EXESUF) \ - gtester -q $(GTESTER_OPTIONS) -o $@ -m=3D$(SPEED) $(check-qtest-$*-y) $= (check-qtest-generic-y),"GTESTER","$@") + gtester -q $(GTESTER_OPTIONS) -o $@ -m=3D$(SPEED) $(filter-out %.py,$(c= heck-qtest-$*-y) $(check-qtest-generic-y)),"GTESTER","$@") =20 check-report-unit.xml: $(check-unit-y) $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=3D$(SPEED) $^= ,"GTESTER","$@") --=20 2.15.1