diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..b7dc1b9b30a51a4132d829fbde1ba51b04dba6f2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/test_developertest.iml b/.idea/test_developertest.iml new file mode 100644 index 0000000000000000000000000000000000000000..8b8c395472a5a6b3598af42086e590417ace9933 --- /dev/null +++ b/.idea/test_developertest.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index fd7f453d034c1ec44de52d7b775f9649d0c57b52..85d7e4b1323bf16c86b337adbf6c841ba3b4bf39 100755 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -29,6 +29,7 @@ from json import JSONDecodeError from xdevice import DeviceTestType from xdevice import DeviceLabelType +from xdevice import CommonParserType from xdevice import ExecuteTerminate from xdevice import DeviceError from xdevice import ShellHandler @@ -37,8 +38,7 @@ from xdevice import IDriver from xdevice import platform_logger from xdevice import Plugin from xdevice import get_plugin -from xdevice_extension._core.constants import CommonParserType -from xdevice_extension._core.environment.dmlib import process_command_ret +from ohos.environment.dmlib import process_command_ret from core.utils import get_decode from core.utils import get_fuzzer_path from core.config.resource_manager import ResourceManager @@ -461,14 +461,14 @@ class CppTestDriver(IDriver): serial) with open(device_log_file, "a", encoding="UTF-8") as file_pipe: - self.config.device.start_catch_device_log(file_pipe) + self.config.device.start_catch_device_log(hilog_file_pipe=file_pipe) self._init_gtest() self._run_gtest(suite_file) finally: self.config.device.stop_catch_device_log() def _init_gtest(self): - self.config.device.hdc_command("target mount") + self.config.device.connector_command("target mount") self.config.device.execute_shell_command( "rm -rf %s" % self.config.target_test_path) self.config.device.execute_shell_command( @@ -562,7 +562,7 @@ class CppTestDriver(IDriver): if corpus_dirs: for corpus in corpus_dirs: mkdir_corpus_command = f"shell; mkdir -p {corpus}" - self.config.device.hdc_command(mkdir_corpus_command) + self.config.device.connector_command(mkdir_corpus_command) # push corpus file if corpus_file_list: @@ -655,7 +655,7 @@ class JSUnitTestDriver(IDriver): self.ability_name = ability_name self.config.test_hap_out_path = \ "/data/data/%s/files/" % self.package_name - self.config.device.hdc_command("shell hilog -r") + self.config.device.connector_command("shell hilog -r") hilog = get_device_log_file( request.config.report_path, @@ -667,7 +667,7 @@ class JSUnitTestDriver(IDriver): 0o755) with os.fdopen(hilog_open, "a") as hilog_file_pipe: - self.config.device.start_catch_device_log(hilog_file_pipe) + self.config.device.start_catch_device_log(hilog_file_pipe=hilog_file_pipe) self._init_jsunit_test() self._run_jsunit(suite_file, hilog) hilog_file_pipe.flush() @@ -676,7 +676,7 @@ class JSUnitTestDriver(IDriver): self.config.device.stop_catch_device_log() def _init_jsunit_test(self): - self.config.device.hdc_command("target mount") + self.config.device.connector_command("target mount") self.config.device.execute_shell_command( "rm -rf %s" % self.config.target_test_path) self.config.device.execute_shell_command( @@ -787,7 +787,7 @@ class JSUnitTestDriver(IDriver): return return_message def _install_hap(self, suite_file): - message = self.config.device.hdc_command("install %s" % suite_file) + message = self.config.device.connector_command("install %s" % suite_file) message = str(message).rstrip() if message == "" or "success" in message: return_code = True diff --git a/src/core/driver/lite_driver.py b/src/core/driver/lite_driver.py index 1f755f46aec401fe2767ff81cddc6fe4157cd9f1..4aaa4da4732a507426d838c017e547b53e13107b 100755 --- a/src/core/driver/lite_driver.py +++ b/src/core/driver/lite_driver.py @@ -26,11 +26,8 @@ from xdevice import IDriver from xdevice import Plugin from xdevice import platform_logger from xdevice import DeviceLabelType -from xdevice import ComType -from xdevice import ParserType from xdevice import ShellHandler from xdevice import ExecuteTerminate -from xdevice import LiteDeviceExecuteCommandError from xdevice import get_plugin from xdevice import JsonParser from xdevice import get_config_value @@ -39,6 +36,10 @@ from xdevice import check_result_report from xdevice import get_device_log_file from xdevice import get_test_component_version from xdevice import ParamError +from ohos.constants import ParserType +from ohos.constants import ComType +from ohos.constants import CKit +from ohos.exception import LiteDeviceExecuteCommandError from core.utils import get_filename_extension from core.testkit.kit_lite import DeployKit from core.config.resource_manager import ResourceManager diff --git a/src/core/testkit/kit_lite.py b/src/core/testkit/kit_lite.py index 21967b7b65d6850e9be206924a9f9220fb9006f1..8a4dcb587229c41498e3c353a104b0f44ecf5970 100755 --- a/src/core/testkit/kit_lite.py +++ b/src/core/testkit/kit_lite.py @@ -25,16 +25,15 @@ import subprocess from xdevice import platform_logger from xdevice import Plugin -from xdevice import CKit -from xdevice import ComType from xdevice import ParamError from xdevice import LiteDeviceError from xdevice import ITestKit from xdevice import get_config_value from xdevice import get_file_absolute_path -from xdevice import LiteDeviceConnectError from xdevice import DeviceAllocationState - +from ohos.constants import ComType +from ohos.constants import CKit +from ohos.exception import LiteDeviceConnectError __all__ = ["DeployKit"] LOG = platform_logger("KitLite") diff --git a/src/main/_init_global_config.py b/src/main/_init_global_config.py index 865870ba39dcbf6cd9d183ddb52adf302c098680..1d3ed0c075f522ac63b0a0ad71462e68c7213289 100755 --- a/src/main/_init_global_config.py +++ b/src/main/_init_global_config.py @@ -43,12 +43,13 @@ def _init_global_config(): "src")) sys.path.insert(0, sys.xdevice_dir) - # 变量注释 sys.xdevice_extension_dir = OpenHarmony/xdevice/extension/src + # 变量注释 sys.xdevice_ohos_dir = OpenHarmony/xdevice/plugins/ohos/src sys.xdevice_extension_dir = os.path.abspath(os.path.join( sys.framework_root_dir, "..", "xdevice", - "extension", + "plugins", + "ohos", "src")) sys.path.insert(1, sys.xdevice_extension_dir) @@ -110,10 +111,15 @@ def _load_internal_plugins(): _iter_module_plugins([core.driver, benchmark.report.benchmark_reporter]) try: - import xdevice_extension._core.environment - _iter_module_plugins([xdevice_extension._core.environment]) - import xdevice_extension._core.driver - _iter_module_plugins([xdevice_extension._core.driver]) + import ohos.environment + _iter_module_plugins([ohos.environment]) + import ohos.testkit + _iter_module_plugins([ohos.testkit]) + import ohos.managers + _iter_module_plugins([ohos.managers]) + import ohos.parser + _iter_module_plugins([ohos.parser]) + except (ModuleNotFoundError, ImportError): pass