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-11-05 22:37:12 +0000
commit4284d918dc7451f6a4d00be065369e86bbaec4d2 (patch)
tree057239079cfe6f146d8eead129979f122d805151
parentaac956a0950c05bf58af1885474cd89bb9c8fbd1 (diff)
downloadbitbake-contrib-4284d918dc7451f6a4d00be065369e86bbaec4d2.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 0fd2c0216..5a8d89285 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))