[OE-core] [PATCH 1/1] oeqa/concurrencytest: fix for locating meta-selftest
Richard Purdie
richard.purdie at linuxfoundation.org
Thu Dec 20 10:14:03 UTC 2018
On Wed, 2018-12-19 at 23:43 -0800, Robert Yang wrote:
> The previous code assumed builddir and meta-selftest are in the same
> dir, but this isn't always true, builddir can be anywhere, use
> bitbake to locate meta-selftest can fix the problem.
>
> The bb.fatal() doesn't work (no error message is print), so I use
> raise Exception to print error messages.
>
> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
> ---
> meta/lib/oeqa/core/utils/concurrencytest.py | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py
> b/meta/lib/oeqa/core/utils/concurrencytest.py
> index f050289..ef1698c 100644
> --- a/meta/lib/oeqa/core/utils/concurrencytest.py
> +++ b/meta/lib/oeqa/core/utils/concurrencytest.py
> @@ -139,6 +139,20 @@ def removebuilddir(d):
> delay = delay - 1
> bb.utils.prunedir(d)
>
> +def get_selftestdir():
> + """
> + Use 'which bitbake' to locate meta-selftest dir
> + """
> + cmd = 'which bitbake'
> + retval, bitbake_path = subprocess.getstatusoutput(cmd)
> + if retval != 0:
> + raise Exception('Failed to run %s' % cmd)
> + topdir = os.path.realpath('%s/../../' %
> os.path.dirname(bitbake_path))
> + selftestdir = os.path.join(topdir, 'meta-selftest')
> + if not os.path.exists(selftestdir):
> + raise Exception('Failed to run %s' % cmd)
> + return selftestdir
> +
> def fork_for_tests(concurrency_num, suite):
> result = []
> test_blocks = partition_tests(suite, concurrency_num)
> @@ -166,7 +180,7 @@ def fork_for_tests(concurrency_num, suite):
> if 'BUILDDIR' in os.environ:
> builddir = os.environ['BUILDDIR']
> newbuilddir = builddir + "-st-" + str(ourpid)
> - selftestdir = os.path.abspath(builddir +
> "/../meta-selftest")
> + selftestdir = get_selftestdir()
> newselftestdir = newbuilddir + "/meta-selftest"
Sorry, but this change just swaps one problem for another. meta-
selftest is part of OE-Core so its position relative to bitbake isn't
fixed.
How about we use
from oeqa.utils.commands import get_test_layer
?
Cheers,
Richard
More information about the Openembedded-core
mailing list