summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorOlof Johansson <olof.johansson@axis.com>2013-03-26 09:28:38 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-03-29 10:45:17 +0000
commit911dbbd8ee4bb4aada554e0975eba1570db4c6d1 (patch)
treeb255982dbc9532c6442f8bcf0217ac47d275cfec /bitbake
parent2f4fe1ee111a3dff68ac1cea6f3f6767cd6fe4eb (diff)
downloadpoky-911dbbd8ee4bb4aada554e0975eba1570db4c6d1.tar.gz
bitbake: bb.tests.fetch: Opt-out for unittests that require network
With this change, you can opt-out to skip unit tests that require an internet connection. To opt-out, you'll set the environment variable BB_SKIP_NETTESTS to 'yes'. (Bitbake rev: 9ff5f172096a4f51b6b085307506473405dc4f59) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tests/fetch.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 778d94f872..46db7e5c60 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -308,6 +308,8 @@ class FetcherTest(unittest.TestCase):
308 def tearDown(self): 308 def tearDown(self):
309 bb.utils.prunedir(self.tempdir) 309 bb.utils.prunedir(self.tempdir)
310 310
311 @unittest.skipIf(os.environ.get("BB_SKIP_NETTESTS") == "yes",
312 "Unset BB_SKIP_NETTESTS to run network tests")
311 def test_fetch(self): 313 def test_fetch(self):
312 fetcher = bb.fetch.Fetch(["http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d) 314 fetcher = bb.fetch.Fetch(["http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d)
313 fetcher.download() 315 fetcher.download()
@@ -320,12 +322,16 @@ class FetcherTest(unittest.TestCase):
320 self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.0/")), 9) 322 self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.0/")), 9)
321 self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.1/")), 9) 323 self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.1/")), 9)
322 324
325 @unittest.skipIf(os.environ.get("BB_SKIP_NETTESTS") == "yes",
326 "Unset BB_SKIP_NETTESTS to run network tests")
323 def test_fetch_mirror(self): 327 def test_fetch_mirror(self):
324 self.d.setVar("MIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake") 328 self.d.setVar("MIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake")
325 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) 329 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
326 fetcher.download() 330 fetcher.download()
327 self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) 331 self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
328 332
333 @unittest.skipIf(os.environ.get("BB_SKIP_NETTESTS") == "yes",
334 "Unset BB_SKIP_NETTESTS to run network tests")
329 def test_fetch_premirror(self): 335 def test_fetch_premirror(self):
330 self.d.setVar("PREMIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake") 336 self.d.setVar("PREMIRRORS", "http://.*/.* http://downloads.yoctoproject.org/releases/bitbake")
331 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) 337 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
@@ -351,21 +357,29 @@ class FetcherTest(unittest.TestCase):
351 fetcher.download() 357 fetcher.download()
352 checkrevision(self, fetcher) 358 checkrevision(self, fetcher)
353 359
360 @unittest.skipIf(os.environ.get("BB_SKIP_NETTESTS") == "yes",
361 "Unset BB_SKIP_NETTESTS to run network tests")
354 def test_gitfetch(self): 362 def test_gitfetch(self):
355 url1 = url2 = "git://git.openembedded.org/bitbake" 363 url1 = url2 = "git://git.openembedded.org/bitbake"
356 self.gitfetcher(url1, url2) 364 self.gitfetcher(url1, url2)
357 365
366 @unittest.skipIf(os.environ.get("BB_SKIP_NETTESTS") == "yes",
367 "Unset BB_SKIP_NETTESTS to run network tests")
358 def test_gitfetch_premirror(self): 368 def test_gitfetch_premirror(self):
359 url1 = "git://git.openembedded.org/bitbake" 369 url1 = "git://git.openembedded.org/bitbake"
360 url2 = "git://someserver.org/bitbake" 370 url2 = "git://someserver.org/bitbake"
361 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n") 371 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n")
362 self.gitfetcher(url1, url2) 372 self.gitfetcher(url1, url2)
363 373
374 @unittest.skipIf(os.environ.get("BB_SKIP_NETTESTS") == "yes",
375 "Unset BB_SKIP_NETTESTS to run network tests")
364 def test_gitfetch_premirror2(self): 376 def test_gitfetch_premirror2(self):
365 url1 = url2 = "git://someserver.org/bitbake" 377 url1 = url2 = "git://someserver.org/bitbake"
366 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n") 378 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n")
367 self.gitfetcher(url1, url2) 379 self.gitfetcher(url1, url2)
368 380
381 @unittest.skipIf(os.environ.get("BB_SKIP_NETTESTS") == "yes",
382 "Unset BB_SKIP_NETTESTS to run network tests")
369 def test_gitfetch_premirror3(self): 383 def test_gitfetch_premirror3(self):
370 realurl = "git://git.openembedded.org/bitbake" 384 realurl = "git://git.openembedded.org/bitbake"
371 dummyurl = "git://someserver.org/bitbake" 385 dummyurl = "git://someserver.org/bitbake"