diff options
| author | Charlie Davies <charles.davies@whitetree.xyz> | 2020-09-16 22:12:41 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-09-23 20:55:53 +0100 |
| commit | 005f2951e2118c79d99665ce66d5bc9220f4a0b1 (patch) | |
| tree | 9b51a32180cb8de3968da7dbc664464ae8d6b255 /bitbake/lib/bb | |
| parent | 9ef2bc360d9cfc017a510f4d6ce811e6895672b4 (diff) | |
| download | poky-005f2951e2118c79d99665ce66d5bc9220f4a0b1.tar.gz | |
bitbake: bitbake: tests/fetch: add unit tests for SRC_URI with spaces in url
(Bitbake rev: e7dab75c8d1923abcbbc7c9ac7de215d720ccf26)
Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 0ecf044f38..5f24918a96 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 | ||
| 2098 | class 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 | |||
| 2083 | class NPMTest(FetcherTest): | 2130 | class NPMTest(FetcherTest): |
| 2084 | def skipIfNoNpm(): | 2131 | def skipIfNoNpm(): |
| 2085 | import shutil | 2132 | import shutil |
