Ejemplo n.º 1
0
 def from_yaml(cls, name, lab):
     lab_type = lab.get('lab_type')
     kw = cls._kw_from_yaml(lab, ['url'])
     kw.update({
         'name': name,
         'lab_type': lab_type,
         'filters': FilterFactory.from_data(lab),
     })
     lab_cls = cls._lab_types[lab_type] if lab_type else Lab
     return lab_cls.from_yaml(lab, kw)
Ejemplo n.º 2
0
 def from_yaml(cls, name, test_plan, file_systems, default_filters=None):
     kw = {
         'name': name,
         'rootfs': file_systems[test_plan['rootfs']],
         'base_name': test_plan.get('base_name'),
         'filters': FilterFactory.from_data(test_plan, default_filters),
     }
     kw.update(
         cls._kw_from_yaml(test_plan,
                           ['name', 'category', 'pattern', 'params']))
     return cls(**kw)
Ejemplo n.º 3
0
def from_yaml(yaml_path):
    with open(yaml_path) as f:
        data = yaml.safe_load(f)

    fs_types = {
        name: RootFSType.from_yaml(fs_type)
        for name, fs_type in data['file_system_types'].items()
    }

    file_systems = {
        name: RootFS.from_yaml(fs_types, rootfs)
        for name, rootfs in data['file_systems'].items()
    }

    plan_filters = FilterFactory.from_yaml(data['test_plan_default_filters'])

    test_plans = {
        name: TestPlan.from_yaml(name, test_plan, file_systems, plan_filters)
        for name, test_plan in data['test_plans'].items()
    }

    device_filters = FilterFactory.from_yaml(data['device_default_filters'])

    device_types = {
        name: DeviceTypeFactory.from_yaml(name, device_type, device_filters)
        for name, device_type in data['device_types'].items()
    }

    test_configs = [
        TestConfig.from_yaml(test_config, device_types, test_plans)
        for test_config in data['test_configs']
    ]

    config_data = {
        'file_systems': file_systems,
        'test_plans': test_plans,
        'device_types': device_types,
        'test_configs': test_configs,
    }

    return config_data
Ejemplo n.º 4
0
    def from_yaml(cls,
                  test_config,
                  device_types,
                  test_plans,
                  default_filters=None):
        kw = {
            'device_type': device_types[test_config['device_type']],
            'test_plans':
            [test_plans[test] for test in test_config['test_plans']],
            'filters': FilterFactory.from_data(test_config, default_filters),
        }

        return cls(**kw)
Ejemplo n.º 5
0
 def from_yaml(cls, data, name, fragments):
     kw = {
         'name': name,
     }
     kw.update(
         cls._kw_from_yaml(data, [
             'name',
             'base_defconfig',
             'extra_configs',
         ]))
     cf = data.get('fragments')
     kw['fragments'] = [fragments[name] for name in cf] if cf else None
     kw['filters'] = FilterFactory.from_data(data)
     return cls(**kw)
Ejemplo n.º 6
0
 def from_yaml(cls, name, device_type, default_filters=None):
     kw = cls._kw_from_yaml(device_type, [
         'mach',
         'arch',
         'boot_method',
         'dtb',
         'flags',
         'context',
         'params',
     ])
     kw.update({
         'name':
         name,
         'base_name':
         device_type.get('base_name'),
         'filters':
         FilterFactory.from_data(device_type, default_filters),
     })
     cls_name = device_type.get('class')
     device_cls = cls._classes[cls_name] if cls_name else DeviceType
     return device_cls(**kw)