Skip to contentSkip to conversation

Revert "test/py: Import 'configparser' lower case to be python 3.x safe"

PATCH New Michal Simek 2 participants 3 messages Oct 4, 2018 – Oct 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "test/py: Import 'configparser' lower case to be python 3.x safe"

This reverts commit 052ca37daa20a9825d7ce905d632e349f434058d. This patch introduced bug which hasn't been resolved for quite a long time. Full failed log is placed below but the major sign is "codec can't decode byte 0x80 in position".
This issue is at least on my Ubuntu 14.04 system but others reported similar issue.

FAILED:
u_boot_console = <u_boot_console_exec_attach.ConsoleExecAttach object at 0x7f6020cc1950>

def test_version(u_boot_console):
"""Test that the "version" command prints the U-Boot version."""

# "version" prints the U-Boot sign-on message. This is usually # considered
# an error, so that any unexpected reboot causes an error. Here, # this
# error detection is disabled since the sign-on message is # expected.
with u_boot_console.disable_check('main_signon'):

Quoted 1 line

response = u_boot_console.run_command('version')

test/py/tests/test_000_version.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/py/u_boot_console_base.py:181: in run_command
self.logstream.write(self.prompt, implicit=True)
test/py/multiplexed_log.py:65: in write
self.logfile.write(self, data, implicit)
test/py/multiplexed_log.py:688: in write
self.f.write(self._escape(data))
test/py/multiplexed_log.py:335: in _escape
c for c in data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

.0 = <iterator object@0x7f6020bce950>

    data = ''.join((c in self._nonprint) and ('%25%25%2502x' %25 ord(c))

or

Quoted 1 line

c for c in data)

E UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position
32: ordinal not in range(128)

test/py/multiplexed_log.py:335: UnicodeDecodeError

---

I am sending this revert because Marek also hit this issue on his PC.

---
 test/py/conftest.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
test/py/conftest.py +2 -6
index 5c658b8c4840..e591f5879dcb 100644
@@ -18,15 +18,11 @@ import os
 import os.path
 import pytest
 from _pytest.runner import runtestprotocol
+import ConfigParser
 import re
 import StringIO
 import sys
 
-try:
-    import configparser
-except:
-    import ConfigParser as configparser
-
 # Globals: The HTML log file, and the connection to the U-Boot console.
 log = None
 console = None
@@ -170,7 +166,7 @@ def pytest_configure(config):
         with open(dot_config, 'rt') as f:
             ini_str = '[root]\n' + f.read()
             ini_sio = StringIO.StringIO(ini_str)
-            parser = configparser.RawConfigParser()
+            parser = ConfigParser.RawConfigParser()
             parser.readfp(ini_sio)
             ubconfig.buildconfig.update(parser.items('root'))
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 Revert "test/py: Import 'configparser' lower case to be python 3.x safe"

Quoted 6 lines · Michal Simek

This reverts commit 052ca37daa20a9825d7ce905d632e349f434058d. This patch introduced bug which hasn't been resolved for quite a long time. Full failed log is placed below but the major sign is "codec can't decode byte 0x80 in position".
This issue is at least on my Ubuntu 14.04 system but others reported similar issue.

Simon Glass sent the patch linked below to fix this. Does this work for you?

http://patchwork.ozlabs.org/patch/977604/
[U-Boot,v2,04/17] test/py: Fix unicode handling for log filtering

Quoted 82 lines

FAILED:
u_boot_console = <u_boot_console_exec_attach.ConsoleExecAttach object at 0x7f6020cc1950>

def test_version(u_boot_console):
"""Test that the "version" command prints the U-Boot version."""

# "version" prints the U-Boot sign-on message. This is usually # considered
# an error, so that any unexpected reboot causes an error. Here, # this
# error detection is disabled since the sign-on message is # expected.
with u_boot_console.disable_check('main_signon'):

Quoted 1 line

response = u_boot_console.run_command('version')

test/py/tests/test_000_version.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/py/u_boot_console_base.py:181: in run_command
self.logstream.write(self.prompt, implicit=True)
test/py/multiplexed_log.py:65: in write
self.logfile.write(self, data, implicit)
test/py/multiplexed_log.py:688: in write
self.f.write(self._escape(data))
test/py/multiplexed_log.py:335: in _escape
c for c in data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

.0 = <iterator object@0x7f6020bce950>

     data = ''.join((c in self._nonprint) and ('%25%25%2502x' %25 ord(c))

or

Quoted 1 line

c for c in data)

E UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position
32: ordinal not in range(128)

test/py/multiplexed_log.py:335: UnicodeDecodeError

---

I am sending this revert because Marek also hit this issue on his PC.

---
  test/py/conftest.py | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
test/py/conftest.py +2 -6
index 5c658b8c4840..e591f5879dcb 100644
@@ -18,15 +18,11 @@ import os
  import os.path
  import pytest
  from _pytest.runner import runtestprotocol
+import ConfigParser
  import re
  import StringIO
  import sys
 
-try:
-    import configparser
-except:
-    import ConfigParser as configparser
-
  # Globals: The HTML log file, and the connection to the U-Boot console.
  log = None
  console = None
@@ -170,7 +166,7 @@ def pytest_configure(config):
          with open(dot_config, 'rt') as f:
              ini_str = '[root]\n' + f.read()
              ini_sio = StringIO.StringIO(ini_str)
-            parser = configparser.RawConfigParser()
+            parser = ConfigParser.RawConfigParser()
              parser.readfp(ini_sio)
              ubconfig.buildconfig.update(parser.items('root'))
 
#2 lore raw

PATCH 1/1 Revert "test/py: Import 'configparser' lower case to be python 3.x safe"

Quoted 8 lines · Stephen Warren
Quoted 6 lines · Michal Simek

This reverts commit 052ca37daa20a9825d7ce905d632e349f434058d. This patch introduced bug which hasn't been resolved for quite a long time. Full failed log is placed below but the major sign is "codec can't decode byte 0x80 in position".
This issue is at least on my Ubuntu 14.04 system but others reported similar issue.

Quoted 5 lines

Simon Glass sent the patch linked below to fix this. Does this work for you?

http://patchwork.ozlabs.org/patch/977604/
[U-Boot,v2,04/17] test/py: Fix unicode handling for log filtering

yep that is solving the problem. I have replied that thread.

Thanks,
Michal