From b8cfd877cc3a409c76bf917226791215dba9cb10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=9B=BD=E8=BE=89?= Date: Fri, 12 Sep 2025 03:49:17 +0000 Subject: [PATCH 1/5] =?UTF-8?q?Signed-off-by:=20=E9=BB=84=E5=9B=BD?= =?UTF-8?q?=E8=BE=89=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄国辉 --- src/core/testcase/testcase_manager.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index 7650e8b..c92b178 100644 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -338,39 +338,39 @@ class TestCaseManager(object): suite_file_dictionary.get("OHJST").append(suite_file) if testcase_list: - testcase_dict["OHJST"][]prefix_name = ":".join(testcase_list) + testcase_dict["OHJST"][prefix_name] = ":".join(testcase_list) if self.get_hap_test_driver(suite_file) == "JSUnitTest": suite_file_dictionary.get("JST").append(suite_file) if testcase_list: - testcase_dict["JST"][]prefix_name = ":".join(testcase_list) + testcase_dict["JST"][prefix_name] = ":".join(testcase_list) elif suffix_name == ".py": if not self.check_python_test_file(suite_file): continue suite_file_dictionary.get("PYT").append(suite_file) if testcase_list: - testcase_dict["PYT"][]prefix_name = ":".join(testcase_list) + testcase_dict["PYT"][prefix_name] = ":".join(testcase_list) elif suffix_name == "": if file_name.startswith("rust_"): Binder.get_tdd_config().update_test_type_in_source( "OHRust", DeviceTestType.oh_rust_test) suite_file_dictionary.get("OHRust").append(suite_file) if testcase_list: - testcase_dict["OHRUST"][]prefix_name = ":".join(testcase_list) + testcase_dict["OHRUST"][prefix_name] = ":".join(testcase_list) else: suite_file_dictionary.get("CXX").append(suite_file) if testcase_list: - testcase_dict["CXX"][]prefix_name = ":".join(testcase_list) + testcase_dict["CXX"][prefix_name] = ":".join(testcase_list) elif suffix_name == ".bin": suite_file_dictionary.get("BIN").append(suite_file) if testcase_list: - testcase_dict["BIN"][]prefix_name = ":".join(testcase_list) + testcase_dict["BIN"][prefix_name] = ":".join(testcase_list) # 将arktstdd的测试文件加入测试文件字典 elif (suffix_name == ".abc" and not os.path.dirname(suite_file).endswith("out") and not os.path.dirname(suite_file).endswith("hypium")): suite_file_dictionary.get("ABC").append(suite_file) if testcase_list: - testcase_dict["ABC"][]prefix_name = ":".join(testcase_list) + testcase_dict["ABC"][prefix_name] = ":".join(testcase_list) options.testcase_dict = testcase_dict options.test_level_dict = test_level_dict -- Gitee From b3f03901a4470a26a50e703136a02230e3de0517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=9B=BD=E8=BE=89?= Date: Fri, 12 Sep 2025 03:49:45 +0000 Subject: [PATCH 2/5] =?UTF-8?q?Signed-off-by:=20=E9=BB=84=E5=9B=BD?= =?UTF-8?q?=E8=BE=89=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄国辉 --- src/core/testcase/testcase_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index c92b178..7131815 100644 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -315,7 +315,7 @@ class TestCaseManager(object): if suffix_name == ".dex": suite_file_dictionary.get("DEX").append(suite_file) - if testcase_list + if testcase_list: testcase_dict["DEX"][prefix_name] = ":".join(testcase_list) elif suffix_name == ".hap": if self.get_hap_test_driver(suite_file) == "OHJSUnitTest": -- Gitee From e1a10bd531d6a6a858b243eb5865d13742d340ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=9B=BD=E8=BE=89?= Date: Fri, 12 Sep 2025 05:08:29 +0000 Subject: [PATCH 3/5] =?UTF-8?q?Signed-off-by:=20=E9=BB=84=E5=9B=BD?= =?UTF-8?q?=E8=BE=89=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄国辉 --- src/core/driver/drivers.py | 2 +- src/core/testcase/testcase_manager.py | 89 ++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 17 deletions(-) diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index d1bb4a2..c035f75 100644 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -656,7 +656,7 @@ class CppTestDriver(IDriver): if self.config.testcase: testcase = self.config.testcase else: - testcase = self.config.tesecase_dict.get("CXX", {}).get(filename, "") + testcase = self.config.testcase_dict.get("CXX", {}).get(filename, "") test_para = self._get_test_para(testcase, self.config.testcase, self.config.testlevel, diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index 7131815..3257085 100644 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -217,16 +217,16 @@ class TestCaseManager(object): def get_all_test_file(self, test_case_out_path, options): testcase_dict = { - "DEX": [], - "HAP": [], - "PYT": [], - "CXX": [], - "BIN": [], - "OHJST": [], - "JST": [], - "LTPPosix": [], - "OHRust": [], - "ABC": [] + "DEX": {}, + "HAP": {}, + "PYT": {}, + "CXX": {}, + "BIN": {}, + "OHJST": {}, + "JST": {}, + "LTPPosix": {}, + "OHRust": {}, + "ABC": {} } test_level_dict = {} suite_file_dictionary = copy.deepcopy(TESTFILE_TYPE_DATA_DIC) @@ -238,7 +238,7 @@ class TestCaseManager(object): command_list = options.current_raw_cmd.split(" ") # testcase_json testcase_json = options.testcasefile - if not testcase_json or not os.path.exists(testcase_json): + if testcase_json and not os.path.exists(testcase_json): return suite_file_dictionary testcase_json_dic = {} @@ -307,11 +307,11 @@ class TestCaseManager(object): if level in ["0", "1", "2", "3", "4"]: test_level_dict[suite_file] = level - - if not self.get_valid_suite_file(test_case_out_path, - suite_file, - options): - continue + else: + if not self.get_valid_suite_file(test_case_out_path, + suite_file, + options): + continue if suffix_name == ".dex": suite_file_dictionary.get("DEX").append(suite_file) @@ -414,6 +414,28 @@ class TestCaseManager(object): if not os.path.exists(xts_test_case_path): LOG.error("xts %s is not exist." % xts_test_case_path) return xts_suit_file_dic + + testcase_dict = { + "DEX": {}, + "HAP": {}, + "PYT": {}, + "CXX": {}, + "BIN": {}, + "OHJST": {}, + "JST": {}, + "LTPPosix": {}, + "OHRust": {}, + "ABC": {} + } + test_level_dict = {} + testcase_json = options.testcasefile + if testcase_json and not os.path.exists(testcase_json): + return xts_suit_file_dic + + testcase_json_dic = {} + if os.path.exists(testcase_json) and testcase_json.endswith(".json"): + testcase_json_dic = json.load(open(testcase_json)) + # 获取XTS测试用例输出目录下面的所有文件路径列表 xts_suite_file_list = get_file_list_by_postfix(xts_test_case_path) for xts_suite_file in xts_suite_file_list: @@ -421,14 +443,49 @@ class TestCaseManager(object): prefix_name, suffix_name = os.path.splitext(file_name) if not self.check_xts_config_match(options, prefix_name, xts_suite_file): continue + + json_config_part = self.get_part_name_test_file(xts_suite_file) + level = "" + testcase_list = [] + if testcase_json_dic: + if json_config_part not in testcase_json_dic: + continue + + part_test_dic = testcase_json_dic.get(json_config_part) + if part_test_dic and "level" in part_test_dic.keys(): + level = part_test_dic.pop("level", "") + + if part_test_dic and prefix_name not in part_test_dic: + continue + + suite_dic = part_test_dic.get(prefix_name, {}) + if suite_dic and "level" in suite_dic.keys(): + testcase_list = part_test_dic.get(prefix_name, {}).get("testcase", []) + if not testcase_list: + level = suite_dic.pop("level", "") + + if level in ["0", "1", "2", "3", "4"]: + test_level_dict[xts_suite_file] = level + if suffix_name == "": if file_name == "HatsOpenPosixTest": xts_suit_file_dic.get("LTPPosix").append(xts_suite_file) + if testcase_list: + testcase_dict["LTPPosix"][prefix_name] = ",".join(testcase_list) else: xts_suit_file_dic.get("CXX").append(xts_suite_file) + if testcase_list: + testcase_dict["CXX"][prefix_name] = ",".join(testcase_list) elif suffix_name == ".hap": if self.get_hap_test_driver(xts_suite_file) == "OHJSUnitTest": xts_suit_file_dic.get("OHJST").append(xts_suite_file) + if testcase_list: + testcase_dict["OHJST"][prefix_name] = ",".join(testcase_list) if self.get_hap_test_driver(xts_suite_file) == "JSUnitTest": xts_suit_file_dic.get("JST").append(xts_suite_file) + if testcase_list: + testcase_dict["JST"][prefix_name] = ",".join(testcase_list) + + options.testcase_dict = testcase_dict + options.test_level_dict = test_level_dict return xts_suit_file_dic -- Gitee From dd9e9c0f15d5162e9d8f0daa6ee7c8d40eb115fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=9B=BD=E8=BE=89?= Date: Fri, 12 Sep 2025 05:18:30 +0000 Subject: [PATCH 4/5] =?UTF-8?q?Signed-off-by:=20=E9=BB=84=E5=9B=BD?= =?UTF-8?q?=E8=BE=89=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄国辉 --- src/core/driver/drivers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index c035f75..ef33be2 100644 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -658,7 +658,6 @@ class CppTestDriver(IDriver): else: testcase = self.config.testcase_dict.get("CXX", {}).get(filename, "") test_para = self._get_test_para(testcase, - self.config.testcase, self.config.testlevel, self.config.testtype, self.config.target_test_path, -- Gitee From 98748214eeddd1dda185e287be9e873535e379c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=9B=BD=E8=BE=89?= Date: Fri, 12 Sep 2025 05:38:14 +0000 Subject: [PATCH 5/5] =?UTF-8?q?Signed-off-by:=20=E9=BB=84=E5=9B=BD?= =?UTF-8?q?=E8=BE=89=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄国辉 --- src/core/testcase/testcase_manager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index 3257085..7e51def 100644 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -349,14 +349,14 @@ class TestCaseManager(object): suite_file_dictionary.get("PYT").append(suite_file) if testcase_list: - testcase_dict["PYT"][prefix_name] = ":".join(testcase_list) + testcase_dict["PYT"][prefix_name] = ":".join(testcase_list) elif suffix_name == "": if file_name.startswith("rust_"): Binder.get_tdd_config().update_test_type_in_source( "OHRust", DeviceTestType.oh_rust_test) suite_file_dictionary.get("OHRust").append(suite_file) if testcase_list: - testcase_dict["OHRUST"][prefix_name] = ":".join(testcase_list) + testcase_dict["OHRust"][prefix_name] = ":".join(testcase_list) else: suite_file_dictionary.get("CXX").append(suite_file) if testcase_list: @@ -364,13 +364,13 @@ class TestCaseManager(object): elif suffix_name == ".bin": suite_file_dictionary.get("BIN").append(suite_file) if testcase_list: - testcase_dict["BIN"][prefix_name] = ":".join(testcase_list) + testcase_dict["BIN"][prefix_name] = ":".join(testcase_list) # 将arktstdd的测试文件加入测试文件字典 elif (suffix_name == ".abc" and not os.path.dirname(suite_file).endswith("out") and not os.path.dirname(suite_file).endswith("hypium")): suite_file_dictionary.get("ABC").append(suite_file) if testcase_list: - testcase_dict["ABC"][prefix_name] = ":".join(testcase_list) + testcase_dict["ABC"][prefix_name] = ":".join(testcase_list) options.testcase_dict = testcase_dict options.test_level_dict = test_level_dict -- Gitee