summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-06-13 14:22:14 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-14 10:18:22 +0100
commitfc42914d426ad2dad8c3026668726c003b3ab10b (patch)
treee3dac0a9cb762325f004d5c58b1d97ea4118a6be
parenta5fc61d8f290d370f4bc51d4e2a67a5580edb1b1 (diff)
downloadopenembedded-core-contrib-fc42914d426ad2dad8c3026668726c003b3ab10b.tar.gz
openembedded-core-contrib-fc42914d426ad2dad8c3026668726c003b3ab10b.tar.bz2
openembedded-core-contrib-fc42914d426ad2dad8c3026668726c003b3ab10b.zip
selftest: add test_wic_rm test case
Added test case for "wic rm" functionality. - remove file from vfat partition - remove directory from vfat partition Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 5034587429..ee9ff0f2dd 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -855,3 +855,33 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
self.assertEqual(0, result.status)
self.assertEqual(8, len(result.output.split('\n')))
self.assertTrue(os.path.basename(testdir) in result.output)
+
+ def test_wic_rm(self):
+ """Test removing files and directories from the the wic image."""
+ self.assertEqual(0, runCmd("wic create mkefidisk "
+ "--image-name=core-image-minimal "
+ "-D -o %s" % self.resultdir).status)
+ images = glob(self.resultdir + "mkefidisk-*.direct")
+ self.assertEqual(1, len(images))
+
+ sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
+
+ # list directory content of the first partition
+ result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot))
+ self.assertEqual(0, result.status)
+ self.assertIn('\nBZIMAGE ', result.output)
+ self.assertIn('\nEFI <DIR> ', result.output)
+
+ # remove file
+ result = runCmd("wic rm %s:1/bzimage -n %s" % (images[0], sysroot))
+ self.assertEqual(0, result.status)
+
+ # remove directory
+ result = runCmd("wic rm %s:1/efi -n %s" % (images[0], sysroot))
+ self.assertEqual(0, result.status)
+
+ # check if they're removed
+ result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot))
+ self.assertEqual(0, result.status)
+ self.assertNotIn('\nBZIMAGE ', result.output)
+ self.assertNotIn('\nEFI <DIR> ', result.output)