diff options
author | Tom Rini <trini@konsulko.com> | 2017-07-28 20:14:36 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-30 08:46:20 +0100 |
commit | 1f1d226aeddffabe3adc99b66080d4766902ac34 (patch) | |
tree | 75da6af27a143cea16a6248477d34408dad61cc4 /meta/lib/oeqa | |
parent | f809daa9acc12cf87a6da3813e94f24c2ddc563f (diff) | |
download | poky-1f1d226aeddffabe3adc99b66080d4766902ac34.tar.gz |
imagefeatures: Add a test for various hypervisor formats
We add a new test that will create core-image-minimal for wic.vmdk,
wic.vdi and wic.qcow2. We then confirm via qemu-img that the resulting
file is of the expected type.
Cc: Ed Bartosh <ed.bartosh@linux.intel.com>
(From OE-Core rev: 1392fdeaf6acc7c8d2ff9a5a2bf6ef2f5928957d)
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/imagefeatures.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py index 2c59ef6490..bb2e0dba4c 100644 --- a/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py | |||
@@ -3,6 +3,7 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu | |||
3 | from oeqa.core.decorator.oeid import OETestID | 3 | from oeqa.core.decorator.oeid import OETestID |
4 | from oeqa.utils.sshcontrol import SSHControl | 4 | from oeqa.utils.sshcontrol import SSHControl |
5 | import os | 5 | import os |
6 | import json | ||
6 | 7 | ||
7 | class ImageFeatures(OESelftestTestCase): | 8 | class ImageFeatures(OESelftestTestCase): |
8 | 9 | ||
@@ -130,6 +131,40 @@ class ImageFeatures(OESelftestTestCase): | |||
130 | # check if the resulting gzip is valid | 131 | # check if the resulting gzip is valid |
131 | self.assertTrue(runCmd('gzip -t %s' % gzip_path)) | 132 | self.assertTrue(runCmd('gzip -t %s' % gzip_path)) |
132 | 133 | ||
134 | def test_hypervisor_fmts(self): | ||
135 | """ | ||
136 | Summary: Check various hypervisor formats | ||
137 | Expected: 1. core-image-minimal can be built with vmdk, vdi and | ||
138 | qcow2 support. | ||
139 | 2. qemu-img says each image has the expected format | ||
140 | Product: oe-core | ||
141 | Author: Tom Rini <trini@konsulko.com> | ||
142 | """ | ||
143 | |||
144 | img_types = [ 'vmdk', 'vdi', 'qcow2' ] | ||
145 | features = "" | ||
146 | for itype in img_types: | ||
147 | features += 'IMAGE_FSTYPES += "wic.%s"\n' % itype | ||
148 | self.write_config(features) | ||
149 | |||
150 | image_name = 'core-image-minimal' | ||
151 | bitbake(image_name) | ||
152 | |||
153 | deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') | ||
154 | link_name = get_bb_var('IMAGE_LINK_NAME', image_name) | ||
155 | for itype in img_types: | ||
156 | image_path = os.path.join(deploy_dir_image, "%s.wic.%s" % | ||
157 | (link_name, itype)) | ||
158 | |||
159 | # check if result image file is in deploy directory | ||
160 | self.assertTrue(os.path.exists(image_path)) | ||
161 | |||
162 | # check if result image is vmdk | ||
163 | sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal') | ||
164 | result = runCmd('qemu-img info --output json %s' % image_path, | ||
165 | native_sysroot=sysroot) | ||
166 | self.assertTrue(json.loads(result.output).get('format') == itype) | ||
167 | |||
133 | def test_long_chain_conversion(self): | 168 | def test_long_chain_conversion(self): |
134 | """ | 169 | """ |
135 | Summary: Check for chaining many CONVERSION_CMDs together | 170 | Summary: Check for chaining many CONVERSION_CMDs together |