summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/selftest/liboe.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/liboe.py b/meta/lib/oeqa/selftest/liboe.py
index 454b92a3b7..5c93069b5d 100644
--- a/meta/lib/oeqa/selftest/liboe.py
+++ b/meta/lib/oeqa/selftest/liboe.py
@@ -1,5 +1,5 @@
1from oeqa.selftest.base import oeSelfTest 1from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import get_bb_var 2from oeqa.utils.commands import get_bb_var, bitbake, runCmd
3import oe.path 3import oe.path
4import glob 4import glob
5import os 5import os
@@ -31,3 +31,34 @@ class LibOE(oeSelfTest):
31 self.assertTrue(fileindst, "File with spaces doesn't exist in dst") 31 self.assertTrue(fileindst, "File with spaces doesn't exist in dst")
32 32
33 oe.path.remove(testloc) 33 oe.path.remove(testloc)
34
35 def test_copy_tree_xattr(self):
36 """
37 Summary: oe.path.copytree() should preserve xattr on copied files
38 Expected: testxattr file in destination should have user.oetest
39 extended attribute
40 Product: OE-Core
41 Author: Joshua Lock <joshua.g.lock@intel.com>
42 """
43 tmp_dir = get_bb_var('TMPDIR')
44 testloc = oe.path.join(tmp_dir, 'liboetests')
45 src = oe.path.join(testloc, 'src')
46 dst = oe.path.join(testloc, 'dst')
47 bb.utils.mkdirhier(testloc)
48 bb.utils.mkdirhier(src)
49 testfilename = 'testxattr'
50
51 # ensure we have setfattr available
52 bitbake("attr-native")
53 bindir = get_bb_var('STAGING_BINDIR_NATIVE')
54
55 # create a file with xattr and copy it
56 open(oe.path.join(src, testfilename), 'w+b').close()
57 runCmd('%s/setfattr -n user.oetest -v "testing liboe" %s' % (bindir, oe.path.join(src, testfilename)))
58 oe.path.copytree(src, dst)
59
60 # ensure file in dest has user.oetest xattr
61 result = runCmd('%s/getfattr -n user.oetest %s' % (bindir, oe.path.join(dst, testfilename)))
62 self.assertIn('user.oetest="testing liboe"', result.output, 'Extended attribute not sert in dst')
63
64 oe.path.remove(testloc)