summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/wic.py
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2022-03-31 19:29:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-01 23:11:38 +0100
commitc4436040eb27afbbf602679e66c23a973279e3a7 (patch)
tree2a5eca5c2dbe54338b11afd436357ab054903ca7 /meta/lib/oeqa/selftest/cases/wic.py
parent12a1456b060a970a1b2157ef64abe0751d6804b9 (diff)
downloadpoky-c4436040eb27afbbf602679e66c23a973279e3a7.tar.gz
oeqa/selftest/wic: use self.td instead of get_bb_var to save on bitbake calls
When a test case starts, self.td is populated with all the variables in the data store. Typically this can be used instead of get_bb_var(), which saves a bitbake call per variable lookup. The only catch is that in parallel runs the build directory is moved after td is populated, so paths in the build directory are wrong: these still need to be fetched in the test. (From OE-Core rev: 884201c6c1bbf7c1b958bab7d7c91e27577eeaac) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/wic.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 5bdd9ae87e..de74c07a03 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -82,7 +82,7 @@ class WicTestCase(OESelftestTestCase):
82 # clean up which can result in the native tools built earlier in 82 # clean up which can result in the native tools built earlier in
83 # setUpClass being unavailable. 83 # setUpClass being unavailable.
84 if not WicTestCase.image_is_ready: 84 if not WicTestCase.image_is_ready:
85 if get_bb_var('USE_NLS') != 'yes': 85 if self.td['USE_NLS'] != 'yes':
86 self.skipTest('wic-tools needs USE_NLS=yes') 86 self.skipTest('wic-tools needs USE_NLS=yes')
87 87
88 bitbake('wic-tools core-image-minimal core-image-minimal-mtdutils') 88 bitbake('wic-tools core-image-minimal core-image-minimal-mtdutils')
@@ -98,9 +98,8 @@ class WicTestCase(OESelftestTestCase):
98 """Generate and obtain the path to <image>.env""" 98 """Generate and obtain the path to <image>.env"""
99 if image not in WicTestCase.wicenv_cache: 99 if image not in WicTestCase.wicenv_cache:
100 bitbake('%s -c do_rootfs_wicenv' % image) 100 bitbake('%s -c do_rootfs_wicenv' % image)
101 bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image) 101 stdir = get_bb_var('STAGING_DIR', image)
102 stdir = bb_vars['STAGING_DIR'] 102 machine = self.td["MACHINE"]
103 machine = bb_vars['MACHINE']
104 WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') 103 WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
105 return WicTestCase.wicenv_cache[image] 104 return WicTestCase.wicenv_cache[image]
106 105
@@ -827,9 +826,8 @@ class Wic2(WicTestCase):
827 bitbake('wic-image-minimal') 826 bitbake('wic-image-minimal')
828 self.remove_config(config) 827 self.remove_config(config)
829 828
830 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE']) 829 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
831 deploy_dir = bb_vars['DEPLOY_DIR_IMAGE'] 830 machine = self.td['MACHINE']
832 machine = bb_vars['MACHINE']
833 prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine) 831 prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine)
834 # check if we have result image and manifests symlinks 832 # check if we have result image and manifests symlinks
835 # pointing to existing files 833 # pointing to existing files
@@ -1069,7 +1067,7 @@ class Wic2(WicTestCase):
1069 def _rawcopy_plugin(self, fstype): 1067 def _rawcopy_plugin(self, fstype):
1070 """Test rawcopy plugin""" 1068 """Test rawcopy plugin"""
1071 img = 'core-image-minimal' 1069 img = 'core-image-minimal'
1072 machine = get_bb_var('MACHINE', img) 1070 machine = self.td["MACHINE"]
1073 params = ',unpack' if fstype.endswith('.gz') else '' 1071 params = ',unpack' if fstype.endswith('.gz') else ''
1074 with NamedTemporaryFile("w", suffix=".wks") as wks: 1072 with NamedTemporaryFile("w", suffix=".wks") as wks:
1075 wks.write('part / --source rawcopy --sourceparams="file=%s-%s.%s%s"\n'\ 1073 wks.write('part / --source rawcopy --sourceparams="file=%s-%s.%s%s"\n'\
@@ -1098,12 +1096,11 @@ class Wic2(WicTestCase):
1098 self.append_config(config) 1096 self.append_config(config)
1099 bitbake('core-image-minimal') 1097 bitbake('core-image-minimal')
1100 self.remove_config(config) 1098 self.remove_config(config)
1099 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
1100 machine = self.td['MACHINE']
1101 1101
1102 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'])
1103 deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
1104 machine = bb_vars['MACHINE']
1105 image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine) 1102 image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
1106 self.assertEqual(True, os.path.exists(image_path)) 1103 self.assertTrue(os.path.exists(image_path))
1107 1104
1108 sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') 1105 sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
1109 1106
@@ -1245,7 +1242,7 @@ class Wic2(WicTestCase):
1245 1242
1246 def test_sparse_copy(self): 1243 def test_sparse_copy(self):
1247 """Test sparse_copy with FIEMAP and SEEK_HOLE filemap APIs""" 1244 """Test sparse_copy with FIEMAP and SEEK_HOLE filemap APIs"""
1248 libpath = os.path.join(get_bb_var('COREBASE'), 'scripts', 'lib', 'wic') 1245 libpath = os.path.join(self.td['COREBASE'], 'scripts', 'lib', 'wic')
1249 sys.path.insert(0, libpath) 1246 sys.path.insert(0, libpath)
1250 from filemap import FilemapFiemap, FilemapSeek, sparse_copy, ErrorNotSupp 1247 from filemap import FilemapFiemap, FilemapSeek, sparse_copy, ErrorNotSupp
1251 with NamedTemporaryFile("w", suffix=".wic-sparse") as sparse: 1248 with NamedTemporaryFile("w", suffix=".wic-sparse") as sparse:
@@ -1300,9 +1297,8 @@ class Wic2(WicTestCase):
1300 bitbake('core-image-minimal') 1297 bitbake('core-image-minimal')
1301 1298
1302 # get path to the image 1299 # get path to the image
1303 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE']) 1300 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
1304 deploy_dir = bb_vars['DEPLOY_DIR_IMAGE'] 1301 machine = self.td['MACHINE']
1305 machine = bb_vars['MACHINE']
1306 image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine) 1302 image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
1307 1303
1308 self.remove_config(config) 1304 self.remove_config(config)