summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-09-05 14:54:42 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-11 17:30:29 +0100
commite1d59cbab42af44e33f44b5f3a10e07890d7180a (patch)
tree40e0c11169023c203c4f651858e9f70aa0a9e402
parentf5a679e9b13c693fe0fc1f4747479a79fe6a096a (diff)
downloadpoky-e1d59cbab42af44e33f44b5f3a10e07890d7180a.tar.gz
wic: selftest: add test_wic_rm_ext test case
Tested if 'wic rm' correctly removes files from the ext4 partition of the wic image. (From OE-Core rev: 693b555e4f419b5d24f9f86c44354866492f8bb0) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 00d1b64469..651d575dc3 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1038,3 +1038,26 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
1038 newdirs = set(line.split()[-1] for line in result.output.split('\n') if line) 1038 newdirs = set(line.split()[-1] for line in result.output.split('\n') if line)
1039 self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)])) 1039 self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)]))
1040 1040
1041 def test_wic_rm_ext(self):
1042 """Test removing files from the ext partition."""
1043 self.assertEqual(0, runCmd("wic create mkefidisk "
1044 "--image-name=core-image-minimal "
1045 "-D -o %s" % self.resultdir).status)
1046 images = glob(self.resultdir + "mkefidisk-*.direct")
1047 self.assertEqual(1, len(images))
1048
1049 sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
1050
1051 # list directory content of the /etc directory on ext4 partition
1052 result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
1053 self.assertEqual(0, result.status)
1054 self.assertTrue('fstab' in [line.split()[-1] for line in result.output.split('\n') if line])
1055
1056 # remove file
1057 result = runCmd("wic rm %s:2/etc/fstab -n %s" % (images[0], sysroot))
1058 self.assertEqual(0, result.status)
1059
1060 # check if it's removed
1061 result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot))
1062 self.assertEqual(0, result.status)
1063 self.assertTrue('fstab' not in [line.split()[-1] for line in result.output.split('\n') if line])