test/py: Shorten u_boot_console
This fixture name is quite long and results in lots of verbose code.
We know this is U-Boot so the 'u_boot_' part is not necessary.
But it is also a bit of a misnomer, since it provides access to all the
information available to tests. It is not just the console.
It would be too confusing to use con as it would be confused with
config and it is probably too short.
So shorten it to 'ubman'.
Signed-off-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/u-boot/CAFLszTgPa4aT_J9h9pqeTtLCVn4x2JvLWRcWRD8NaN3uoSAtyA@mail.gmail.com/
diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py
index 3343493..ff880ff 100644
--- a/test/py/tests/test_efi_loader.py
+++ b/test/py/tests/test_efi_loader.py
@@ -59,65 +59,65 @@
net_set_up = False
-def test_efi_pre_commands(u_boot_console):
+def test_efi_pre_commands(ubman):
"""Execute any commands required to enable network hardware.
These commands are provided by the boardenv_* file; see the comment at the
beginning of this file.
"""
- init_usb = u_boot_console.config.env.get('env__net_uses_usb', False)
+ init_usb = ubman.config.env.get('env__net_uses_usb', False)
if init_usb:
- u_boot_console.run_command('usb start')
+ ubman.run_command('usb start')
- init_pci = u_boot_console.config.env.get('env__net_uses_pci', False)
+ init_pci = ubman.config.env.get('env__net_uses_pci', False)
if init_pci:
- u_boot_console.run_command('pci enum')
+ ubman.run_command('pci enum')
@pytest.mark.buildconfigspec('cmd_dhcp')
-def test_efi_setup_dhcp(u_boot_console):
+def test_efi_setup_dhcp(ubman):
"""Set up the network using DHCP.
The boardenv_* file may be used to enable/disable this test; see the
comment at the beginning of this file.
"""
- test_dhcp = u_boot_console.config.env.get('env__net_dhcp_server', False)
+ test_dhcp = ubman.config.env.get('env__net_dhcp_server', False)
if not test_dhcp:
- env_vars = u_boot_console.config.env.get('env__net_static_env_vars', None)
+ env_vars = ubman.config.env.get('env__net_static_env_vars', None)
if not env_vars:
pytest.skip('No DHCP server available')
return
- u_boot_console.run_command('setenv autoload no')
- output = u_boot_console.run_command('dhcp')
+ ubman.run_command('setenv autoload no')
+ output = ubman.run_command('dhcp')
assert 'DHCP client bound to address ' in output
global net_set_up
net_set_up = True
@pytest.mark.buildconfigspec('net')
-def test_efi_setup_static(u_boot_console):
+def test_efi_setup_static(ubman):
"""Set up the network using a static IP configuration.
The configuration is provided by the boardenv_* file; see the comment at
the beginning of this file.
"""
- env_vars = u_boot_console.config.env.get('env__net_static_env_vars', None)
+ env_vars = ubman.config.env.get('env__net_static_env_vars', None)
if not env_vars:
- test_dhcp = u_boot_console.config.env.get('env__net_dhcp_server', False)
+ test_dhcp = ubman.config.env.get('env__net_dhcp_server', False)
if not test_dhcp:
pytest.skip('No static network configuration is defined')
return None
for (var, val) in env_vars:
- u_boot_console.run_command('setenv %s %s' % (var, val))
+ ubman.run_command('setenv %s %s' % (var, val))
global net_set_up
net_set_up = True
-def fetch_file(u_boot_console, env_conf, proto):
+def fetch_file(ubman, env_conf, proto):
"""Grab an env described file via TFTP or HTTP and return its address
A file as described by an env config <env_conf> is downloaded from the
@@ -126,13 +126,13 @@
if not net_set_up:
pytest.skip('Network not initialized')
- f = u_boot_console.config.env.get(env_conf, None)
+ f = ubman.config.env.get(env_conf, None)
if not f:
pytest.skip('No %s binary specified in environment' % env_conf)
addr = f.get('addr', None)
if not addr:
- addr = u_boot_utils.find_ram_base(u_boot_console)
+ addr = u_boot_utils.find_ram_base(ubman)
fn = f['fn']
if proto == PROTO_TFTP:
@@ -141,7 +141,7 @@
cmd = 'wget'
else:
assert False
- output = u_boot_console.run_command('%s %x %s' % (cmd, addr, fn))
+ output = ubman.run_command('%s %x %s' % (cmd, addr, fn))
expected_text = 'Bytes transferred = '
sz = f.get('size', None)
if sz:
@@ -152,18 +152,18 @@
if not expected_crc:
return addr
- if u_boot_console.config.buildconfig.get('config_cmd_crc32', 'n') != 'y':
+ if ubman.config.buildconfig.get('config_cmd_crc32', 'n') != 'y':
return addr
- output = u_boot_console.run_command('crc32 %x $filesize' % addr)
+ output = ubman.run_command('crc32 %x $filesize' % addr)
assert expected_crc in output
return addr
-def do_test_efi_helloworld_net(u_boot_console, proto):
- addr = fetch_file(u_boot_console, 'env__efi_loader_helloworld_file', proto)
+def do_test_efi_helloworld_net(ubman, proto):
+ addr = fetch_file(ubman, 'env__efi_loader_helloworld_file', proto)
- output = u_boot_console.run_command('bootefi %x' % addr)
+ output = ubman.run_command('bootefi %x' % addr)
expected_text = 'Hello, world'
assert expected_text in output
expected_text = '## Application failed'
@@ -172,65 +172,65 @@
@pytest.mark.buildconfigspec('of_control')
@pytest.mark.buildconfigspec('bootefi_hello_compile')
@pytest.mark.buildconfigspec('cmd_tftpboot')
-def test_efi_helloworld_net_tftp(u_boot_console):
+def test_efi_helloworld_net_tftp(ubman):
"""Run the helloworld.efi binary via TFTP.
The helloworld.efi file is downloaded from the TFTP server and is executed
using the fallback device tree at $fdtcontroladdr.
"""
- do_test_efi_helloworld_net(u_boot_console, PROTO_TFTP);
+ do_test_efi_helloworld_net(ubman, PROTO_TFTP);
@pytest.mark.buildconfigspec('of_control')
@pytest.mark.buildconfigspec('bootefi_hello_compile')
@pytest.mark.buildconfigspec('cmd_wget')
-def test_efi_helloworld_net_http(u_boot_console):
+def test_efi_helloworld_net_http(ubman):
"""Run the helloworld.efi binary via HTTP.
The helloworld.efi file is downloaded from the HTTP server and is executed
using the fallback device tree at $fdtcontroladdr.
"""
- if u_boot_console.config.env.get('env__efi_helloworld_net_http_test_skip', True):
+ if ubman.config.env.get('env__efi_helloworld_net_http_test_skip', True):
pytest.skip('helloworld.efi HTTP test is not enabled!')
- do_test_efi_helloworld_net(u_boot_console, PROTO_HTTP);
+ do_test_efi_helloworld_net(ubman, PROTO_HTTP);
@pytest.mark.buildconfigspec('cmd_bootefi_hello')
-def test_efi_helloworld_builtin(u_boot_console):
+def test_efi_helloworld_builtin(ubman):
"""Run the builtin helloworld.efi binary.
The helloworld.efi file is included in U-Boot, execute it using the
special "bootefi hello" command.
"""
- output = u_boot_console.run_command('bootefi hello')
+ output = ubman.run_command('bootefi hello')
expected_text = 'Hello, world'
assert expected_text in output
@pytest.mark.buildconfigspec('of_control')
@pytest.mark.buildconfigspec('cmd_bootefi')
@pytest.mark.buildconfigspec('cmd_tftpboot')
-def test_efi_grub_net(u_boot_console):
+def test_efi_grub_net(ubman):
"""Run the grub.efi binary via TFTP.
The grub.efi file is downloaded from the TFTP server and gets
executed.
"""
- addr = fetch_file(u_boot_console, 'env__efi_loader_grub_file', PROTO_TFTP)
+ addr = fetch_file(ubman, 'env__efi_loader_grub_file', PROTO_TFTP)
- u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False)
+ ubman.run_command('bootefi %x' % addr, wait_for_prompt=False)
# Verify that we have an SMBIOS table
- check_smbios = u_boot_console.config.env.get('env__efi_loader_check_smbios', False)
+ check_smbios = ubman.config.env.get('env__efi_loader_check_smbios', False)
if check_smbios:
- u_boot_console.wait_for('grub>')
- u_boot_console.run_command('lsefisystab', wait_for_prompt=False, wait_for_echo=False)
- u_boot_console.wait_for('SMBIOS')
+ ubman.wait_for('grub>')
+ ubman.run_command('lsefisystab', wait_for_prompt=False, wait_for_echo=False)
+ ubman.wait_for('SMBIOS')
# Then exit cleanly
- u_boot_console.wait_for('grub>')
- u_boot_console.run_command('exit', wait_for_prompt=False, wait_for_echo=False)
- u_boot_console.wait_for(u_boot_console.prompt)
+ ubman.wait_for('grub>')
+ ubman.run_command('exit', wait_for_prompt=False, wait_for_echo=False)
+ ubman.wait_for(ubman.prompt)
# And give us our U-Boot prompt back
- u_boot_console.run_command('')
+ ubman.run_command('')