diff options
author | Joshua Lock <joshua.lock@collabora.co.uk> | 2016-04-08 10:14:19 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-09 07:54:29 +0100 |
commit | 2b8299eb6b911e64d9a05b86c07b489d15eeaa5e (patch) | |
tree | 7d145bc0c8148b4fbfd666d133f1594fab28569e | |
parent | 5fd592fbae2e046bcb8c3a6c3ef4993fe0400676 (diff) | |
download | openembedded-core-2b8299eb6b911e64d9a05b86c07b489d15eeaa5e.tar.gz openembedded-core-2b8299eb6b911e64d9a05b86c07b489d15eeaa5e.tar.bz2 openembedded-core-2b8299eb6b911e64d9a05b86c07b489d15eeaa5e.zip |
oeqa/selftest/wic: add test case for sparse images
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@collabora.co.uk>
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/wic.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index a569fbf747..dd3207528e 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -276,3 +276,16 @@ class Wic(oeSelfTest): status, output = qemu.run_serial(command) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (command, output)) self.assertEqual(output, '/dev/root /\r\n/dev/vda3 /mnt') + + 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) |