Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Nathan Rossi <nathan@nathanrossi.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 4/7] oeqa/selftest/context.py: Change -t/-T args to be optional
Date: Sat, 07 Sep 2019 12:55:06 +0000	[thread overview]
Message-ID: <20190907125506.17536-4-nathan@nathanrossi.com> (raw)
In-Reply-To: <20190907125506.17536-1-nathan@nathanrossi.com>

Change the -t/-T args to be optional so that they can be used together
with the existing -r/-a/... args to run a more flexible filtering of
test tags.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
---
 meta/lib/oeqa/selftest/context.py | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index 47de08e3f2..3126ada716 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -61,12 +61,6 @@ 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,
@@ -83,7 +77,14 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
 
         parser.add_argument('--machine', required=False, choices=['random', 'all'],
                             help='Run tests on different machines (random/all).')
-        
+
+        parser.add_argument('-t', '--select-tags', dest="select_tags",
+                nargs='*', default=None,
+                help='Filter all (unhidden) tests to any that match any of the specified tags.')
+        parser.add_argument('-T', '--exclude-tags', dest="exclude_tags",
+                nargs='*', default=None,
+                help='Exclude all (unhidden) tests that match any of the specified tags. (exclude applies before select)')
+
         parser.set_defaults(func=self.run)
 
     def _get_available_machines(self):
@@ -155,10 +156,17 @@ 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)
+        def tag_filter(tags):
+            if args.exclude_tags:
+                if any(tag in args.exclude_tags for tag in tags):
+                    return True
+            if args.select_tags:
+                if not tags or not any(tag in args.select_tags for tag in tags):
+                    return True
+            return False
+
+        if args.select_tags or args.exclude_tags:
+            self.tc_kwargs['load']['tags_filter'] = tag_filter
 
         self.tc_kwargs['run']['skips'] = args.skips
         self.tc_kwargs['run']['processes'] = args.processes
---
2.23.0.rc1


  parent reply	other threads:[~2019-09-07 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-07 12:55 [PATCH 1/7] oeqa/core/runner.py: Fix OETestTag listing Nathan Rossi
2019-09-07 12:55 ` [PATCH 2/7] oeqa/core: Implement proper extra result collection and serialization Nathan Rossi
2019-09-07 12:55 ` [PATCH 3/7] oeqa/selftest: Use extraresults on self instead of self.tc Nathan Rossi
2019-09-07 12:55 ` [PATCH 5/7] oeqa/core/decorator: Fix super class modifying subclass tags Nathan Rossi
2019-09-07 12:55 ` Nathan Rossi [this message]
2019-09-07 12:55 ` [PATCH 6/7] oeqa/selftest/cases/gcc.py: Split into classes for parallelism Nathan Rossi
2019-09-07 12:55 ` [PATCH 7/7] oeqa/selftest/cases/glibc.py: Rework and tag with toolchain-user/system Nathan Rossi
2019-09-07 13:02 ` ✗ patchtest: failure for "oeqa/core/runner.py: Fix OETes..." and 6 more Patchwork

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=20190907125506.17536-4-nathan@nathanrossi.com \
    --to=nathan@nathanrossi.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