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:25:18 +0000
commit89288705c682bceea52302cc607ff221ca30f3d1 (patch)
tree8a1a42dffbd49ed7fd82c7c9665575e80225c30e /meta/lib/oeqa/selftest/cases/wic.py
parent4d6a9708e6e1e1aadca7e9eb50841778d391a456 (diff)
downloadpoky-89288705c682bceea52302cc607ff221ca30f3d1.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] (From OE-Core rev: bd669c1809a378f93580eb9e0679a26ec6746cb8) 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):
866 self.assertEqual(8, len(result.output.split('\n'))) 866 self.assertEqual(8, len(result.output.split('\n')))
867 self.assertTrue(os.path.basename(testdir) in result.output) 867 self.assertTrue(os.path.basename(testdir) in result.output)
868 868
869 # copy the file from the partition and check if it success
870 dest = '%s-cp' % testfile.name
871 runCmd("wic cp %s:1/%s %s -n %s" % (images[0],
872 os.path.basename(testfile.name), dest, sysroot))
873 self.assertTrue(os.path.exists(dest))
874
875
869 def test_wic_rm(self): 876 def test_wic_rm(self):
870 """Test removing files and directories from the the wic image.""" 877 """Test removing files and directories from the the wic image."""
871 runCmd("wic create mkefidisk " 878 runCmd("wic create mkefidisk "
@@ -1005,6 +1012,16 @@ class Wic2(WicTestCase):
1005 newdirs = set(line.split()[-1] for line in result.output.split('\n') if line) 1012 newdirs = set(line.split()[-1] for line in result.output.split('\n') if line)
1006 self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)])) 1013 self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)]))
1007 1014
1015 # check if the file to copy is in the partition
1016 result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
1017 self.assertTrue('fstab' in [line.split()[-1] for line in result.output.split('\n') if line])
1018
1019 # copy file from the partition, replace the temporary file content with it and
1020 # check for the file size to validate the copy
1021 runCmd("wic cp %s:2/etc/fstab %s -n %s" % (images[0], testfile.name, sysroot))
1022 self.assertTrue(os.stat(testfile.name).st_size > 0)
1023
1024
1008 def test_wic_rm_ext(self): 1025 def test_wic_rm_ext(self):
1009 """Test removing files from the ext partition.""" 1026 """Test removing files from the ext partition."""
1010 runCmd("wic create mkefidisk " 1027 runCmd("wic create mkefidisk "