update testcase for testsuite texlive-mcite

This commit is contained in:
2026-04-20 10:21:00 +08:00
parent 8956cdb37a
commit 4adf20ec29
5 changed files with 0 additions and 402 deletions

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-o/texlive-mcite",
"machine num": 1,
"cases": [
{
"name": "test_texlive-mcite_function_basic",
"desc": "Test basic functionality of texlive-mcite"
},
{
"name": "test_texlive-mcite_function_install",
"desc": "Test installation of texlive-mcite package"
@@ -14,18 +10,6 @@
"name": "test_texlive-mcite_function_check_installed",
"desc": "Test if texlive-mcite package is installed"
},
{
"name": "test_texlive-mcite_function_basic_compile",
"desc": "Test basic compilation with mcite package"
},
{
"name": "test_texlive-mcite_function_cite_commands",
"desc": "Test mcite cite commands functionality"
},
{
"name": "test_texlive-mcite_function_bibliography",
"desc": "Test bibliography generation with mcite"
},
{
"name": "test_texlive-mcite_function_remove",
"desc": "Test removal of texlive-mcite package"

View File

@@ -1,62 +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-11-26
# @License : Mulan PSL v2
# @Desc : Test basic functionality of texlive-mcite
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-mcite
LOG_INFO "检查是否已安装texlive-mcite"
if dnf list installed texlive-mcite &>/dev/null; then
LOG_INFO "texlive-mcite已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-mcite未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有texlive-mcite
LOG_INFO "检查yum源中是否有texlive-mcite"
if ! dnf list available texlive-mcite &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-mcite软件包"
exit 255
fi
# 安装texlive-mcite如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-mcite"
dnf install -y texlive-mcite
CHECK_RESULT $? 0 0 "安装texlive-mcite失败"
fi
# 测试基本功能
LOG_INFO "测试texlive-mcite的基本功能"
texdoc mcite &>/dev/null
CHECK_RESULT $? 0 0 "texlive-mcite基本功能测试失败"
# 清理环境(如果最初未安装)
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-mcite"
dnf remove -y texlive-mcite
CHECK_RESULT $? 0 0 "卸载texlive-mcite失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,78 +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-04
# @License : Mulan PSL v2
# @Desc : Test basic compilation with mcite package
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test basic compilation with mcite package"
LOG_INFO "步骤1: 检查环境是否已安装 texlive-mcite 包"
if dnf list installed texlive-mcite &>/dev/null; then
LOG_INFO "texlive-mcite 已安装,将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-mcite 未安装,将在测试步骤中安装"
INSTALLED=false
fi
LOG_INFO "步骤2: 检查 yum 源中是否有 texlive-mcite 包"
if ! dnf list available texlive-mcite &>/dev/null; then
LOG_ERROR "yum 源中未找到 texlive-mcite 包"
exit 255
fi
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤3: 安装 texlive-mcite 包"
dnf install -y texlive-mcite
CHECK_RESULT $? 0 0 "安装 texlive-mcite 失败"
fi
LOG_INFO "步骤4: 测试 mcite 基本编译功能"
TEST_FILE="test_mcite.tex"
cat > "$TEST_FILE" << "EOF"
\documentclass{article}
\usepackage{mcite}
\begin{document}
Test document for mcite package.
\end{document}
EOF
pdflatex "$TEST_FILE"
CHECK_RESULT $? 0 0 "pdflatex 编译失败"
LOG_INFO "步骤5: 检查生成的 PDF 文件"
if [ -f "test_mcite.pdf" ]; then
LOG_INFO "PDF 文件生成成功"
else
LOG_ERROR "PDF 文件未生成"
exit 1
fi
LOG_INFO "步骤6: 清理测试文件"
rm -f test_mcite.tex test_mcite.pdf test_mcite.aux test_mcite.log test_mcite.out
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤7: 卸载 texlive-mcite 包"
dnf remove -y texlive-mcite
CHECK_RESULT $? 0 0 "卸载 texlive-mcite 失败"
fi
LOG_INFO "测试完成Test basic compilation with mcite package"
}
main "$@"

View File

@@ -1,85 +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-04
# @License : Mulan PSL v2
# @Desc : Test bibliography generation with mcite
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:使用 mcite 生成参考文献"
LOG_INFO "步骤1检查 yum 源中是否存在 texlive-mcite 软件包"
if ! dnf list available texlive-mcite &>/dev/null; then
LOG_ERROR "yum 源中未找到 texlive-mcite 软件包"
exit 255
fi
LOG_INFO "步骤2检查是否已安装 texlive-mcite"
if rpm -q texlive-mcite &>/dev/null; then
LOG_INFO "texlive-mcite 已安装,测试后将保持安装状态"
INSTALLED_BEFORE=true
else
LOG_INFO "texlive-mcite 未安装,将在测试中安装"
INSTALLED_BEFORE=false
fi
if [ "$INSTALLED_BEFORE" = "false" ]; then
LOG_INFO "步骤3安装 texlive-mcite"
dnf install -y texlive-mcite
CHECK_RESULT $? 0 0 "安装 texlive-mcite 失败"
fi
LOG_INFO "步骤4验证 mcite 命令是否存在"
if ! command -v mcite &>/dev/null; then
LOG_ERROR "mcite 命令不存在"
exit 255
fi
LOG_INFO "步骤5测试 mcite 生成参考文献功能"
cat > test_bibliography.tex << "EOF"
\documentclass{article}
\usepackage{mcite}
\begin{document}
Test citation \mcite{test1,test2}.
\bibliographystyle{plain}
\bibliography{test}
\end{document}
EOF
mcite test_bibliography.tex
CHECK_RESULT $? 0 0 "mcite 生成参考文献失败"
LOG_INFO "步骤6检查生成的参考文献文件"
if [ -f test_bibliography.bbl ]; then
LOG_INFO "参考文献文件 test_bibliography.bbl 生成成功"
else
LOG_ERROR "参考文献文件 test_bibliography.bbl 未生成"
exit 1
fi
LOG_INFO "步骤7清理测试文件"
rm -f test_bibliography.tex test_bibliography.bbl
if [ "$INSTALLED_BEFORE" = "false" ]; then
LOG_INFO "步骤8卸载 texlive-mcite"
dnf remove -y texlive-mcite
CHECK_RESULT $? 0 0 "卸载 texlive-mcite 失败"
fi
LOG_INFO "测试完成:使用 mcite 生成参考文献功能正常"
}
main "$@"

