summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/multiconfig.py
blob: 39b92f24391871a3516e6f47eac1abd71b78b41e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# SPDX-License-Identifier: MIT
#

import os
import textwrap
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import bitbake

class MultiConfig(OESelftestTestCase):

    def test_multiconfig(self):
        """
        Test that a simple multiconfig build works. This uses the mcextend class and the
        multiconfig-image-packager test recipe to build a core-image-full-cmdline image which
        contains a tiny core-image-minimal and a musl core-image-minimal, installed as packages.
        """

        config = """
IMAGE_INSTALL_append_pn-core-image-full-cmdline = " multiconfig-image-packager-tiny multiconfig-image-packager-musl"
BBMULTICONFIG = "tiny musl"
"""
        self.write_config(config)

        muslconfig = """
MACHINE = "qemux86-64"
DISTRO = "poky"
TCLIBC = "musl"
TMPDIR = "${TOPDIR}/tmp-mc-musl"
"""
        self.write_config(muslconfig, 'musl')

        tinyconfig = """
MACHINE = "qemux86"
DISTRO = "poky-tiny"
TMPDIR = "${TOPDIR}/tmp-mc-tiny"
"""
        self.write_config(tinyconfig, 'tiny')

        # Build a core-image-minimal
        bitbake('core-image-full-cmdline')

    def test_multiconfig_reparse(self):
        """
        Test that changes to a multiconfig conf file are correctly detected and
        cause a reparse/rebuild of a recipe.
        """
        config = textwrap.dedent('''\
                MCTESTVAR = "test"
                BBMULTICONFIG = "test"
                ''')
        self.write_config(config)

        testconfig = textwrap.dedent('''\
                MCTESTVAR_append = "1"
                ''')
        self.write_config(testconfig, 'test')

        # Check that the 1) the task executed and 2) that it output the correct
        # value. Note "bitbake -e" is not used because it always reparses the
        # recipe and we want to ensure that the automatic reparsing and parse
        # caching is detected.
        result = bitbake('mc:test:multiconfig-test-parse -c showvar')
        self.assertIn('MCTESTVAR=test1', result.output.splitlines())

        testconfig = textwrap.dedent('''\
                MCTESTVAR_append = "2"
                ''')
        self.write_config(testconfig, 'test')

        result = bitbake('mc:test:multiconfig-test-parse -c showvar')
        self.assertIn('MCTESTVAR=test2', result.output.splitlines())