コード例 #1
0
ファイル: pipeline.py プロジェクト: rabbit-2-svg/MAYA2
def _get_host_manufacturer(*args, **kwargs):
    """
    See usage in main method
    :return: None
    """
    device = Device(test_conf['device_id'])
    device.get_host_manufacturer()
コード例 #2
0
ファイル: run_one_tc.py プロジェクト: rabbit-2-svg/MAYA2
def process_param(**kwargs):
    """
    Process parameters both from command line and IDE
    :param kwargs: key value pair
    :return: None
    """
    tc_logger.info('==>Start to process parameters')
    global test_conf
    if len(sys.argv) > 1:
        for arg in sys.argv[1:]:
            kv = arg.strip().split('=', 1)
            key = kv[0]
            value = kv[1]
            if ',' in value:
                value = value.lower().replace(' ', '').split(',')
            test_conf[key] = value
    else:
        for k, v in kwargs.items():
            if ',' in str(v):
                v = v.lower().replace(' ', '').split(',')
            test_conf[k] = v
    # make switch input standard
    switch = [
        'statistics', 'chart', 'monitor', 'watchdog', 'event_trace',
        'loop_health_report'
    ]
    for key in switch:
        if not isinstance(test_conf[key], bool):
            test_conf[key] = test_conf[key].lower() in ('1', 'true', 'yes',
                                                        't')

    if ("user_test_conf" in test_conf):
        tc_logger.info('==>Start to process user test conf yaml')
        with open(test_conf["user_test_conf"], 'r') as file:
            temp_conf = yaml.safe_load(file)
        for k, v in temp_conf.items():
            test_conf[k] = v
        tc_logger.info('==>Process user test conf yaml over')
    k1 = "default_suite_id"
    k2 = "default_test_id"
    v1 = test_conf[k1]
    v2 = test_conf[k2]
    for k, v in test_conf.items():
        if (type(v) == str):
            test_conf[k] = v.replace("@" + k1, v1).replace("@" + k2, v2)

    complete_config_path(
        test_conf['support_device'] + test_conf['support_tool'], test_conf)
    device = Device(test_conf['device_id'])
    device.root_device()
    if test_conf.get('device_type', None) is None:
        test_conf['device_type'] = device.get_host_manufacturer()[1][0]
    if test_conf.get('chip_manufacturer', None) is None:
        test_conf['chip_manufacturer'] = device.get_chip_manufacturer()[1][0]
    if test_conf.get('chip_capacity', None) is None:
        test_conf['chip_capacity'] = device.get_chip_capacity()[1][0]
    tc_logger.info('==>Process parameters over, valid parameters:')
    tc_logger.info(test_conf)