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/
This commit is contained in:
Simon Glass
2025-02-09 09:07:14 -07:00
parent 00dfb7038e
commit 752c376987
105 changed files with 2676 additions and 2676 deletions

View File

@@ -24,34 +24,34 @@ temp_addr2 = 0x90002000
@pytest.mark.buildconfigspec('cmd_avb')
@pytest.mark.buildconfigspec('cmd_mmc')
def test_avb_verify(u_boot_console):
def test_avb_verify(ubman):
"""Run AVB 2.0 boot verification chain with avb subset of commands
"""
success_str = "Verification passed successfully"
response = u_boot_console.run_command('avb init %s' %str(mmc_dev))
response = ubman.run_command('avb init %s' %str(mmc_dev))
assert response == ''
response = u_boot_console.run_command('avb verify')
response = ubman.run_command('avb verify')
assert response.find(success_str)
@pytest.mark.buildconfigspec('cmd_avb')
@pytest.mark.buildconfigspec('cmd_mmc')
@pytest.mark.notbuildconfigspec('sandbox')
def test_avb_mmc_uuid(u_boot_console):
def test_avb_mmc_uuid(ubman):
"""Check if 'avb get_uuid' works, compare results with
'part list mmc 1' output
"""
response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
response = ubman.run_command('avb init %s' % str(mmc_dev))
assert response == ''
response = u_boot_console.run_command('mmc rescan; mmc dev %s' %
response = ubman.run_command('mmc rescan; mmc dev %s' %
str(mmc_dev))
assert response.find('is current device')
part_lines = u_boot_console.run_command('mmc part').splitlines()
part_lines = ubman.run_command('mmc part').splitlines()
part_list = {}
cur_partname = ''
@@ -67,72 +67,72 @@ def test_avb_mmc_uuid(u_boot_console):
# lets check all guids with avb get_guid
for part, guid in part_list.items():
avb_guid_resp = u_boot_console.run_command('avb get_uuid %s' % part)
avb_guid_resp = ubman.run_command('avb get_uuid %s' % part)
assert guid == avb_guid_resp.split('UUID: ')[1]
@pytest.mark.buildconfigspec('cmd_avb')
def test_avb_read_rb(u_boot_console):
def test_avb_read_rb(ubman):
"""Test reading rollback indexes
"""
response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
response = ubman.run_command('avb init %s' % str(mmc_dev))
assert response == ''
response = u_boot_console.run_command('avb read_rb 1')
response = ubman.run_command('avb read_rb 1')
assert response == 'Rollback index: 0'
@pytest.mark.buildconfigspec('cmd_avb')
def test_avb_is_unlocked(u_boot_console):
def test_avb_is_unlocked(ubman):
"""Test if device is in the unlocked state
"""
response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
response = ubman.run_command('avb init %s' % str(mmc_dev))
assert response == ''
response = u_boot_console.run_command('avb is_unlocked')
response = ubman.run_command('avb is_unlocked')
assert response == 'Unlocked = 1'
@pytest.mark.buildconfigspec('cmd_avb')
@pytest.mark.buildconfigspec('cmd_mmc')
@pytest.mark.notbuildconfigspec('sandbox')
def test_avb_mmc_read(u_boot_console):
def test_avb_mmc_read(ubman):
"""Test mmc read operation
"""
response = u_boot_console.run_command('mmc rescan; mmc dev %s 0' %
response = ubman.run_command('mmc rescan; mmc dev %s 0' %
str(mmc_dev))
assert response.find('is current device')
response = u_boot_console.run_command('mmc read 0x%x 0x100 0x1' % temp_addr)
response = ubman.run_command('mmc read 0x%x 0x100 0x1' % temp_addr)
assert response.find('read: OK')
response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
response = ubman.run_command('avb init %s' % str(mmc_dev))
assert response == ''
response = u_boot_console.run_command('avb read_part xloader 0 100 0x%x' %
response = ubman.run_command('avb read_part xloader 0 100 0x%x' %
temp_addr2)
assert response.find('Read 512 bytes')
# Now lets compare two buffers
response = u_boot_console.run_command('cmp 0x%x 0x%x 40' %
response = ubman.run_command('cmp 0x%x 0x%x 40' %
(temp_addr, temp_addr2))
assert response.find('64 word')
@pytest.mark.buildconfigspec('cmd_avb')
@pytest.mark.buildconfigspec('optee_ta_avb')
def test_avb_persistent_values(u_boot_console):
def test_avb_persistent_values(ubman):
"""Test reading/writing persistent storage to avb
"""
response = u_boot_console.run_command('avb init %s' % str(mmc_dev))
response = ubman.run_command('avb init %s' % str(mmc_dev))
assert response == ''
response = u_boot_console.run_command('avb write_pvalue test value_value')
response = ubman.run_command('avb write_pvalue test value_value')
assert response == 'Wrote 12 bytes'
response = u_boot_console.run_command('avb read_pvalue test 12')
response = ubman.run_command('avb read_pvalue test 12')
assert response == 'Read 12 bytes, value = value_value'