diff options
author | Nikita Kozlovskiy <nikitka@gmail.com> | 2023-08-16 14:39:21 +0300 |
---|---|---|
committer | nkozlovskiy <nmk@ydb.tech> | 2023-08-16 16:15:08 +0300 |
commit | 193c3861dc3bed68a1d0a394effdda630d0eb551 (patch) | |
tree | be90a52ef8b2b6eae122641e3c6b5d32748afca9 /.github/scripts/tests/ctest-postprocess.py | |
parent | 8662d99f68311ede697154b9fb02e3fd9e9ad52e (diff) | |
download | ydb-193c3861dc3bed68a1d0a394effdda630d0eb551.tar.gz |
CI: group tests by test shard name
CI: group tests by test shard name
Pull Request resolved: #332
Diffstat (limited to '.github/scripts/tests/ctest-postprocess.py')
-rwxr-xr-x | .github/scripts/tests/ctest-postprocess.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/.github/scripts/tests/ctest-postprocess.py b/.github/scripts/tests/ctest-postprocess.py index 10eacf6767..8d3df91f6c 100755 --- a/.github/scripts/tests/ctest-postprocess.py +++ b/.github/scripts/tests/ctest-postprocess.py @@ -1,16 +1,27 @@ #!/usr/bin/env python3 import argparse +import re from typing import TextIO import xml.etree.ElementTree as ET from log_parser import ctest_log_parser, log_reader -from mute_utils import mute_target, remove_failure, update_suite_info, MutedShardCheck +from mute_utils import mute_target, remove_failure, update_suite_info, MuteTestCheck def find_targets_to_remove(log_fp): return {target for target, reason, _ in ctest_log_parser(log_fp) if reason == "Failed"} +shard_suffix_re = re.compile(r"_\d+$") + + +def strip_shardname(testcase): + name = testcase.get('classname') + classname = shard_suffix_re.sub('', name) + + testcase.set('classname', classname) + + def postprocess_ctest(log_fp: TextIO, ctest_junit_report, is_mute_shard, dry_run): to_remove = find_targets_to_remove(log_fp) tree = ET.parse(ctest_junit_report) @@ -20,6 +31,8 @@ def postprocess_ctest(log_fp: TextIO, ctest_junit_report, is_mute_shard, dry_run for testcase in root.findall("testcase"): target = testcase.attrib["classname"] + strip_shardname(testcase) + if is_mute_shard(target): if mute_target(testcase): print(f"mute {target}") @@ -31,13 +44,12 @@ def postprocess_ctest(log_fp: TextIO, ctest_junit_report, is_mute_shard, dry_run n_remove_failures += 1 remove_failure(testcase) - if n_remove_failures: - update_suite_info(root, n_remove_failures, n_skipped=n_skipped) - print(f"{'(dry-run) ' if dry_run else ''}update {ctest_junit_report}") - if not dry_run: - tree.write(ctest_junit_report, xml_declaration=True, encoding="UTF-8") - else: - print("nothing to remove") + update_suite_info(root, n_remove_failures, n_skipped=n_skipped) + + print(f"{'(dry-run) ' if dry_run else ''}update {ctest_junit_report}") + + if not dry_run: + tree.write(ctest_junit_report, xml_declaration=True, encoding="UTF-8") def main(): @@ -50,7 +62,7 @@ def main(): args = parser.parse_args() log = log_reader(args.ctest_log, args.decompress) - is_mute_shard = MutedShardCheck(args.filter_file) + is_mute_shard = MuteTestCheck(args.filter_file) postprocess_ctest(log, args.ctest_junit_report, is_mute_shard, args.dry_run) |