Skip to content

Commit 7cab581

Browse files
fix
Created using spr 1.3.6
1 parent e6ec92c commit 7cab581

File tree

4 files changed

+7
-78
lines changed

4 files changed

+7
-78
lines changed

.ci/generate_test_report_github.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
if __name__ == "__main__":
1717
parser = argparse.ArgumentParser()
1818
parser.add_argument("return_code", help="The build's return code.", type=int)
19-
parser.add_argument(
20-
"build_test_logs", help="Paths to JUnit report files and ninja logs.", nargs="*"
21-
)
19+
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
2220
args = parser.parse_args()
2321

2422
report = generate_test_report_lib.generate_report_from_files(
25-
PLATFORM_TITLES[platform.system()], args.return_code, args.build_test_logs
23+
PLATFORM_TITLES[platform.system()], args.return_code, args.junit_files
2624
)
2725

2826
print(report)

.ci/generate_test_report_lib.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -251,19 +251,9 @@ def plural(num_tests):
251251
return report
252252

253253

254-
def generate_report_from_files(title, return_code, build_log_files):
255-
junit_files = [
256-
junit_file for junit_file in build_log_files if junit_file.endswith(".xml")
257-
]
258-
ninja_log_files = [
259-
ninja_log for ninja_log in build_log_files if ninja_log.endswith(".log")
260-
]
261-
ninja_logs = []
262-
for ninja_log_file in ninja_log_files:
263-
with open(ninja_log_file, "r") as ninja_log_file_handle:
264-
ninja_logs.append(
265-
[log_line.strip() for log_line in ninja_log_file_handle.readlines()]
266-
)
254+
def generate_report_from_files(title, return_code, junit_files):
267255
return generate_report(
268-
title, return_code, [JUnitXml.fromfile(p) for p in junit_files], ninja_logs
256+
title,
257+
return_code,
258+
[JUnitXml.fromfile(p) for p in junit_files],
269259
)

.ci/generate_test_report_lib_test.py

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import unittest
99
from io import StringIO
1010
from textwrap import dedent
11-
import tempfile
12-
import os
1311

1412
from junitparser import JUnitXml
1513

@@ -720,59 +718,3 @@ def test_report_size_limit(self):
720718
)
721719
),
722720
)
723-
724-
def test_generate_report_end_to_end(self):
725-
with tempfile.TemporaryDirectory() as temp_dir:
726-
junit_xml_file = os.path.join(temp_dir, "junit.xml")
727-
with open(junit_xml_file, "w") as junit_xml_handle:
728-
junit_xml_handle.write(
729-
dedent(
730-
"""\
731-
<?xml version="1.0" encoding="UTF-8"?>
732-
<testsuites time="0.00">
733-
<testsuite name="Passed" tests="1" failures="0" skipped="0" time="0.00">
734-
<testcase classname="Bar/test_1" name="test_1" time="0.00"/>
735-
</testsuite>
736-
</testsuites>"""
737-
)
738-
)
739-
ninja_log_file = os.path.join(temp_dir, "ninja.log")
740-
with open(ninja_log_file, "w") as ninja_log_handle:
741-
ninja_log_handle.write(
742-
dedent(
743-
"""\
744-
[1/5] test/1.stamp
745-
[2/5] test/2.stamp
746-
[3/5] test/3.stamp
747-
[4/5] test/4.stamp
748-
FAILED: test/4.stamp
749-
touch test/4.stamp
750-
Wow! That's so True!
751-
[5/5] test/5.stamp"""
752-
)
753-
)
754-
self.assertEqual(
755-
generate_test_report_lib.generate_report_from_files(
756-
"Foo", 1, [junit_xml_file, ninja_log_file]
757-
),
758-
dedent(
759-
"""\
760-
# Foo
761-
762-
* 1 test passed
763-
764-
All tests passed but another part of the build **failed**. Click on a failure below to see the details.
765-
766-
<details>
767-
<summary>test/4.stamp</summary>
768-
769-
```
770-
FAILED: test/4.stamp
771-
touch test/4.stamp
772-
Wow! That's so True!
773-
```
774-
</details>
775-
776-
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."""
777-
),
778-
)

.ci/utils.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ function at-exit {
3333

3434
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
3535
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
36-
$retcode "${BUILD_DIR}"/test-results.*.xml "${BUILD_DIR}"/ninja*.log \
37-
>> $GITHUB_STEP_SUMMARY
36+
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
3837
fi
3938
}
4039
trap at-exit EXIT

0 commit comments

Comments
 (0)