Pull request for UEFI sub-system for efi-2020-04-rc2
Fix pylint issues in Python based tests. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAl47ircACgkQxIHbvCwF GsT/fA/9Eg/lmJheOrj9i0zUjhDlaVi8afccMcdXJHc5ejEqX+IgYau+IXImQOcM oIJ+BgDEbwbWmsUD3zzQwoE2hfSoZJARaHM59YkYmUFuq+h3/a67JsX9aUTJh7c5 k9LRPe9YxJBDACIWbVoQaDOAv8Zus9eWHV+YMRPG0lUNgAq4npI08W0WZD6HxTaE AYmDeUvbbpaPLG8CBsn7C8Y3TXwAkXq7w4r7JtClNrvyFtX4VJJeLW5/C91902Au VYAFLV7ZEtFLXJJv0m/52Li8BgX92Ra4hAmhWJdG7CqiWcB1vxuWoLPOc1jmomPy kei1JRDO1KmZXXqcuvbDdlSq5F2ut9iM28Odhr9IfkNKuW8A3twwtF839iyG+viP Sj/VwUz91fgnOFAe2ICWoWw+jvdx1F6rXTZNqdOiVaGL5VVcLqwtNiMD+C14pJXr 6tHWPKYthmW5fiOj/bMNX3C3yKgPsA8eH7nQiDauEW97kXIP1rgxH0NiSY0dihr2 DvOfxhyzVb6tf0Gajcw1yTeLiiZL1oR23NSwya0EF/hBL+bPt40Y3dM1tF6M4x1A Wd2H4XHSZ8pp3lS6qpTc5iMyQRihq4eoe/qQsWu8ALwEhlHXyhnYGKO6DNbGmY5S u4m0hYwpTP+EiyhsqC49/kLrmi+MN91uuACEHQMxmEO92lDlAME= =Tu0L -----END PGP SIGNATURE----- Merge tag 'efi-2020-04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-04-rc2 Fix pylint issues in Python based tests.
This commit is contained in:
commit
904ea003c1
@ -9,10 +9,6 @@
|
||||
#
|
||||
# Test launching UEFI binaries from FIT images.
|
||||
|
||||
import os.path
|
||||
import pytest
|
||||
import u_boot_utils as util
|
||||
|
||||
"""
|
||||
Note: This test relies on boardenv_* containing configuration values to define
|
||||
which network environment is available for testing. Without this, the parts
|
||||
@ -57,8 +53,12 @@ env__efi_fit_tftp_file = {
|
||||
}
|
||||
"""
|
||||
|
||||
import os.path
|
||||
import pytest
|
||||
import u_boot_utils as util
|
||||
|
||||
# Define the parametrized ITS data to be used for FIT images generation.
|
||||
its_data = '''
|
||||
ITS_DATA = '''
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
@ -101,7 +101,7 @@ its_data = '''
|
||||
'''
|
||||
|
||||
# Define the parametrized FDT data to be used for DTB images generation.
|
||||
fdt_data = '''
|
||||
FDT_DATA = '''
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
@ -199,16 +199,16 @@ def test_efi_fit_launch(u_boot_console):
|
||||
cons.run_command('setenv %s %s' % (var, val))
|
||||
return True
|
||||
|
||||
def make_fpath(fname):
|
||||
def make_fpath(file_name):
|
||||
"""Compute the path of a given (temporary) file.
|
||||
|
||||
Args:
|
||||
fname: The name of a file within U-Boot build dir.
|
||||
file_name: The name of a file within U-Boot build dir.
|
||||
Return:
|
||||
The computed file path.
|
||||
"""
|
||||
|
||||
return os.path.join(cons.config.build_dir, fname)
|
||||
return os.path.join(cons.config.build_dir, file_name)
|
||||
|
||||
def make_efi(fname, comp):
|
||||
"""Create an UEFI binary.
|
||||
@ -225,7 +225,8 @@ def test_efi_fit_launch(u_boot_console):
|
||||
|
||||
bin_path = make_fpath(fname)
|
||||
util.run_and_log(cons,
|
||||
['cp', make_fpath('lib/efi_loader/helloworld.efi'), bin_path])
|
||||
['cp', make_fpath('lib/efi_loader/helloworld.efi'),
|
||||
bin_path])
|
||||
if comp:
|
||||
util.run_and_log(cons, ['gzip', '-f', bin_path])
|
||||
bin_path += '.gz'
|
||||
@ -251,8 +252,8 @@ def test_efi_fit_launch(u_boot_console):
|
||||
|
||||
# Generate a test FDT file.
|
||||
dts = make_fpath('test-efi-fit-%s.dts' % fdt_type)
|
||||
with open(dts, 'w') as fd:
|
||||
fd.write(fdt_data % fdt_params)
|
||||
with open(dts, 'w') as file:
|
||||
file.write(FDT_DATA % fdt_params)
|
||||
|
||||
# Build the test FDT.
|
||||
dtb = make_fpath('test-efi-fit-%s.dtb' % fdt_type)
|
||||
@ -284,65 +285,65 @@ def test_efi_fit_launch(u_boot_console):
|
||||
|
||||
# Generate a test ITS file.
|
||||
its_path = make_fpath('test-efi-fit-helloworld.its')
|
||||
with open(its_path, 'w') as fd:
|
||||
fd.write(its_data % its_params)
|
||||
with open(its_path, 'w') as file:
|
||||
file.write(ITS_DATA % its_params)
|
||||
|
||||
# Build the test ITS.
|
||||
fit_path = make_fpath('test-efi-fit-helloworld.fit')
|
||||
util.run_and_log(
|
||||
cons, [make_fpath('tools/mkimage'), '-f', its_path, fit_path])
|
||||
cons, [make_fpath('tools/mkimage'), '-f', its_path, fit_path])
|
||||
return fit_path
|
||||
|
||||
def load_fit_from_host(f):
|
||||
def load_fit_from_host(fit):
|
||||
"""Load the FIT image using the 'host load' command and return its address.
|
||||
|
||||
Args:
|
||||
f: Dictionary describing the FIT image to load, see env__efi_fit_test_file
|
||||
in the comment at the beginning of this file.
|
||||
fit: Dictionary describing the FIT image to load, see env__efi_fit_test_file
|
||||
in the comment at the beginning of this file.
|
||||
Return:
|
||||
The address where the file has been loaded.
|
||||
"""
|
||||
|
||||
addr = f.get('addr', None)
|
||||
addr = fit.get('addr', None)
|
||||
if not addr:
|
||||
addr = util.find_ram_base(cons)
|
||||
|
||||
output = cons.run_command(
|
||||
'host load hostfs - %x %s/%s' % (addr, f['dn'], f['fn']))
|
||||
'host load hostfs - %x %s/%s' % (addr, fit['dn'], fit['fn']))
|
||||
expected_text = ' bytes read'
|
||||
sz = f.get('size', None)
|
||||
if sz:
|
||||
expected_text = '%d' % sz + expected_text
|
||||
assert(expected_text in output)
|
||||
size = fit.get('size', None)
|
||||
if size:
|
||||
expected_text = '%d' % size + expected_text
|
||||
assert expected_text in output
|
||||
|
||||
return addr
|
||||
|
||||
def load_fit_from_tftp(f):
|
||||
def load_fit_from_tftp(fit):
|
||||
"""Load the FIT image using the tftpboot command and return its address.
|
||||
|
||||
The file is downloaded from the TFTP server, its size and optionally its
|
||||
CRC32 are validated.
|
||||
|
||||
Args:
|
||||
f: Dictionary describing the FIT image to load, see env__efi_fit_tftp_file
|
||||
in the comment at the beginning of this file.
|
||||
fit: Dictionary describing the FIT image to load, see env__efi_fit_tftp_file
|
||||
in the comment at the beginning of this file.
|
||||
Return:
|
||||
The address where the file has been loaded.
|
||||
"""
|
||||
|
||||
addr = f.get('addr', None)
|
||||
addr = fit.get('addr', None)
|
||||
if not addr:
|
||||
addr = util.find_ram_base(cons)
|
||||
|
||||
fn = f['fn']
|
||||
output = cons.run_command('tftpboot %x %s' % (addr, fn))
|
||||
file_name = fit['fn']
|
||||
output = cons.run_command('tftpboot %x %s' % (addr, file_name))
|
||||
expected_text = 'Bytes transferred = '
|
||||
sz = f.get('size', None)
|
||||
if sz:
|
||||
expected_text += '%d' % sz
|
||||
size = fit.get('size', None)
|
||||
if size:
|
||||
expected_text += '%d' % size
|
||||
assert expected_text in output
|
||||
|
||||
expected_crc = f.get('crc32', None)
|
||||
expected_crc = fit.get('crc32', None)
|
||||
if not expected_crc:
|
||||
return addr
|
||||
|
||||
@ -398,8 +399,8 @@ def test_efi_fit_launch(u_boot_console):
|
||||
if not fit:
|
||||
pytest.skip('No env__efi_fit_tftp_file binary specified in environment')
|
||||
|
||||
sz = fit.get('size', None)
|
||||
if not sz:
|
||||
size = fit.get('size', None)
|
||||
if not size:
|
||||
if not fit.get('dn', None):
|
||||
pytest.skip('Neither "size", nor "dn" info provided in env__efi_fit_tftp_file')
|
||||
|
||||
@ -420,12 +421,12 @@ def test_efi_fit_launch(u_boot_console):
|
||||
|
||||
# Try booting.
|
||||
cons.run_command(
|
||||
'bootm %x#%s' % (addr, fit_config), wait_for_prompt=False)
|
||||
'bootm %x#%s' % (addr, fit_config), wait_for_prompt=False)
|
||||
if enable_fdt:
|
||||
cons.wait_for('Booting using the fdt blob')
|
||||
cons.wait_for('Hello, world')
|
||||
cons.wait_for('## Application terminated, r = 0')
|
||||
cons.restart_uboot();
|
||||
cons.restart_uboot()
|
||||
|
||||
cons = u_boot_console
|
||||
# Array slice removes leading/trailing quotes.
|
||||
|
@ -1,198 +1,211 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (c) 2017, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
|
||||
# Test efi API implementation
|
||||
"""
|
||||
Test UEFI API implementation
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import u_boot_utils
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
|
||||
def test_efi_selftest(u_boot_console):
|
||||
"""Test the UEFI implementation
|
||||
"""Run UEFI unit tests
|
||||
|
||||
:param u_boot_console: U-Boot console
|
||||
:param u_boot_console: U-Boot console
|
||||
|
||||
This function executes all selftests that are not marked as on request.
|
||||
"""
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest')
|
||||
u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
|
||||
if m != 0:
|
||||
raise Exception('Failures occurred during the EFI selftest')
|
||||
u_boot_console.restart_uboot();
|
||||
This function executes all selftests that are not marked as on request.
|
||||
"""
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest')
|
||||
u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
|
||||
if m != 0:
|
||||
raise Exception('Failures occurred during the EFI selftest')
|
||||
u_boot_console.restart_uboot()
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
|
||||
@pytest.mark.buildconfigspec('of_control')
|
||||
@pytest.mark.notbuildconfigspec('generate_acpi_table')
|
||||
def test_efi_selftest_device_tree(u_boot_console):
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest list')
|
||||
output = u_boot_console.run_command('bootefi selftest')
|
||||
assert '\'device tree\'' in output
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest device tree')
|
||||
u_boot_console.run_command(cmd='setenv -f serial# Testing DT')
|
||||
u_boot_console.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['serial-number: Testing DT', 'U-Boot'])
|
||||
if m != 0:
|
||||
raise Exception('serial-number missing in device tree')
|
||||
u_boot_console.restart_uboot();
|
||||
"""Test the device tree support in the UEFI sub-system
|
||||
|
||||
:param u_boot_console: U-Boot console
|
||||
|
||||
This test executes the UEFI unit test by calling 'bootefi selftest'.
|
||||
"""
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest list')
|
||||
output = u_boot_console.run_command('bootefi selftest')
|
||||
assert '\'device tree\'' in output
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest device tree')
|
||||
u_boot_console.run_command(cmd='setenv -f serial# Testing DT')
|
||||
u_boot_console.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['serial-number: Testing DT', 'U-Boot'])
|
||||
if m != 0:
|
||||
raise Exception('serial-number missing in device tree')
|
||||
u_boot_console.restart_uboot()
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
|
||||
def test_efi_selftest_watchdog_reboot(u_boot_console):
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest list')
|
||||
output = u_boot_console.run_command('bootefi selftest')
|
||||
assert '\'watchdog reboot\'' in output
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest watchdog reboot')
|
||||
u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['resetting', 'U-Boot'])
|
||||
if m != 0:
|
||||
raise Exception('Reset failed in \'watchdog reboot\' test')
|
||||
u_boot_console.restart_uboot();
|
||||
"""Test the watchdog timer
|
||||
|
||||
:param u_boot_console: U-Boot console
|
||||
|
||||
This function executes the 'watchdog reboot' unit test.
|
||||
"""
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest list')
|
||||
output = u_boot_console.run_command('bootefi selftest')
|
||||
assert '\'watchdog reboot\'' in output
|
||||
u_boot_console.run_command(cmd='setenv efi_selftest watchdog reboot')
|
||||
u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['resetting', 'U-Boot'])
|
||||
if m != 0:
|
||||
raise Exception('Reset failed in \'watchdog reboot\' test')
|
||||
u_boot_console.restart_uboot()
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
|
||||
def test_efi_selftest_text_input(u_boot_console):
|
||||
"""Test the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
|
||||
"""Test the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
|
||||
|
||||
:param u_boot_console: U-Boot console
|
||||
:param u_boot_console: U-Boot console
|
||||
|
||||
This function calls the text input EFI selftest.
|
||||
"""
|
||||
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([r'To terminate type \'x\''])
|
||||
if m != 0:
|
||||
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)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# BS
|
||||
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(
|
||||
[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()
|
||||
# TAB
|
||||
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(
|
||||
[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()
|
||||
# a
|
||||
u_boot_console.run_command(cmd='a', wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# UP escape sequence
|
||||
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(
|
||||
[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=b'\xe2\x82\xac'.decode(), wait_for_echo=False,
|
||||
send_nl=False, wait_for_prompt=False)
|
||||
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()
|
||||
u_boot_console.run_command(cmd='x', wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
|
||||
if m != 0:
|
||||
raise Exception('Failures occurred during the EFI selftest')
|
||||
u_boot_console.restart_uboot();
|
||||
This function calls the text input EFI selftest.
|
||||
"""
|
||||
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([r'To terminate type \'x\''])
|
||||
if m != 0:
|
||||
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)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# BS
|
||||
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(
|
||||
[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()
|
||||
# TAB
|
||||
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(
|
||||
[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()
|
||||
# a
|
||||
u_boot_console.run_command(cmd='a', wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# UP escape sequence
|
||||
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(
|
||||
[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=b'\xe2\x82\xac'.decode(), wait_for_echo=False,
|
||||
send_nl=False, wait_for_prompt=False)
|
||||
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()
|
||||
u_boot_console.run_command(cmd='x', wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
|
||||
if m != 0:
|
||||
raise Exception('Failures occurred during the EFI selftest')
|
||||
u_boot_console.restart_uboot()
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
|
||||
def test_efi_selftest_text_input_ex(u_boot_console):
|
||||
"""Test the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
|
||||
"""Test the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
|
||||
|
||||
:param u_boot_console: U-Boot console
|
||||
:param u_boot_console: U-Boot console
|
||||
|
||||
This function calls the extended text input EFI selftest.
|
||||
"""
|
||||
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([r'To terminate type \'CTRL\+x\''])
|
||||
if m != 0:
|
||||
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)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# BS
|
||||
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(
|
||||
[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()
|
||||
# TAB
|
||||
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(
|
||||
[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()
|
||||
# a
|
||||
u_boot_console.run_command(cmd='a', wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# UP escape sequence
|
||||
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(
|
||||
[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=b'\xe2\x82\xac'.decode(), wait_for_echo=False,
|
||||
send_nl=False, wait_for_prompt=False)
|
||||
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=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(
|
||||
[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()
|
||||
u_boot_console.run_command(cmd=chr(24), wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
|
||||
if m != 0:
|
||||
raise Exception('Failures occurred during the EFI selftest')
|
||||
u_boot_console.restart_uboot();
|
||||
This function calls the extended text input EFI selftest.
|
||||
"""
|
||||
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([r'To terminate type \'CTRL\+x\''])
|
||||
if m != 0:
|
||||
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)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# BS
|
||||
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(
|
||||
[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()
|
||||
# TAB
|
||||
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(
|
||||
[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()
|
||||
# a
|
||||
u_boot_console.run_command(cmd='a', wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(
|
||||
[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()
|
||||
# UP escape sequence
|
||||
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(
|
||||
[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=b'\xe2\x82\xac'.decode(), wait_for_echo=False,
|
||||
send_nl=False, wait_for_prompt=False)
|
||||
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=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(
|
||||
[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()
|
||||
u_boot_console.run_command(cmd=chr(24), wait_for_echo=False, send_nl=False,
|
||||
wait_for_prompt=False)
|
||||
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
|
||||
if m != 0:
|
||||
raise Exception('Failures occurred during the EFI selftest')
|
||||
u_boot_console.restart_uboot()
|
||||
|
Loading…
Reference in New Issue
Block a user