update testcase for testsuite texlive-graphics-def

This commit is contained in:
2026-04-24 04:09:55 +08:00
parent 141006cad2
commit 22afae45f6
4 changed files with 0 additions and 222 deletions

View File

@@ -9,18 +9,6 @@
{
"name": "test_texlive-graphics-def_function_uninstall",
"desc": "Test package removal"
},
{
"name": "test_texlive-graphics-def_function_version",
"desc": "Test package version check"
},
{
"name": "test_texlive-graphics-def_function_doc",
"desc": "Test documentation presence"
},
{
"name": "test_texlive-graphics-def_function_listfiles",
"desc": "Test listing package files"
}
]
}

View File

@@ -1,63 +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-04-02
# @License : Mulan PSL v2
# @Desc : Test documentation presence
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "测试文档存在性"
LOG_INFO "步骤1检查texlive-graphics-def软件包是否在yum源中"
dnf list available texlive-graphics-def &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-graphics-def软件包"
exit 255
fi
LOG_INFO "步骤2检查当前环境是否已安装texlive-graphics-def"
rpm -q texlive-graphics-def &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "texlive-graphics-def已安装测试完成后将保持安装状态"
INSTALLED=1
else
LOG_INFO "texlive-graphics-def未安装将在测试过程中安装"
INSTALLED=0
fi
LOG_INFO "步骤3若未安装则安装texlive-graphics-def软件包"
if [ $INSTALLED -eq 0 ]; then
dnf install -y texlive-graphics-def
CHECK_RESULT $? 0 0 "安装texlive-graphics-def失败"
fi
LOG_INFO "步骤4检查texlive-graphics-def的文档文件是否存在"
rpm -ql texlive-graphics-def | grep -E "\.(pdf|html|txt)$" >/dev/null 2>&1
CHECK_RESULT $? 0 0 "texlive-graphics-def软件包未找到文档文件"
LOG_INFO "步骤5环境恢复"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载测试安装的texlive-graphics-def软件包"
dnf remove -y texlive-graphics-def
CHECK_RESULT $? 0 0 "卸载texlive-graphics-def失败"
else
LOG_INFO "测试前已安装texlive-graphics-def保持安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,80 +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-04-02
# @License : Mulan PSL v2
# @Desc : Test listing package files
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "测试开始Test listing package files"
LOG_INFO "步骤1: 检查环境中是否已安装texlive-graphics-def软件包"
if rpm -q texlive-graphics-def &> /dev/null; then
LOG_INFO "texlive-graphics-def已安装脚本结束时将保持安装状态"
INSTALLED_BEFORE=true
else
LOG_INFO "texlive-graphics-def未安装"
INSTALLED_BEFORE=false
fi
LOG_INFO "步骤2: 检查yum源中是否有texlive-graphics-def软件包"
if ! dnf list available texlive-graphics-def &> /dev/null; then
LOG_ERROR "yum源中未找到texlive-graphics-def软件包"
exit 255
fi
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "步骤3: 安装texlive-graphics-def软件包"
dnf install -y texlive-graphics-def
CHECK_RESULT $? 0 0 "安装texlive-graphics-def失败"
fi
LOG_INFO "步骤4: 执行rpm -ql texlive-graphics-def命令列出包文件"
RPM_OUTPUT=$(rpm -ql texlive-graphics-def 2>&1)
RPM_EXIT_CODE=$?
if [ $RPM_EXIT_CODE -ne 0 ]; then
LOG_ERROR "执行rpm -ql命令失败"
if echo "$RPM_OUTPUT" | grep -q "argument expected"; then
LOG_ERROR "rpm命令参数错误"
exit 255
else
exit $RPM_EXIT_CODE
fi
fi
LOG_INFO "步骤5: 验证rpm -ql命令输出是否包含预期文件"
if echo "$RPM_OUTPUT" | grep -q "/usr/share/texlive/texmf-dist/tex/latex/graphics-def/"; then
LOG_INFO "rpm -ql输出包含预期的graphics-def路径"
else
LOG_ERROR "rpm -ql输出未包含预期的graphics-def路径"
exit 1
fi
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "步骤6: 卸载texlive-graphics-def软件包以恢复环境"
dnf remove -y texlive-graphics-def
CHECK_RESULT $? 0 0 "卸载texlive-graphics-def失败"
LOG_INFO "环境已恢复texlive-graphics-def已卸载"
else
LOG_INFO "环境保持原状texlive-graphics-def保持安装"
fi
LOG_INFO "测试结束Test listing package files"
}
main "$@"

View File

@@ -1,67 +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-04-02
# @License : Mulan PSL v2
# @Desc : Test package version check
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test package version check"
LOG_INFO "步骤1检查texlive-graphics-def软件包是否在yum源中"
if ! dnf list available texlive-graphics-def &>/dev/null; then
LOG_ERROR "texlive-graphics-def软件包在yum源中不存在"
exit 255
fi
LOG_INFO "texlive-graphics-def软件包在yum源中存在"
LOG_INFO "步骤2检查系统是否已经安装了texlive-graphics-def"
if rpm -q texlive-graphics-def &>/dev/null; then
LOG_INFO "texlive-graphics-def已经安装测试后将保持安装状态"
INSTALLED_BEFORE_TEST=true
else
LOG_INFO "texlive-graphics-def未安装将在测试过程中安装"
INSTALLED_BEFORE_TEST=false
fi
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "步骤3安装texlive-graphics-def软件包"
dnf install -y texlive-graphics-def
CHECK_RESULT $? 0 0 "安装texlive-graphics-def失败"
LOG_INFO "texlive-graphics-def安装成功"
fi
LOG_INFO "步骤4检查texlive-graphics-def软件包版本"
PACKAGE_VERSION=$(rpm -q --qf "%{VERSION}-%{RELEASE}" texlive-graphics-def)
CHECK_RESULT $? 0 0 "获取texlive-graphics-def版本失败"
LOG_INFO "texlive-graphics-def版本为$PACKAGE_VERSION"
LOG_INFO "步骤5验证版本信息格式"
if [[ "$PACKAGE_VERSION" =~ ^[0-9]+(\.[0-9]+)*-[0-9]+(\.[0-9]+)*$ ]]; then
LOG_INFO "版本信息格式正确"
else
LOG_ERROR "版本信息格式不正确:$PACKAGE_VERSION"
exit 255
fi
LOG_INFO "步骤6清理测试环境"
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "卸载texlive-graphics-def软件包"
dnf remove -y texlive-graphics-def
CHECK_RESULT $? 0 0 "卸载texlive-graphics-def失败"
LOG_INFO "texlive-graphics-def卸载成功"
else
LOG_INFO "测试前已安装texlive-graphics-def保持安装状态"
fi
LOG_INFO "测试完成Test package version check"
}
main "$@"