diff --git a/aw/python/distributed/common/common.py b/aw/python/distributed/common/common.py index 16bcecbb459b4bafd81fa373dd2b223bca9928a4..82bb7ea628de36e39bb085365dbeca086b61ec9d 100755 --- a/aw/python/distributed/common/common.py +++ b/aw/python/distributed/common/common.py @@ -92,7 +92,7 @@ def create_empty_result_file(savepath, filename, message=""): file_desc.write( '\n' % time_stamp) + 'time="0" name="%s" unavailable="1">\n' % (time_stamp, filename)) file_desc.write( ' 0: if not self._build_test_cases(options): @@ -344,7 +345,7 @@ class Run(object): os.makedirs(log_path, exist_ok=True) os.makedirs(tmp_path, exist_ok=True) - Scheduler.start_task_log(log_path) + Binder.get_runtime_log().start_task_log(log_path) make_device_info_file(tmp_path) for case in output_test: @@ -356,12 +357,12 @@ class Run(object): manager.tearDown() make_reports(result_rootpath, start_time) - Scheduler.stop_task_logcat() + Binder.get_runtime_log().stop_task_logcat() else: options.testdict = test_dict options.target_outpath = self.get_target_out_path( options.productform) - + setattr(options, "scheduler", "Scheduler") scheduler = get_plugin(plugin_type=Plugin.SCHEDULER, plugin_id=SchedulerType.SCHEDULER)[0] if scheduler is None: @@ -373,10 +374,10 @@ class Run(object): if is_lite_product(options.productform, sys.source_code_root_path): if options.productform.find("wifiiot") != -1: - scheduler.update_test_type_in_source(".bin", - DeviceTestType.ctest_lite) - scheduler.update_ext_type_in_source("BIN", - DeviceTestType.ctest_lite) + Binder.get_tdd_config().update_test_type_in_source( + ".bin", DeviceTestType.ctest_lite) + Binder.get_tdd_config().update_ext_type_in_source( + "BIN", DeviceTestType.ctest_lite) else: print("productform is not wifiiot") scheduler.exec_command(command, options) diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index ec07b4bfbb7feaed70ccd483da8480b86a37b330..457490b026258663abdceb5d2e9ffa5ed904d805 100644 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -183,6 +183,19 @@ def update_xml(suite_file, result_xml): line = path_text.readline().replace("//", "").strip() tree = ET.parse(result_xml) tree.getroot().attrib["path"] = line + tree.getroot().attrib["name"] = os.path.basename(suite_file.split(".")[0]) + + test_suit = os.path.basename(result_xml).split(".")[0] + log_path = os.path.abspath(result_xml).split("result")[0] + crash_path = os.path.join(log_path, "log", test_suit) + all_items = os.listdir(crash_path) + + # 筛选以crash开头的目录 + matching_dirs = [os.path.join(crash_path, item) for item in all_items if + os.path.isdir(os.path.join(crash_path, item)) + and item.startswith(f"crash_log_{test_suit}")] + if len(matching_dirs) >= 1: + tree.getroot().attrib["is_crash"] = "1" tree.write(result_xml) @@ -203,7 +216,7 @@ def _create_empty_result_file(filepath, filename, error_message): file_desc.write( '\n' % time_stamp) + 'time="0" name="%s" unavailable="1">\n' % (time_stamp, filename)) file_desc.write( ' \n') file_desc.write( - '\n' % time_stamp) + 'failures="1" tests="1">\n' % (filename, time_stamp)) file_desc.write( ' \n' % filename) @@ -274,9 +287,9 @@ def _create_fuzz_pass_file(filepath, filename): time.localtime()) file_desc.write('\n') file_desc.write( - '\n' % time_stamp) + 'failures="0" tests="1">\n' % (filename, time_stamp)) file_desc.write( ' \n' % filename) @@ -575,12 +588,12 @@ class CppTestDriver(IDriver): xml_path = os.path.join(log_path, f"{suit_name}.xml") if not os.path.exists(xml_path): _create_empty_result_file(xml_path, suit_name, "ERROR") - update_xml(request.root.source.source_file, xml_path) serial = "{}_{}".format(str(request.config.device.__get_serial__()), time.time_ns()) log_tar_file_name = "{}_{}".format(request.get_module_name(), str(serial).replace( ":", "_")) self.config.device.device_log_collector.stop_hilog_task( log_tar_file_name, module_name=request.get_module_name()) + update_xml(request.root.source.source_file, xml_path) @staticmethod def _alter_init(name): @@ -723,7 +736,6 @@ class CppTestDriver(IDriver): self.result = result.get_test_results_hidelog(return_message) else: self.result = result.get_test_results(return_message) - update_xml(suite_file, self.result) resource_manager.process_cleaner_data(resource_data_dic, resource_dir, @@ -885,10 +897,10 @@ class JSUnitTestDriver(IDriver): request.config.report_path, "result", '.'.join((request.get_module_name(), "xml"))) shutil.move(xml_path, self.result) - update_xml(suite_file, self.result) finally: self.config.device.device_log_collector.remove_log_address(None, self.hilog) self.config.device.device_log_collector.stop_catch_device_log(self.hilog_proc) + update_xml(request.root.source.source_file, self.result) @staticmethod def _get_acts_test_para(testcase, diff --git a/src/core/driver/lite_driver.py b/src/core/driver/lite_driver.py index 1c6853823601ff61c268f8dd531cd8ba367ac201..5e95d6285826f9ccf89c29796adec2c2c673b1a7 100755 --- a/src/core/driver/lite_driver.py +++ b/src/core/driver/lite_driver.py @@ -426,7 +426,7 @@ class CTestDriver(IDriver): kit_instances = get_kit_instances(json_config, request.config.resource_path, request.config.testcases_path) - from xdevice import Scheduler + from xdevice import Binder for (kit_instance, kit_info) in zip(kit_instances, json_config.get_kits()): @@ -436,7 +436,7 @@ class CTestDriver(IDriver): self.file_name = get_config_value( 'burn_file', kit_info)[0].split("\\")[-1].split(".")[0] reset_cmd = kit_instance.burn_command - if not Scheduler.is_execute: + if not Binder.is_executing(): raise ExecuteTerminate("ExecuteTerminate", error_no="00300") kit_instance.__setup__(self.config.device, @@ -499,9 +499,9 @@ class JSUnitTestLiteDriver(IDriver): self._get_driver_config(json_config) - from xdevice import Scheduler + from xdevice import Binder for kit in self.kits: - if not Scheduler.is_execute: + if not Binder.is_executing(): raise ExecuteTerminate("ExecuteTerminate", error_no="00300") if kit.__class__.__name__ == CKit.liteinstall: diff --git a/src/core/testcase/testcase_manager.py b/src/core/testcase/testcase_manager.py index e32b718f26885c2b178bfab6b54aca9841cd3e49..f02b096cad50ebe39bd3c56f6938295e16eb9015 100644 --- a/src/core/testcase/testcase_manager.py +++ b/src/core/testcase/testcase_manager.py @@ -27,8 +27,8 @@ from core.common import is_open_source_product from core.utils import get_file_list_by_postfix from core.config.config_manager import FilterConfigManager from xdevice import platform_logger -from xdevice import Scheduler from xdevice import DeviceTestType +from xdevice import Binder LOG = platform_logger("TestcaseManager") @@ -285,7 +285,8 @@ class TestCaseManager(object): suite_file_dictionary.get("PYT").append(suite_file) elif suffix_name == "": if file_name.startswith("rust_"): - Scheduler.update_test_type_in_source("OHRust", DeviceTestType.oh_rust_test) + Binder.get_tdd_config().update_test_type_in_source( + "OHRust", DeviceTestType.oh_rust_test) suite_file_dictionary.get("OHRust").append(suite_file) else: suite_file_dictionary.get("CXX").append(suite_file)