1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[lit] Create one output file when --output is specified more than once

The argparse 'append' action concatenates multiple occurrences of an
argument (even when we specify `nargs=1` or `nargs='?'`).  This means
that we create multiple identical output files if the `--output`
argument is given more than once.  This isn't useful and we instead want
this to behave like a standard optional argument: last occurrence wins.
This commit is contained in:
Julian Lettner 2020-05-04 21:36:20 -07:00
parent 90a12086d6
commit bf1a04832c

View File

@ -58,10 +58,7 @@ def parse_args():
help="Display all commandlines and output", help="Display all commandlines and output",
action="store_true") action="store_true")
format_group.add_argument("-o", "--output", format_group.add_argument("-o", "--output",
dest="reports",
action="append",
type=lit.reports.JsonReport, type=lit.reports.JsonReport,
default=[],
help="Write test results to the provided path", help="Write test results to the provided path",
metavar="PATH") metavar="PATH")
format_group.add_argument("--no-progress-bar", format_group.add_argument("--no-progress-bar",
@ -102,10 +99,7 @@ def parse_args():
help="Don't execute any tests (assume PASS)", help="Don't execute any tests (assume PASS)",
action="store_true") action="store_true")
execution_group.add_argument("--xunit-xml-output", execution_group.add_argument("--xunit-xml-output",
dest="reports",
action="append",
type=lit.reports.XunitReport, type=lit.reports.XunitReport,
default=[],
help="Write XUnit-compatible XML test reports to the specified file") help="Write XUnit-compatible XML test reports to the specified file")
execution_group.add_argument("--timeout", execution_group.add_argument("--timeout",
dest="maxIndividualTestTime", dest="maxIndividualTestTime",
@ -190,6 +184,8 @@ def parse_args():
else: else:
opts.shard = None opts.shard = None
opts.reports = filter(None, [opts.output, opts.xunit_xml_output])
return opts return opts