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_tpm2.py b/test/py/tests/test_tpm2.py
index 75f5d31..47e0e7a 100644
--- a/test/py/tests/test_tpm2.py
+++ b/test/py/tests/test_tpm2.py
@@ -31,24 +31,24 @@
 
 updates = 0
 
-def force_init(u_boot_console, force=False):
+def force_init(ubman, force=False):
     """When a test fails, U-Boot is reset. Because TPM stack must be initialized
     after each reboot, we must ensure these lines are always executed before
     trying any command or they will fail with no reason. Executing 'tpm init'
     twice will spawn an error used to detect that the TPM was not reset and no
     initialization code should be run.
     """
-    skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
+    skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
     if skip_test:
         pytest.skip('skip TPM device test')
-    output = u_boot_console.run_command('tpm2 autostart')
+    output = ubman.run_command('tpm2 autostart')
     if force or not 'Error' in output:
-        u_boot_console.run_command('echo --- start of init ---')
-        u_boot_console.run_command('tpm2 clear TPM2_RH_LOCKOUT')
-        output = u_boot_console.run_command('echo $?')
+        ubman.run_command('echo --- start of init ---')
+        ubman.run_command('tpm2 clear TPM2_RH_LOCKOUT')
+        output = ubman.run_command('echo $?')
         if not output.endswith('0'):
-            u_boot_console.run_command('tpm2 clear TPM2_RH_PLATFORM')
-        u_boot_console.run_command('echo --- end of init ---')
+            ubman.run_command('tpm2 clear TPM2_RH_PLATFORM')
+        ubman.run_command('echo --- end of init ---')
 
 def is_sandbox(cons):
     # Array slice removes leading/trailing quotes.
@@ -56,84 +56,84 @@
     return sys_arch == 'sandbox'
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_init(u_boot_console):
+def test_tpm2_init(ubman):
     """Init the software stack to use TPMv2 commands."""
-    skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
+    skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
     if skip_test:
         pytest.skip('skip TPM device test')
-    u_boot_console.run_command('tpm2 autostart')
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 autostart')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_startup(u_boot_console):
+def test_tpm2_startup(ubman):
     """Execute a TPM2_Startup command.
 
     Initiate the TPM internal state machine.
     """
-    skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
+    skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
     if skip_test:
         pytest.skip('skip TPM device test')
-    u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR')
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 startup TPM2_SU_CLEAR')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
-def tpm2_sandbox_init(u_boot_console):
+def tpm2_sandbox_init(ubman):
     """Put sandbox back into a known state so we can run a test
 
     This allows all tests to run in parallel, since no test depends on another.
     """
-    u_boot_console.restart_uboot()
-    u_boot_console.run_command('tpm2 autostart')
-    output = u_boot_console.run_command('echo $?')
+    ubman.restart_uboot()
+    ubman.run_command('tpm2 autostart')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
-    skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
+    skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
     if skip_test:
         pytest.skip('skip TPM device test')
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_sandbox_self_test_full(u_boot_console):
+def test_tpm2_sandbox_self_test_full(ubman):
     """Execute a TPM2_SelfTest (full) command.
 
     Ask the TPM to perform all self tests to also enable full capabilities.
     """
-    if is_sandbox(u_boot_console):
-        u_boot_console.restart_uboot()
-        u_boot_console.run_command('tpm2 autostart')
-        output = u_boot_console.run_command('echo $?')
+    if is_sandbox(ubman):
+        ubman.restart_uboot()
+        ubman.run_command('tpm2 autostart')
+        output = ubman.run_command('echo $?')
         assert output.endswith('0')
 
-        u_boot_console.run_command('tpm2 startup TPM2_SU_CLEAR')
-        output = u_boot_console.run_command('echo $?')
+        ubman.run_command('tpm2 startup TPM2_SU_CLEAR')
+        output = ubman.run_command('echo $?')
         assert output.endswith('0')
 
-    skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
+    skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
     if skip_test:
         pytest.skip('skip TPM device test')
-    u_boot_console.run_command('tpm2 self_test full')
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 self_test full')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_continue_self_test(u_boot_console):
+def test_tpm2_continue_self_test(ubman):
     """Execute a TPM2_SelfTest (continued) command.
 
     Ask the TPM to finish its self tests (alternative to the full test) in order
     to enter a fully operational state.
     """
 
-    skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
+    skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
     if skip_test:
         pytest.skip('skip TPM device test')
