From patchwork Thu Jan 22 16:52:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 431918 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 53186140273 for ; Fri, 23 Jan 2015 03:52:55 +1100 (AEDT) Received: from localhost ([::1]:54782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEL00-0003On-4t for incoming@patchwork.ozlabs.org; Thu, 22 Jan 2015 11:52:52 -0500 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 Received: from localhost ([10.18.17.71]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0MGqObs030225 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Thu, 22 Jan 2015 11:52:25 -0500 From: Max Reitz To: qemu-devel@nongnu.org Date: Thu, 22 Jan 2015 11:52:23 -0500 Message-Id: <1421945543-15607-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz Subject: [Qemu-devel] [PATCH] iotests: Test prefix for supported_oses in Python X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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