From e53f86ba8aeb6d2e9eb259329001d27d62401072 Mon Sep 17 00:00:00 2001 From: Mariano Lopez Date: Tue, 21 Feb 2017 14:33:08 +0000 Subject: 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 Signed-off-by: Ross Burton --- meta/lib/oeqa/selftest/prservice.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'meta/lib/oeqa/selftest/prservice.py') 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) -- cgit 1.2.3-korg