diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2017-02-21 14:33:08 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-01 23:27:10 +0000 |
commit | 19d23814e449101f57c8f149c77ee8697c636f43 (patch) | |
tree | d6e79252c334f3f71caff686423cfa52ff2327a5 /meta/lib/oeqa/selftest/bbtests.py | |
parent | ef010c1a1d823870aba80152fc13c32c62e95146 (diff) | |
download | poky-19d23814e449101f57c8f149c77ee8697c636f43.tar.gz |
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]
(From OE-Core rev: e53f86ba8aeb6d2e9eb259329001d27d62401072)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/bbtests.py')
-rw-r--r-- | meta/lib/oeqa/selftest/bbtests.py | 24 |
1 files changed, 14 insertions, 10 deletions
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 | |||
3 | 3 | ||
4 | import oeqa.utils.ftools as ftools | 4 | import oeqa.utils.ftools as ftools |
5 | from oeqa.selftest.base import oeSelfTest | 5 | from oeqa.selftest.base import oeSelfTest |
6 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var | 6 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars |
7 | from oeqa.utils.decorators import testcase | 7 | from oeqa.utils.decorators import testcase |
8 | 8 | ||
9 | class BitbakeTests(oeSelfTest): | 9 | class BitbakeTests(oeSelfTest): |
@@ -78,9 +78,10 @@ class BitbakeTests(oeSelfTest): | |||
78 | # test 1 from bug 5875 | 78 | # test 1 from bug 5875 |
79 | test_recipe = 'zlib' | 79 | test_recipe = 'zlib' |
80 | test_data = "Microsoft Made No Profit From Anyone's Zunes Yo" | 80 | test_data = "Microsoft Made No Profit From Anyone's Zunes Yo" |
81 | image_dir = get_bb_var('D', test_recipe) | 81 | bb_vars = get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe) |
82 | pkgsplit_dir = get_bb_var('PKGDEST', test_recipe) | 82 | image_dir = bb_vars['D'] |
83 | man_dir = get_bb_var('mandir', test_recipe) | 83 | pkgsplit_dir = bb_vars['PKGDEST'] |
84 | man_dir = bb_vars['mandir'] | ||
84 | 85 | ||
85 | bitbake('-c clean %s' % test_recipe) | 86 | bitbake('-c clean %s' % test_recipe) |
86 | bitbake('-c package -f %s' % test_recipe) | 87 | bitbake('-c package -f %s' % test_recipe) |
@@ -121,8 +122,9 @@ class BitbakeTests(oeSelfTest): | |||
121 | @testcase(899) | 122 | @testcase(899) |
122 | def test_image_manifest(self): | 123 | def test_image_manifest(self): |
123 | bitbake('core-image-minimal') | 124 | bitbake('core-image-minimal') |
124 | deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") | 125 | bb_vars = get_bb_vars(["DEPLOY_DIR_IMAGE", "IMAGE_LINK_NAME"], "core-image-minimal") |
125 | imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal") | 126 | deploydir = bb_vars["DEPLOY_DIR_IMAGE"] |
127 | imagename = bb_vars["IMAGE_LINK_NAME"] | ||
126 | manifest = os.path.join(deploydir, imagename + ".manifest") | 128 | manifest = os.path.join(deploydir, imagename + ".manifest") |
127 | self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest) | 129 | self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest) |
128 | 130 | ||
@@ -160,8 +162,9 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
160 | result = bitbake('-c fetch aspell', ignore_status=True) | 162 | result = bitbake('-c fetch aspell', ignore_status=True) |
161 | self.delete_recipeinc('aspell') | 163 | self.delete_recipeinc('aspell') |
162 | self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output) | 164 | self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output) |
163 | 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"))) | 165 | dl_dir = get_bb_var("DL_DIR") |
164 | 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"))) | 166 | 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) |
167 | 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) | ||
165 | 168 | ||
166 | @testcase(1028) | 169 | @testcase(1028) |
167 | def test_environment(self): | 170 | def test_environment(self): |
@@ -253,8 +256,9 @@ INHERIT_remove = \"report-error\" | |||
253 | def test_bbappend_order(self): | 256 | def test_bbappend_order(self): |
254 | """ Bitbake should bbappend to recipe in a predictable order """ | 257 | """ Bitbake should bbappend to recipe in a predictable order """ |
255 | test_recipe = 'ed' | 258 | test_recipe = 'ed' |
256 | test_recipe_summary_before = get_bb_var('SUMMARY', test_recipe) | 259 | bb_vars = get_bb_vars(['SUMMARY', 'PV'], test_recipe) |
257 | test_recipe_pv = get_bb_var('PV', test_recipe) | 260 | test_recipe_summary_before = bb_vars['SUMMARY'] |
261 | test_recipe_pv = bb_vars['PV'] | ||
258 | recipe_append_file = test_recipe + '_' + test_recipe_pv + '.bbappend' | 262 | recipe_append_file = test_recipe + '_' + test_recipe_pv + '.bbappend' |
259 | expected_recipe_summary = test_recipe_summary_before | 263 | expected_recipe_summary = test_recipe_summary_before |
260 | 264 | ||