summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/fetch.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-20 17:53:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-22 15:56:39 +0000
commitca3993cc4b13d4e661228cee6fb9448adfd0a4ba (patch)
tree7bfdd2411a144e7acad6ee111880d7a9c0d391cc /bitbake/lib/bb/tests/fetch.py
parent244141ef8cb01728cecf50b2d2702dbe0573ab0d (diff)
downloadpoky-e0e56736cb6d6ef748f21d44d5f0db701e9c9e52.tar.gz
bitbake: tests/fetch: Allow wget upgrade tests to run against a local server3.1_M2
Currently these tests rely upon multiple uptream webservers which may change or be unavailable. Add local copies of the test data, copy the httpserver from OE-Core (used for testing there) and run these tests against a local server instead. (Bitbake rev: d5a4a352723258b4d499d3a51f340109c4f36f60) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r--bitbake/lib/bb/tests/fetch.py70
1 files changed, 50 insertions, 20 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 4d347dead7..fa0c5c5ae3 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -14,6 +14,7 @@ import os
14from bb.fetch2 import URI 14from bb.fetch2 import URI
15from bb.fetch2 import FetchMethod 15from bb.fetch2 import FetchMethod
16import bb 16import bb
17from bb.tests.support.httpserver import HTTPService
17 18
18def skipIfNoNetwork(): 19def skipIfNoNetwork():
19 if os.environ.get("BB_SKIP_NETTESTS") == "yes": 20 if os.environ.get("BB_SKIP_NETTESTS") == "yes":
@@ -1179,27 +1180,46 @@ class FetchLatestVersionTest(FetcherTest):
1179 } 1180 }
1180 1181
1181 test_wget_uris = { 1182 test_wget_uris = {
1183 #
1182 # packages with versions inside directory name 1184 # packages with versions inside directory name
1183 ("util-linux", "http://kernel.org/pub/linux/utils/util-linux/v2.23/util-linux-2.24.2.tar.bz2", "", "") 1185 #
1186 # http://kernel.org/pub/linux/utils/util-linux/v2.23/util-linux-2.24.2.tar.bz2
1187 ("util-linux", "/pub/linux/utils/util-linux/v2.23/util-linux-2.24.2.tar.bz2", "", "")
1184 : "2.24.2", 1188 : "2.24.2",
1185 ("enchant", "http://www.abisource.com/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz", "", "") 1189 # http://www.abisource.com/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz
1190 ("enchant", "/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz", "", "")
1186 : "1.6.0", 1191 : "1.6.0",
1187 ("cmake", "http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz", "", "") 1192 # http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
1193 ("cmake", "/files/v2.8/cmake-2.8.12.1.tar.gz", "", "")
1188 : "2.8.12.1", 1194 : "2.8.12.1",
1195 #
1189 # packages with versions only in current directory 1196 # packages with versions only in current directory
1190 ("eglic", "http://downloads.yoctoproject.org/releases/eglibc/eglibc-2.18-svnr23787.tar.bz2", "", "") 1197 #
1198 # http://downloads.yoctoproject.org/releases/eglibc/eglibc-2.18-svnr23787.tar.bz2
1199 ("eglic", "/releases/eglibc/eglibc-2.18-svnr23787.tar.bz2", "", "")
1191 : "2.19", 1200 : "2.19",
1192 ("gnu-config", "http://downloads.yoctoproject.org/releases/gnu-config/gnu-config-20120814.tar.bz2", "", "") 1201 # http://downloads.yoctoproject.org/releases/gnu-config/gnu-config-20120814.tar.bz2
1202 ("gnu-config", "/releases/gnu-config/gnu-config-20120814.tar.bz2", "", "")
1193 : "20120814", 1203 : "20120814",
1204 #
1194 # packages with "99" in the name of possible version 1205 # packages with "99" in the name of possible version
1195 ("pulseaudio", "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-4.0.tar.xz", "", "") 1206 #
1207 # http://freedesktop.org/software/pulseaudio/releases/pulseaudio-4.0.tar.xz
1208 ("pulseaudio", "/software/pulseaudio/releases/pulseaudio-4.0.tar.xz", "", "")
1196 : "5.0", 1209 : "5.0",
1197 ("xserver-xorg", "http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.15.1.tar.bz2", "", "") 1210 # http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.15.1.tar.bz2
1211 ("xserver-xorg", "/releases/individual/xserver/xorg-server-1.15.1.tar.bz2", "", "")
1198 : "1.15.1", 1212 : "1.15.1",
1213 #
1199 # packages with valid UPSTREAM_CHECK_URI and UPSTREAM_CHECK_REGEX 1214 # packages with valid UPSTREAM_CHECK_URI and UPSTREAM_CHECK_REGEX
1200 ("cups", "http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2", "https://github.com/apple/cups/releases", "(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz") 1215 #
1216 # http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2
1217 # https://github.com/apple/cups/releases
1218 ("cups", "/software/1.7.2/cups-1.7.2-source.tar.bz2", "/apple/cups/releases", "(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz")
1201 : "2.0.0", 1219 : "2.0.0",
1202 ("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://ftp.debian.org/debian/pool/main/d/db5.3/", "(?P<name>db5\.3_)(?P<pver>\d+(\.\d+)+).+\.orig\.tar\.xz") 1220 # http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz
1221 # http://ftp.debian.org/debian/pool/main/d/db5.3/
1222 ("db", "/berkeley-db/db-5.3.21.tar.gz", "/debian/pool/main/d/db5.3/", "(?P<name>db5\.3_)(?P<pver>\d+(\.\d+)+).+\.orig\.tar\.xz")
1203 : "5.3.10", 1223 : "5.3.10",
1204 } 1224 }
1205 1225
@@ -1216,18 +1236,28 @@ class FetchLatestVersionTest(FetcherTest):
1216 r = bb.utils.vercmp_string(v, verstring) 1236 r = bb.utils.vercmp_string(v, verstring)
1217 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring)) 1237 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
1218 1238
1219 @skipIfNoNetwork()
1220 def test_wget_latest_versionstring(self): 1239 def test_wget_latest_versionstring(self):
1221 for k, v in self.test_wget_uris.items(): 1240 testdata = os.path.dirname(os.path.abspath(__file__)) + "/fetch-testdata"
1222 self.d.setVar("PN", k[0]) 1241 server = HTTPService(testdata)
1223 self.d.setVar("UPSTREAM_CHECK_URI", k[2]) 1242 server.start()
1224 self.d.setVar("UPSTREAM_CHECK_REGEX", k[3]) 1243 port = server.port
1225 ud = bb.fetch2.FetchData(k[1], self.d) 1244 try:
1226 pupver = ud.method.latest_versionstring(ud, self.d) 1245 for k, v in self.test_wget_uris.items():
1227 verstring = pupver[0] 1246 self.d.setVar("PN", k[0])
1228 self.assertTrue(verstring, msg="Could not find upstream version for %s" % k[0]) 1247 checkuri = ""
1229 r = bb.utils.vercmp_string(v, verstring) 1248 if k[2]:
1230 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring)) 1249 checkuri = "http://localhost:%s/" % port + k[2]
1250 self.d.setVar("UPSTREAM_CHECK_URI", checkuri)
1251 self.d.setVar("UPSTREAM_CHECK_REGEX", k[3])
1252 url = "http://localhost:%s/" % port + k[1]
1253 ud = bb.fetch2.FetchData(url, self.d)
1254 pupver = ud.method.latest_versionstring(ud, self.d)
1255 verstring = pupver[0]
1256 self.assertTrue(verstring, msg="Could not find upstream version for %s" % k[0])
1257 r = bb.utils.vercmp_string(v, verstring)
1258 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
1259 finally:
1260 server.stop()
1231 1261
1232 1262
1233class FetchCheckStatusTest(FetcherTest): 1263class FetchCheckStatusTest(FetcherTest):