Heinrich Schuchardt | d828a05 | 2017-09-15 10:06:12 +0200 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 2 | # Copyright (c) 2017, Heinrich Schuchardt <xypron.glpk@gmx.de> |
Heinrich Schuchardt | d828a05 | 2017-09-15 10:06:12 +0200 | [diff] [blame] | 3 | |
Heinrich Schuchardt | 8bf7ffd | 2022-05-08 10:40:49 +0200 | [diff] [blame] | 4 | """ Test UEFI API implementation |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 5 | """ |
Heinrich Schuchardt | d828a05 | 2017-09-15 10:06:12 +0200 | [diff] [blame] | 6 | |
| 7 | import pytest |
Heinrich Schuchardt | d828a05 | 2017-09-15 10:06:12 +0200 | [diff] [blame] | 8 | |
| 9 | @pytest.mark.buildconfigspec('cmd_bootefi_selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 10 | def test_efi_selftest_base(ubman): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 11 | """Run UEFI unit tests |
Heinrich Schuchardt | d828a05 | 2017-09-15 10:06:12 +0200 | [diff] [blame] | 12 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 13 | ubman -- U-Boot console |
Heinrich Schuchardt | 48161e1 | 2018-11-18 17:58:54 +0100 | [diff] [blame] | 14 | |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 15 | This function executes all selftests that are not marked as on request. |
| 16 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 17 | ubman.run_command(cmd='setenv efi_selftest') |
| 18 | ubman.run_command(cmd='bootefi selftest', wait_for_prompt=False) |
| 19 | if ubman.p.expect(['Summary: 0 failures', 'Press any key']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 20 | raise Exception('Failures occurred during the EFI selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 21 | ubman.restart_uboot() |
Heinrich Schuchardt | 1dc0a1b | 2017-10-18 18:13:17 +0200 | [diff] [blame] | 22 | |
| 23 | @pytest.mark.buildconfigspec('cmd_bootefi_selftest') |
Heinrich Schuchardt | 604c8e7 | 2020-08-07 23:11:35 +0200 | [diff] [blame] | 24 | @pytest.mark.buildconfigspec('hush_parser') |
Heinrich Schuchardt | 43d2799 | 2018-03-03 15:29:04 +0100 | [diff] [blame] | 25 | @pytest.mark.buildconfigspec('of_control') |
Heinrich Schuchardt | 1c111f9 | 2019-04-20 13:33:55 +0200 | [diff] [blame] | 26 | @pytest.mark.notbuildconfigspec('generate_acpi_table') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 27 | def test_efi_selftest_device_tree(ubman): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 28 | """Test the device tree support in the UEFI sub-system |
| 29 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 30 | ubman -- U-Boot console |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 31 | |
| 32 | This test executes the UEFI unit test by calling 'bootefi selftest'. |
| 33 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 34 | ubman.run_command(cmd='setenv efi_selftest list') |
| 35 | output = ubman.run_command('bootefi selftest') |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 36 | assert '\'device tree\'' in output |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 37 | ubman.run_command(cmd='setenv efi_selftest device tree') |
Heinrich Schuchardt | 604c8e7 | 2020-08-07 23:11:35 +0200 | [diff] [blame] | 38 | # Set serial# if it is not already set. |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 39 | ubman.run_command(cmd='setenv efi_test "${serial#}x"') |
| 40 | ubman.run_command(cmd='test "${efi_test}" = x && setenv serial# 0') |
| 41 | ubman.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False) |
| 42 | if ubman.p.expect(['serial-number:', 'U-Boot']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 43 | raise Exception('serial-number missing in device tree') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 44 | ubman.restart_uboot() |
Heinrich Schuchardt | 43d2799 | 2018-03-03 15:29:04 +0100 | [diff] [blame] | 45 | |
| 46 | @pytest.mark.buildconfigspec('cmd_bootefi_selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 47 | def test_efi_selftest_watchdog_reboot(ubman): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 48 | """Test the watchdog timer |
| 49 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 50 | ubman -- U-Boot console |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 51 | |
| 52 | This function executes the 'watchdog reboot' unit test. |
| 53 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 54 | ubman.run_command(cmd='setenv efi_selftest list') |
| 55 | output = ubman.run_command('bootefi selftest') |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 56 | assert '\'watchdog reboot\'' in output |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 57 | ubman.run_command(cmd='setenv efi_selftest watchdog reboot') |
| 58 | ubman.run_command(cmd='bootefi selftest', wait_for_prompt=False) |
| 59 | if ubman.p.expect(['resetting', 'U-Boot']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 60 | raise Exception('Reset failed in \'watchdog reboot\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 61 | ubman.run_command(cmd='', send_nl=False, wait_for_reboot=True) |
Heinrich Schuchardt | 5e450d4 | 2018-09-06 20:19:31 +0200 | [diff] [blame] | 62 | |
| 63 | @pytest.mark.buildconfigspec('cmd_bootefi_selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 64 | def test_efi_selftest_text_input(ubman): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 65 | """Test the EFI_SIMPLE_TEXT_INPUT_PROTOCOL |
Heinrich Schuchardt | 5e450d4 | 2018-09-06 20:19:31 +0200 | [diff] [blame] | 66 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 67 | ubman -- U-Boot console |
Heinrich Schuchardt | 5e450d4 | 2018-09-06 20:19:31 +0200 | [diff] [blame] | 68 | |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 69 | This function calls the text input EFI selftest. |
| 70 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 71 | ubman.run_command(cmd='setenv efi_selftest text input') |
| 72 | ubman.run_command(cmd='bootefi selftest', wait_for_prompt=False) |
| 73 | if ubman.p.expect([r'To terminate type \'x\'']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 74 | raise Exception('No prompt for \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 75 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 76 | # EOT |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 77 | ubman.run_command(cmd=chr(4), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 78 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 79 | if ubman.p.expect([r'Unicode char 4 \(unknown\), scan code 0 \(Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 80 | raise Exception('EOT failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 81 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 82 | # BS |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 83 | ubman.run_command(cmd=chr(8), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 84 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 85 | if ubman.p.expect([r'Unicode char 8 \(BS\), scan code 0 \(Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 86 | raise Exception('BS failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 87 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 88 | # TAB |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 89 | ubman.run_command(cmd=chr(9), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 90 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 91 | if ubman.p.expect([r'Unicode char 9 \(TAB\), scan code 0 \(Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 92 | raise Exception('BS failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 93 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 94 | # a |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 95 | ubman.run_command(cmd='a', wait_for_echo=False, send_nl=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 96 | wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 97 | if ubman.p.expect([r'Unicode char 97 \(\'a\'\), scan code 0 \(Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 98 | raise Exception('\'a\' failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 99 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 100 | # UP escape sequence |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 101 | ubman.run_command(cmd=chr(27) + '[A', wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 102 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 103 | if ubman.p.expect([r'Unicode char 0 \(Null\), scan code 1 \(Up\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 104 | raise Exception('UP failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 105 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 106 | # Euro sign |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 107 | ubman.run_command(cmd=b'\xe2\x82\xac'.decode(), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 108 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 109 | if ubman.p.expect([r'Unicode char 8364 \(\'']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 110 | raise Exception('Euro sign failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 111 | ubman.drain_console() |
| 112 | ubman.run_command(cmd='x', wait_for_echo=False, send_nl=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 113 | wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 114 | if ubman.p.expect(['Summary: 0 failures', 'Press any key']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 115 | raise Exception('Failures occurred during the EFI selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 116 | ubman.restart_uboot() |
Heinrich Schuchardt | 7ecaf97 | 2018-09-11 22:38:11 +0200 | [diff] [blame] | 117 | |
| 118 | @pytest.mark.buildconfigspec('cmd_bootefi_selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 119 | def test_efi_selftest_text_input_ex(ubman): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 120 | """Test the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL |
Heinrich Schuchardt | 7ecaf97 | 2018-09-11 22:38:11 +0200 | [diff] [blame] | 121 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 122 | ubman -- U-Boot console |
Heinrich Schuchardt | 7ecaf97 | 2018-09-11 22:38:11 +0200 | [diff] [blame] | 123 | |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 124 | This function calls the extended text input EFI selftest. |
| 125 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 126 | ubman.run_command(cmd='setenv efi_selftest extended text input') |
| 127 | ubman.run_command(cmd='bootefi selftest', wait_for_prompt=False) |
| 128 | if ubman.p.expect([r'To terminate type \'CTRL\+x\'']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 129 | raise Exception('No prompt for \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 130 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 131 | # EOT |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 132 | ubman.run_command(cmd=chr(4), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 133 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 134 | if ubman.p.expect([r'Unicode char 100 \(\'d\'\), scan code 0 \(CTRL\+Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 135 | raise Exception('EOT failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 136 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 137 | # BS |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 138 | ubman.run_command(cmd=chr(8), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 139 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 140 | if ubman.p.expect([r'Unicode char 8 \(BS\), scan code 0 \(\+Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 141 | raise Exception('BS failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 142 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 143 | # TAB |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 144 | ubman.run_command(cmd=chr(9), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 145 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 146 | if ubman.p.expect([r'Unicode char 9 \(TAB\), scan code 0 \(\+Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 147 | raise Exception('TAB failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 148 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 149 | # a |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 150 | ubman.run_command(cmd='a', wait_for_echo=False, send_nl=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 151 | wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 152 | if ubman.p.expect([r'Unicode char 97 \(\'a\'\), scan code 0 \(Null\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 153 | raise Exception('\'a\' failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 154 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 155 | # UP escape sequence |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 156 | ubman.run_command(cmd=chr(27) + '[A', wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 157 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 158 | if ubman.p.expect([r'Unicode char 0 \(Null\), scan code 1 \(\+Up\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 159 | raise Exception('UP failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 160 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 161 | # Euro sign |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 162 | ubman.run_command(cmd=b'\xe2\x82\xac'.decode(), wait_for_echo=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 163 | send_nl=False, wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 164 | if ubman.p.expect([r'Unicode char 8364 \(\'']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 165 | raise Exception('Euro sign failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 166 | ubman.drain_console() |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 167 | # SHIFT+ALT+FN 5 |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 168 | ubman.run_command(cmd=b'\x1b\x5b\x31\x35\x3b\x34\x7e'.decode(), |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 169 | wait_for_echo=False, send_nl=False, |
| 170 | wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 171 | if ubman.p.expect([r'Unicode char 0 \(Null\), scan code 15 \(SHIFT\+ALT\+FN 5\)']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 172 | raise Exception('SHIFT+ALT+FN 5 failed in \'text input\' test') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 173 | ubman.drain_console() |
| 174 | ubman.run_command(cmd=chr(24), wait_for_echo=False, send_nl=False, |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 175 | wait_for_prompt=False) |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 176 | if ubman.p.expect(['Summary: 0 failures', 'Press any key']): |
Heinrich Schuchardt | ba41e3e | 2020-01-25 21:58:56 +0100 | [diff] [blame] | 177 | raise Exception('Failures occurred during the EFI selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 178 | ubman.restart_uboot() |
Heinrich Schuchardt | 8226df3 | 2021-11-15 18:26:50 +0100 | [diff] [blame] | 179 | |
| 180 | @pytest.mark.buildconfigspec('cmd_bootefi_selftest') |
| 181 | @pytest.mark.buildconfigspec('efi_tcg2_protocol') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 182 | def test_efi_selftest_tcg2(ubman): |
Heinrich Schuchardt | 8226df3 | 2021-11-15 18:26:50 +0100 | [diff] [blame] | 183 | """Test the EFI_TCG2 PROTOCOL |
| 184 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 185 | ubman -- U-Boot console |
Heinrich Schuchardt | 8226df3 | 2021-11-15 18:26:50 +0100 | [diff] [blame] | 186 | |
| 187 | This function executes the 'tcg2' unit test. |
| 188 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 189 | ubman.restart_uboot() |
| 190 | ubman.run_command(cmd='setenv efi_selftest list') |
| 191 | output = ubman.run_command('bootefi selftest') |
Heinrich Schuchardt | 8226df3 | 2021-11-15 18:26:50 +0100 | [diff] [blame] | 192 | assert '\'tcg2\'' in output |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 193 | ubman.run_command(cmd='setenv efi_selftest tcg2') |
| 194 | ubman.run_command(cmd='bootefi selftest', wait_for_prompt=False) |
| 195 | if ubman.p.expect(['Summary: 0 failures', 'Press any key']): |
Heinrich Schuchardt | 8226df3 | 2021-11-15 18:26:50 +0100 | [diff] [blame] | 196 | raise Exception('Failures occurred during the EFI selftest') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 197 | ubman.restart_uboot() |