Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .ci/generate_test_report_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
args = parser.parse_args()

report, _ = generate_test_report_lib.generate_report_from_files(
report = generate_test_report_lib.generate_report_from_files(
args.title, args.return_code, args.junit_files
)

Expand Down
11 changes: 3 additions & 8 deletions .ci/generate_test_report_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def generate_report(
#
# If we were going to post a report, then yes, it would be misleading
# to say we succeeded when the final return code was non-zero.
return ("", "success")
return ""

failures = {}
tests_run = 0
Expand All @@ -51,12 +51,7 @@ def generate_report(
)

if not tests_run:
return ("", None)

style = "success"
# Either tests failed, or all tests passed but something failed to build.
if tests_failed or return_code != 0:
style = "error"
return ""

report = [f"# {title}", ""]

Expand Down Expand Up @@ -132,7 +127,7 @@ def plural(num_tests):
list_failures=False,
)

return report, style
return report


def generate_report_from_files(title, return_code, junit_files):
Expand Down
31 changes: 10 additions & 21 deletions .ci/generate_test_report_lib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def junit_from_xml(xml):

class TestReports(unittest.TestCase):
def test_title_only(self):
self.assertEqual(
generate_test_report_lib.generate_report("Foo", 0, []), ("", "success")
)
self.assertEqual(generate_test_report_lib.generate_report("Foo", 0, []), "")

def test_no_tests_in_testsuite(self):
self.assertEqual(
Expand All @@ -42,7 +40,7 @@ def test_no_tests_in_testsuite(self):
)
],
),
("", None),
"",
)

def test_no_failures(self):
Expand Down Expand Up @@ -70,8 +68,7 @@ def test_no_failures(self):
# Foo

* 1 test passed"""
),
"success",
)
),
)

Expand Down Expand Up @@ -106,8 +103,7 @@ def test_no_failures_build_failed(self):
Download the build's log file to see the details.

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
),
"error",
)
),
)

Expand Down Expand Up @@ -168,14 +164,12 @@ def test_report_single_file_single_testsuite(self):
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
),
"error",
)
),
)

MULTI_SUITE_OUTPUT = (
dedent(
"""\
MULTI_SUITE_OUTPUT = dedent(
"""\
# ABC and DEF

* 1 test passed
Expand Down Expand Up @@ -204,8 +198,6 @@ def test_report_single_file_single_testsuite(self):
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
),
"error",
)

def test_report_single_file_multiple_testsuites(self):
Expand Down Expand Up @@ -314,8 +306,7 @@ def test_report_dont_list_failures(self):
Failed tests and their output was too large to report. Download the build's log file to see the details.

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
),
"error",
)
),
)

Expand Down Expand Up @@ -351,8 +342,7 @@ def test_report_dont_list_failures_link_to_log(self):
Failed tests and their output was too large to report. Download the build's log file to see the details.

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
),
"error",
)
),
)

Expand Down Expand Up @@ -391,7 +381,6 @@ def test_report_size_limit(self):
Failed tests and their output was too large to report. Download the build's log file to see the details.

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label."""
),
"error",
)
),
)
Loading