mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
900f8676e5
commit
089929e831
@@ -2,6 +2,9 @@
|
|||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import tempfile
|
||||||
|
import textwrap
|
||||||
|
import bb.tinfoil
|
||||||
import oe.path
|
import oe.path
|
||||||
from oeqa.selftest.case import OESelftestTestCase
|
from oeqa.selftest.case import OESelftestTestCase
|
||||||
from oeqa.utils.commands import bitbake
|
from oeqa.utils.commands import bitbake
|
||||||
@@ -49,3 +52,54 @@ MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/so
|
|||||||
self.write_config(features)
|
self.write_config(features)
|
||||||
oe.path.remove(dldir, recurse=True)
|
oe.path.remove(dldir, recurse=True)
|
||||||
bitbake("dbus-wait -c fetch -f")
|
bitbake("dbus-wait -c fetch -f")
|
||||||
|
|
||||||
|
|
||||||
|
class Dependencies(OESelftestTestCase):
|
||||||
|
def write_recipe(self, content):
|
||||||
|
f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb")
|
||||||
|
f.write(content)
|
||||||
|
f.flush()
|
||||||
|
return f
|
||||||
|
|
||||||
|
def test_dependencies(self):
|
||||||
|
"""
|
||||||
|
Verify that the correct dependencies are generated for specific SRC_URI entries.
|
||||||
|
"""
|
||||||
|
with bb.tinfoil.Tinfoil() as tinfoil:
|
||||||
|
tinfoil.prepare(config_only=False, quiet=2)
|
||||||
|
|
||||||
|
r = """
|
||||||
|
LICENSE="CLOSED"
|
||||||
|
SRC_URI="http://example.com/tarball.zip"
|
||||||
|
"""
|
||||||
|
f = self.write_recipe(textwrap.dedent(r))
|
||||||
|
d = tinfoil.parse_recipe_file(f.name)
|
||||||
|
self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
|
||||||
|
self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends"))
|
||||||
|
|
||||||
|
# Verify that the downloadfilename overrides the URI
|
||||||
|
r = """
|
||||||
|
LICENSE="CLOSED"
|
||||||
|
SRC_URI="https://example.com/tarball;downloadfilename=something.zip"
|
||||||
|
"""
|
||||||
|
f = self.write_recipe(textwrap.dedent(r))
|
||||||
|
d = tinfoil.parse_recipe_file(f.name)
|
||||||
|
self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
|
||||||
|
self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends") or "")
|
||||||
|
|
||||||
|
r = """
|
||||||
|
LICENSE="CLOSED"
|
||||||
|
SRC_URI="ftp://example.com/tarball.lz"
|
||||||
|
"""
|
||||||
|
f = self.write_recipe(textwrap.dedent(r))
|
||||||
|
d = tinfoil.parse_recipe_file(f.name)
|
||||||
|
self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
|
||||||
|
self.assertIn("lzip-native", d.getVarFlag("do_unpack", "depends"))
|
||||||
|
|
||||||
|
r = """
|
||||||
|
LICENSE="CLOSED"
|
||||||
|
SRC_URI="git://example.com/repo"
|
||||||
|
"""
|
||||||
|
f = self.write_recipe(textwrap.dedent(r))
|
||||||
|
d = tinfoil.parse_recipe_file(f.name)
|
||||||
|
self.assertIn("git-native", d.getVarFlag("do_fetch", "depends"))
|
||||||
|
|||||||
Reference in New Issue
Block a user