mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
tiny-test-fw: revise unit test job config file:
`overwrite` should be included by each case config
This commit is contained in:
@@ -30,6 +30,11 @@ class Group(CIAssignTest.Group):
|
|||||||
"execution_time": "execution time"
|
"execution_time": "execution time"
|
||||||
}
|
}
|
||||||
CI_JOB_MATCH_KEYS = ["test environment"]
|
CI_JOB_MATCH_KEYS = ["test environment"]
|
||||||
|
DUT_CLS_NAME = {
|
||||||
|
"esp32": "ESP32DUT",
|
||||||
|
"esp32s2beta": "ESP32S2DUT",
|
||||||
|
"esp8266": "ESP8266DUT",
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, case):
|
def __init__(self, case):
|
||||||
super(Group, self).__init__(case)
|
super(Group, self).__init__(case)
|
||||||
@@ -89,33 +94,26 @@ class Group(CIAssignTest.Group):
|
|||||||
"""
|
"""
|
||||||
test_function = self._map_test_function()
|
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 = {
|
output_data = {
|
||||||
# we don't need filter for test function, as UT uses a few test functions for all cases
|
# we don't need filter for test function, as UT uses a few test functions for all cases
|
||||||
"CaseConfig": [
|
"CaseConfig": [
|
||||||
{
|
{
|
||||||
"name": test_function,
|
"name": test_function,
|
||||||
"extra_data": self._create_extra_data(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
|
return output_data
|
||||||
|
|
||||||
|
|
||||||
|
@@ -159,7 +159,7 @@ class Parser(object):
|
|||||||
configs = cls.DEFAULT_CONFIG.copy()
|
configs = cls.DEFAULT_CONFIG.copy()
|
||||||
if config_file:
|
if config_file:
|
||||||
with open(config_file, "r") as f:
|
with open(config_file, "r") as f:
|
||||||
configs.update(yaml.load(f), Loader=Loader)
|
configs.update(yaml.load(f, Loader=Loader))
|
||||||
return configs
|
return configs
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -190,9 +190,9 @@ class Parser(object):
|
|||||||
test_case_list = []
|
test_case_list = []
|
||||||
for _config in configs["CaseConfig"]:
|
for _config in configs["CaseConfig"]:
|
||||||
_filter = configs["Filter"].copy()
|
_filter = configs["Filter"].copy()
|
||||||
|
_overwrite = cls.handle_overwrite_args(_config.pop("overwrite", dict()))
|
||||||
|
_extra_data = _config.pop("extra_data", None)
|
||||||
_filter.update(_config)
|
_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:
|
for test_method in test_methods:
|
||||||
if _filter_one_case(test_method, _filter):
|
if _filter_one_case(test_method, _filter):
|
||||||
test_case_list.append(TestCase.TestCase(test_method, _extra_data, **_overwrite))
|
test_case_list.append(TestCase.TestCase(test_method, _extra_data, **_overwrite))
|
||||||
|
Reference in New Issue
Block a user