Received: from eggs.gnu.org ([2001:4830:134:3::10]:57336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEKzf-00034f-N7 for qemu-devel@nongnu.org; Thu, 22 Jan 2015 11:52:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEKzc-0000j5-CL for qemu-devel@nongnu.org; Thu, 22 Jan 2015 11:52:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEKzc-0000ii-4h for qemu-devel@nongnu.org; Thu, 22 Jan 2015 11:52:28 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0MGqPuj024982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 22 Jan 2015 11:52:26 -0500 From: Max Reitz Date: Thu, 22 Jan 2015 11:52:23 -0500 Message-Id: <1421945543-15607-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH] iotests: Test prefix for supported_oses in Python List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz sys.platform may be set to "linux2" instead of just "linux" (in theory, it could even be set to "linux3" or something else). The Python documentation on sys.platform recommends testing the prefix of the platform against "linux", so we should do that. Signed-off-by: Max Reitz --- tests/qemu-iotests/iotests.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 87002e0..da00de5 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -288,7 +288,13 @@ def main(supported_fmts=[], supported_oses=['linux']): if supported_fmts and (imgfmt not in supported_fmts): notrun('not suitable for this image format: %s' % imgfmt) - if sys.platform not in supported_oses: + os_supported = False + for supported_os in supported_oses: + if sys.platform.startswith(supported_os): + os_supported = True + break + + if not os_supported: notrun('not suitable for this OS: %s' % sys.platform) # We need to filter out the time taken from the output so that qemu-iotest -- 2.1.0