From 052a75cb06c12e4b0356a4bca95206642c8a390f Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 03:29:27 +0800 Subject: [PATCH] update testcase for testsuite rust-debugger-common --- .../pkg_test/rust/rust-debugger-common.json | 12 --- ...t_rust-debugger-common_function_depends.sh | 91 ------------------ ...t_rust-debugger-common_function_install.sh | 69 ------------- ...t_rust-debugger-common_function_provide.sh | 96 ------------------- 4 files changed, 268 deletions(-) delete mode 100644 testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_depends.sh delete mode 100644 testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_install.sh delete mode 100644 testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_provide.sh diff --git a/suite2cases/function_test/pkg_test/rust/rust-debugger-common.json b/suite2cases/function_test/pkg_test/rust/rust-debugger-common.json index b7cae3d4d88..40e59362d44 100644 --- a/suite2cases/function_test/pkg_test/rust/rust-debugger-common.json +++ b/suite2cases/function_test/pkg_test/rust/rust-debugger-common.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/rust/rust-debugger-common", "machine num": 1, "cases": [ - { - "name": "test_rust-debugger-common_function_install", - "desc": "测试 rust-debugger-common 软件包能否被正确安装。" - }, { "name": "test_rust-debugger-common_function_check_version", "desc": "测试已安装的 rust-debugger-common 软件包版本信息能否被正确查询。" @@ -13,14 +9,6 @@ { "name": "test_rust-debugger-common_function_uninstall", "desc": "测试 rust-debugger-common 软件包能否被完全卸载,且移除相关配置文件。" - }, - { - "name": "test_rust-debugger-common_function_depends", - "desc": "测试 rust-debugger-common 软件包依赖的其他包是否已正确安装。" - }, - { - "name": "test_rust-debugger-common_function_provide", - "desc": "测试 rust-debugger-common 软件包提供的库文件或头文件是否存在且可用。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_depends.sh b/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_depends.sh deleted file mode 100644 index 13bffcc5ad8..00000000000 --- a/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_depends.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-21 -# @License : Mulan PSL v2 -# @Desc : 测试 rust-debugger-common 软件包依赖的其他包是否已正确安装。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 rust-debugger-common 软件包依赖的其他包是否已正确安装。" - - # 检查是否已安装 rust-debugger-common - LOG_INFO "检查是否已安装 rust-debugger-common 软件包。" - rpm -q rust-debugger-common - if [ $? -eq 0 ]; then - LOG_INFO "rust-debugger-common 已安装。脚本结束后将保持安装状态。" - already_installed=1 - else - LOG_INFO "rust-debugger-common 未安装。将作为测试步骤进行安装。" - already_installed=0 - fi - - # 检查 yum 源中是否存在 rust-debugger-common - LOG_INFO "检查 yum 源中是否存在 rust-debugger-common 软件包。" - dnf list available rust-debugger-common > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum 源中未找到 rust-debugger-common 软件包,退出测试。" - if [ $? -ne 0 ]; then - exit 255 - fi - - # 如果未安装,则安装 rust-debugger-common - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装 rust-debugger-common 软件包。" - dnf install -y rust-debugger-common - CHECK_RESULT $? 0 0 "安装 rust-debugger-common 失败。" - fi - - # 获取 rust-debugger-common 的依赖包列表 - LOG_INFO "获取 rust-debugger-common 的依赖包列表。" - deps=$(rpm -qR rust-debugger-common) - CHECK_RESULT $? 0 0 "获取 rust-debugger-common 依赖包列表失败。" - - # 检查每个依赖包是否已安装 - LOG_INFO "检查每个依赖包是否已安装。" - for dep in $deps; do - # 去除版本号等条件,只保留包名 - pkg_name=$(echo $dep | sed "s/[<>=].*//") - # 检查包是否已安装 - rpm -q $pkg_name > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "依赖包 $pkg_name 未安装。" - # 如果依赖包未安装,需要检查 yum 源中是否有该包 - LOG_INFO "检查 yum 源中是否存在 $pkg_name 软件包。" - dnf list available $pkg_name > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 $pkg_name 软件包。" - exit 255 - else - LOG_INFO "yum 源中存在 $pkg_name 软件包,但未安装。" - fi - else - LOG_INFO "依赖包 $pkg_name 已安装。" - fi - done - - LOG_INFO "所有依赖包检查完成。" - - # 环境清理:如果之前未安装,则卸载 rust-debugger-common - if [ $already_installed -eq 0 ]; then - LOG_INFO "清理环境:卸载 rust-debugger-common 软件包。" - dnf remove -y rust-debugger-common - CHECK_RESULT $? 0 0 "卸载 rust-debugger-common 失败。" - fi - - LOG_INFO "测试脚本执行完毕。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_install.sh b/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_install.sh deleted file mode 100644 index c4c6f2b3259..00000000000 --- a/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_install.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-21 -# @License : Mulan PSL v2 -# @Desc : 测试 rust-debugger-common 软件包能否被正确安装。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 rust-debugger-common 软件包能否被正确安装" - - # 步骤1:检查yum源中是否存在 rust-debugger-common 软件包 - LOG_INFO "检查yum源中是否存在 rust-debugger-common 软件包" - dnf list --available rust-debugger-common &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到 rust-debugger-common 软件包" - exit 255 - fi - - # 步骤2:检查系统当前是否已安装 rust-debugger-common 软件包 - LOG_INFO "检查系统当前是否已安装 rust-debugger-common 软件包" - rpm -q rust-debugger-common &>/dev/null - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "检测到 rust-debugger-common 软件包已安装,测试后将保持安装状态" - else - INSTALLED="false" - LOG_INFO "检测到 rust-debugger-common 软件包未安装,测试后将进行卸载" - fi - - # 步骤3:安装 rust-debugger-common 软件包 - LOG_INFO "安装 rust-debugger-common 软件包" - dnf install -y rust-debugger-common - CHECK_RESULT $? 0 0 "安装 rust-debugger-common 软件包失败" - - # 步骤4:验证安装是否成功 - LOG_INFO "验证 rust-debugger-common 软件包是否安装成功" - rpm -q rust-debugger-common - CHECK_RESULT $? 0 0 "验证 rust-debugger-common 软件包安装状态失败" - - # 步骤5:清理环境(如果测试前未安装,则卸载软件包) - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载 rust-debugger-common 软件包" - dnf remove -y rust-debugger-common - CHECK_RESULT $? 0 0 "卸载 rust-debugger-common 软件包失败" - LOG_INFO "环境已恢复至测试前状态" - else - LOG_INFO "测试前已安装,保持 rust-debugger-common 软件包安装状态" - fi - - LOG_INFO "测试完成:rust-debugger-common 软件包能够被正确安装" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_provide.sh b/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_provide.sh deleted file mode 100644 index 8c7cc157775..00000000000 --- a/testcases/function_test/pkg_test/rust/rust-debugger-common/test_rust-debugger-common_function_provide.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-21 -# @License : Mulan PSL v2 -# @Desc : 测试 rust-debugger-common 软件包提供的库文件或头文件是否存在且可用。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 检查yum源中是否存在rust-debugger-common软件包 - LOG_INFO "检查yum源中是否存在rust-debugger-common软件包" - dnf list available rust-debugger-common &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到rust-debugger-common软件包" - exit 255 - fi - - # 检查系统是否已安装rust-debugger-common - LOG_INFO "检查系统是否已安装rust-debugger-common" - rpm -q rust-debugger-common &>/dev/null - if [ $? -eq 0 ]; then - INSTALLED="yes" - LOG_INFO "系统已安装rust-debugger-common,测试结束后保持安装状态" - else - INSTALLED="no" - LOG_INFO "系统未安装rust-debugger-common,将在测试前安装" - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "安装rust-debugger-common软件包" - dnf install -y rust-debugger-common - CHECK_RESULT $? 0 0 "安装rust-debugger-common失败" - fi - - # 测试库文件是否存在 - LOG_INFO "测试rust-debugger-common提供的库文件是否存在" - find /usr/lib* -name "*rust-debugger*" -type f 2>/dev/null | head -5 > /tmp/rust_debugger_libs.txt - if [ -s /tmp/rust_debugger_libs.txt ]; then - LOG_INFO "找到以下库文件:" - cat /tmp/rust_debugger_libs.txt - CHECK_RESULT $? 0 0 "未找到rust-debugger-common的库文件" - else - LOG_ERROR "未找到rust-debugger-common的库文件" - CHECK_RESULT 1 0 1 "库文件检查失败" - fi - - # 测试头文件是否存在 - LOG_INFO "测试rust-debugger-common提供的头文件是否存在" - find /usr/include -name "*rust-debugger*" -type f 2>/dev/null | head -5 > /tmp/rust_debugger_headers.txt - if [ -s /tmp/rust_debugger_headers.txt ]; then - LOG_INFO "找到以下头文件:" - cat /tmp/rust_debugger_headers.txt - CHECK_RESULT $? 0 0 "未找到rust-debugger-common的头文件" - else - LOG_INFO "未在/usr/include目录下找到rust-debugger-common的头文件,尝试在其他位置查找" - find /usr -name "*rust-debugger*.h" -o -name "*rust-debugger*.hpp" 2>/dev/null | head -5 > /tmp/rust_debugger_headers.txt - if [ -s /tmp/rust_debugger_headers.txt ]; then - LOG_INFO "在其他位置找到以下头文件:" - cat /tmp/rust_debugger_headers.txt - CHECK_RESULT $? 0 0 "未找到rust-debugger-common的头文件" - else - LOG_ERROR "未找到rust-debugger-common的头文件" - CHECK_RESULT 1 0 1 "头文件检查失败" - fi - fi - - # 清理临时文件 - rm -f /tmp/rust_debugger_libs.txt /tmp/rust_debugger_headers.txt - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "卸载rust-debugger-common软件包" - dnf remove -y rust-debugger-common - CHECK_RESULT $? 0 0 "卸载rust-debugger-common失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file