diff options
| -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 |
