[Buildroot] [PATCH v3 5/7] support/testing/infra/emulator.py: update encoding when calling qemu

Yann E. MORIN yann.morin.1998 at free.fr
Thu Sep 30 20:28:10 UTC 2021


Köry, All,

+Arnout, +Petr for their python3 expertise

On 2021-09-23 17:57 +0200, Kory Maincent spake thusly:
> With UTF-8 got issue with wrong character returned by Qemu when using EFI
> BIOS. This breaks the test process with the following error. Update to
> ISO-8859-1 encoding to avoid it.

I am always skeptical about switching away from UTF-8. Rather, I'd like
to undersand why that is the case.

Is it specific to just the edk2 tests you added later in the series?
What if you set your locale to 'C' (LC_ALL=C LANG=C) when runing the
test-suite? Or to 'C.UTF-8'?

>     emulator.login()
>   File "/home/kmaincent/Documents/projects/ariane-groupe/buildroot/support/testing/infra/emulator.py", line 89, in login
>     index = self.qemu.expect(["buildroot login:", pexpect.TIMEOUT],
>   File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 340, in expect
>     return self.expect_list(compiled_pattern_list,
>   File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 369, in expect_list
>     return exp.expect_loop(timeout)
>   File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 111, in expect_loop
>     incoming = spawn.read_nonblocking(spawn.maxread, timeout)
>   File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
>     return super(spawn, self).read_nonblocking(size)
>   File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 178, in read_nonblocking
>     s = self._decoder.decode(s, final=False)
>   File "/usr/lib/python3.8/codecs.py", line 322, in decode
>     (result, consumed) = self._buffer_decode(data, self.errors, final)
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 0: invalid continuation byte

0xda in iso8859-15 is Ú (LATIN CAPITAL LETTER U WITH ACUTE). This is a
weird character to see... And his is the first byte... Is edk2 just
spitting actual binary?

So I'd really like to understand why that is... 

Regards,
Yann E. MORIN.

> Signed-off-by: Kory Maincent <kory.maincent at bootlin.com>
> ---
>  support/testing/infra/emulator.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
> index 0a77eb80fc..1fab9caad8 100644
> --- a/support/testing/infra/emulator.py
> +++ b/support/testing/infra/emulator.py
> @@ -76,7 +76,7 @@ class Emulator(object):
>          self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd))
>          self.qemu = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:],
>                                    timeout=5 * self.timeout_multiplier,
> -                                  encoding='utf-8',
> +                                  encoding='ISO-8859-1',
>                                    env={"QEMU_AUDIO_DRV": "none"})
>          # We want only stdout into the log to avoid double echo
>          self.qemu.logfile_read = self.logfile
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at lists.buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'


More information about the buildroot mailing list