diff --git a/src/__init__.py b/src/__init__.py index 231bb06f570e6697a7bbfb66fdb5c8b5987b7583..3523e95e98b18e7ca62df9e9c1f0718dbbdf84d8 100755 --- a/src/__init__.py +++ b/src/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/__init__.py b/src/core/__init__.py index d63d77b7bff3df1fae2780c860693835e633cb09..2e9ff8d48807da09732597189c3192210adc8144 100755 --- a/src/core/__init__.py +++ b/src/core/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -14,5 +14,4 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - +# \ No newline at end of file diff --git a/src/core/build/__init__.py b/src/core/build/__init__.py index d63d77b7bff3df1fae2780c860693835e633cb09..58b51a8ed641571cfc02ac99ed7ec34d513cbb1d 100755 --- a/src/core/build/__init__.py +++ b/src/core/build/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/build/build_lite_manager.py b/src/core/build/build_lite_manager.py index c50272a5870a9f073fb8d50d0e2ada1ee90866ad..9d6118f423100baa10de59f5a0daf2c41c7aae6f 100755 --- a/src/core/build/build_lite_manager.py +++ b/src/core/build/build_lite_manager.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/build/build_lite_testcases.sh b/src/core/build/build_lite_testcases.sh index 0aec2566c3815998829aca10757fbf0e2984d2a7..4aac11c0f01c1008115ecfedab3a646afb2341ae 100755 --- a/src/core/build/build_lite_testcases.sh +++ b/src/core/build/build_lite_testcases.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/build/build_manager.py b/src/core/build/build_manager.py index b0cf72d8e8fbeafcfa863859eee13c2c1c009300..735fd336c53cab7d7a66db9cd3808368a0f952ee 100755 --- a/src/core/build/build_manager.py +++ b/src/core/build/build_manager.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/build/build_testcases.py b/src/core/build/build_testcases.py index 95351c0061b4cacc29bed9027b9d36c293fceb4e..560ebb10f3cec7f8f5c2723cf4c3d2b50dbe1b96 100755 --- a/src/core/build/build_testcases.py +++ b/src/core/build/build_testcases.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -208,7 +208,8 @@ class BuildTestcases(object): acts_build_command.append(BUILD_PRODUCT_NAME % para.productform) acts_build_command.append("system_size=standard") if len(para.subsystem) > 0: - acts_build_command.append(BUILD_TARGET_SUBSYSTEM % 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: diff --git a/src/core/build/select_targets.py b/src/core/build/select_targets.py index ce6c88cf8c3d4c6fe19243c490230374d30c1771..f6563fa96b46876be911855c1d6e9350dd5db562 100755 --- a/src/core/build/select_targets.py +++ b/src/core/build/select_targets.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/__init__.py b/src/core/command/__init__.py index d63d77b7bff3df1fae2780c860693835e633cb09..58b51a8ed641571cfc02ac99ed7ec34d513cbb1d 100755 --- a/src/core/command/__init__.py +++ b/src/core/command/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/console.py b/src/core/command/console.py index 87c3e9ef2028b815cfd5797d1f5d64d21b4b00f7..7ae9ff5922fb3c9b9ac7213ee8af89ee15ec148f 100755 --- a/src/core/command/console.py +++ b/src/core/command/console.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -20,8 +20,9 @@ import argparse import sys import signal import platform - +from dataclasses import dataclass from core.constants import ToolCommandType +from core.exception import ParamError from xdevice import platform_logger from xdevice import EnvironmentManager from core.command.run import Run @@ -40,10 +41,9 @@ except ModuleNotFoundError: except ImportError: print("ImportError: libreadline.so is not exist.") -__all__ = ["Console"] +__all__ = ["Console", "ConfigConst"] LOG = platform_logger("Console") - ############################################################################## ############################################################################## @@ -122,7 +122,6 @@ class Console(object): parser = argparse.ArgumentParser(description="Specify test para.") parser.add_argument("action", type=str.lower, help="Specify action") - # Developer test general test parameters parser.add_argument("-p", "--productform", action="store", @@ -164,6 +163,14 @@ class Console(object): default="", help="Specify test suit" ) + parser.add_argument("-ta", "--testargs", + action="store", + type=str, + nargs='+', + dest=ConfigConst.testargs, + default={}, + help="Specify test arguments" + ) parser.add_argument("-tc", "--testcase", action="store", type=str, @@ -214,7 +221,9 @@ class Console(object): default="", help="Specify fuzzer name" ) + # 解析部分命令行参数,会返回一个由两个条目构成的元组,其中包含带成员的命名空间(options)和剩余参数字符串的列表(unparsed) + cls._params_pre_processing(para_list) (options, unparsed) = parser.parse_known_args(para_list) # Set default value @@ -273,6 +282,37 @@ class Console(object): UnicodeError) as exception: LOG.exception(exception, exc_info=False) + @classmethod + def _params_pre_processing(cls, para_list): + if len(para_list) <= 1 or ( + len(para_list) > 1 and "-" in str(para_list[1])): + para_list.insert(1, "empty") + for index, param in enumerate(para_list): + if param == "--retry": + if index + 1 == len(para_list): + para_list.append("retry_previous_command") + elif "-" in str(para_list[index + 1]): + para_list.insert(index + 1, "retry_previous_command") + elif param == "-->": + para_list[index] = "!%s" % param + + @staticmethod + def _parse_combination_param(combination_value): + # sample: size:xxx1;exclude-annotation:xxx + parse_result = {} + key_value_pairs = str(combination_value).split(";") + for key_value_pair in key_value_pairs: + key, value = key_value_pair.split(":", 1) + if not value: + raise ParamError("'%s' no value" % key) + value_list = str(value).split(",") + exist_list = parse_result.get(key, []) + exist_list.extend(value_list) + parse_result[key] = exist_list + return parse_result + + + @classmethod def _process_command_help(cls, para_list): if para_list[0] == ToolCommandType.TOOLCMD_KEY_HELP: @@ -349,6 +389,47 @@ class Console(object): product_form) return build_result +@dataclass +class ConfigConst(object): + action = "action" + task = "task" + testlist = "testlist" + testfile = "testfile" + testcase = "testcase" + testdict = "testdict" + device_sn = "device_sn" + report_path = "report_path" + resource_path = "resource_path" + testcases_path = "testcases_path" + testargs = "testargs" + pass_through = "pass_through" + test_environment = "test_environment" + exectype = "exectype" + testtype = "testtype" + testdriver = "testdriver" + retry = "retry" + session = "session" + dry_run = "dry_run" + reboot_per_module = "reboot_per_module" + check_device = "check_device" + configfile = "config" + repeat = "repeat" + subsystems = "subsystems" + parts = "parts" + + # Runtime Constant + history_report_path = "history_report_path" + product_info = "product_info" + task_state = "task_state" + recover_state = "recover_state" + need_kit_setup = "need_kit_setup" + task_kits = "task_kits" + module_kits = "module_kits" + spt = "spt" + version = "version" + component_mapper = "_component_mapper" + component_base_kit = "component_base_kit" + support_component = "support_component" ############################################################################## ############################################################################## diff --git a/src/core/command/display.py b/src/core/command/display.py index 5832316b783dec1fe000149da07b2752774841c7..1b2370895ead520fd193bb6d41a95046b3704bf8 100755 --- a/src/core/command/display.py +++ b/src/core/command/display.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/distribute_execute.py b/src/core/command/distribute_execute.py index 1b5778417979b17c36b49a7ce946b6aad8c61f69..7694922bd52ee92e04a4d6ffaf045da03bf6c321 100644 --- a/src/core/command/distribute_execute.py +++ b/src/core/command/distribute_execute.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/distribute_utils.py b/src/core/command/distribute_utils.py index 5d41d3cc6c4bb046baf2a858b3192acf42f320a5..e045f4ccf11542b0d1743aac9a97e154205a18e9 100755 --- a/src/core/command/distribute_utils.py +++ b/src/core/command/distribute_utils.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/gen.py b/src/core/command/gen.py index bcbeecde7cf4c6e36546ce98436d126516d08110..4bc0fee92cdda6edadb5b1d5c03001d387d80931 100644 --- a/src/core/command/gen.py +++ b/src/core/command/gen.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/parameter.py b/src/core/command/parameter.py index 066d72adf339536c6b36168cddb4988bec3e05e2..dd69ec38e4b91f1096c00a3c2e22426304ffe16f 100755 --- a/src/core/command/parameter.py +++ b/src/core/command/parameter.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/run.py b/src/core/command/run.py index 23fca4dacee7d6a1f9f2bdc90212c531ddb93e84..56fc47d28d4df098dd00cd8373b4458e18296477 100755 --- a/src/core/command/run.py +++ b/src/core/command/run.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -78,12 +78,11 @@ class Run(object): LOG.error("Build test cases failed.") return - test_case_path = self.get_tests_out_path(options.productform) - if not os.path.exists(test_case_path): - LOG.error("%s is not exist." % test_case_path) - return + if "actstest" in options.testtype: + test_dict = self.get_acts_test_dict(options) + else: + test_dict = self.get_test_dict(options) - test_dict = TestCaseManager().get_test_files(test_case_path, options) if not self._check_test_dictionary(test_dict): LOG.error("The test file list is empty.") return @@ -228,6 +227,15 @@ class Run(object): LOG.info("testcase_path=%s" % testcase_path) 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_coverage_outpath(cls, options): @@ -241,4 +249,20 @@ 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_test_dict(self, options): + # 获取测试用例编译结果路径 + test_case_path = self.get_tests_out_path(options.productform) + if not os.path.exists(test_case_path): + LOG.error("%s is not exist." % test_case_path) + return + + test_dict = TestCaseManager().get_test_files(test_case_path, options) + return test_dict + diff --git a/src/core/common.py b/src/core/common.py index 52523658a4683a5edfb68fd567a600b0ad3781f1..e46dbc9bfd41057acf4877da5fcacbbd77067167 100755 --- a/src/core/common.py +++ b/src/core/common.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/config/__init__.py b/src/core/config/__init__.py index d63d77b7bff3df1fae2780c860693835e633cb09..58b51a8ed641571cfc02ac99ed7ec34d513cbb1d 100755 --- a/src/core/config/__init__.py +++ b/src/core/config/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/config/config_manager.py b/src/core/config/config_manager.py index 448d85dd63613d2cf5c907906b9f114312e4763e..5b45acb6f98d5f19ccc2b8506f71f1c882b3fd32 100755 --- a/src/core/config/config_manager.py +++ b/src/core/config/config_manager.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -45,7 +45,6 @@ class FrameworkConfigManager(object): def get_framework_config(self, target_name): # 获取framework_config.xml中所有name的value,返回列表 data_list = [] - try: if os.path.exists(self.filepath): diff --git a/src/core/config/parse_parts_config.py b/src/core/config/parse_parts_config.py index 5a271b7059f7b9ae311d77548caaa12cbfa8c36a..107932b61e46521b26042114064de11c79b4bcfc 100755 --- a/src/core/config/parse_parts_config.py +++ b/src/core/config/parse_parts_config.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/config/resource_manager.py b/src/core/config/resource_manager.py index 69c646367eb03a36d08713f46d96515003baf5fa..549cc7a9d8b463fe849a5820dc287f585c1e67b7 100755 --- a/src/core/config/resource_manager.py +++ b/src/core/config/resource_manager.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/constants.py b/src/core/constants.py index a1a3187a8c7a5d4924569780f8b3702f50e8fe1e..abe78f854f8cf64fce24a9ec71284c807d55c341 100755 --- a/src/core/constants.py +++ b/src/core/constants.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/driver/__init__.py b/src/core/driver/__init__.py index d63d77b7bff3df1fae2780c860693835e633cb09..58b51a8ed641571cfc02ac99ed7ec34d513cbb1d 100755 --- a/src/core/driver/__init__.py +++ b/src/core/driver/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index fd7f453d034c1ec44de52d7b775f9649d0c57b52..18aa2b3abd13f2899c14fc19175c44adeb98af11 100755 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/driver/lite_driver.py b/src/core/driver/lite_driver.py index 1f755f46aec401fe2767ff81cddc6fe4157cd9f1..8475f270d175ac15b7a8dd1c379cf71ae798dbd0 100755 --- a/src/core/driver/lite_driver.py +++ b/src/core/driver/lite_driver.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/driver/parser.py b/src/core/driver/parser.py index cc5392294e6ed9396af1026d6084f34d24abed71..ccbe705fe0e2dee54208f0f8a57497303f258e74 100755 --- a/src/core/driver/parser.py +++ b/src/core/driver/parser.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/exception.py b/src/core/exception.py index 1aa9fb9060dc48c51429bd5fe9b49c864fd0c001..0ae2dc878c6cb0fccbf43a0563d59df1a784c20a 100755 --- a/src/core/exception.py +++ b/src/core/exception.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/testcase/__init__.py b/src/core/testcase/__init__.py index d63d77b7bff3df1fae2780c860693835e633cb09..58b51a8ed641571cfc02ac99ed7ec34d513cbb1d 100755 --- a/src/core/testcase/__init__.py +++ b/src/core/testcase/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index 1bec1ddca810730086c133cdb22f9f408764682d..656924549055bfdf42d4d44643c9c493ad2248e1 100755 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -142,6 +142,9 @@ class TestCaseManager(object): 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 != "" and options.testsuit != prefix_name: continue @@ -225,3 +228,19 @@ class TestCaseManager(object): return False finally: print(" check hap test file finally") + + @classmethod + def get_part_name_test_file(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: + 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 diff --git a/src/core/testkit/__init__.py b/src/core/testkit/__init__.py index a9c48070fbceebd30c9f2118e6d87cf3db623dc4..f1b275bc535f315c5a3c7f1697658f88d6f05bbb 100755 --- a/src/core/testkit/__init__.py +++ b/src/core/testkit/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/testkit/kit_lite.py b/src/core/testkit/kit_lite.py index 21967b7b65d6850e9be206924a9f9220fb9006f1..aeabd6af88600f18f3bc10c0ecfc58666fb44ff8 100755 --- a/src/core/testkit/kit_lite.py +++ b/src/core/testkit/kit_lite.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Copyright (c) 2020-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/utils.py b/src/core/utils.py index 49a98154e5c390387442cca3a5a35e13c94bcd17..b45661d39dbc211d241117c6321592d1b6d230c4 100755 --- a/src/core/utils.py +++ b/src/core/utils.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/main/__init__.py b/src/main/__init__.py index d414ea5ceda3d5e6ef735cbf798592bf73c98851..cbbc7a7f7760e0cd95dd96d07437e7002dda7929 100755 --- a/src/main/__init__.py +++ b/src/main/__init__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/main/__main__.py b/src/main/__main__.py index 72a567ed64d0af2298772c6b5c5f0d69c26447cb..83bb24e73e2ae8e4194988a96c43d3600dd82c15 100755 --- a/src/main/__main__.py +++ b/src/main/__main__.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/main/_init_global_config.py b/src/main/_init_global_config.py index 865870ba39dcbf6cd9d183ddb52adf302c098680..08c97d4fa7dcc86b52a13234b87908e88170f3bb 100755 --- a/src/main/_init_global_config.py +++ b/src/main/_init_global_config.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at