コード例 #1
0
def parser_maple_test_config_file(maple_test_cfg_file):
    raw_config = read_config(maple_test_cfg_file)
    test_paths = get_config_value(raw_config, "test-home", "dir")
    if test_paths:
        test_paths = test_paths.replace("\n", "").split(":")
    else:
        test_paths = []
    test_suite_config = {
        "test_paths":
        [complete_path(BASE_DIR / path) for path in test_paths if path],
    }
    log_config = {
        "dir":
        complete_path(BASE_DIR /
                      Path(get_config_value(raw_config, "logging", "name"))),
        "level":
        get_level_name(get_config_value(raw_config, "logging", "level")),
    }

    running_config = {
        "temp_dir":
        complete_path(
            BASE_DIR /
            Path(get_config_value(raw_config, "running", "temp_dir"))),
    }

    return test_suite_config, running_config, log_config
コード例 #2
0
def init_config():
    global TEST_CONFIG
    (
        TEST_CONFIG,
        cli_test_suite_config,
        cli_running_config,
        cli_log_config,
    ) = parse_args()

    (
        file_test_suite_config,
        file_running_config,
        file_log_config,
    ) = parser_maple_test_config_file(TEST_CONFIG.get("cfg"))

    cli_test_paths = cli_test_suite_config.get("test_paths") or []
    file_test_paths = file_test_suite_config.get("test_paths") or []

    for path1 in cli_test_paths:
        for path2 in file_test_paths:
            if is_relative(path1, path2):
                user_test_cfg = cli_test_suite_config.get("test_cfg")
                if not user_test_cfg:
                    cli_test_suite_config["test_cfg"] = complete_path(
                        path2 / "test.cfg")

    test_suite_config = merge_config(cli_test_suite_config,
                                     file_test_suite_config)
    running_config = merge_config(cli_running_config, file_running_config)
    log_config = merge_config(cli_log_config, file_log_config)

    if log_config.get("dir") is None:
        log_dir = complete_path(Path("./maple_test_log"))
        print(
            "No log dir find in cfg file and cli args, will create lod gir at: {}"
            .format(log_dir))
        log_config["dir"] = log_dir

    global CASE_ENCODING
    CASE_ENCODING = TEST_CONFIG.get("encoding")

    global LOGGER
    maple_test_log_config = log_config.copy()
    maple_test_log_config["verbose"] = True
    maple_test_log_config["level"] = min(20,
                                         maple_test_log_config.get("level"))
    stream_fmt = logging.Formatter("%(message)s")
    log_dir = maple_test_log_config.get("dir")
    if not log_dir.exists():
        log_dir.mkdir(parents=True, exist_ok=True)
    LOGGER = construct_logger(
        maple_test_log_config,
        "Maple_Test",
        stream_fmt=stream_fmt,
        stream_level=min(20, maple_test_log_config.get("level")),
    )
    LOGGER.info("Test log saved to {}".format(log_dir))
    running_config["log_config"] = log_config.copy()

    return test_suite_config, running_config, log_config
コード例 #3
0
ファイル: task.py プロジェクト: MapleSystem/OpenArkCompiler
    def __init__(self,
                 test_path,
                 cfg_path,
                 running_config,
                 cli_running_config=None):
        if cli_running_config is None:
            cli_running_config = {}

        self.path = complete_path(test_path)
        self.cfg_path = cfg_path

        config = read_config(self.cfg_path)
        if config is None:
            raise TestError(
                "Test suite config path:{} not found, skip!!!!!".format(
                    self.cfg_path))
        try:
            self.name = config["description"]["title"].replace(" ", "")
        except KeyError:
            self.name = self.path.name
        self.suffix_comments = config_section_to_dict(config, "suffix")

        self.result = defaultdict(int)

        self.config_set = {}
        self.testlist_set = {}

        self.task_set = defaultdict(list)
        self.task_set_result = {}
        self.all_cases = {}
        self._form_task_set(running_config, cli_running_config)
