multiconfig.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # SPDX-License-Identifier: MIT
  3. #
  4. import os
  5. import textwrap
  6. from oeqa.selftest.case import OESelftestTestCase
  7. from oeqa.utils.commands import bitbake
  8. class MultiConfig(OESelftestTestCase):
  9. def test_multiconfig(self):
  10. """
  11. Test that a simple multiconfig build works. This uses the mcextend class and the
  12. multiconfig-image-packager test recipe to build a core-image-full-cmdline image which
  13. contains a tiny core-image-minimal and a musl core-image-minimal, installed as packages.
  14. """
  15. config = """
  16. IMAGE_INSTALL_append_pn-core-image-full-cmdline = " multiconfig-image-packager-tiny multiconfig-image-packager-musl"
  17. BBMULTICONFIG = "tiny musl"
  18. """
  19. self.write_config(config)
  20. muslconfig = """
  21. MACHINE = "qemux86-64"
  22. DISTRO = "poky"
  23. TCLIBC = "musl"
  24. TMPDIR = "${TOPDIR}/tmp-mc-musl"
  25. """
  26. self.write_config(muslconfig, 'musl')
  27. tinyconfig = """
  28. MACHINE = "qemux86"
  29. DISTRO = "poky-tiny"
  30. TMPDIR = "${TOPDIR}/tmp-mc-tiny"
  31. """
  32. self.write_config(tinyconfig, 'tiny')
  33. # Build a core-image-minimal
  34. bitbake('core-image-full-cmdline')
  35. def test_multiconfig_reparse(self):
  36. """
  37. Test that changes to a multiconfig conf file are correctly detected and
  38. cause a reparse/rebuild of a recipe.
  39. """
  40. config = textwrap.dedent('''\
  41. MCTESTVAR = "test"
  42. BBMULTICONFIG = "test"
  43. ''')
  44. self.write_config(config)
  45. testconfig = textwrap.dedent('''\
  46. MCTESTVAR_append = "1"
  47. ''')
  48. self.write_config(testconfig, 'test')
  49. # Check that the 1) the task executed and 2) that it output the correct
  50. # value. Note "bitbake -e" is not used because it always reparses the
  51. # recipe and we want to ensure that the automatic reparsing and parse
  52. # caching is detected.
  53. result = bitbake('mc:test:multiconfig-test-parse -c showvar')
  54. self.assertIn('MCTESTVAR=test1', result.output.splitlines())
  55. testconfig = textwrap.dedent('''\
  56. MCTESTVAR_append = "2"
  57. ''')
  58. self.write_config(testconfig, 'test')
  59. result = bitbake('mc:test:multiconfig-test-parse -c showvar')
  60. self.assertIn('MCTESTVAR=test2', result.output.splitlines())