[llvm] 3eb1d7f - [lit] Create report generators during argument parsing
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 17:04:07 PDT 2020
Author: Julian Lettner
Date: 2020-05-01T17:03:55-07:00
New Revision: 3eb1d7ffb57d718fd591fd9886e8aae16906c039
URL: https://github.com/llvm/llvm-project/commit/3eb1d7ffb57d718fd591fd9886e8aae16906c039
DIFF: https://github.com/llvm/llvm-project/commit/3eb1d7ffb57d718fd591fd9886e8aae16906c039.diff
LOG: [lit] Create report generators during argument parsing
Added:
Modified:
llvm/utils/lit/lit/cl_arguments.py
llvm/utils/lit/lit/main.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/cl_arguments.py b/llvm/utils/lit/lit/cl_arguments.py
index 4e185dee900f..e03e4c269d72 100644
--- a/llvm/utils/lit/lit/cl_arguments.py
+++ b/llvm/utils/lit/lit/cl_arguments.py
@@ -3,6 +3,7 @@
import shlex
import sys
+import lit.reports
import lit.util
@@ -57,7 +58,10 @@ def parse_args():
help="Display all commandlines and output",
action="store_true")
format_group.add_argument("-o", "--output",
- dest="output_path",
+ 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",
@@ -98,7 +102,10 @@ def parse_args():
help="Don't execute any tests (assume PASS)",
action="store_true")
execution_group.add_argument("--xunit-xml-output",
- dest="xunit_output_file",
+ 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",
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index d155b0d8a4d1..c6f798d35eaf 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -98,11 +98,8 @@ def main(builtin_params={}):
print_results(discovered_tests, elapsed, opts)
- if opts.output_path:
- #TODO(yln): pass in discovered_tests
- write_test_results(executed_tests, lit_config, elapsed, opts.output_path)
- if opts.xunit_output_file:
- write_test_results_xunit(executed_tests, opts)
+ for report in opts.reports:
+ report.write_results(executed_tests, elapsed)
if lit_config.numErrors:
sys.stderr.write('\n%d error(s) in tests\n' % lit_config.numErrors)
@@ -330,16 +327,3 @@ def print_summary(tests_by_code, quiet, elapsed):
label = label.ljust(max_label_len)
count = str(count).rjust(max_count_len)
print(' %s: %s' % (label, count))
-
-
-def write_test_results(tests, lit_config, elapsed, output_path):
- import lit.reports
- r = lit.reports.JsonReport(output_path)
- r.write_results(tests, elapsed)
-
-
-def write_test_results_xunit(tests, opts):
- import lit.reports
- r = lit.reports.XunitReport(opts.xunit_output_file)
- r.write_results(tests, 0.0)
-
More information about the llvm-commits
mailing list