From: Joshua Lock <joshua.g.lock@linux.intel.com>
To: jwang <jing.j.wang@intel.com>, openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 3/4] meta: use baserunner in oetest
Date: Thu, 15 Sep 2016 14:15:48 +0100 [thread overview]
Message-ID: <1473945348.3558.34.camel@linux.intel.com> (raw)
In-Reply-To: <1473729455-32649-3-git-send-email-jing.j.wang@intel.com>
On Tue, 2016-09-13 at 09:17 +0800, jwang wrote:
> From: zjh <junhuix.zhang@intel.com>
>
> enable two features from baserunner:
> 1. loadtest
> 2. read test cases from manifest file
>
> Signed-off-by: zjh <junhuix.zhang@intel.com>
> ---
> meta/lib/oeqa/oetest.py | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
> index 4a740fb..9211cec 100644
> --- a/meta/lib/oeqa/oetest.py
> +++ b/meta/lib/oeqa/oetest.py
> @@ -28,6 +28,8 @@ except ImportError:
> pass
> from oeqa.utils.decorators import LogResults, gettag, getResults
> from oeqa.utils import avoid_paths_in_environ
> +from base.baserunner import TestRunnerBase
> +
>
> logger = logging.getLogger("BitBake")
>
> @@ -203,8 +205,10 @@ def custom_verbose(msg, *args, **kwargs):
> logger.info(_buffer_logger.rstrip("\n"), *args,
> **kwargs)
> _buffer_logger = ""
>
> -class TestContext(object):
> +class TestContext(TestRunnerBase):
> + _configure_in_init = True
This is a funny variable, when would it not be True and why? Could we
add a comment here about what the variable is for?
Should it be an argument passed at object construction, as it's denoted
as internal by the _ prefix?
> def __init__(self, d, exported=False):
> + super(TestContext, self).__init__(self)
> self.d = d
>
> self.testsuites = self._get_test_suites()
> @@ -223,6 +227,9 @@ class TestContext(object):
> self.imagefeatures = d.getVar("IMAGE_FEATURES",
> True).split()
> self.distrofeatures = d.getVar("DISTRO_FEATURES",
> True).split()
>
> + if self._configure_in_init:
> + self.configure()
If we don't configure during __init__() when do we do it? Why might we
not do it during __init__() ?
> +
> # get testcase list from specified file
> # if path is a relative path, then relative to build/conf/
> def _read_testlist(self, fpath, builddir):
> @@ -329,9 +336,7 @@ class TestContext(object):
> def loadTests(self):
> setattr(oeTest, "tc", self)
>
> - testloader = unittest.TestLoader()
> - testloader.sortTestMethodsUsing = None
> - suites = [testloader.loadTestsFromName(name) for name in
> self.testslist]
> + suites = self.loadtest(self.testslist)
> suites = filterByTagExp(suites, getattr(self, "tagexp",
> None))
>
> # Determine dependencies between suites by looking for
> @skipUnlessPassed
> @@ -376,9 +381,9 @@ class TestContext(object):
> def cmpfunc(a, b):
> return cmp((a.depth, a.index), (b.depth, b.index))
>
> - suites.sort(key=functools.cmp_to_key(cmpfunc))
> + suites._tests.sort(key=functools.cmp_to_key(cmpfunc))
We appear to be using a non-public instance variable, is there
something else we could be using here to get the list of tests?
>
> - self.suite = testloader.suiteClass(suites)
> + self.suite = suites
>
> return self.suite
>
> @@ -387,11 +392,10 @@ class TestContext(object):
> if hasattr(self, "tagexp") and self.tagexp:
> logger.info("Filter test cases by tags: %s" %
> self.tagexp)
> logger.info("Found %s tests" % self.suite.countTestCases())
> - runner = unittest.TextTestRunner(verbosity=2)
> if 'bb' in sys.modules:
> - runner.stream.write = custom_verbose
> -
> - return runner.run(self.suite)
> + self.runner.stream.write = custom_verbose
> + self.start(self.suite)
> + return self.result()
>
> class RuntimeTestContext(TestContext):
> def __init__(self, d, target, exported=False):
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-09-15 13:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 1:17 [PATCH 1/4] meta: introduce a small baserunner framework jwang
2016-09-13 1:17 ` [PATCH 2/4] meta: implement key baserunner features jwang
2016-09-15 13:15 ` Joshua Lock
2016-09-13 1:17 ` [PATCH 3/4] meta: use baserunner in oetest jwang
2016-09-15 13:15 ` Joshua Lock [this message]
2016-09-13 1:17 ` [PATCH 4/4] meta: modify runexported script to inherit the features from baserunner jwang
2016-09-15 13:15 ` [PATCH 1/4] meta: introduce a small baserunner framework Joshua Lock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473945348.3558.34.camel@linux.intel.com \
--to=joshua.g.lock@linux.intel.com \
--cc=jing.j.wang@intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox