summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-26 12:03:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-26 17:14:47 +0100
commit3e83364ed7031d53f281216214b04c7acace844a (patch)
treeef3cc1973f7df63a5adcf1ce68e3bae22328ecb0 /meta/lib
parent364449251ffe4ff2c11acaa258edcec244c38818 (diff)
downloadopenembedded-core-contrib-3e83364ed7031d53f281216214b04c7acace844a.tar.gz
openembedded-core-contrib-3e83364ed7031d53f281216214b04c7acace844a.tar.bz2
openembedded-core-contrib-3e83364ed7031d53f281216214b04c7acace844a.zip
selftest/wic: Fix/cleanup class setup code
The code was using Wic instead of WicTestCase for image_is_ready and native_sysroot which was confusing some tests. Fix image_is_ready. For native_sysroot, convert the only user to just run the call itself as there is no point in executing this for all the other tests which don't use the value. Whilst here, move _get_image_env_path to the base class alongside its parent variabe and fix it to use WicTestCase. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index cfee9d1e71..36ee5e5a14 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -65,27 +65,24 @@ class WicTestCase(OESelftestTestCase):
"""Wic test class."""
image_is_ready = False
- native_sysroot = None
wicenv_cache = {}
def setUpLocal(self):
"""This code is executed before each test method."""
self.resultdir = self.builddir + "/wic-tmp/"
super(WicTestCase, self).setUpLocal()
- if not self.native_sysroot:
- Wic.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'wic-tools')
# Do this here instead of in setUpClass as the base setUp does some
# clean up which can result in the native tools built earlier in
# setUpClass being unavailable.
- if not Wic.image_is_ready:
+ if not WicTestCase.image_is_ready:
if get_bb_var('USE_NLS') == 'yes':
bitbake('wic-tools')
else:
self.skipTest('wic-tools cannot be built due its (intltool|gettext)-native dependency and NLS disable')
bitbake('core-image-minimal')
- Wic.image_is_ready = True
+ WicTestCase.image_is_ready = True
rmtree(self.resultdir, ignore_errors=True)
@@ -94,6 +91,16 @@ class WicTestCase(OESelftestTestCase):
rmtree(self.resultdir, ignore_errors=True)
super(WicTestCase, self).tearDownLocal()
+ def _get_image_env_path(self, image):
+ """Generate and obtain the path to <image>.env"""
+ if image not in WicTestCase.wicenv_cache:
+ self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status)
+ bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image)
+ stdir = bb_vars['STAGING_DIR']
+ machine = bb_vars['MACHINE']
+ WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
+ return WicTestCase.wicenv_cache[image]
+
class Wic(WicTestCase):
@OETestID(1552)
@@ -534,16 +541,6 @@ class Wic2(WicTestCase):
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct")))
self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*direct.bmap")))
- def _get_image_env_path(self, image):
- """Generate and obtain the path to <image>.env"""
- if image not in self.wicenv_cache:
- self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status)
- bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image)
- stdir = bb_vars['STAGING_DIR']
- machine = bb_vars['MACHINE']
- self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
- return self.wicenv_cache[image]
-
@OETestID(1347)
def test_image_env(self):
"""Test generation of <image>.env files."""
@@ -683,9 +680,11 @@ class Wic2(WicTestCase):
wicimg = wicout[0]
+ native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools")
+
# verify partition size with wic
res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg,
- native_sysroot=self.native_sysroot)
+ native_sysroot=native_sysroot)
# parse parted output which looks like this:
# BYT;\n