mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ci: pass target from build stage to unit test
This commit is contained in:
parent
4558824150
commit
3a9ae4acc6
@ -19,13 +19,12 @@ except ImportError:
|
||||
|
||||
|
||||
class Group(CIAssignTest.Group):
|
||||
SORT_KEYS = ["config", "SDK", "test environment", "multi_device", "multi_stage", "tags"]
|
||||
SORT_KEYS = ["config", "test environment", "multi_device", "multi_stage", "tags", "chip_target"]
|
||||
MAX_CASE = 30
|
||||
ATTR_CONVERT_TABLE = {
|
||||
"execution_time": "execution time"
|
||||
}
|
||||
# when IDF support multiple chips, SDK will be moved into tags, we can remove it
|
||||
CI_JOB_MATCH_KEYS = ["test environment", "SDK"]
|
||||
CI_JOB_MATCH_KEYS = ["test environment"]
|
||||
|
||||
def __init__(self, case):
|
||||
super(Group, self).__init__(case)
|
||||
@ -84,6 +83,7 @@ class Group(CIAssignTest.Group):
|
||||
:return: {"Filter": case filter, "CaseConfig": list of case configs for cases in this group}
|
||||
"""
|
||||
test_function = self._map_test_function()
|
||||
|
||||
output_data = {
|
||||
# we don't need filter for test function, as UT uses a few test functions for all cases
|
||||
"CaseConfig": [
|
||||
@ -91,8 +91,26 @@ class Group(CIAssignTest.Group):
|
||||
"name": test_function,
|
||||
"extra_data": self._create_extra_data(test_function),
|
||||
}
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Env(object):
|
||||
except ValueError:
|
||||
dut_config = dict()
|
||||
dut_config.update(dut_init_args)
|
||||
dut = self.default_dut_cls(dut_name, port,
|
||||
dut = dut_class(dut_name, port,
|
||||
os.path.join(self.log_path, dut_name + ".log"),
|
||||
app_inst,
|
||||
**dut_config)
|
||||
|
@ -233,7 +233,7 @@ class AssignTest(object):
|
||||
else:
|
||||
failed_to_assign.append(group)
|
||||
if failed_to_assign:
|
||||
console_log("Too many test cases vs jobs to run. Please add the following jobs to .gitlab-ci.yml with specific tags:", "R")
|
||||
console_log("Too many test cases vs jobs to run. Please add the following jobs to tools/ci/config/target-test.yml with specific tags:", "R")
|
||||
for group in failed_to_assign:
|
||||
console_log("* Add job with: " + ",".join(group.ci_job_match_keys), "R")
|
||||
raise RuntimeError("Failed to assign test case to CI jobs")
|
||||
|
@ -10,7 +10,7 @@ import CreateSectionTable
|
||||
|
||||
TEST_CASE_PATTERN = {
|
||||
"initial condition": "UTINIT1",
|
||||
"SDK": "ESP32_IDF",
|
||||
"chip_target": "esp32",
|
||||
"level": "Unit",
|
||||
"execution time": 0,
|
||||
"auto test": "Yes",
|
||||
@ -73,6 +73,7 @@ class Parser(object):
|
||||
|
||||
table = CreateSectionTable.SectionTable("section_table.tmp")
|
||||
tags = self.parse_tags(os.path.join(config_output_folder, self.SDKCONFIG_FILE))
|
||||
print("Tags of config %s: %s" % (config_name, tags))
|
||||
test_cases = []
|
||||
|
||||
# we could split cases of same config into multiple binaries as we have limited rom space
|
||||
@ -94,7 +95,17 @@ class Parser(object):
|
||||
name = table.get_string("any", name_addr)
|
||||
desc = table.get_string("any", desc_addr)
|
||||
file_name = table.get_string("any", file_name_addr)
|
||||
tc = self.parse_one_test_case(name, desc, file_name, config_name, stripped_config_name, tags)
|
||||
|
||||
# Search in tags to set the target
|
||||
target_tag_dict = {"ESP32_IDF": "esp32", "7.2.2": "esp32s2beta"}
|
||||
for tag in target_tag_dict:
|
||||
if tag in tags:
|
||||
target = target_tag_dict[tag]
|
||||
break
|
||||
else:
|
||||
target = "esp32"
|
||||
|
||||
tc = self.parse_one_test_case(name, desc, file_name, config_name, stripped_config_name, tags, target)
|
||||
|
||||
# check if duplicated case names
|
||||
# we need to use it to select case,
|
||||
@ -233,7 +244,7 @@ class Parser(object):
|
||||
return match.group(1).split(' ')
|
||||
return None
|
||||
|
||||
def parse_one_test_case(self, name, description, file_name, config_name, stripped_config_name, tags):
|
||||
def parse_one_test_case(self, name, description, file_name, config_name, stripped_config_name, tags, target):
|
||||
"""
|
||||
parse one test case
|
||||
:param name: test case name (summary)
|
||||
@ -261,7 +272,8 @@ class Parser(object):
|
||||
"multi_device": prop["multi_device"],
|
||||
"multi_stage": prop["multi_stage"],
|
||||
"timeout": int(prop["timeout"]),
|
||||
"tags": tags})
|
||||
"tags": tags,
|
||||
"chip_target": target})
|
||||
return test_case
|
||||
|
||||
def dump_test_cases(self, test_cases):
|
||||
|
Loading…
x
Reference in New Issue
Block a user