Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/docs/CommandGuide/lit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ EXECUTION OPTIONS

Write XUnit-compatible XML test reports to the specified file.

.. option:: --report-failures-only

Only include unresolved, timed out, failed and unexpectedly passed tests in the report.

.. option:: --resultdb-output RESULTDB_OUTPUT

Write LuCI ResultDB compatible JSON to the specified file.
Expand Down
6 changes: 6 additions & 0 deletions llvm/utils/lit/lit/cl_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ def parse_args():
type=lit.reports.XunitReport,
help="Write XUnit-compatible XML test reports to the specified file",
)
execution_group.add_argument(
"--report-failures-only",
help="Only include unresolved, timed out, failed"
" and unexpectedly passed tests in the report",
action="store_true"
)
execution_group.add_argument(
"--resultdb-output",
type=lit.reports.ResultDBReport,
Expand Down
4 changes: 4 additions & 0 deletions llvm/utils/lit/lit/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ def main(builtin_params={}):
print_results(discovered_tests, elapsed, opts)

tests_for_report = selected_tests if opts.shard else discovered_tests
if opts.report_failures_only:
# Only report tests that failed.
tests_for_report = [t for t in tests_for_report if t.isFailure()]

for report in opts.reports:
report.write_results(tests_for_report, elapsed)

Expand Down
12 changes: 12 additions & 0 deletions llvm/utils/lit/tests/xunit-output-report-failures-only.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Check xunit output.
# RUN: not %{lit} --report-failures-only --xunit-xml-output %t.xunit.xml %{inputs}/xunit-output
# RUN: FileCheck --input-file=%t.xunit.xml %s

# CHECK: <?xml version="1.0" encoding="UTF-8"?>
# CHECK-NEXT: <testsuites time="{{[0-9.]+}}">
# CHECK-NEXT: <testsuite name="test-data" tests="1" failures="1" skipped="0" time="{{[0-9.]+}}">
# CHECK-NEXT: <testcase classname="test-data.test-data" name="bad&amp;name.ini" time="{{[0-1]\.[0-9]+}}">
# CHECK-NEXT: <failure><![CDATA[& < > ]]]]><![CDATA[> &"]]></failure>
# CHECK-NEXT: </testcase>
# CHECK-NEXT: </testsuite>
# CHECK-NEXT: </testsuites>
Loading