summaryrefslogtreecommitdiffstats
path: root/meta
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:24:04 +0100
commite8e81789f994bf2d256afb3d648dde16816035fd (patch)
treec2ba582a80ee0aec607e39696c3a2cdebab59bc5 /meta
parent822c708e8fd007cdefccbdbcbf7dcbe3256dcf5a (diff)
downloadpoky-e8e81789f994bf2d256afb3d648dde16816035fd.tar.gz
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>
Diffstat (limited to 'meta')
-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):
62 self.assertIn('user.oetest="testing liboe"', result.output, 'Extended attribute not sert in dst') 62 self.assertIn('user.oetest="testing liboe"', result.output, 'Extended attribute not sert in dst')
63 63
64 oe.path.remove(testloc) 64 oe.path.remove(testloc)
65
66 def test_copy_hardlink_tree_count(self):
67 """
68 Summary: oe.path.copyhardlinktree() shouldn't miss out files
69 Expected: src and dst should have the same number of files
70 Product: OE-Core
71 Author: Joshua Lock <joshua.g.lock@intel.com>
72 """
73 tmp_dir = get_bb_var('TMPDIR')
74 testloc = oe.path.join(tmp_dir, 'liboetests')
75 src = oe.path.join(testloc, 'src')
76 dst = oe.path.join(testloc, 'dst')
77 bb.utils.mkdirhier(testloc)
78 bb.utils.mkdirhier(src)
79 testfiles = ['foo', 'bar', '.baz', 'quux']
80
81 def touchfile(tf):
82 open(oe.path.join(src, tf), 'w+b').close()
83
84 for f in testfiles:
85 touchfile(f)
86
87 oe.path.copyhardlinktree(src, dst)
88
89 dstcnt = len(os.listdir(dst))
90 srccnt = len(os.listdir(src))
91 self.assertEquals(dstcnt, len(testfiles), "Number of files in dst (%s) differs from number of files in src(%s)." % (dstcnt, srccnt))
92
93 oe.path.remove(testloc)