]> xenbits.xensource.com Git - people/liuw/xtf.git/commitdiff
runner: Add --all and --non-default options to help with category selection
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 2 Aug 2016 09:46:45 +0000 (10:46 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 2 Aug 2016 15:12:40 +0000 (16:12 +0100)
This allows calling software to easily find all tests to run without needing
to name categories, environments or tests specifically.

--all is expected to cover the usual case, while --non-default is provided
just in case.  It is not expected to be running the non-default category tests
in bulk.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xtf-runner

index 98d2d53ed7f893719ac6b05187c90e0ab89f70dc..034393cc09c387b4bb2ea49062f5e27f7f783be0 100755 (executable)
@@ -337,15 +337,17 @@ def interpret_selection(opts):
 
     args = set(opts.args)
 
-    # No input? No selection.
-    if not args:
-        return []
-
     # First, filter into large buckets
     cats   = all_categories   & args
     envs   = all_environments & args
     others = args - cats - envs
 
+    # Add all categories if --all or --non-default is passed
+    if opts.all:
+        cats |= default_categories
+    if opts.non_default:
+        cats |= non_default_categories
+
     # Allow "pv" and "hvm" as a combination of environments
     if "pv" in others:
         envs |= pv_environments
@@ -355,6 +357,10 @@ def interpret_selection(opts):
         envs |= hvm_environments
         others -= {"hvm"}
 
+    # No input? No selection.
+    if not cats and not envs and not others:
+        return []
+
     all_tests = get_all_test_info()
     tests = []
 
@@ -533,8 +539,10 @@ def main():
                   "\n"
                   "  Additionally, --host may be passed to restrict the\n"
                   "  selection to tests applicable to the current host.\n"
+                  "  --all may be passed to choose all default categories\n"
+                  "  without needing to explicitly name them.  --non-default\n"
+                  "  is available to obtain the non-default categories.\n"
                   "\n"
-
                   "Examples:\n"
                   "  Listing all tests implemented for hvm32 environment:\n"
                   "    ./xtf-runner --list hvm32\n"
@@ -562,6 +570,14 @@ def main():
                       dest = "list_tests",
                       help = "List tests in the selection",
                       )
+    parser.add_option("-a", "--all", action = "store_true",
+                      dest = "all",
+                      help = "Select all default categories",
+                      )
+    parser.add_option("--non-default", action = "store_true",
+                      dest = "non_default",
+                      help = "Select all non default categories",
+                      )
     parser.add_option("--host", action = "store_true",
                       dest = "host", help = "Restrict selection to applicable"
                       " tests for the current host",