Ejemplo n.º 1
0
def convert_tests_for_flatbuffers(tests, to_flatbuff, working_dir, color_enum):
    test_base_working_dir = str(working_dir)
    if not Path(test_base_working_dir).exists():
        Path(test_base_working_dir).mkdir(parents=True, exist_ok=True)

    for test in tests:
        test_id = test['id']
        if 'vw_command' not in test:
            print("{}Skipping test {} for flatbuffers, no vw command available{}".format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            continue
        if 'flatbuffer' in test['vw_command']:
            print("{}Skipping test {} for flatbuffers, already a flatbuffer test{}".format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            continue
        if 'malformed' in test['vw_command']:
            print("{}Skipping test {} for flatbuffers, malformed input{}".format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            continue
        if 'input_files' not in test:
            print("{}Skipping test {} for flatbuffers, no input files{}".format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            continue
        if 'dictionary' in test['vw_command']:
            print("{}Skipping test {} for flatbuffers, currently dictionaries are not supported{}".format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            continue
        if 'help' in test['vw_command']:
            print("{}Skipping test {} for flatbuffers, --help test{}".format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            continue

        depends_on_test = (
            tests[int(test["depends_on"][0]) - 1] if "depends_on" in test else None
        )

        fb_test_converter = fb_converter.FlatbufferTest(test, working_dir, depends_on_test=depends_on_test)
        fb_test_converter.to_flatbuffer(to_flatbuff, color_enum)

    return tests
Ejemplo n.º 2
0
def convert_tests_for_flatbuffers(tests, to_flatbuff, working_dir, color_enum):
    test_base_working_dir = str(working_dir)
    if not Path(test_base_working_dir).exists():
        Path(test_base_working_dir).mkdir(parents=True, exist_ok=True)

    for test in tests:
        test_id = test['id']
        if 'vw_command' not in test:
            print(
                "{}Skipping test {} for flatbuffers, no vw command available{}"
                .format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            test['skip'] = True
            continue
        if 'flatbuffer' in test['vw_command']:
            print(
                "{}Skipping test {} for flatbuffers, already a flatbuffer test{}"
                .format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            test['skip'] = True
            continue
        if 'malformed' in test['vw_command']:
            print(
                "{}Skipping test {} for flatbuffers, malformed input{}".format(
                    color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            test['skip'] = True
            continue
        if 'input_files' not in test:
            print(
                "{}Skipping test {} for flatbuffers, no input files{}".format(
                    color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            test['skip'] = True
            continue
        if 'dictionary' in test['vw_command']:
            print(
                "{}Skipping test {} for flatbuffers, currently dictionaries are not supported{}"
                .format(color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            test['skip'] = True
            continue
        if 'help' in test['vw_command']:
            print("{}Skipping test {} for flatbuffers, --help test{}".format(
                color_enum.LIGHT_CYAN, test_id, color_enum.ENDC))
            test['skip'] = True
            continue
        #todo: 300 understand why is it failing
        # test 189, 312, 316, 318 and 319 depend on dsjson parser behaviour
        # they can be enabled if we ignore diffing the --extra_metrics
        # 324 deals with corrupted data, so cannot be translated to fb
        if str(test_id) in ('300', '189', '312', '316', '318', '319', '324'):
            continue

        # test id is being used as an index here, not necessarily a contract
        depends_on_test = (tests[int(test["depends_on"][0]) -
                                 1] if "depends_on" in test else None)

        fb_test_converter = fb_converter.FlatbufferTest(
            test, working_dir, depends_on_test=depends_on_test)
        fb_test_converter.to_flatbuffer(to_flatbuff, color_enum)

    return tests
Ejemplo n.º 3
0
def convert_tests_for_flatbuffers(
    tests: List[TestData], to_flatbuff, working_dir, color_enum
):
    test_base_working_dir = str(working_dir)
    if not Path(test_base_working_dir).exists():
        Path(test_base_working_dir).mkdir(parents=True, exist_ok=True)

    for test in tests:
        if test.is_shell:
            test.skip = True
            test.skip_reason = "Cannot convert bash based tests to flatbuffers"
            continue
        if "flatbuffer" in test.command_line:
            test.skip = True
            test.skip_reason = "already a flatbuffer test"
            continue
        if "malformed" in test.command_line:
            test.skip = True
            test.skip_reason = "malformed input"
            continue
        if len(test.input_files) < 1:
            test.skip = True
            test.skip_reason = (
                "no input files for for automatic converted flatbuffer test"
            )
            continue
        if "dictionary" in test.command_line:
            test.skip = True
            test.skip_reason = "currently dictionaries are not supported for automatic converted flatbuffer tests"
            continue
        if "help" in test.command_line:
            test.skip = True
            test.skip_reason = (
                "--help test skipped for automatic converted flatbuffer tests"
            )
            continue
        # todo: 300 understand why is it failing
        # test 189, 312, 316, 318, 351 and 319 depend on dsjson parser behaviour
        # they can be enabled if we ignore diffing the --extra_metrics
        # (324-326) deals with corrupted data, so cannot be translated to fb
        # pdrop is not supported in fb, so 327-331 are excluded
        # 336, 337, 338 - the FB converter script seems to be affecting the invert_hash
        if str(test.id) in (
            "300",
            "189",
            "312",
            "316",
            "318",
            "319",
            "324",
            "325",
            "326",
            "327",
            "328",
            "329",
            "330",
            "331",
            "336",
            "337",
            "338",
            "351",
        ):
            test.skip = True
            test.skip_reason = "test skipped for automatic converted flatbuffer tests for unknown reason"
            continue

        # test id is being used as an index here, not necessarily a contract
        depends_on_test = (
            get_test(test.depends_on[0], tests) if len(test.depends_on) > 0 else None
        )

        fb_test_converter = fb_converter.FlatbufferTest(
            test, working_dir, depends_on_test=depends_on_test
        )
        fb_test_converter.to_flatbuffer(to_flatbuff, color_enum)

    return tests