summaryrefslogtreecommitdiff
path: root/meta/lib/oeqa
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:31 +0100
commita408f8310d9426db4439cf8db0cf49f9bfe90b3b (patch)
treed595d466ab546d59cee5a1049c1a88a8c0e0af49 /meta/lib/oeqa
parentba6d01d432dd8244be6ac2b351477b771d5db308 (diff)
downloadopenembedded-core-a408f8310d9426db4439cf8db0cf49f9bfe90b3b.tar.gz
openembedded-core-a408f8310d9426db4439cf8db0cf49f9bfe90b3b.tar.bz2
openembedded-core-a408f8310d9426db4439cf8db0cf49f9bfe90b3b.zip
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. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-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 @@
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.commands import get_bb_var
+import oe.path
+import glob
+import os
+import os.path
+
+class LibOE(oeSelfTest):
+ def test_copy_tree_special(self):
+ """
+ Summary: oe.path.copytree() should copy files with special character
+ Expected: 'test file with sp£c!al @nd spaces' should exist in
+ copy destination
+ Product: OE-Core
+ Author: Joshua Lock <joshua.g.lock@intel.com>
+ """
+ tmp_dir = get_bb_var('TMPDIR')
+ testloc = oe.path.join(tmp_dir, 'liboetests')
+ src = oe.path.join(testloc, 'src')
+ dst = oe.path.join(testloc, 'dst')
+ bb.utils.mkdirhier(testloc)
+ bb.utils.mkdirhier(src)
+ testfilename = 'test file with sp£c!al @nd spaces'
+
+ # create the test file and copy it
+ open(oe.path.join(src, testfilename), 'w+b').close()
+ oe.path.copytree(src, dst)
+
+ # ensure path exists in dest
+ fileindst = os.path.isfile(oe.path.join(dst, testfilename))
+ self.assertTrue(fileindst, "File with spaces doesn't exist in dst")
+
+ oe.path.remove(testloc)