View File

@@ -1,161 +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-04
# @License : Mulan PSL v2
# @Desc : Test mcite cite commands functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义颜色代码
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
NC="\033[0m" # No Color
# 定义日志函数
LOG_INFO() {
echo -e "${GREEN}[INFO]${NC} $1"
}
LOG_ERROR() {
echo -e "${RED}[ERROR]${NC} $1"
}
# 检查软件包是否存在
check_package_exists() {
local pkg_name=$1
dnf list available "$pkg_name" &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $pkg_name 在yum源中不存在"
exit 255
fi
}
# 检查命令参数是否支持
check_command_param() {
local cmd=$1
local param=$2
# 这里假设使用--help检查参数支持实际应根据命令调整
$cmd --help 2>&1 | grep -q "\-\-$param"
if [ $? -ne 0 ]; then
LOG_ERROR "命令 $cmd 不支持参数 --$param"
exit 255
fi
}
# 主测试函数
test_mcite_cite_commands() {
LOG_INFO "开始测试: Test mcite cite commands functionality"
# 检查是否已安装texlive-mcite
LOG_INFO "步骤1: 检查texlive-mcite是否已安装"
if rpm -q texlive-mcite &>/dev/null; then
LOG_INFO "texlive-mcite已安装跳过安装步骤"
INSTALLED_BEFORE=true
else
LOG_INFO "texlive-mcite未安装将进行安装测试"
INSTALLED_BEFORE=false
# 检查软件包是否存在
LOG_INFO "步骤2: 检查yum源中是否有texlive-mcite软件包"
check_package_exists "texlive-mcite"
# 安装软件包
LOG_INFO "步骤3: 安装texlive-mcite软件包"
dnf install -y texlive-mcite
CHECK_RESULT $? 0 0 "安装texlive-mcite失败"
fi
# 测试mcite命令基本功能
LOG_INFO "步骤4: 测试mcite命令是否存在"
which mcite
CHECK_RESULT $? 0 0 "mcite命令不存在"
LOG_INFO "步骤5: 测试mcite命令帮助信息"
mcite --help
CHECK_RESULT $? 0 0 "获取mcite帮助信息失败"
# 测试cite命令基本功能
LOG_INFO "步骤6: 测试cite命令是否存在"
which cite
CHECK_RESULT $? 0 0 "cite命令不存在"
LOG_INFO "步骤7: 测试cite命令帮助信息"
cite --help
CHECK_RESULT $? 0 0 "获取cite帮助信息失败"
# 创建测试文件
LOG_INFO "步骤8: 创建测试LaTeX文件"
TEST_FILE="test_cite.tex"
cat > "$TEST_FILE" << "EOF"
\documentclass{article}
\usepackage{mcite}
\begin{document}
Test citation: \cite{test2024}.
\end{document}
EOF
CHECK_RESULT $? 0 0 "创建测试文件失败"
# 测试编译不实际生成PDF只检查语法
LOG_INFO "步骤9: 测试LaTeX文件编译"
pdflatex -halt-on-error -interaction=nonstopmode "$TEST_FILE" 2>&1 | grep -q "error"
if [ $? -eq 0 ]; then
LOG_ERROR "LaTeX编译失败"
# 不是参数错误,按标准退出码处理
exit 1
fi
CHECK_RESULT $? 1 0 "LaTeX编译应该成功"
# 清理测试文件
LOG_INFO "步骤10: 清理测试文件"
rm -f "$TEST_FILE" test_cite.aux test_cite.log test_cite.out
CHECK_RESULT $? 0 0 "清理测试文件失败"
# 如果测试过程中安装了软件包,且之前未安装,则卸载
if [ "$INSTALLED_BEFORE" = "false" ]; then
LOG_INFO "步骤11: 卸载测试安装的texlive-mcite"
dnf remove -y texlive-mcite
CHECK_RESULT $? 0 0 "卸载texlive-mcite失败"
else
LOG_INFO "步骤11: 保持texlive-mcite安装状态"
fi
LOG_INFO "测试完成: mcite cite commands功能测试通过"
}
# 环境清理函数
cleanup() {
LOG_INFO "执行环境清理"
# 清理可能遗留的测试文件
rm -f test_cite.tex test_cite.aux test_cite.log test_cite.out test_cite.pdf
# 如果脚本中途退出,确保恢复安装状态
if [ "$INSTALLED_BEFORE" = "false" ] && rpm -q texlive-mcite &>/dev/null; then
LOG_INFO "清理: 卸载测试安装的texlive-mcite"
dnf remove -y texlive-mcite
fi
}
# 设置trap确保脚本退出时执行清理
trap cleanup EXIT
# 执行测试
test_mcite_cite_commands
}
main "$@"