-    if is_sandbox(u_boot_console):
-        tpm2_sandbox_init(u_boot_console)
-    u_boot_console.run_command('tpm2 self_test continue')
-    output = u_boot_console.run_command('echo $?')
+    if is_sandbox(ubman):
+        tpm2_sandbox_init(ubman)
+    ubman.run_command('tpm2 self_test continue')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_clear(u_boot_console):
+def test_tpm2_clear(ubman):
     """Execute a TPM2_Clear command.
 
     Ask the TPM to reset entirely its internal state (including internal
@@ -144,22 +144,22 @@
     not have a password set, otherwise this test will fail. ENDORSEMENT and
     PLATFORM hierarchies are also available.
     """
-    if is_sandbox(u_boot_console):
-        tpm2_sandbox_init(u_boot_console)
+    if is_sandbox(ubman):
+        tpm2_sandbox_init(ubman)
 
-    skip_test = u_boot_console.config.env.get('env__tpm_device_test_skip', False)
+    skip_test = ubman.config.env.get('env__tpm_device_test_skip', False)
     if skip_test:
         pytest.skip('skip TPM device test')
-    u_boot_console.run_command('tpm2 clear TPM2_RH_LOCKOUT')
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 clear TPM2_RH_LOCKOUT')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
-    u_boot_console.run_command('tpm2 clear TPM2_RH_PLATFORM')
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 clear TPM2_RH_PLATFORM')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_change_auth(u_boot_console):
+def test_tpm2_change_auth(ubman):
     """Execute a TPM2_HierarchyChangeAuth command.
 
     Ask the TPM to change the owner, ie. set a new password: 'unicorn'
@@ -167,22 +167,22 @@
     Use the LOCKOUT hierarchy for this. ENDORSEMENT and PLATFORM hierarchies are
     also available.
     """
-    if is_sandbox(u_boot_console):
-        tpm2_sandbox_init(u_boot_console)
-    force_init(u_boot_console)
+    if is_sandbox(ubman):
+        tpm2_sandbox_init(ubman)
+    force_init(ubman)
 
-    u_boot_console.run_command('tpm2 change_auth TPM2_RH_LOCKOUT unicorn')
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 change_auth TPM2_RH_LOCKOUT unicorn')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
-    u_boot_console.run_command('tpm2 clear TPM2_RH_LOCKOUT unicorn')
-    output = u_boot_console.run_command('echo $?')
-    u_boot_console.run_command('tpm2 clear TPM2_RH_PLATFORM')
+    ubman.run_command('tpm2 clear TPM2_RH_LOCKOUT unicorn')
+    output = ubman.run_command('echo $?')
+    ubman.run_command('tpm2 clear TPM2_RH_PLATFORM')
     assert output.endswith('0')
 
 @pytest.mark.buildconfigspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_get_capability(u_boot_console):
+def test_tpm2_get_capability(ubman):
     """Execute a TPM_GetCapability command.
 
     Display one capability. In our test case, let's display the default DAM
@@ -193,19 +193,19 @@
     There is no expected default values because it would depend on the chip
     used. We can still save them in order to check they have changed later.
     """
-    if is_sandbox(u_boot_console):
-        tpm2_sandbox_init(u_boot_console)
+    if is_sandbox(ubman):
+        tpm2_sandbox_init(ubman)
 
-    force_init(u_boot_console)
-    ram = u_boot_utils.find_ram_base(u_boot_console)
+    force_init(ubman)
+    ram = u_boot_utils.find_ram_base(ubman)
 
-    read_cap = u_boot_console.run_command('tpm2 get_capability 0x6 0x20e 0x200 1') #0x%x 1' % ram)
-    output = u_boot_console.run_command('echo $?')
+    read_cap = ubman.run_command('tpm2 get_capability 0x6 0x20e 0x200 1') #0x%x 1' % ram)
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
     assert 'Property 0x0000020e: 0x00000000' in read_cap
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_dam_parameters(u_boot_console):
+def test_tpm2_dam_parameters(ubman):
     """Execute a TPM2_DictionaryAttackParameters command.
 
     Change Dictionary Attack Mitigation (DAM) parameters. Ask the TPM to change:
@@ -217,38 +217,38 @@
     the authentication, otherwise the lockout will be engaged after the first
     failed authentication attempt.
     """
-    if is_sandbox(u_boot_console):
-        tpm2_sandbox_init(u_boot_console)
-    force_init(u_boot_console)
-    ram = u_boot_utils.find_ram_base(u_boot_console)
+    if is_sandbox(ubman):
+        tpm2_sandbox_init(ubman)
+    force_init(ubman)
+    ram = u_boot_utils.find_ram_base(ubman)
 
     # Set the DAM parameters to known values
