diff --git a/src/core/build/build_testcases.py b/src/core/build/build_testcases.py index 560ebb10f3cec7f8f5c2723cf4c3d2b50dbe1b96..73cc1d03f083311d3c3c80d391a1ffd17a4384df 100755 --- a/src/core/build/build_testcases.py +++ b/src/core/build/build_testcases.py @@ -22,6 +22,8 @@ import json import shutil import subprocess import platform +import time + from xdevice import platform_logger from core.utils import get_build_output_path from core.utils import scan_support_product @@ -210,9 +212,7 @@ class BuildTestcases(object): if len(para.subsystem) > 0: input_subsystem = ",".join(para.subsystem) acts_build_command.append(BUILD_TARGET_SUBSYSTEM % input_subsystem) - if para.testsuit != "" and len(para.subsystem) > 0: - acts_build_command.append(BUILD_TARGET_SUITE % para.testsuit) - elif para.testsuit != "" and len(para.subsystem) == 0: + if para.testsuit != "" and len(para.subsystem) == 0: LOG.error("Please specify subsystem.") return if os.path.exists(BUILD_FILEPATH): @@ -259,6 +259,7 @@ class BuildTestcases(object): # 编译ACTS测试用例 def build_acts_testcases(self, para): self._delete_acts_testcase_dir(para.productform) + time.sleep(5) build_result = self._execute_build_acts_command(para) return build_result diff --git a/src/core/command/console.py b/src/core/command/console.py index 7ae9ff5922fb3c9b9ac7213ee8af89ee15ec148f..f9e6189dfdd4b46916b2924c07b71ccdb4ed987a 100755 --- a/src/core/command/console.py +++ b/src/core/command/console.py @@ -312,7 +312,6 @@ class Console(object): return parse_result - @classmethod def _process_command_help(cls, para_list): if para_list[0] == ToolCommandType.TOOLCMD_KEY_HELP: @@ -337,7 +336,6 @@ class Console(object): LOG.error("Wrong gen command.") return - # run命令执行入口 @classmethod def _process_command_run(cls, command, options): if command == ToolCommandType.TOOLCMD_KEY_RUN: @@ -389,6 +387,7 @@ class Console(object): product_form) return build_result + @dataclass class ConfigConst(object): action = "action" @@ -431,5 +430,6 @@ class ConfigConst(object): component_base_kit = "component_base_kit" support_component = "support_component" + ############################################################################## ############################################################################## diff --git a/src/core/command/run.py b/src/core/command/run.py index 56fc47d28d4df098dd00cd8373b4458e18296477..f79147554306177257fe37f42f3de6554a6295fc 100755 --- a/src/core/command/run.py +++ b/src/core/command/run.py @@ -80,6 +80,8 @@ class Run(object): if "actstest" in options.testtype: test_dict = self.get_acts_test_dict(options) + options.testcases_path = self.get_acts_tests_out_path(options.productform) + options.resource_path = self.get_acts_tests_out_path(options.productform) else: test_dict = self.get_test_dict(options) diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index b2ed16991bd65f9dbae670c8bc31149d2f7c6866..fb2221a021b2823a36148d7b11bd9a7f338408a7 100755 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -606,7 +606,7 @@ class CppTestDriver(IDriver): ############################################################################## ############################################################################## -@Plugin(type=Plugin.DRIVER, id=DeviceTestType.jsunit_test) +#@Plugin(type=Plugin.DRIVER, id=DeviceTestType.jsunit_test) class JSUnitTestDriver(IDriver): """ JSUnitTestDriver is a Test that runs a native test package on given device. diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index 656924549055bfdf42d4d44643c9c493ad2248e1..a23de04c75888a03d21d2ba9b6347f6aaa59eb0b 100755 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -36,6 +36,7 @@ TESTFILE_TYPE_DATA_DIC = { "PYT": [], "CXX": [], "BIN": [], + "OHJST": [], "JST": [], } FILTER_SUFFIX_NAME_LIST = [".TOC", ".info", ".pyc"] @@ -150,7 +151,10 @@ class TestCaseManager(object): continue if not self.check_hap_test_file(acts_suite_file): continue - acts_suit_file_dic["JST"].append(acts_suite_file) + if self.get_hap_test_driver(acts_suite_file) == "OHJSUnitTest": + acts_suit_file_dic["OHJST"].append(acts_suite_file) + if self.get_hap_test_driver(acts_suite_file) == "JSUnitTest": + acts_suit_file_dic["JST"].append(acts_suite_file) else: LOG.error("acts %s is not exist." % acts_test_case_path) return acts_suit_file_dic @@ -192,7 +196,6 @@ class TestCaseManager(object): break return is_valid_status - @classmethod def check_python_test_file(cls, suite_file): if suite_file.endswith(".py"): @@ -201,7 +204,6 @@ class TestCaseManager(object): return True return False - @classmethod def check_hap_test_file(cls, hap_file_path): try: @@ -230,17 +232,34 @@ class TestCaseManager(object): print(" check hap test file finally") @classmethod - def get_part_name_test_file(cls, hap_file_path): + def get_hap_test_driver(cls, hap_file_path): + data_dic = cls.get_hap_json(hap_file_path) + if not data_dic: + return False + else: + if "driver" in data_dic.keys(): + driver_dict = data_dic.get("driver") + if bool(driver_dict): + driver_type = driver_dict.get("type") + return driver_type + else: + LOG.error("%s has not set driver." % hap_file_path) + + @classmethod + def get_hap_json(cls, hap_file_path): if hap_file_path.endswith(".hap"): - module_info_file_path = hap_file_path.replace(".hap", ".moduleInfo") - if os.path.exists(module_info_file_path): - with open(module_info_file_path, 'r') as json_file: + json_file_path = hap_file_path.replace(".hap", ".json") + if os.path.exists(json_file_path): + with open(json_file_path, 'r') as json_file: data_dic = json.load(json_file) - if not data_dic: - return False - else: - if "part" in data_dic.keys(): - part_name = data_dic["part"] - return part_name - else: - return "space" \ No newline at end of file + return data_dic + + @classmethod + def get_part_name_test_file(cls, hap_file_path): + data_dic = cls.get_hap_json(hap_file_path) + if not data_dic: + return False + else: + if "part" in data_dic.keys(): + part_name = data_dic["part"] + return part_name \ No newline at end of file