diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -96,17 +96,13 @@
run_tests(selected_tests, lit_config, opts, len(discovered_tests))
elapsed = time.time() - start
- # TODO(yln): eventually, all functions below should act on discovered_tests
- executed_tests = [
- t for t in selected_tests if t.result.code != lit.Test.SKIPPED]
-
if opts.time_tests:
print_histogram(discovered_tests)
print_results(discovered_tests, elapsed, opts)
for report in opts.reports:
- report.write_results(executed_tests, elapsed)
+ report.write_results(discovered_tests, elapsed)
if lit_config.numErrors:
sys.stderr.write('\n%d error(s) in tests\n' % lit_config.numErrors)
diff --git a/llvm/utils/lit/lit/reports.py b/llvm/utils/lit/lit/reports.py
--- a/llvm/utils/lit/lit/reports.py
+++ b/llvm/utils/lit/lit/reports.py
@@ -17,7 +17,8 @@
self.output_file = output_file
def write_results(self, tests, elapsed):
- assert not any(t.result.code in {lit.Test.EXCLUDED, lit.Test.SKIPPED} for t in tests)
+ unexecuted_codes = {lit.Test.EXCLUDED, lit.Test.SKIPPED}
+ tests = [t for t in tests if t.result.code not in unexecuted_codes]
# Construct the data we will write.
data = {}
# Encode the current lit version as a schema version.
@@ -75,7 +76,6 @@
# TODO(yln): elapsed unused, put it somewhere?
def write_results(self, tests, elapsed):
- assert not any(t.result.code in {lit.Test.EXCLUDED, lit.Test.SKIPPED} for t in tests)
tests.sort(key=by_suite_and_test_path)
tests_by_suite = itertools.groupby(tests, lambda t: t.suite)
@@ -136,4 +136,4 @@
features = test.getMissingRequiredFeatures()
if features:
return 'Missing required feature(s): ' + ', '.join(features)
- return 'Skipping because of configuration'
+ return 'Unsupported configuration'
diff --git a/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py b/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py
--- a/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py
+++ b/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py
@@ -23,6 +23,10 @@
result = lit.Test.Result(getattr(lit.Test, result_code),
result_output)
+ required_feature = cfg.get('global', 'required_feature', fallback=None)
+ if required_feature:
+ test.requires.append(required_feature)
+
# Load additional metrics.
for key,value_str in cfg.items('results'):
value = eval(value_str)
diff --git a/llvm/utils/lit/tests/Inputs/xunit-output/excluded.ini b/llvm/utils/lit/tests/Inputs/xunit-output/excluded.ini
new file mode 100644
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/xunit-output/excluded.ini
@@ -0,0 +1,5 @@
+[global]
+result_code = EXCLUDED
+result_output = not shown
+
+[results]
diff --git a/llvm/utils/lit/tests/Inputs/xunit-output/missing_feature.ini b/llvm/utils/lit/tests/Inputs/xunit-output/missing_feature.ini
new file mode 100644
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/xunit-output/missing_feature.ini
@@ -0,0 +1,7 @@
+[global]
+result_code = UNSUPPORTED
+result_output = not shown
+
+required_feature = dummy_feature
+
+[results]
diff --git a/llvm/utils/lit/tests/Inputs/xunit-output/pass.ini b/llvm/utils/lit/tests/Inputs/xunit-output/pass.ini
new file mode 100644
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/xunit-output/pass.ini
@@ -0,0 +1,5 @@
+[global]
+result_code = PASS
+result_output = not shown
+
+[results]
diff --git a/llvm/utils/lit/tests/Inputs/xunit-output/unsupported.ini b/llvm/utils/lit/tests/Inputs/xunit-output/unsupported.ini
new file mode 100644
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/xunit-output/unsupported.ini
@@ -0,0 +1,5 @@
+[global]
+result_code = UNSUPPORTED
+result_output = not shown
+
+[results]
diff --git a/llvm/utils/lit/tests/shtest-format.py b/llvm/utils/lit/tests/shtest-format.py
--- a/llvm/utils/lit/tests/shtest-format.py
+++ b/llvm/utils/lit/tests/shtest-format.py
@@ -134,7 +134,7 @@
# XUNIT:
# XUNIT:
-# XUNIT-NEXT:
+# XUNIT-NEXT:
# XUNIT:
# XUNIT-NEXT:
@@ -142,7 +142,7 @@
# XUNIT-NEXT:
# XUNIT:
-# XUNIT-NEXT:
+# XUNIT-NEXT:
# XUNIT:
diff --git a/llvm/utils/lit/tests/xunit-output.py b/llvm/utils/lit/tests/xunit-output.py
--- a/llvm/utils/lit/tests/xunit-output.py
+++ b/llvm/utils/lit/tests/xunit-output.py
@@ -7,10 +7,21 @@
# RUN: sh -c 'if command -v xmllint 2>/dev/null; then xmllint --noout %t.xunit.xml; fi'
# RUN: FileCheck < %t.xunit.xml %s
-# CHECK:
-# CHECK:
-# CHECK:
-# CHECK:
-# CHECK-NEXT: ]]]]> &"]]>
-# CHECK:
-# CHECK:
+# CHECK:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT: ]]]]> &"]]>
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT:
+# CHECK-NEXT: