]> git.ipfire.org Git - thirdparty/qemu.git/commit
tests: Force Python I/O encoding for check-qapi-schema
authorEduardo Habkost <ehabkost@redhat.com>
Mon, 6 May 2019 21:38:17 +0000 (18:38 -0300)
committerThomas Huth <thuth@redhat.com>
Wed, 8 May 2019 14:59:28 +0000 (16:59 +0200)
commit4ac2670bf955dbb3c785eb7e6c29ef684e670d7f
tree5ce7d5534602ea3a29322cd8d635a363a54968bb
parent629d166994725773dea9cef843fcb0ae5f3585fe
tests: Force Python I/O encoding for check-qapi-schema

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 <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190506213817.14344-1-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/Makefile.include