From 41b6811f453b97b512bbdbc9cd2983b5edd2d04f Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 10 Jul 2019 13:20:17 +0200 Subject: [PATCH 1/3] unit-test-app: split default, release, single_core configs --- tools/unit-test-app/configs/default | 2 +- tools/unit-test-app/configs/default_2 | 1 + tools/unit-test-app/configs/release | 2 +- tools/unit-test-app/configs/release_2 | 3 +++ tools/unit-test-app/configs/single_core | 2 +- tools/unit-test-app/configs/single_core_2 | 4 ++++ 6 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tools/unit-test-app/configs/default_2 create mode 100644 tools/unit-test-app/configs/release_2 create mode 100644 tools/unit-test-app/configs/single_core_2 diff --git a/tools/unit-test-app/configs/default b/tools/unit-test-app/configs/default index f7f508a43..572b6cd8b 100644 --- a/tools/unit-test-app/configs/default +++ b/tools/unit-test-app/configs/default @@ -1 +1 @@ -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update \ No newline at end of file +TEST_COMPONENTS=freertos esp32 driver heap pthread soc spi_flash vfs \ No newline at end of file diff --git a/tools/unit-test-app/configs/default_2 b/tools/unit-test-app/configs/default_2 new file mode 100644 index 000000000..c02ec4789 --- /dev/null +++ b/tools/unit-test-app/configs/default_2 @@ -0,0 +1 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32 driver heap pthread soc spi_flash vfs \ No newline at end of file diff --git a/tools/unit-test-app/configs/release b/tools/unit-test-app/configs/release index d58d94997..75da1aa80 100644 --- a/tools/unit-test-app/configs/release +++ b/tools/unit-test-app/configs/release @@ -1,3 +1,3 @@ -TEST_EXCLUDE_COMPONENTS=bt app_update +TEST_COMPONENTS=freertos esp32 driver heap pthread soc spi_flash vfs CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/release_2 b/tools/unit-test-app/configs/release_2 new file mode 100644 index 000000000..c3e104675 --- /dev/null +++ b/tools/unit-test-app/configs/release_2 @@ -0,0 +1,3 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32 driver heap pthread soc spi_flash vfs +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y diff --git a/tools/unit-test-app/configs/single_core b/tools/unit-test-app/configs/single_core index 9c85abae6..40f7e98f2 100644 --- a/tools/unit-test-app/configs/single_core +++ b/tools/unit-test-app/configs/single_core @@ -1,4 +1,4 @@ -TEST_EXCLUDE_COMPONENTS=libsodium bt app_update +TEST_COMPONENTS=freertos esp32 driver heap pthread soc spi_flash vfs CONFIG_MEMMAP_SMP=n CONFIG_FREERTOS_UNICORE=y CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y diff --git a/tools/unit-test-app/configs/single_core_2 b/tools/unit-test-app/configs/single_core_2 new file mode 100644 index 000000000..17910a066 --- /dev/null +++ b/tools/unit-test-app/configs/single_core_2 @@ -0,0 +1,4 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32 driver heap pthread soc spi_flash vfs +CONFIG_MEMMAP_SMP=n +CONFIG_FREERTOS_UNICORE=y +CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y From 56e3f2780d997b78844a7b3ccc5ea45d6fa7dcad Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 10 Jul 2019 14:19:13 +0200 Subject: [PATCH 2/3] ci: add unit test job --- tools/ci/config/target-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/ci/config/target-test.yml b/tools/ci/config/target-test.yml index c8c12a321..6aa25316e 100644 --- a/tools/ci/config/target-test.yml +++ b/tools/ci/config/target-test.yml @@ -203,6 +203,9 @@ UT_001: - ESP32_IDF - UT_T1_1 +# Max. allowed value of 'parallel' is 50. +# See UT_030 below if you want to add more unit test jobs. + UT_002: extends: .unit_test_template parallel: 18 @@ -404,7 +407,7 @@ UT_029: # Gitlab parallel max value is 50. We need to create another UT job if parallel is larger than 50. UT_030: extends: .unit_test_template - parallel: 5 + parallel: 6 tags: - ESP32_IDF - UT_T1_1 From 663ed11509ca839d2aef97d6b2ee281161d57dee Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Wed, 10 Jul 2019 23:00:25 +0800 Subject: [PATCH 3/3] unit-test-app: use stripped config name in test case ID: We could split cases of same config into multiple binaries as we have limited rom space. So we should regard those configs like `default` and `default_2` as the same config. --- tools/unit-test-app/tools/UnitTestParser.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/unit-test-app/tools/UnitTestParser.py b/tools/unit-test-app/tools/UnitTestParser.py index 0058a6574..cf94eb0ae 100644 --- a/tools/unit-test-app/tools/UnitTestParser.py +++ b/tools/unit-test-app/tools/UnitTestParser.py @@ -43,6 +43,7 @@ class Parser(object): UT_CONFIG_FOLDER = os.path.join("tools", "unit-test-app", "configs") ELF_FILE = "unit-test-app.elf" SDKCONFIG_FILE = "sdkconfig" + STRIP_CONFIG_PATTERN = re.compile(r"(.+?)(_\d+)?$") def __init__(self, idf_path=os.getenv("IDF_PATH")): self.test_env_tags = {} @@ -73,6 +74,12 @@ class Parser(object): table = CreateSectionTable.SectionTable("section_table.tmp") tags = self.parse_tags(os.path.join(config_output_folder, self.SDKCONFIG_FILE)) test_cases = [] + + # we could split cases of same config into multiple binaries as we have limited rom space + # we should regard those configs like `default` and `default_2` as the same config + match = self.STRIP_CONFIG_PATTERN.match(config_name) + stripped_config_name = match.group(1) + with open("case_address.tmp", "rb") as f: for line in f: # process symbol table like: "3ffb4310 l O .dram0.data 00000018 test_desc_33$5010" @@ -87,17 +94,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, tags) + tc = self.parse_one_test_case(name, desc, file_name, config_name, stripped_config_name, tags) # check if duplicated case names # we need to use it to select case, # if duplicated IDs, Unity could select incorrect case to run # and we need to check all cases no matter if it's going te be executed by CI # also add app_name here, we allow same case for different apps - if (tc["summary"] + config_name) in self.test_case_names: + if (tc["summary"] + stripped_config_name) in self.test_case_names: self.parsing_errors.append("duplicated test case ID: " + tc["summary"]) else: - self.test_case_names.add(tc["summary"] + config_name) + self.test_case_names.add(tc["summary"] + stripped_config_name) test_group_included = True if test_groups is not None and tc["group"] not in test_groups: @@ -226,13 +233,14 @@ class Parser(object): return match.group(1).split(' ') return None - def parse_one_test_case(self, name, description, file_name, config_name, tags): + def parse_one_test_case(self, name, description, file_name, config_name, stripped_config_name, tags): """ parse one test case :param name: test case name (summary) :param description: test case description (tag string) :param file_name: the file defines this test case :param config_name: built unit test app name + :param stripped_config_name: strip suffix from config name because they're the same except test components :param tags: tags to select runners :return: parsed test case """ @@ -243,7 +251,7 @@ class Parser(object): "module": self.module_map[prop["module"]]['module'], "group": prop["group"], "CI ready": "No" if prop["ignore"] == "Yes" else "Yes", - "ID": name, + "ID": "[{}] {}".format(stripped_config_name, name), "test point 2": prop["module"], "steps": name, "test environment": prop["test_env"],