summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests
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-11 17:19:37 +0100
commit96f258ba12d3184a631e846c73a23d131ebc6e7e (patch)
tree1a55b596653cefa6e2ebafad5c4631670ae7461d /bitbake/lib/bb/tests
parent384d97663190535c512f4de3e4bdf093d0924ef7 (diff)
downloadpoky-96f258ba12d3184a631e846c73a23d131ebc6e7e.tar.gz
bitbake: 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 ] (Bitbake rev: 3f034d2172bf64ecc43577b43e0cf032a54b1358) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r--bitbake/lib/bb/tests/fetch.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index faa5c74aae..209b13f695 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -793,6 +793,7 @@ class FetchLatestVersionTest(FetcherTest):
793 ud = bb.fetch2.FetchData(k[1], self.d) 793 ud = bb.fetch2.FetchData(k[1], self.d)
794 pupver= ud.method.latest_versionstring(ud, self.d) 794 pupver= ud.method.latest_versionstring(ud, self.d)
795 verstring = pupver[0] 795 verstring = pupver[0]
796 self.assertTrue(verstring, msg="Could not find upstream version")
796 r = bb.utils.vercmp_string(v, verstring) 797 r = bb.utils.vercmp_string(v, verstring)
797 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring)) 798 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
798 799
@@ -804,6 +805,7 @@ class FetchLatestVersionTest(FetcherTest):
804 ud = bb.fetch2.FetchData(k[1], self.d) 805 ud = bb.fetch2.FetchData(k[1], self.d)
805 pupver = ud.method.latest_versionstring(ud, self.d) 806 pupver = ud.method.latest_versionstring(ud, self.d)
806 verstring = pupver[0] 807 verstring = pupver[0]
808 self.assertTrue(verstring, msg="Could not find upstream version")
807 r = bb.utils.vercmp_string(v, verstring) 809 r = bb.utils.vercmp_string(v, verstring)
808 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring)) 810 self.assertTrue(r == -1 or r == 0, msg="Package %s, version: %s <= %s" % (k[0], v, verstring))
809 811