sysroot.py 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #
  2. # Copyright OpenEmbedded Contributors
  3. #
  4. # SPDX-License-Identifier: MIT
  5. #
  6. import uuid
  7. from oeqa.selftest.case import OESelftestTestCase
  8. from oeqa.utils.commands import bitbake
  9. class SysrootTests(OESelftestTestCase):
  10. def test_sysroot_cleanup(self):
  11. """
  12. Build sysroot test which depends on virtual/sysroot-test for one machine,
  13. switch machine, switch provider of virtual/sysroot-test and check that the
  14. sysroot is correctly cleaned up. The files in the two providers overlap
  15. so can cause errors if the sysroot code doesn't function correctly.
  16. Yes, sysroot-test should be machine specific really to avoid this, however
  17. the sysroot cleanup should also work [YOCTO #13702].
  18. """
  19. uuid1 = uuid.uuid4()
  20. uuid2 = uuid.uuid4()
  21. self.write_config("""
  22. PREFERRED_PROVIDER_virtual/sysroot-test = "sysroot-test-arch1"
  23. MACHINE = "qemux86"
  24. TESTSTRING:pn-sysroot-test-arch1 = "%s"
  25. TESTSTRING:pn-sysroot-test-arch2 = "%s"
  26. """ % (uuid1, uuid2))
  27. bitbake("sysroot-test")
  28. self.write_config("""
  29. PREFERRED_PROVIDER_virtual/sysroot-test = "sysroot-test-arch2"
  30. MACHINE = "qemux86copy"
  31. TESTSTRING:pn-sysroot-test-arch1 = "%s"
  32. TESTSTRING:pn-sysroot-test-arch2 = "%s"
  33. """ % (uuid1, uuid2))
  34. bitbake("sysroot-test")
  35. def test_sysroot_max_shebang(self):
  36. """
  37. Summary: Check max shebang triggers. To confirm [YOCTO #11053] is closed.
  38. Expected: Fail when a shebang bigger than the max shebang-size is reached.
  39. Author: Paulo Neves <ptsneves@gmail.com>
  40. """
  41. expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]"
  42. res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True)
  43. self.assertTrue(expected in res.output, msg=res.output)
  44. self.assertTrue(res.status != 0)
  45. def test_sysroot_la(self):
  46. """
  47. Summary: Check that workdir paths are not contained in .la files.
  48. Expected: Fail when a workdir path is found in the file content.
  49. Author: Paulo Neves <ptsneves@gmail.com>
  50. """
  51. expected = "la-test.la failed sanity test (workdir) in path"
  52. res = bitbake("sysroot-la-test -c populate_sysroot", ignore_status=True)
  53. self.assertTrue(expected in res.output, msg=res.output)
  54. self.assertTrue('[la]' in res.output, msg=res.output)
  55. self.assertTrue(res.status != 0)
  56. res = bitbake("sysroot-la-test-native -c populate_sysroot", ignore_status=True)
  57. self.assertTrue(expected in res.output, msg=res.output)
  58. self.assertTrue('[la]' in res.output, msg=res.output)
  59. self.assertTrue(res.status != 0)
  60. def test_sysroot_pkgconfig(self):
  61. """
  62. Summary: Check that tmpdir paths are not contained in .pc files.
  63. Expected: Fail when a tmpdir path is found in the file content.
  64. Author: Paulo Neves <ptsneves@gmail.com>
  65. """
  66. expected = "test.pc failed sanity test (tmpdir) in path"
  67. res = bitbake("sysroot-pc-test -c populate_sysroot", ignore_status=True)
  68. self.assertTrue('[pkgconfig]' in res.output, msg=res.output)
  69. self.assertTrue(expected in res.output, msg=res.output)
  70. self.assertTrue(res.status != 0)
  71. res = bitbake("sysroot-pc-test-native -c populate_sysroot", ignore_status=True)
  72. self.assertTrue(expected in res.output, msg=res.output)
  73. self.assertTrue('[pkgconfig]' in res.output, msg=res.output)
  74. self.assertTrue(res.status != 0)