test_efi_selftest.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # SPDX-License-Identifier: GPL-2.0
  2. # Copyright (c) 2017, Heinrich Schuchardt <xypron.glpk@gmx.de>
  3. # Test efi API implementation
  4. import pytest
  5. import u_boot_utils
  6. @pytest.mark.buildconfigspec('cmd_bootefi_selftest')
  7. def test_efi_selftest(u_boot_console):
  8. """
  9. Run bootefi selftest
  10. """
  11. u_boot_console.run_command(cmd='setenv efi_selftest')
  12. u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
  13. m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
  14. if m != 0:
  15. raise Exception('Failures occured during the EFI selftest')
  16. u_boot_console.run_command(cmd='', wait_for_echo=False, wait_for_prompt=False);
  17. m = u_boot_console.p.expect(['resetting', 'U-Boot'])
  18. if m != 0:
  19. raise Exception('Reset failed during the EFI selftest')
  20. u_boot_console.restart_uboot();
  21. @pytest.mark.buildconfigspec('cmd_bootefi_selftest')
  22. @pytest.mark.buildconfigspec('of_control')
  23. def test_efi_selftest_device_tree(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 '\'device tree\'' in output
  27. u_boot_console.run_command(cmd='setenv efi_selftest device tree')
  28. u_boot_console.run_command(cmd='setenv -f serial# Testing DT')
  29. u_boot_console.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False)
  30. m = u_boot_console.p.expect(['serial-number: Testing DT', 'U-Boot'])
  31. if m != 0:
  32. raise Exception('Reset failed in \'device tree\' test')
  33. u_boot_console.restart_uboot();
  34. @pytest.mark.buildconfigspec('cmd_bootefi_selftest')
  35. def test_efi_selftest_watchdog_reboot(u_boot_console):
  36. u_boot_console.run_command(cmd='setenv efi_selftest list')
  37. output = u_boot_console.run_command('bootefi selftest')
  38. assert '\'watchdog reboot\'' in output
  39. u_boot_console.run_command(cmd='setenv efi_selftest watchdog reboot')
  40. u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
  41. m = u_boot_console.p.expect(['resetting', 'U-Boot'])
  42. if m != 0:
  43. raise Exception('Reset failed in \'watchdog reboot\' test')
  44. u_boot_console.restart_uboot();