From d79f5c9df889caeb3cf04f9a3d091c3d9f6f543b Mon Sep 17 00:00:00 2001 From: maliang Date: Fri, 21 Mar 2025 18:23:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=A3=80=E6=9F=A5=E5=85=A8=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E6=B5=8B=E8=AF=95=E6=9C=9F=E9=97=B4=E6=9C=89=E6=97=A0?= =?UTF-8?q?crashs=EF=BC=8C=E5=A4=9A=E6=AC=A1=E8=A7=A6=E5=8F=91=E6=96=AD?= =?UTF-8?q?=E9=93=BE=E9=87=8D=E8=BF=9E=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: maliang --- test/scripts/testModule/test_hdc_base.py | 1 + test/scripts/testModule/test_hdc_file_fd.py | 2 -- test/scripts/testModule/test_hdc_smode.py | 1 - test/scripts/testModule/test_hdc_usb.py | 2 ++ test/scripts/testModule/test_hdc_zenith.py | 24 +++++++++++++++++++++ 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100755 test/scripts/testModule/test_hdc_zenith.py diff --git a/test/scripts/testModule/test_hdc_base.py b/test/scripts/testModule/test_hdc_base.py index 80892336..5bf1b91d 100644 --- a/test/scripts/testModule/test_hdc_base.py +++ b/test/scripts/testModule/test_hdc_base.py @@ -24,6 +24,7 @@ def clear_and_restart(): check_hdc_cmd("start") check_hdc_cmd("wait") check_hdc_cmd("shell rm -rf data/local/tmp/it_*") + check_hdc_cmd("shell rm /data/log/faultlog/faultlogger/cppcrash*hdcd*") check_hdc_cmd("shell mkdir data/local/tmp/it_send_dir") diff --git a/test/scripts/testModule/test_hdc_file_fd.py b/test/scripts/testModule/test_hdc_file_fd.py index 147fbe80..879164e9 100644 --- a/test/scripts/testModule/test_hdc_file_fd.py +++ b/test/scripts/testModule/test_hdc_file_fd.py @@ -263,7 +263,6 @@ class TestFileNoSpaceFdFullCrash: check_shell(f"shell dd if={SEP}dev/zero bs=1M of={SEP}storage/largefile") check_shell(f"shell df /storage") check_shell(f"shell rm -rf /storage/smallfile") - check_shell(f"shell rm /data/log/faultlog/faultlogger/cppcrash*hdcd*") time.sleep(1) tree_path = get_local_path("tree") check_shell(f"shell ls") @@ -312,6 +311,5 @@ class TestFileNoSpaceFdFullCrash: run_command_with_timeout(f"{GP.hdc_head} wait", 3) time.sleep(3) - assert not check_shell(f"shell ls {SEP}data/log/faultlog/faultlogger/", "-hdcd-") new_pid = get_shell_result(f"shell pidof hdcd").split("\r")[0] assert not self.pid == new_pid diff --git a/test/scripts/testModule/test_hdc_smode.py b/test/scripts/testModule/test_hdc_smode.py index 15f2ca51..85a7b1ef 100644 --- a/test/scripts/testModule/test_hdc_smode.py +++ b/test/scripts/testModule/test_hdc_smode.py @@ -46,4 +46,3 @@ class TestSmode: time.sleep(3) # sleep 3s to wait for the device to connect channel run_command_with_timeout(f"{GP.hdc_head} wait", 15) # wait 15s for the device to connect channel assert check_shell(f"shell id", "context=u:r:su:s0") - assert not check_hdc_cmd("ls data/log/faultlog/faultlogger | grep hdcd", "hdcd") \ No newline at end of file diff --git a/test/scripts/testModule/test_hdc_usb.py b/test/scripts/testModule/test_hdc_usb.py index d157dfdf..f557a58c 100644 --- a/test/scripts/testModule/test_hdc_usb.py +++ b/test/scripts/testModule/test_hdc_usb.py @@ -19,6 +19,7 @@ from utils import GP, check_hdc_cmd, check_hdc_targets, check_shell_any_device, class TestUsbConnect: @pytest.mark.L0 + @pytest.mark.repeat(10) def test_usb_disconnect(self): # 注意:断连后需要等待一段时间才能重新连接 @@ -29,6 +30,7 @@ class TestUsbConnect: assert check_hdc_targets() @pytest.mark.L0 + @pytest.mark.repeat(10) def test_list_targets_multi_usb_device(self): devices_str = check_shell_any_device(f"{GP.hdc_exe} list targets", None, True) time.sleep(3) # sleep 3s to wait for the device to connect channel diff --git a/test/scripts/testModule/test_hdc_zenith.py b/test/scripts/testModule/test_hdc_zenith.py new file mode 100755 index 00000000..d9d7e27f --- /dev/null +++ b/test/scripts/testModule/test_hdc_zenith.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright (C) 2025 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. +import time +import pytest +from utils import GP, check_hdc_cmd, check_hdc_targets, check_shell, load_gp + + +class TestHdcdCrashAndBadfd: + @pytest.mark.L0 + def test_hdcd_crash_and_badfd(self): + assert check_hdc_targets() + assert not check_shell(f"shell ls data/log/faultlog/faultlogger/", "-hdcd-") \ No newline at end of file -- Gitee