From 1faf4bc4a84726b649e9c9232f07e8160f5e2206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E6=98=A5=E5=A9=B7?= Date: Mon, 23 May 2022 12:31:30 +0000 Subject: [PATCH] Signed-off-by: 17792618987 --- aw/python/distributed/common/devices.py | 9 ++++++--- aw/python/distributed/common/manager.py | 1 + aw/python/distributed/distribute/distribute.py | 5 +++++ .../unittest/common/get_app_info/ExampleJsunit.test.js | 4 ++++ libs/fuzzlib/fuzzer_helper.py | 4 ++-- libs/fuzzlib/tools/run_result.py | 4 ++-- src/core/build/pretreat_targets.py | 2 +- src/core/command/console.py | 3 ++- src/core/command/run.py | 2 +- src/core/testcase/testcase_manager.py | 3 ++- src/main/__init__.py | 2 +- src/main/__main__.py | 3 ++- 12 files changed, 29 insertions(+), 13 deletions(-) diff --git a/aw/python/distributed/common/devices.py b/aw/python/distributed/common/devices.py index 7180385..e900160 100755 --- a/aw/python/distributed/common/devices.py +++ b/aw/python/distributed/common/devices.py @@ -179,7 +179,6 @@ class DeviceAdapter: time.sleep(1) return return_code - ############################################################### ############################################################### @@ -199,6 +198,7 @@ class DeviceAdapter: remote_ip, remote_port, device_sn) return device_para + @classmethod def execute_command(self, command, print_flag=True, timeout=900): try: if print_flag: @@ -211,6 +211,7 @@ class DeviceAdapter: print("results: failed") return False + @classmethod def execute_command_with_output(self, command, print_flag=True): if print_flag: print("command: " + command) @@ -248,6 +249,7 @@ class DeviceAdapter: command, QUOTATION_MARKS)) + @classmethod def check_path_legal(self, path): if path and " " in path: return "\"%s\"" % path @@ -318,7 +320,6 @@ class HDCDeviceAdapter: self.unlock_screen() self.unlock_device() - ############################################################### ############################################################### @@ -337,7 +338,7 @@ class HDCDeviceAdapter: device_para = "-s tcp:%s:%s -t %s" % ( remote_ip, remote_port, device_sn) return device_para - + @classmethod def execute_command(self, command, print_flag=True, timeout=900): try: if print_flag: @@ -350,6 +351,7 @@ class HDCDeviceAdapter: print("results: failed") return False + @classmethod def execute_command_with_output(self, command, print_flag=True): if print_flag: print("command: " + command) @@ -384,6 +386,7 @@ class HDCDeviceAdapter: command, QUOTATION_MARKS)) + @classmethod def check_path_legal(self, path): if path and " " in path: return "\"%s\"" % path diff --git a/aw/python/distributed/common/manager.py b/aw/python/distributed/common/manager.py index 7d3f3e9..0cba2d6 100755 --- a/aw/python/distributed/common/manager.py +++ b/aw/python/distributed/common/manager.py @@ -79,6 +79,7 @@ class DeviceManager: setattr(self, device.name, device) return + @classmethod def get_device_info_list(self): device_info_list = [] tmp_path = os.path.join(os.environ.get('PYTEST_RESULTPATH'), "temp") diff --git a/aw/python/distributed/distribute/distribute.py b/aw/python/distributed/distribute/distribute.py index 10790d0..29b0d8b 100755 --- a/aw/python/distributed/distribute/distribute.py +++ b/aw/python/distributed/distribute/distribute.py @@ -116,6 +116,7 @@ class Distribute: suite_path = os.path.join(self.suite_dir, target_name) return driver.execute(suite_path, background=False) + @classmethod def pull_result(self, device, source_path, result_save_path): _, file_name = os.path.split(source_path) device.pull_file(source_path, result_save_path) @@ -123,6 +124,7 @@ class Distribute: create_empty_result_file(result_save_path, file_name) return + @classmethod def _check_thread(self, device, thread_name): check_command = "ps -A | grep %s" % thread_name checksum = 0 @@ -164,6 +166,7 @@ class Distribute: config_major_file = os.path.join(self.suite_dir, "major.desc") self._write_device_config(config_info, config_major_file) + @classmethod def _query_device_ip(self, device): output = device.shell_with_output("getprop ro.hardware") if output == "": @@ -185,6 +188,7 @@ class Distribute: return ipaddress[0] + @classmethod def _query_device_uuid(self, device): """ 1. Run the dumpsys DdmpDeviceMonitorService command to query the value @@ -209,6 +213,7 @@ class Distribute: dev_nodeid_info = device_info[begin:end].replace('"', "") return dev_nodeid_info.split(":")[1] + @classmethod def _write_device_config(self, device_info, file_path): file_dir, file_name = os.path.split(file_path) final_file = os.path.join(file_dir, file_name.split('.')[0] + ".desc") diff --git a/examples/app_info/test/unittest/common/get_app_info/ExampleJsunit.test.js b/examples/app_info/test/unittest/common/get_app_info/ExampleJsunit.test.js index d6e92a7..84f7682 100644 --- a/examples/app_info/test/unittest/common/get_app_info/ExampleJsunit.test.js +++ b/examples/app_info/test/unittest/common/get_app_info/ExampleJsunit.test.js @@ -18,6 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' describe("AppInfoTest", function () { beforeAll(function() { + /* * @tc.setup: setup invoked before all testcases */ @@ -25,6 +26,7 @@ describe("AppInfoTest", function () { }) afterAll(function() { + /* * @tc.teardown: teardown invoked after all testcases */ @@ -32,6 +34,7 @@ describe("AppInfoTest", function () { }) beforeEach(function() { + /* * @tc.setup: setup invoked before each testcases */ @@ -39,6 +42,7 @@ describe("AppInfoTest", function () { }) afterEach(function() { + /* * @tc.teardown: teardown invoked after each testcases */ diff --git a/libs/fuzzlib/fuzzer_helper.py b/libs/fuzzlib/fuzzer_helper.py index b8c6217..75efdfb 100644 --- a/libs/fuzzlib/fuzzer_helper.py +++ b/libs/fuzzlib/fuzzer_helper.py @@ -27,6 +27,8 @@ import pipes import traceback import time import copy +import shutil +from pprint import pprint from tools.colored import Colored from tools.templates import GN_ENTRY_TEMPLATE @@ -34,8 +36,6 @@ from tools.templates import PROJECT_GN_TEMPLATE from tools.templates import PROJECT_DEMO_TEMPLATE from tools.templates import PROJECT_HEADER_TEMPLATE from tools.templates import PROJECT_XML_TEMPLATE -import shutil -from pprint import pprint from tools.run_result import RunResult CURRENT_DIR = os.path.dirname(os.path.realpath(__file__)) diff --git a/libs/fuzzlib/tools/run_result.py b/libs/fuzzlib/tools/run_result.py index 5fb2b6e..8898e75 100644 --- a/libs/fuzzlib/tools/run_result.py +++ b/libs/fuzzlib/tools/run_result.py @@ -83,8 +83,8 @@ class RunResult(): if __name__ == "__main__": - cmd_log = "" + CMD_LOG = "" res_obj = RunResult(0, "OK") - res_obj.analysis(cmd_log, "../../../out/") + res_obj.analysis(CMD_LOG, "../../../out/") print(res_obj.crash_info) diff --git a/src/core/build/pretreat_targets.py b/src/core/build/pretreat_targets.py index 7d30c9e..b3c537c 100644 --- a/src/core/build/pretreat_targets.py +++ b/src/core/build/pretreat_targets.py @@ -21,8 +21,8 @@ import sys import json import shutil -from core.constants import JsTestConst from xdevice import platform_logger +from core.constants import JsTestConst LOG = platform_logger("PretreatTargets") diff --git a/src/core/command/console.py b/src/core/command/console.py index a8b3822..87bbd96 100755 --- a/src/core/command/console.py +++ b/src/core/command/console.py @@ -21,9 +21,10 @@ import sys import signal import platform -from core.constants import ToolCommandType from xdevice import platform_logger from xdevice import EnvironmentManager + +from core.constants import ToolCommandType from core.command.run import Run from core.command.gen import Gen from core.command.display import display_help_info diff --git a/src/core/command/run.py b/src/core/command/run.py index d89d657..f079887 100755 --- a/src/core/command/run.py +++ b/src/core/command/run.py @@ -20,12 +20,12 @@ import time import os import sys -from core.constants import SchedulerType from xdevice import Plugin from xdevice import get_plugin from xdevice import platform_logger from xdevice import Scheduler from xdevice import DeviceTestType +from core.constants import SchedulerType from core.utils import get_build_output_path from core.utils import scan_support_product from core.utils import is_lite_product diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index d0ac52a..dc1bd57 100755 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -18,9 +18,10 @@ import os import copy + +from xdevice import platform_logger from core.utils import get_file_list_by_postfix from core.config.config_manager import FilterConfigManager -from xdevice import platform_logger LOG = platform_logger("TestcaseManager") diff --git a/src/main/__init__.py b/src/main/__init__.py index d414ea5..81cae9c 100755 --- a/src/main/__init__.py +++ b/src/main/__init__.py @@ -16,8 +16,8 @@ # limitations under the License. # -from . import _init_global_config from core.command.console import Console +from . import _init_global_config __all__ = [ "Console", diff --git a/src/main/__main__.py b/src/main/__main__.py index 72a567e..be62402 100755 --- a/src/main/__main__.py +++ b/src/main/__main__.py @@ -17,8 +17,9 @@ # import sys -from main import Console + from xdevice import platform_logger +from main import Console LOG = platform_logger("main") -- Gitee