[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/14] tests: Force Python I/O encoding for check-qap
From: |
Thomas Huth |
Subject: |
[Qemu-devel] [PULL 01/14] tests: Force Python I/O encoding for check-qapi-schema |
Date: |
Thu, 9 May 2019 10:19:17 +0200 |
From: Eduardo Habkost <address@hidden>
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 <address@hidden>
Tested-by: Thomas Huth <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Tested-by: Alex Bennée <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
---
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=$(SRC_PATH)/scripts \
- $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \
+ PYTHONIOENCODING=utf-8 $(PYTHON)
$(SRC_PATH)/tests/qapi-schema/test-qapi.py \
$^ >$*.test.out 2>$*.test.err; \
echo $$? >$*.test.exit, \
"TEST","$*.out")
--
2.21.0
- [Qemu-devel] [PULL 00/14] qtests, copyright statement clarifications and misc patches, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 01/14] tests: Force Python I/O encoding for check-qapi-schema,
Thomas Huth <=
- [Qemu-devel] [PULL 02/14] tests/tco: Make test independent of global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 03/14] tests/megasas: Make test independent of global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 04/14] tests/qmp-cmd-test: Use qtest_init() instead of qtest_start(), Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 05/14] tests/test-hmp: Use qtest_init() instead of qtest_start(), Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 07/14] tests/tpm-tests: Use g_test_skip() to mark skipped tests, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 08/14] tests/Makefile: Remove unused test-obj-y variable, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 06/14] tests/ide-test: Make test independent of global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 09/14] tests/drive_del-test: Use qtest_init() instead of qtest_start(), Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 10/14] tests: qpci_unplug_acpi_device_test() should not rely on global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 13/14] target/sh4: Fix LGPL information in the file headers, Thomas Huth, 2019/05/09