* [PATCH 0/1] tests/acceptance: set VM socket encoding to UTF-8
@ 2020-07-21 12:55 Daniele Buono
2020-07-21 12:55 ` [PATCH 1/1] " Daniele Buono
0 siblings, 1 reply; 2+ messages in thread
From: Daniele Buono @ 2020-07-21 12:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé,
Daniele Buono, Wainer dos Santos Moschetta, Cleber Rosa
Some of the acceptance tests were failing for me with an error while
decoding characters coming from the VMs running for the test.
The error looked like this:
(30/36) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_nios2_10m50: ERROR: 'ascii' codec can't decode byte 0xc2 in position 36: ordinal not in range(128) (1.29 s)
The very same test is running fine on GitLab CI
An investigation of the issue shows that the socket we are using between
QEMU and AVOCADO is using the default encoding of the host OS. In my
case, locale was set to plain ASCII with LANG=C. Setting it to a UTF-8
locale fixed the issue, but a safer approach should be to just tell
Python to always use a UTF-8 charset for the socket. This is what the
patch does.
Daniele Buono (1):
tests/acceptance: set VM socket encoding to UTF-8
tests/acceptance/avocado_qemu/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.26.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] tests/acceptance: set VM socket encoding to UTF-8
2020-07-21 12:55 [PATCH 0/1] tests/acceptance: set VM socket encoding to UTF-8 Daniele Buono
@ 2020-07-21 12:55 ` Daniele Buono
0 siblings, 0 replies; 2+ messages in thread
From: Daniele Buono @ 2020-07-21 12:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé,
Daniele Buono, Wainer dos Santos Moschetta, Cleber Rosa
The OS of some VM used by acceptance tests sends messages in UTF-8
encoding.
The socket used to communicate between the VM and the host by the
AVOCADO framework uses the default host encoding. This is not generally
a problem since most distributions default to UTF. However, if for some
reason the host is using a plain ASCII encoding, the VM test will fail
with an error. This patch explicitly sets the encoding to be UTF-8.
Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
---
tests/acceptance/avocado_qemu/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 77d1c1d9ff..5f7ef0a2f2 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -73,7 +73,7 @@ def _console_interaction(test, success_message, failure_message,
assert not keep_sending or send_string
if vm is None:
vm = test.vm
- console = vm.console_socket.makefile()
+ console = vm.console_socket.makefile(encoding='UTF-8')
console_logger = logging.getLogger('console')
while True:
if send_string:
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-21 12:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 12:55 [PATCH 0/1] tests/acceptance: set VM socket encoding to UTF-8 Daniele Buono
2020-07-21 12:55 ` [PATCH 1/1] " Daniele Buono
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).