diff options
Diffstat (limited to 'kernelci/config/test.py')
-rw-r--r-- | kernelci/config/test.py | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/kernelci/config/test.py b/kernelci/config/test.py index b01c5e8..f21b578 100644 --- a/kernelci/config/test.py +++ b/kernelci/config/test.py @@ -128,6 +128,14 @@ class DeviceType_arm64(DeviceType): super(DeviceType_arm64, self).__init__(name, mach, arch, *args, **kw) +class DeviceType_riscv(DeviceType): + + def __init__(self, name, mach, arch='riscv', *args, **kw): + """RISCV device type with a device tree.""" + kw.setdefault('dtb', '{}/{}.dtb'.format(mach, name)) + super(DeviceType_riscv, self).__init__(name, mach, arch, *args, **kw) + + class DeviceTypeFactory(YAMLObject): """Factory to create device types from YAML data.""" @@ -136,6 +144,7 @@ class DeviceTypeFactory(YAMLObject): 'mips-dtb': DeviceType_mips, 'arm-dtb': DeviceType_arm, 'arm64-dtb': DeviceType_arm64, + 'riscv-dtb': DeviceType_riscv, } @classmethod @@ -272,10 +281,11 @@ class RootFS(YAMLObject): class TestPlan(YAMLObject): """Test plan model.""" - _pattern = '{plan}/{category}-{method}-{protocol}-{rootfs}-{plan}-template.jinja2' + _pattern = \ + '{plan}/{category}-{method}-{protocol}-{rootfs}-{plan}-template.jinja2' - def __init__(self, name, rootfs, params=None, category='generic', - filters=None, pattern=None): + def __init__(self, name, rootfs, base_name=None, params=None, + category='generic', filters=None, pattern=None): """A test plan is an arbitrary group of test cases to be run. *name* is the overall arbitrary test plan name, used when looking for @@ -283,6 +293,9 @@ class TestPlan(YAMLObject): *rootfs* is a RootFS object to be used to run this test plan. + *base_name* is the name of the base test plan which this test plan + configuration refers to. + *params" is a dictionary with parameters to pass to the test job generator. @@ -294,9 +307,11 @@ class TestPlan(YAMLObject): *pattern* is a string pattern to create the path to the job template file, see TestPlan._pattern for the default value with the regular template file naming scheme. + """ self._name = name self._rootfs = rootfs + self._base_name = base_name or name self._params = params or dict() self._category = category self._filters = filters or list() @@ -308,6 +323,7 @@ class TestPlan(YAMLObject): 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, [ @@ -323,6 +339,10 @@ class TestPlan(YAMLObject): return self._rootfs @property + def base_name(self): + return self._base_name + + @property def params(self): return dict(self._params) @@ -341,8 +361,6 @@ class TestPlan(YAMLObject): plan=self.name) def match(self, config): - if self.name == 'boot': - return True return all(f.match(**config) for f in self._filters) @@ -381,10 +399,12 @@ class TestConfig(YAMLObject): def test_plans(self): return self._test_plans - def match(self, arch, plan, flags, config): + def match(self, arch, flags, config, plan=None): return ( - plan in self._test_plans and - self._test_plans[plan].match(config) and + (plan is None or ( + plan in self._test_plans and + self._test_plans[plan].match(config) + )) and self.device_type.arch == arch and self.device_type.match(flags, config) and all(f.match(**config) for f in self._filters) |