コード例 #4
0
ファイル: task.py プロジェクト: MapleSystem/OpenArkCompiler
 def __init__(self,
              path,
              config,
              top_config,
              user_config=None,
              user_env=None):
     if top_config is None:
         name = path.name
         self.internal_var = {}
         self.env = {}
         self.suffix_comments = {}
     else:
         self.inherit_top_config(top_config)
         name = str(path.relative_to(top_config.path.parent)).replace(
             OS_SEP, "_")
     self.name = name.replace(".", "_")
     self.path = complete_path(path)
     self.base_dir = self.path.parent
     self.update_sub_config(config)
     self.update_by_user_config(user_config, user_env)
コード例 #5
0
ファイル: qemu_run.py プロジェクト: venshine/OpenArkCompiler
def main():
    opts = parse_cli()
    run_type = opts.run_type

    parser = shlex.shlex(opts.execute_file)
    parser.whitespace = ":"
    parser.whitespace_split = True
    source_files = [complete_path(file) for file in parser]

    execute_class = opts.execute_class
    execute_args = opts.execute_args
    mrt_type = opts.mrt_type
    timeout = opts.timeout

    execute_option = {
        "execute_files": source_files,
        "execute_class": execute_class,
        "execute_args": execute_args,
        "mrt_type": mrt_type,
        "timeout": timeout,
    }

    logging.basicConfig(
        format="\t%(asctime)s %(message)s",
        datefmt="%H:%M:%S",
        level=logging.DEBUG if opts.verbose else logging.INFO,
        stream=sys.stderr,
    )

    execute_cmd = OrderedDict()
    execute_cmd["run_case"] = None

    if run_type == "aarch64":
        construct_qemu_cmd(execute_cmd, execute_option)
    else:
        logging.error("Not support run type: {}".format(run_type))
    run_case(execute_cmd, ".", timeout)
コード例 #6
0
def main():
    opts = parse_cli()
    run_type = opts.run_type

    parser = shlex.shlex(opts.execute_file)
    parser.whitespace = ":"
    parser.whitespace_split = True
    source_files = [complete_path(file) for file in parser]

    execute_file = opts.execute_file
    execute_class = opts.execute_class
    execute_args = opts.execute_args
    mrt_type = opts.mrt_type
    timeout = opts.timeout
    ssh_user = opts.ssh_user
    ssh_ip = opts.ssh_ip
    sn = opts.sn

    tmp_id = str(uuid.uuid1())
    remote_path = "~/ndk_test/tmp/" + execute_class + "_" + tmp_id + "/"
    android_path = "/data/local/ndk_test/tmp/" + execute_class + "_" + tmp_id + "/"

    execute_option = {
        "source_files": source_files,
        "execute_file": execute_file,
        "execute_class": execute_class,
        "execute_args": execute_args,
        "mrt_type": mrt_type,
        "timeout": timeout,
        "ssh_user": ssh_user,
        "ssh_ip": ssh_ip,
        "sn": sn,
        "remote_path": remote_path,
        "android_path": android_path,
    }

    logging.basicConfig(
        format="\t%(asctime)s %(message)s",
        datefmt="%H:%M:%S",
        level=logging.DEBUG if opts.verbose else logging.INFO,
        stream=sys.stderr,
    )

    execute_cmd = OrderedDict()
    execute_cmd["run_case"] = None

    # check_env_cmd(execute_cmd, execute_option)
    # isInit = run_case(execute_cmd, ".", timeout)
    # if isInit != 'yes':
    #     print(1234)
    #     init_env_cmd(execute_cmd, execute_option)
    #     run_case(execute_cmd, ".", timeout)

    pre_path(execute_cmd, execute_option)
    run_case(execute_cmd, ".", timeout)
    scp_so_cmd(execute_cmd, execute_option)
    run_case(execute_cmd, ".", timeout)
    push_so_cmd(execute_cmd, execute_option)
    run_case(execute_cmd, ".", timeout)
    run_so_cmd(execute_cmd, execute_option)
    run_case(execute_cmd, ".", timeout)