Openembedded Bitbake Development
 help / color / mirror / Atom feed
* [PATCH 0/2] bitbake-selftest fixes
@ 2014-04-08 15:49 Paul Eggleton
  2014-04-08 15:49 ` [PATCH 1/2] bitbake-selftest: fix help message to include command line Paul Eggleton
  2014-04-08 15:49 ` [PATCH 2/2] bitbake-selftest: add tests for local fetching Paul Eggleton
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggleton @ 2014-04-08 15:49 UTC (permalink / raw)
  To: bitbake-devel

The following changes since commit 35c67281775b08925957c32663d587d486944e0e:

  hob: add "recipes/images/" to BBFILES when Hob is launched (2014-04-08 13:06:34 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib paule/selftest2
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/selftest2

Paul Eggleton (2):
  bitbake-selftest: fix help message to include command line
  bitbake-selftest: add tests for local fetching

 bin/bitbake-selftest  |  2 +-
 lib/bb/tests/fetch.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

-- 
1.9.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] bitbake-selftest: fix help message to include command line
  2014-04-08 15:49 [PATCH 0/2] bitbake-selftest fixes Paul Eggleton
@ 2014-04-08 15:49 ` Paul Eggleton
  2014-04-08 15:49 ` [PATCH 2/2] bitbake-selftest: add tests for local fetching Paul Eggleton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2014-04-08 15:49 UTC (permalink / raw)
  To: bitbake-devel

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bin/bitbake-selftest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/bitbake-selftest b/bin/bitbake-selftest
index 8c55f7b..81e4c3c 100755
--- a/bin/bitbake-selftest
+++ b/bin/bitbake-selftest
@@ -26,7 +26,7 @@ except RuntimeError as exc:
     sys.exit(str(exc))
 
 def usage():
-    print('usage: %s [testname1 [testname2]...]')
+    print('usage: %s [testname1 [testname2]...]' % os.path.basename(sys.argv[0]))
 
 if len(sys.argv) > 1:
     if '--help' in sys.argv[1:]:
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] bitbake-selftest: add tests for local fetching
  2014-04-08 15:49 [PATCH 0/2] bitbake-selftest fixes Paul Eggleton
  2014-04-08 15:49 ` [PATCH 1/2] bitbake-selftest: fix help message to include command line Paul Eggleton
@ 2014-04-08 15:49 ` Paul Eggleton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2014-04-08 15:49 UTC (permalink / raw)
  To: bitbake-devel

Add some explicit tests for unpacking local files to the appropriate
location. Some of these tests are actually testing for broken behaviour;
these have been called out in the comments, and associated bugs have
been filed.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/tests/fetch.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 4be5a07..7df7a0e 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -390,6 +390,61 @@ class MirrorUriTest(FetcherTest):
         uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
         self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
 
+
+class FetcherLocalTest(FetcherTest):
+    def setUp(self):
+        def touch(fn):
+            with file(fn, 'a'):
+                os.utime(fn, None)
+
+        super(FetcherLocalTest, self).setUp()
+        self.localsrcdir = os.path.join(self.tempdir, 'localsrc')
+        os.makedirs(self.localsrcdir)
+        touch(os.path.join(self.localsrcdir, 'a'))
+        touch(os.path.join(self.localsrcdir, 'b'))
+        os.makedirs(os.path.join(self.localsrcdir, 'dir'))
+        touch(os.path.join(self.localsrcdir, 'dir', 'c'))
+        touch(os.path.join(self.localsrcdir, 'dir', 'd'))
+        os.makedirs(os.path.join(self.localsrcdir, 'dir', 'subdir'))
+        touch(os.path.join(self.localsrcdir, 'dir', 'subdir', 'e'))
+        self.d.setVar("FILESPATH", self.localsrcdir)
+
+    def fetchUnpack(self, uris):
+        fetcher = bb.fetch.Fetch(uris, self.d)
+        fetcher.download()
+        fetcher.unpack(self.unpackdir)
+        flst = []
+        for root, dirs, files in os.walk(self.unpackdir):
+            for f in files:
+                flst.append(os.path.relpath(os.path.join(root, f), self.unpackdir))
+        flst.sort()
+        return flst
+
+    def test_local(self):
+        tree = self.fetchUnpack(['file://a', 'file://dir/c'])
+        self.assertEqual(tree, ['a', 'dir/c'])
+
+    def test_local_wildcard(self):
+        tree = self.fetchUnpack(['file://a', 'file://dir/*'])
+        # FIXME: this is broken - it should return ['a', 'dir/c', 'dir/d', 'dir/subdir/e']
+        # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=6128
+        self.assertEqual(tree, ['a', 'b', 'dir/c', 'dir/d', 'dir/subdir/e'])
+
+    def test_local_dir(self):
+        tree = self.fetchUnpack(['file://a', 'file://dir'])
+        self.assertEqual(tree, ['a', 'dir/c', 'dir/d', 'dir/subdir/e'])
+
+    def test_local_subdir(self):
+        tree = self.fetchUnpack(['file://dir/subdir'])
+        # FIXME: this is broken - it should return ['dir/subdir/e']
+        # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=6129
+        self.assertEqual(tree, ['subdir/e'])
+
+    def test_local_subdir_file(self):
+        tree = self.fetchUnpack(['file://dir/subdir/e'])
+        self.assertEqual(tree, ['dir/subdir/e'])
+
+
 class FetcherNetworkTest(FetcherTest):
 
     if os.environ.get("BB_SKIP_NETTESTS") == "yes":
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-08 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-08 15:49 [PATCH 0/2] bitbake-selftest fixes Paul Eggleton
2014-04-08 15:49 ` [PATCH 1/2] bitbake-selftest: fix help message to include command line Paul Eggleton
2014-04-08 15:49 ` [PATCH 2/2] bitbake-selftest: add tests for local fetching Paul Eggleton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox