blob: 39b92f24391871a3516e6f47eac1abd71b78b41e [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 = """
20IMAGE_INSTALL_append_pn-core-image-full-cmdline = " multiconfig-image-packager-tiny multiconfig-image-packager-musl"
21BBMULTICONFIG = "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('''\
55 MCTESTVAR_append = "1"
56 ''')
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('''\
67 MCTESTVAR_append = "2"
68 ''')
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())