diff options
author | Dmitry Kopylov <kopylovd@gmail.com> | 2022-02-10 16:48:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:18 +0300 |
commit | 7230275728d34873cba1ba78bb68669b0c5faa31 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /build | |
parent | b2f5101486cc0de2e979c8ba9ada2109785bf5fd (diff) | |
download | ydb-7230275728d34873cba1ba78bb68669b0c5faa31.tar.gz |
Restoring authorship annotation for Dmitry Kopylov <kopylovd@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'build')
33 files changed, 620 insertions, 620 deletions
diff --git a/build/plugins/_test_const.py b/build/plugins/_test_const.py index af591ccc08..0d03cc3d17 100644 --- a/build/plugins/_test_const.py +++ b/build/plugins/_test_const.py @@ -1,7 +1,7 @@ # coding: utf-8 import re import sys - + RESTART_TEST_INDICATOR = '##restart-test##' INFRASTRUCTURE_ERROR_INDICATOR = '##infrastructure-error##' @@ -120,16 +120,16 @@ class TestRequirementsConstants(Enum): class TestSize(Enum): - Small = 'small' - Medium = 'medium' - Large = 'large' - + Small = 'small' + Medium = 'medium' + Large = 'large' + DefaultTimeouts = { - Small: 60, - Medium: 600, - Large: 3600, - } - + Small: 60, + Medium: 600, + Large: 3600, + } + DefaultPriorities = { Small: -1, Medium: -2, @@ -178,22 +178,22 @@ class TestSize(Enum): }, } - @classmethod - def sizes(cls): + @classmethod + def sizes(cls): return cls.DefaultTimeouts.keys() - - @classmethod - def get_default_timeout(cls, size): + + @classmethod + def get_default_timeout(cls, size): if size in cls.DefaultTimeouts: return cls.DefaultTimeouts[size] - raise Exception("Unknown test size '{}'".format(size)) - + raise Exception("Unknown test size '{}'".format(size)) + @classmethod def get_default_priorities(cls, size): if size in cls.DefaultPriorities: return cls.DefaultPriorities[size] raise Exception("Unknown test size '{}'".format(size)) - + @classmethod def get_default_requirements(cls, size): if size in cls.DefaultRequirements: @@ -208,25 +208,25 @@ class TestSize(Enum): class TestRunExitCode(Enum): - Skipped = 2 + Skipped = 2 Failed = 3 - TimeOut = 10 + TimeOut = 10 InfrastructureError = 12 - - + + class YaTestTags(Enum): - Manual = "ya:manual" - Notags = "ya:notags" - Norestart = "ya:norestart" - Dirty = "ya:dirty" - Noretries = "ya:noretries" - Fat = "ya:fat" - RunWithAsserts = "ya:relwithdebinfo" - Privileged = "ya:privileged" + Manual = "ya:manual" + Notags = "ya:notags" + Norestart = "ya:norestart" + Dirty = "ya:dirty" + Noretries = "ya:noretries" + Fat = "ya:fat" + RunWithAsserts = "ya:relwithdebinfo" + Privileged = "ya:privileged" ExoticPlatform = "ya:exotic_platform" NotAutocheck = "ya:not_autocheck" - - + + class Status(object): GOOD, XFAIL, FAIL, XPASS, MISSING, CRASHED, TIMEOUT = range(1, 8) SKIPPED = -100 diff --git a/build/plugins/gobuild.py b/build/plugins/gobuild.py index 06d9ce4acb..8df96ebc55 100644 --- a/build/plugins/gobuild.py +++ b/build/plugins/gobuild.py @@ -172,7 +172,7 @@ def on_go_process_srcs(unit): basedirs[basedir].append(f) for basedir in basedirs: unit.onadd_check(['gofmt'] + basedirs[basedir]) - + # Go coverage instrumentation (NOTE! go_files list is modified here) if is_test_module and unit.enabled('GO_TEST_COVER'): cover_info = [] diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py index 51babe298e..f32a2d39a0 100644 --- a/build/plugins/pybuild.py +++ b/build/plugins/pybuild.py @@ -110,13 +110,13 @@ def has_pyx(args): def get_srcdir(path, unit): return rootrel_arc_src(path, unit)[:-len(path)].rstrip('/') -def add_python_lint_checks(unit, py_ver, files): +def add_python_lint_checks(unit, py_ver, files): def get_resolved_files(): - resolved_files = [] - for path in files: - resolved = unit.resolve_arc_path([path]) + resolved_files = [] + for path in files: + resolved = unit.resolve_arc_path([path]) if resolved.startswith('$S'): # path was resolved as source file. - resolved_files.append(resolved) + resolved_files.append(resolved) return resolved_files if unit.get('LINT_LEVEL_VALUE') == "none": @@ -141,7 +141,7 @@ def add_python_lint_checks(unit, py_ver, files): resolved_files = get_resolved_files() flake8_cfg = 'build/config/tests/flake8/flake8.conf' unit.onadd_check(["flake8.py{}".format(py_ver), flake8_cfg] + resolved_files) - + def is_py3(unit): return unit.get("PYTHON3") == "yes" @@ -532,7 +532,7 @@ def _check_test_srcs(*args): def ontest_srcs(unit, *args): _check_test_srcs(*args) if unit.get('PY3TEST_BIN' if is_py3(unit) else 'PYTEST_BIN') != 'no': - unit.onpy_srcs(["NAMESPACE", "__tests__"] + list(args)) + unit.onpy_srcs(["NAMESPACE", "__tests__"] + list(args)) def onpy_doctests(unit, *args): diff --git a/build/plugins/res.py b/build/plugins/res.py index 25fba06383..a937caba81 100644 --- a/build/plugins/res.py +++ b/build/plugins/res.py @@ -48,8 +48,8 @@ def onfat_resource(unit, *args): unit.onrun_program(['tools/rescompiler', output] + part_args + inputs + ['OUT_NOAUTO', output]) unit.onsrcs(['GLOBAL', output]) - - + + def onresource_files(unit, *args): """ @usage: RESOURCE_FILES([DONT_PARSE] [PREFIX {prefix}] [STRIP prefix_to_strip] {path}) diff --git a/build/plugins/ya.make b/build/plugins/ya.make index 1a7623643e..4ad5f5988e 100644 --- a/build/plugins/ya.make +++ b/build/plugins/ya.make @@ -5,15 +5,15 @@ PY2_LIBRARY() PY_SRCS( code_generator.py ssqls.py - swig.py + swig.py - _common.py + _common.py _custom_command.py _import_wrapper.py _requirements.py _test_const.py -) - +) + PEERDIR(build/plugins/lib) END() diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py index 610a69e41e..8970837f0f 100644 --- a/build/plugins/ytest.py +++ b/build/plugins/ytest.py @@ -1,21 +1,21 @@ -import os -import re -import sys +import os +import re +import sys import json import copy import base64 import shlex -import _common +import _common import lib._metric_resolvers as mr import _test_const as consts import _requirements as reqs import StringIO import subprocess -import collections +import collections + +import ymake -import ymake - MDS_URI_PREFIX = 'https://storage.yandex-team.ru/get-devtools/' MDS_SHEME = 'mds' CANON_DATA_DIR_NAME = 'canondata' @@ -26,7 +26,7 @@ CANON_SB_VAULT_REGEX = re.compile(r"\w+=(value|file):[-\w]+:\w+") CANON_SBR_RESOURCE_REGEX = re.compile(r'(sbr:/?/?(\d+))') VALID_NETWORK_REQUIREMENTS = ("full", "restricted") -VALID_DNS_REQUIREMENTS = ("default", "local", "dns64") +VALID_DNS_REQUIREMENTS = ("default", "local", "dns64") BLOCK_SEPARATOR = '=============================================================' SPLIT_FACTOR_MAX_VALUE = 1000 SPLIT_FACTOR_TEST_FILES_MAX_VALUE = 4250 @@ -122,27 +122,27 @@ def validate_requirement(req_name, value, test_size, is_force_sandbox, in_autoch def validate_test(unit, kw): - def get_list(key): - return deserialize_list(kw.get(key, "")) - + def get_list(key): + return deserialize_list(kw.get(key, "")) + valid_kw = copy.deepcopy(kw) - errors = [] + errors = [] warnings = [] - + if valid_kw.get('SCRIPT-REL-PATH') == 'boost.test': project_path = valid_kw.get('BUILD-FOLDER-PATH', "") if not project_path.startswith(("contrib", "mail", "maps", "tools/idl", "metrika", "devtools", "mds", "yandex_io", "smart_devices")): - errors.append("BOOSTTEST is not allowed here") + errors.append("BOOSTTEST is not allowed here") elif valid_kw.get('SCRIPT-REL-PATH') == 'gtest': project_path = valid_kw.get('BUILD-FOLDER-PATH', "") if not project_path.startswith(("contrib", "devtools", "mail", "mds", "taxi")): errors.append("GTEST_UGLY is not allowed here, use GTEST instead") - + size_timeout = collections.OrderedDict(sorted(consts.TestSize.DefaultTimeouts.items(), key=lambda t: t[1])) - + size = valid_kw.get('SIZE', consts.TestSize.Small).lower() # TODO: use set instead list - tags = get_list("TAG") + tags = get_list("TAG") requirements_orig = get_list("REQUIREMENTS") in_autocheck = "ya:not_autocheck" not in tags and 'ya:manual' not in tags is_fat = 'ya:fat' in tags @@ -150,15 +150,15 @@ def validate_test(unit, kw): is_ytexec_run = 'ya:yt' in tags is_fuzzing = valid_kw.get("FUZZING", False) is_kvm = 'kvm' in requirements_orig - requirements = {} + requirements = {} list_requirements = ('sb_vault') for req in requirements_orig: if req in ('kvm', ): requirements[req] = str(True) continue - if ":" in req: - req_name, req_value = req.split(":", 1) + if ":" in req: + req_name, req_value = req.split(":", 1) if req_name in list_requirements: requirements[req_name] = ",".join(filter(None, [requirements.get(req_name), req_value])) else: @@ -171,9 +171,9 @@ def validate_test(unit, kw): requirements[req_name] = req_value else: requirements[req_name] = req_value - else: - errors.append("Invalid requirement syntax [[imp]]{}[[rst]]: expect <requirement>:<value>".format(req)) - + else: + errors.append("Invalid requirement syntax [[imp]]{}[[rst]]: expect <requirement>:<value>".format(req)) + if not errors: for req_name, req_value in requirements.items(): error_msg = validate_requirement(req_name, req_value, size, is_force_sandbox, in_autocheck, is_fuzzing, is_kvm, is_ytexec_run) @@ -207,29 +207,29 @@ def validate_test(unit, kw): if 'ya:privileged' in tags and 'container' not in requirements: errors.append("Only tests with 'container' requirement can have 'ya:privileged' tag") - if size not in size_timeout: + if size not in size_timeout: errors.append("Unknown test size: [[imp]]{}[[rst]], choose from [[imp]]{}[[rst]]".format(size.upper(), ", ".join([sz.upper() for sz in size_timeout.keys()]))) - else: - try: + else: + try: timeout = int(valid_kw.get('TEST-TIMEOUT', size_timeout[size]) or size_timeout[size]) script_rel_path = valid_kw.get('SCRIPT-REL-PATH') - if timeout < 0: - raise Exception("Timeout must be > 0") + if timeout < 0: + raise Exception("Timeout must be > 0") if size_timeout[size] < timeout and in_autocheck and script_rel_path != 'java.style': - suggested_size = None - for s, t in size_timeout.items(): - if timeout <= t: - suggested_size = s - break - - if suggested_size: + suggested_size = None + for s, t in size_timeout.items(): + if timeout <= t: + suggested_size = s + break + + if suggested_size: suggested_size = ", suggested size: [[imp]]{}[[rst]]".format(suggested_size.upper()) - else: - suggested_size = "" + else: + suggested_size = "" errors.append("Max allowed timeout for test size [[imp]]{}[[rst]] is [[imp]]{} sec[[rst]]{}".format(size.upper(), size_timeout[size], suggested_size)) - except Exception as e: - errors.append("Error when parsing test timeout: [[bad]]{}[[rst]]".format(e)) - + except Exception as e: + errors.append("Error when parsing test timeout: [[bad]]{}[[rst]]".format(e)) + requiremtens_list = [] for req_name, req_value in requirements.iteritems(): requiremtens_list.append(req_name + ":" + req_value) @@ -265,46 +265,46 @@ def validate_test(unit, kw): tags.append("ya:yt_research_pool") if valid_kw.get("USE_ARCADIA_PYTHON") == "yes" and valid_kw.get("SCRIPT-REL-PATH") == "py.test": - errors.append("PYTEST_SCRIPT is deprecated") - + errors.append("PYTEST_SCRIPT is deprecated") + partition = valid_kw.get('TEST_PARTITION', 'SEQUENTIAL') if partition not in PARTITION_MODS: raise ValueError('partition mode should be one of {}, detected: {}'.format(PARTITION_MODS, partition)) if valid_kw.get('SPLIT-FACTOR'): if valid_kw.get('FORK-MODE') == 'none': - errors.append('SPLIT_FACTOR must be use with FORK_TESTS() or FORK_SUBTESTS() macro') + errors.append('SPLIT_FACTOR must be use with FORK_TESTS() or FORK_SUBTESTS() macro') value = 1 - try: + try: value = int(valid_kw.get('SPLIT-FACTOR')) - if value <= 0: - raise ValueError("must be > 0") + if value <= 0: + raise ValueError("must be > 0") if value > SPLIT_FACTOR_MAX_VALUE: raise ValueError("the maximum allowed value is {}".format(SPLIT_FACTOR_MAX_VALUE)) - except ValueError as e: - errors.append('Incorrect SPLIT_FACTOR value: {}'.format(e)) - + except ValueError as e: + errors.append('Incorrect SPLIT_FACTOR value: {}'.format(e)) + if valid_kw.get('FORK-TEST-FILES') and size != consts.TestSize.Large: nfiles = count_entries(valid_kw.get('TEST-FILES')) if nfiles * value > SPLIT_FACTOR_TEST_FILES_MAX_VALUE: errors.append('Too much chunks generated:{} (limit: {}). Remove FORK_TEST_FILES() macro or reduce SPLIT_FACTOR({}).'.format( nfiles * value, SPLIT_FACTOR_TEST_FILES_MAX_VALUE, value)) - unit_path = get_norm_unit_path(unit) + unit_path = get_norm_unit_path(unit) if not is_fat and "ya:noretries" in tags and not is_ytexec_run \ - and not unit_path.startswith("devtools/") \ - and not unit_path.startswith("infra/kernel/") \ - and not unit_path.startswith("yt/python/yt") \ - and not unit_path.startswith("infra/yp_dns_api/tests") \ - and not unit_path.startswith("yp/tests"): - errors.append("Only LARGE tests can have 'ya:noretries' tag") - + and not unit_path.startswith("devtools/") \ + and not unit_path.startswith("infra/kernel/") \ + and not unit_path.startswith("yt/python/yt") \ + and not unit_path.startswith("infra/yp_dns_api/tests") \ + and not unit_path.startswith("yp/tests"): + errors.append("Only LARGE tests can have 'ya:noretries' tag") + if errors: return None, warnings, errors - + return valid_kw, warnings, errors - + def get_norm_unit_path(unit, extra=None): path = _common.strip_roots(unit.path()) @@ -320,25 +320,25 @@ def dump_test(unit, kw): for e in errors: ymake.report_configure_error(e) if valid_kw is None: - return None + return None string_handler = StringIO.StringIO() for k, v in valid_kw.iteritems(): print >>string_handler, k + ': ' + v - print >>string_handler, BLOCK_SEPARATOR + print >>string_handler, BLOCK_SEPARATOR data = string_handler.getvalue() string_handler.close() return data -def serialize_list(lst): - lst = filter(None, lst) - return '\"' + ';'.join(lst) + '\"' if lst else '' - - -def deserialize_list(val): - return filter(None, val.replace('"', "").split(";")) - - +def serialize_list(lst): + lst = filter(None, lst) + return '\"' + ';'.join(lst) + '\"' if lst else '' + + +def deserialize_list(val): + return filter(None, val.replace('"', "").split(";")) + + def count_entries(x): # see (de)serialize_list assert x is None or isinstance(x, str), type(x) @@ -347,11 +347,11 @@ def count_entries(x): return x.count(";") + 1 -def get_values_list(unit, key): +def get_values_list(unit, key): res = map(str.strip, (unit.get(key) or '').replace('$' + key, '').strip().split()) - return [r for r in res if r and r not in ['""', "''"]] - - + return [r for r in res if r and r not in ['""', "''"]] + + def get_norm_paths(unit, key): # return paths without trailing (back)slash return [x.rstrip('\\/') for x in get_values_list(unit, key)] @@ -413,18 +413,18 @@ def get_project_tidy_config(unit): return get_default_tidy_config(unit) -def onadd_ytest(unit, *args): +def onadd_ytest(unit, *args): keywords = {"DEPENDS": -1, "DATA": -1, "TIMEOUT": 1, "FORK_MODE": 1, "SPLIT_FACTOR": 1, "FORK_SUBTESTS": 0, "FORK_TESTS": 0} flat_args, spec_args = _common.sort_by_keywords(keywords, args) - - test_data = sorted(_common.filter_out_by_keyword(spec_args.get('DATA', []) + get_norm_paths(unit, 'TEST_DATA_VALUE'), 'AUTOUPDATED')) - + + test_data = sorted(_common.filter_out_by_keyword(spec_args.get('DATA', []) + get_norm_paths(unit, 'TEST_DATA_VALUE'), 'AUTOUPDATED')) + if flat_args[1] == "fuzz.test": unit.ondata("arcadia/fuzzing/{}/corpus.json".format(get_norm_unit_path(unit))) - elif flat_args[1] == "go.test": - data, _ = get_canonical_test_resources(unit) - test_data += data + elif flat_args[1] == "go.test": + data, _ = get_canonical_test_resources(unit) + test_data += data elif flat_args[1] == "coverage.extractor" and not match_coverage_extractor_requirements(unit): # XXX # Current ymake implementation doesn't allow to call macro inside the 'when' body @@ -473,39 +473,39 @@ def onadd_ytest(unit, *args): unit_path = get_norm_unit_path(unit) - test_record = { - 'TEST-NAME': flat_args[0], - 'SCRIPT-REL-PATH': flat_args[1], - 'TESTED-PROJECT-NAME': unit.name(), - 'TESTED-PROJECT-FILENAME': unit.filename(), + test_record = { + 'TEST-NAME': flat_args[0], + 'SCRIPT-REL-PATH': flat_args[1], + 'TESTED-PROJECT-NAME': unit.name(), + 'TESTED-PROJECT-FILENAME': unit.filename(), 'SOURCE-FOLDER-PATH': unit_path, # TODO get rid of BUILD-FOLDER-PATH 'BUILD-FOLDER-PATH': unit_path, 'BINARY-PATH': "{}/{}".format(unit_path, unit.filename()), 'GLOBAL-LIBRARY-PATH': unit.global_filename(), - 'CUSTOM-DEPENDENCIES': ' '.join(spec_args.get('DEPENDS', []) + get_values_list(unit, 'TEST_DEPENDS_VALUE')), + 'CUSTOM-DEPENDENCIES': ' '.join(spec_args.get('DEPENDS', []) + get_values_list(unit, 'TEST_DEPENDS_VALUE')), 'TEST-RECIPES': prepare_recipes(unit.get("TEST_RECIPES_VALUE")), 'TEST-ENV': prepare_env(unit.get("TEST_ENV_VALUE")), # 'TEST-PRESERVE-ENV': 'da', - 'TEST-DATA': serialize_list(test_data), + 'TEST-DATA': serialize_list(test_data), 'TEST-TIMEOUT': test_timeout, - 'FORK-MODE': fork_mode, - 'SPLIT-FACTOR': ''.join(spec_args.get('SPLIT_FACTOR', [])) or unit.get('TEST_SPLIT_FACTOR') or '', + 'FORK-MODE': fork_mode, + 'SPLIT-FACTOR': ''.join(spec_args.get('SPLIT_FACTOR', [])) or unit.get('TEST_SPLIT_FACTOR') or '', 'SIZE': test_size, 'TAG': test_tags, 'REQUIREMENTS': serialize_list(test_requirements), - 'TEST-CWD': unit.get('TEST_CWD_VALUE') or '', + 'TEST-CWD': unit.get('TEST_CWD_VALUE') or '', 'FUZZ-DICTS': serialize_list(spec_args.get('FUZZ_DICTS', []) + get_unit_list_variable(unit, 'FUZZ_DICTS_VALUE')), 'FUZZ-OPTS': serialize_list(spec_args.get('FUZZ_OPTS', []) + get_unit_list_variable(unit, 'FUZZ_OPTS_VALUE')), 'YT-SPEC': serialize_list(spec_args.get('YT_SPEC', []) + get_unit_list_variable(unit, 'TEST_YT_SPEC_VALUE')), - 'BLOB': unit.get('TEST_BLOB_DATA') or '', - 'SKIP_TEST': unit.get('SKIP_TEST_VALUE') or '', + 'BLOB': unit.get('TEST_BLOB_DATA') or '', + 'SKIP_TEST': unit.get('SKIP_TEST_VALUE') or '', 'TEST_IOS_DEVICE_TYPE': unit.get('TEST_IOS_DEVICE_TYPE_VALUE') or '', 'TEST_IOS_RUNTIME_TYPE': unit.get('TEST_IOS_RUNTIME_TYPE_VALUE') or '', 'ANDROID_APK_TEST_ACTIVITY': unit.get('ANDROID_APK_TEST_ACTIVITY_VALUE') or '', 'TEST_PARTITION': unit.get("TEST_PARTITION") or 'SEQUENTIAL', 'GO_BENCH_TIMEOUT': unit.get('GO_BENCH_TIMEOUT') or '', - } + } if flat_args[1] == "go.bench": if "ya:run_go_benchmark" not in test_record["TAG"]: @@ -519,9 +519,9 @@ def onadd_ytest(unit, *args): test_record['REQUIREMENTS'] = serialize_list(filter(None, deserialize_list(test_record['REQUIREMENTS']) + ["cpu:all", "ram:all"])) data = dump_test(unit, test_record) - if data: - unit.set_property(["DART_DATA", data]) - save_in_file(unit.get('TEST_DART_OUT_FILE'), data) + if data: + unit.set_property(["DART_DATA", data]) + save_in_file(unit.get('TEST_DART_OUT_FILE'), data) def java_srcdirs_to_data(unit, var): @@ -543,15 +543,15 @@ def java_srcdirs_to_data(unit, var): return serialize_list(extra_data) -def onadd_check(unit, *args): +def onadd_check(unit, *args): if unit.get("TIDY") == "yes": # graph changed for clang_tidy tests return flat_args, spec_args = _common.sort_by_keywords({"DEPENDS": -1, "TIMEOUT": 1, "DATA": -1, "TAG": -1, "REQUIREMENTS": -1, "FORK_MODE": 1, "SPLIT_FACTOR": 1, "FORK_SUBTESTS": 0, "FORK_TESTS": 0, "SIZE": 1}, args) - check_type = flat_args[0] + check_type = flat_args[0] test_dir = get_norm_unit_path(unit) - + test_timeout = '' fork_mode = '' extra_test_data = '' @@ -584,15 +584,15 @@ def onadd_check(unit, *args): if ymake_java_test: extra_test_data = java_srcdirs_to_data(unit, 'ALL_SRCDIRS') extra_test_dart_data['JDK_RESOURCE'] = 'JDK' + (unit.get('JDK_VERSION') or '_DEFAULT') - elif check_type == "gofmt": - script_rel_path = check_type - go_files = flat_args[1:] - if go_files: - test_dir = os.path.dirname(go_files[0]).lstrip("$S/") - else: - script_rel_path = check_type - - use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') + elif check_type == "gofmt": + script_rel_path = check_type + go_files = flat_args[1:] + if go_files: + test_dir = os.path.dirname(go_files[0]).lstrip("$S/") + else: + script_rel_path = check_type + + use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') uid_ext = '' if check_type in ("check.data", "check.resource"): if unit.get("VALIDATE_DATA") == "no": @@ -613,118 +613,118 @@ def onadd_check(unit, *args): else: test_files = serialize_list(flat_args[1:]) - test_record = { - 'TEST-NAME': check_type.lower(), + test_record = { + 'TEST-NAME': check_type.lower(), 'TEST-TIMEOUT': test_timeout, - 'SCRIPT-REL-PATH': script_rel_path, - 'TESTED-PROJECT-NAME': os.path.basename(test_dir), - 'SOURCE-FOLDER-PATH': test_dir, - 'CUSTOM-DEPENDENCIES': " ".join(spec_args.get('DEPENDS', [])), + 'SCRIPT-REL-PATH': script_rel_path, + 'TESTED-PROJECT-NAME': os.path.basename(test_dir), + 'SOURCE-FOLDER-PATH': test_dir, + 'CUSTOM-DEPENDENCIES': " ".join(spec_args.get('DEPENDS', [])), 'TEST-DATA': extra_test_data, "SBR-UID-EXT": uid_ext, - 'SPLIT-FACTOR': '', + 'SPLIT-FACTOR': '', 'TEST_PARTITION': 'SEQUENTIAL', 'FORK-MODE': fork_mode, - 'FORK-TEST-FILES': '', - 'SIZE': 'SMALL', - 'TAG': '', + 'FORK-TEST-FILES': '', + 'SIZE': 'SMALL', + 'TAG': '', 'REQUIREMENTS': '', - 'USE_ARCADIA_PYTHON': use_arcadia_python or '', - 'OLD_PYTEST': 'no', - 'PYTHON-PATHS': '', + 'USE_ARCADIA_PYTHON': use_arcadia_python or '', + 'OLD_PYTEST': 'no', + 'PYTHON-PATHS': '', # TODO remove FILES, see DEVTOOLS-7052 'FILES': test_files, 'TEST-FILES': test_files, 'NO_JBUILD': 'yes' if ymake_java_test else 'no', - } + } test_record.update(extra_test_dart_data) data = dump_test(unit, test_record) - if data: - unit.set_property(["DART_DATA", data]) - save_in_file(unit.get('TEST_DART_OUT_FILE'), data) - - + if data: + unit.set_property(["DART_DATA", data]) + save_in_file(unit.get('TEST_DART_OUT_FILE'), data) + + def on_register_no_check_imports(unit): s = unit.get('NO_CHECK_IMPORTS_FOR_VALUE') if s not in ('', 'None'): unit.onresource(['-', 'py/no_check_imports/{}="{}"'.format(_common.pathid(s), s)]) -def onadd_check_py_imports(unit, *args): +def onadd_check_py_imports(unit, *args): if unit.get("TIDY") == "yes": # graph changed for clang_tidy tests return - if unit.get('NO_CHECK_IMPORTS_FOR_VALUE').strip() == "": - return + if unit.get('NO_CHECK_IMPORTS_FOR_VALUE').strip() == "": + return unit.onpeerdir(['library/python/testing/import_test']) - check_type = "py.imports" + check_type = "py.imports" test_dir = get_norm_unit_path(unit) - - use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') + + use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') test_files = serialize_list([get_norm_unit_path(unit, unit.filename())]) - test_record = { - 'TEST-NAME': "pyimports", - 'TEST-TIMEOUT': '', - 'SCRIPT-REL-PATH': check_type, - 'TESTED-PROJECT-NAME': os.path.basename(test_dir), - 'SOURCE-FOLDER-PATH': test_dir, - 'CUSTOM-DEPENDENCIES': '', - 'TEST-DATA': '', + test_record = { + 'TEST-NAME': "pyimports", + 'TEST-TIMEOUT': '', + 'SCRIPT-REL-PATH': check_type, + 'TESTED-PROJECT-NAME': os.path.basename(test_dir), + 'SOURCE-FOLDER-PATH': test_dir, + 'CUSTOM-DEPENDENCIES': '', + 'TEST-DATA': '', 'TEST-ENV': prepare_env(unit.get("TEST_ENV_VALUE")), - 'SPLIT-FACTOR': '', + 'SPLIT-FACTOR': '', 'TEST_PARTITION': 'SEQUENTIAL', - 'FORK-MODE': '', - 'FORK-TEST-FILES': '', - 'SIZE': 'SMALL', - 'TAG': '', - 'USE_ARCADIA_PYTHON': use_arcadia_python or '', - 'OLD_PYTEST': 'no', - 'PYTHON-PATHS': '', + 'FORK-MODE': '', + 'FORK-TEST-FILES': '', + 'SIZE': 'SMALL', + 'TAG': '', + 'USE_ARCADIA_PYTHON': use_arcadia_python or '', + 'OLD_PYTEST': 'no', + 'PYTHON-PATHS': '', # TODO remove FILES, see DEVTOOLS-7052 'FILES': test_files, 'TEST-FILES': test_files, - } - if unit.get('NO_CHECK_IMPORTS_FOR_VALUE') != "None": - test_record["NO-CHECK"] = serialize_list(get_values_list(unit, 'NO_CHECK_IMPORTS_FOR_VALUE') or ["*"]) - else: - test_record["NO-CHECK"] = '' + } + if unit.get('NO_CHECK_IMPORTS_FOR_VALUE') != "None": + test_record["NO-CHECK"] = serialize_list(get_values_list(unit, 'NO_CHECK_IMPORTS_FOR_VALUE') or ["*"]) + else: + test_record["NO-CHECK"] = '' data = dump_test(unit, test_record) - if data: - unit.set_property(["DART_DATA", data]) - save_in_file(unit.get('TEST_DART_OUT_FILE'), data) - - -def onadd_pytest_script(unit, *args): + if data: + unit.set_property(["DART_DATA", data]) + save_in_file(unit.get('TEST_DART_OUT_FILE'), data) + + +def onadd_pytest_script(unit, *args): if unit.get("TIDY") == "yes": # graph changed for clang_tidy tests return - unit.set(["PYTEST_BIN", "no"]) - custom_deps = get_values_list(unit, 'TEST_DEPENDS_VALUE') - timeout = filter(None, [unit.get(["TEST_TIMEOUT"])]) - - if timeout: - timeout = timeout[0] - else: - timeout = '0' - test_type = args[0] - fork_mode = unit.get('TEST_FORK_MODE').split() or '' - split_factor = unit.get('TEST_SPLIT_FACTOR') or '' - test_size = unit.get('TEST_SIZE_NAME') or '' - - test_files = get_values_list(unit, 'TEST_SRCS_VALUE') - tags = _get_test_tags(unit) + unit.set(["PYTEST_BIN", "no"]) + custom_deps = get_values_list(unit, 'TEST_DEPENDS_VALUE') + timeout = filter(None, [unit.get(["TEST_TIMEOUT"])]) + + if timeout: + timeout = timeout[0] + else: + timeout = '0' + test_type = args[0] + fork_mode = unit.get('TEST_FORK_MODE').split() or '' + split_factor = unit.get('TEST_SPLIT_FACTOR') or '' + test_size = unit.get('TEST_SIZE_NAME') or '' + + test_files = get_values_list(unit, 'TEST_SRCS_VALUE') + tags = _get_test_tags(unit) requirements = get_values_list(unit, 'TEST_REQUIREMENTS_VALUE') test_data = get_norm_paths(unit, 'TEST_DATA_VALUE') data, data_files = get_canonical_test_resources(unit) test_data += data - python_paths = get_values_list(unit, 'TEST_PYTHON_PATH_VALUE') - binary_path = None - test_cwd = unit.get('TEST_CWD_VALUE') or '' + python_paths = get_values_list(unit, 'TEST_PYTHON_PATH_VALUE') + binary_path = None + test_cwd = unit.get('TEST_CWD_VALUE') or '' _dump_test(unit, test_type, test_files, timeout, get_norm_unit_path(unit), custom_deps, test_data, python_paths, split_factor, fork_mode, test_size, tags, requirements, binary_path, test_cwd=test_cwd, data_files=data_files) - - -def onadd_pytest_bin(unit, *args): + + +def onadd_pytest_bin(unit, *args): if unit.get("TIDY") == "yes": # graph changed for clang_tidy tests return @@ -734,10 +734,10 @@ def onadd_pytest_bin(unit, *args): 'Unknown arguments found while processing add_pytest_bin macro: {!r}' .format(flat) ) - + runner_bin = kws.get('RUNNER_BIN', [None])[0] test_type = 'py3test.bin' if (unit.get("PYTHON3") == 'yes') else "pytest.bin" - + add_test_to_dart(unit, test_type, runner_bin=runner_bin) @@ -745,31 +745,31 @@ def add_test_to_dart(unit, test_type, binary_path=None, runner_bin=None): if unit.get("TIDY") == "yes": # graph changed for clang_tidy tests return - custom_deps = get_values_list(unit, 'TEST_DEPENDS_VALUE') - timeout = filter(None, [unit.get(["TEST_TIMEOUT"])]) - if timeout: - timeout = timeout[0] - else: - timeout = '0' - fork_mode = unit.get('TEST_FORK_MODE').split() or '' - split_factor = unit.get('TEST_SPLIT_FACTOR') or '' - test_size = unit.get('TEST_SIZE_NAME') or '' - test_cwd = unit.get('TEST_CWD_VALUE') or '' - + custom_deps = get_values_list(unit, 'TEST_DEPENDS_VALUE') + timeout = filter(None, [unit.get(["TEST_TIMEOUT"])]) + if timeout: + timeout = timeout[0] + else: + timeout = '0' + fork_mode = unit.get('TEST_FORK_MODE').split() or '' + split_factor = unit.get('TEST_SPLIT_FACTOR') or '' + test_size = unit.get('TEST_SIZE_NAME') or '' + test_cwd = unit.get('TEST_CWD_VALUE') or '' + unit_path = unit.path() - test_files = get_values_list(unit, 'TEST_SRCS_VALUE') - tags = _get_test_tags(unit) + test_files = get_values_list(unit, 'TEST_SRCS_VALUE') + tags = _get_test_tags(unit) requirements = get_values_list(unit, 'TEST_REQUIREMENTS_VALUE') test_data = get_norm_paths(unit, 'TEST_DATA_VALUE') data, data_files = get_canonical_test_resources(unit) test_data += data - python_paths = get_values_list(unit, 'TEST_PYTHON_PATH_VALUE') + python_paths = get_values_list(unit, 'TEST_PYTHON_PATH_VALUE') yt_spec = get_values_list(unit, 'TEST_YT_SPEC_VALUE') - if not binary_path: + if not binary_path: binary_path = os.path.join(unit_path, unit.filename()) _dump_test(unit, test_type, test_files, timeout, get_norm_unit_path(unit), custom_deps, test_data, python_paths, split_factor, fork_mode, test_size, tags, requirements, binary_path, test_cwd=test_cwd, runner_bin=runner_bin, yt_spec=yt_spec, data_files=data_files) - - + + def extract_java_system_properties(unit, args): if len(args) % 2: return [], 'Wrong use of SYSTEM_PROPERTIES in {}: odd number of arguments'.format(unit.path()) @@ -841,7 +841,7 @@ def onjava_test(unit, *args): 'SOURCE-FOLDER-PATH': path, 'TEST-NAME': '-'.join([os.path.basename(os.path.dirname(path)), os.path.basename(path)]), 'SCRIPT-REL-PATH': script_rel_path, - 'TEST-TIMEOUT': unit.get('TEST_TIMEOUT') or '', + 'TEST-TIMEOUT': unit.get('TEST_TIMEOUT') or '', 'TESTED-PROJECT-NAME': path, 'TEST-ENV': prepare_env(unit.get("TEST_ENV_VALUE")), # 'TEST-PRESERVE-ENV': 'da', @@ -849,7 +849,7 @@ def onjava_test(unit, *args): 'FORK-MODE': unit.get('TEST_FORK_MODE') or '', 'SPLIT-FACTOR': unit.get('TEST_SPLIT_FACTOR') or '', 'CUSTOM-DEPENDENCIES': ' '.join(get_values_list(unit, 'TEST_DEPENDS_VALUE')), - 'TAG': serialize_list(_get_test_tags(unit)), + 'TAG': serialize_list(_get_test_tags(unit)), 'SIZE': unit.get('TEST_SIZE_NAME') or '', 'REQUIREMENTS': serialize_list(get_values_list(unit, 'TEST_REQUIREMENTS_VALUE')), 'TEST-RECIPES': prepare_recipes(unit.get("TEST_RECIPES_VALUE")), @@ -860,7 +860,7 @@ def onjava_test(unit, *args): 'JVM_ARGS': serialize_list(get_values_list(unit, 'JVM_ARGS_VALUE')), 'SYSTEM_PROPERTIES': props, 'TEST-CWD': test_cwd, - 'SKIP_TEST': unit.get('SKIP_TEST_VALUE') or '', + 'SKIP_TEST': unit.get('SKIP_TEST_VALUE') or '', 'JAVA_CLASSPATH_CMD_TYPE': java_cp_arg_type, 'NO_JBUILD': 'yes' if ymake_java_test else 'no', 'JDK_RESOURCE': 'JDK' + (unit.get('JDK_VERSION') or '_DEFAULT'), @@ -879,8 +879,8 @@ def onjava_test(unit, *args): test_record['TEST_JAR'] = '{}/{}.jar'.format(unit.get('MODDIR'), unit.get('REALPRJNAME')) data = dump_test(unit, test_record) - if data: - unit.set_property(['DART_DATA', data]) + if data: + unit.set_property(['DART_DATA', data]) def onjava_test_deps(unit, *args): @@ -927,50 +927,50 @@ def onjava_test_deps(unit, *args): unit.set_property(['DART_DATA', data]) -def _get_test_tags(unit, spec_args=None): - if spec_args is None: - spec_args = {} - tags = spec_args.get('TAG', []) + get_values_list(unit, 'TEST_TAGS_VALUE') - # DEVTOOLS-7571 - if unit.get('SKIP_TEST_VALUE') and 'ya:fat' in tags and "ya:not_autocheck" not in tags: - tags.append("ya:not_autocheck") - - return tags - - -def _dump_test( - unit, - test_type, - test_files, - timeout, - test_dir, - custom_deps, - test_data, - python_paths, - split_factor, - fork_mode, - test_size, - tags, +def _get_test_tags(unit, spec_args=None): + if spec_args is None: + spec_args = {} + tags = spec_args.get('TAG', []) + get_values_list(unit, 'TEST_TAGS_VALUE') + # DEVTOOLS-7571 + if unit.get('SKIP_TEST_VALUE') and 'ya:fat' in tags and "ya:not_autocheck" not in tags: + tags.append("ya:not_autocheck") + + return tags + + +def _dump_test( + unit, + test_type, + test_files, + timeout, + test_dir, + custom_deps, + test_data, + python_paths, + split_factor, + fork_mode, + test_size, + tags, requirements, - binary_path='', - old_pytest=False, - test_cwd=None, + binary_path='', + old_pytest=False, + test_cwd=None, runner_bin=None, yt_spec=None, data_files=None -): - - if test_type == "PY_TEST": - script_rel_path = "py.test" - else: - script_rel_path = test_type - +): + + if test_type == "PY_TEST": + script_rel_path = "py.test" + else: + script_rel_path = test_type + unit_path = unit.path() - fork_test_files = unit.get('FORK_TEST_FILES_MODE') - fork_mode = ' '.join(fork_mode) if fork_mode else '' - use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') - if test_cwd: - test_cwd = test_cwd.replace("$TEST_CWD_VALUE", "").replace('"MACRO_CALLS_DELIM"', "").strip() + fork_test_files = unit.get('FORK_TEST_FILES_MODE') + fork_mode = ' '.join(fork_mode) if fork_mode else '' + use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') + if test_cwd: + test_cwd = test_cwd.replace("$TEST_CWD_VALUE", "").replace('"MACRO_CALLS_DELIM"', "").strip() test_name = os.path.basename(binary_path) test_record = { 'TEST-NAME': os.path.splitext(test_name)[0], @@ -1000,7 +1000,7 @@ def _dump_test( 'BLOB': unit.get('TEST_BLOB_DATA') or '', 'CANONIZE_SUB_PATH': unit.get('CANONIZE_SUB_PATH') or '', } - if binary_path: + if binary_path: test_record['BINARY-PATH'] = _common.strip_roots(binary_path) if runner_bin: test_record['TEST-RUNNER-BIN'] = runner_bin @@ -1010,34 +1010,34 @@ def _dump_test( if data: unit.set_property(["DART_DATA", data]) save_in_file(unit.get('TEST_DART_OUT_FILE'), data) - - -def onsetup_pytest_bin(unit, *args): - use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') == "yes" - if use_arcadia_python: - unit.onresource(['-', 'PY_MAIN={}'.format("library.python.pytest.main:main")]) # XXX + + +def onsetup_pytest_bin(unit, *args): + use_arcadia_python = unit.get('USE_ARCADIA_PYTHON') == "yes" + if use_arcadia_python: + unit.onresource(['-', 'PY_MAIN={}'.format("library.python.pytest.main:main")]) # XXX unit.onadd_pytest_bin(list(args)) - else: - unit.onno_platform() - unit.onadd_pytest_script(["PY_TEST"]) - - -def onrun(unit, *args): - exectest_cmd = unit.get(["EXECTEST_COMMAND_VALUE"]) or '' + else: + unit.onno_platform() + unit.onadd_pytest_script(["PY_TEST"]) + + +def onrun(unit, *args): + exectest_cmd = unit.get(["EXECTEST_COMMAND_VALUE"]) or '' exectest_cmd += "\n" + subprocess.list2cmdline(args) - unit.set(["EXECTEST_COMMAND_VALUE", exectest_cmd]) - - -def onsetup_exectest(unit, *args): + unit.set(["EXECTEST_COMMAND_VALUE", exectest_cmd]) + + +def onsetup_exectest(unit, *args): command = unit.get(["EXECTEST_COMMAND_VALUE"]) if command is None: ymake.report_configure_error("EXECTEST must have at least one RUN macro") return command = command.replace("$EXECTEST_COMMAND_VALUE", "") - if "PYTHON_BIN" in command: - unit.ondepends('contrib/tools/python') - unit.set(["TEST_BLOB_DATA", base64.b64encode(command)]) - add_test_to_dart(unit, "exectest", binary_path=os.path.join(unit.path(), unit.filename()).replace(".pkg", "")) + if "PYTHON_BIN" in command: + unit.ondepends('contrib/tools/python') + unit.set(["TEST_BLOB_DATA", base64.b64encode(command)]) + add_test_to_dart(unit, "exectest", binary_path=os.path.join(unit.path(), unit.filename()).replace(".pkg", "")) def onsetup_run_python(unit): diff --git a/build/plugins/ytest2.py b/build/plugins/ytest2.py index 1963f4311a..0a34263c35 100644 --- a/build/plugins/ytest2.py +++ b/build/plugins/ytest2.py @@ -31,7 +31,7 @@ def ytest_base(unit, related_prj_dir, related_prj_name, args): data = '\"' + ';'.join(data_lst) + '\"' if data_lst else '' unit.set(['TEST-DATA', data]) - related_dirs_list = ['{ARCADIA_ROOT}/devtools/${YA_ROOT}', '${ARCADIA_ROOT}/devtools/${YA_ROOT}', '$RELATED_TARGET_SRCDIR'] + related_dirs_list = ['{ARCADIA_ROOT}/devtools/${YA_ROOT}', '${ARCADIA_ROOT}/devtools/${YA_ROOT}', '$RELATED_TARGET_SRCDIR'] related_dirs_value = [] for rel in related_dirs_list: related_dirs_value.extend(['--test-related-path', rel]) diff --git a/build/sanitize-blacklist.txt b/build/sanitize-blacklist.txt index 1006e35d57..c1fb5e539f 100644 --- a/build/sanitize-blacklist.txt +++ b/build/sanitize-blacklist.txt @@ -1,4 +1,4 @@ -src:*contrib/tools/python/src* +src:*contrib/tools/python/src* src:*contrib/tools/python3/src* src:*contrib/libs/luajit* type:std::__*::locale::id=init diff --git a/build/scripts/append_file.py b/build/scripts/append_file.py index 0b594a53e8..6b5d53bc71 100644 --- a/build/scripts/append_file.py +++ b/build/scripts/append_file.py @@ -1,9 +1,9 @@ -import sys - - -if __name__ == "__main__": - - file_path = sys.argv[1] - with open(file_path, "a") as f: +import sys + + +if __name__ == "__main__": + + file_path = sys.argv[1] + with open(file_path, "a") as f: for text in sys.argv[2:]: print >>f, text diff --git a/build/scripts/build_mn.py b/build/scripts/build_mn.py index f3ede12de7..5bb03c247c 100755 --- a/build/scripts/build_mn.py +++ b/build/scripts/build_mn.py @@ -321,7 +321,7 @@ def BuildMnF(argv): if __name__ == '__main__': if len(sys.argv) < 2: - print >>sys.stderr, "Usage: build_mn.py <funcName> <args...>" + print >>sys.stderr, "Usage: build_mn.py <funcName> <args...>" sys.exit(1) if (sys.argv[2:]): diff --git a/build/scripts/build_pln_header.py b/build/scripts/build_pln_header.py index 0d09907f9b..c73693f444 100755 --- a/build/scripts/build_pln_header.py +++ b/build/scripts/build_pln_header.py @@ -6,7 +6,7 @@ import os def BuildPlnHeader(): if len(sys.argv) < 2: - print >>sys.stderr, "Usage: build_pln_header.py <absolute/path/to/OutFile>" + print >>sys.stderr, "Usage: build_pln_header.py <absolute/path/to/OutFile>" sys.exit(1) print >>sys.stdout, "Build Pln Header..." diff --git a/build/scripts/cat.py b/build/scripts/cat.py index 6153dd2a8a..0c3f73d96f 100755 --- a/build/scripts/cat.py +++ b/build/scripts/cat.py @@ -3,13 +3,13 @@ import sys from shutil import copyfileobj as copy import os.path -if __name__ == '__main__': - for filename in sys.argv[1:] or ["-"]: - if filename == "-": - copy(sys.stdin, sys.stdout) +if __name__ == '__main__': + for filename in sys.argv[1:] or ["-"]: + if filename == "-": + copy(sys.stdin, sys.stdout) else: - if os.path.exists(filename): - with open(filename, 'rb') as file: - copy(file, sys.stdout) - else: - sys.stderr.write('cat.py: {0}: No such file or directory\n'.format(filename)) + if os.path.exists(filename): + with open(filename, 'rb') as file: + copy(file, sys.stdout) + else: + sys.stderr.write('cat.py: {0}: No such file or directory\n'.format(filename)) diff --git a/build/scripts/check_config_h.py b/build/scripts/check_config_h.py index 0fe56908df..07bc12e230 100644 --- a/build/scripts/check_config_h.py +++ b/build/scripts/check_config_h.py @@ -83,7 +83,7 @@ static_assert(sizeof(wchar_t) == SIZEOF_WCHAR_T, "fixme 16"); //TODO #endif """ -if __name__ == '__main__': - with open(sys.argv[2], 'w') as f: - f.write('#include <' + sys.argv[1] + '>\n\n') - f.write(data) +if __name__ == '__main__': + with open(sys.argv[2], 'w') as f: + f.write('#include <' + sys.argv[1] + '>\n\n') + f.write(data) diff --git a/build/scripts/compile_cuda.py b/build/scripts/compile_cuda.py index 7e98e5bc19..c0bec50b2a 100644 --- a/build/scripts/compile_cuda.py +++ b/build/scripts/compile_cuda.py @@ -21,29 +21,29 @@ def main(): except ValueError: skip_nocxxinc = False - spl = sys.argv.index('--cflags') + spl = sys.argv.index('--cflags') mtime0 = sys.argv[1] command = sys.argv[2: spl] - cflags = sys.argv[spl + 1:] + cflags = sys.argv[spl + 1:] dump_args = False if '--y_dump_args' in command: command.remove('--y_dump_args') dump_args = True - executable = command[0] - if not os.path.exists(executable): - print >> sys.stderr, '{} not found'.format(executable) - sys.exit(1) + executable = command[0] + if not os.path.exists(executable): + print >> sys.stderr, '{} not found'.format(executable) + sys.exit(1) if is_clang(command): # nvcc concatenates the sources for clang, and clang reports unused # things from .h files as if they they were defined in a .cpp file. cflags += ['-Wno-unused-function', '-Wno-unused-parameter'] - if not is_clang(command) and '-fopenmp=libomp' in cflags: - cflags.append('-fopenmp') - cflags.remove('-fopenmp=libomp') + if not is_clang(command) and '-fopenmp=libomp' in cflags: + cflags.append('-fopenmp') + cflags.remove('-fopenmp=libomp') skip_list = [ '-gline-tables-only', diff --git a/build/scripts/coverage-info.py b/build/scripts/coverage-info.py index c64c3efd48..94491d9256 100644 --- a/build/scripts/coverage-info.py +++ b/build/scripts/coverage-info.py @@ -96,26 +96,26 @@ def chunks(l, n): yield l[i:i + n] -def combine_info_files(lcov, files, out_file): - chunk_size = 50 - files = list(set(files)) - - for chunk in chunks(files, chunk_size): - combine_cmd = [lcov] - if os.path.exists(out_file): - chunk.append(out_file) - for trace in chunk: - assert os.path.exists(trace), "Trace file does not exist: {} (cwd={})".format(trace, os.getcwd()) - combine_cmd += ["-a", os.path.abspath(trace)] - print >>sys.stderr, '## lcov', ' '.join(combine_cmd[1:]) - out_file_tmp = "combined.tmp" - with open(out_file_tmp, "w") as stdout: - subprocess.check_call(combine_cmd, stdout=stdout) - if os.path.exists(out_file): - os.remove(out_file) - os.rename(out_file_tmp, out_file) - - +def combine_info_files(lcov, files, out_file): + chunk_size = 50 + files = list(set(files)) + + for chunk in chunks(files, chunk_size): + combine_cmd = [lcov] + if os.path.exists(out_file): + chunk.append(out_file) + for trace in chunk: + assert os.path.exists(trace), "Trace file does not exist: {} (cwd={})".format(trace, os.getcwd()) + combine_cmd += ["-a", os.path.abspath(trace)] + print >>sys.stderr, '## lcov', ' '.join(combine_cmd[1:]) + out_file_tmp = "combined.tmp" + with open(out_file_tmp, "w") as stdout: + subprocess.check_call(combine_cmd, stdout=stdout) + if os.path.exists(out_file): + os.remove(out_file) + os.rename(out_file_tmp, out_file) + + def probe_path_global(path, source_root, prefix_filter, exclude_files): if path.endswith('_ut.cpp'): return None @@ -186,7 +186,7 @@ def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_exe source_fname = gcda_name[:-len(GCDA_EXT)] for suff in suffixes(source_fname): if suff in fname2gcno: - gcda_new_name = suff + GCDA_EXT + gcda_new_name = suff + GCDA_EXT gcda_item.name = gcda_new_name gcda_tf.extract(gcda_item) if os.path.getsize(gcda_new_name) > 0: @@ -196,9 +196,9 @@ def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_exe geninfo_executable, '--gcov-tool', gcov_tool, gcda_new_name, - '-o', coverage_info + '.tmp' + '-o', coverage_info + '.tmp' ] - gen_info(geninfo_cmd, coverage_info) + gen_info(geninfo_cmd, coverage_info) def gen_cobertura(tool, output, combined_info): @@ -251,9 +251,9 @@ def main(source_root, output, gcno_archive, gcda_archive, gcov_tool, prefix_filt print_stat(da, fnda, teamcity_stat_file) if lcov_args: - output_trace = "combined.info" - combine_info_files(os.path.join(source_root, 'devtools', 'lcov', 'lcov'), lcov_args, output_trace) - cmd = [os.path.join(source_root, 'devtools', 'lcov', 'genhtml'), '-p', source_root, '--ignore-errors', 'source', '-o', output_dir, output_trace] + output_trace = "combined.info" + combine_info_files(os.path.join(source_root, 'devtools', 'lcov', 'lcov'), lcov_args, output_trace) + cmd = [os.path.join(source_root, 'devtools', 'lcov', 'genhtml'), '-p', source_root, '--ignore-errors', 'source', '-o', output_dir, output_trace] print >>sys.stderr, '## genhtml', ' '.join(cmd) subprocess.check_call(cmd) if lcov_cobertura: diff --git a/build/scripts/f2c.py b/build/scripts/f2c.py index 2668bd1a37..7021e1391f 100644 --- a/build/scripts/f2c.py +++ b/build/scripts/f2c.py @@ -28,31 +28,31 @@ def mkdir_p(directory): os.makedirs(directory) -if __name__ == '__main__': - parser = argparse.ArgumentParser() +if __name__ == '__main__': + parser = argparse.ArgumentParser() - parser.add_argument('-t', '--tool') - parser.add_argument('-c', '--input') - parser.add_argument('-o', '--output') + parser.add_argument('-t', '--tool') + parser.add_argument('-c', '--input') + parser.add_argument('-o', '--output') - args = parser.parse_args() + args = parser.parse_args() tmpdir = args.output + '.f2c' mkdir_p(tmpdir) - # should parse includes, really + # should parse includes, really p = subprocess.Popen( [args.tool, '-w', '-R', '-a', '-I' + os.path.dirname(args.input), '-T' + tmpdir], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) - stdout, stderr = p.communicate(input=open(args.input).read()) - ret = p.wait() + stdout, stderr = p.communicate(input=open(args.input).read()) + ret = p.wait() - if ret: - print >>sys.stderr, 'f2c failed: %s, %s' % (stderr, ret) - sys.exit(ret) + if ret: + print >>sys.stderr, 'f2c failed: %s, %s' % (stderr, ret) + sys.exit(ret) - if 'Error' in stderr: + if 'Error' in stderr: print >>sys.stderr, stderr - with open(args.output, 'w') as f: + with open(args.output, 'w') as f: f.write(header) - f.write(stdout) + f.write(stdout) f.write(footer) diff --git a/build/scripts/fetch_from_sandbox.py b/build/scripts/fetch_from_sandbox.py index a9beb5ba41..a99542e174 100755 --- a/build/scripts/fetch_from_sandbox.py +++ b/build/scripts/fetch_from_sandbox.py @@ -121,13 +121,13 @@ def get_resource_info(resource_id, touch=False, no_links=False): if no_links: headers.update({'X-No-Links': '1'}) return _query(url) - - -def get_resource_http_links(resource_id): + + +def get_resource_http_links(resource_id): url = ''.join((_SANDBOX_BASE_URL, '/resource/', str(resource_id), '/data/http')) return [r['url'] + ORIGIN_SUFFIX for r in _query(url)] - - + + def fetch_via_script(script, resource_id): return subprocess.check_output([script, str(resource_id)]).rstrip() diff --git a/build/scripts/fs_tools.py b/build/scripts/fs_tools.py index 979aa72f0c..dec4c349c8 100644 --- a/build/scripts/fs_tools.py +++ b/build/scripts/fs_tools.py @@ -23,28 +23,28 @@ def link_or_copy(src, dst): raise -if __name__ == '__main__': - mode = sys.argv[1] +if __name__ == '__main__': + mode = sys.argv[1] args = pcf.get_args(sys.argv[2:]) - if mode == 'copy': + if mode == 'copy': shutil.copy(args[0], args[1]) elif mode == 'copy_tree_no_link': dst = args[1] shutil.copytree(args[0], dst, ignore=lambda dirname, names: [n for n in names if os.path.islink(os.path.join(dirname, n))]) - elif mode == 'copy_files': - src = args[0] - dst = args[1] - files = open(args[2]).read().strip().split() - for f in files: - s = os.path.join(src, f) - d = os.path.join(dst, f) - if os.path.exists(d): - continue - try: - os.makedirs(os.path.dirname(d)) - except OSError: - pass + elif mode == 'copy_files': + src = args[0] + dst = args[1] + files = open(args[2]).read().strip().split() + for f in files: + s = os.path.join(src, f) + d = os.path.join(dst, f) + if os.path.exists(d): + continue + try: + os.makedirs(os.path.dirname(d)) + except OSError: + pass shutil.copy(s, d) elif mode == 'copy_all_files': src = args[0] @@ -61,23 +61,23 @@ if __name__ == '__main__': except OSError: pass shutil.copy(os.path.join(root, f), file_dst) - elif mode == 'rename_if_exists': - if os.path.exists(args[0]): - shutil.move(args[0], args[1]) - elif mode == 'rename': + elif mode == 'rename_if_exists': + if os.path.exists(args[0]): + shutil.move(args[0], args[1]) + elif mode == 'rename': targetdir = os.path.dirname(args[1]) if targetdir and not os.path.exists(targetdir): os.makedirs(os.path.dirname(args[1])) shutil.move(args[0], args[1]) - elif mode == 'remove': - for f in args: - try: - if os.path.isfile(f) or os.path.islink(f): - os.remove(f) - else: - shutil.rmtree(f) - except OSError: - pass + elif mode == 'remove': + for f in args: + try: + if os.path.isfile(f) or os.path.islink(f): + os.remove(f) + else: + shutil.rmtree(f) + except OSError: + pass elif mode == 'link_or_copy': link_or_copy(args[0], args[1]) elif mode == 'link_or_copy_to_dir': @@ -100,5 +100,5 @@ if __name__ == '__main__': os.makedirs(args[0]) except OSError: pass - else: - raise Exception('unsupported tool %s' % mode) + else: + raise Exception('unsupported tool %s' % mode) diff --git a/build/scripts/gen_mx_table.py b/build/scripts/gen_mx_table.py index 45f392a3e5..187c21c539 100644 --- a/build/scripts/gen_mx_table.py +++ b/build/scripts/gen_mx_table.py @@ -50,26 +50,26 @@ namespace { yabs_mx_calc_table_t yabs_mx_calc_table = {YABS_MX_CALC_VERSION, 10000, 0, yabs_funcs}; """ -if __name__ == '__main__': - init = [] - body = [] - defs = {} +if __name__ == '__main__': + init = [] + body = [] + defs = {} - for i in sys.argv[1:]: - name = i.replace('.', '_') - num = long(name.split('_')[1]) + for i in sys.argv[1:]: + name = i.replace('.', '_') + num = long(name.split('_')[1]) - init.append('(*this)[%s] = new TFml(ar.ObjectBlobByKey("%s"));' % (num, '/' + i)) + init.append('(*this)[%s] = new TFml(ar.ObjectBlobByKey("%s"));' % (num, '/' + i)) - f1 = 'static void yabs_%s(size_t count, const float** args, double* res) {Singleton<TFormulas>()->at(%s).DoCalcRelevs(args, res, count);}' % (name, num) - f2 = 'static size_t yabs_%s_factor_count() {return Singleton<TFormulas>()->at(%s).MaxFactorIndex() + 1;}' % (name, num) + f1 = 'static void yabs_%s(size_t count, const float** args, double* res) {Singleton<TFormulas>()->at(%s).DoCalcRelevs(args, res, count);}' % (name, num) + f2 = 'static size_t yabs_%s_factor_count() {return Singleton<TFormulas>()->at(%s).MaxFactorIndex() + 1;}' % (name, num) - body.append(f1) - body.append(f2) + body.append(f1) + body.append(f2) - d1 = 'yabs_%s' % name - d2 = 'yabs_%s_factor_count' % name + d1 = 'yabs_%s' % name + d2 = 'yabs_%s_factor_count' % name - defs[num] = '{%s, %s}' % (d1, d2) + defs[num] = '{%s, %s}' % (d1, d2) - print tmpl % ('\n'.join(init), '\n\n'.join(body), ',\n'.join((defs.get(i, '{nullptr, nullptr}') for i in range(0, 10000)))) + print tmpl % ('\n'.join(init), '\n\n'.join(body), ',\n'.join((defs.get(i, '{nullptr, nullptr}') for i in range(0, 10000)))) diff --git a/build/scripts/gen_py_reg.py b/build/scripts/gen_py_reg.py index 2c2495c14e..1560135ae8 100644 --- a/build/scripts/gen_py_reg.py +++ b/build/scripts/gen_py_reg.py @@ -19,14 +19,14 @@ def mangle(name): return name return ''.join('{}{}'.format(len(s), s) for s in name.split('.')) -if __name__ == '__main__': - if len(sys.argv) != 3: - print >>sys.stderr, 'Usage: <path/to/gen_py_reg.py> <python_module_name> <output_file>' - print >>sys.stderr, 'Passed: ' + ' '.join(sys.argv) - sys.exit(1) +if __name__ == '__main__': + if len(sys.argv) != 3: + print >>sys.stderr, 'Usage: <path/to/gen_py_reg.py> <python_module_name> <output_file>' + print >>sys.stderr, 'Passed: ' + ' '.join(sys.argv) + sys.exit(1) - with open(sys.argv[2], 'w') as f: - modname = sys.argv[1] - initname = 'init' + mangle(modname) - code = template.replace('{0}', modname).replace('{1}', initname) - f.write(code) + with open(sys.argv[2], 'w') as f: + modname = sys.argv[1] + initname = 'init' + mangle(modname) + code = template.replace('{0}', modname).replace('{1}', initname) + f.write(code) diff --git a/build/scripts/link_fat_obj.py b/build/scripts/link_fat_obj.py index 9bf6254255..c189668b9e 100644 --- a/build/scripts/link_fat_obj.py +++ b/build/scripts/link_fat_obj.py @@ -8,11 +8,11 @@ YA_ARG_PREFIX = '-Ya,' def get_args(): - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser() parser.add_argument('--obj') parser.add_argument('--globals-lib') - parser.add_argument('--lib', required=True) - parser.add_argument('--arch', required=True) + parser.add_argument('--lib', required=True) + parser.add_argument('--arch', required=True) parser.add_argument('--build-root', default=None) parser.add_argument('--with-own-obj', action='store_true', default=False) parser.add_argument('--with-global-srcs', action='store_true', default=False) @@ -46,8 +46,8 @@ def main(): auto_input = groups['input'] # Outputs - lib_output = args.lib - obj_output = args.obj + lib_output = args.lib + obj_output = args.obj # Dependencies global_srcs = groups['global_srcs'] @@ -69,10 +69,10 @@ def main(): if args.with_global_srcs: do_archive += global_srcs - def call(c): + def call(c): proc = subprocess.Popen(c, shell=False, stderr=sys.stderr, stdout=sys.stdout, cwd=args.build_root) - proc.communicate() - return proc.returncode + proc.communicate() + return proc.returncode if obj_output: link_res = call(do_link) diff --git a/build/scripts/mkver.py b/build/scripts/mkver.py index 91197942af..321cdaade1 100755 --- a/build/scripts/mkver.py +++ b/build/scripts/mkver.py @@ -1,12 +1,12 @@ import sys -if __name__ == '__main__': - with open(sys.argv[1], 'r') as f: - data = f.readline() +if __name__ == '__main__': + with open(sys.argv[1], 'r') as f: + data = f.readline() - beg = data.find('(') + 1 - end = data.find(')') - version = data[beg:end] + beg = data.find('(') + 1 + end = data.find(')') + version = data[beg:end] - print '#pragma once' - print '#define DEBIAN_VERSION "%s"' % version + print '#pragma once' + print '#define DEBIAN_VERSION "%s"' % version diff --git a/build/scripts/perl_wrapper.py b/build/scripts/perl_wrapper.py index fdb9beb1db..cb4027f1d3 100644 --- a/build/scripts/perl_wrapper.py +++ b/build/scripts/perl_wrapper.py @@ -2,23 +2,23 @@ import os import sys import shutil -if __name__ == '__main__': - path = sys.argv[1] - to = sys.argv[-1] - fr = sys.argv[-2] - to_dir = os.path.dirname(to) +if __name__ == '__main__': + path = sys.argv[1] + to = sys.argv[-1] + fr = sys.argv[-2] + to_dir = os.path.dirname(to) - os.chdir(to_dir) + os.chdir(to_dir) - f1 = os.path.basename(fr) - fr_ = os.path.dirname(fr) - f2 = os.path.basename(fr_) - fr_ = os.path.dirname(fr_) + f1 = os.path.basename(fr) + fr_ = os.path.dirname(fr) + f2 = os.path.basename(fr_) + fr_ = os.path.dirname(fr_) - os.makedirs(f2) - shutil.copyfile(fr, os.path.join(f2, f1)) + os.makedirs(f2) + shutil.copyfile(fr, os.path.join(f2, f1)) - if path[0] != '/': - path = os.path.join(os.path.dirname(__file__), path) + if path[0] != '/': + path = os.path.join(os.path.dirname(__file__), path) - os.execv(path, [path] + sys.argv[2:]) + os.execv(path, [path] + sys.argv[2:]) diff --git a/build/scripts/preprocess.py b/build/scripts/preprocess.py index 1d724c6819..4657bef732 100644 --- a/build/scripts/preprocess.py +++ b/build/scripts/preprocess.py @@ -44,5 +44,5 @@ def subst_headers(path, headers): f.write(prev) -if __name__ == '__main__': - subst_headers(sys.argv[1], ['stack.hh', 'position.hh', 'location.hh']) +if __name__ == '__main__': + subst_headers(sys.argv[1], ['stack.hh', 'position.hh', 'location.hh']) diff --git a/build/scripts/resolve_java_srcs.py b/build/scripts/resolve_java_srcs.py index bd50c96af9..a2e6c20012 100644 --- a/build/scripts/resolve_java_srcs.py +++ b/build/scripts/resolve_java_srcs.py @@ -17,15 +17,15 @@ def list_all_files(directory, prefix='/', hidden_files=False): def pattern_to_regexp(p): return '^' + \ ('/' if not p.startswith('**') else '') + \ - re.escape(p).replace( - r'\*\*\/', '[_DIR_]' - ).replace( - r'\*', '[_FILE_]' - ).replace( - '[_DIR_]', '(.*/)?' - ).replace( - '[_FILE_]', '([^/]*)' - ) + '$' + re.escape(p).replace( + r'\*\*\/', '[_DIR_]' + ).replace( + r'\*', '[_FILE_]' + ).replace( + '[_DIR_]', '(.*/)?' + ).replace( + '[_FILE_]', '([^/]*)' + ) + '$' def resolve_java_srcs(srcdir, include_patterns, exclude_patterns, all_resources, resolve_kotlin=False, resolve_groovy=False): @@ -87,7 +87,7 @@ def do_it(directory, sources_file, resources_file, kotlin_sources_file, groovy_s if groovy_sources_file: open(groovy_sources_file, mode).writelines(i + '\n' for i in g + j) - + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('-d', '--directory', required=True) diff --git a/build/scripts/run_llvm_dsymutil.py b/build/scripts/run_llvm_dsymutil.py index 862cc74979..4f43362ad9 100644 --- a/build/scripts/run_llvm_dsymutil.py +++ b/build/scripts/run_llvm_dsymutil.py @@ -3,9 +3,9 @@ import sys import subprocess -if __name__ == '__main__': - with open(os.devnull, 'w') as fnull: - p = subprocess.Popen(sys.argv[1:], shell=False, stderr=fnull, stdout=sys.stdout) +if __name__ == '__main__': + with open(os.devnull, 'w') as fnull: + p = subprocess.Popen(sys.argv[1:], shell=False, stderr=fnull, stdout=sys.stdout) - p.communicate() - sys.exit(p.returncode) + p.communicate() + sys.exit(p.returncode) diff --git a/build/scripts/run_tool.py b/build/scripts/run_tool.py index 948e7f50d1..00e3ff6f1e 100755 --- a/build/scripts/run_tool.py +++ b/build/scripts/run_tool.py @@ -2,8 +2,8 @@ import sys import subprocess import os - -if __name__ == '__main__': - env = os.environ.copy() - env['ASAN_OPTIONS'] = 'detect_leaks=0' - subprocess.check_call(sys.argv[sys.argv.index('--') + 1:], env=env) + +if __name__ == '__main__': + env = os.environ.copy() + env['ASAN_OPTIONS'] = 'detect_leaks=0' + subprocess.check_call(sys.argv[sys.argv.index('--') + 1:], env=env) diff --git a/build/scripts/wrapper.py b/build/scripts/wrapper.py index 7259ef5864..1e9d7955a5 100644 --- a/build/scripts/wrapper.py +++ b/build/scripts/wrapper.py @@ -2,10 +2,10 @@ import os import sys -if __name__ == '__main__': - path = sys.argv[1] +if __name__ == '__main__': + path = sys.argv[1] - if path[0] != '/': - path = os.path.join(os.path.dirname(__file__), path) + if path[0] != '/': + path = os.path.join(os.path.dirname(__file__), path) - os.execv(path, [path] + sys.argv[2:]) + os.execv(path, [path] + sys.argv[2:]) diff --git a/build/scripts/xargs.py b/build/scripts/xargs.py index 8a6e93e027..5d68929ecc 100644 --- a/build/scripts/xargs.py +++ b/build/scripts/xargs.py @@ -2,17 +2,17 @@ import sys import os import subprocess -if __name__ == '__main__': - pos = sys.argv.index('--') - fname = sys.argv[pos + 1] - cmd = sys.argv[pos + 2:] +if __name__ == '__main__': + pos = sys.argv.index('--') + fname = sys.argv[pos + 1] + cmd = sys.argv[pos + 2:] - with open(fname, 'r') as f: - args = [x.strip() for x in f] + with open(fname, 'r') as f: + args = [x.strip() for x in f] - os.remove(fname) + os.remove(fname) - p = subprocess.Popen(cmd + args, shell=False, stderr=sys.stderr, stdout=sys.stdout) - p.communicate() + p = subprocess.Popen(cmd + args, shell=False, stderr=sys.stderr, stdout=sys.stdout) + p.communicate() - sys.exit(p.returncode) + sys.exit(p.returncode) diff --git a/build/scripts/ya.make b/build/scripts/ya.make index 5f19477098..710165e40d 100644 --- a/build/scripts/ya.make +++ b/build/scripts/ya.make @@ -10,44 +10,44 @@ TEST_SRCS( build_java_with_error_prone2.py build_mn.py build_pln_header.py - cat.py + cat.py cgo1_wrapper.py - check_config_h.py + check_config_h.py collect_java_srcs.py - compile_cuda.py - compile_java.py + compile_cuda.py + compile_java.py compile_jsrc.py compile_pysrc.py - configure_file.py + configure_file.py copy_files_to_dir.py - copy_to_dir.py - coverage-info.py + copy_to_dir.py + coverage-info.py cpp_flatc_wrapper.py - create_jcoverage_report.py + create_jcoverage_report.py extract_asrc.py extract_docs.py extract_jacoco_report.py - f2c.py + f2c.py fail_module_cmd.py fetch_from.py - fetch_from_external.py + fetch_from_external.py fetch_from_mds.py fetch_from_npm.py - fetch_from_sandbox.py - fetch_resource.py + fetch_from_sandbox.py + fetch_resource.py filter_zip.py - find_and_tar.py - fix_msvc_output.py - fs_tools.py + find_and_tar.py + fix_msvc_output.py + fs_tools.py gen_aar_gradle_script.py gen_java_codenav_entry.py gen_java_codenav_protobuf.py - gen_mx_table.py + gen_mx_table.py gen_py3_reg.py - gen_py_reg.py + gen_py_reg.py gen_test_apk_gradle_script.py - gen_ub.py - generate_pom.py + gen_ub.py + generate_pom.py go_proto_wrapper.py go_tool.py ios_wrapper.py @@ -55,43 +55,43 @@ TEST_SRCS( link_asrc.py link_dyn_lib.py link_exe.py - link_fat_obj.py - link_lib.py + link_fat_obj.py + link_lib.py llvm_opt_wrapper.py - merge_coverage_data.py + merge_coverage_data.py merge_files.py - mkdir.py + mkdir.py mkdocs_builder_wrapper.py - mkver.py + mkver.py pack_ios.py - pack_jcoverage_resources.py - perl_wrapper.py + pack_jcoverage_resources.py + perl_wrapper.py postprocess_go_fbs.py - preprocess.py - py_compile.py + preprocess.py + py_compile.py run_ios_simulator.py - run_javac.py + run_javac.py run_junit.py - run_llvm_dsymutil.py - run_msvc_wine.py - run_tool.py + run_llvm_dsymutil.py + run_msvc_wine.py + run_tool.py sky.py - stdout2stderr.py - symlink.py + stdout2stderr.py + symlink.py tar_directory.py tar_sources.py - tared_protoc.py - touch.py - unpacking_jtest_runner.py + tared_protoc.py + touch.py + unpacking_jtest_runner.py vcs_info.py with_coverage.py with_crash_on_timeout.py - with_pathsep_resolve.py + with_pathsep_resolve.py wrap_groovyc.py - wrapper.py - writer.py - xargs.py - yield_line.py + wrapper.py + writer.py + xargs.py + yield_line.py yndexer.py ) diff --git a/build/scripts/yield_line.py b/build/scripts/yield_line.py index ff47af4e3d..9c1c539146 100644 --- a/build/scripts/yield_line.py +++ b/build/scripts/yield_line.py @@ -1,7 +1,7 @@ import sys -if __name__ == '__main__': - pos = sys.argv.index('--') +if __name__ == '__main__': + pos = sys.argv.index('--') - with open(sys.argv[pos + 1], 'a') as f: - f.write(' '.join(sys.argv[pos + 2:]) + '\n') + with open(sys.argv[pos + 1], 'a') as f: + f.write(' '.join(sys.argv[pos + 2:]) + '\n') diff --git a/build/ya.conf.json b/build/ya.conf.json index 5dd350dbdc..5f7cc875d6 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -3901,7 +3901,7 @@ "default": true } ] - }, + }, "mvn": { "tools": { "mvn": { @@ -3930,13 +3930,13 @@ } ] }, - "fast_diff": { - "tools": { + "fast_diff": { + "tools": { "fast_diff": { "bottle": "fast_diff", "executable": "fast_diff" } - }, + }, "platforms": [ { "host": { @@ -3945,7 +3945,7 @@ "default": true } ] - }, + }, "cuda": { "tools": { "cuda": { @@ -4284,14 +4284,14 @@ "default": true } ] - }, + }, "allure_commandline": { - "tools": { + "tools": { "allure": { "bottle": "allure_commandline", "executable": "allure" } - }, + }, "platforms": [ { "host": { @@ -7111,7 +7111,7 @@ "ant" ] } - }, + }, "maven": { "formula": { "sandbox_id": 39222824, @@ -7125,10 +7125,10 @@ } }, "fast_diff": { - "formula": { - "sandbox_id": 42519064, - "match": "fast_diff" - } + "formula": { + "sandbox_id": 42519064, + "match": "fast_diff" + } }, "kiwi_protos": { "formula": { @@ -7137,7 +7137,7 @@ } }, "allure_commandline": { - "formula": { + "formula": { "sandbox_id": 569859192, "match": "Allure Commandline" }, @@ -7146,7 +7146,7 @@ "bin", "allure" ] - } + } }, "ctags": { "formula": { diff --git a/build/ymake.core.conf b/build/ymake.core.conf index d7541e352b..081833998b 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -1593,8 +1593,8 @@ module _LINK_UNIT: _BASE_UNIT { CHECK_PROVIDES() } -MODULE_TYPE=UNKNOWN - +MODULE_TYPE=UNKNOWN + macro ADD_CLANG_TIDY() { ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy) SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json) @@ -1960,8 +1960,8 @@ module BOOSTTEST: _BASE_PROGRAM { } ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING) SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json) -} - +} + # tag:deprecated ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated ### @@ -2024,8 +2024,8 @@ TEST_SRCS_VALUE= ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest macro TEST_SRCS(Tests...) { SET_APPEND(TEST_SRCS_VALUE $Tests) -} - +} + macro DISABLE_DATA_VALIDATION() { DISABLE(VALIDATE_DATA) } @@ -2044,8 +2044,8 @@ TEST_DATA_VALUE= macro DATA(Data...) { SET_APPEND(TEST_DATA_VALUE $Data) ADD_CHECK(check.data $Data) -} - +} + # tag:test TEST_TAGS_VALUE= ### @usage: TAG ([tag...]) @@ -2056,8 +2056,8 @@ TEST_TAGS_VALUE= ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija macro TAG(Tags...) { SET_APPEND(TEST_TAGS_VALUE $Tags) -} - +} + # tag:test TEST_REQUIREMENTS_VALUE= ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64]) @@ -2106,17 +2106,17 @@ TEST_PYTHON_PATH_VALUE= ### Set path to Python that will be used to runs scripts in tests macro PYTHON_PATH(Path) { SET(TEST_PYTHON_PATH_VALUE $Path) -} - +} + # tag:test -SKIP_TEST_VALUE= +SKIP_TEST_VALUE= ### @usage: SKIP_TEST(Reason) ### ### Skip the suite defined by test module. Provide a reason to be output in test execution report. macro SKIP_TEST(Reason...) { - SET(SKIP_TEST_VALUE $Reason) -} - + SET(SKIP_TEST_VALUE $Reason) +} + # tag:test LINT_LEVEL_VALUE=extended ### @usage: NO_LINT() @@ -2124,7 +2124,7 @@ LINT_LEVEL_VALUE=extended ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS. macro NO_LINT() { SET(LINT_LEVEL_VALUE none) -} +} ### @usage: LINT(<none|base|strict>) ### @@ -2132,7 +2132,7 @@ macro NO_LINT() { macro LINT(level) { SET(LINT_LEVEL_VALUE $level) } - + # tag:python-specific tag:test ### @usage: NO_DOCTESTS() ### @@ -2158,8 +2158,8 @@ module _BASE_PYTEST: _BASE_PY_PROGRAM { } SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json) -} - +} + # tag:python-specific tag:deprecated tag:test ### @usage: PYTEST_BIN() #deprecated ### @@ -2167,8 +2167,8 @@ module _BASE_PYTEST: _BASE_PY_PROGRAM { module PYTEST_BIN: _BASE_PYTEST { .NODE_TYPE=Program SETUP_PYTEST_BIN() -} - +} + # tag:python-specific tag:test ### @usage: PY2TEST([name]) ### @@ -2188,8 +2188,8 @@ module PY2TEST: PYTEST_BIN { } SET(MODULE_LANG PY2) ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.) -} - +} + # tag:python-specific tag:deprecated tag:test ### @usage: PY3TEST_BIN() #deprecated ### @@ -2198,7 +2198,7 @@ module PY3TEST_BIN: _BASE_PY3_PROGRAM { .NODE_TYPE=Program .FINAL_TARGET=no .ALLOWED=YT_SPEC NO_DOCTESTS - SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json) + SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json) SET(MODULE_LANG PY3) SETUP_PYTEST_BIN() PEERDIR+=library/python/pytest @@ -2258,8 +2258,8 @@ module GTEST_UGLY: _BASE_PROGRAM { PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest) ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest) SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json) -} - +} + # tag:test ### @usage: EXECTEST() ### @@ -2291,11 +2291,11 @@ module EXECTEST: _BARE_UNIT { .FINAL_TARGET=no .ALLOWED=YT_SPEC .RESTRICTED=FORK_TEST_FILES - SET(MODULE_SUFFIX .pkg.fake) - SETUP_EXECTEST() + SET(MODULE_SUFFIX .pkg.fake) + SETUP_EXECTEST() SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json) -} - +} + # tag:cpp-specific tag:test ### @usage: Y_BENCHMARK([benchmarkname]) ### @@ -4111,9 +4111,9 @@ module _BASE_PY_PROGRAM: _BASE_PROGRAM { .CMD=PY_PROGRAM_LINK_EXE _ARCADIA_PYTHON_ADDINCL() - when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { - NO_CHECK_IMPORTS_FOR_VALUE= - } + when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { + NO_CHECK_IMPORTS_FOR_VALUE= + } ADD_CHECK_PY_IMPORTS() when ($NO_PYTHON_INCLS != "yes") { @@ -4176,9 +4176,9 @@ module _BASE_PY3_PROGRAM: _BASE_PROGRAM { PEERDIR += contrib/tools/python3/src/Modules/_sqlite } - when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { - NO_CHECK_IMPORTS_FOR_VALUE= - } + when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") { + NO_CHECK_IMPORTS_FOR_VALUE= + } ADD_CHECK_PY_IMPORTS() when ($ARCH_PPC64LE == "yes") { @@ -5555,10 +5555,10 @@ FORK_TEST_FILES_MODE= ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/ macro FORK_TEST_FILES() { SET(FORK_TEST_FILES_MODE on) -} - +} + # tag:test -TEST_SIZE_NAME=SMALL +TEST_SIZE_NAME=SMALL ### @usage: SIZE(SMALL/MEDIUM/LARGE) ### ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list. @@ -7262,8 +7262,8 @@ TOUCH_PACKAGE=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc ligh _P_PK=${kv;hide:"p PK"} TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK TOUCH_JAVA_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"java $CURDIR"} $TARGET - -NO_CHECK_IMPORTS_FOR_VALUE=None + +NO_CHECK_IMPORTS_FOR_VALUE=None ### @usage: NO_CHECK_IMPORTS([patterns]) ### ### Do not run checks on imports of Python modules. |