summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-09-01 17:26:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-03 09:58:42 +0100
commit1429d9d463b5d9202735ae5924a4f6acd5c570de (patch)
tree0a7da967b262aaaa0a1e358e834fa4cd43d62388 /meta/lib
parent92f9308e2cadcd47ca66e6cc08aa7b1df261b0cc (diff)
downloadpoky-1429d9d463b5d9202735ae5924a4f6acd5c570de.tar.gz
oeqa.selftest.liboe: add test for xattr in copytree
Add a test to ensure that oe.path.copytree() preserves extended attributes on files. (From OE-Core rev: 2b047b8e3218f95978e41fee13635bff9af03dd6) 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.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)