summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorCharlie Davies <charles.davies@whitetree.xyz>2020-10-12 05:07:53 -1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-13 09:40:10 +0100
commitcd38c4db87cd4bcef7abf7cd368d137dca7842e9 (patch)
tree00ba220402ce61563fe807c26949956aafef1e57 /bitbake
parent52daea2287c868cec6008cb407933b673675e08e (diff)
downloadpoky-cd38c4db87cd4bcef7abf7cd368d137dca7842e9.tar.gz
bitbake: bitbake: tests/fetch: add unit tests for SRC_URI with spaces in url
(Bitbake rev: d8daad57bdbceec041c4c2d288ed5d487ad8e6dc) Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit e7dab75c8d1923abcbbc7c9ac7de215d720ccf26) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tests/fetch.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index b188354152..f7fe78b4ae 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -223,6 +223,21 @@ class URITest(unittest.TestCase):
223 'query': {}, 223 'query': {},
224 'relative': False 224 'relative': False
225 }, 225 },
226 "git://tfs-example.org:22/tfs/example%20path/example.git": {
227 'uri': 'git://tfs-example.org:22/tfs/example%20path/example.git',
228 'scheme': 'git',
229 'hostname': 'tfs-example.org',
230 'port': 22,
231 'hostport': 'tfs-example.org:22',
232 'path': '/tfs/example path/example.git',
233 'userinfo': '',
234 'userinfo': '',
235 'username': '',
236 'password': '',
237 'params': {},
238 'query': {},
239 'relative': False
240 },
226 "http://somesite.net;someparam=1": { 241 "http://somesite.net;someparam=1": {
227 'uri': 'http://somesite.net;someparam=1', 242 'uri': 'http://somesite.net;someparam=1',
228 'scheme': 'http', 243 'scheme': 'http',
@@ -2080,6 +2095,38 @@ class GitLfsTest(FetcherTest):
2080 shutil.rmtree(self.gitdir, ignore_errors=True) 2095 shutil.rmtree(self.gitdir, ignore_errors=True)
2081 fetcher.unpack(self.d.getVar('WORKDIR')) 2096 fetcher.unpack(self.d.getVar('WORKDIR'))
2082 2097
2098class GitURLWithSpacesTest(FetcherTest):
2099 test_git_urls = {
2100 "git://tfs-example.org:22/tfs/example%20path/example.git" : {
2101 'url': 'git://tfs-example.org:22/tfs/example%20path/example.git',
2102 'gitsrcname': 'tfs-example.org.22.tfs.example_path.example.git',
2103 'path': '/tfs/example path/example.git'
2104 },
2105 "git://tfs-example.org:22/tfs/example%20path/example%20repo.git" : {
2106 'url': 'git://tfs-example.org:22/tfs/example%20path/example%20repo.git',
2107 'gitsrcname': 'tfs-example.org.22.tfs.example_path.example_repo.git',
2108 'path': '/tfs/example path/example repo.git'
2109 }
2110 }
2111
2112 def test_urls(self):
2113
2114 # Set fake SRCREV to stop git fetcher from trying to contact non-existent git repo
2115 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
2116
2117 for test_git_url, ref in self.test_git_urls.items():
2118
2119 fetcher = bb.fetch.Fetch([test_git_url], self.d)
2120 ud = fetcher.ud[fetcher.urls[0]]
2121
2122 self.assertEqual(ud.url, ref['url'])
2123 self.assertEqual(ud.path, ref['path'])
2124 self.assertEqual(ud.localfile, os.path.join(self.dldir, "git2", ref['gitsrcname']))
2125 self.assertEqual(ud.localpath, os.path.join(self.dldir, "git2", ref['gitsrcname']))
2126 self.assertEqual(ud.lockfile, os.path.join(self.dldir, "git2", ref['gitsrcname'] + '.lock'))
2127 self.assertEqual(ud.clonedir, os.path.join(self.dldir, "git2", ref['gitsrcname']))
2128 self.assertEqual(ud.fullmirror, os.path.join(self.dldir, "git2_" + ref['gitsrcname'] + '.tar.gz'))
2129
2083class NPMTest(FetcherTest): 2130class NPMTest(FetcherTest):
2084 def skipIfNoNpm(): 2131 def skipIfNoNpm():
2085 import shutil 2132 import shutil