diff --git a/config/framework_config.xml b/config/framework_config.xml
index e02a69d1406c7d75c16414e1ae16eab0451691dd..ced2d4d5aa0b087775975f040081074f0cee5d75 100644
--- a/config/framework_config.xml
+++ b/config/framework_config.xml
@@ -24,10 +24,13 @@
desc="unittest"
timeout="300" />
+
+
@@ -67,4 +71,4 @@
-
+
\ No newline at end of file
diff --git a/src/core/build/build_manager.py b/src/core/build/build_manager.py
index 26ba353152f72ac199b6add53e22e39cbdc1bd9d..04f0a2fda8770b521f6a0eee3636adf70fd84115 100644
--- a/src/core/build/build_manager.py
+++ b/src/core/build/build_manager.py
@@ -64,29 +64,16 @@ class BuildManager(object):
build_result = False
return build_result
- # 根据目标编译acts测试用例
+ # 根据目标编译xts测试用例
# project_root_path 工程根目录
# para 指令参数
@classmethod
- def _compile_acts_test_cases(cls, project_root_path, para):
- if BuildTestcases(project_root_path).build_acts_testcases(para):
- LOG.info("Acts test case compilation successed.")
+ def _compile_xts_test_cases(cls, project_root_path, para):
+ if BuildTestcases(project_root_path).build_xts_testcases(para):
+ LOG.info("XTS test case compilation successed.")
build_result = True
else:
- LOG.info("Acts test compilation failed, please modify.")
- build_result = False
- return build_result
-
- # 根据目标编译hats测试用例
- # project_root_path 工程根目录
- # para 指令参数
- @classmethod
- def _compile_hats_test_cases(cls, project_root_path, para):
- if BuildTestcases(project_root_path).build_hats_testcases(para):
- LOG.info("Hats test case compilation successed.")
- build_result = True
- else:
- LOG.info("Hats test compilation failed, please modify.")
+ LOG.info("XTS test compilation failed, please modify.")
build_result = False
return build_result
@@ -196,15 +183,11 @@ class BuildManager(object):
LOG.info("**************************************************")
LOG.info("")
- build_acts_result = True
- build_hats_result = True
+ build_xts_result = True
build_result = True
- if "actstest" in param.testtype:
- LOG.info("**********************Start build acts testcases****************************")
- build_acts_result = self._compile_acts_test_cases(project_root_path, param)
- elif "hatstest" in param.testtype:
- LOG.info("**********************Start build hats testcases****************************")
- build_hats_result = self._compile_hats_test_cases(project_root_path, param)
+ if "acts" in param.testtype or "hats" in param.testtype or "hits" in param.testtype:
+ LOG.info("**********************Start build xts testcases****************************")
+ build_xts_result = self._compile_xts_test_cases(project_root_path, param)
else:
LOG.info("**********************Start build subsystem testcases****************************")
build_result = self._compile_testcases(project_root_path, param)
@@ -215,7 +198,7 @@ class BuildManager(object):
LOG.info("**************************************************")
LOG.info("")
- return build_result and build_acts_result and build_hats_result
+ return build_result and build_xts_result
##############################################################################
diff --git a/src/core/build/build_testcases.py b/src/core/build/build_testcases.py
index 89e9e2791210375e1c02a228a6a2896264884623..cdbb57f299fca94f980e800ef09de1aa9eb0b6cd 100644
--- a/src/core/build/build_testcases.py
+++ b/src/core/build/build_testcases.py
@@ -44,14 +44,6 @@ LOG = platform_logger("BuildTestcases")
class BuildTestcases(object):
def __init__(self, project_rootpath):
self.project_rootpath = project_rootpath
- self.xts_project_rootpath = os.path.join(sys.source_code_root_path,
- "test",
- "xts",
- "acts")
- self._xts_project_rootpath = os.path.join(sys.source_code_root_path,
- "test",
- "xts",
- "hats")
user_manager = UserConfigManager()
self.is_build_example = user_manager.get_user_config_flag(
"build", "example")
@@ -100,27 +92,16 @@ class BuildTestcases(object):
return testcase_outpath
@classmethod
- def _delete_acts_testcase_dir(cls, productform):
- acts_testcase_out_dir = os.path.join(
- get_build_output_path(productform),
- "suites",
- "acts",
- "testcases")
- LOG.info("acts_testcase_out_dir=%s" % acts_testcase_out_dir)
- # 删除~/OpenHarmony/out/rk3568/suites/acts/testcases目录内容
- if os.path.exists(acts_testcase_out_dir):
- shutil.rmtree(acts_testcase_out_dir)
-
- def _delete_hats_testcase_dir(cls, productform):
- hats_testcase_out_dir = os.path.join(
- get_build_output_path(productform),
+ def _delete_xts_testcase_dir(cls, para):
+ xts_testcase_out_dir = os.path.join(
+ get_build_output_path(para.productform),
"suites",
- "hats",
+ para.testtype[0],
"testcases")
- LOG.info("hats_testcase_out_dir=%s" % hats_testcase_out_dir)
- # 删除~/OpenHarmony/out/rk3568/suites/hats/testcases目录内容
- if os.path.exists(hats_testcase_out_dir):
- shutil.rmtree(hats_testcase_out_dir)
+ LOG.info("xts_testcase_out_dir=%s" % xts_testcase_out_dir)
+ # 删除~/OpenHarmony/out/rk3568/suites/xts/testcases目录内容
+ if os.path.exists(xts_testcase_out_dir):
+ shutil.rmtree(xts_testcase_out_dir)
def _delete_testcase_dir(self, productform):
if is_open_source_product(productform):
@@ -215,66 +196,38 @@ class BuildTestcases(object):
os.chdir(current_path)
return build_result
- def _execute_build_acts_command(self, para):
+ def _execute_build_xts_command(self, para):
build_result = False
- acts_build_command = []
+ xts_build_command = []
current_path = os.getcwd()
- # 路径 acts_rootpath = ~/OpenHarmony/test/xts/acts
- os.chdir(self.xts_project_rootpath)
- acts_build_command.append(BUILD_PRODUCT_NAME % para.productform)
- acts_build_command.append("system_size=standard")
+ # eg.路径 acts_rootpath = ~/OpenHarmony/test/xts/acts
+ xts_project_rootpath = os.path.join(sys.source_code_root_path,
+ "test",
+ "xts",
+ para.testtype[0])
+ os.chdir(xts_project_rootpath)
+ xts_build_command.append(BUILD_PRODUCT_NAME % para.productform)
+ xts_build_command.append("system_size=standard")
if len(para.subsystem) > 0:
input_subsystem = ",".join(para.subsystem)
- acts_build_command.append(BUILD_TARGET_SUBSYSTEM % input_subsystem)
+ xts_build_command.append(BUILD_TARGET_SUBSYSTEM % input_subsystem)
if para.testsuit != "" and len(para.subsystem) == 0:
LOG.error("Please specify subsystem.")
return
target_cpu = self.build_parameter_dic.get("target_cpu")
if target_cpu == "arm64":
- acts_build_command.append("target_arch=" + target_cpu)
- if os.path.exists(BUILD_FILEPATH):
- build_command = [BUILD_FILEPATH]
- build_command.extend(acts_build_command)
- LOG.info("build_acts_command: %s" % str(build_command))
- if subprocess.call(build_command) == 0:
- build_result = True
- else:
- build_result = False
- else:
- LOG.warning("Build Acts Testcase Error: The %s is not exist" % BUILD_FILEPATH)
-
- os.chdir(current_path)
- return build_result
-
- def _execute_build_hats_command(self, para):
- build_result = False
- hats_build_command = []
- current_path = os.getcwd()
- # 路径 hats_rootpath = ~/OpenHarmony/test/xts/hats
- os.chdir(self._xts_project_rootpath)
- hats_build_command.append(BUILD_PRODUCT_NAME % para.productform)
- hats_build_command.append("system_size=standard")
- if len(para.subsystem) > 0:
- input_subsystem = ",".join(para.subsystem)
- hats_build_command.append(BUILD_TARGET_SUBSYSTEM % input_subsystem)
- if para.testsuit != "" and len(para.subsystem) == 0:
- LOG.error("Please specify subsystem.")
- return build_result
- target_cpu = self.build_parameter_dic.get("target_cpu")
- if target_cpu == "arm64":
- hats_build_command.append("target_arch=" + target_cpu)
- if para.productform == "m40":
- hats_build_command.append("use_musl=true")
+ xts_build_command.append("target_arch=" + target_cpu)
+ xts_build_command.append("use_musl=true")
if os.path.exists(BUILD_FILEPATH):
build_command = [BUILD_FILEPATH]
- build_command.extend(hats_build_command)
- LOG.info("build_hats_command: %s" % str(build_command))
+ build_command.extend(xts_build_command)
+ LOG.info("build_xts_command: %s" % str(build_command))
if subprocess.call(build_command) == 0:
build_result = True
else:
build_result = False
else:
- LOG.warning("Build Hats Testcase Error: The %s is not exist" % BUILD_FILEPATH)
+ LOG.warning("Build XTS Testcase Error: The %s is not exist" % BUILD_FILEPATH)
os.chdir(current_path)
return build_result
@@ -316,16 +269,10 @@ class BuildTestcases(object):
self._merge_testcase_dir(productform)
return build_result
- # 编译ACTS测试用例
- def build_acts_testcases(self, para):
- self._delete_acts_testcase_dir(para.productform)
- build_result = self._execute_build_acts_command(para)
- return build_result
-
- # 编译HATS测试用例
- def build_hats_testcases(self, para):
- self._delete_hats_testcase_dir(para.productform)
- build_result = self._execute_build_hats_command(para)
+ # 编译XTS测试用例
+ def build_xts_testcases(self, para):
+ self._delete_xts_testcase_dir(para)
+ build_result = self._execute_build_xts_command(para)
return build_result
def build_gn_file(self, productform):
diff --git a/src/core/command/run.py b/src/core/command/run.py
index 83dc67ebff7884525f113d4ea73602bb745489bf..cd8df50be68192886dc2d12355ee4f6c845a85d6 100644
--- a/src/core/command/run.py
+++ b/src/core/command/run.py
@@ -165,14 +165,10 @@ class Run(object):
LOG.error("Build test cases failed.")
return
- 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)
- elif "hatstest" in options.testtype:
- test_dict = self.get_hats_test_dict(options)
- options.testcases_path = self.get_hats_tests_out_path(options.productform)
- options.resource_path = self.get_hats_tests_out_path(options.productform)
+ if "acts" in options.testtype or "hats" in options.testtype or "hits" in options.testtype:
+ test_dict = self.get_xts_test_dict(options)
+ options.testcases_path = self.get_xts_tests_out_path(options.productform, options.testtype)
+ options.resource_path = self.get_xts_tests_out_path(options.productform, options.testtype)
else:
test_dict = self.get_test_dict(options)
@@ -330,26 +326,16 @@ class Run(object):
return testcase_path
@classmethod
- def get_acts_tests_out_path(cls, product_form):
- acts_testcase_path = os.path.abspath(os.path.join(
- get_build_output_path(product_form),
- "suites",
- "acts",
- "testcases"))
- LOG.info("acts_testcase_path=%s" % acts_testcase_path)
- return acts_testcase_path
-
- @classmethod
- def get_hats_tests_out_path(cls, product_form):
- hats_testcase_path = UserConfigManager().get_test_cases_dir()
- if hats_testcase_path == "":
- hats_testcase_path = os.path.abspath(os.path.join(
+ def get_xts_tests_out_path(cls, product_form, testtype):
+ xts_testcase_path = UserConfigManager().get_test_cases_dir()
+ if xts_testcase_path == "":
+ xts_testcase_path = os.path.abspath(os.path.join(
get_build_output_path(product_form),
"suites",
- "hats",
+ testtype[0],
"testcases"))
- LOG.info("hats_testcase_path=%s" % hats_testcase_path)
- return hats_testcase_path
+ LOG.info("xts_testcase_path=%s" % xts_testcase_path)
+ return xts_testcase_path
@classmethod
def get_coverage_outpath(cls, options):
@@ -363,17 +349,14 @@ class Run(object):
LOG.error("Coverage test: coverage_outpath is empty.")
return coverage_out_path
- def get_acts_test_dict(self, options):
- # 获取测试用例编译结果路径
- acts_test_case_path = self.get_acts_tests_out_path(options.productform)
- acts_test_dict = TestCaseManager().get_acts_test_files(acts_test_case_path, options)
- return acts_test_dict
-
- def get_hats_test_dict(self, options):
- # 获取HATS测试用例编译结果路径
- hats_test_case_path = self.get_hats_tests_out_path(options.productform)
- hats_test_dict = TestCaseManager().get_hats_test_files(hats_test_case_path, options)
- return hats_test_dict
+ def get_xts_test_dict(self, options):
+ # 获取XTS测试用例编译结果路径
+ xts_test_case_path = self.get_xts_tests_out_path(options.productform, options.testtype)
+ if not os.path.exists(xts_test_case_path):
+ LOG.error("%s is not exist." % xts_test_case_path)
+ return
+ xts_test_dict = TestCaseManager().get_xts_test_files(xts_test_case_path, options)
+ return xts_test_dict
def get_test_dict(self, options):
# 获取测试用例编译结果路径
diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py
index fad75b0456ed1ea9f41345d6692df35b115f0756..1c47b4f3f7e849c47775041b492e008d1d59b704 100644
--- a/src/core/testcase/testcase_manager.py
+++ b/src/core/testcase/testcase_manager.py
@@ -152,45 +152,11 @@ class TestCaseManager(object):
return suite_file_dictionary
- def get_acts_test_files(self, acts_test_case_path, options):
- LOG.info("acts test case path: " + acts_test_case_path)
- acts_suit_file_dic = copy.deepcopy(TESTFILE_TYPE_DATA_DIC)
- if os.path.exists(acts_test_case_path):
- # 获取acts测试用例输出目录下面的所有文件路径列表
- acts_suite_file_list = get_file_list_by_postfix(acts_test_case_path)
- for acts_suite_file in acts_suite_file_list:
- file_name = os.path.basename(acts_suite_file)
- prefix_name, suffix_name = os.path.splitext(file_name)
- if suffix_name != ".hap":
- continue
- # 如果acts测试指定了-tp,只有部件名与moduleInfo中part一致的HAP包才会加入最终执行的队列
- if options.testpart != [] and options.testpart[0] != self.get_part_name_test_file(acts_suite_file):
- continue
- # 如果acts测试指定了-ts,只有完全匹配的HAP包才会加入最终执行的队列
- if options.testsuit != "":
- testsuit_list = options.testsuit.split(";")
- is_match = False
- for suite_item in testsuit_list:
- if suite_item == prefix_name:
- is_match = True
- break
- if not is_match:
- continue
- if not self.check_hap_test_file(acts_suite_file):
- continue
- if self.get_hap_test_driver(acts_suite_file) == "OHJSUnitTest":
- acts_suit_file_dic.get("OHJST").append(acts_suite_file)
- if self.get_hap_test_driver(acts_suite_file) == "JSUnitTest":
- acts_suit_file_dic.get("JST").append(acts_suite_file)
- else:
- LOG.error("acts %s is not exist." % acts_test_case_path)
- return acts_suit_file_dic
-
- def check_hats_config_match(self, options, prefix_name, hats_suite_file):
- # 如果hats测试指定了-tp,只有部件名与moduleInfo中part一致的CXX文件才会加入最终执行的队列
- if options.testpart != [] and options.testpart[0] != self.get_part_name_test_file(hats_suite_file):
+ def check_xts_config_match(self, options, prefix_name, xts_suite_file):
+ # 如果xts测试指定了-tp,只有部件名与moduleInfo中part一致的文件才会加入最终执行的队列
+ if options.testpart != [] and options.testpart[0] != self.get_part_name_test_file(xts_suite_file):
return False
- # 如果hats测试指定了-ts,只有完全匹配的CXX才会加入最终执行的队列
+ # 如果xts测试指定了-ts,只有完全匹配的文件才会加入最终执行的队列
if options.testsuit != "":
testsuit_list = options.testsuit.split(";")
for suite_item in testsuit_list:
@@ -199,25 +165,30 @@ class TestCaseManager(object):
return False
return True
- def get_hats_test_files(self, hats_test_case_path, options):
- LOG.info("hats test case path: " + hats_test_case_path)
- hats_suit_file_dic = copy.deepcopy(TESTFILE_TYPE_DATA_DIC)
- if not os.path.exists(hats_test_case_path):
- LOG.error("hats %s is not exist." % hats_test_case_path)
- return hats_suit_file_dic
- # 获取hats测试用例输出目录下面的所有文件路径列表
- hats_suite_file_list = get_file_list_by_postfix(hats_test_case_path)
- for hats_suite_file in hats_suite_file_list:
- file_name = os.path.basename(hats_suite_file)
+ def get_xts_test_files(self, xts_test_case_path, options):
+ LOG.info("xts test case path: " + xts_test_case_path)
+ xts_suit_file_dic = copy.deepcopy(TESTFILE_TYPE_DATA_DIC)
+ 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
+ # 获取XTS测试用例输出目录下面的所有文件路径列表
+ xts_suite_file_list = get_file_list_by_postfix(xts_test_case_path)
+ for xts_suite_file in xts_suite_file_list:
+ file_name = os.path.basename(xts_suite_file)
prefix_name, suffix_name = os.path.splitext(file_name)
- if not self.check_hats_config_match(options, prefix_name, hats_suite_file):
+ if not self.check_xts_config_match(options, prefix_name, xts_suite_file):
continue
if suffix_name == "":
if file_name == "HatsOpenPosixTest":
- hats_suit_file_dic.get("LTPPosix").append(hats_suite_file)
+ xts_suit_file_dic.get("LTPPosix").append(xts_suite_file)
else:
- hats_suit_file_dic.get("CXX").append(hats_suite_file)
- return hats_suit_file_dic
+ xts_suit_file_dic.get("CXX").append(xts_suite_file)
+ 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 self.get_hap_test_driver(xts_suite_file) == "JSUnitTest":
+ xts_suit_file_dic.get("JST").append(xts_suite_file)
+ return xts_suit_file_dic
@classmethod
def get_valid_suite_file(cls, test_case_out_path, suite_file, options):