mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 04:36:13 +02:00
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>
This commit is contained in:
parent
56d33104e1
commit
dff62ec8b4
@ -209,10 +209,13 @@ def setup_parser():
|
||||
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 @@ def parse_args(argv=None, config_fname=None, parser=None):
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user