[gnome-continuous-yocto/gnomeostree-3.28-rocko: 2284/8267] selftest/liboe: add a test for copyhardlinktree()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 2284/8267] selftest/liboe: add a test for copyhardlinktree()
- Date: Sat, 16 Dec 2017 23:00:52 +0000 (UTC)
commit e8e81789f994bf2d256afb3d648dde16816035fd
Author: Joshua Lock <joshuagloe gmail com>
Date: Mon Sep 5 14:35:10 2016 +0100
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.
(From OE-Core rev: ca5c718b309524e46818627f8b5c9260d009472d)
Signed-off-by: Joshua Lock <joshua g lock intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
meta/lib/oeqa/selftest/liboe.py | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/meta/lib/oeqa/selftest/liboe.py b/meta/lib/oeqa/selftest/liboe.py
index 5c93069..35131eb 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]