aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-05-09 21:59:13 +0200
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-05-28 10:59:27 +0200
commit018b993bba98cf98cc28c940889b13b791882111 (patch)
tree2701f826ab332d3e94685295a6775b9e8f4456ab
parent1291c2d446e193824b0952e46dacbd2ea6da62ea (diff)
downloadu-boot-018b993bba98cf98cc28c940889b13b791882111.zip
u-boot-018b993bba98cf98cc28c940889b13b791882111.tar.gz
u-boot-018b993bba98cf98cc28c940889b13b791882111.tar.bz2
test: restore timeout after bootmenu unit test
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>
-rw-r--r--test/py/tests/test_bootmenu.py66
1 files changed, 33 insertions, 33 deletions
diff --git a/test/py/tests/test_bootmenu.py b/test/py/tests/test_bootmenu.py
index b4baa53..70f51de 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')