diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2016-09-01 17:26:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-03 09:58:42 +0100 |
commit | 1429d9d463b5d9202735ae5924a4f6acd5c570de (patch) | |
tree | 0a7da967b262aaaa0a1e358e834fa4cd43d62388 /meta/lib | |
parent | 92f9308e2cadcd47ca66e6cc08aa7b1df261b0cc (diff) | |
download | poky-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.py | 33 |
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 @@ | |||
1 | from oeqa.selftest.base import oeSelfTest | 1 | from oeqa.selftest.base import oeSelfTest |
2 | from oeqa.utils.commands import get_bb_var | 2 | from oeqa.utils.commands import get_bb_var, bitbake, runCmd |
3 | import oe.path | 3 | import oe.path |
4 | import glob | 4 | import glob |
5 | import os | 5 | import 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) | ||