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/buildoptions.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/buildoptions.py')
-rw-r--r-- | meta/lib/oeqa/selftest/buildoptions.py | 10 |
1 files changed, 6 insertions, 4 deletions
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 | |||
5 | import tempfile | 5 | import tempfile |
6 | from oeqa.selftest.base import oeSelfTest | 6 | from oeqa.selftest.base import oeSelfTest |
7 | from oeqa.selftest.buildhistory import BuildhistoryBase | 7 | from oeqa.selftest.buildhistory import BuildhistoryBase |
8 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var | 8 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars |
9 | import oeqa.utils.ftools as ftools | 9 | import oeqa.utils.ftools as ftools |
10 | from oeqa.utils.decorators import testcase | 10 | from oeqa.utils.decorators import testcase |
11 | 11 | ||
@@ -33,13 +33,15 @@ class ImageOptionsTests(oeSelfTest): | |||
33 | @testcase(286) | 33 | @testcase(286) |
34 | def test_ccache_tool(self): | 34 | def test_ccache_tool(self): |
35 | bitbake("ccache-native") | 35 | bitbake("ccache-native") |
36 | p = get_bb_var('SYSROOT_DESTDIR', 'ccache-native') + get_bb_var('bindir', 'ccache-native') + "/" + "ccache" | 36 | bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'ccache-native') |
37 | p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "ccache" | ||
37 | self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p) | 38 | self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p) |
38 | self.write_config('INHERIT += "ccache"') | 39 | self.write_config('INHERIT += "ccache"') |
39 | self.add_command_to_tearDown('bitbake -c clean m4') | 40 | self.add_command_to_tearDown('bitbake -c clean m4') |
40 | bitbake("m4 -f -c compile") | 41 | bitbake("m4 -f -c compile") |
41 | res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True) | 42 | log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile") |
42 | 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")) | 43 | res = runCmd("grep ccache %s" % log_compile, ignore_status=True) |
44 | self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile) | ||
43 | 45 | ||
44 | @testcase(1435) | 46 | @testcase(1435) |
45 | def test_read_only_image(self): | 47 | def test_read_only_image(self): |