From nobody Fri Nov 7 15:42:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 154825582627625.06551047698838; Wed, 23 Jan 2019 07:03:46 -0800 (PST) Received: from localhost ([127.0.0.1]:36337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmK48-0004A2-S3 for importer@patchew.org; Wed, 23 Jan 2019 10:03:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmJo6-00005m-3s for qemu-devel@nongnu.org; Wed, 23 Jan 2019 09:47:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmJo0-0000PB-29 for qemu-devel@nongnu.org; Wed, 23 Jan 2019 09:47:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmJnk-0000EU-Mx; Wed, 23 Jan 2019 09:46:48 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E45EC71B8; Wed, 23 Jan 2019 14:46:43 +0000 (UTC) Received: from localhost (unknown [10.40.206.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A77231EB; Wed, 23 Jan 2019 14:46:38 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 23 Jan 2019 15:46:07 +0100 Message-Id: <20190123144610.8842-7-mreitz@redhat.com> In-Reply-To: <20190123144610.8842-1-mreitz@redhat.com> References: <20190123144610.8842-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 23 Jan 2019 14:46:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 6/9] iotests.py: Add is_str() 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: Kevin Wolf , John Snow , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Strings can have various representations, this helper function checks whether a given value is in any of them. Signed-off-by: Max Reitz Reviewed-by: John Snow --- tests/qemu-iotests/iotests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f51456fa63..29e4e3306f 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -221,6 +221,12 @@ def image_size(img): r =3D qemu_img_pipe('info', '--output=3Djson', '-f', imgfmt, img) return json.loads(r)['virtual-size'] =20 +def is_str(val): + if sys.version_info.major >=3D 3: + return isinstance(val, str) or isinstance(val, bytes) + else: + return isinstance(val, str) or isinstance(val, unicode) + test_dir_re =3D re.compile(r"%s" % test_dir) def filter_test_dir(msg): return test_dir_re.sub("TEST_DIR", msg) --=20 2.20.1