update testcase for testsuite texlive-duerer-doc

This commit is contained in:
2026-04-15 12:04:00 +08:00
parent f6e8ab536b
commit b2fb6ad08e
4 changed files with 0 additions and 276 deletions

View File

@@ -7,14 +7,6 @@
"desc": "测试 texlive-duerer-doc 软件包的安装功能,验证是否能够成功安装。",
"machine num": 1
},
{
"name": "test_texlive-duerer-doc_function_render",
"desc": "测试 texlive-duerer-doc 软件包的渲染功能,验证是否能正确渲染文档。"
},
{
"name": "test_texlive-duerer-doc_uninstall",
"desc": "测试 texlive-duerer-doc 软件包的卸载功能,验证是否能完全移除。"
},
{
"name": "test_texlive-duerer-doc_check_version",
"desc": "测试 texlive-duerer-doc 软件包的版本查询功能,验证是否能正确显示版本信息。"
@@ -22,10 +14,6 @@
{
"name": "test_texlive-duerer-doc_list_files",
"desc": "测试 texlive-duerer-doc 软件包的文件列表功能,验证安装后是否包含预期的文档文件。"
},
{
"name": "test_texlive-duerer-doc_check_deps",
"desc": "测试 texlive-duerer-doc 软件包的依赖检查功能,验证其依赖包是否已正确安装。"
}
]
}

View File

@@ -1,111 +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-07
# @License : Mulan PSL v2
# @Desc : 测试 texlive-duerer-doc 软件包的依赖检查功能,验证其依赖包是否已正确安装。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义颜色输出(可选,用于日志高亮)
LOG_INFO() {
echo -e "\033[32m[INFO]\033[0m $*"
}
LOG_ERROR() {
echo -e "\033[31m[ERROR]\033[0m $*"
}
# 定义检查结果函数
CHECK_RESULT() {
local actual=$1
local expected=$2
local index=$3
local msg=$4
if [ "$actual" -eq "$expected" ]; then
LOG_INFO "检查点$index: $msg 成功"
else
LOG_ERROR "检查点$index: $msg 失败"
exit "$actual"
fi
}
# 定义软件包名称
PACKAGE_NAME="texlive-duerer-doc"
# 步骤1: 检查yum源中是否存在texlive-duerer-doc软件包
LOG_INFO "步骤1: 检查yum源中是否存在$PACKAGE_NAME软件包"
dnf list available "$PACKAGE_NAME" &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在$PACKAGE_NAME软件包"
exit 255
fi
# 步骤2: 检查系统是否已安装texlive-duerer-doc
LOG_INFO "步骤2: 检查系统是否已安装$PACKAGE_NAME"
if rpm -q "$PACKAGE_NAME" &>/dev/null; then
LOG_INFO "$PACKAGE_NAME 已安装,脚本结束时将保持安装状态"
ALREADY_INSTALLED=true
else
LOG_INFO "$PACKAGE_NAME 未安装,将在测试过程中安装"
ALREADY_INSTALLED=false
fi
# 步骤3: 安装texlive-duerer-doc如果未安装
if [ "$ALREADY_INSTALLED" = false ]; then
LOG_INFO "步骤3: 安装$PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME" &>/dev/null
CHECK_RESULT $? 0 1 "安装$PACKAGE_NAME"
fi
# 步骤4: 检查texlive-duerer-doc的依赖包
LOG_INFO "步骤4: 检查$PACKAGE_NAME的依赖包"
# 使用rpm -qR列出依赖包
deps=$(rpm -qR "$PACKAGE_NAME" 2>/dev/null)
if [ $? -ne 0 ]; then
LOG_ERROR "无法获取$PACKAGE_NAME的依赖包列表"
exit 255
fi
# 步骤5: 验证每个依赖包是否已安装
LOG_INFO "步骤5: 验证每个依赖包是否已安装"
dep_check_failed=false
for dep in $deps; do
# 过滤掉版本号等,只取包名
dep_name=$(echo "$dep" | grep -o "^[a-zA-Z0-9._-]*")
if [ -n "$dep_name" ] && ! rpm -q "$dep_name" &>/dev/null; then
LOG_ERROR "依赖包 $dep_name 未安装"
dep_check_failed=true
fi
done
if [ "$dep_check_failed" = true ]; then
LOG_ERROR "$PACKAGE_NAME 的依赖包检查失败"
exit 1
else
LOG_INFO "$PACKAGE_NAME 的所有依赖包已正确安装"
fi
# 步骤6: 清理环境(如果测试前未安装,则卸载软件包)
if [ "$ALREADY_INSTALLED" = false ]; then
LOG_INFO "步骤6: 卸载$PACKAGE_NAME"
dnf remove -y "$PACKAGE_NAME" &>/dev/null
CHECK_RESULT $? 0 2 "卸载$PACKAGE_NAME"
fi
LOG_INFO "测试完成: $PACKAGE_NAME 的依赖检查功能验证成功"
}
main "$@"

