update testcase for testsuite rust-debugger-common

This commit is contained in:
2026-04-17 03:29:27 +08:00
parent c5ea836905
commit 052a75cb06
4 changed files with 0 additions and 268 deletions

View File

@@ -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 软件包提供的库文件或头文件是否存在且可用。"
}
]
}

View File

@@ -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 "$@"

View File

@@ -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 "$@"

View File

@@ -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 "$@"