blob: 932c7f883da9a9809b5574d3541e0fab7f38e6df [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001import os
2
3from oeqa.selftest.case import OESelftestTestCase
4from oeqa.utils.commands import bitbake
5from oeqa.core.decorator.oeid import OETestID
6
7class ImageTypeDepTests(OESelftestTestCase):
8
9 # Verify that when specifying a IMAGE_TYPEDEP_ of the form "foo.bar" that
10 # the conversion type bar gets added as a dep as well
11 @OETestID(1633)
12 def test_conversion_typedep_added(self):
13
14 self.write_recipeinc('emptytest', """
15# Try to empty out the default dependency list
16PACKAGE_INSTALL = ""
17DISTRO_EXTRA_RDEPENDS=""
18
19LICENSE = "MIT"
20IMAGE_FSTYPES = "testfstype"
21
22IMAGE_TYPES_MASKED += "testfstype"
23IMAGE_TYPEDEP_testfstype = "tar.bz2"
24
25inherit image
26
27""")
28 # First get the dependency that should exist for bz2, it will look
29 # like CONVERSION_DEPENDS_bz2="somedep"
30 result = bitbake('-e emptytest')
31
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032 dep = None
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033 for line in result.output.split('\n'):
34 if line.startswith('CONVERSION_DEPENDS_bz2'):
35 dep = line.split('=')[1].strip('"')
36 break
37
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038 self.assertIsNotNone(dep, "CONVERSION_DEPENDS_bz2 dependency not found in bitbake -e output")
39
Brad Bishopd7bf8c12018-02-25 22:55:05 -050040 # Now get the dependency task list and check for the expected task
41 # dependency
42 bitbake('-g emptytest')
43
44 taskdependsfile = os.path.join(self.builddir, 'task-depends.dot')
45 dep = dep + ".do_populate_sysroot"
46 depfound = False
47 expectedline = '"emptytest.do_rootfs" -> "{}"'.format(dep)
48
49 with open(taskdependsfile, "r") as f:
50 for line in f:
51 if line.strip() == expectedline:
52 depfound = True
53 break
54
55 if not depfound:
56 raise AssertionError("\"{}\" not found".format(expectedline))