diff options
author | snowball <snowball@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:32 +0300 |
commit | 4d57126b1bae3cfd0f4f95c32d1a85ca684ee92c (patch) | |
tree | 9aa76172d0e8abdf7c78fce6ec639c5d7e62b459 /build/plugins | |
parent | 249e91c445cb92462f9509d1ef2730b27629f43d (diff) | |
download | ydb-4d57126b1bae3cfd0f4f95c32d1a85ca684ee92c.tar.gz |
Restoring authorship annotation for <snowball@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/plugins')
-rw-r--r-- | build/plugins/_common.py | 6 | ||||
-rw-r--r-- | build/plugins/_requirements.py | 74 | ||||
-rw-r--r-- | build/plugins/_test_const.py | 278 | ||||
-rw-r--r-- | build/plugins/_xsyn_includes.py | 2 | ||||
-rw-r--r-- | build/plugins/build_mn_files.py | 2 | ||||
-rw-r--r-- | build/plugins/cp.py | 12 | ||||
-rw-r--r-- | build/plugins/create_init_py.py | 14 | ||||
-rw-r--r-- | build/plugins/lib/_metric_resolvers.py | 22 | ||||
-rw-r--r-- | build/plugins/print_module_type.py | 2 | ||||
-rw-r--r-- | build/plugins/pybuild.py | 16 | ||||
-rw-r--r-- | build/plugins/split_codegen.py | 2 | ||||
-rw-r--r-- | build/plugins/swig.py | 2 | ||||
-rw-r--r-- | build/plugins/tests/test_common.py | 98 | ||||
-rw-r--r-- | build/plugins/tests/test_requirements.py | 102 | ||||
-rw-r--r-- | build/plugins/tests/ya.make | 26 | ||||
-rw-r--r-- | build/plugins/ya.make | 20 | ||||
-rw-r--r-- | build/plugins/yql_python_udf.py | 12 | ||||
-rw-r--r-- | build/plugins/ytest.py | 98 |
18 files changed, 394 insertions, 394 deletions
diff --git a/build/plugins/_common.py b/build/plugins/_common.py index 2f831a94db..11e87a7d34 100644 --- a/build/plugins/_common.py +++ b/build/plugins/_common.py @@ -185,9 +185,9 @@ def filter_out_by_keyword(test_data, keyword): return list(_iterate()) -def generate_chunks(lst, chunk_size): - for i in xrange(0, len(lst), chunk_size): - yield lst[i:(i + chunk_size)] +def generate_chunks(lst, chunk_size): + for i in xrange(0, len(lst), chunk_size): + yield lst[i:(i + chunk_size)] def strip_roots(path): diff --git a/build/plugins/_requirements.py b/build/plugins/_requirements.py index c27635e852..a10b75110f 100644 --- a/build/plugins/_requirements.py +++ b/build/plugins/_requirements.py @@ -1,49 +1,49 @@ -import _test_const as consts - - -def check_cpu(suite_cpu_requirements, test_size, is_kvm=False): - min_cpu_requirements = consts.TestRequirementsConstants.MinCpu - max_cpu_requirements = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) - if isinstance(suite_cpu_requirements, str): - if all(consts.TestRequirementsConstants.is_all_cpu(req) for req in (max_cpu_requirements, suite_cpu_requirements)): +import _test_const as consts + + +def check_cpu(suite_cpu_requirements, test_size, is_kvm=False): + min_cpu_requirements = consts.TestRequirementsConstants.MinCpu + max_cpu_requirements = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) + if isinstance(suite_cpu_requirements, str): + if all(consts.TestRequirementsConstants.is_all_cpu(req) for req in (max_cpu_requirements, suite_cpu_requirements)): return None return "Wrong 'cpu' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_cpu_requirements, min_cpu_requirements, max_cpu_requirements, test_size) - - if not isinstance(suite_cpu_requirements, int): + + if not isinstance(suite_cpu_requirements, int): return "Wrong 'cpu' requirements: {}, should be integer".format(suite_cpu_requirements) - - if suite_cpu_requirements < min_cpu_requirements or suite_cpu_requirements > consts.TestRequirementsConstants.get_cpu_value(max_cpu_requirements): + + if suite_cpu_requirements < min_cpu_requirements or suite_cpu_requirements > consts.TestRequirementsConstants.get_cpu_value(max_cpu_requirements): return "Wrong 'cpu' requirement: {}, should be in [{}..{}] for {}-size tests".format(suite_cpu_requirements, min_cpu_requirements, max_cpu_requirements, test_size) - + return None - - -# TODO: Remove is_kvm param when there will be guarantees on RAM -def check_ram(suite_ram_requirements, test_size, is_kvm=False): - if not isinstance(suite_ram_requirements, int): + + +# TODO: Remove is_kvm param when there will be guarantees on RAM +def check_ram(suite_ram_requirements, test_size, is_kvm=False): + if not isinstance(suite_ram_requirements, int): return "Wrong 'ram' requirements: {}, should be integer".format(suite_ram_requirements) - min_ram_requirements = consts.TestRequirementsConstants.MinRam - max_ram_requirements = consts.MAX_RAM_REQUIREMENTS_FOR_KVM if is_kvm else consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) - if suite_ram_requirements < min_ram_requirements or suite_ram_requirements > max_ram_requirements: - err_msg = "Wrong 'ram' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_requirements, min_ram_requirements, max_ram_requirements, test_size) - if is_kvm: - err_msg += ' with kvm requirements' - return err_msg + min_ram_requirements = consts.TestRequirementsConstants.MinRam + max_ram_requirements = consts.MAX_RAM_REQUIREMENTS_FOR_KVM if is_kvm else consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) + if suite_ram_requirements < min_ram_requirements or suite_ram_requirements > max_ram_requirements: + err_msg = "Wrong 'ram' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_requirements, min_ram_requirements, max_ram_requirements, test_size) + if is_kvm: + err_msg += ' with kvm requirements' + return err_msg return None - - -def check_ram_disk(suite_ram_disk, test_size, is_kvm=False): - min_ram_disk = consts.TestRequirementsConstants.MinRamDisk - max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) - if isinstance(suite_ram_disk, str): - if all(consts.TestRequirementsConstants.is_all_ram_disk(req) for req in (max_ram_disk, suite_ram_disk)): + + +def check_ram_disk(suite_ram_disk, test_size, is_kvm=False): + min_ram_disk = consts.TestRequirementsConstants.MinRamDisk + max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) + if isinstance(suite_ram_disk, str): + if all(consts.TestRequirementsConstants.is_all_ram_disk(req) for req in (max_ram_disk, suite_ram_disk)): return None return "Wrong 'ram_disk' requirements: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_disk, 0, max_ram_disk, test_size) - - if not isinstance(suite_ram_disk, int): + + if not isinstance(suite_ram_disk, int): return "Wrong 'ram_disk' requirements: {}, should be integer".format(suite_ram_disk) - - if suite_ram_disk < min_ram_disk or suite_ram_disk > consts.TestRequirementsConstants.get_ram_disk_value(max_ram_disk): + + if suite_ram_disk < min_ram_disk or suite_ram_disk > consts.TestRequirementsConstants.get_ram_disk_value(max_ram_disk): return "Wrong 'ram_disk' requirement: {}, should be in [{}..{}] for {}-size tests".format(suite_ram_disk, min_ram_disk, max_ram_disk, test_size) - + return None diff --git a/build/plugins/_test_const.py b/build/plugins/_test_const.py index 0d03cc3d17..62683d40f8 100644 --- a/build/plugins/_test_const.py +++ b/build/plugins/_test_const.py @@ -1,5 +1,5 @@ # coding: utf-8 -import re +import re import sys @@ -24,25 +24,25 @@ REPORT_SNIPPET_LIMIT = 10000 SANITIZER_ERROR_RC = 100 TEST_SUBTEST_SEPARATOR = '::' TESTING_OUT_DIR_NAME = "testing_out_stuff" -TESTING_OUT_TAR_NAME = TESTING_OUT_DIR_NAME + ".tar" +TESTING_OUT_TAR_NAME = TESTING_OUT_DIR_NAME + ".tar" TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S.%f" TRACE_FILE_NAME = "ytest.report.trace" TRUNCATING_IGNORE_FILE_LIST = {TRACE_FILE_NAME, "run_test.log"} -# kvm -DEFAULT_RAM_REQUIREMENTS_FOR_KVM = 4 -MAX_RAM_REQUIREMENTS_FOR_KVM = 16 - -# distbuild -TEST_NODE_FINISHING_TIME = 5 * 60 -DEFAULT_TEST_NODE_TIMEOUT = 15 * 60 - +# kvm +DEFAULT_RAM_REQUIREMENTS_FOR_KVM = 4 +MAX_RAM_REQUIREMENTS_FOR_KVM = 16 + +# distbuild +TEST_NODE_FINISHING_TIME = 5 * 60 +DEFAULT_TEST_NODE_TIMEOUT = 15 * 60 + # coverage -COVERAGE_TESTS_TIMEOUT_FACTOR = 1.5 -COVERAGE_RESOLVED_FILE_NAME_PATTERN = "coverage_resolved.{}.json" -CPP_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("cpp") -JAVA_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("java") -PYTHON_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("python") +COVERAGE_TESTS_TIMEOUT_FACTOR = 1.5 +COVERAGE_RESOLVED_FILE_NAME_PATTERN = "coverage_resolved.{}.json" +CPP_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("cpp") +JAVA_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("java") +PYTHON_COVERAGE_RESOLVED_FILE_NAME = COVERAGE_RESOLVED_FILE_NAME_PATTERN.format("python") CLANG_COVERAGE_TEST_TYPES = ("unittest", "coverage_extractor", "pytest", "py3test", "gtest", "boost_test", "exectest") COVERAGE_TABLE_CHUNKS = 20 COVERAGE_YT_PROXY = "hahn.yt.yandex.net" @@ -55,26 +55,26 @@ CORPUS_DATA_ROOT_DIR = 'fuzzing' CORPUS_DIR_NAME = 'corpus' FUZZING_COMPRESSION_COEF = 1.1 FUZZING_DEFAULT_TIMEOUT = 3600 -FUZZING_FINISHING_TIME = 600 +FUZZING_FINISHING_TIME = 600 FUZZING_TIMEOUT_RE = re.compile(r'(^|\s)-max_total_time=(?P<max_time>\d+)') GENERATED_CORPUS_DIR_NAME = 'mined_corpus' MAX_CORPUS_RESOURCES_ALLOWED = 5 -TEST_TOOL_HOST = 'TEST_TOOL_HOST_RESOURCE_GLOBAL' -TEST_TOOL_TARGET = 'TEST_TOOL_TARGET_RESOURCE_GLOBAL' -TEST_TOOL_HOST_LOCAL = 'TEST_TOOL_HOST_LOCAL' -TEST_TOOL_TARGET_LOCAL = 'TEST_TOOL_TARGET_LOCAL' -XCODE_TOOLS_RESOURCE = 'XCODE_TOOLS_ROOT_RESOURCE_GLOBAL' -GO_TOOLS_RESOURCE = 'GO_TOOLS_RESOURCE_GLOBAL' -LLVM_COV9_RESOURCE = 'LLVM_COV9_RESOURCE_GLOBAL' -PEP8_PY2_RESOURCE = 'PEP8_PY2_RESOURCE_GLOBAL' -PEP8_PY3_RESOURCE = 'PEP8_PY3_RESOURCE_GLOBAL' -FLAKES_PY2_RESOURCE = 'FLAKES_PY2_RESOURCE_GLOBAL' -FLAKES_PY3_RESOURCE = 'FLAKES_PY3_RESOURCE_GLOBAL' +TEST_TOOL_HOST = 'TEST_TOOL_HOST_RESOURCE_GLOBAL' +TEST_TOOL_TARGET = 'TEST_TOOL_TARGET_RESOURCE_GLOBAL' +TEST_TOOL_HOST_LOCAL = 'TEST_TOOL_HOST_LOCAL' +TEST_TOOL_TARGET_LOCAL = 'TEST_TOOL_TARGET_LOCAL' +XCODE_TOOLS_RESOURCE = 'XCODE_TOOLS_ROOT_RESOURCE_GLOBAL' +GO_TOOLS_RESOURCE = 'GO_TOOLS_RESOURCE_GLOBAL' +LLVM_COV9_RESOURCE = 'LLVM_COV9_RESOURCE_GLOBAL' +PEP8_PY2_RESOURCE = 'PEP8_PY2_RESOURCE_GLOBAL' +PEP8_PY3_RESOURCE = 'PEP8_PY3_RESOURCE_GLOBAL' +FLAKES_PY2_RESOURCE = 'FLAKES_PY2_RESOURCE_GLOBAL' +FLAKES_PY3_RESOURCE = 'FLAKES_PY3_RESOURCE_GLOBAL' FLAKE8_PY2_RESOURCE = 'FLAKE8_PY2_RESOURCE_GLOBAL' FLAKE8_PY3_RESOURCE = 'FLAKE8_PY3_RESOURCE_GLOBAL' - + class Enum(object): @classmethod @@ -82,134 +82,134 @@ class Enum(object): return [v for k, v in cls.__dict__.items() if not k.startswith("_")] -class TestRequirements(Enum): - Container = 'container' - Cpu = 'cpu' - DiskUsage = 'disk_usage' - Ram = 'ram' - RamDisk = 'ram_disk' - SbVault = 'sb_vault' - Network = 'network' - Dns = 'dns' - Kvm = 'kvm' - - -class TestRequirementsConstants(Enum): - All = 'all' - AllCpuValue = 50 - AllRamDiskValue = 50 - MinCpu = 1 - MinRam = 1 - MinRamDisk = 0 - - @classmethod - def is_all_cpu(cls, value): - return value == cls.All - - @classmethod - def get_cpu_value(cls, value): - return cls.AllCpuValue if cls.is_all_cpu(value) else value - - @classmethod - def is_all_ram_disk(cls, value): - return value == cls.All - - @classmethod - def get_ram_disk_value(cls, value): - return cls.AllRamDiskValue if cls.is_all_ram_disk(value) else value - - +class TestRequirements(Enum): + Container = 'container' + Cpu = 'cpu' + DiskUsage = 'disk_usage' + Ram = 'ram' + RamDisk = 'ram_disk' + SbVault = 'sb_vault' + Network = 'network' + Dns = 'dns' + Kvm = 'kvm' + + +class TestRequirementsConstants(Enum): + All = 'all' + AllCpuValue = 50 + AllRamDiskValue = 50 + MinCpu = 1 + MinRam = 1 + MinRamDisk = 0 + + @classmethod + def is_all_cpu(cls, value): + return value == cls.All + + @classmethod + def get_cpu_value(cls, value): + return cls.AllCpuValue if cls.is_all_cpu(value) else value + + @classmethod + def is_all_ram_disk(cls, value): + return value == cls.All + + @classmethod + def get_ram_disk_value(cls, value): + return cls.AllRamDiskValue if cls.is_all_ram_disk(value) else value + + class TestSize(Enum): Small = 'small' Medium = 'medium' Large = 'large' - DefaultTimeouts = { + DefaultTimeouts = { Small: 60, Medium: 600, Large: 3600, } - DefaultPriorities = { - Small: -1, - Medium: -2, - Large: -3, - } - - DefaultRequirements = { - Small: { - TestRequirements.Cpu: 1, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 2, - TestRequirements.RamDisk: 0, - }, - Medium: { - TestRequirements.Cpu: 1, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 4, - TestRequirements.RamDisk: 0, - }, - Large: { - TestRequirements.Cpu: 1, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 8, - TestRequirements.RamDisk: 0, - }, - } - - MaxRequirements = { - Small: { - TestRequirements.Cpu: 4, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 4, - TestRequirements.RamDisk: 4, - }, - Medium: { - TestRequirements.Cpu: 4, - # TestRequirements.Cpu: 8, - TestRequirements.Ram: 32, - # TestRequirements.Ram: 16, - TestRequirements.RamDisk: 4, - }, - Large: { + DefaultPriorities = { + Small: -1, + Medium: -2, + Large: -3, + } + + DefaultRequirements = { + Small: { + TestRequirements.Cpu: 1, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 2, + TestRequirements.RamDisk: 0, + }, + Medium: { + TestRequirements.Cpu: 1, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 4, + TestRequirements.RamDisk: 0, + }, + Large: { + TestRequirements.Cpu: 1, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 8, + TestRequirements.RamDisk: 0, + }, + } + + MaxRequirements = { + Small: { + TestRequirements.Cpu: 4, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 4, + TestRequirements.RamDisk: 4, + }, + Medium: { + TestRequirements.Cpu: 4, + # TestRequirements.Cpu: 8, + TestRequirements.Ram: 32, + # TestRequirements.Ram: 16, + TestRequirements.RamDisk: 4, + }, + Large: { TestRequirements.Cpu: 4, - TestRequirements.Ram: 32, - TestRequirements.RamDisk: 4, - }, - } - + TestRequirements.Ram: 32, + TestRequirements.RamDisk: 4, + }, + } + @classmethod def sizes(cls): - return cls.DefaultTimeouts.keys() + return cls.DefaultTimeouts.keys() @classmethod def get_default_timeout(cls, size): - if size in cls.DefaultTimeouts: - return cls.DefaultTimeouts[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: - return cls.DefaultRequirements[size] + if size in cls.DefaultTimeouts: + return cls.DefaultTimeouts[size] raise Exception("Unknown test size '{}'".format(size)) - @classmethod - def get_max_requirements(cls, size): - if size in cls.MaxRequirements: - return cls.MaxRequirements[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: + return cls.DefaultRequirements[size] + raise Exception("Unknown test size '{}'".format(size)) + + @classmethod + def get_max_requirements(cls, size): + if size in cls.MaxRequirements: + return cls.MaxRequirements[size] + raise Exception("Unknown test size '{}'".format(size)) + + class TestRunExitCode(Enum): Skipped = 2 - Failed = 3 + Failed = 3 TimeOut = 10 InfrastructureError = 12 @@ -223,8 +223,8 @@ class YaTestTags(Enum): Fat = "ya:fat" RunWithAsserts = "ya:relwithdebinfo" Privileged = "ya:privileged" - ExoticPlatform = "ya:exotic_platform" - NotAutocheck = "ya:not_autocheck" + ExoticPlatform = "ya:exotic_platform" + NotAutocheck = "ya:not_autocheck" class Status(object): @@ -256,7 +256,7 @@ class _Colors(object): "white", "yellow", ] - _PREFIXES = ["", "light", "dark"] + _PREFIXES = ["", "light", "dark"] def __init__(self): self._table = {} diff --git a/build/plugins/_xsyn_includes.py b/build/plugins/_xsyn_includes.py index 8d33cea2f0..ce23222a93 100644 --- a/build/plugins/_xsyn_includes.py +++ b/build/plugins/_xsyn_includes.py @@ -48,7 +48,7 @@ def process_xsyn(filepath, on_element): # keep a stack of filepathes if on_element calls process_xsyn recursively with open(filepath) as xsyn_file: - from xml.dom.minidom import parse + from xml.dom.minidom import parse tree = parse(xsyn_file) tree.normalize() res = traverse_xsyn(tree, on_element) diff --git a/build/plugins/build_mn_files.py b/build/plugins/build_mn_files.py index 4da76f1852..207339ae24 100644 --- a/build/plugins/build_mn_files.py +++ b/build/plugins/build_mn_files.py @@ -1,6 +1,6 @@ from os.path import basename, splitext - + def on_build_mns_files(unit, *args): files = [] name = '' diff --git a/build/plugins/cp.py b/build/plugins/cp.py index 5c663a3bdd..7341204cff 100644 --- a/build/plugins/cp.py +++ b/build/plugins/cp.py @@ -4,12 +4,12 @@ from _common import sort_by_keywords def oncopy(unit, *args): - keywords = {'RESULT': 1, 'KEEP_DIR_STRUCT': 0, 'DESTINATION': 1, 'FROM': 1} + keywords = {'RESULT': 1, 'KEEP_DIR_STRUCT': 0, 'DESTINATION': 1, 'FROM': 1} flat_args, spec_args = sort_by_keywords(keywords, args) dest_dir = spec_args['DESTINATION'][0] if 'DESTINATION' in spec_args else '' - from_dir = spec_args['FROM'][0] if 'FROM' in spec_args else '' + from_dir = spec_args['FROM'][0] if 'FROM' in spec_args else '' keep_struct = 'KEEP_DIR_STRUCT' in spec_args save_in_var = 'RESULT' in spec_args targets = [] @@ -21,10 +21,10 @@ def oncopy(unit, *args): if keep_struct: if path_list[:-1]: rel_path = os.path.join(*path_list[:-1]) - source_path = os.path.join(from_dir, rel_path, filename) - target_path = os.path.join(dest_dir, rel_path, filename) + source_path = os.path.join(from_dir, rel_path, filename) + target_path = os.path.join(dest_dir, rel_path, filename) if save_in_var: - targets.append(target_path) - unit.oncopy_file([source_path, target_path]) + targets.append(target_path) + unit.oncopy_file([source_path, target_path]) if save_in_var: unit.set([spec_args["RESULT"][0], " ".join(targets)]) diff --git a/build/plugins/create_init_py.py b/build/plugins/create_init_py.py index e41a4d22df..90d61c4c25 100644 --- a/build/plugins/create_init_py.py +++ b/build/plugins/create_init_py.py @@ -3,13 +3,13 @@ import os from _common import sort_by_keywords -def oncreate_init_py_structure(unit, *args): +def oncreate_init_py_structure(unit, *args): if unit.get('DISTBUILD'): return - target_dir = unit.get('PY_PROTOS_FOR_DIR') - path_list = target_dir.split(os.path.sep)[1:] - inits = [os.path.join("${ARCADIA_BUILD_ROOT}", '__init__.py')] - for i in range(1, len(path_list) + 1): - inits.append(os.path.join("${ARCADIA_BUILD_ROOT}", os.path.join(*path_list[0:i]), '__init__.py')) - unit.ontouch(inits) + target_dir = unit.get('PY_PROTOS_FOR_DIR') + path_list = target_dir.split(os.path.sep)[1:] + inits = [os.path.join("${ARCADIA_BUILD_ROOT}", '__init__.py')] + for i in range(1, len(path_list) + 1): + inits.append(os.path.join("${ARCADIA_BUILD_ROOT}", os.path.join(*path_list[0:i]), '__init__.py')) + unit.ontouch(inits) diff --git a/build/plugins/lib/_metric_resolvers.py b/build/plugins/lib/_metric_resolvers.py index 270eb78345..7c5ea4a9ea 100644 --- a/build/plugins/lib/_metric_resolvers.py +++ b/build/plugins/lib/_metric_resolvers.py @@ -1,11 +1,11 @@ -import re - -VALUE_PATTERN = re.compile(r"^\s*(?P<value>\d+)\s*$") - - -def resolve_value(val): - match = VALUE_PATTERN.match(val) - if not match: - return None - val = match.group('value') - return int(val) +import re + +VALUE_PATTERN = re.compile(r"^\s*(?P<value>\d+)\s*$") + + +def resolve_value(val): + match = VALUE_PATTERN.match(val) + if not match: + return None + val = match.group('value') + return int(val) diff --git a/build/plugins/print_module_type.py b/build/plugins/print_module_type.py index cc54c55675..723970609d 100644 --- a/build/plugins/print_module_type.py +++ b/build/plugins/print_module_type.py @@ -1,5 +1,5 @@ def onprint_module_type(unit, *args): filepath = unit.get('KIWI_OUT_FILE') - if len(args) >= 2 and filepath is not None: + if len(args) >= 2 and filepath is not None: with open(filepath, "a") as file_handler: print >>file_handler, "{0} {1} {2}".format(args[0], args[1], unit.path()) diff --git a/build/plugins/pybuild.py b/build/plugins/pybuild.py index f32a2d39a0..5639da6fb0 100644 --- a/build/plugins/pybuild.py +++ b/build/plugins/pybuild.py @@ -48,10 +48,10 @@ def proto_arg(path, mod, unit): def pb_cc_arg(suf, path, unit): return '{}{suf}'.format(stripext(to_build_root(path, unit)), suf=suf) - -def ev_cc_arg(path, unit): - return '{}.ev.pb.cc'.format(stripext(to_build_root(path, unit))) - + +def ev_cc_arg(path, unit): + return '{}.ev.pb.cc'.format(stripext(to_build_root(path, unit))) + def ev_arg(path, mod, unit): return '{}__int___ev_pb2.py={}_ev_pb2'.format(stripext(to_build_root(path, unit)), mod) @@ -301,9 +301,9 @@ def onpy_srcs(unit, *args): else: if arg.startswith('../'): ymake.report_configure_error('PY_SRCS item starts with "../": {!r}'.format(arg)) - if arg.startswith('/'): - ymake.report_configure_error('PY_SRCS item starts with "/": {!r}'.format(arg)) - continue + if arg.startswith('/'): + ymake.report_configure_error('PY_SRCS item starts with "/": {!r}'.format(arg)) + continue mod_name = stripext(arg).replace('/', '.') if py3 and path.endswith('.py') and is_extended_source_search_enabled(path, unit): # Dig out real path from the file path. Unit.path is not enough because of SRCDIR and ADDINCL @@ -499,7 +499,7 @@ def onpy_srcs(unit, *args): unit.onpeerdir(unit.get("PY_PROTO_DEPS").split()) - proto_paths = [path for path, mod in protos] + proto_paths = [path for path, mod in protos] unit.on_generate_py_protos_internal(proto_paths) unit.onpy_srcs([ pb2_arg(py_suf, path, mod, unit) diff --git a/build/plugins/split_codegen.py b/build/plugins/split_codegen.py index f1e60bc142..03c534c834 100644 --- a/build/plugins/split_codegen.py +++ b/build/plugins/split_codegen.py @@ -4,7 +4,7 @@ from _common import sort_by_keywords _DEFAULT_CPP_PARTS = 20 # See TCodegenParams::MethodStream usage in factor codegen _ADDITIONAL_STREAM_COUNT = 5 - + def onsplit_codegen(unit, *args): ''' diff --git a/build/plugins/swig.py b/build/plugins/swig.py index 32a37204a6..6dd30a1ff2 100644 --- a/build/plugins/swig.py +++ b/build/plugins/swig.py @@ -49,7 +49,7 @@ class Swig(iw.CustomCommand): self._library_dir ] self._incl_dirs = ['$S', '$B'] + [posixpath.join('$S', d) for d in incl_dirs] - + modname = unit.get('REALPRJNAME') self._flags.extend(['-module', modname]) diff --git a/build/plugins/tests/test_common.py b/build/plugins/tests/test_common.py index e1780354f8..6490b6d7c4 100644 --- a/build/plugins/tests/test_common.py +++ b/build/plugins/tests/test_common.py @@ -1,49 +1,49 @@ -import pytest - -import build.plugins._common as pc - - -def test_sort_by_keywords(): - keywords = {'KEY1': 2, 'KEY2': 0, 'KEY3': 1} - args = 'aaaa bbbb KEY2 KEY1 kkk10 kkk11 ccc ddd KEY3 kkk3 eee'.split() - flat, spec = pc.sort_by_keywords(keywords, args) - assert flat == ['aaaa', 'bbbb', 'ccc', 'ddd', 'eee'] - assert spec == {'KEY1': ['kkk10', 'kkk11'], 'KEY2': True, 'KEY3': ['kkk3']} - - keywords = {'KEY1': 0, 'KEY2': 4} - args = 'aaaa KEY2 eee'.split() - flat, spec = pc.sort_by_keywords(keywords, args) - assert flat == ['aaaa'] - assert spec == {'KEY2': ['eee']} - - keywords = {'KEY1': 2, 'KEY2': 2} - args = 'KEY1 k10 KEY2 k20 KEY1 k11 KEY2 k21 KEY1 k13'.split() - flat, spec = pc.sort_by_keywords(keywords, args) - assert flat == [] - assert spec == {'KEY1': ['k10', 'k11', 'k13'], 'KEY2': ['k20', 'k21']} - - -def test_filter_out_by_keyword(): - assert pc.filter_out_by_keyword([], 'A') == [] - assert pc.filter_out_by_keyword(['x'], 'A') == ['x'] - assert pc.filter_out_by_keyword(['x', 'A'], 'A') == ['x'] - assert pc.filter_out_by_keyword(['x', 'A', 'B'], 'A') == ['x'] - assert pc.filter_out_by_keyword(['x', 'A', 'B', 'y'], 'A') == ['x', 'y'] - assert pc.filter_out_by_keyword(['x', 'A', 'A', 'y'], 'A') == ['x', 'y'] - assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A'], 'A') == ['x'] - assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y'], 'A') == ['x', 'y'] - assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y', 'A'], 'A') == ['x', 'y'] - assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y', 'A', 'F', 'z'], 'A') == ['x', 'y', 'z'] - - -test_data = [ - [[1, 2, 3], 1, [[1], [2], [3]]], - [[1, 2, 3], 2, [[1, 2], [3]]], - [[1, 2, 3, 4], 2, [[1, 2], [3, 4]]], - [[1], 5, [[1]]], -] - - -@pytest.mark.parametrize('lst, chunk_size, expected', test_data, ids=[str(num + 1) for num in range(len(test_data))]) -def test_generate_chunks(lst, chunk_size, expected): - assert list(pc.generate_chunks(lst, chunk_size)) == expected +import pytest + +import build.plugins._common as pc + + +def test_sort_by_keywords(): + keywords = {'KEY1': 2, 'KEY2': 0, 'KEY3': 1} + args = 'aaaa bbbb KEY2 KEY1 kkk10 kkk11 ccc ddd KEY3 kkk3 eee'.split() + flat, spec = pc.sort_by_keywords(keywords, args) + assert flat == ['aaaa', 'bbbb', 'ccc', 'ddd', 'eee'] + assert spec == {'KEY1': ['kkk10', 'kkk11'], 'KEY2': True, 'KEY3': ['kkk3']} + + keywords = {'KEY1': 0, 'KEY2': 4} + args = 'aaaa KEY2 eee'.split() + flat, spec = pc.sort_by_keywords(keywords, args) + assert flat == ['aaaa'] + assert spec == {'KEY2': ['eee']} + + keywords = {'KEY1': 2, 'KEY2': 2} + args = 'KEY1 k10 KEY2 k20 KEY1 k11 KEY2 k21 KEY1 k13'.split() + flat, spec = pc.sort_by_keywords(keywords, args) + assert flat == [] + assert spec == {'KEY1': ['k10', 'k11', 'k13'], 'KEY2': ['k20', 'k21']} + + +def test_filter_out_by_keyword(): + assert pc.filter_out_by_keyword([], 'A') == [] + assert pc.filter_out_by_keyword(['x'], 'A') == ['x'] + assert pc.filter_out_by_keyword(['x', 'A'], 'A') == ['x'] + assert pc.filter_out_by_keyword(['x', 'A', 'B'], 'A') == ['x'] + assert pc.filter_out_by_keyword(['x', 'A', 'B', 'y'], 'A') == ['x', 'y'] + assert pc.filter_out_by_keyword(['x', 'A', 'A', 'y'], 'A') == ['x', 'y'] + assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A'], 'A') == ['x'] + assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y'], 'A') == ['x', 'y'] + assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y', 'A'], 'A') == ['x', 'y'] + assert pc.filter_out_by_keyword(['x', 'A', 'A', 'A', 'B', 'y', 'A', 'F', 'z'], 'A') == ['x', 'y', 'z'] + + +test_data = [ + [[1, 2, 3], 1, [[1], [2], [3]]], + [[1, 2, 3], 2, [[1, 2], [3]]], + [[1, 2, 3, 4], 2, [[1, 2], [3, 4]]], + [[1], 5, [[1]]], +] + + +@pytest.mark.parametrize('lst, chunk_size, expected', test_data, ids=[str(num + 1) for num in range(len(test_data))]) +def test_generate_chunks(lst, chunk_size, expected): + assert list(pc.generate_chunks(lst, chunk_size)) == expected diff --git a/build/plugins/tests/test_requirements.py b/build/plugins/tests/test_requirements.py index 24d57ac901..4cc913ec15 100644 --- a/build/plugins/tests/test_requirements.py +++ b/build/plugins/tests/test_requirements.py @@ -1,52 +1,52 @@ -import pytest - -import build.plugins._requirements as requirements -import build.plugins._test_const as consts - - -class TestRequirements(object): - @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) - def test_cpu(self, test_size): - max_cpu = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) - min_cpu = consts.TestRequirementsConstants.MinCpu - assert requirements.check_cpu(-1, test_size) - assert requirements.check_cpu(min_cpu - 1, test_size) - assert requirements.check_cpu("unknown", test_size) - assert not requirements.check_cpu(1, test_size) - assert not requirements.check_cpu(3, test_size) - assert requirements.check_cpu(1000, test_size) - if max_cpu != consts.TestRequirementsConstants.All: - assert requirements.check_cpu(max_cpu + 1, test_size) - assert requirements.check_cpu(max_cpu + 4, test_size) - assert requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) - else: - assert not requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) - - @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) - def test_ram(self, test_size): - max_ram = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) - min_ram = consts.TestRequirementsConstants.MinRam - assert requirements.check_ram(-1, test_size) - assert requirements.check_ram(min_ram - 1, test_size) - assert requirements.check_ram(max_ram + 1, test_size) - assert not requirements.check_ram(1, test_size) - assert not requirements.check_ram(4, test_size) - assert not requirements.check_ram(5, test_size) +import pytest + +import build.plugins._requirements as requirements +import build.plugins._test_const as consts + + +class TestRequirements(object): + @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) + def test_cpu(self, test_size): + max_cpu = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Cpu) + min_cpu = consts.TestRequirementsConstants.MinCpu + assert requirements.check_cpu(-1, test_size) + assert requirements.check_cpu(min_cpu - 1, test_size) + assert requirements.check_cpu("unknown", test_size) + assert not requirements.check_cpu(1, test_size) + assert not requirements.check_cpu(3, test_size) + assert requirements.check_cpu(1000, test_size) + if max_cpu != consts.TestRequirementsConstants.All: + assert requirements.check_cpu(max_cpu + 1, test_size) + assert requirements.check_cpu(max_cpu + 4, test_size) + assert requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) + else: + assert not requirements.check_cpu(consts.TestRequirementsConstants.All, test_size) + + @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) + def test_ram(self, test_size): + max_ram = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.Ram) + min_ram = consts.TestRequirementsConstants.MinRam + assert requirements.check_ram(-1, test_size) + assert requirements.check_ram(min_ram - 1, test_size) + assert requirements.check_ram(max_ram + 1, test_size) + assert not requirements.check_ram(1, test_size) + assert not requirements.check_ram(4, test_size) + assert not requirements.check_ram(5, test_size) assert not requirements.check_ram(32, consts.TestSize.Large) - assert requirements.check_ram(48, consts.TestSize.Large) - - assert not requirements.check_ram(1, test_size, is_kvm=True) - assert not requirements.check_ram(4, test_size, is_kvm=True) - assert not requirements.check_ram(16, test_size, is_kvm=True) - assert requirements.check_ram(32, test_size, is_kvm=True) - - @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) - def test_ram_disk(self, test_size): - max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) - min_ram_disk = consts.TestRequirementsConstants.MinRamDisk - assert requirements.check_ram_disk(-1, test_size) - assert requirements.check_ram_disk(min_ram_disk - 1, test_size) - assert requirements.check_ram_disk(max_ram_disk + 1, test_size) - assert requirements.check_ram_disk(8, test_size) - assert not requirements.check_ram_disk(1, test_size) - assert not requirements.check_ram_disk(4, test_size) + assert requirements.check_ram(48, consts.TestSize.Large) + + assert not requirements.check_ram(1, test_size, is_kvm=True) + assert not requirements.check_ram(4, test_size, is_kvm=True) + assert not requirements.check_ram(16, test_size, is_kvm=True) + assert requirements.check_ram(32, test_size, is_kvm=True) + + @pytest.mark.parametrize('test_size', consts.TestSize.sizes()) + def test_ram_disk(self, test_size): + max_ram_disk = consts.TestSize.get_max_requirements(test_size).get(consts.TestRequirements.RamDisk) + min_ram_disk = consts.TestRequirementsConstants.MinRamDisk + assert requirements.check_ram_disk(-1, test_size) + assert requirements.check_ram_disk(min_ram_disk - 1, test_size) + assert requirements.check_ram_disk(max_ram_disk + 1, test_size) + assert requirements.check_ram_disk(8, test_size) + assert not requirements.check_ram_disk(1, test_size) + assert not requirements.check_ram_disk(4, test_size) diff --git a/build/plugins/tests/ya.make b/build/plugins/tests/ya.make index 87228b98df..d42a278fe6 100644 --- a/build/plugins/tests/ya.make +++ b/build/plugins/tests/ya.make @@ -1,16 +1,16 @@ PY2TEST() - -OWNER(g:yatool) - -PEERDIR( - build/plugins -) - -TEST_SRCS( + +OWNER(g:yatool) + +PEERDIR( + build/plugins +) + +TEST_SRCS( test_code_generator.py - test_common.py - test_requirements.py + test_common.py + test_requirements.py test_ssqls.py -) - -END() +) + +END() diff --git a/build/plugins/ya.make b/build/plugins/ya.make index 4ad5f5988e..106476752d 100644 --- a/build/plugins/ya.make +++ b/build/plugins/ya.make @@ -2,22 +2,22 @@ OWNER(g:ymake) PY2_LIBRARY() -PY_SRCS( +PY_SRCS( code_generator.py ssqls.py swig.py - + _common.py - _custom_command.py - _import_wrapper.py - _requirements.py - _test_const.py + _custom_command.py + _import_wrapper.py + _requirements.py + _test_const.py ) PEERDIR(build/plugins/lib) END() - -RECURSE( - tests -) + +RECURSE( + tests +) diff --git a/build/plugins/yql_python_udf.py b/build/plugins/yql_python_udf.py index c4f949d8a9..d47cb2e793 100644 --- a/build/plugins/yql_python_udf.py +++ b/build/plugins/yql_python_udf.py @@ -37,10 +37,10 @@ def onregister_yql_python_udf(unit, *args): else: flavor = 'System' - output_includes = [ - 'yql/udfs/common/python/python_udf/python_udf.h', + output_includes = [ + 'yql/udfs/common/python/python_udf/python_udf.h', 'ydb/library/yql/public/udf/udf_registrator.h', - ] + ] if add_libra_modules: output_includes.append('yql/udfs/quality/libra/module/module.h') @@ -50,6 +50,6 @@ def onregister_yql_python_udf(unit, *args): 'build/scripts/gen_yql_python_udf.py', flavor, name, resource_name, path, libra_flag, 'OUT', path, - 'OUTPUT_INCLUDES', - ] + output_includes - ) + 'OUTPUT_INCLUDES', + ] + output_includes + ) diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py index 8970837f0f..228474b002 100644 --- a/build/plugins/ytest.py +++ b/build/plugins/ytest.py @@ -2,13 +2,13 @@ import os import re import sys import json -import copy +import copy import base64 import shlex import _common import lib._metric_resolvers as mr -import _test_const as consts -import _requirements as reqs +import _test_const as consts +import _requirements as reqs import StringIO import subprocess import collections @@ -25,7 +25,7 @@ CANON_MDS_RESOURCE_REGEX = re.compile(re.escape(MDS_URI_PREFIX) + r'(.*?)($|#)') 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_NETWORK_REQUIREMENTS = ("full", "restricted") VALID_DNS_REQUIREMENTS = ("default", "local", "dns64") BLOCK_SEPARATOR = '=============================================================' SPLIT_FACTOR_MAX_VALUE = 1000 @@ -92,10 +92,10 @@ def validate_force_sandbox_requirement(name, value, test_size, is_force_sandbox, error_msg = validate_numerical_requirement(name, value) if error_msg: return error_msg - return check_func(mr.resolve_value(value), test_size, is_kvm) + return check_func(mr.resolve_value(value), test_size, is_kvm) -# TODO: Remove is_kvm param when there will be guarantees on RAM +# TODO: Remove is_kvm param when there will be guarantees on RAM def validate_requirement(req_name, value, test_size, is_force_sandbox, in_autocheck, is_fuzzing, is_kvm, is_ytexec_run): req_checks = { 'container': validate_numerical_requirement, @@ -125,26 +125,26 @@ def validate_test(unit, kw): def get_list(key): return deserialize_list(kw.get(key, "")) - valid_kw = copy.deepcopy(kw) + valid_kw = copy.deepcopy(kw) errors = [] warnings = [] - if valid_kw.get('SCRIPT-REL-PATH') == 'boost.test': - project_path = valid_kw.get('BUILD-FOLDER-PATH', "") + 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") - elif valid_kw.get('SCRIPT-REL-PATH') == 'gtest': - project_path = valid_kw.get('BUILD-FOLDER-PATH', "") + 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_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 + size = valid_kw.get('SIZE', consts.TestSize.Small).lower() + # TODO: use set instead list tags = get_list("TAG") requirements_orig = get_list("REQUIREMENTS") - in_autocheck = "ya:not_autocheck" not in tags and 'ya:manual' not in tags + in_autocheck = "ya:not_autocheck" not in tags and 'ya:manual' not in tags is_fat = 'ya:fat' in tags is_force_sandbox = 'ya:force_distbuild' not in tags and is_fat is_ytexec_run = 'ya:yt' in tags @@ -153,10 +153,10 @@ def validate_test(unit, kw): requirements = {} list_requirements = ('sb_vault') for req in requirements_orig: - if req in ('kvm', ): - requirements[req] = str(True) - continue - + if req in ('kvm', ): + requirements[req] = str(True) + continue + if ":" in req: req_name, req_value = req.split(":", 1) if req_name in list_requirements: @@ -169,7 +169,7 @@ def validate_test(unit, kw): elif requirements[req_name] != req_value: warnings.append("Requirement [[imp]]{}[[rst]] is redefined [[imp]]{}[[rst]] -> [[imp]]{}[[rst]]".format(req_name, requirements[req_name], req_value)) requirements[req_name] = req_value - else: + else: requirements[req_name] = req_value else: errors.append("Invalid requirement syntax [[imp]]{}[[rst]]: expect <requirement>:<value>".format(req)) @@ -180,14 +180,14 @@ def validate_test(unit, kw): if error_msg: errors += [error_msg] - invalid_requirements_for_distbuild = [requirement for requirement in requirements.keys() if requirement not in ('ram', 'ram_disk', 'cpu', 'network')] + invalid_requirements_for_distbuild = [requirement for requirement in requirements.keys() if requirement not in ('ram', 'ram_disk', 'cpu', 'network')] sb_tags = [tag for tag in tags if tag.startswith('sb:')] - - if is_fat: + + if is_fat: if size != consts.TestSize.Large: errors.append("Only LARGE test may have ya:fat tag") - if in_autocheck and not is_force_sandbox: + if in_autocheck and not is_force_sandbox: if invalid_requirements_for_distbuild: errors.append("'{}' REQUIREMENTS options can be used only for FAT tests without ya:force_distbuild tag. Remove TAG(ya:force_distbuild) or an option.".format(invalid_requirements_for_distbuild)) if sb_tags: @@ -195,7 +195,7 @@ def validate_test(unit, kw): if 'ya:sandbox_coverage' in tags: errors.append("You can set 'ya:sandbox_coverage' tag only for FAT tests without ya:force_distbuild.") else: - if is_force_sandbox: + if is_force_sandbox: errors.append('ya:force_sandbox can be used with LARGE tests only') if 'ya:nofuse' in tags: errors.append('ya:nofuse can be used with LARGE tests only') @@ -203,15 +203,15 @@ def validate_test(unit, kw): errors.append("ya:privileged can be used with LARGE tests only") if in_autocheck and size == consts.TestSize.Large: errors.append("LARGE test must have ya:fat tag") - - if 'ya:privileged' in tags and 'container' not in requirements: - errors.append("Only tests with 'container' requirement can have 'ya:privileged' tag") - + + 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: - errors.append("Unknown test size: [[imp]]{}[[rst]], choose from [[imp]]{}[[rst]]".format(size.upper(), ", ".join([sz.upper() for sz in size_timeout.keys()]))) + 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: - timeout = int(valid_kw.get('TEST-TIMEOUT', size_timeout[size]) or size_timeout[size]) + 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") @@ -223,19 +223,19 @@ def validate_test(unit, kw): break if suggested_size: - suggested_size = ", suggested size: [[imp]]{}[[rst]]".format(suggested_size.upper()) + suggested_size = ", suggested size: [[imp]]{}[[rst]]".format(suggested_size.upper()) 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)) + 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)) - requiremtens_list = [] - for req_name, req_value in requirements.iteritems(): - requiremtens_list.append(req_name + ":" + req_value) - valid_kw['REQUIREMENTS'] = serialize_list(requiremtens_list) - - if valid_kw.get("FUZZ-OPTS"): + requiremtens_list = [] + for req_name, req_value in requirements.iteritems(): + requiremtens_list.append(req_name + ":" + req_value) + valid_kw['REQUIREMENTS'] = serialize_list(requiremtens_list) + + if valid_kw.get("FUZZ-OPTS"): for option in get_list("FUZZ-OPTS"): if not option.startswith("-"): errors.append("Unrecognized fuzzer option '[[imp]]{}[[rst]]'. All fuzzer options should start with '-'".format(option)) @@ -264,20 +264,20 @@ def validate_test(unit, kw): tags.append("ya:external") tags.append("ya:yt_research_pool") - if valid_kw.get("USE_ARCADIA_PYTHON") == "yes" and valid_kw.get("SCRIPT-REL-PATH") == "py.test": + if valid_kw.get("USE_ARCADIA_PYTHON") == "yes" and valid_kw.get("SCRIPT-REL-PATH") == "py.test": 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': + 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') value = 1 try: - value = int(valid_kw.get('SPLIT-FACTOR')) + value = int(valid_kw.get('SPLIT-FACTOR')) if value <= 0: raise ValueError("must be > 0") if value > SPLIT_FACTOR_MAX_VALUE: @@ -305,7 +305,7 @@ def validate_test(unit, kw): return valid_kw, warnings, errors - + def get_norm_unit_path(unit, extra=None): path = _common.strip_roots(unit.path()) if extra: @@ -319,10 +319,10 @@ def dump_test(unit, kw): unit.message(['warn', w]) for e in errors: ymake.report_configure_error(e) - if valid_kw is None: + if valid_kw is None: return None string_handler = StringIO.StringIO() - for k, v in valid_kw.iteritems(): + for k, v in valid_kw.iteritems(): print >>string_handler, k + ': ' + v print >>string_handler, BLOCK_SEPARATOR data = string_handler.getvalue() @@ -515,8 +515,8 @@ def onadd_ytest(unit, *args): if flat_args[1] == 'fuzz.test' and unit.get('FUZZING') == 'yes': test_record['FUZZING'] = '1' - # use all cores if fuzzing requested - test_record['REQUIREMENTS'] = serialize_list(filter(None, deserialize_list(test_record['REQUIREMENTS']) + ["cpu:all", "ram:all"])) + # use all cores if fuzzing requested + test_record['REQUIREMENTS'] = serialize_list(filter(None, deserialize_list(test_record['REQUIREMENTS']) + ["cpu:all", "ram:all"])) data = dump_test(unit, test_record) if data: @@ -548,7 +548,7 @@ def onadd_check(unit, *args): # 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) + "SPLIT_FACTOR": 1, "FORK_SUBTESTS": 0, "FORK_TESTS": 0, "SIZE": 1}, args) check_type = flat_args[0] test_dir = get_norm_unit_path(unit) |