Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 5 | import os |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 6 | import textwrap |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | from oeqa.selftest.case import OESelftestTestCase |
| 8 | from oeqa.utils.commands import bitbake |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 9 | |
| 10 | class MultiConfig(OESelftestTestCase): |
| 11 | |
| 12 | def test_multiconfig(self): |
| 13 | """ |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 14 | 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 Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 16 | contains a tiny core-image-minimal and a musl core-image-minimal, installed as packages. |
| 17 | """ |
| 18 | |
| 19 | config = """ |
| 20 | IMAGE_INSTALL_append_pn-core-image-full-cmdline = " multiconfig-image-packager-tiny multiconfig-image-packager-musl" |
| 21 | BBMULTICONFIG = "tiny musl" |
| 22 | """ |
| 23 | self.write_config(config) |
| 24 | |
| 25 | muslconfig = """ |
| 26 | MACHINE = "qemux86-64" |
| 27 | DISTRO = "poky" |
| 28 | TCLIBC = "musl" |
| 29 | TMPDIR = "${TOPDIR}/tmp-mc-musl" |
| 30 | """ |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 31 | self.write_config(muslconfig, 'musl') |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 32 | |
| 33 | tinyconfig = """ |
| 34 | MACHINE = "qemux86" |
| 35 | DISTRO = "poky-tiny" |
| 36 | TMPDIR = "${TOPDIR}/tmp-mc-tiny" |
| 37 | """ |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 38 | self.write_config(tinyconfig, 'tiny') |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 39 | |
| 40 | # Build a core-image-minimal |
| 41 | bitbake('core-image-full-cmdline') |
| 42 | |
Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 43 | 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()) |