summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2019-09-03 16:56:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-07 21:47:35 +0100
commit0dc3caf21c4519ef16c2ac99b93c03e23aab61d9 (patch)
treec5fcb8d12bec525176b8d499ff49035dd071eb6e
parentb8a4a4c2de68110d74607cb9807c9e741ca9441c (diff)
downloadopenembedded-core-contrib-0dc3caf21c4519ef16c2ac99b93c03e23aab61d9.tar.gz
openembedded-core-contrib-0dc3caf21c4519ef16c2ac99b93c03e23aab61d9.tar.bz2
openembedded-core-contrib-0dc3caf21c4519ef16c2ac99b93c03e23aab61d9.zip
oeqa/selftest: Add test run filtering based on test tags
Add '--run-only-tags' for running tests which match any of the provided tags, and '--run-exclude-tags' for running all tests except those that have any of the provided tags. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/context.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index d279994ddf..47de08e3f2 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -61,6 +61,12 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
group.add_argument('-r', '--run-tests', required=False, action='store',
nargs='+', dest="run_tests", default=None,
help='Select what tests to run (modules, classes or test methods). Format should be: <module>.<class>.<test_method>')
+ group.add_argument('-t', '--run-only-tags', action='store',
+ nargs='+', dest="run_only_tags", default=None,
+ help='Run all (unhidden) tests which match any of the specified tags.')
+ group.add_argument('-T', '--run-exclude-tags', action='store',
+ nargs='+', dest="run_exclude_tags", default=None,
+ help='Run all (unhidden) tests excluding any that match any of the specified tags.')
group.add_argument('-m', '--list-modules', required=False,
action="store_true", default=False,
@@ -149,6 +155,11 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
copyfile(self.tc_kwargs['init']['config_paths']['bblayers'],
self.tc_kwargs['init']['config_paths']['bblayers_backup'])
+ if args.run_only_tags:
+ self.tc_kwargs['load']['tags_filter'] = lambda tags: not tags or not any(tag in args.run_only_tags for tag in tags)
+ if args.run_exclude_tags:
+ self.tc_kwargs['load']['tags_filter'] = lambda tags: any(tag in args.run_exclude_tags for tag in tags)
+
self.tc_kwargs['run']['skips'] = args.skips
self.tc_kwargs['run']['processes'] = args.processes