test_efi_selftest.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (c) 2017, Heinrich Schuchardt <xypron.glpk@gmx.de>
  2. #
  3. # SPDX-License-Identifier: GPL-2.0
  4. # Test efi API implementation
  5. import pytest
  6. import u_boot_utils
  7. @pytest.mark.buildconfigspec('cmd_bootefi_selftest')
  8. def test_efi_selftest(u_boot_console):
  9. """
  10. Run bootefi selftest
  11. """
  12. u_boot_console.run_command(cmd='setenv efi_selftest')
  13. u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
  14. m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
  15. if m != 0:
  16. raise Exception('Failures occured during the EFI selftest')
  17. u_boot_console.run_command(cmd='', wait_for_echo=False, wait_for_prompt=False);
  18. m = u_boot_console.p.expect(['resetting', 'U-Boot'])
  19. if m != 0:
  20. raise Exception('Reset failed during the EFI selftest')
  21. u_boot_console.restart_uboot();
  22. @pytest.mark.buildconfigspec('cmd_bootefi_selftest')
  23. def test_efi_selftest_watchdog_reboot(u_boot_console):
  24. u_boot_console.run_command(cmd='setenv efi_selftest list')
  25. output = u_boot_console.run_command('bootefi selftest')
  26. assert '\'watchdog reboot\'' in output
  27. u_boot_console.run_command(cmd='setenv efi_selftest watchdog reboot')
  28. u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
  29. m = u_boot_console.p.expect(['resetting', 'U-Boot'])
  30. if m != 0:
  31. raise Exception('Reset failed in \'watchdog reboot\' test')
  32. u_boot_console.restart_uboot();