summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-09-07 10:24:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-07 11:47:50 +0100
commit3f034d2172bf64ecc43577b43e0cf032a54b1358 (patch)
treee842fb896477eb5ade766346ab9fea4f4289b8f3
parentc45453d1f6bc7bcecd84f58e2f7d93d6bd1e8499 (diff)
downloadbitbake-contrib-3f034d2172bf64ecc43577b43e0cf032a54b1358.tar.gz
tests/fetch: handle network failures gracefully
If there is a network failure the return value from latest_versionstring() is ('','') which later causes an exception when comparing versions. Improve this by checking the return value and failing the test early. [ YOCTO #12053 ] Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/tests/fetch.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index faa5c74aa..209b13f69 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -793,6 +793,7 @@ class FetchLatestVersionTest(FetcherTest):
ud = bb.fetch2.FetchData(k[1], self.d)
pupver= ud.method.latest_versionstring(ud, self.d)
verstring = pupver[0]
+ self.assertTrue(verstring, msg="Could not find upstream version")
r = bb.utils.vercmp_string(v, verstring)
self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
@@ -804,6 +805,7 @@ class FetchLatestVersionTest(FetcherTest):
ud = bb.fetch2.FetchData(k[1], self.d)
pupver = ud.method.latest_versionstring(ud, self.d)
verstring = pupver[0]
+ self.assertTrue(verstring, msg="Could not find upstream version")
r = bb.utils.vercmp_string(v, verstring)
self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))