update testcase for testsuite texlive-ryethesis
This commit is contained in:
@@ -2,25 +2,9 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-u/texlive-ryethesis",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-ryethesis_function_install",
|
||||
"desc": "Test package installation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ryethesis_function_uninstall",
|
||||
"desc": "Test package uninstallation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ryethesis_function_documentclass",
|
||||
"desc": "Test LaTeX document class availability"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ryethesis_function_compile",
|
||||
"desc": "Test basic thesis compilation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ryethesis_function_help",
|
||||
"desc": "Test package documentation access"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,114 +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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic thesis compilation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-ryethesis
|
||||
LOG_INFO "检查是否已安装texlive-ryethesis"
|
||||
rpm -q texlive-ryethesis > /dev/null 2>&1
|
||||
INSTALLED=$?
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-ryethesis"
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ryethesis软件包"
|
||||
dnf list available $PACKAGE_NAME > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ryethesis软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -ne 0 ]; then
|
||||
LOG_INFO "安装texlive-ryethesis软件包"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ryethesis失败"
|
||||
fi
|
||||
|
||||
# 测试基本论文编译功能
|
||||
LOG_INFO "测试基本论文编译功能"
|
||||
|
||||
# 创建测试目录
|
||||
TEST_DIR="/tmp/ryethesis_test_$(date +%s)"
|
||||
LOG_INFO "创建测试目录: $TEST_DIR"
|
||||
mkdir -p $TEST_DIR
|
||||
cd $TEST_DIR
|
||||
|
||||
# 创建简单的LaTeX测试文件
|
||||
LOG_INFO "创建测试LaTeX文件"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{ryethesis}
|
||||
\begin{document}
|
||||
\title{测试论文}
|
||||
\author{测试作者}
|
||||
\maketitle
|
||||
\section{测试章节}
|
||||
这是一个测试内容。
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# 检查ryethesis文档类是否支持
|
||||
LOG_INFO "检查ryethesis文档类参数支持"
|
||||
pdflatex -interaction=nonstopmode -draftmode test.tex > compile.log 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "编译测试文件失败,可能ryethesis文档类不支持或参数错误"
|
||||
# 检查编译日志中是否有特定错误
|
||||
if grep -q "Document class" compile.log || grep -q "option clash" compile.log; then
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "编译测试文件失败"
|
||||
fi
|
||||
|
||||
# 完整编译测试
|
||||
LOG_INFO "执行完整编译测试"
|
||||
pdflatex -interaction=nonstopmode test.tex > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "完整编译测试失败"
|
||||
|
||||
# 检查生成的PDF文件
|
||||
LOG_INFO "检查生成的PDF文件"
|
||||
if [ -f test.pdf ]; then
|
||||
LOG_INFO "PDF文件生成成功"
|
||||
file test.pdf | grep -q "PDF document"
|
||||
CHECK_RESULT $? 0 0 "生成的PDF文件格式不正确"
|
||||
else
|
||||
LOG_ERROR "未生成PDF文件"
|
||||
CHECK_RESULT 1 0 0 "未生成PDF文件"
|
||||
fi
|
||||
|
||||
# 清理测试目录
|
||||
LOG_INFO "清理测试目录"
|
||||
cd /
|
||||
rm -rf $TEST_DIR
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ $INSTALLED -ne 0 ]; then
|
||||
LOG_INFO "卸载texlive-ryethesis软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ryethesis失败"
|
||||
LOG_INFO "环境已恢复到测试前状态"
|
||||
else
|
||||
LOG_INFO "保持texlive-ryethesis安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试基本论文编译功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,102 +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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test LaTeX document class availability
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试LaTeX文档类可用性
|
||||
|
||||
LOG_INFO "开始测试LaTeX文档类可用性"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-ryethesis"
|
||||
LOG_INFO "测试目标软件包: ${PACKAGE_NAME}"
|
||||
|
||||
# 检查软件包是否已在yum源中
|
||||
LOG_INFO "检查软件包是否在yum源中"
|
||||
dnf search ${PACKAGE_NAME} > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查当前是否已安装该软件包
|
||||
LOG_INFO "检查软件包是否已安装"
|
||||
dnf list installed ${PACKAGE_NAME} > /dev/null 2>&1
|
||||
PACKAGE_INSTALLED=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ ${PACKAGE_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 已安装"
|
||||
INITIAL_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 未安装"
|
||||
INITIAL_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if ! ${INITIAL_INSTALLED}; then
|
||||
LOG_INFO "安装软件包 ${PACKAGE_NAME}"
|
||||
dnf install -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试LaTeX文档类可用性
|
||||
LOG_INFO "测试LaTeX文档类ryethesis是否可用"
|
||||
|
||||
# 创建测试LaTeX文档
|
||||
LOG_INFO "创建测试LaTeX文档"
|
||||
cat > test_ryethesis.tex << "EOF"
|
||||
\documentclass{ryethesis}
|
||||
\begin{document}
|
||||
\title{测试文档}
|
||||
\author{测试作者}
|
||||
\maketitle
|
||||
这是一个测试文档。
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# 检查ryethesis文档类是否存在
|
||||
LOG_INFO "检查ryethesis文档类"
|
||||
kpsewhich ryethesis.cls > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ryethesis文档类不可用"
|
||||
|
||||
# 尝试编译测试文档(不生成PDF,只检查语法)
|
||||
LOG_INFO "尝试编译测试文档(语法检查)"
|
||||
pdflatex -interaction=nonstopmode -draftmode test_ryethesis.tex > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ryethesis文档类编译失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_ryethesis.tex test_ryethesis.aux test_ryethesis.log test_ryethesis.out
|
||||
|
||||
# 恢复环境到初始状态
|
||||
LOG_INFO "恢复环境到初始状态"
|
||||
if ! ${INITIAL_INSTALLED}; then
|
||||
LOG_INFO "卸载软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
else
|
||||
LOG_INFO "保持软件包 ${PACKAGE_NAME} 的安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "LaTeX文档类可用性测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,83 +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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package documentation access
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
PACKAGE_NAME="texlive-ryethesis"
|
||||
COMMAND="ryethesis"
|
||||
EXPECTED_HELP_TEXT="Usage:"
|
||||
|
||||
LOG_INFO "开始测试软件包 ${PACKAGE_NAME} 的文档访问功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查软件包 ${PACKAGE_NAME} 是否在yum源中"
|
||||
dnf list available ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到软件包 ${PACKAGE_NAME}"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 在yum源中存在"
|
||||
|
||||
LOG_INFO "步骤2: 检查系统是否已安装 ${PACKAGE_NAME}"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,标记为需要保持安装状态"
|
||||
KEEP_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,标记为需要测试后卸载"
|
||||
KEEP_INSTALLED=false
|
||||
fi
|
||||
|
||||
if [ "${KEEP_INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "步骤3: 安装软件包 ${PACKAGE_NAME}"
|
||||
dnf install -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败"
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证 ${COMMAND} 命令是否存在"
|
||||
which ${COMMAND} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "命令 ${COMMAND} 未找到"
|
||||
|
||||
LOG_INFO "步骤5: 测试 ${COMMAND} 命令的 --help 参数"
|
||||
${COMMAND} --help &>/dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "命令 ${COMMAND} 不支持 --help 参数"
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "执行 ${COMMAND} --help 命令失败"
|
||||
|
||||
LOG_INFO "步骤6: 检查 ${COMMAND} --help 输出是否包含预期内容"
|
||||
${COMMAND} --help 2>&1 | grep -q "${EXPECTED_HELP_TEXT}"
|
||||
CHECK_RESULT $? 0 0 "命令 ${COMMAND} --help 的输出未包含预期文本 "${EXPECTED_HELP_TEXT}""
|
||||
LOG_INFO "命令 ${COMMAND} --help 输出符合预期"
|
||||
|
||||
if [ "${KEEP_INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "步骤7: 清理环境 - 卸载测试安装的软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败"
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 卸载成功,环境已恢复"
|
||||
else
|
||||
LOG_INFO "步骤7: 环境清理 - 保持软件包 ${PACKAGE_NAME} 的安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试软件包 ${PACKAGE_NAME} 的文档访问功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,61 +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-10-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package installation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已经安装texlive-ryethesis
|
||||
LOG_INFO "检查是否已经安装texlive-ryethesis"
|
||||
rpm -q texlive-ryethesis > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ryethesis已经安装,脚本结束时保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ryethesis软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ryethesis软件包"
|
||||
dnf list available texlive-ryethesis > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中没有texlive-ryethesis软件包"
|
||||
|
||||
# 安装texlive-ryethesis
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "开始安装texlive-ryethesis"
|
||||
dnf install -y texlive-ryethesis > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ryethesis失败"
|
||||
fi
|
||||
|
||||
# 测试texlive-ryethesis功能
|
||||
LOG_INFO "测试texlive-ryethesis功能"
|
||||
test_command="some_texlive_command --test" # 替换为实际的测试命令
|
||||
$test_command > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "texlive-ryethesis功能测试失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-ryethesis"
|
||||
dnf remove -y texlive-ryethesis > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ryethesis失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user