mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 14:56:03 +00:00
test/py: test_efi_loader: add HTTP (wget) test for the EFI loader
Add a test to test_efi_loader.py similar to the TFTP test but for HTTP with the wget command. Suggested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Tom Rini <trini@konsulko.com> Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
This commit is contained in:
parent
9f8c10c7ab
commit
d2056e2ed0
1 changed files with 46 additions and 16 deletions
|
@ -45,11 +45,18 @@ env__efi_loader_helloworld_file = {
|
||||||
'crc32': 'c2244b26', # CRC32 check sum
|
'crc32': 'c2244b26', # CRC32 check sum
|
||||||
'addr': 0x40400000, # load address
|
'addr': 0x40400000, # load address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# False if the helloworld EFI over HTTP boot test should be performed.
|
||||||
|
# If HTTP boot testing is not possible or desired, set this variable to True or
|
||||||
|
# ommit it.
|
||||||
|
env__efi_helloworld_net_http_test_skip = True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import u_boot_utils
|
import u_boot_utils
|
||||||
|
|
||||||
|
PROTO_TFTP, PROTO_HTTP = range(0, 2)
|
||||||
|
|
||||||
net_set_up = False
|
net_set_up = False
|
||||||
|
|
||||||
def test_efi_pre_commands(u_boot_console):
|
def test_efi_pre_commands(u_boot_console):
|
||||||
|
@ -110,10 +117,10 @@ def test_efi_setup_static(u_boot_console):
|
||||||
global net_set_up
|
global net_set_up
|
||||||
net_set_up = True
|
net_set_up = True
|
||||||
|
|
||||||
def fetch_tftp_file(u_boot_console, env_conf):
|
def fetch_file(u_boot_console, env_conf, proto):
|
||||||
"""Grab an env described file via TFTP and return its address
|
"""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 TFTP
|
A file as described by an env config <env_conf> is downloaded from the
|
||||||
server. The address to that file is returned.
|
server. The address to that file is returned.
|
||||||
"""
|
"""
|
||||||
if not net_set_up:
|
if not net_set_up:
|
||||||
|
@ -128,7 +135,13 @@ def fetch_tftp_file(u_boot_console, env_conf):
|
||||||
addr = u_boot_utils.find_ram_base(u_boot_console)
|
addr = u_boot_utils.find_ram_base(u_boot_console)
|
||||||
|
|
||||||
fn = f['fn']
|
fn = f['fn']
|
||||||
output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
|
if proto == PROTO_TFTP:
|
||||||
|
cmd = 'tftpboot'
|
||||||
|
elif proto == PROTO_HTTP:
|
||||||
|
cmd = 'wget'
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
|
output = u_boot_console.run_command('%s %x %s' % (cmd, addr, fn))
|
||||||
expected_text = 'Bytes transferred = '
|
expected_text = 'Bytes transferred = '
|
||||||
sz = f.get('size', None)
|
sz = f.get('size', None)
|
||||||
if sz:
|
if sz:
|
||||||
|
@ -147,17 +160,8 @@ def fetch_tftp_file(u_boot_console, env_conf):
|
||||||
|
|
||||||
return addr
|
return addr
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('of_control')
|
def do_test_efi_helloworld_net(u_boot_console, proto):
|
||||||
@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
|
addr = fetch_file(u_boot_console, 'env__efi_loader_helloworld_file', proto)
|
||||||
@pytest.mark.buildconfigspec('cmd_tftpboot')
|
|
||||||
def test_efi_helloworld_net(u_boot_console):
|
|
||||||
"""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.
|
|
||||||
"""
|
|
||||||
|
|
||||||
addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_helloworld_file')
|
|
||||||
|
|
||||||
output = u_boot_console.run_command('bootefi %x' % addr)
|
output = u_boot_console.run_command('bootefi %x' % addr)
|
||||||
expected_text = 'Hello, world'
|
expected_text = 'Hello, world'
|
||||||
|
@ -165,6 +169,32 @@ def test_efi_helloworld_net(u_boot_console):
|
||||||
expected_text = '## Application failed'
|
expected_text = '## Application failed'
|
||||||
assert expected_text not in output
|
assert expected_text not in output
|
||||||
|
|
||||||
|
@pytest.mark.buildconfigspec('of_control')
|
||||||
|
@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
|
||||||
|
@pytest.mark.buildconfigspec('cmd_tftpboot')
|
||||||
|
def test_efi_helloworld_net_tftp(u_boot_console):
|
||||||
|
"""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);
|
||||||
|
|
||||||
|
@pytest.mark.buildconfigspec('of_control')
|
||||||
|
@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
|
||||||
|
@pytest.mark.buildconfigspec('cmd_wget')
|
||||||
|
def test_efi_helloworld_net_http(u_boot_console):
|
||||||
|
"""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):
|
||||||
|
pytest.skip('helloworld.efi HTTP test is not enabled!')
|
||||||
|
|
||||||
|
do_test_efi_helloworld_net(u_boot_console, PROTO_HTTP);
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('cmd_bootefi_hello')
|
@pytest.mark.buildconfigspec('cmd_bootefi_hello')
|
||||||
def test_efi_helloworld_builtin(u_boot_console):
|
def test_efi_helloworld_builtin(u_boot_console):
|
||||||
"""Run the builtin helloworld.efi binary.
|
"""Run the builtin helloworld.efi binary.
|
||||||
|
@ -187,7 +217,7 @@ def test_efi_grub_net(u_boot_console):
|
||||||
executed.
|
executed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_grub_file')
|
addr = fetch_file(u_boot_console, 'env__efi_loader_grub_file', PROTO_TFTP)
|
||||||
|
|
||||||
u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False)
|
u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue