summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2017-02-21 14:33:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-01 12:54:24 +0000
commite53f86ba8aeb6d2e9eb259329001d27d62401072 (patch)
treef5a8a59120e5ba4b94a8968da865240680d782b0 /meta
parent37fd073526811dee6edcfbb78a1864dd37991f4d (diff)
downloadopenembedded-core-e53f86ba8aeb6d2e9eb259329001d27d62401072.tar.gz
openembedded-core-e53f86ba8aeb6d2e9eb259329001d27d62401072.tar.bz2
openembedded-core-e53f86ba8aeb6d2e9eb259329001d27d62401072.zip
selftest: Optimize get_bb_var use
get_bb_var calls bitbake every time it is used and every call would take about 7 seconds. There are tests that calls get_bb_var several times when they can use get_bb_vars. Also there are tests that calls it to fetch the same variable over and over again. This will optimize the use of get_bb_var and get_bb_vars for a little speed up in the tests. [YOCTO #11037] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/archiver.py7
-rw-r--r--meta/lib/oeqa/selftest/bbtests.py24
-rw-r--r--meta/lib/oeqa/selftest/buildhistory.py5
-rw-r--r--meta/lib/oeqa/selftest/buildoptions.py10
-rw-r--r--meta/lib/oeqa/selftest/devtool.py57
-rw-r--r--meta/lib/oeqa/selftest/eSDK.py15
-rw-r--r--meta/lib/oeqa/selftest/liboe.py21
-rw-r--r--meta/lib/oeqa/selftest/manifest.py7
-rw-r--r--meta/lib/oeqa/selftest/pkgdata.py11
-rw-r--r--meta/lib/oeqa/selftest/prservice.py9
-rw-r--r--meta/lib/oeqa/selftest/recipetool.py34
-rw-r--r--meta/lib/oeqa/selftest/runtime-test.py15
-rw-r--r--meta/lib/oeqa/selftest/signing.py12
-rw-r--r--meta/lib/oeqa/selftest/sstate.py20
-rw-r--r--meta/lib/oeqa/selftest/sstatetests.py92
-rw-r--r--meta/lib/oeqa/selftest/tinfoil.py2
-rw-r--r--meta/lib/oeqa/selftest/wic.py39
17 files changed, 206 insertions, 174 deletions
diff --git a/meta/lib/oeqa/selftest/archiver.py b/meta/lib/oeqa/selftest/archiver.py
index 97b6f5b212..d7f215cbf6 100644
--- a/meta/lib/oeqa/selftest/archiver.py
+++ b/meta/lib/oeqa/selftest/archiver.py
@@ -1,5 +1,5 @@
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import bitbake, get_bb_var
+from oeqa.utils.commands import bitbake, get_bb_vars
from oeqa.utils.decorators import testcase
import glob
import os
@@ -28,10 +28,11 @@ class Archiver(oeSelfTest):
features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % exclude_recipe
self.write_config(features)
- shutil.rmtree(get_bb_var('TMPDIR'))
+ bitbake('-c clean %s %s' % (include_recipe, exclude_recipe))
bitbake("%s %s" % (include_recipe, exclude_recipe))
- src_path = os.path.join(get_bb_var('DEPLOY_DIR_SRC'), get_bb_var('TARGET_SYS'))
+ bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS'])
+ src_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS'])
# Check that include_recipe was included
included_present = len(glob.glob(src_path + '/%s-*' % include_recipe))
diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py
index 7675563b45..4d9eec130a 100644
--- a/meta/lib/oeqa/selftest/bbtests.py
+++ b/meta/lib/oeqa/selftest/bbtests.py
@@ -3,7 +3,7 @@ import re
import oeqa.utils.ftools as ftools
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import runCmd, bitbake, get_bb_var
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
from oeqa.utils.decorators import testcase
class BitbakeTests(oeSelfTest):
@@ -78,9 +78,10 @@ class BitbakeTests(oeSelfTest):
# test 1 from bug 5875
test_recipe = 'zlib'
test_data = "Microsoft Made No Profit From Anyone's Zunes Yo"
- image_dir = get_bb_var('D', test_recipe)
- pkgsplit_dir = get_bb_var('PKGDEST', test_recipe)
- man_dir = get_bb_var('mandir', test_recipe)
+ bb_vars = get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe)
+ image_dir = bb_vars['D']
+ pkgsplit_dir = bb_vars['PKGDEST']
+ man_dir = bb_vars['mandir']
bitbake('-c clean %s' % test_recipe)
bitbake('-c package -f %s' % test_recipe)
@@ -121,8 +122,9 @@ class BitbakeTests(oeSelfTest):
@testcase(899)
def test_image_manifest(self):
bitbake('core-image-minimal')
- deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal")
- imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal")
+ bb_vars = get_bb_vars(["DEPLOY_DIR_IMAGE", "IMAGE_LINK_NAME"], "core-image-minimal")
+ deploydir = bb_vars["DEPLOY_DIR_IMAGE"]
+ imagename = bb_vars["IMAGE_LINK_NAME"]
manifest = os.path.join(deploydir, imagename + ".manifest")
self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest)
@@ -160,8 +162,9 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
result = bitbake('-c fetch aspell', ignore_status=True)
self.delete_recipeinc('aspell')
self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output)
- self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % str(get_bb_var("DL_DIR")))
- self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % str(get_bb_var("DL_DIR")))
+ dl_dir = get_bb_var("DL_DIR")
+ self.assertTrue(os.path.isfile(os.path.join(dl_dir, 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % dl_dir)
+ self.assertTrue(os.path.isfile(os.path.join(dl_dir, 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % dl_dir)
@testcase(1028)
def test_environment(self):
@@ -253,8 +256,9 @@ INHERIT_remove = \"report-error\"
def test_bbappend_order(self):
""" Bitbake should bbappend to recipe in a predictable order """
test_recipe = 'ed'
- test_recipe_summary_before = get_bb_var('SUMMARY', test_recipe)
- test_recipe_pv = get_bb_var('PV', test_recipe)
+ bb_vars = get_bb_vars(['SUMMARY', 'PV'], test_recipe)
+ test_recipe_summary_before = bb_vars['SUMMARY']
+ test_recipe_pv = bb_vars['PV']
recipe_append_file = test_recipe + '_' + test_recipe_pv + '.bbappend'
expected_recipe_summary = test_recipe_summary_before
diff --git a/meta/lib/oeqa/selftest/buildhistory.py b/meta/lib/oeqa/selftest/buildhistory.py
index 674da6205a..008c39c956 100644
--- a/meta/lib/oeqa/selftest/buildhistory.py
+++ b/meta/lib/oeqa/selftest/buildhistory.py
@@ -3,14 +3,15 @@ import re
import datetime
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import bitbake, get_bb_var
+from oeqa.utils.commands import bitbake, get_bb_vars
from oeqa.utils.decorators import testcase
class BuildhistoryBase(oeSelfTest):
def config_buildhistory(self, tmp_bh_location=False):
- if (not 'buildhistory' in get_bb_var('USER_CLASSES')) and (not 'buildhistory' in get_bb_var('INHERIT')):
+ bb_vars = get_bb_vars(['USER_CLASSES', 'INHERIT'])
+ if (not 'buildhistory' in bb_vars['USER_CLASSES']) and (not 'buildhistory' in bb_vars['INHERIT']):
add_buildhistory_config = 'INHERIT += "buildhistory"\nBUILDHISTORY_COMMIT = "1"'
self.append_config(add_buildhistory_config)
diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 28734fd1f0..568882ba8f 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -5,7 +5,7 @@ import shutil
import tempfile
from oeqa.selftest.base import oeSelfTest
from oeqa.selftest.buildhistory import BuildhistoryBase
-from oeqa.utils.commands import runCmd, bitbake, get_bb_var
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
import oeqa.utils.ftools as ftools
from oeqa.utils.decorators import testcase
@@ -33,13 +33,15 @@ class ImageOptionsTests(oeSelfTest):
@testcase(286)
def test_ccache_tool(self):
bitbake("ccache-native")
- p = get_bb_var('SYSROOT_DESTDIR', 'ccache-native') + get_bb_var('bindir', 'ccache-native') + "/" + "ccache"
+ bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'ccache-native')
+ p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "ccache"
self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p)
self.write_config('INHERIT += "ccache"')
self.add_command_to_tearDown('bitbake -c clean m4')
bitbake("m4 -f -c compile")
- res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True)
- self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile"))
+ log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile")
+ res = runCmd("grep ccache %s" % log_compile, ignore_status=True)
+ self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile)
@testcase(1435)
def test_read_only_image(self):
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 8bf9f05bb9..f1661efeb1 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -213,9 +213,10 @@ class DevtoolTests(DevtoolBase):
bitbake('pv -c cleansstate')
# Test devtool build
result = runCmd('devtool build pv')
- installdir = get_bb_var('D', 'pv')
+ bb_vars = get_bb_vars(['D', 'bindir'], 'pv')
+ installdir = bb_vars['D']
self.assertTrue(installdir, 'Could not query installdir variable')
- bindir = get_bb_var('bindir', 'pv')
+ bindir = bb_vars['bindir']
self.assertTrue(bindir, 'Could not query bindir variable')
if bindir[0] == '/':
bindir = bindir[1:]
@@ -296,11 +297,12 @@ class DevtoolTests(DevtoolBase):
f.write('\nTESTLIBOUTPUT = "${STAGING_DIR}-components/${TUNE_PKGARCH}/${PN}/${libdir}"\n')
# Test devtool build
result = runCmd('devtool build libftdi')
- staging_libdir = get_bb_var('TESTLIBOUTPUT', 'libftdi')
+ bb_vars = get_bb_vars(['TESTLIBOUTPUT', 'STAMP'], 'libftdi')
+ staging_libdir = bb_vars['TESTLIBOUTPUT']
self.assertTrue(staging_libdir, 'Could not query TESTLIBOUTPUT variable')
self.assertTrue(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), "libftdi binary not found in STAGING_LIBDIR. Output of devtool build libftdi %s" % result.output)
# Test devtool reset
- stampprefix = get_bb_var('STAMP', 'libftdi')
+ stampprefix = bb_vars['STAMP']
result = runCmd('devtool reset libftdi')
result = runCmd('devtool status')
self.assertNotIn('libftdi', result.output)
@@ -463,9 +465,10 @@ class DevtoolTests(DevtoolBase):
self.assertNotIn(expected + '\n', f, message)
modfile = os.path.join(tempdir, 'mdadm.8.in')
- pkgd = get_bb_var('PKGD', 'mdadm')
+ bb_vars = get_bb_vars(['PKGD', 'mandir'], 'mdadm')
+ pkgd = bb_vars['PKGD']
self.assertTrue(pkgd, 'Could not query PKGD variable')
- mandir = get_bb_var('mandir', 'mdadm')
+ mandir = bb_vars['mandir']
self.assertTrue(mandir, 'Could not query mandir variable')
manfile = oe.path.join(pkgd, mandir, 'man8', 'mdadm.8')
@@ -679,8 +682,9 @@ class DevtoolTests(DevtoolBase):
def test_devtool_update_recipe(self):
# Check preconditions
testrecipe = 'minicom'
- recipefile = get_bb_var('FILE', testrecipe)
- src_uri = get_bb_var('SRC_URI', testrecipe)
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe)
self._check_repo_status(os.path.dirname(recipefile), [])
# First, modify a recipe
@@ -711,8 +715,9 @@ class DevtoolTests(DevtoolBase):
def test_devtool_update_recipe_git(self):
# Check preconditions
testrecipe = 'mtd-utils'
- recipefile = get_bb_var('FILE', testrecipe)
- src_uri = get_bb_var('SRC_URI', testrecipe)
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
patches = []
for entry in src_uri.split():
@@ -780,8 +785,9 @@ class DevtoolTests(DevtoolBase):
def test_devtool_update_recipe_append(self):
# Check preconditions
testrecipe = 'mdadm'
- recipefile = get_bb_var('FILE', testrecipe)
- src_uri = get_bb_var('SRC_URI', testrecipe)
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe)
self._check_repo_status(os.path.dirname(recipefile), [])
# First, modify a recipe
@@ -848,8 +854,9 @@ class DevtoolTests(DevtoolBase):
def test_devtool_update_recipe_append_git(self):
# Check preconditions
testrecipe = 'mtd-utils'
- recipefile = get_bb_var('FILE', testrecipe)
- src_uri = get_bb_var('SRC_URI', testrecipe)
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
for entry in src_uri.split():
if entry.startswith('git://'):
@@ -1009,8 +1016,9 @@ class DevtoolTests(DevtoolBase):
def test_devtool_update_recipe_local_files_3(self):
# First, modify the recipe
testrecipe = 'devtool-test-localonly'
- recipefile = get_bb_var('FILE', testrecipe)
- src_uri = get_bb_var('SRC_URI', testrecipe)
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
self.track_for_cleanup(tempdir)
self.track_for_cleanup(self.workspacedir)
@@ -1027,8 +1035,9 @@ class DevtoolTests(DevtoolBase):
def test_devtool_update_recipe_local_patch_gz(self):
# First, modify the recipe
testrecipe = 'devtool-test-patch-gz'
- recipefile = get_bb_var('FILE', testrecipe)
- src_uri = get_bb_var('SRC_URI', testrecipe)
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
self.track_for_cleanup(tempdir)
self.track_for_cleanup(self.workspacedir)
@@ -1054,8 +1063,9 @@ class DevtoolTests(DevtoolBase):
# was also in SRC_URI
# First, modify the recipe
testrecipe = 'devtool-test-subdir'
- recipefile = get_bb_var('FILE', testrecipe)
- src_uri = get_bb_var('SRC_URI', testrecipe)
+ bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe)
+ recipefile = bb_vars['FILE']
+ src_uri = bb_vars['SRC_URI']
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
self.track_for_cleanup(tempdir)
self.track_for_cleanup(self.workspacedir)
@@ -1184,9 +1194,10 @@ class DevtoolTests(DevtoolBase):
result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand))
# Check if it deployed all of the files with the right ownership/perms
# First look on the host - need to do this under pseudo to get the correct ownership/perms
- installdir = get_bb_var('D', testrecipe)
- fakerootenv = get_bb_var('FAKEROOTENV', testrecipe)
- fakerootcmd = get_bb_var('FAKEROOTCMD', testrecipe)
+ bb_vars = get_bb_vars(['D', 'FAKEROOTENV', 'FAKEROOTCMD'], testrecipe)
+ installdir = bb_vars['D']
+ fakerootenv = bb_vars['FAKEROOTENV']
+ fakerootcmd = bb_vars['FAKEROOTCMD']
result = runCmd('%s %s find . -type f -exec ls -l {} \;' % (fakerootenv, fakerootcmd), cwd=installdir)
filelist1 = self._process_ls_output(result.output)
diff --git a/meta/lib/oeqa/selftest/eSDK.py b/meta/lib/oeqa/selftest/eSDK.py
index b68e997ba9..a66ff92140 100644
--- a/meta/lib/oeqa/selftest/eSDK.py
+++ b/meta/lib/oeqa/selftest/eSDK.py
@@ -6,9 +6,9 @@ import glob
import logging
import subprocess
import oeqa.utils.ftools as ftools
-from oeqa.utils.decorators import testcase
+from oeqa.utils.decorators import testcase
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import runCmd, bitbake, get_bb_var
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
from oeqa.utils.httpserver import HTTPService
class oeSDKExtSelfTest(oeSelfTest):
@@ -24,7 +24,7 @@ class oeSDKExtSelfTest(oeSelfTest):
# what environment load oe-selftest, i586, x86_64
pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*')
return glob.glob(pattern)[0]
-
+
@staticmethod
def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options):
if postconfig:
@@ -47,10 +47,11 @@ class oeSDKExtSelfTest(oeSelfTest):
def get_eSDK_toolchain(image):
pn_task = '%s -c populate_sdk_ext' % image
- sdk_deploy = get_bb_var('SDK_DEPLOY', pn_task)
- toolchain_name = get_bb_var('TOOLCHAINEXT_OUTPUTNAME', pn_task)
+ bb_vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAINEXT_OUTPUTNAME'], pn_task)
+ sdk_deploy = bb_vars['SDK_DEPLOY']
+ toolchain_name = bb_vars['TOOLCHAINEXT_OUTPUTNAME']
return os.path.join(sdk_deploy, toolchain_name + '.sh')
-
+
@staticmethod
def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path):
sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache')
@@ -119,7 +120,7 @@ SSTATE_MIRRORS = "file://.* http://%s/PATH"
bitbake(pn_sstate)
cmd = "devtool sdk-install %s " % pn_sstate
oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd)
-
+
@testcase(1603)
def test_image_generation_binary_feeds(self):
image = 'core-image-minimal'
diff --git a/meta/lib/oeqa/selftest/liboe.py b/meta/lib/oeqa/selftest/liboe.py
index cd12cd25b3..0b0301def6 100644
--- a/meta/lib/oeqa/selftest/liboe.py
+++ b/meta/lib/oeqa/selftest/liboe.py
@@ -1,11 +1,16 @@
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import get_bb_var, bitbake, runCmd
+from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake, runCmd
import oe.path
import glob
import os
import os.path
class LibOE(oeSelfTest):
+
+ @classmethod
+ def setUpClass(cls):
+ cls.tmp_dir = get_bb_var('TMPDIR')
+
def test_copy_tree_special(self):
"""
Summary: oe.path.copytree() should copy files with special character
@@ -14,8 +19,7 @@ class LibOE(oeSelfTest):
Product: OE-Core
Author: Joshua Lock <joshua.g.lock@intel.com>
"""
- tmp_dir = get_bb_var('TMPDIR')
- testloc = oe.path.join(tmp_dir, 'liboetests')
+ testloc = oe.path.join(self.tmp_dir, 'liboetests')
src = oe.path.join(testloc, 'src')
dst = oe.path.join(testloc, 'dst')
bb.utils.mkdirhier(testloc)
@@ -40,8 +44,7 @@ class LibOE(oeSelfTest):
Product: OE-Core
Author: Joshua Lock <joshua.g.lock@intel.com>
"""
- tmp_dir = get_bb_var('TMPDIR')
- testloc = oe.path.join(tmp_dir, 'liboetests')
+ testloc = oe.path.join(self.tmp_dir, 'liboetests')
src = oe.path.join(testloc, 'src')
dst = oe.path.join(testloc, 'dst')
bb.utils.mkdirhier(testloc)
@@ -51,8 +54,9 @@ class LibOE(oeSelfTest):
# ensure we have setfattr available
bitbake("attr-native")
- destdir = get_bb_var('SYSROOT_DESTDIR', 'attr-native')
- bindir = get_bb_var('bindir', 'attr-native')
+ bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'attr-native')
+ destdir = bb_vars['SYSROOT_DESTDIR']
+ bindir = bb_vars['bindir']
bindir = destdir + bindir
# create a file with xattr and copy it
@@ -73,8 +77,7 @@ class LibOE(oeSelfTest):
Product: OE-Core
Author: Joshua Lock <joshua.g.lock@intel.com>
"""
- tmp_dir = get_bb_var('TMPDIR')
- testloc = oe.path.join(tmp_dir, 'liboetests')
+ testloc = oe.path.join(self.tmp_dir, 'liboetests')
src = oe.path.join(testloc, 'src')
dst = oe.path.join(testloc, 'dst')
bb.utils.mkdirhier(testloc)
diff --git a/meta/lib/oeqa/selftest/manifest.py b/meta/lib/oeqa/selftest/manifest.py
index 44d0404c5d..fe6f949644 100644
--- a/meta/lib/oeqa/selftest/manifest.py
+++ b/meta/lib/oeqa/selftest/manifest.py
@@ -2,7 +2,7 @@ import unittest
import os
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import get_bb_var, bitbake
+from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake
from oeqa.utils.decorators import testcase
class ManifestEntry:
@@ -84,9 +84,10 @@ class VerifyManifest(oeSelfTest):
try:
mdir = self.get_dir_from_bb_var('SDK_DEPLOY', self.buildtarget)
for k in d_target.keys():
+ bb_vars = get_bb_vars(['SDK_NAME', 'SDK_VERSION'], self.buildtarget)
mfilename[k] = "{}-toolchain-{}.{}.manifest".format(
- get_bb_var("SDK_NAME", self.buildtarget),
- get_bb_var("SDK_VERSION", self.buildtarget),
+ bb_vars['SDK_NAME'],
+ bb_vars['SDK_VERSION'],
k)
mpath[k] = os.path.join(mdir, mfilename[k])
if not os.path.isfile(mpath[k]):
diff --git a/meta/lib/oeqa/selftest/pkgdata.py b/meta/lib/oeqa/selftest/pkgdata.py
index 3512ce3531..36d8b346d0 100644
--- a/meta/lib/oeqa/selftest/pkgdata.py
+++ b/meta/lib/oeqa/selftest/pkgdata.py
@@ -6,7 +6,7 @@ import fnmatch
import oeqa.utils.ftools as ftools
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import runCmd, bitbake, get_bb_var
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
from oeqa.utils.decorators import testcase
class OePkgdataUtilTests(oeSelfTest):
@@ -126,10 +126,11 @@ class OePkgdataUtilTests(oeSelfTest):
curpkg = line.split(':')[0]
files[curpkg] = []
return files
- base_libdir = get_bb_var('base_libdir')
- libdir = get_bb_var('libdir')
- includedir = get_bb_var('includedir')
- mandir = get_bb_var('mandir')
+ bb_vars = get_bb_vars(['base_libdir', 'libdir', 'includedir', 'mandir'])
+ base_libdir = bb_vars['base_libdir']
+ libdir = bb_vars['libdir']
+ includedir = bb_vars['includedir']
+ mandir = bb_vars['mandir']
# Test recipe-space package name
result = runCmd('oe-pkgdata-util list-pkg-files zlib-dev zlib-doc')
files = splitoutput(result.output)
diff --git a/meta/lib/oeqa/selftest/prservice.py b/meta/lib/oeqa/selftest/prservice.py
index 0b2dfe6494..34d419762c 100644
--- a/meta/lib/oeqa/selftest/prservice.py
+++ b/meta/lib/oeqa/selftest/prservice.py
@@ -12,10 +12,13 @@ from oeqa.utils.decorators import testcase
from oeqa.utils.network import get_free_port
class BitbakePrTests(oeSelfTest):
-
+
+ @classmethod
+ def setUpClass(cls):
+ cls.pkgdata_dir = get_bb_var('PKGDATA_DIR')
+
def get_pr_version(self, package_name):
- pkgdata_dir = get_bb_var('PKGDATA_DIR')
- package_data_file = os.path.join(pkgdata_dir, 'runtime', package_name)
+ package_data_file = os.path.join(self.pkgdata_dir, 'runtime', package_name)
package_data = ftools.read_file(package_data_file)
find_pr = re.search("PKGR: r[0-9]+\.([0-9]+)", package_data)
self.assertTrue(find_pr, "No PKG revision found in %s" % package_data_file)
diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py
index e8348233ec..d62c8bb603 100644
--- a/meta/lib/oeqa/selftest/recipetool.py
+++ b/meta/lib/oeqa/selftest/recipetool.py
@@ -4,7 +4,8 @@ import shutil
import tempfile
import urllib.parse
-from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var
+from oeqa.utils.commands import get_bb_vars, create_temp_layer
from oeqa.utils.decorators import testcase
from oeqa.selftest import devtool
@@ -25,6 +26,7 @@ def tearDownModule():
class RecipetoolBase(devtool.DevtoolBase):
+
def setUpLocal(self):
self.templayerdir = templayerdir
self.tempdir = tempfile.mkdtemp(prefix='recipetoolqa')
@@ -65,12 +67,16 @@ class RecipetoolBase(devtool.DevtoolBase):
class RecipetoolTests(RecipetoolBase):
+
@classmethod
def setUpClass(cls):
# Ensure we have the right data in shlibs/pkgdata
logger = logging.getLogger("selftest")
logger.info('Running bitbake to generate pkgdata')
bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile')
+ bb_vars = get_bb_vars(['COREBASE', 'BBPATH'])
+ cls.corebase = bb_vars['COREBASE']
+ cls.bbpath = bb_vars['BBPATH']
def _try_recipetool_appendfile(self, testrecipe, destfile, newfile, options, expectedlines, expectedfiles):
cmd = 'recipetool appendfile %s %s %s %s' % (self.templayerdir, destfile, newfile, options)
@@ -104,9 +110,8 @@ class RecipetoolTests(RecipetoolBase):
# Now try with a file we know should be an alternative
# (this is very much a fake example, but one we know is reliably an alternative)
self._try_recipetool_appendfile_fail('/bin/ls', self.testfile, ['ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox'])
- corebase = get_bb_var('COREBASE')
# Need a test file - should be executable
- testfile2 = os.path.join(corebase, 'oe-init-build-env')
+ testfile2 = os.path.join(self.corebase, 'oe-init-build-env')
testfile2name = os.path.basename(testfile2)
expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
'\n',
@@ -135,7 +140,6 @@ class RecipetoolTests(RecipetoolBase):
@testcase(1173)
def test_recipetool_appendfile_add(self):
- corebase = get_bb_var('COREBASE')
# Try arbitrary file add to a recipe
expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
'\n',
@@ -148,7 +152,7 @@ class RecipetoolTests(RecipetoolBase):
self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile'])
# Try adding another file, this time where the source file is executable
# (so we're testing that, plus modifying an existing bbappend)
- testfile2 = os.path.join(corebase, 'oe-init-build-env')
+ testfile2 = os.path.join(self.corebase, 'oe-init-build-env')
testfile2name = os.path.basename(testfile2)
expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n',
'\n',
@@ -500,8 +504,7 @@ class RecipetoolTests(RecipetoolBase):
recipetool = runCmd("which recipetool")
fromname = runCmd("recipetool --quiet pluginfile")
srcfile = fromname.output
- bbpath = get_bb_var('BBPATH')
- searchpath = bbpath.split(':') + [os.path.dirname(recipetool.output)]
+ searchpath = self.bbpath.split(':') + [os.path.dirname(recipetool.output)]
plugincontent = []
with open(srcfile) as fh:
plugincontent = fh.readlines()
@@ -597,17 +600,18 @@ class RecipetoolAppendsrcBase(RecipetoolBase):
self._try_recipetool_appendsrcfiles(testrecipe, newfiles, expectedfiles=expectedfiles, destdir=destdir, options=options)
- src_uri = get_bb_var('SRC_URI', testrecipe).split()
+ bb_vars = get_bb_vars(['SRC_URI', 'FILE', 'FILESEXTRAPATHS'], testrecipe)
+ src_uri = bb_vars['SRC_URI'].split()
for f in expectedfiles:
if destdir:
self.assertIn('file://%s;subdir=%s' % (f, destdir), src_uri)
else:
self.assertIn('file://%s' % f, src_uri)
- recipefile = get_bb_var('FILE', testrecipe)
+ recipefile = bb_vars['FILE']
bbappendfile = self._check_bbappend(testrecipe, recipefile, self.templayerdir)
filesdir = os.path.join(os.path.dirname(bbappendfile), testrecipe)
- filesextrapaths = get_bb_var('FILESEXTRAPATHS', testrecipe).split(':')
+ filesextrapaths = bb_vars['FILESEXTRAPATHS'].split(':')
self.assertIn(filesdir, filesextrapaths)
@@ -638,8 +642,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
@testcase(1280)
def test_recipetool_appendsrcfile_srcdir_basic(self):
testrecipe = 'bash'
- srcdir = get_bb_var('S', testrecipe)
- workdir = get_bb_var('WORKDIR', testrecipe)
+ bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe)
+ srcdir = bb_vars['S']
+ workdir = bb_vars['WORKDIR']
subdir = os.path.relpath(srcdir, workdir)
self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir)
@@ -664,8 +669,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase):
def test_recipetool_appendsrcfile_replace_file_srcdir(self):
testrecipe = 'bash'
filepath = 'Makefile.in'
- srcdir = get_bb_var('S', testrecipe)
- workdir = get_bb_var('WORKDIR', testrecipe)
+ bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe)
+ srcdir = bb_vars['S']
+ workdir = bb_vars['WORKDIR']
subdir = os.path.relpath(srcdir, workdir)
self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir)
diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py
index a673f36d39..e8b483d7f8 100644
--- a/meta/lib/oeqa/selftest/runtime-test.py
+++ b/meta/lib/oeqa/selftest/runtime-test.py
@@ -1,5 +1,5 @@
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
from oeqa.utils.decorators import testcase
import os
import re
@@ -31,8 +31,9 @@ class TestExport(oeSelfTest):
bitbake('core-image-minimal')
bitbake('-c testexport core-image-minimal')
- # Verify if TEST_EXPORT_DIR was created
testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal')
+
+ # Verify if TEST_EXPORT_DIR was created
isdir = os.path.isdir(testexport_dir)
self.assertEqual(True, isdir, 'Failed to create testexport dir: %s' % testexport_dir)
@@ -73,10 +74,14 @@ class TestExport(oeSelfTest):
bitbake('core-image-minimal')
bitbake('-c testexport core-image-minimal')
+ needed_vars = ['TEST_EXPORT_DIR', 'TEST_EXPORT_SDK_DIR', 'TEST_EXPORT_SDK_NAME']
+ bb_vars = get_bb_vars(needed_vars, 'core-image-minimal')
+ testexport_dir = bb_vars['TEST_EXPORT_DIR']
+ sdk_dir = bb_vars['TEST_EXPORT_SDK_DIR']
+ sdk_name = bb_vars['TEST_EXPORT_SDK_NAME']
+
# Check for SDK
- testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal')
- sdk_dir = get_bb_var('TEST_EXPORT_SDK_DIR', 'core-image-minimal')
- tarball_name = "%s.sh" % get_bb_var('TEST_EXPORT_SDK_NAME', 'core-image-minimal')
+ tarball_name = "%s.sh" % sdk_name
tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name)
msg = "Couldn't find SDK tarball: %s" % tarball_path
self.assertEqual(os.path.isfile(tarball_path), True, msg)
diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py
index 35c2dc12ab..006afbef15 100644
--- a/meta/lib/oeqa/selftest/signing.py
+++ b/meta/lib/oeqa/selftest/signing.py
@@ -1,5 +1,5 @@
from oeqa.selftest.base import oeSelfTest
-from oeqa.utils.commands import runCmd, bitbake, get_bb_var
+from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
import os
import glob
import re
@@ -59,15 +59,17 @@ class Signing(oeSelfTest):
self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
- pkgdatadir = get_bb_var('PKGDATA_DIR', test_recipe)
+ needed_vars = ['PKGDATA_DIR', 'DEPLOY_DIR_RPM', 'PACKAGE_ARCH', 'STAGING_BINDIR_NATIVE']
+ bb_vars = get_bb_vars(needed_vars, test_recipe)
+ pkgdatadir = bb_vars['PKGDATA_DIR']
pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/ed")
if 'PKGE' in pkgdata:
pf = pkgdata['PN'] + "-" + pkgdata['PKGE'] + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
else:
pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
- deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', test_recipe)
- package_arch = get_bb_var('PACKAGE_ARCH', test_recipe).replace('-', '_')
- staging_bindir_native = get_bb_var('STAGING_BINDIR_NATIVE', test_recipe)
+ deploy_dir_rpm = bb_vars['DEPLOY_DIR_RPM']
+ package_arch = bb_vars['PACKAGE_ARCH'].replace('-', '_')
+ staging_bindir_native = bb_vars['STAGING_BINDIR_NATIVE']
pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm')))
diff --git a/meta/lib/oeqa/selftest/sstate.py b/meta/lib/oeqa/selftest/sstate.py
index 742f4d053b..f54bc41465 100644
--- a/meta/lib/oeqa/selftest/sstate.py
+++ b/