CI: assign unit test cases according to sdkconfig:

We have built unit-test-app with different configs.
Currently we use the config name as tags to match runners.
It's not easy to add new configs (need to update tags to existed runners).

Now we'll parse required test runner tags from `sdkconfig` file.
For example, if config enables `CONFIG_SPIRAM_SUPPORT`, then it requires `psram` tag.
This will make adding new configs easier.

In this commit we change the one behavior of assign test: match keys of
cases should be exactly the same with job tags. This fixes cases select
jobs include their tags, and jobs requires those tags can't be assigned.
This commit is contained in:
He Yin Ling
2018-05-15 11:51:56 +08:00
committed by bot
parent 358c822d6a
commit 3b24bc42d2
8 changed files with 175 additions and 195 deletions

View File

@@ -17,12 +17,18 @@ from Utility import CIAssignTest
class Group(CIAssignTest.Group):
SORT_KEYS = ["Test App", "SDK", "test environment", "multi_device", "multi_stage"]
CI_JOB_MATCH_KEYS = ["Test App", "SDK", "test environment"]
SORT_KEYS = ["config", "SDK", "test environment", "multi_device", "multi_stage", "tags"]
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"]
def __init__(self, case):
super(Group, self).__init__(case)
for tag in self._get_case_attr(case, "tags"):
self.ci_job_match_keys.add(tag)
@staticmethod
def _get_case_attr(case, attr):
@@ -30,13 +36,6 @@ class Group(CIAssignTest.Group):
attr = Group.ATTR_CONVERT_TABLE[attr]
return case[attr]
@staticmethod
def _get_ut_config(test_app):
# we format test app "UT_ + config" when parsing test cases
# now we need to extract config
assert test_app[:3] == "UT_"
return test_app[3:]
def _create_extra_data(self, test_function):
"""
For unit test case, we need to copy some attributes of test cases into config file.
@@ -45,7 +44,7 @@ class Group(CIAssignTest.Group):
case_data = []
for case in self.case_list:
one_case_data = {
"config": self._get_ut_config(self._get_case_attr(case, "Test App")),
"config": self._get_case_attr(case, "config"),
"name": self._get_case_attr(case, "summary"),
"reset": self._get_case_attr(case, "reset"),
"timeout": self._get_case_attr(case, "timeout"),
@@ -101,8 +100,7 @@ class UnitTestAssignTest(CIAssignTest.AssignTest):
def __init__(self, test_case_path, ci_config_file):
CIAssignTest.AssignTest.__init__(self, test_case_path, ci_config_file, case_group=Group)
@staticmethod
def _search_cases(test_case_path, case_filter=None):
def _search_cases(self, test_case_path, case_filter=None):
"""
For unit test case, we don't search for test functions.
The unit test cases is stored in a yaml file which is created in job build-idf-test.