diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2019-09-03 16:56:41 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-09-07 21:56:43 +0100 |
commit | d4dd54fa502c10b57fe1b666ade2c33abafb31d2 (patch) | |
tree | a90d848080373979f2f28d725615f84fa94018a0 | |
parent | c3625e141dfbb6c8b8bfa3ff05e0e87f215bf606 (diff) | |
download | poky-d4dd54fa502c10b57fe1b666ade2c33abafb31d2.tar.gz |
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.
(From OE-Core rev: 0dc3caf21c4519ef16c2ac99b93c03e23aab61d9)
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.py | 11 |
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): | |||
61 | group.add_argument('-r', '--run-tests', required=False, action='store', | 61 | group.add_argument('-r', '--run-tests', required=False, action='store', |
62 | nargs='+', dest="run_tests", default=None, | 62 | nargs='+', dest="run_tests", default=None, |
63 | help='Select what tests to run (modules, classes or test methods). Format should be: <module>.<class>.<test_method>') | 63 | help='Select what tests to run (modules, classes or test methods). Format should be: <module>.<class>.<test_method>') |
64 | group.add_argument('-t', '--run-only-tags', action='store', | ||
65 | nargs='+', dest="run_only_tags", default=None, | ||
66 | help='Run all (unhidden) tests which match any of the specified tags.') | ||
67 | group.add_argument('-T', '--run-exclude-tags', action='store', | ||
68 | nargs='+', dest="run_exclude_tags", default=None, | ||
69 | help='Run all (unhidden) tests excluding any that match any of the specified tags.') | ||
64 | 70 | ||
65 | group.add_argument('-m', '--list-modules', required=False, | 71 | group.add_argument('-m', '--list-modules', required=False, |
66 | action="store_true", default=False, | 72 | action="store_true", default=False, |
@@ -149,6 +155,11 @@ class OESelftestTestContextExecutor(OETestContextExecutor): | |||
149 | copyfile(self.tc_kwargs['init']['config_paths']['bblayers'], | 155 | copyfile(self.tc_kwargs['init']['config_paths']['bblayers'], |
150 | self.tc_kwargs['init']['config_paths']['bblayers_backup']) | 156 | self.tc_kwargs['init']['config_paths']['bblayers_backup']) |
151 | 157 | ||
158 | if args.run_only_tags: | ||
159 | self.tc_kwargs['load']['tags_filter'] = lambda tags: not tags or not any(tag in args.run_only_tags for tag in tags) | ||
160 | if args.run_exclude_tags: | ||
161 | self.tc_kwargs['load']['tags_filter'] = lambda tags: any(tag in args.run_exclude_tags for tag in tags) | ||
162 | |||
152 | self.tc_kwargs['run']['skips'] = args.skips | 163 | self.tc_kwargs['run']['skips'] = args.skips |
153 | self.tc_kwargs['run']['processes'] = args.processes | 164 | self.tc_kwargs['run']['processes'] = args.processes |
154 | 165 | ||