From patchwork Wed Oct 10 21:31:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 982115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="niVz7vGp"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42VnNb73YTz9s8F for ; Thu, 11 Oct 2018 08:31:42 +1100 (AEDT) Received: from localhost ([::1]:59237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAM4w-0006Ur-Jg for incoming@patchwork.ozlabs.org; Wed, 10 Oct 2018 17:31:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAM4V-0006Uk-Ox for qemu-devel@nongnu.org; Wed, 10 Oct 2018 17:31:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAM4S-00085C-40 for qemu-devel@nongnu.org; Wed, 10 Oct 2018 17:31:11 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40571) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAM4R-00084J-TS; Wed, 10 Oct 2018 17:31:08 -0400 Received: by mail-wm1-x334.google.com with SMTP id z204-v6so7249786wmc.5; Wed, 10 Oct 2018 14:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=doYYmIjGnXZmXC7U4ZkS1If1PvYviBPFI5q7olWy3Tw=; b=niVz7vGpCBbRBwMVjnXm9P2Vf68LHTsgmQt4uPWYWoeuUBIsKWpZ4cW386LXykhW3T PDb/bQN1gfPFh/3k77z8D8N1AN6EslRe9y+QNV7Zzv0/Cy+GKWw+pviFEHmYi5QZ6wcx Ruenj+mlpsVV9KdexhbLkCON8R7WcsHKy/NfkAGWMktTDBTykqop4LXcFnWUmA78ouIl RFbOUXAov9w7MP7G1qtIBddwiSAad8uXg/GtAbUUfsZyaW1ms/tKe4PPE63oS9Zs8s9F 1HgKJ80SwgeJSkM593agTsr4l4iaMYVYg5hq9uBeoPpYc9XbiHvU7wBxb0deSfqFJ89H 5imQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=doYYmIjGnXZmXC7U4ZkS1If1PvYviBPFI5q7olWy3Tw=; b=Uf0vlA8+5MJyRAfQwiZntQB6ANHCtnE8AmqR2aUHCm95DSrdRP1a8hUwATidY0X6d6 bqsK4DTEVixWRcLBEA2sL94TGdQl8Shq432SeWHPRny/dUztjANptS94q6k/L9eCpxJq znpX2MXeauWQb33/Z3LYacqcg7fZhzRoEo8dq5r6qtfCC1P90ctA5z4NfZxT61tzFsYu jlHCmRaeGlG5aCMUcbWCBtcw8Wmhc4tmOEQ+yt0vAHnPDti3rrkgN5ZdEt7QnSl8fEVa dveCp8CwKqnFCaejY33IwAXHkLuNpGbZVYdXHYGpwb0VGdr5LVI2kzocmRHpm23EfInW RzfA== X-Gm-Message-State: ABuFfoj0Npnce8C2mHi7Bu7O8DwCLa6UblHDYSYOJ5zB2MlG5SMHLSqS OyQeUIzSOmxW/imU2lXl0bM= X-Google-Smtp-Source: ACcGV62xT1PSS6ZMlATvn/Hx/5cxSBdQnDiZeW37kwLHMYgDTnlDIaCoBMSgtq2OTd/dx8TfcT67ZA== X-Received: by 2002:a1c:5e49:: with SMTP id s70-v6mr2165966wmb.131.1539207066797; Wed, 10 Oct 2018 14:31:06 -0700 (PDT) Received: from x1.local (26.red-83-32-208.dynamicip.rima-tde.net. [83.32.208.26]) by smtp.gmail.com with ESMTPSA id x66-v6sm7478322wme.35.2018.10.10.14.31.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 14:31:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Fam Zheng , Kevin Wolf , Max Reitz , Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , "Daniel P . Berrange" Date: Wed, 10 Oct 2018 23:31:02 +0200 Message-Id: <20181010213102.8373-1-f4bug@amsat.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PATCH v3] python: Use io.StringIO 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Both Python 2.7 and 3 support the same io.StringIO to handle unicode strings. Use the common form to use indistinctly Python 2.7 or 3. http://python-future.org/compatible_idioms.html#stringio This fixes running tests on the Fedora Docker image, which uses Python3 since 356dc290f: $ make docker-test-block@fedora [...] 045 [failed, exit status 1] - output mismatch (see 045.out.bad) --- /tmp/qemu-test/src/tests/qemu-iotests/045.out 2018-07-17 16:56:18.000000000 +0000 +++ /tmp/qemu-test/build/tests/qemu-iotests/045.out.bad 2018-07-17 17:19:22.448409007 +0000 @@ -1,5 +1,6 @@ -........... ----------------------------------------------------------------------- -Ran 11 tests - -OK +Traceback (most recent call last): + File "045", line 178, in + iotests.main(supported_fmts=['raw']) + File "/tmp/qemu-test/src/tests/qemu-iotests/iotests.py", line 682, in main + import StringIO +ModuleNotFoundError: No module named 'StringIO' 132 [failed, exit status 1] - output mismatch (see 132.out.bad) 152 [failed, exit status 1] - output mismatch (see 152.out.bad) Failures: 045 132 152 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini --- tests/qemu-iotests/iotests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 4e67fbbe96..cd9be1bd9c 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -679,13 +679,13 @@ def main(supported_fmts=[], supported_oses=['linux'], supported_cache_modes=[], # 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 + from io import StringIO if debug: output = sys.stdout verbosity = 2 sys.argv.remove('-d') else: - output = StringIO.StringIO() + output = StringIO() logging.basicConfig(level=(logging.DEBUG if debug else logging.WARN))