update testcase for testsuite texlive-structmech
This commit is contained in:
@@ -2,26 +2,10 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-structmech",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-structmech_function_basic",
|
||||
"desc": "Test basic functionality of structmech package"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-structmech_function_install",
|
||||
"desc": "Test if the texlive-structmech package can be successfully installed via package manager"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-structmech_function_verify",
|
||||
"desc": "Test if the structmech package files are correctly installed in the TeX system"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-structmech_function_compile",
|
||||
"desc": "Test basic LaTeX document compilation using the structmech package"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-structmech_function_macros",
|
||||
"desc": "Test the availability and basic usage of key structmech package macros (e.g., \\beam, \\support)"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-structmech_function_uninstall",
|
||||
"desc": "Test if the texlive-structmech package can be cleanly uninstalled"
|
||||
|
||||
@@ -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 : 2025-11-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality of structmech package
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试structmech包的基本功能"
|
||||
|
||||
# 检查yum源中是否存在structmech包
|
||||
LOG_INFO "检查yum源中是否存在structmech包"
|
||||
dnf list available texlive-structmech > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-structmech包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装texlive-structmech包
|
||||
LOG_INFO "检查是否已安装texlive-structmech包"
|
||||
rpm -q texlive-structmech > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-structmech包已安装,测试结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-structmech包未安装,测试结束后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-structmech包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装texlive-structmech包"
|
||||
dnf install -y texlive-structmech
|
||||
CHECK_RESULT $? 0 0 "安装texlive-structmech包失败"
|
||||
fi
|
||||
|
||||
# 测试structmech包的基本功能
|
||||
LOG_INFO "测试structmech包的基本功能"
|
||||
command_to_test="structmec --help" # 假设structmec是structmech包的测试命令
|
||||
$command_to_test > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "structmec命令执行失败"
|
||||
|
||||
# 如果测试开始时未安装,则在测试结束后卸载texlive-structmech包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-structmech包"
|
||||
dnf remove -y texlive-structmech
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-structmech包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,93 +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-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic LaTeX document compilation using the structmech package
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已经安装了texlive-structmech包
|
||||
LOG_INFO "检查是否已安装texlive-structmech包"
|
||||
rpm -q texlive-structmech &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-structmech已安装,脚本将保持安装状态"
|
||||
already_installed=1
|
||||
else
|
||||
LOG_INFO "texlive-structmech未安装,将在测试过程中安装"
|
||||
already_installed=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-structmech包
|
||||
LOG_INFO "检查yum源中是否有texlive-structmech包"
|
||||
dnf list available texlive-structmech &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有texlive-structmech包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-structmech包
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-structmech包"
|
||||
dnf install -y texlive-structmech
|
||||
CHECK_RESULT $? 0 0 "安装texlive-structmech包失败"
|
||||
fi
|
||||
|
||||
# 创建测试用的LaTeX文档
|
||||
LOG_INFO "创建测试用的LaTeX文档"
|
||||
cat > test_structmech.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{structmech}
|
||||
\begin{document}
|
||||
This is a test document using the structmech package.
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败"
|
||||
|
||||
# 使用pdflatex编译LaTeX文档
|
||||
LOG_INFO "使用pdflatex编译LaTeX文档"
|
||||
pdflatex -interaction=nonstopmode test_structmech.tex &> compile.log
|
||||
CHECK_RESULT $? 0 0 "编译LaTeX文档失败"
|
||||
|
||||
# 检查是否生成了PDF文件
|
||||
LOG_INFO "检查是否生成了PDF文件"
|
||||
if [ -f "test_structmech.pdf" ]; then
|
||||
LOG_INFO "成功生成PDF文件"
|
||||
else
|
||||
LOG_ERROR "未生成PDF文件"
|
||||
CHECK_RESULT 1 0 1 "PDF文件生成失败"
|
||||
fi
|
||||
|
||||
# 清理编译生成的中间文件
|
||||
LOG_INFO "清理编译生成的中间文件"
|
||||
rm -f test_structmech.aux test_structmech.log test_structmech.out test_structmech.synctex.gz compile.log
|
||||
|
||||
# 如果测试前未安装,则卸载texlive-structmech包
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-structmech包"
|
||||
dnf remove -y texlive-structmech
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-structmech包失败"
|
||||
# 清理测试文件
|
||||
rm -f test_structmech.tex test_structmech.pdf
|
||||
else
|
||||
LOG_INFO "保持texlive-structmech包安装状态,仅清理测试文件"
|
||||
rm -f test_structmech.tex test_structmech.pdf
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,94 +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-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test the availability and basic usage of key structmech package macros (e.g., \beam, \support)
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 structmech 宏包的关键宏命令(如 \\beam, \\support)的可用性和基本用法"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-structmech"
|
||||
|
||||
# 步骤1: 检查软件包是否已在系统中安装
|
||||
LOG_INFO "步骤1: 检查 $PACKAGE_NAME 是否已安装"
|
||||
if dnf list installed "$PACKAGE_NAME" &>/dev/null; then
|
||||
LOG_INFO "$PACKAGE_NAME 已安装,跳过安装步骤"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "$PACKAGE_NAME 未安装,将在后续步骤中安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 步骤2: 检查yum源中是否存在该软件包
|
||||
LOG_INFO "步骤2: 检查yum源中是否存在 $PACKAGE_NAME"
|
||||
if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3: 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤3: 安装 $PACKAGE_NAME"
|
||||
dnf install -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 步骤4: 测试关键宏命令的可用性
|
||||
LOG_INFO "步骤4: 测试关键宏命令 \\beam 和 \\support 的可用性"
|
||||
cat > test_structmech.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{structmech}
|
||||
\begin{document}
|
||||
测试宏命令:
|
||||
\beam{Test Beam}
|
||||
\support{Test Support}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# 步骤5: 编译LaTeX文档以验证宏命令是否正常工作
|
||||
LOG_INFO "步骤5: 编译LaTeX文档验证宏命令"
|
||||
pdflatex -interaction=nonstopmode test_structmech.tex
|
||||
CHECK_RESULT $? 0 0 "编译LaTeX文档失败,宏命令可能不可用"
|
||||
|
||||
# 步骤6: 检查生成的PDF文件是否存在
|
||||
LOG_INFO "步骤6: 检查生成的PDF文件"
|
||||
if [ -f test_structmech.pdf ]; then
|
||||
LOG_INFO "PDF文件生成成功,宏命令可用"
|
||||
else
|
||||
LOG_ERROR "PDF文件未生成,宏命令可能存在问题"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 步骤7: 清理临时文件
|
||||
LOG_INFO "步骤7: 清理临时文件"
|
||||
rm -f test_structmech.tex test_structmech.aux test_structmech.log test_structmech.pdf
|
||||
|
||||
# 步骤8: 如果之前未安装,则卸载软件包以恢复环境
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤8: 卸载 $PACKAGE_NAME 以恢复环境"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败"
|
||||
else
|
||||
LOG_INFO "步骤8: 保持 $PACKAGE_NAME 的安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,103 +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-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test if the structmech package files are correctly installed in the TeX system
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:验证structmech包文件是否正确安装在TeX系统中"
|
||||
|
||||
LOG_INFO "步骤1:检查TeX Live是否已安装"
|
||||
if command -v tex > /dev/null 2>&1; then
|
||||
LOG_INFO "TeX Live已安装,将保持安装状态"
|
||||
TEXLIVE_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "TeX Live未安装,将在测试过程中安装"
|
||||
TEXLIVE_INSTALLED=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在texlive-structmech包"
|
||||
if ! dnf list available texlive-structmech > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到texlive-structmech包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:安装texlive-structmech包"
|
||||
if [ "$TEXLIVE_INSTALLED" = false ]; then
|
||||
dnf install -y texlive-structmech
|
||||
CHECK_RESULT $? 0 0 "安装texlive-structmech包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查structmech包文件是否正确安装"
|
||||
TEXMFDIST=$(kpsewhich -var-value TEXMFDIST)
|
||||
if [ -z "$TEXMFDIST" ]; then
|
||||
LOG_ERROR "无法获取TEXMFDIST路径"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:验证structmech.sty文件是否存在"
|
||||
STRUCTMECH_STY_PATH="$TEXMFDIST/tex/latex/structmech/structmech.sty"
|
||||
if [ ! -f "$STRUCTMECH_STY_PATH" ]; then
|
||||
LOG_ERROR "structmech.sty文件未找到"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "structmech.sty文件存在: $STRUCTMECH_STY_PATH"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:验证structmech.pdf文档是否存在"
|
||||
STRUCTMECH_PDF_PATH="$TEXMFDIST/doc/latex/structmech/structmech.pdf"
|
||||
if [ ! -f "$STRUCTMECH_PDF_PATH" ]; then
|
||||
LOG_ERROR "structmech.pdf文档未找到"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "structmech.pdf文档存在: $STRUCTMECH_PDF_PATH"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7:验证structmech包提供的命令是否可用"
|
||||
if ! kpsewhich structmech.sty > /dev/null 2>&1; then
|
||||
LOG_ERROR "kpsewhich无法找到structmech.sty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8:创建测试LaTeX文档验证structmech包功能"
|
||||
TEST_TEX_FILE="/tmp/test_structmech.tex"
|
||||
cat > "$TEST_TEX_FILE" << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{structmech}
|
||||
\begin{document}
|
||||
Test document for structmech package.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
pdflatex -interaction=nonstopmode "$TEST_TEX_FILE" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "使用structmech包编译LaTeX文档失败"
|
||||
|
||||
LOG_INFO "步骤9:清理临时文件"
|
||||
rm -f "$TEST_TEX_FILE" /tmp/test_structmech.aux /tmp/test_structmech.log /tmp/test_structmech.pdf 2>/dev/null
|
||||
|
||||
LOG_INFO "步骤10:恢复测试环境"
|
||||
if [ "$TEXLIVE_INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载在测试过程中安装的texlive-structmech包"
|
||||
dnf remove -y texlive-structmech
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-structmech包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:structmech包文件已正确安装在TeX系统中"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user