From nobody Sat Feb 7 11:05:08 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1557390115; cv=none; d=zoho.com; s=zohoarc; b=lE71WfN6ggiEbCrlXUqrb9uQb1dbUTBz2De/0GKkRuCWZGoH/40G6z7MLnZKhX3HaCAnrg9BPrDp/yp65ny0baCCAhN8GYnq9XzD0MGotn9EhtkKQ/tcmjfJcyzX/DLVRWS60UqRCShPvaoInu5dExiK5rwSmIHVY6Z+jnhDnuc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557390115; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3JDVffwRuRQdFDe/CBl+2y2/I9nOH9Qacl6sJGYhDH8=; b=N/3qVkqDK0FHiApzGf4SPllH33yKZLYugBPw7D+LsaC8T2/7qt/SdqhrzmxnOlQpWPTRsBJL/F9KJOWtmO/BfvZO5L6uZO2pnZeh8Kpx/w+L9qV8V/cbKQyVI2bdQtMimUM4HfryNXvvfWU82G5dzeySFZvlQRRDtsEiNDQagDM= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557390115029393.0096204626303; Thu, 9 May 2019 01:21:55 -0700 (PDT) Received: from localhost ([127.0.0.1]:50261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOeJF-0004YE-GD for importer@patchew.org; Thu, 09 May 2019 04:21:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOeHI-0001gP-R2 for qemu-devel@nongnu.org; Thu, 09 May 2019 04:19:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOeHH-0000GP-P1 for qemu-devel@nongnu.org; Thu, 09 May 2019 04:19:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58682) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hOeHH-0000FV-JI for qemu-devel@nongnu.org; Thu, 09 May 2019 04:19:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF019309B164; Thu, 9 May 2019 08:19:42 +0000 (UTC) Received: from thuth.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id F13205B680; Thu, 9 May 2019 08:19:36 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 9 May 2019 10:19:17 +0200 Message-Id: <20190509081930.19081-2-thuth@redhat.com> In-Reply-To: <20190509081930.19081-1-thuth@redhat.com> References: <20190509081930.19081-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 09 May 2019 08:19:42 +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] [PULL 01/14] tests: Force Python I/O encoding for check-qapi-schema 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: ehabkost@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost test-qapi.py doesn't force a specific encoding for stderr or stdout, but the reference files used by check-qapi-schema are in UTF-8. This breaks check-qapi-schema under certain circumstances (e.g. if using the C locale and Python < 3.7). We need to make sure test-qapi.py always generate UTF-8 output somehow. On Python 3.7+ we can do it using `sys.stdout.reconfigure(...)`, but we need a solution that works with older Python versions. Instead of trying a hack like reopening sys.stdout and sys.stderr, we can just tell Python to use UTF-8 for I/O encoding when running test-qapi.py. Do it by setting PYTHONIOENCODING. Reported-by: Thomas Huth Tested-by: Thomas Huth Signed-off-by: Eduardo Habkost Message-Id: <20190506213817.14344-1-ehabkost@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e Signed-off-by: Thomas Huth --- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 7c8b9c84b2..af88ab6f8b 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1103,7 +1103,7 @@ check-tests/qemu-iotests-quick.sh: tests/qemu-iotests= -quick.sh qemu-img$(EXESUF) .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/= %.json $(call quiet-command, PYTHONPATH=3D$(SRC_PATH)/scripts \ - $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \ + PYTHONIOENCODING=3Dutf-8 $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qa= pi.py \ $^ >$*.test.out 2>$*.test.err; \ echo $$? >$*.test.exit, \ "TEST","$*.out") --=20 2.21.0