From 1de1a34a64d2e34d438f6d24adbd70a62366dab7 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 13 Jun 2017 14:22:14 +0300 Subject: selftest: add test_wic_rm test case Added test case for "wic rm" functionality. - remove file from vfat partition - remove directory from vfat partition (From OE-Core rev: fc42914d426ad2dad8c3026668726c003b3ab10b) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/wic.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'meta/lib') 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 ', 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 ', result.output) -- cgit v1.2.3-54-g00ecf