summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorJoshua Lock <joshuagloe@gmail.com>2016-09-05 14:35:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-06 10:23:59 +0100
commitca5c718b309524e46818627f8b5c9260d009472d (patch)
tree4e8e074e61d1197e6bc977f7fd8c86fd3d6ecfd7 /meta/lib
parent2b9fdd8448c2c29418d1c3fca9fe1789466f09b4 (diff)
downloadopenembedded-core-ca5c718b309524e46818627f8b5c9260d009472d.tar.gz
openembedded-core-ca5c718b309524e46818627f8b5c9260d009472d.tar.bz2
openembedded-core-ca5c718b309524e46818627f8b5c9260d009472d.zip
selftest/liboe: add a test for copyhardlinktree()
Add a simple test to validate that the number of files in the destination matches the number of files in the source after the copyhardlinktree() has been performed. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/liboe.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/liboe.py b/meta/lib/oeqa/selftest/liboe.py
index 5c93069b5d..35131eb240 100644
--- a/meta/lib/oeqa/selftest/liboe.py
+++ b/meta/lib/oeqa/selftest/liboe.py
@@ -62,3 +62,32 @@ class LibOE(oeSelfTest):
self.assertIn('user.oetest="testing liboe"', result.output, 'Extended attribute not sert in dst')
oe.path.remove(testloc)
+
+ def test_copy_hardlink_tree_count(self):
+ """
+ Summary: oe.path.copyhardlinktree() shouldn't miss out files
+ Expected: src and dst should have the same number of files
+ Product: OE-Core
+ Author: Joshua Lock <joshua.g.lock@intel.com>
+ """
+ tmp_dir = get_bb_var('TMPDIR')
+ testloc = oe.path.join(tmp_dir, 'liboetests')
+ src = oe.path.join(testloc, 'src')
+ dst = oe.path.join(testloc, 'dst')
+ bb.utils.mkdirhier(testloc)
+ bb.utils.mkdirhier(src)
+ testfiles = ['foo', 'bar', '.baz', 'quux']
+
+ def touchfile(tf):
+ open(oe.path.join(src, tf), 'w+b').close()
+
+ for f in testfiles:
+ touchfile(f)
+
+ oe.path.copyhardlinktree(src, dst)
+
+ dstcnt = len(os.listdir(dst))
+ srccnt = len(os.listdir(src))
+ self.assertEquals(dstcnt, len(testfiles), "Number of files in dst (%s) differs from number of files in src(%s)." % (dstcnt, srccnt))
+
+ oe.path.remove(testloc)