summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/wic.py
diff options
context:
space:
mode:
authorChee Yang Lee <chee.yang.lee@intel.com>2019-11-21 14:28:52 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-27 13:23:27 +0000
commitbd669c1809a378f93580eb9e0679a26ec6746cb8 (patch)
tree0d82d99e5d51c3f3c64eefa6e4bf4c5677e50d2f /meta/lib/oeqa/selftest/cases/wic.py
parent7356ae622bd71ba1a022a9ed18c4cf085e948b38 (diff)
downloadopenembedded-core-contrib-bd669c1809a378f93580eb9e0679a26ec6746cb8.tar.gz
wic: 'wic cp' to copy from image
currently 'wic cp' only works for copy file from local storage to wic image. enhance 'wic cp' to copy file/directory from wic image to local storage. include selftest and 'wic help' updates. [YOCTO#12169] Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/wic.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 0c03b4b02d..3c5be2f501 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -866,6 +866,13 @@ class Wic2(WicTestCase):
self.assertEqual(8, len(result.output.split('\n')))
self.assertTrue(os.path.basename(testdir) in result.output)
+ # copy the file from the partition and check if it success
+ dest = '%s-cp' % testfile.name
+ runCmd("wic cp %s:1/%s %s -n %s" % (images[0],
+ os.path.basename(testfile.name), dest, sysroot))
+ self.assertTrue(os.path.exists(dest))
+
+
def test_wic_rm(self):
"""Test removing files and directories from the the wic image."""
runCmd("wic create mkefidisk "
@@ -1005,6 +1012,16 @@ class Wic2(WicTestCase):
newdirs = set(line.split()[-1] for line in result.output.split('\n') if line)
self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)]))
+ # check if the file to copy is in the partition
+ result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
+ self.assertTrue('fstab' in [line.split()[-1] for line in result.output.split('\n') if line])
+
+ # copy file from the partition, replace the temporary file content with it and
+ # check for the file size to validate the copy
+ runCmd("wic cp %s:2/etc/fstab %s -n %s" % (images[0], testfile.name, sysroot))
+ self.assertTrue(os.stat(testfile.name).st_size > 0)
+
+
def test_wic_rm_ext(self):
"""Test removing files from the ext partition."""
runCmd("wic create mkefidisk "