summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/fetch.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r--bitbake/lib/bb/tests/fetch.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 4be5a07bec..7df7a0ef51 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -390,6 +390,61 @@ class MirrorUriTest(FetcherTest):
390 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) 390 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
391 self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz']) 391 self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
392 392
393
394class FetcherLocalTest(FetcherTest):
395 def setUp(self):
396 def touch(fn):
397 with file(fn, 'a'):
398 os.utime(fn, None)
399
400 super(FetcherLocalTest, self).setUp()
401 self.localsrcdir = os.path.join(self.tempdir, 'localsrc')
402 os.makedirs(self.localsrcdir)
403 touch(os.path.join(self.localsrcdir, 'a'))
404 touch(os.path.join(self.localsrcdir, 'b'))
405 os.makedirs(os.path.join(self.localsrcdir, 'dir'))
406 touch(os.path.join(self.localsrcdir, 'dir', 'c'))
407 touch(os.path.join(self.localsrcdir, 'dir', 'd'))
408 os.makedirs(os.path.join(self.localsrcdir, 'dir', 'subdir'))
409 touch(os.path.join(self.localsrcdir, 'dir', 'subdir', 'e'))
410 self.d.setVar("FILESPATH", self.localsrcdir)
411
412 def fetchUnpack(self, uris):
413 fetcher = bb.fetch.Fetch(uris, self.d)
414 fetcher.download()
415 fetcher.unpack(self.unpackdir)
416 flst = []
417 for root, dirs, files in os.walk(self.unpackdir):
418 for f in files:
419 flst.append(os.path.relpath(os.path.join(root, f), self.unpackdir))
420 flst.sort()
421 return flst
422
423 def test_local(self):
424 tree = self.fetchUnpack(['file://a', 'file://dir/c'])
425 self.assertEqual(tree, ['a', 'dir/c'])
426
427 def test_local_wildcard(self):
428 tree = self.fetchUnpack(['file://a', 'file://dir/*'])
429 # FIXME: this is broken - it should return ['a', 'dir/c', 'dir/d', 'dir/subdir/e']
430 # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=6128
431 self.assertEqual(tree, ['a', 'b', 'dir/c', 'dir/d', 'dir/subdir/e'])
432
433 def test_local_dir(self):
434 tree = self.fetchUnpack(['file://a', 'file://dir'])
435 self.assertEqual(tree, ['a', 'dir/c', 'dir/d', 'dir/subdir/e'])
436
437 def test_local_subdir(self):
438 tree = self.fetchUnpack(['file://dir/subdir'])
439 # FIXME: this is broken - it should return ['dir/subdir/e']
440 # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=6129
441 self.assertEqual(tree, ['subdir/e'])
442
443 def test_local_subdir_file(self):
444 tree = self.fetchUnpack(['file://dir/subdir/e'])
445 self.assertEqual(tree, ['dir/subdir/e'])
446
447
393class FetcherNetworkTest(FetcherTest): 448class FetcherNetworkTest(FetcherTest):
394 449
395 if os.environ.get("BB_SKIP_NETTESTS") == "yes": 450 if os.environ.get("BB_SKIP_NETTESTS") == "yes":