summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2022-12-05 22:38:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-08 10:48:36 +0000
commitcc1c4506bade3b028294efe64d5862ba9be1ad4c (patch)
treee2b50eca731d2c76894214230a9e9f2f2c75f31c /meta
parentf4d5ffd4d8ca06a44ad292159068c2f54912a942 (diff)
downloadpoky-cc1c4506bade3b028294efe64d5862ba9be1ad4c.tar.gz
oeqa/selftest/externalsrc: add test for srctree_hash_files
(From OE-Core rev: 7b9728e5b8bdf1193c1304ec3beeca4b5bf8d2da) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/cases/externalsrc.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/externalsrc.py b/meta/lib/oeqa/selftest/cases/externalsrc.py
new file mode 100644
index 0000000000..1d800dc82c
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/externalsrc.py
@@ -0,0 +1,44 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7import os
8import shutil
9import tempfile
10
11from oeqa.selftest.case import OESelftestTestCase
12from oeqa.utils.commands import get_bb_var, runCmd
13
14class ExternalSrc(OESelftestTestCase):
15 # test that srctree_hash_files does not crash
16 # we should be actually checking do_compile[file-checksums] but oeqa currently does not support it
17 # so we check only that a recipe with externalsrc can be parsed
18 def test_externalsrc_srctree_hash_files(self):
19 test_recipe = "git-submodule-test"
20 git_url = "git://git.yoctoproject.org/git-submodule-test"
21 externalsrc_dir = tempfile.TemporaryDirectory(prefix="externalsrc").name
22
23 self.write_config(
24 """
25INHERIT += "externalsrc"
26EXTERNALSRC:pn-%s = "%s"
27""" % (test_recipe, externalsrc_dir)
28 )
29
30 # test with git without submodules
31 runCmd('git clone %s %s' % (git_url, externalsrc_dir))
32 os.unlink(externalsrc_dir + "/.gitmodules")
33 open(".gitmodules", 'w').close() # local file .gitmodules in cwd should not affect externalsrc parsing
34 self.assertEqual(get_bb_var("S", test_recipe), externalsrc_dir, msg = "S does not equal to EXTERNALSRC")
35 os.unlink(".gitmodules")
36
37 # test with git with submodules
38 runCmd('git checkout .gitmodules', cwd=externalsrc_dir)
39 runCmd('git submodule update --init --recursive', cwd=externalsrc_dir)
40 self.assertEqual(get_bb_var("S", test_recipe), externalsrc_dir, msg = "S does not equal to EXTERNALSRC")
41
42 # test without git
43 shutil.rmtree(os.path.join(externalsrc_dir, ".git"))
44 self.assertEqual(get_bb_var("S", test_recipe), externalsrc_dir, msg = "S does not equal to EXTERNALSRC")