Received: from eggs.gnu.org ([2001:4830:134:3::10]:35928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVLkU-0004Y5-EB for qemu-devel@nongnu.org; Mon, 15 Feb 2016 11:11:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVLkS-0006Zk-6r for qemu-devel@nongnu.org; Mon, 15 Feb 2016 11:11:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVLkS-0006Zf-1f for qemu-devel@nongnu.org; Mon, 15 Feb 2016 11:11:40 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id C62DD8F4F5 for ; Mon, 15 Feb 2016 16:11:39 +0000 (UTC) From: "Daniel P. Berrange" Date: Mon, 15 Feb 2016 16:10:50 +0000 Message-Id: <1455552659-14000-18-git-send-email-berrange@redhat.com> In-Reply-To: <1455552659-14000-1-git-send-email-berrange@redhat.com> References: <1455552659-14000-1-git-send-email-berrange@redhat.com> Subject: [Qemu-devel] [PATCH v3 17/26] tests: refactor python I/O tests helper main method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Fam Zheng The iotests.py helper provides a main() method for running tests via the python unit test framework. Not all tests will want to use this, so refactor it to split the testing of compatible formats and platforms into separate helper methods Signed-off-by: Daniel P. Berrange --- tests/qemu-iotests/iotests.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 5f82bbe..51e53bb 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -29,7 +29,8 @@ import qtest import struct __all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io', - 'VM', 'QMPTestCase', 'notrun', 'main'] + 'VM', 'QMPTestCase', 'notrun', 'main', 'verify_image_format', + 'verify_platform'] # This will not work if arguments contain spaces but is necessary if we # want to support the override options that ./check supports. @@ -394,17 +395,22 @@ def notrun(reason): print '%s not run: %s' % (seq, reason) sys.exit(0) -def main(supported_fmts=[], supported_oses=['linux']): - '''Run tests''' - - debug = '-d' in sys.argv - verbosity = 1 +def verify_image_format(supported_fmts=[]): if supported_fmts and (imgfmt not in supported_fmts): notrun('not suitable for this image format: %s' % imgfmt) +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 main(supported_fmts=[], supported_oses=['linux']): + '''Run tests''' + + debug = '-d' in sys.argv + verbosity = 1 + verify_image_format(supported_fmts) + verify_platform(supported_oses) + # We need to filter out the time taken from the output so that qemu-iotest # can reliably diff the results against master output. import StringIO -- 2.5.0