summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2021-04-06 14:34:20 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-04-06 22:37:23 +0100
commit089929e8317b2cc9b3b4865df30fe18b16358539 (patch)
tree8d111686dc4a743ac82c441ee57115ee9d6efe57 /meta/lib/oeqa
parent900f8676e5d3919e6e668c0958eac870e866bdff (diff)
downloadpoky-089929e8317b2cc9b3b4865df30fe18b16358539.tar.gz
oeqa/selftest: add test case for SRC_URI dependency sniffing
Add tests to verify that SRC_URI dependency sniffing works correctly. (From OE-Core rev: 394b98f7d77c199a4a022447ec5d722ffb7d1741) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/fetch.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fetch.py b/meta/lib/oeqa/selftest/cases/fetch.py
index 76cbadf2ff..67e85d3e4c 100644
--- a/meta/lib/oeqa/selftest/cases/fetch.py
+++ b/meta/lib/oeqa/selftest/cases/fetch.py
@@ -2,6 +2,9 @@
2# SPDX-License-Identifier: MIT 2# SPDX-License-Identifier: MIT
3# 3#
4 4
5import tempfile
6import textwrap
7import bb.tinfoil
5import oe.path 8import oe.path
6from oeqa.selftest.case import OESelftestTestCase 9from oeqa.selftest.case import OESelftestTestCase
7from oeqa.utils.commands import bitbake 10from oeqa.utils.commands import bitbake
@@ -49,3 +52,54 @@ MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/so
49 self.write_config(features) 52 self.write_config(features)
50 oe.path.remove(dldir, recurse=True) 53 oe.path.remove(dldir, recurse=True)
51 bitbake("dbus-wait -c fetch -f") 54 bitbake("dbus-wait -c fetch -f")
55
56
57class Dependencies(OESelftestTestCase):
58 def write_recipe(self, content):
59 f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb")
60 f.write(content)
61 f.flush()
62 return f
63
64 def test_dependencies(self):
65 """
66 Verify that the correct dependencies are generated for specific SRC_URI entries.
67 """
68 with bb.tinfoil.Tinfoil() as tinfoil:
69 tinfoil.prepare(config_only=False, quiet=2)
70
71 r = """
72 LICENSE="CLOSED"
73 SRC_URI="http://example.com/tarball.zip"
74 """
75 f = self.write_recipe(textwrap.dedent(r))
76 d = tinfoil.parse_recipe_file(f.name)
77 self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
78 self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends"))
79
80 # Verify that the downloadfilename overrides the URI
81 r = """
82 LICENSE="CLOSED"
83 SRC_URI="https://example.com/tarball;downloadfilename=something.zip"
84 """
85 f = self.write_recipe(textwrap.dedent(r))
86 d = tinfoil.parse_recipe_file(f.name)
87 self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
88 self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends") or "")
89
90 r = """
91 LICENSE="CLOSED"
92 SRC_URI="ftp://example.com/tarball.lz"
93 """
94 f = self.write_recipe(textwrap.dedent(r))
95 d = tinfoil.parse_recipe_file(f.name)
96 self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
97 self.assertIn("lzip-native", d.getVarFlag("do_unpack", "depends"))
98
99 r = """
100 LICENSE="CLOSED"
101 SRC_URI="git://example.com/repo"
102 """
103 f = self.write_recipe(textwrap.dedent(r))
104 d = tinfoil.parse_recipe_file(f.name)
105 self.assertIn("git-native", d.getVarFlag("do_fetch", "depends"))