View File

@@ -1,66 +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 : 2025-12-09
# @License : Mulan PSL v2
# @Desc : 测试 texlive-duerer-doc 软件包的渲染功能,验证是否能正确渲染文档。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查texlive-duerer-doc软件包是否已安装
LOG_INFO "检查texlive-duerer-doc软件包是否已安装"
dnf list installed texlive-duerer-doc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-duerer-doc软件包已安装测试完成后将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-duerer-doc软件包未安装测试完成后将卸载"
INSTALLED=false
fi
# 检查yum源中是否存在texlive-duerer-doc软件包
LOG_INFO "检查yum源中是否存在texlive-duerer-doc软件包"
dnf list available texlive-duerer-doc > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在texlive-duerer-doc软件包"
exit 255
fi
# 安装texlive-duerer-doc软件包如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-duerer-doc软件包"
dnf install -y texlive-duerer-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-duerer-doc软件包失败"
fi
# 验证渲染功能
LOG_INFO "验证texlive-duerer-doc的渲染功能"
texdoc --list duerer > /dev/null 2>&1
CHECK_RESULT $? 0 0 "渲染功能验证失败"
# 清理环境(如果最初未安装)
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-duerer-doc软件包"
dnf remove -y texlive-duerer-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-duerer-doc软件包失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,87 +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-07
# @License : Mulan PSL v2
# @Desc : 测试 texlive-duerer-doc 软件包的卸载功能,验证是否能完全移除。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试 texlive-duerer-doc 软件包的卸载功能"
# 检查软件包是否在yum源中
LOG_INFO "检查yum源中是否存在 texlive-duerer-doc 软件包"
dnf list available texlive-duerer-doc > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在 texlive-duerer-doc 软件包"
exit 255
fi
# 检查当前是否已安装
LOG_INFO "检查 texlive-duerer-doc 是否已安装"
if rpm -q texlive-duerer-doc > /dev/null 2>&1; then
already_installed=true
LOG_INFO "检测到 texlive-duerer-doc 已安装,测试后将保持安装状态"
else
already_installed=false
LOG_INFO "检测到 texlive-duerer-doc 未安装,将在测试前安装"
fi
# 如果未安装,则先安装
if [ "$already_installed" = "false" ]; then
LOG_INFO "安装 texlive-duerer-doc 软件包"
dnf install -y texlive-duerer-doc
CHECK_RESULT $? 0 0 "安装 texlive-duerer-doc 失败"
fi
# 验证软件包已安装
LOG_INFO "验证 texlive-duerer-doc 已成功安装"
rpm -q texlive-duerer-doc
CHECK_RESULT $? 0 0 "验证 texlive-duerer-doc 安装状态失败"
# 执行卸载测试
LOG_INFO "执行 texlive-duerer-doc 卸载操作"
dnf remove -y texlive-duerer-doc
CHECK_RESULT $? 0 0 "卸载 texlive-duerer-doc 失败"
# 验证软件包已卸载
LOG_INFO "验证 texlive-duerer-doc 是否完全移除"
rpm -q texlive-duerer-doc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_ERROR "texlive-duerer-doc 卸载后仍然存在"
CHECK_RESULT 1 0 0 "软件包未完全移除"
else
LOG_INFO "texlive-duerer-doc 已完全移除"
CHECK_RESULT 0 0 0 "软件包移除验证成功"
fi
# 环境恢复
LOG_INFO "开始环境恢复"
if [ "$already_installed" = "true" ]; then
LOG_INFO "恢复原始安装状态:重新安装 texlive-duerer-doc"
dnf install -y texlive-duerer-doc
CHECK_RESULT $? 0 0 "恢复 texlive-duerer-doc 安装失败"
LOG_INFO "环境已恢复到原始安装状态"
else
LOG_INFO "原始状态为未安装,无需额外恢复"
fi
LOG_INFO "测试完成"
}
main "$@"