zdtm.py: ignore utf-8 conversion errors in test logs

In zdtm/static/binfmt_misc we print the string which contains random
bytes, some of which may not map to utf-8. So let's ignore those bytes
we can't show in utf-8.

Else we can get:

  File ".../criu/test/zdtm.py", line 660, in print_output
    print(output.read())
          ~~~~~~~~~~~^^
  File "<frozen codecs>", line 325, in decode
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 180: invalid continuation byte

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
Pavel Tikhomirov 2026-02-03 20:33:50 +01:00 committed by Alexander Mikhalitsyn
parent 51e1d41a0e
commit de732ded15
No known key found for this signature in database
GPG key ID: B1F47F5CB05B4FA3

View file

@ -656,7 +656,7 @@ class zdtm_test:
for postfix in ['.out', '.out.inprogress']:
if os.access(self.__name + postfix, os.R_OK):
print("Test output: " + "=" * 32)
with open(self.__name + postfix) as output:
with open(self.__name + postfix, errors='ignore') as output:
print(output.read())
print(" <<< " + "=" * 32)