-    u_boot_console.run_command('tpm2 dam_parameters 3 10 0')
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 dam_parameters 3 10 0')
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
     # Check the values have been saved
-    read_cap = u_boot_console.run_command('tpm2 get_capability 0x6 0x20f 0x%x 3' % ram)
-    output = u_boot_console.run_command('echo $?')
+    read_cap = ubman.run_command('tpm2 get_capability 0x6 0x20f 0x%x 3' % ram)
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
     assert 'Property 0x0000020f: 0x00000003' in read_cap
     assert 'Property 0x00000210: 0x0000000a' in read_cap
     assert 'Property 0x00000211: 0x00000000' in read_cap
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_pcr_read(u_boot_console):
+def test_tpm2_pcr_read(ubman):
     """Execute a TPM2_PCR_Read command.
 
     Perform a PCR read of the 10th PCR. Must be zero.
     """
-    if is_sandbox(u_boot_console):
-        tpm2_sandbox_init(u_boot_console)
+    if is_sandbox(ubman):
+        tpm2_sandbox_init(ubman)
 
-    force_init(u_boot_console)
-    ram = u_boot_utils.find_ram_base(u_boot_console)
+    force_init(ubman)
+    ram = u_boot_utils.find_ram_base(ubman)
 
-    read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % ram)
-    output = u_boot_console.run_command('echo $?')
+    read_pcr = ubman.run_command('tpm2 pcr_read 10 0x%x' % ram)
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
     # Save the number of PCR updates
@@ -261,7 +261,7 @@
     assert '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' in read_pcr
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_pcr_extend(u_boot_console):
+def test_tpm2_pcr_extend(ubman):
     """Execute a TPM2_PCR_Extend command.
 
     Perform a PCR extension with a known hash in memory (zeroed since the board
@@ -270,25 +270,25 @@
     No authentication mechanism is used here, not protecting against packet
     replay, yet.
     """
-    if is_sandbox(u_boot_console):
-        tpm2_sandbox_init(u_boot_console)
-    force_init(u_boot_console)
-    ram = u_boot_utils.find_ram_base(u_boot_console)
+    if is_sandbox(ubman):
+        tpm2_sandbox_init(ubman)
+    force_init(ubman)
+    ram = u_boot_utils.find_ram_base(ubman)
 
-    read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20))
-    output = u_boot_console.run_command('echo $?')
+    read_pcr = ubman.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20))
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
     str = re.findall(r'\d+ known updates', read_pcr)[0]
     updates = int(re.findall(r'\d+', str)[0])
 
-    u_boot_console.run_command('tpm2 pcr_extend 10 0x%x' % ram)
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 pcr_extend 10 0x%x' % ram)
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
     # Read the value back into a different place so we can still use 'ram' as
     # our zero bytes
-    read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20))
-    output = u_boot_console.run_command('echo $?')
+    read_pcr = ubman.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20))
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
     assert 'f5 a5 fd 42 d1 6a 20 30 27 98 ef 6e d3 09 97 9b' in read_pcr
     assert '43 00 3d 23 20 d9 f0 e8 ea 98 31 a9 27 59 fb 4b' in read_pcr
@@ -297,12 +297,12 @@
     new_updates = int(re.findall(r'\d+', str)[0])
     assert (updates + 1) == new_updates
 
-    u_boot_console.run_command('tpm2 pcr_extend 10 0x%x' % ram)
-    output = u_boot_console.run_command('echo $?')
+    ubman.run_command('tpm2 pcr_extend 10 0x%x' % ram)
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
 
-    read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20))
-    output = u_boot_console.run_command('echo $?')
+    read_pcr = ubman.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20))
+    output = ubman.run_command('echo $?')
     assert output.endswith('0')
     assert '7a 05 01 f5 95 7b df 9c b3 a8 ff 49 66 f0 22 65' in read_pcr
     assert 'f9 68 65 8b 7a 9c 62 64 2c ba 11 65 e8 66 42 f5' in read_pcr
@@ -312,7 +312,7 @@
     assert (updates + 2) == new_updates
 
 @pytest.mark.buildconfigspec('cmd_tpm_v2')
-def test_tpm2_cleanup(u_boot_console):
+def test_tpm2_cleanup(ubman):
     """Ensure the TPM is cleared from password or test related configuration."""
 
-    force_init(u_boot_console, True)
+    force_init(ubman, True)