diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2017-08-03 07:01:38 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-11 00:08:31 +0100 |
commit | e40eeaa790b95d9c25832405c0b0d5b3a0d0292b (patch) | |
tree | 890cee666239426b14186747106497c734a31e71 /meta/lib/oeqa/core | |
parent | c7ef6000b11f1b1cd27c9bc408eea9f76bb94a3b (diff) | |
download | openembedded-core-e40eeaa790b95d9c25832405c0b0d5b3a0d0292b.tar.gz openembedded-core-e40eeaa790b95d9c25832405c0b0d5b3a0d0292b.tar.bz2 openembedded-core-e40eeaa790b95d9c25832405c0b0d5b3a0d0292b.zip |
context: Include a command line argument to run all except certain tests
A new command line argument (-R, which is the oposite of current -r) that allows
to run all test cases except the ones indicated through the command line.
Some command line examples:
* Run all except the distro test case:
$ oe-selftest -R distrodata
* Run all except the archiver test case and a single bblayers unit test
$ oe-selftest -R archiver bblayers.BitbakeLayers.test_bitbakelayers_add_remove
[YOCTO #11847]
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib/oeqa/core')
-rw-r--r-- | meta/lib/oeqa/core/context.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py index 422e289992..acd547416f 100644 --- a/meta/lib/oeqa/core/context.py +++ b/meta/lib/oeqa/core/context.py @@ -41,6 +41,14 @@ class OETestContext(object): return modules + def skipTests(self, skips): + if not skips: + return + for test in self.suites: + for skip in skips: + if test.id().startswith(skip): + setattr(test, 'setUp', lambda: test.skipTest('Skip by the command line argument "%s"' % skip)) + def loadTests(self, module_paths, modules=[], tests=[], modules_manifest="", modules_required=[], filters={}): if modules_manifest: @@ -50,9 +58,12 @@ class OETestContext(object): modules_required, filters) self.suites = self.loader.discover() - def runTests(self): + def runTests(self, skips=[]): self.runner = self.runnerClass(self, descriptions=False, verbosity=2) + # Dinamically skip those tests specified though arguments + self.skipTests(skips) + self._run_start_time = time.time() result = self.runner.run(self.suites) self._run_end_time = time.time() @@ -128,7 +139,8 @@ class OETestContextExecutor(object): self.tc_kwargs = {} self.tc_kwargs['init'] = {} self.tc_kwargs['load'] = {} - self.tc_kwargs['run'] = {} + self.tc_kwargs['list'] = {} + self.tc_kwargs['run'] = {} self.tc_kwargs['init']['logger'] = self._setup_logger(logger, args) if args.test_data_file: @@ -143,6 +155,8 @@ class OETestContextExecutor(object): else: self.tc_kwargs['load']['modules'] = [] + self.tc_kwargs['run']['skips'] = [] + self.module_paths = args.CASES_PATHS def _pre_run(self): @@ -159,7 +173,7 @@ class OETestContextExecutor(object): sys.exit(1) if args.list_tests: - rc = self.tc.listTests(args.list_tests, **self.tc_kwargs['run']) + rc = self.tc.listTests(args.list_tests, **self.tc_kwargs['list']) else: self._pre_run() rc = self.tc.runTests(**self.tc_kwargs['run']) |