[OE-core] [[PATCH v2] oeqa/selftest/wic: add test case for sparse images
Joshua Lock
joshua.lock at collabora.co.uk
Thu Dec 17 19:43:41 UTC 2015
Add a testcase to build a directdisk image and check that the
used disk size is less than the apparent size, as wic now
assembles images as sparse files.
Signed-off-by: Joshua Lock <joshua.lock at collabora.co.uk>
---
meta/lib/oeqa/selftest/wic.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 55f6f82..9050d28 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -264,3 +264,16 @@ class Wic(oeSelfTest):
self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
% image).status)
self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
+
+ def test_sparseness(self):
+ """Test that assembled images are sparse; apparent size > disk usage"""
+ self.assertEqual(0, runCmd("wic create directdisk "
+ "--image-name core-image-minimal").status)
+ images = glob(self.resultdir + "directdisk-*.direct")
+ self.assertEqual(1, len(images))
+
+ imagestat = os.stat(images.pop())
+ # st_blocks is the "number of 512-byte blocks allocated for file"
+ used = imagestat.st_blocks*512
+ apparent = imagestat.st_size
+ self.assertLess(used, apparent)
--
2.5.0
More information about the Openembedded-core
mailing list