summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-09-01 17:26:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-03 09:58:42 +0100
commit97677c11cf186a17439c742788a2914578d9dc99 (patch)
tree75c0bfc13bc876c120a45adefe88d796adf77650 /meta/lib
parent74d0a3dad18c9eaad9fc4b867c1ffccc49a7e459 (diff)
downloadpoky-97677c11cf186a17439c742788a2914578d9dc99.tar.gz
oeqa.selftest: add a test for oe.path.copytree()
One motivation for the use of cpio in oe.path.copytree() was to ensure that files with spaces in their names were copied. Add a new unittest module to test the OE module with a test case for copytree with a spaces in a filename. (From OE-Core rev: a408f8310d9426db4439cf8db0cf49f9bfe90b3b) 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, 33 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/liboe.py b/meta/lib/oeqa/selftest/liboe.py
new file mode 100644
index 0000000000..454b92a3b7
--- /dev/null
+++ b/meta/lib/oeqa/selftest/liboe.py
@@ -0,0 +1,33 @@
1from oeqa.selftest.base import oeSelfTest
2from oeqa.utils.commands import get_bb_var
3import oe.path
4import glob
5import os
6import os.path
7
8class LibOE(oeSelfTest):
9 def test_copy_tree_special(self):
10 """
11 Summary: oe.path.copytree() should copy files with special character
12 Expected: 'test file with sp£c!al @nd spaces' should exist in
13 copy destination
14 Product: OE-Core
15 Author: Joshua Lock <joshua.g.lock@intel.com>
16 """
17 tmp_dir = get_bb_var('TMPDIR')
18 testloc = oe.path.join(tmp_dir, 'liboetests')
19 src = oe.path.join(testloc, 'src')
20 dst = oe.path.join(testloc, 'dst')
21 bb.utils.mkdirhier(testloc)
22 bb.utils.mkdirhier(src)
23 testfilename = 'test file with sp£c!al @nd spaces'
24
25 # create the test file and copy it
26 open(oe.path.join(src, testfilename), 'w+b').close()
27 oe.path.copytree(src, dst)
28
29 # ensure path exists in dest
30 fileindst = os.path.isfile(oe.path.join(dst, testfilename))
31 self.assertTrue(fileindst, "File with spaces doesn't exist in dst")
32
33 oe.path.remove(testloc)