tiny-test-fw: revise unit test job config file:

`overwrite` should be included by each case config
This commit is contained in:
He Yin Ling 2019-11-21 16:04:30 +08:00
parent b7b4cd3418
commit 74ca3fc571
2 changed files with 19 additions and 21 deletions

View File

@ -30,6 +30,11 @@ class Group(CIAssignTest.Group):
"execution_time": "execution time"
}
CI_JOB_MATCH_KEYS = ["test environment"]
DUT_CLS_NAME = {
"esp32": "ESP32DUT",
"esp32s2beta": "ESP32S2DUT",
"esp8266": "ESP8266DUT",
}
def __init__(self, case):
super(Group, self).__init__(case)
@ -89,33 +94,26 @@ class Group(CIAssignTest.Group):
"""
test_function = self._map_test_function()
target = self._get_case_attr(self.case_list[0], "chip_target")
if target:
overwrite = {
"dut": {
"path": "IDF/IDFDUT.py",
"class": self.DUT_CLS_NAME[target],
}
}
else:
overwrite = dict()
output_data = {
# we don't need filter for test function, as UT uses a few test functions for all cases
"CaseConfig": [
{
"name": test_function,
"extra_data": self._create_extra_data(test_function),
"overwrite": overwrite,
}
],
}
target = self._get_case_attr(self.case_list[0], "chip_target")
if target is not None:
target_dut = {
"esp32": "ESP32DUT",
"esp32s2beta": "ESP32S2DUT",
"esp8266": "ESP8266DUT",
}[target]
output_data.update({
"Filter": {
"overwrite": {
"dut": {
"path": "IDF/IDFDUT.py",
"class": target_dut,
}
}
}
})
return output_data

View File

@ -159,7 +159,7 @@ class Parser(object):
configs = cls.DEFAULT_CONFIG.copy()
if config_file:
with open(config_file, "r") as f:
configs.update(yaml.load(f), Loader=Loader)
configs.update(yaml.load(f, Loader=Loader))
return configs
@classmethod
@ -190,9 +190,9 @@ class Parser(object):
test_case_list = []
for _config in configs["CaseConfig"]:
_filter = configs["Filter"].copy()
_overwrite = cls.handle_overwrite_args(_config.pop("overwrite", dict()))
_extra_data = _config.pop("extra_data", None)
_filter.update(_config)
_overwrite = cls.handle_overwrite_args(_filter.pop("overwrite", dict()))
_extra_data = _filter.pop("extra_data", None)
for test_method in test_methods:
if _filter_one_case(test_method, _filter):
test_case_list.append(TestCase.TestCase(test_method, _extra_data, **_overwrite))