From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCHv3 08/13] test/py: test_efi_selftest.py: Updates for python 3 support
Date: Thu, 24 Oct 2019 11:59:23 -0400 [thread overview]
Message-ID: <20191024155928.28616-9-trini@konsulko.com> (raw)
In-Reply-To: <20191024155928.28616-1-trini@konsulko.com>
- In python 3 you must use raw strings for regex as other forms are
deprecated and would require further changes to the pattern here.
In one case this lets us have a simpler match pattern.
- As strings are now Unicode our complex tests (Euro symbol,
SHIFT+ALT+FN 5) we need to declare that as a bytes string and then
decode it for use.
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Changes in v2:
- New patch
---
test/py/tests/test_efi_selftest.py | 36 +++++++++++++++---------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py
index d5430f9c1275..ca01542088f1 100644
--- a/test/py/tests/test_efi_selftest.py
+++ b/test/py/tests/test_efi_selftest.py
@@ -59,7 +59,7 @@ def test_efi_selftest_text_input(u_boot_console):
u_boot_console.run_command(cmd='setenv efi_selftest text input')
output = u_boot_console.run_command(cmd='bootefi selftest',
wait_for_prompt=False)
- m = u_boot_console.p.expect(['To terminate type \'x\''])
+ m = u_boot_console.p.expect([r'To terminate type \'x\''])
if m != 0:
raise Exception('No prompt for \'text input\' test')
u_boot_console.drain_console()
@@ -68,7 +68,7 @@ def test_efi_selftest_text_input(u_boot_console):
u_boot_console.run_command(cmd=chr(4), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 4 \(unknown\), scan code 0 \(Null\)'])
+ [r'Unicode char 4 \(unknown\), scan code 0 \(Null\)'])
if m != 0:
raise Exception('EOT failed in \'text input\' test')
u_boot_console.drain_console()
@@ -76,7 +76,7 @@ def test_efi_selftest_text_input(u_boot_console):
u_boot_console.run_command(cmd=chr(8), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 8 \(BS\), scan code 0 \(Null\)'])
+ [r'Unicode char 8 \(BS\), scan code 0 \(Null\)'])
if m != 0:
raise Exception('BS failed in \'text input\' test')
u_boot_console.drain_console()
@@ -84,7 +84,7 @@ def test_efi_selftest_text_input(u_boot_console):
u_boot_console.run_command(cmd=chr(9), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 9 \(TAB\), scan code 0 \(Null\)'])
+ [r'Unicode char 9 \(TAB\), scan code 0 \(Null\)'])
if m != 0:
raise Exception('BS failed in \'text input\' test')
u_boot_console.drain_console()
@@ -92,7 +92,7 @@ def test_efi_selftest_text_input(u_boot_console):
u_boot_console.run_command(cmd='a', wait_for_echo=False, send_nl=False,
wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 97 \(\'a\'\), scan code 0 \(Null\)'])
+ [r'Unicode char 97 \(\'a\'\), scan code 0 \(Null\)'])
if m != 0:
raise Exception('\'a\' failed in \'text input\' test')
u_boot_console.drain_console()
@@ -100,14 +100,14 @@ def test_efi_selftest_text_input(u_boot_console):
u_boot_console.run_command(cmd=chr(27) + '[A', wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 0 \(Null\), scan code 1 \(Up\)'])
+ [r'Unicode char 0 \(Null\), scan code 1 \(Up\)'])
if m != 0:
raise Exception('UP failed in \'text input\' test')
u_boot_console.drain_console()
# Euro sign
- u_boot_console.run_command(cmd='\xe2\x82\xac', wait_for_echo=False,
+ u_boot_console.run_command(cmd=b'\xe2\x82\xac'.decode(), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
- m = u_boot_console.p.expect(['Unicode char 8364 \(\''])
+ m = u_boot_console.p.expect([r'Unicode char 8364 \(\''])
if m != 0:
raise Exception('Euro sign failed in \'text input\' test')
u_boot_console.drain_console()
@@ -129,7 +129,7 @@ def test_efi_selftest_text_input_ex(u_boot_console):
u_boot_console.run_command(cmd='setenv efi_selftest extended text input')
output = u_boot_console.run_command(cmd='bootefi selftest',
wait_for_prompt=False)
- m = u_boot_console.p.expect(['To terminate type \'CTRL\+x\''])
+ m = u_boot_console.p.expect([r'To terminate type \'CTRL\+x\''])
if m != 0:
raise Exception('No prompt for \'text input\' test')
u_boot_console.drain_console()
@@ -138,7 +138,7 @@ def test_efi_selftest_text_input_ex(u_boot_console):
u_boot_console.run_command(cmd=chr(4), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 100 \\(\'d\'\\), scan code 0 \\(CTRL\\+Null\\)'])
+ [r'Unicode char 100 \(\'d\'\), scan code 0 \(CTRL\+Null\)'])
if m != 0:
raise Exception('EOT failed in \'text input\' test')
u_boot_console.drain_console()
@@ -146,7 +146,7 @@ def test_efi_selftest_text_input_ex(u_boot_console):
u_boot_console.run_command(cmd=chr(8), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 8 \(BS\), scan code 0 \(\+Null\)'])
+ [r'Unicode char 8 \(BS\), scan code 0 \(\+Null\)'])
if m != 0:
raise Exception('BS failed in \'text input\' test')
u_boot_console.drain_console()
@@ -154,7 +154,7 @@ def test_efi_selftest_text_input_ex(u_boot_console):
u_boot_console.run_command(cmd=chr(9), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 9 \(TAB\), scan code 0 \(\+Null\)'])
+ [r'Unicode char 9 \(TAB\), scan code 0 \(\+Null\)'])
if m != 0:
raise Exception('TAB failed in \'text input\' test')
u_boot_console.drain_console()
@@ -162,7 +162,7 @@ def test_efi_selftest_text_input_ex(u_boot_console):
u_boot_console.run_command(cmd='a', wait_for_echo=False, send_nl=False,
wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 97 \(\'a\'\), scan code 0 \(Null\)'])
+ [r'Unicode char 97 \(\'a\'\), scan code 0 \(Null\)'])
if m != 0:
raise Exception('\'a\' failed in \'text input\' test')
u_boot_console.drain_console()
@@ -170,23 +170,23 @@ def test_efi_selftest_text_input_ex(u_boot_console):
u_boot_console.run_command(cmd=chr(27) + '[A', wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 0 \(Null\), scan code 1 \(\+Up\)'])
+ [r'Unicode char 0 \(Null\), scan code 1 \(\+Up\)'])
if m != 0:
raise Exception('UP failed in \'text input\' test')
u_boot_console.drain_console()
# Euro sign
- u_boot_console.run_command(cmd='\xe2\x82\xac', wait_for_echo=False,
+ u_boot_console.run_command(cmd=b'\xe2\x82\xac'.decode(), wait_for_echo=False,
send_nl=False, wait_for_prompt=False)
- m = u_boot_console.p.expect(['Unicode char 8364 \(\''])
+ m = u_boot_console.p.expect([r'Unicode char 8364 \(\''])
if m != 0:
raise Exception('Euro sign failed in \'text input\' test')
u_boot_console.drain_console()
# SHIFT+ALT+FN 5
- u_boot_console.run_command(cmd='\x1b\x5b\x31\x35\x3b\x34\x7e',
+ u_boot_console.run_command(cmd=b'\x1b\x5b\x31\x35\x3b\x34\x7e'.decode(),
wait_for_echo=False, send_nl=False,
wait_for_prompt=False)
m = u_boot_console.p.expect(
- ['Unicode char 0 \(Null\), scan code 15 \(SHIFT\+ALT\+FN 5\)'])
+ [r'Unicode char 0 \(Null\), scan code 15 \(SHIFT\+ALT\+FN 5\)'])
if m != 0:
raise Exception('SHIFT+ALT+FN 5 failed in \'text input\' test')
u_boot_console.drain_console()
--
2.17.1
next prev parent reply other threads:[~2019-10-24 15:59 UTC|newest]
Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 20:53 [U-Boot] [PATCH 00/10] Moving test/py to Python 3 Tom Rini
2019-10-18 20:53 ` [U-Boot] [PATCH 01/10] gitlab-ci: Fix indentation in some stanzas Tom Rini
2019-10-21 15:25 ` Simon Glass
2019-10-18 20:53 ` [U-Boot] [PATCH 02/10] gitlab-ci: Prepend to PATH rather than overwrite it Tom Rini
2019-10-21 15:25 ` Simon Glass
2019-10-18 20:53 ` [U-Boot] [PATCH 03/10] test/py: Fix pytest4 deprecation warnings Tom Rini
2019-10-21 15:25 ` Simon Glass
2019-10-21 15:51 ` Tom Rini
2019-10-18 20:53 ` [U-Boot] [PATCH 04/10] test/py: Automated conversion to Python 3 Tom Rini
2019-10-18 21:12 ` Stephen Warren
2019-10-18 22:08 ` Tom Rini
2019-10-19 5:25 ` Heinrich Schuchardt
2019-10-19 6:13 ` [U-Boot] [RFC v2 4/10] " Heinrich Schuchardt
2019-10-19 11:22 ` Tom Rini
2019-10-19 12:16 ` [U-Boot] [PATCH 04/10] " Tom Rini
2019-10-18 20:53 ` [U-Boot] [PATCH 05/10] test/py: Split mark to multiple lines Tom Rini
2019-10-18 20:53 ` [U-Boot] [PATCH 06/10] test/py: test_ut.py: Ensure we use bytes Tom Rini
2019-10-18 20:53 ` [U-Boot] [PATCH 07/10] test/py: Manual python3 fixes Tom Rini
2019-10-19 6:33 ` Heinrich Schuchardt
2019-10-18 20:53 ` [U-Boot] [PATCH 08/10] WORKAROUND: gitlab-ci: Rework how and when we use virtualenv in order to have python3 Tom Rini
2019-10-18 20:53 ` [U-Boot] [PATCH 09/10] WORKAROUND: test/py: Skip fs tests for now Tom Rini
2019-10-18 21:16 ` Stephen Warren
2019-10-18 22:07 ` Tom Rini
2019-10-18 20:53 ` [U-Boot] [PATCH 10/10] HACK: test.py: Disable EFI " Tom Rini
2019-10-18 21:17 ` Stephen Warren
2019-10-18 21:18 ` [U-Boot] [PATCH 00/10] Moving test/py to Python 3 Stephen Warren
2019-10-23 3:19 ` [U-Boot] [PATCHv2 00/13] " Tom Rini
2019-10-23 3:19 ` [U-Boot] [PATCHv2 01/13] gitlab-ci: Fix indentation in some stanzas Tom Rini
2019-10-23 3:19 ` [U-Boot] [PATCHv2 02/13] gitlab-ci: Prepend to PATH rather than replace it Tom Rini
2019-10-23 3:20 ` [U-Boot] [PATCHv2 03/13] test/py: Split mark to multiple lines Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 04/13] test/py: Fix pytest4 deprecation warnings Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 05/13] test/py: Automated conversion to Python 3 Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 06/13] test/py: Manual python3 fixes Tom Rini
2019-10-23 18:50 ` Stephen Warren
2019-10-23 19:01 ` Tom Rini
2019-10-23 19:27 ` Stephen Warren
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 07/13] test/py: test_ut.py: Ensure we use bytes Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 08/13] test/py: test_efi_selftest.py: Updates for python 3 support Tom Rini
2019-10-23 16:47 ` Stephen Warren
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 09/13] test/py: Update test_fs to decode check_output calls Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 10/13] test/py: Rework test.py to be a different kind of wrapper Tom Rini
2019-10-23 16:55 ` Stephen Warren
2019-10-23 16:58 ` Tom Rini
2019-10-23 17:03 ` Stephen Warren
2019-10-23 17:12 ` Tom Rini
2019-10-23 17:29 ` Stephen Warren
2019-10-23 18:04 ` Stephen Warren
2019-10-23 18:17 ` Tom Rini
2019-10-23 21:11 ` Stephen Warren
2019-10-23 21:37 ` Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 11/13] test/py: Update docs, add requirements.txt for pip Tom Rini
2019-10-23 18:30 ` Stephen Warren
2019-10-23 18:49 ` Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 12/13] gitlab/travis: Rework how and when we use virtualenv in order to use python3 Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-23 3:20 ` [U-Boot] [PATCHv2 13/13] test/py: Use raw strings more to avoid deprecation warnings Tom Rini
2019-10-24 0:59 ` Simon Glass
2019-10-24 15:59 ` [U-Boot] [PATCHv3 00/13] Moving test/py to Python 3 Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 01/13] gitlab-ci: Fix indentation in some stanzas Tom Rini
2019-11-01 13:31 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 02/13] gitlab-ci: Prepend to PATH rather than replace it Tom Rini
2019-11-01 13:31 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 03/13] test/py: Split mark to multiple lines Tom Rini
2019-11-01 13:31 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 04/13] test/py: Fix pytest4 deprecation warnings Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 05/13] test/py: Automated conversion to Python 3 Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 06/13] test/py: Manual python3 fixes Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 07/13] test/py: test_ut.py: Ensure we use bytes Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` Tom Rini [this message]
2019-11-01 13:32 ` [U-Boot] [PATCHv3 08/13] test/py: test_efi_selftest.py: Updates for python 3 support Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 09/13] test/py: Update test_fs to decode check_output calls Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 10/13] test/py: Rework test.py to be a different kind of wrapper Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 11/13] test/py: Update docs, add requirements.txt for pip Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 12/13] gitlab/travis: Rework how and when we use virtualenv in order to use python3 Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 15:59 ` [U-Boot] [PATCHv3 13/13] test/py: Use raw strings more to avoid deprecation warnings Tom Rini
2019-11-01 13:32 ` Tom Rini
2019-10-24 16:01 ` [U-Boot] [PATCH 1/2] Dockerfile: Update to latest bionic tag Tom Rini
2019-10-24 16:01 ` [U-Boot] [PATCH 2/2] Dockerfile: Add python3-pip Tom Rini
2019-10-30 17:02 ` Tom Rini
2019-10-30 17:02 ` [U-Boot] [PATCH 1/2] Dockerfile: Update to latest bionic tag Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191024155928.28616-9-trini@konsulko.com \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox