systemd_boot.py 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import os
  2. from oeqa.selftest.case import OESelftestTestCase
  3. from oeqa.core.decorator.oeid import OETestID
  4. from oeqa.core.decorator.depends import OETestDepends
  5. from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
  6. class Systemdboot(OESelftestTestCase):
  7. @OETestID(1445)
  8. @OETestID(1528)
  9. def test_efi_systemdboot_images_can_be_built(self):
  10. """
  11. Summary: Check if systemd-boot images can be built correctly
  12. Expected: 1. File systemd-boot.efi should be available in $poky/build/tmp/deploy/images/genericx86-64
  13. 2. 'systemd-boot" can be built correctly
  14. Product: oe-core
  15. Author: Jose Perez Carranza <jose.perez.carranza@intel.com>
  16. AutomatedBy: Jose Perez Carranza <jose.perez.carranza@intel.com>
  17. """
  18. # Set EFI_PROVIDER = "systemdboot" and MACHINE = "genericx86-64" in conf/local.conf
  19. features = 'EFI_PROVIDER = "systemd-boot"\n'
  20. features += 'MACHINE = "genericx86-64"'
  21. self.append_config(features)
  22. deploydir = get_bb_var('DEPLOY_DIR_IMAGE', "core-image-minimal")
  23. systemdbootfile = os.path.join(deploydir, 'systemd-bootx64.efi')
  24. # Ensure we're actually testing that this gets built and not that
  25. # it was around from an earlier build
  26. bitbake('-c clean systemd-boot')
  27. runCmd('rm -f %s' % systemdbootfile)
  28. # Build a genericx86-64/efi systemdboot image
  29. bitbake('mtools-native core-image-minimal')
  30. found = os.path.isfile(systemdbootfile)
  31. self.assertTrue(found, 'Systemd-Boot file %s not found' % systemdbootfile)
  32. """
  33. Summary: Check if EFI bootloader for systemd is correctly build
  34. Dependencies: Image was built correctly on testcase 1445
  35. Steps: 1. Copy bootx64.efi file form the hddimg created
  36. under build/tmp/deploy/images/genericx86-64
  37. 2. Check bootx64.efi was copied form hddimg
  38. 3. Verify the checksums from the copied and previously
  39. created file are equal.
  40. Expected : Systemd-bootx64.efi and bootx64.efi should be the same
  41. hence checksums should be equal.
  42. Product: oe-core
  43. Author: Jose Perez Carranza <jose.perez.carranza at linux-intel.com>
  44. AutomatedBy: Jose Perez Carranza <jose.perez.carranza at linux-intel.com>
  45. """
  46. systemdbootimage = os.path.join(deploydir, 'core-image-minimal-genericx86-64.hddimg')
  47. imagebootfile = os.path.join(deploydir, 'bootx64.efi')
  48. mcopynative = os.path.join(get_bb_var('STAGING_BINDIR_NATIVE', "core-image-minimal"), 'mcopy')
  49. # Clean environment before start the test
  50. if os.path.isfile(imagebootfile):
  51. runCmd('rm -f %s' % imagebootfile)
  52. runCmd('%s -i %s ::EFI/BOOT/bootx64.efi %s' % (mcopynative ,systemdbootimage,
  53. imagebootfile))
  54. found = os.path.isfile(imagebootfile)
  55. self.assertTrue(found, 'bootx64.efi file %s was not copied from image'
  56. % imagebootfile)
  57. result = runCmd('md5sum %s %s' % (systemdbootfile, imagebootfile))
  58. self.assertEqual(result.output.split()[0], result.output.split()[2],
  59. '%s was not correclty generated' % imagebootfile)