(
pr: dict[str, Any],
github,
s3_prefix: str = "tvm-jenkins-artifacts-prod",
jenkins_prefix: str = "ci.tlcpack.ai",
pr_test_report_dir: str = "pr-reports",
main_test_report_dir: str = "main-reports",
common_commit_sha: str | None = None,
common_main_build: dict[str, Any] | None = None,
additional_tests_to_check_file: str = "required_tests_to_run.json",
)
| 163 | |
| 164 | |
| 165 | def get_skipped_tests_comment( |
| 166 | pr: dict[str, Any], |
| 167 | github, |
| 168 | s3_prefix: str = "tvm-jenkins-artifacts-prod", |
| 169 | jenkins_prefix: str = "ci.tlcpack.ai", |
| 170 | pr_test_report_dir: str = "pr-reports", |
| 171 | main_test_report_dir: str = "main-reports", |
| 172 | common_commit_sha: str | None = None, |
| 173 | common_main_build: dict[str, Any] | None = None, |
| 174 | additional_tests_to_check_file: str = "required_tests_to_run.json", |
| 175 | ) -> str: |
| 176 | pr_head = pr["commits"]["nodes"][0]["commit"] |
| 177 | target_url = find_target_url(pr_head) |
| 178 | pr_and_build = get_pr_and_build_numbers(target_url) |
| 179 | logging.info(f"Getting comment for {pr_head} with target {target_url}") |
| 180 | |
| 181 | commit_sha = pr_head["oid"] |
| 182 | |
| 183 | is_dry_run = common_commit_sha is not None |
| 184 | |
| 185 | if not is_dry_run: |
| 186 | logging.info("Fetching common commit sha and build info") |
| 187 | common_commit_sha = get_common_commit_sha() |
| 188 | common_main_build = get_main_jenkins_build_number(github, common_commit_sha) |
| 189 | |
| 190 | retrieve_test_reports( |
| 191 | common_main_build=common_main_build["build_number"], |
| 192 | pr_number=pr_and_build["pr_number"], |
| 193 | build_number=pr_and_build["build_number"], |
| 194 | s3_prefix=s3_prefix, |
| 195 | main_test_report_dir=main_test_report_dir, |
| 196 | pr_test_report_dir=pr_test_report_dir, |
| 197 | ) |
| 198 | else: |
| 199 | logging.info("Dry run, expecting PR and main reports on disk") |
| 200 | |
| 201 | main_tests = build_test_set(main_test_report_dir) |
| 202 | build_tests = build_test_set(pr_test_report_dir) |
| 203 | |
| 204 | skipped_list = [] |
| 205 | for subdir, skipped_set in build_tests.items(): |
| 206 | skipped_main = main_tests[subdir] |
| 207 | if skipped_main is None: |
| 208 | logging.warning(f"Could not find directory {subdir} in main.") |
| 209 | continue |
| 210 | |
| 211 | diff_set = skipped_set - skipped_main |
| 212 | if len(diff_set) != 0: |
| 213 | for test in diff_set: |
| 214 | skipped_list.append(f"{to_node_name(subdir)} -> {test}") |
| 215 | |
| 216 | # Sort the list to maintain an order in the output. Helps when validating the output in tests. |
| 217 | skipped_list.sort() |
| 218 | |
| 219 | if len(skipped_list) == 0: |
| 220 | logging.info("No skipped tests found.") |
| 221 | |
| 222 | if not is_dry_run: |
no test coverage detected
searching dependent graphs…