sanitychecks: add new keyword 'kernel' to testcase.ini

Specify the kernel being tested instead of relying on parsing
Makefile for KERNEL_TYPE.

This is needed for testcases that build for multiple kernels.

Change-Id: Ic4df2fa66eee4cd498955aee2b0da80a99d35e30
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2016-02-09 20:31:26 -05:00 committed by Anas Nashif
commit a7c4aa2e8a

View file

@ -30,6 +30,10 @@ Each testcase.ini block can define the following key/value pairs:
run under certain circumstances, like daily builds. These test cases
are still compiled.
kernel = <nano|micro>
Specify the kernel being tested instead of relying on parsing
Makefile for KERNEL_TYPE
extra_args = <list of extra arguments>
Extra arguments to pass to Make when building or running the
test case.
@ -725,6 +729,7 @@ testcase_valid_keys = {"tags" : {"type" : "set", "required" : True},
"skip" : {"type" : "bool", "default" : False},
"slow" : {"type" : "bool", "default" : False},
"timeout" : {"type" : "int", "default" : 60},
"kernel" : {"type": "str", "required" : False},
"arch_whitelist" : {"type" : "set"},
"arch_exclude" : {"type" : "set"},
"platform_exclude" : {"type" : "set"},
@ -968,6 +973,7 @@ class TestCase:
self.arch_whitelist = tc_dict["arch_whitelist"]
self.arch_exclude = tc_dict["arch_exclude"]
self.skip = tc_dict["skip"]
self.kernel = tc_dict["kernel"]
self.platform_exclude = tc_dict["platform_exclude"]
self.platform_whitelist = tc_dict["platform_whitelist"]
self.config_whitelist = tc_dict["config_whitelist"]
@ -976,18 +982,21 @@ class TestCase:
self.slow = tc_dict["slow"]
self.path = os.path.join(workdir, name)
self.name = self.path # for now
self.ktype = None
self.defconfig = {}
self.ktype = None
with open(os.path.join(testcase_root, workdir, "Makefile")) as makefile:
for line in makefile.readlines():
m = TestCase.makefile_re.match(line)
if m:
self.ktype = m.group(1)
break
if not self.ktype:
raise ConfigurationError(os.path.join(workdir, "Makefile"),
"KERNEL_TYPE not found")
if self.kernel:
self.ktype = self.kernel
else:
with open(os.path.join(testcase_root, workdir, "Makefile")) as makefile:
for line in makefile.readlines():
m = TestCase.makefile_re.match(line)
if m:
self.ktype = m.group(1)
break
if not self.ktype:
raise ConfigurationError(os.path.join(workdir, "Makefile"),
"KERNEL_TYPE not found")
def __repr__(self):
return self.name