All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] test: restore timeout after bootmenu unit test
@ 2022-05-09 20:08 Heinrich Schuchardt
  2022-05-09 20:15 ` [PATCH 2/2] test: don't change console timeout in EFI selftest Heinrich Schuchardt
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2022-05-09 20:08 UTC (permalink / raw)
  To: u-boot; +Cc: Masahisa Kojima, Heinrich Schuchardt

In the bootmenu unit test the console timeout is set to 500 ms.
Other tests rely on the original timeout. Ensure that the original value
is restored.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 test/py/tests/test_bootmenu.py | 66 +++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/test/py/tests/test_bootmenu.py b/test/py/tests/test_bootmenu.py
index b4baa534aa..70f51de699 100644
--- a/test/py/tests/test_bootmenu.py
+++ b/test/py/tests/test_bootmenu.py
@@ -11,36 +11,36 @@ def test_bootmenu(u_boot_console):
     u_boot_console -- U-Boot console
     """
 
-    u_boot_console.p.timeout = 500
-    u_boot_console.run_command('setenv bootmenu_default 1')
-    u_boot_console.run_command('setenv bootmenu_0 test 1=echo ok 1')
-    u_boot_console.run_command('setenv bootmenu_1 test 2=echo ok 2')
-    u_boot_console.run_command('setenv bootmenu_2 test 3=echo ok 3')
-    u_boot_console.run_command('bootmenu 2', wait_for_prompt=False)
-    for i in ('U-Boot Boot Menu', 'test 1', 'test 2', 'test 3', 'autoboot'):
-        u_boot_console.p.expect([i])
-    # Press enter key to execute default entry
-    response = u_boot_console.run_command(cmd='\x0d', wait_for_echo=False, send_nl=False)
-    assert 'ok 2' in response
-    u_boot_console.run_command('bootmenu 2', wait_for_prompt=False)
-    u_boot_console.p.expect(['autoboot'])
-    # Press up key to select prior entry followed by the enter key
-    response = u_boot_console.run_command(cmd='\x1b\x5b\x41\x0d', wait_for_echo=False,
-                                          send_nl=False)
-    assert 'ok 1' in response
-    u_boot_console.run_command('bootmenu 2', wait_for_prompt=False)
-    u_boot_console.p.expect(['autoboot'])
-    # Press down key to select next entry followed by the enter key
-    response = u_boot_console.run_command(cmd='\x1b\x5b\x42\x0d', wait_for_echo=False,
-                                          send_nl=False)
-    assert 'ok 3' in response
-    u_boot_console.run_command('bootmenu 2; echo rc:$?', wait_for_prompt=False)
-    u_boot_console.p.expect(['autoboot'])
-    # Press the escape key
-    response = u_boot_console.run_command(cmd='\x1b', wait_for_echo=False, send_nl=False)
-    assert 'ok' not in response
-    assert 'rc:0' in response
-    u_boot_console.run_command('setenv bootmenu_default')
-    u_boot_console.run_command('setenv bootmenu_0')
-    u_boot_console.run_command('setenv bootmenu_1')
-    u_boot_console.run_command('setenv bootmenu_2')
+    with u_boot_console.temporary_timeout(500):
+        u_boot_console.run_command('setenv bootmenu_default 1')
+        u_boot_console.run_command('setenv bootmenu_0 test 1=echo ok 1')
+        u_boot_console.run_command('setenv bootmenu_1 test 2=echo ok 2')
+        u_boot_console.run_command('setenv bootmenu_2 test 3=echo ok 3')
+        u_boot_console.run_command('bootmenu 2', wait_for_prompt=False)
+        for i in ('U-Boot Boot Menu', 'test 1', 'test 2', 'test 3', 'autoboot'):
+            u_boot_console.p.expect([i])
+        # Press enter key to execute default entry
+        response = u_boot_console.run_command(cmd='\x0d', wait_for_echo=False, send_nl=False)
+        assert 'ok 2' in response
+        u_boot_console.run_command('bootmenu 2', wait_for_prompt=False)
+        u_boot_console.p.expect(['autoboot'])
+        # Press up key to select prior entry followed by the enter key
+        response = u_boot_console.run_command(cmd='\x1b\x5b\x41\x0d', wait_for_echo=False,
+                                              send_nl=False)
+        assert 'ok 1' in response
+        u_boot_console.run_command('bootmenu 2', wait_for_prompt=False)
+        u_boot_console.p.expect(['autoboot'])
+        # Press down key to select next entry followed by the enter key
+        response = u_boot_console.run_command(cmd='\x1b\x5b\x42\x0d', wait_for_echo=False,
+                                              send_nl=False)
+        assert 'ok 3' in response
+        u_boot_console.run_command('bootmenu 2; echo rc:$?', wait_for_prompt=False)
+        u_boot_console.p.expect(['autoboot'])
+        # Press the escape key
+        response = u_boot_console.run_command(cmd='\x1b', wait_for_echo=False, send_nl=False)
+        assert 'ok' not in response
+        assert 'rc:0' in response
+        u_boot_console.run_command('setenv bootmenu_default')
+        u_boot_console.run_command('setenv bootmenu_0')
+        u_boot_console.run_command('setenv bootmenu_1')
+        u_boot_console.run_command('setenv bootmenu_2')
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] test: don't change console timeout in EFI selftest.
  2022-05-09 20:08 [PATCH 1/2] test: restore timeout after bootmenu unit test Heinrich Schuchardt
@ 2022-05-09 20:15 ` Heinrich Schuchardt
  0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2022-05-09 20:15 UTC (permalink / raw)
  To: u-boot; +Cc: Heinrich Schuchardt

Changing the console timeout to 500 ms without restoring the original value
leads to failures in other tests. As the console timeout change is not
necessary for the text input protocol tests remove it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 test/py/tests/test_efi_selftest.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py
index 5257f7a433..e92d63cde6 100644
--- a/test/py/tests/test_efi_selftest.py
+++ b/test/py/tests/test_efi_selftest.py
@@ -73,7 +73,6 @@ def test_efi_selftest_text_input(u_boot_console):
     if u_boot_console.p.expect([r'To terminate type \'x\'']):
         raise Exception('No prompt for \'text input\' test')
     u_boot_console.drain_console()
-    u_boot_console.p.timeout = 500
     # EOT
     u_boot_console.run_command(cmd=chr(4), wait_for_echo=False,
                                send_nl=False, wait_for_prompt=False)
@@ -129,7 +128,6 @@ def test_efi_selftest_text_input_ex(u_boot_console):
     if u_boot_console.p.expect([r'To terminate type \'CTRL\+x\'']):
         raise Exception('No prompt for \'text input\' test')
     u_boot_console.drain_console()
-    u_boot_console.p.timeout = 500
     # EOT
     u_boot_console.run_command(cmd=chr(4), wait_for_echo=False,
                                send_nl=False, wait_for_prompt=False)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-09 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 20:08 [PATCH 1/2] test: restore timeout after bootmenu unit test Heinrich Schuchardt
2022-05-09 20:15 ` [PATCH 2/2] test: don't change console timeout in EFI selftest Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.