patman: Support returning the parsers to use

The parsing tests need to be able to try invalid arguments to make sure
that these are handled correctly. Provide a way to return the parsers
being used, as well as to pass in the parsers to use. This feature is
needed in test_series_no_subcmd(), for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py
index e34cf12..1b2a32c 100644
--- a/tools/patman/cmdline.py
+++ b/tools/patman/cmdline.py
@@ -209,10 +209,13 @@
         test_parser.add_argument('testname', type=str, default=None, nargs='?',
                                  help="Specify the test to run")
 
-    return parser
+    parsers = {
+        'main': parser,
+        }
+    return parsers
 
 
-def parse_args(argv=None, config_fname=None, parser=None):
+def parse_args(argv=None, config_fname=None, parsers=None):
     """Parse command line arguments from sys.argv[]
 
     Args:
@@ -225,8 +228,9 @@
             options: command line options
             args: command lin arguments
     """
-    if not parser:
-        parser = setup_parser()
+    if not parsers:
+        parsers = setup_parser()
+    parser = parsers['main']
 
     # Parse options twice: first to get the project and second to handle
     # defaults properly (which depends on project)