blob: 17c98baf143d41d8b823f345acafcc997de3795b [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright OpenEmbedded Contributors
3#
Brad Bishopc342db32019-05-15 21:57:59 -04004# SPDX-License-Identifier: MIT
5#
6
Brad Bishopd7bf8c12018-02-25 22:55:05 -05007import os
8
9from oeqa.selftest.case import OESelftestTestCase
10from oeqa.utils.commands import bitbake
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011
12class ImageTypeDepTests(OESelftestTestCase):
13
Patrick Williams213cb262021-08-07 19:21:33 -050014 # Verify that when specifying a IMAGE_TYPEDEP: of the form "foo.bar" that
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015 # the conversion type bar gets added as a dep as well
Brad Bishopd7bf8c12018-02-25 22:55:05 -050016 def test_conversion_typedep_added(self):
17
18 self.write_recipeinc('emptytest', """
19# Try to empty out the default dependency list
20PACKAGE_INSTALL = ""
21DISTRO_EXTRA_RDEPENDS=""
22
23LICENSE = "MIT"
24IMAGE_FSTYPES = "testfstype"
25
26IMAGE_TYPES_MASKED += "testfstype"
Patrick Williams213cb262021-08-07 19:21:33 -050027IMAGE_TYPEDEP:testfstype = "tar.bz2"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028
29inherit 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 Bishop1a4b7ee2018-12-16 17:11:34 -080036 dep = None
Brad Bishopd7bf8c12018-02-25 22:55:05 -050037 for line in result.output.split('\n'):
38 if line.startswith('CONVERSION_DEPENDS_bz2'):
39 dep = line.split('=')[1].strip('"')
40 break
41
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080042 self.assertIsNotNone(dep, "CONVERSION_DEPENDS_bz2 dependency not found in bitbake -e output")
43
Brad Bishopd7bf8c12018-02-25 22:55:05 -050044 # 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))