[llvm] 47b25c3 - [lit] Create one output file when `--output` is specified more than once

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 21:44:20 PDT 2020


Author: Julian Lettner
Date: 2020-05-04T21:36:20-07:00
New Revision: 47b25c3323c5919bb3f96a432369cc8d8f5f3117

URL: https://github.com/llvm/llvm-project/commit/47b25c3323c5919bb3f96a432369cc8d8f5f3117
DIFF: https://github.com/llvm/llvm-project/commit/47b25c3323c5919bb3f96a432369cc8d8f5f3117.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/utils/lit/lit/cl_arguments.py

Removed: 
    


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


        


More information about the llvm-commits mailing list