Received: from eggs.gnu.org ([2001:4830:134:3::10]:48770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anNBi-0008Nb-00 for qemu-devel@nongnu.org; Tue, 05 Apr 2016 05:22:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anNBd-00034X-8O for qemu-devel@nongnu.org; Tue, 05 Apr 2016 05:22:17 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:58622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anNBc-00034E-Gb for qemu-devel@nongnu.org; Tue, 05 Apr 2016 05:22:12 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Apr 2016 10:22:11 +0100 From: Sascha Silbe Date: Tue, 5 Apr 2016 11:21:46 +0200 Message-Id: <1459848109-29756-5-git-send-email-silbe@linux.vnet.ibm.com> In-Reply-To: <1459848109-29756-1-git-send-email-silbe@linux.vnet.ibm.com> References: <1459848109-29756-1-git-send-email-silbe@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 4/7] qemu-iotests: 148: properly skip test if quorum support is missing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-block@nongnu.org, Kevin Wolf Cc: Tu Bo qemu-iotests test case 148 already had some code for skipping the test if quorum support is missing, but it didn't work in all cases. TestQuorumEvents.setUp() gets run before the actual test class (which contains the skipping code) and tries to start qemu with a drive using the quorum driver. For some reason this works fine when using qcow2, but fails for raw. As the entire test case requires quorum, just check for availability before even starting the test suite. Introduce a verify_quorum() function in iotests.py for this purpose so future test cases can make use of it. Signed-off-by: Sascha Silbe Reviewed-by: Bo Tu --- tests/qemu-iotests/148 | 4 +--- tests/qemu-iotests/iotests.py | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index d066ec3..e01b061 100644 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -79,9 +79,6 @@ sector = "%d" self.assert_qmp(event, 'data/sector-num', sector) def testQuorum(self): - if not 'quorum' in iotests.qemu_img_pipe('--help'): - return - # Generate an error and get an event self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % (offset * sector_size, sector_size)) @@ -139,4 +136,5 @@ class TestFifoQuorumEvents(TestQuorumEvents): read_pattern = 'fifo' if __name__ == '__main__': + iotests.verify_quorum() iotests.main(supported_fmts=["raw"]) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index fb5c482..bf31ec8 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -437,6 +437,11 @@ def verify_platform(supported_oses=['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_quorum(): + '''Skip test suite if quorum support is not available''' + if 'quorum' not in qemu_img_pipe('--help'): + notrun('quorum support missing') + def main(supported_fmts=[], supported_oses=['linux']): '''Run tests''' -- 1.9.1