summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2023-03-13 13:15:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-22 13:53:29 +0000
commit248f6f01cf385bd8b3dc09a8dd1c39c5e0cc0f84 (patch)
treeaa72df67bb0269ce95a4c0dffcf28fc513e6160f /meta
parent92c9dfe1d3f253323482199a8a5a39816492ec2f (diff)
downloadpoky-248f6f01cf385bd8b3dc09a8dd1c39c5e0cc0f84.tar.gz
selftest: imagefeatures.py: respect IMAGE_LINK_NAME for debugfs and manifest as well
* these cases were correctly respecting IMAGE_LINK_NAME in most tests * the only exception was relatively wide glob for manifest: "test-empty-image-*.manifest" * and even wider glob for -dbg: "*-dbg.rootfs.tar.bz2" * replace them with the exact filename we expect for given image * be aware that gzip won't accept the symlink in IMAGE_LINK_NAME causing: 2023-03-13 08:58:23,845 - oe-selftest - INFO - ... FAIL 2023-03-13 08:58:23,845 - oe-selftest - INFO - Traceback (most recent call last): File "/OE/build/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py", line 124, in test_bmap self.assertTrue(runCmd('gzip -t %s' % gzip_path)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/OE/build/poky/meta/lib/oeqa/utils/commands.py", line 214, in runCmd raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output)) AssertionError: Command 'gzip -t /OE/build/poky/build/build-st-2023-03-12-todo-patch2/imagefeatures.ImageFeatures.test_bmap/build-st/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.ext4.bmap.gz' returned non-zero exit status 1: gzip: skipping: /OE/build/poky/build/build-st-2023-03-12-todo-patch2/imagefeatures.ImageFeatures.test_bmap/build-st/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.ext4.bmap.gz is a symbolic link * and "*-dbg.rootfs.tar.bz2" doesn't work if IMAGE_NAME_SUFFIX is changed to anything else than ".rootfs" or moved into IMAGE_LINK_NAME (like I plan in future changes where this will need to be updated again). Luckily we can use the symlink which currently doesn't have IMAGE_NAME_SUFFIX nor the DATETIME, so we don't need to search for it with glob, e.g. currently: core-image-minimal-qemux86-64-dbg-20230313112546-dbg.rootfs.tar.bz2 core-image-minimal-qemux86-64-dbg.tar.bz2 -> core-image-minimal-qemux86-64-dbg-20230313112546-dbg.rootfs.tar.bz2 [YOCTO #12937] (From OE-Core rev: 39285e981343930e41afe4eb8f2db675a85d54c2) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/cases/imagefeatures.py82
1 files changed, 40 insertions, 42 deletions
diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py
index bdd4d3200e..3dc750594c 100644
--- a/meta/lib/oeqa/selftest/cases/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py
@@ -6,7 +6,7 @@
6 6
7from oeqa.selftest.case import OESelftestTestCase 7from oeqa.selftest.case import OESelftestTestCase
8from oeqa.core.decorator import OETestTag 8from oeqa.core.decorator import OETestTag
9from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu 9from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
10from oeqa.utils.sshcontrol import SSHControl 10from oeqa.utils.sshcontrol import SSHControl
11import glob 11import glob
12import os 12import os
@@ -102,12 +102,11 @@ class ImageFeatures(OESelftestTestCase):
102 features = 'IMAGE_FSTYPES += " ext4 ext4.bmap ext4.bmap.gz"' 102 features = 'IMAGE_FSTYPES += " ext4 ext4.bmap ext4.bmap.gz"'
103 self.write_config(features) 103 self.write_config(features)
104 104
105 image_name = 'core-image-minimal' 105 image = 'core-image-minimal'
106 bitbake(image_name) 106 bitbake(image)
107 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
107 108
108 deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') 109 image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s.ext4" % bb_vars['IMAGE_LINK_NAME'])
109 link_name = get_bb_var('IMAGE_LINK_NAME', image_name)
110 image_path = os.path.join(deploy_dir_image, "%s.ext4" % link_name)
111 bmap_path = "%s.bmap" % image_path 110 bmap_path = "%s.bmap" % image_path
112 gzip_path = "%s.gz" % bmap_path 111 gzip_path = "%s.gz" % bmap_path
113 112
@@ -120,8 +119,8 @@ class ImageFeatures(OESelftestTestCase):
120 image_stat = os.stat(image_path) 119 image_stat = os.stat(image_path)
121 self.assertGreater(image_stat.st_size, image_stat.st_blocks * 512) 120 self.assertGreater(image_stat.st_size, image_stat.st_blocks * 512)
122 121
123 # check if the resulting gzip is valid 122 # check if the resulting gzip is valid, --force is needed in case gzip_path is a symlink
124 self.assertTrue(runCmd('gzip -t %s' % gzip_path)) 123 self.assertTrue(runCmd('gzip --test --force %s' % gzip_path))
125 124
126 def test_hypervisor_fmts(self): 125 def test_hypervisor_fmts(self):
127 """ 126 """
@@ -139,14 +138,13 @@ class ImageFeatures(OESelftestTestCase):
139 features += 'IMAGE_FSTYPES += "ext4.%s"\n' % itype 138 features += 'IMAGE_FSTYPES += "ext4.%s"\n' % itype
140 self.write_config(features) 139 self.write_config(features)
141 140
142 image_name = 'core-image-minimal' 141 image = 'core-image-minimal'
143 bitbake(image_name) 142 bitbake(image)
143 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
144 144
145 deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
146 link_name = get_bb_var('IMAGE_LINK_NAME', image_name)
147 for itype in img_types: 145 for itype in img_types:
148 image_path = os.path.join(deploy_dir_image, "%s.ext4.%s" % 146 image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s.ext4.%s" %
149 (link_name, itype)) 147 (bb_vars['IMAGE_LINK_NAME'], itype))
150 148
151 # check if result image file is in deploy directory 149 # check if result image file is in deploy directory
152 self.assertTrue(os.path.exists(image_path)) 150 self.assertTrue(os.path.exists(image_path))
@@ -177,13 +175,11 @@ class ImageFeatures(OESelftestTestCase):
177 features = 'IMAGE_FSTYPES += "%s %s.sha256sum"' % (conv, conv) 175 features = 'IMAGE_FSTYPES += "%s %s.sha256sum"' % (conv, conv)
178 self.write_config(features) 176 self.write_config(features)
179 177
180 image_name = 'core-image-minimal' 178 image = 'core-image-minimal'
181 bitbake(image_name) 179 bitbake(image)
182 180 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
183 deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') 181 image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s.%s" %
184 link_name = get_bb_var('IMAGE_LINK_NAME', image_name) 182 (bb_vars['IMAGE_LINK_NAME'], conv))
185 image_path = os.path.join(deploy_dir_image, "%s.%s" %
186 (link_name, conv))
187 183
188 # check if resulting image is in the deploy directory 184 # check if resulting image is in the deploy directory
189 self.assertTrue(os.path.exists(image_path)) 185 self.assertTrue(os.path.exists(image_path))
@@ -191,7 +187,7 @@ class ImageFeatures(OESelftestTestCase):
191 187
192 # check if the resulting sha256sum agrees 188 # check if the resulting sha256sum agrees
193 self.assertTrue(runCmd('cd %s;sha256sum -c %s.%s.sha256sum' % 189 self.assertTrue(runCmd('cd %s;sha256sum -c %s.%s.sha256sum' %
194 (deploy_dir_image, link_name, conv))) 190 (bb_vars['DEPLOY_DIR_IMAGE'], bb_vars['IMAGE_LINK_NAME'], conv)))
195 191
196 def test_image_fstypes(self): 192 def test_image_fstypes(self):
197 """ 193 """
@@ -200,9 +196,9 @@ class ImageFeatures(OESelftestTestCase):
200 Product: oe-core 196 Product: oe-core
201 Author: Ed Bartosh <ed.bartosh@linux.intel.com> 197 Author: Ed Bartosh <ed.bartosh@linux.intel.com>
202 """ 198 """
203 image_name = 'core-image-minimal' 199 image = 'core-image-minimal'
204 200
205 all_image_types = set(get_bb_var("IMAGE_TYPES", image_name).split()) 201 all_image_types = set(get_bb_var("IMAGE_TYPES", image).split())
206 skip_image_types = set(('container', 'elf', 'f2fs', 'multiubi', 'tar.zst', 'wic.zst', 'squashfs-lzo')) 202 skip_image_types = set(('container', 'elf', 'f2fs', 'multiubi', 'tar.zst', 'wic.zst', 'squashfs-lzo'))
207 img_types = all_image_types - skip_image_types 203 img_types = all_image_types - skip_image_types
208 204
@@ -214,12 +210,11 @@ UBINIZE_ARGS ?= "-m 2048 -p 128KiB -s 512"
214""" % ' '.join(img_types) 210""" % ' '.join(img_types)
215 self.write_config(config) 211 self.write_config(config)
216 212
217 bitbake(image_name) 213 bitbake(image)
214 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
218 215
219 deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
220 link_name = get_bb_var('IMAGE_LINK_NAME', image_name)
221 for itype in img_types: 216 for itype in img_types:
222 image_path = os.path.join(deploy_dir_image, "%s.%s" % (link_name, itype)) 217 image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s.%s" % (bb_vars['IMAGE_LINK_NAME'], itype))
223 # check if result image is in deploy directory 218 # check if result image is in deploy directory
224 self.assertTrue(os.path.exists(image_path), 219 self.assertTrue(os.path.exists(image_path),
225 "%s image %s doesn't exist" % (itype, image_path)) 220 "%s image %s doesn't exist" % (itype, image_path))
@@ -271,19 +266,20 @@ SKIP_RECIPE[busybox] = "Don't build this"
271 Yeoh Ee Peng <ee.peng.yeoh@intel.com> 266 Yeoh Ee Peng <ee.peng.yeoh@intel.com>
272 """ 267 """
273 268
274 image_name = 'core-image-minimal' 269 image = 'core-image-minimal'
270 image_fstypes_debugfs = 'tar.bz2'
275 features = 'IMAGE_GEN_DEBUGFS = "1"\n' 271 features = 'IMAGE_GEN_DEBUGFS = "1"\n'
276 features += 'IMAGE_FSTYPES_DEBUGFS = "tar.bz2"\n' 272 features += 'IMAGE_FSTYPES_DEBUGFS = "%s"\n' % image_fstypes_debugfs
277 self.write_config(features) 273 self.write_config(features)
278 274
279 bitbake(image_name) 275 bitbake(image)
280 deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') 276 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
281 dbg_tar_file = os.path.join(deploy_dir_image, "*-dbg.rootfs.tar.bz2") 277
282 debug_files = glob.glob(dbg_tar_file) 278 dbg_tar_file = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s-dbg.%s" % (bb_vars['IMAGE_LINK_NAME'], image_fstypes_debugfs))
283 self.assertNotEqual(len(debug_files), 0, 'debug filesystem not generated at %s' % dbg_tar_file) 279 self.assertTrue(os.path.exists(dbg_tar_file), 'debug filesystem not generated at %s' % dbg_tar_file)
284 result = runCmd('cd %s; tar xvf %s' % (deploy_dir_image, dbg_tar_file)) 280 result = runCmd('cd %s; tar xvf %s' % (bb_vars['DEPLOY_DIR_IMAGE'], dbg_tar_file))
285 self.assertEqual(result.status, 0, msg='Failed to extract %s: %s' % (dbg_tar_file, result.output)) 281 self.assertEqual(result.status, 0, msg='Failed to extract %s: %s' % (dbg_tar_file, result.output))
286 result = runCmd('find %s -name %s' % (deploy_dir_image, "udevadm")) 282 result = runCmd('find %s -name %s' % (bb_vars['DEPLOY_DIR_IMAGE'], "udevadm"))
287 self.assertTrue("udevadm" in result.output, msg='Failed to find udevadm: %s' % result.output) 283 self.assertTrue("udevadm" in result.output, msg='Failed to find udevadm: %s' % result.output)
288 dbg_symbols_targets = result.output.splitlines() 284 dbg_symbols_targets = result.output.splitlines()
289 self.assertTrue(dbg_symbols_targets, msg='Failed to split udevadm: %s' % dbg_symbols_targets) 285 self.assertTrue(dbg_symbols_targets, msg='Failed to split udevadm: %s' % dbg_symbols_targets)
@@ -293,11 +289,13 @@ SKIP_RECIPE[busybox] = "Don't build this"
293 289
294 def test_empty_image(self): 290 def test_empty_image(self):
295 """Test creation of image with no packages""" 291 """Test creation of image with no packages"""
296 bitbake('test-empty-image') 292 image = 'test-empty-image'
297 res_dir = get_bb_var('DEPLOY_DIR_IMAGE') 293 bitbake(image)
298 images = os.path.join(res_dir, "test-empty-image-*.manifest") 294 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
299 result = glob.glob(images) 295 manifest = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s.manifest" % bb_vars['IMAGE_LINK_NAME'])
300 with open(result[1],"r") as f: 296 self.assertTrue(os.path.exists(manifest))
297
298 with open(manifest, "r") as f:
301 self.assertEqual(len(f.read().strip()),0) 299 self.assertEqual(len(f.read().strip()),0)
302 300
303 def test_mandb(self): 301 def test_mandb(self):