summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-20 15:10:20 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-21 13:10:34 +0100
commitdd249ebe67095178608756aac978a7206951ccc4 (patch)
treea7c9c888f83e9d06d5e511bd65dcfdb24bb9f23d
parentad8d1d3a1545f612da6d784632b4b3027feff7f8 (diff)
downloadpoky-dd249ebe67095178608756aac978a7206951ccc4.tar.gz
bitbake: test/fetch: Add a couple of extra test cases
(From Poky rev: 01d8220ef8580ca980a14c05d500765ca2d37e2c) (Bitbake rev: 0d0a12fa0e4dabf01c1c24370aff54d26690a6dc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/tests/fetch.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index d890ec990e..9961343d76 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -46,12 +46,19 @@ class FetcherTest(unittest.TestCase):
46 ("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_1.2.3.tar.gz") 46 ("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_1.2.3.tar.gz")
47 : "http://somewhere2.org/somedir3/somefile_1.2.3.tar.gz", 47 : "http://somewhere2.org/somedir3/somefile_1.2.3.tar.gz",
48 ("http://www.apache.org/dist/subversion/subversion-1.7.1.tar.bz2", "http://www.apache.org/dist", "http://archive.apache.org/dist") 48 ("http://www.apache.org/dist/subversion/subversion-1.7.1.tar.bz2", "http://www.apache.org/dist", "http://archive.apache.org/dist")
49 : "http://archive.apache.org/dist/subversion/subversion-1.7.1.tar.bz2" 49 : "http://archive.apache.org/dist/subversion/subversion-1.7.1.tar.bz2",
50 ("http://www.apache.org/dist/subversion/subversion-1.7.1.tar.bz2", "http://.*/.*", "file:///somepath/downloads/")
51 : "file:///somepath/downloads/subversion-1.7.1.tar.bz2"
50 #Renaming files doesn't work 52 #Renaming files doesn't work
51 #("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz") : "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz" 53 #("http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere.org/somedir1/somefile_1.2.3.tar.gz", "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz") : "http://somewhere2.org/somedir3/somefile_2.3.4.tar.gz"
52 #("file://sstate-xyz.tgz", "file://.*/.*", "file:///somewhere/1234/sstate-cache") : "file:///somewhere/1234/sstate-cache/sstate-xyz.tgz", 54 #("file://sstate-xyz.tgz", "file://.*/.*", "file:///somewhere/1234/sstate-cache") : "file:///somewhere/1234/sstate-cache/sstate-xyz.tgz",
53 } 55 }
54 56
57 mirrorvar = "http://.*/.* file:///somepath/downloads/ \n" \
58 "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n" \
59 "https://.*/.* file:///someotherpath/downloads/ \n" \
60 "http://.*/.* file:///someotherpath/downloads/ \n"
61
55 def setUp(self): 62 def setUp(self):
56 self.d = bb.data.init() 63 self.d = bb.data.init()
57 self.tempdir = tempfile.mkdtemp() 64 self.tempdir = tempfile.mkdtemp()
@@ -124,6 +131,14 @@ class FetcherTest(unittest.TestCase):
124 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n") 131 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n")
125 self.gitfetcher(url1, url2) 132 self.gitfetcher(url1, url2)
126 133
134 def test_gitfetch_premirror3(self):
135 realurl = "git://git.openembedded.org/bitbake"
136 dummyurl = "git://someserver.org/bitbake"
137 self.sourcedir = self.unpackdir.replace("unpacked", "sourcemirror.git")
138 subprocess.check_output("git clone %s %s 2> /dev/null" % (realurl, self.sourcedir), shell=True)
139 self.d.setVar("PREMIRRORS", "%s git://%s;protocol=file \n" % (dummyurl, self.sourcedir))
140 self.gitfetcher(dummyurl, dummyurl)
141
127 def test_urireplace(self): 142 def test_urireplace(self):
128 for k, v in self.replaceuris.items(): 143 for k, v in self.replaceuris.items():
129 ud = bb.fetch.FetchData(k[0], self.d) 144 ud = bb.fetch.FetchData(k[0], self.d)
@@ -131,6 +146,19 @@ class FetcherTest(unittest.TestCase):
131 newuris = bb.fetch2.uri_replace(ud, k[1], k[2], self.d) 146 newuris = bb.fetch2.uri_replace(ud, k[1], k[2], self.d)
132 self.assertEqual(newuris, v) 147 self.assertEqual(newuris, v)
133 148
149 def test_urilist1(self):
150 fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
151 mirrors = bb.fetch2.mirror_from_string(self.mirrorvar)
152 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
153 self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
154
155 def test_urilist2(self):
156 # Catch https:// -> files:// bug
157 fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
158 mirrors = bb.fetch2.mirror_from_string(self.mirrorvar)
159 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
160 self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
161
134 162
135class URLHandle(unittest.TestCase): 163class URLHandle(unittest.TestCase):
136 164