blob: 5b182a8f94002a2f30aa11e17b327b6cc3ab38cc [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005import os
6
7from oeqa.selftest.case import OESelftestTestCase
8from oeqa.utils.commands import bitbake
Brad Bishopd7bf8c12018-02-25 22:55:05 -05009
10class ImageTypeDepTests(OESelftestTestCase):
11
Patrick Williams213cb262021-08-07 19:21:33 -050012 # Verify that when specifying a IMAGE_TYPEDEP: of the form "foo.bar" that
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013 # the conversion type bar gets added as a dep as well
Brad Bishopd7bf8c12018-02-25 22:55:05 -050014 def test_conversion_typedep_added(self):
15
16 self.write_recipeinc('emptytest', """
17# Try to empty out the default dependency list
18PACKAGE_INSTALL = ""
19DISTRO_EXTRA_RDEPENDS=""
20
21LICENSE = "MIT"
22IMAGE_FSTYPES = "testfstype"
23
24IMAGE_TYPES_MASKED += "testfstype"
Patrick Williams213cb262021-08-07 19:21:33 -050025IMAGE_TYPEDEP:testfstype = "tar.bz2"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050026
27inherit image
28
29""")
30 # First get the dependency that should exist for bz2, it will look
31 # like CONVERSION_DEPENDS_bz2="somedep"
32 result = bitbake('-e emptytest')
33
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034 dep = None
Brad Bishopd7bf8c12018-02-25 22:55:05 -050035 for line in result.output.split('\n'):
36 if line.startswith('CONVERSION_DEPENDS_bz2'):
37 dep = line.split('=')[1].strip('"')
38 break
39
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080040 self.assertIsNotNone(dep, "CONVERSION_DEPENDS_bz2 dependency not found in bitbake -e output")
41
Brad Bishopd7bf8c12018-02-25 22:55:05 -050042 # Now get the dependency task list and check for the expected task
43 # dependency
44 bitbake('-g emptytest')
45
46 taskdependsfile = os.path.join(self.builddir, 'task-depends.dot')
47 dep = dep + ".do_populate_sysroot"
48 depfound = False
49 expectedline = '"emptytest.do_rootfs" -> "{}"'.format(dep)
50
51 with open(taskdependsfile, "r") as f:
52 for line in f:
53 if line.strip() == expectedline:
54 depfound = True
55 break
56
57 if not depfound:
58 raise AssertionError("\"{}\" not found".format(expectedline))