Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 7 | import os |
| 8 | |
| 9 | from oeqa.selftest.case import OESelftestTestCase |
| 10 | from oeqa.utils.commands import bitbake |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 11 | |
| 12 | class ImageTypeDepTests(OESelftestTestCase): |
| 13 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 14 | # Verify that when specifying a IMAGE_TYPEDEP: of the form "foo.bar" that |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 15 | # the conversion type bar gets added as a dep as well |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 16 | def test_conversion_typedep_added(self): |
| 17 | |
| 18 | self.write_recipeinc('emptytest', """ |
| 19 | # Try to empty out the default dependency list |
| 20 | PACKAGE_INSTALL = "" |
| 21 | DISTRO_EXTRA_RDEPENDS="" |
| 22 | |
| 23 | LICENSE = "MIT" |
| 24 | IMAGE_FSTYPES = "testfstype" |
| 25 | |
| 26 | IMAGE_TYPES_MASKED += "testfstype" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 27 | IMAGE_TYPEDEP:testfstype = "tar.bz2" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 28 | |
| 29 | inherit image |
| 30 | |
| 31 | """) |
| 32 | # First get the dependency that should exist for bz2, it will look |
| 33 | # like CONVERSION_DEPENDS_bz2="somedep" |
| 34 | result = bitbake('-e emptytest') |
| 35 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 36 | dep = None |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 37 | for line in result.output.split('\n'): |
| 38 | if line.startswith('CONVERSION_DEPENDS_bz2'): |
| 39 | dep = line.split('=')[1].strip('"') |
| 40 | break |
| 41 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 42 | self.assertIsNotNone(dep, "CONVERSION_DEPENDS_bz2 dependency not found in bitbake -e output") |
| 43 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 44 | # Now get the dependency task list and check for the expected task |
| 45 | # dependency |
| 46 | bitbake('-g emptytest') |
| 47 | |
| 48 | taskdependsfile = os.path.join(self.builddir, 'task-depends.dot') |
| 49 | dep = dep + ".do_populate_sysroot" |
| 50 | depfound = False |
| 51 | expectedline = '"emptytest.do_rootfs" -> "{}"'.format(dep) |
| 52 | |
| 53 | with open(taskdependsfile, "r") as f: |
| 54 | for line in f: |
| 55 | if line.strip() == expectedline: |
| 56 | depfound = True |
| 57 | break |
| 58 | |
| 59 | if not depfound: |
| 60 | raise AssertionError("\"{}\" not found".format(expectedline)) |