blob: baae9b456f54b08235ceb3bed7a31e16e3350b62 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishop19323692019-04-05 15:28:33 -04005import os
Brad Bishop00e122a2019-10-05 11:10:57 -04006import textwrap
Brad Bishop19323692019-04-05 15:28:33 -04007from oeqa.selftest.case import OESelftestTestCase
8from oeqa.utils.commands import bitbake
Brad Bishop19323692019-04-05 15:28:33 -04009
10class MultiConfig(OESelftestTestCase):
11
12 def test_multiconfig(self):
13 """
Brad Bishop00e122a2019-10-05 11:10:57 -040014 Test that a simple multiconfig build works. This uses the mcextend class and the
15 multiconfig-image-packager test recipe to build a core-image-full-cmdline image which
Brad Bishop19323692019-04-05 15:28:33 -040016 contains a tiny core-image-minimal and a musl core-image-minimal, installed as packages.
17 """
18
19 config = """
Patrick Williams213cb262021-08-07 19:21:33 -050020IMAGE_INSTALL:append:pn-core-image-full-cmdline = " multiconfig-image-packager-tiny multiconfig-image-packager-musl"
Brad Bishop19323692019-04-05 15:28:33 -040021BBMULTICONFIG = "tiny musl"
22"""
23 self.write_config(config)
24
25 muslconfig = """
26MACHINE = "qemux86-64"
27DISTRO = "poky"
28TCLIBC = "musl"
29TMPDIR = "${TOPDIR}/tmp-mc-musl"
30"""
Brad Bishop00e122a2019-10-05 11:10:57 -040031 self.write_config(muslconfig, 'musl')
Brad Bishop19323692019-04-05 15:28:33 -040032
33 tinyconfig = """
34MACHINE = "qemux86"
35DISTRO = "poky-tiny"
36TMPDIR = "${TOPDIR}/tmp-mc-tiny"
37"""
Brad Bishop00e122a2019-10-05 11:10:57 -040038 self.write_config(tinyconfig, 'tiny')
Brad Bishop19323692019-04-05 15:28:33 -040039
40 # Build a core-image-minimal
41 bitbake('core-image-full-cmdline')
42
Brad Bishop00e122a2019-10-05 11:10:57 -040043 def test_multiconfig_reparse(self):
44 """
45 Test that changes to a multiconfig conf file are correctly detected and
46 cause a reparse/rebuild of a recipe.
47 """
48 config = textwrap.dedent('''\
49 MCTESTVAR = "test"
50 BBMULTICONFIG = "test"
51 ''')
52 self.write_config(config)
53
54 testconfig = textwrap.dedent('''\
Patrick Williams213cb262021-08-07 19:21:33 -050055 MCTESTVAR:append = "1"
Brad Bishop00e122a2019-10-05 11:10:57 -040056 ''')
57 self.write_config(testconfig, 'test')
58
59 # Check that the 1) the task executed and 2) that it output the correct
60 # value. Note "bitbake -e" is not used because it always reparses the
61 # recipe and we want to ensure that the automatic reparsing and parse
62 # caching is detected.
63 result = bitbake('mc:test:multiconfig-test-parse -c showvar')
64 self.assertIn('MCTESTVAR=test1', result.output.splitlines())
65
66 testconfig = textwrap.dedent('''\
Patrick Williams213cb262021-08-07 19:21:33 -050067 MCTESTVAR:append = "2"
Brad Bishop00e122a2019-10-05 11:10:57 -040068 ''')
69 self.write_config(testconfig, 'test')
70
71 result = bitbake('mc:test:multiconfig-test-parse -c showvar')
72 self.assertIn('MCTESTVAR=test2', result.output.splitlines())