diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-07-18 14:48:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-18 14:48:45 +0300 |
commit | a1bc95abba649bfe2b5c4cdf7c7687fa3fd6d8c0 (patch) | |
tree | 300b0cad679c6829018371afcdf7a2eab41ee66c /.github | |
parent | 4e6103948ffcfc575926252093f848b9110b6cb0 (diff) | |
download | ydb-a1bc95abba649bfe2b5c4cdf7c7687fa3fd6d8c0.tar.gz |
Remove cmake tests from workflows (#6816)
Diffstat (limited to '.github')
-rw-r--r-- | .github/actions/test/action.yml | 351 | ||||
-rwxr-xr-x | .github/scripts/tests/attach-logs.py | 160 | ||||
-rwxr-xr-x | .github/scripts/tests/ctest-postprocess.py | 79 | ||||
-rw-r--r-- | .github/scripts/tests/ctest_utils.py | 87 | ||||
-rwxr-xr-x | .github/scripts/tests/pytest-postprocess.py | 75 | ||||
-rw-r--r-- | .github/workflows/build_and_test_ondemand.yml | 34 | ||||
-rw-r--r-- | .github/workflows/build_and_test_provisioned.yml | 34 | ||||
-rw-r--r-- | .github/workflows/nightly_run.yaml | 6 | ||||
-rw-r--r-- | .github/workflows/postcommit_cmakebuild.yml | 2 |
9 files changed, 2 insertions, 826 deletions
diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml deleted file mode 100644 index 54db3d5a98..0000000000 --- a/.github/actions/test/action.yml +++ /dev/null @@ -1,351 +0,0 @@ -name: build-and-test -description: Build YDB and run Tests -inputs: - log_suffix: - required: true - type: string - test_label_regexp: - required: false - type: string - aws_key_id: - required: true - type: string - aws_key_value: - required: true - type: string - testman_token: - required: false - type: string - testman_url: - required: false - type: string - testman_project_id: - required: false - type: string - aws_bucket: - required: true - type: string - aws_endpoint: - required: true - type: string - run_unit_tests: - required: true - type: string - run_functional_tests: - required: true - type: string - -runs: - using: "composite" - steps: - - name: Init - id: init - shell: bash - run: | - rm -rf artifacts tmp test_reports - mkdir -p artifacts tmp/pytest test_reports/pytest - echo "WORKDIR=$(pwd)" >> $GITHUB_ENV - echo "TESTREPDIR=$(pwd)/test_reports" >> $GITHUB_ENV - echo "TMPDIR=$(pwd)/tmp" >> $GITHUB_ENV - echo "PYTESTREPDIR=$(pwd)/test_reports/pytest/" >> $GITHUB_ENV - echo "TESTMO_URL=${{inputs.testman_url}}" >> $GITHUB_ENV - echo "ARTIFACTS_DIR=$(pwd)/artifacts" >> $GITHUB_ENV - echo "SUMMARY_LINKS=$(mktemp)" >> $GITHUB_ENV - echo "logfilename=${{inputs.log_suffix}}-ctest-stdout.gz" >> $GITHUB_OUTPUT - echo "testfilterfile=$(pwd)/.github/config/muted_test.txt" >> $GITHUB_OUTPUT - echo "testshardfilterfile=$(pwd)/.github/config/muted_shard.txt" >> $GITHUB_OUTPUT - echo "functestfilterfile=$(pwd)/.github/config/muted_functest.txt" >> $GITHUB_OUTPUT - echo "pytest-logfilename=${{inputs.log_suffix}}-pytest-stdout.log" >> $GITHUB_OUTPUT - echo "PORT_SYNC_PATH=$(mktemp -d -p $(pwd)/tmp port-sync-XXXXXX)" >> $GITHUB_ENV - - - name: configure s3cmd - shell: bash - run: | - cat <<EOF > $TMPDIR/s3cfg - [default] - access_key = ${aws_key_id} - secret_key = ${aws_secret_access_key} - bucket_location = ru-central1 - host_base = storage.yandexcloud.net - host_bucket = %(bucket)s.storage.yandexcloud.net - EOF - echo "S3CMD_CONFIG=$TMPDIR/s3cfg" >> $GITHUB_ENV - echo "S3_BUCKET_PATH=s3://${{ inputs.aws_bucket }}/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{inputs.log_suffix}}/" >> $GITHUB_ENV - echo "S3_URL_PREFIX=${{inputs.aws_endpoint}}/${{inputs.aws_bucket}}/${{ github.repository }}/${{github.workflow}}/${{github.run_id}}/${{inputs.log_suffix}}" >> $GITHUB_ENV - env: - aws_key_id: ${{inputs.AWS_KEY_ID }} - aws_secret_access_key: ${{inputs.AWS_KEY_VALUE}} - - - name: Install Node required for Testmo CLI - uses: actions/setup-node@v3 - with: - node-version: 19 - - name: Install Testmo CLI - shell: bash - run: npm install -g @testmo/testmo-cli - - name: Test history run create - id: th - if: inputs.testman_token - shell: bash - env: - PR_NUMBER: ${{ github.event.number }} - TESTMO_TOKEN: ${{ inputs.testman_token }} - run: | - RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" - BRANCH_TAG="$GITHUB_REF_NAME" - ARCH="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}" - LOG_SUFFIX="${{ inputs.log_suffix }}" - TESTMO_SOURCE="cmake-${ARCH}" - - if [ ! -z "${LOG_SUFFIX}" ]; then - TESTMO_SOURCE="${TESTMO_SOURCE}-${LOG_SUFFIX/_/-}" - fi - - case $GITHUB_EVENT_NAME in - workflow_dispatch) - TESTMO_RUN_NAME="${{ github.run_id }} manual" - EXTRA_TAG="manual" - ;; - pull_request | pull_request_target) - TESTMO_RUN_NAME="${{ github.run_id }} PR #${PR_NUMBER}" - EXTRA_TAG="pr" - BRANCH_TAG="" - ;; - schedule) - TESTMO_RUN_NAME="${{ github.run_id }} schedule" - EXTRA_TAG="schedule" - ;; - *) - TESTMO_RUN_NAME="${{ github.run_id }}" - EXTRA_TAG="" - ;; - esac - - testmo automation:resources:add-link --name build --url $RUN_URL --resources testmo.json - testmo automation:resources:add-field --name git-sha --type string --value ${GITHUB_SHA:0:7} --resources testmo.json - - RUN_ID=$( - testmo automation:run:create --instance "$TESTMO_URL" --project-id ${{inputs.testman_project_id}} \ - --name "$TESTMO_RUN_NAME" --source "$TESTMO_SOURCE" --resources testmo.json \ - --tags "$BRANCH_TAG" --tags "$EXTRA_TAG" - ) - echo "runid=${RUN_ID}" >> $GITHUB_OUTPUT - echo "TEST_HISTORY_URL=${TESTMO_URL}/automation/runs/view/${RUN_ID}" >> $GITHUB_ENV - - - name: Print test history link - shell: bash - run: | - echo "10 [Test history](${TEST_HISTORY_URL})" >> $SUMMARY_LINKS - - - name: set environment variables required by some tests - shell: bash - run: | - echo "PSQL_BINARY=/usr/bin/psql" >> $GITHUB_ENV - - - name: Run unit tests - id: ctest - if: inputs.run_unit_tests == 'true' - shell: bash - run: | - cd $WORKDIR/../build/ydb - - echo "20 [Unittest log]($S3_URL_PREFIX/${{steps.init.outputs.logfilename}})" >> $SUMMARY_LINKS - - # Sed removes coloring from the output - - GTEST_OUTPUT="xml:$TESTREPDIR/unittests/" Y_UNITTEST_OUTPUT="xml:$TESTREPDIR/unittests/" \ - ctest -j28 --timeout 1200 --force-new-ctest-process --output-on-failure \ - --output-junit $TESTREPDIR/suites/ctest_report.xml \ - -L '${{inputs.test_label_regexp}}' -E "${CTEST_SKIP_SHARDS:-}" | \ - sed -u -e 's/\x1b\[[0-9;]*m//g' | \ - tee >(gzip --stdout > $ARTIFACTS_DIR/${{steps.init.outputs.logfilename}}) | \ - grep --line-buffered -E '(Test\s*#.*\*\*\*|\[FAIL\])|.*tests passed,.*tests failed out of' | \ - tee $WORKDIR/short.log || ( - RC=$? - if [ $RC == 8 ]; then - echo "ctest returned TEST_ERRORS, recovering.." - else - exit $RC - fi - ) - - - name: archive unitest reports (orig) - if: inputs.run_unit_tests == 'true' - shell: bash - run: | - tar -C $TESTREPDIR/ -czf $ARTIFACTS_DIR/xml_orig.tar.gz . - - - name: postprocess xml reports - if: inputs.run_unit_tests == 'true' - shell: bash - run: | - echo "::group::extract-logs" - - mkdir $ARTIFACTS_DIR/logs/ - - .github/scripts/tests/attach-logs.py \ - --url-prefix $S3_URL_PREFIX/logs/ \ - --ctest-report $TESTREPDIR/suites/ctest_report.xml \ - --junit-reports-path $TESTREPDIR/unittests/ \ - --decompress \ - $ARTIFACTS_DIR/${{steps.init.outputs.logfilename}} \ - $ARTIFACTS_DIR/logs/ - - echo "::endgroup::" - - echo "::group::junit-postprocess" - - .github/scripts/tests/junit-postprocess.py \ - --filter-file ${{steps.init.outputs.testfilterfile}} \ - $TESTREPDIR/unittests/ - - echo "::endgroup::" - - echo "::group::ctest-postprocess" - - .github/scripts/tests/ctest-postprocess.py \ - --filter-file ${{steps.init.outputs.testshardfilterfile}} \ - --decompress \ - $ARTIFACTS_DIR/${{steps.init.outputs.logfilename}} \ - $TESTREPDIR/suites/ctest_report.xml - - tar -C $TESTREPDIR/ -czf $ARTIFACTS_DIR/reports.tar.gz . - - echo "90 [XML reports archive]($S3_URL_PREFIX/reports.tar.gz)" >> $SUMMARY_LINKS - - echo "::endgroup::" - - - name: sync test results to s3 - if: always() && inputs.run_unit_tests == 'true' - shell: bash - run: | - echo "::group::s3-sync" - s3cmd sync -P --no-progress --stats --no-check-md5 -P $ARTIFACTS_DIR/ $S3_BUCKET_PATH - echo "::endgroup::" - - - name: Unit test history upload results - if: always() && inputs.run_unit_tests == 'true' && inputs.testman_token - shell: bash - env: - TESTMO_TOKEN: ${{ inputs.testman_token }} - run: | - testmo automation:run:submit-thread \ - --instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} \ - --results "$TESTREPDIR/unittests/*.xml" - testmo automation:run:submit-thread \ - --exec-suppress \ - --instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} \ - --results "$TESTREPDIR/suites/*.xml" \ - -- cat $WORKDIR/short.log - - - name: Run functional tests - if: inputs.run_functional_tests == 'true' && (success() || failure()) - shell: bash - run: | - export source_root=$WORKDIR - export build_root=$WORKDIR/../build/ - - echo "30 [Functional test log]($S3_URL_PREFIX/${{steps.init.outputs.pytest-logfilename}})" >> $SUMMARY_LINKS - source $WORKDIR/ydb/tests/oss/launch/prepare.sh - - rm -rf $ARTIFACTS_DIR/pytest/ - mkdir $ARTIFACTS_DIR/pytest/ - - cd $WORKDIR/ydb/tests/functional/ - - pytest \ - -p xdist -n 24 --dist worksteal \ - --timeout_method signal \ - -o junit_logging=log -o junit_log_passing_tests=False --junit-xml=$PYTESTREPDIR/pytest.xml \ - -ra --tb=no --show-capture=no \ - --github-repo $GITHUB_REPOSITORY --github-ref $GITHUB_SHA \ - --source-root $source_root \ - --build-root $build_root \ - --output-dir $TMPDIR/pytest/ \ - . | tee $ARTIFACTS_DIR/${{steps.init.outputs.pytest-logfilename}} || { - RC=$? - if [ $RC == 1 ]; then - echo "pytest: tests were collected and run but some of the tests failed" - else - exit $RC - fi; - } - -# --artifacts-dir $ARTIFACTS_DIR/pytest/ \ -# --artifacts-url $S3_URL_PREFIX/pytest/ \ - - - name: postprocess functional test reports - if: always() && inputs.run_functional_tests == 'true' - shell: bash - run: | - echo "::group::junit-postprocess" - - # append orig pytest reports - if [ -f "$ARTIFACTS_DIR/xml_orig.tar.gz" ]; then - echo "add pytest to xml_orig.tar.gz" - gzip -d $ARTIFACTS_DIR/xml_orig.tar.gz - tar -C $TESTREPDIR/ -rvf $ARTIFACTS_DIR/xml_orig.tar pytest - gzip -v $ARTIFACTS_DIR/xml_orig.tar - fi - - .github/scripts/tests/pytest-postprocess.py \ - --filter-file ${{ steps.init.outputs.functestfilterfile }} \ - $PYTESTREPDIR/ - - # make archive again with pytest reports - tar -C $TESTREPDIR/ -czf $ARTIFACTS_DIR/reports.tar.gz . - ls -la $ARTIFACTS_DIR/reports.tar.gz - - echo "::endgroup::" - - - - name: Functional tests history upload results - if: always() && inputs.run_functional_tests == 'true' && inputs.testman_token - shell: bash - env: - TESTMO_TOKEN: ${{ inputs.testman_token }} - run: | - testmo automation:run:submit-thread \ - --instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} \ - --results "$PYTESTREPDIR/*.xml" \ - -- cat $ARTIFACTS_DIR/${{steps.init.outputs.pytest-logfilename}} - - - name: Test history run complete - if: always() && inputs.testman_token - shell: bash - env: - TESTMO_TOKEN: ${{ inputs.testman_token }} - run: | - testmo automation:run:complete --instance "$TESTMO_URL" --run-id ${{steps.th.outputs.runid}} - - - name: write tests summary - if: always() - shell: bash - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - - cat $SUMMARY_LINKS | python3 -c 'import sys; print(" | ".join([v for _, v in sorted([l.strip().split(" ", 1) for l in sys.stdin], key=lambda a: (int(a[0]), a))]))' >> $GITHUB_STEP_SUMMARY - - mkdir $ARTIFACTS_DIR/summary/ - - .github/scripts/tests/generate-summary.py \ - --summary-out-path $ARTIFACTS_DIR/summary/ \ - --summary-url-prefix $S3_URL_PREFIX/summary/ \ - --test-history-url $TEST_HISTORY_URL \ - "Unittests" unittest.html $TESTREPDIR/unittests \ - "Unittest binary runs" ctest.html $TESTREPDIR/suites \ - "Functional tests" functional.html $PYTESTREPDIR - - - name: sync test results to s3 - if: always() - shell: bash - run: | - echo "::group::s3-sync" - s3cmd sync -P --no-progress --stats --no-check-md5 -P $ARTIFACTS_DIR/ $S3_BUCKET_PATH - echo "::endgroup::" - - - name: finish - shell: bash - run: | - .github/scripts/tests/fail-checker.py $TESTREPDIR/unittests/ $TESTREPDIR/suites/ $PYTESTREPDIR/ diff --git a/.github/scripts/tests/attach-logs.py b/.github/scripts/tests/attach-logs.py deleted file mode 100755 index 55bdb64f3d..0000000000 --- a/.github/scripts/tests/attach-logs.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import io -import os -import glob -import re -from xml.etree import ElementTree as ET -from pathlib import Path -from typing import List -from log_parser import ctest_log_parser, parse_yunit_fails, parse_gtest_fails, log_reader, GTEST_MARK, YUNIT_MARK -from junit_utils import add_junit_log_property, create_error_testcase, create_error_testsuite, suite_case_iterator -from ctest_utils import CTestLog - -fn_shard_part_re = re.compile(r"-\d+$") - - -def make_filename(n, *parts): - fn = f'{"-".join(parts)}' - - fn = re.sub(r"[^\w_-]", "", fn) - - if n > 0: - fn = f"{fn}-{n}" - - return f"{fn}.log" - - -def save_log(err_lines: List[str], out_path: Path, *parts): - for x in range(128): - fn = make_filename(x, *parts) - path = out_path.joinpath(fn) - try: - with open(path, "xt") as fp: - for line in err_lines: - fp.write(f"{line}\n") - except FileExistsError: - pass - else: - print(f"save {fn} for {'::'.join(parts)}") - return fn, path - - raise Exception("Unable to create file") - - -def extract_logs(log_fp: io.StringIO, out_path: Path, url_prefix): - # FIXME: memory inefficient because new buffer created every time - - ctestlog = CTestLog() - - for target, reason, ctest_buf in ctest_log_parser(log_fp): - fn, _ = save_log(ctest_buf, out_path, target) - log_url = f"{url_prefix}{fn}" - - shard = ctestlog.add_shard(target, reason, log_url) - - if not ctest_buf: - continue - - line_no = 0 - while line_no < len(ctest_buf): - if ctest_buf[line_no].startswith((YUNIT_MARK, GTEST_MARK)): - break - line_no += 1 - else: - continue - - if ctest_buf[line_no].startswith(GTEST_MARK): - for classname, method, err_lines in parse_gtest_fails(ctest_buf[line_no:]): - fn, path = save_log(err_lines, out_path, classname, method) - log_url = f"{url_prefix}{fn}" - shard.add_testcase(classname, method, path, log_url) - elif ctest_buf[line_no].startswith(YUNIT_MARK): - for classname, method, err_lines in parse_yunit_fails(ctest_buf[line_no:]): - fn, path = save_log(err_lines, out_path, classname, method) - log_url = f"{url_prefix}{fn}" - shard.add_testcase(classname, method, path, log_url) - else: - raise Exception("We checked known test markers in the while loop") - - return ctestlog - - -def attach_to_ctest(ctest_log: CTestLog, ctest_path): - tree = ET.parse(ctest_path) - root = tree.getroot() - changed = False - for testcase in root.findall("testcase"): - name = testcase.attrib["classname"] - if ctest_log.has_error_shard(name): - add_junit_log_property(testcase, ctest_log.get_shard(name).log_url) - changed = True - - if changed: - print(f"patch {ctest_path}") - tree.write(ctest_path, xml_declaration=True, encoding="UTF-8") - - -def attach_to_unittests(ctest_log: CTestLog, unit_path): - all_found_tests = {} - - for fn in glob.glob(os.path.join(unit_path, "*.xml")): - log_name = os.path.splitext(os.path.basename(fn))[0] - common_shard_name = fn_shard_part_re.sub("", log_name) - found_tests = all_found_tests.setdefault(common_shard_name, []) - try: - tree = ET.parse(fn) - except ET.ParseError as e: - print(f"Unable to parse {fn}: {e}") - continue - - root = tree.getroot() - changed = False - - for tsuite, tcase, cls, name in suite_case_iterator(root): - test_log = ctest_log.get_log(common_shard_name, cls, name) - - if test_log is None: - continue - - found_tests.append((cls, name)) - add_junit_log_property(tcase, test_log.url) - changed = True - - if changed: - print(f"patch {fn}") - tree.write(fn, xml_declaration=True, encoding="UTF-8") - - for shard, found_tests in all_found_tests.items(): - extra_logs = ctest_log.get_extra_tests(shard, found_tests) - if not extra_logs: - continue - - fn = f"{shard}-0000.xml" - print(f"create {fn}") - testcases = [create_error_testcase(t.shard.name, t.classname, t.method, t.fn, t.url) for t in extra_logs] - - testsuite = create_error_testsuite(testcases) - testsuite.write(os.path.join(unit_path, fn), xml_declaration=True, encoding="UTF-8") - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("--url-prefix", default="./") - parser.add_argument("--decompress", action="store_true", default=False, help="decompress ctest log") - parser.add_argument("--ctest-report") - parser.add_argument("--junit-reports-path") - parser.add_argument("ctest_log") - parser.add_argument("out_log_dir") - - args = parser.parse_args() - - ctest_log = extract_logs(log_reader(args.ctest_log, args.decompress), Path(args.out_log_dir), args.url_prefix) - - if ctest_log.has_logs: - attach_to_ctest(ctest_log, args.ctest_report) - attach_to_unittests(ctest_log, args.junit_reports_path) - - -if __name__ == "__main__": - main() diff --git a/.github/scripts/tests/ctest-postprocess.py b/.github/scripts/tests/ctest-postprocess.py deleted file mode 100755 index dafda4d9ba..0000000000 --- a/.github/scripts/tests/ctest-postprocess.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/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, GTEST_MARK, YUNIT_MARK -from mute_utils import mute_target, remove_failure, update_suite_info, MuteTestCheck - - -def find_targets_to_remove(log_fp): - target_with_tests = set() - for target, reason, buf in ctest_log_parser(log_fp): - if reason != "Failed": - continue - - for line in buf: - if line.startswith((GTEST_MARK, YUNIT_MARK)): - target_with_tests.add(target) - break - return target_with_tests - - -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) - root = tree.getroot() - n_remove_failures = n_skipped = 0 - - 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}") - testcase.set("status", "run") # CTEST specific - n_remove_failures += 1 - n_skipped += 1 - elif target in to_remove: - print(f"set {target} as passed") - n_remove_failures += 1 - remove_failure(testcase) - - 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(): - parser = argparse.ArgumentParser() - parser.add_argument("--dry-run", action="store_true", default=False) - parser.add_argument("--filter-file", required=False) - parser.add_argument("--decompress", action="store_true", default=False, help="decompress ctest log") - parser.add_argument("ctest_log", type=str) - parser.add_argument("ctest_junit_report") - args = parser.parse_args() - - log = log_reader(args.ctest_log, args.decompress) - is_mute_shard = MuteTestCheck(args.filter_file) - postprocess_ctest(log, args.ctest_junit_report, is_mute_shard, args.dry_run) - - -if __name__ == "__main__": - main() diff --git a/.github/scripts/tests/ctest_utils.py b/.github/scripts/tests/ctest_utils.py deleted file mode 100644 index c2f20eb9be..0000000000 --- a/.github/scripts/tests/ctest_utils.py +++ /dev/null @@ -1,87 +0,0 @@ -import dataclasses -import re -from collections import defaultdict -from typing import List, Dict, Tuple, Set - - -shard_partition_re = re.compile(r"_\d+$") - - -def get_common_shard_name(name): - return shard_partition_re.sub("", name) - - -@dataclasses.dataclass -class CTestTestcaseLog: - classname: str - method: str - fn: str - url: str - shard: "CTestLogShard" - - -class CTestLogShard: - def __init__(self, name, status, log_url): - self.name = name - self.status = status - self.log_url = log_url - self.testcases: List[CTestTestcaseLog] = [] - self.idx: Dict[Tuple[str, str], CTestTestcaseLog] = {} - - def add_testcase(self, classname, method, fn, url): - log = CTestTestcaseLog(classname, method, fn, url, self) - self.testcases.append(log) - self.idx[(classname, method)] = log - - def get_log(self, classname, method): - return self.idx.get((classname, method)) - - def get_extra_logs(self, found_testcases: Set[Tuple[str, str]]): - extra_keys = set(self.idx.keys()) - found_testcases - return [self.idx[k] for k in extra_keys] - - @property - def logs(self): - return self.idx.values() - - @property - def filename(self): - return f"{self.name}.xml" - - -class CTestLog: - def __init__(self): - self.name_shard = {} # type: Dict[str, CTestLogShard] - self.storage = defaultdict(dict) - - def add_shard(self, name, status, log_url): - common_name = get_common_shard_name(name) - shard = self.storage[common_name][name] = self.name_shard[name] = CTestLogShard(name, status, log_url) - return shard - - def has_error_shard(self, name): - return name in self.name_shard - - def get_shard(self, name): - return self.name_shard[name] - - def get_log(self, common_name, cls, name): - for shard in self.storage[common_name].values(): - log = shard.get_log(cls, name) - - if log: - return log - - return None - - def get_extra_tests(self, common_name, names): - result = [] - for shard in self.storage[common_name].values(): - extra = shard.get_extra_logs(set(names)) - if extra: - result.extend(extra) - return result - - @property - def has_logs(self): - return len(self.name_shard) > 0 diff --git a/.github/scripts/tests/pytest-postprocess.py b/.github/scripts/tests/pytest-postprocess.py deleted file mode 100755 index 9c0873691f..0000000000 --- a/.github/scripts/tests/pytest-postprocess.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import glob -import os -import xml.etree.ElementTree as ET -from mute_utils import MuteTestCheck, mute_target, recalc_suite_info -from junit_utils import get_property_value - - -def update_testname(testcase): - filename = get_property_value(testcase, "filename") - - clsname = testcase.get("classname") - tstname = testcase.get("name") - - if filename is None: - return f"{clsname}::{tstname}" - - filename = filename.split("/") - test_fn = filename[-1] - folder = "/".join(filename[:-1]) - - testcase.set("classname", folder) - - clsname = clsname.split(".")[-1] - - test_name = f"{test_fn}::{clsname}::{tstname}" - - testcase.set("name", test_name) - testcase.set("id", f"{folder}_{test_fn}_{clsname}_{tstname}") - - return f"{folder}/{test_name}" - - -def postprocess_pytest(fn, mute_check, dry_run): - tree = ET.parse(fn) - root = tree.getroot() - - for testsuite in root.findall("testsuite"): - need_recalc = False - for testcase in testsuite.findall("testcase"): - new_name = update_testname(testcase) - if mute_check(new_name) and mute_target(testcase): - print(f"mute {new_name}") - need_recalc = True - - if need_recalc: - recalc_suite_info(testsuite) - - print(f"{'(dry-run) ' if dry_run else ''}save {fn}") - - if not dry_run: - tree.write(fn, xml_declaration=True, encoding="UTF-8") - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("--filter-file", required=True) - parser.add_argument("--dry-run", action="store_true", default=False) - parser.add_argument("pytest_xml_path") - - args = parser.parse_args() - - if not os.path.isdir(args.pytest_xml_path): - print(f"{args.pytest_xml_path} is not a directory, exit") - raise SystemExit(-1) - - mute_check = MuteTestCheck(args.filter_file) - - for fn in glob.glob(os.path.join(args.pytest_xml_path, "*.xml")): - postprocess_pytest(fn, mute_check, args.dry_run) - - -if __name__ == "__main__": - main() diff --git a/.github/workflows/build_and_test_ondemand.yml b/.github/workflows/build_and_test_ondemand.yml index 6b4320e499..1176de15ee 100644 --- a/.github/workflows/build_and_test_ondemand.yml +++ b/.github/workflows/build_and_test_ondemand.yml @@ -1,4 +1,4 @@ -name: Build-and-Test-On-demand +name: Build-and-Test-On-demand # actually tests are not executed on: workflow_call: @@ -6,9 +6,6 @@ on: sanitizer: required: false type: string - test_label_regexp: - required: false - type: string image: type: string required: false @@ -16,20 +13,11 @@ on: extra_compile_flags: required: false type: string - run_unit_tests: - type: boolean - default: true - run_functional_tests: - type: boolean - default: true workflow_dispatch: inputs: sanitizer: required: false type: string - test_label_regexp: - required: false - type: string image: type: string required: false @@ -37,12 +25,6 @@ on: extra_compile_flags: required: false type: string - run_unit_tests: - type: boolean - default: true - run_functional_tests: - type: boolean - default: true jobs: @@ -109,20 +91,6 @@ jobs: sanitizer: ${{ inputs.sanitizer }} ccache_remote_path: ${{ vars.REMOTE_CACHE_URL && format('http://{0}{1}', secrets.REMOTE_CACHE_AUTH, vars.REMOTE_CACHE_URL) || ''}} extra_compile_flags: ${{ inputs.extra_compile_flags }} - - name: Run tests - uses: ./.github/actions/test - with: - log_suffix: ${{ inputs.sanitizer != '' && format('{0}-{1}', 'x86_64', inputs.sanitizer) || 'x86_64' }} - test_label_regexp: ${{ inputs.test_label_regexp }} - aws_key_id: ${{secrets.AWS_KEY_ID}} - aws_key_value: ${{secrets.AWS_KEY_VALUE}} - aws_bucket: ${{vars.AWS_BUCKET}} - aws_endpoint: ${{vars.AWS_ENDPOINT}} - testman_token: ${{secrets.TESTMO_TOKEN2}} - testman_url: ${{vars.TESTMO_URL}} - testman_project_id: ${{vars.TESTMO_PROJECT_ID}} - run_unit_tests: ${{inputs.run_unit_tests}} - run_functional_tests: ${{inputs.run_functional_tests}} release-runner: name: Release self-hosted YC runner if provided on-demand needs: diff --git a/.github/workflows/build_and_test_provisioned.yml b/.github/workflows/build_and_test_provisioned.yml index 5feaaded79..9a9b7a8c9b 100644 --- a/.github/workflows/build_and_test_provisioned.yml +++ b/.github/workflows/build_and_test_provisioned.yml @@ -1,4 +1,4 @@ -name: Build-and-Test-Provisioned +name: Build-and-Test-Provisioned # actually tests are not executed on: workflow_call: @@ -12,15 +12,6 @@ on: sanitizer: required: false type: string - run_unit_tests: - type: boolean - default: true - run_functional_tests: - type: boolean - default: true - test_label_regexp: - required: false - type: string extra_compile_flags: required: false type: string @@ -41,15 +32,6 @@ on: sanitizer: required: false type: string - run_unit_tests: - type: boolean - default: true - run_functional_tests: - type: boolean - default: true - test_label_regexp: - required: false - type: string extra_compile_flags: required: false type: string @@ -77,18 +59,4 @@ jobs: ccache_remote_path: ${{ vars.REMOTE_CACHE_URL && format('http://{0}{1}', secrets.REMOTE_CACHE_AUTH, vars.REMOTE_CACHE_URL) || ''}} extra_compile_flags: ${{ inputs.extra_compile_flags }} ninja_target: ${{ inputs.ninja_target }} - - name: Run tests - uses: ./.github/actions/test - with: - log_suffix: ${{ inputs.sanitizer != '' && format('{0}-{1}', inputs.runner_label, inputs.sanitizer) || inputs.runner_label }} - test_label_regexp: ${{ inputs.test_label_regexp }} - aws_key_id: ${{secrets.AWS_KEY_ID}} - aws_key_value: ${{secrets.AWS_KEY_VALUE}} - aws_bucket: ${{vars.AWS_BUCKET}} - aws_endpoint: ${{vars.AWS_ENDPOINT}} - testman_token: ${{secrets.TESTMO_TOKEN2}} - testman_url: ${{vars.TESTMO_URL}} - testman_project_id: ${{vars.TESTMO_PROJECT_ID}} - run_unit_tests: ${{inputs.run_unit_tests}} - run_functional_tests: ${{inputs.run_functional_tests}} diff --git a/.github/workflows/nightly_run.yaml b/.github/workflows/nightly_run.yaml index 819007be66..8ea43fa71d 100644 --- a/.github/workflows/nightly_run.yaml +++ b/.github/workflows/nightly_run.yaml @@ -3,10 +3,6 @@ on: schedule: - cron: "0 1 * * *" # At 01:00 every day workflow_dispatch: - inputs: - test_label_regexp: - required: false - type: string jobs: cmake_x86_64: @@ -19,7 +15,6 @@ jobs: with: runner_label: auto-provisioned sanitizer: ${{matrix.sanitizer}} - test_label_regexp: ${{inputs.test_label_regexp}} secrets: inherit cmake_arm64: @@ -32,7 +27,6 @@ jobs: runner_label: ARM64 sanitizer: ${{matrix.sanitizer}} extra_compile_flags: "-DMKQL_DISABLE_CODEGEN" - test_label_regexp: ${{inputs.test_label_regexp}} secrets: inherit ya_x86_64: diff --git a/.github/workflows/postcommit_cmakebuild.yml b/.github/workflows/postcommit_cmakebuild.yml index e741cff1be..49ca654918 100644 --- a/.github/workflows/postcommit_cmakebuild.yml +++ b/.github/workflows/postcommit_cmakebuild.yml @@ -12,7 +12,5 @@ jobs: uses: ./.github/workflows/build_and_test_provisioned.yml with: runner_label: auto-provisioned, postcommit - run_unit_tests: false - run_functional_tests: false secrets: inherit |