update testcase for testsuite texlive-bibleref-lds
This commit is contained in:
@@ -19,18 +19,6 @@
|
||||
{
|
||||
"name": "test_texlive-bibleref-lds_function_uninstall",
|
||||
"desc": "测试软件包 texlive-bibleref-lds 的卸载功能,确保能够通过包管理器完全移除且不残留主要文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-bibleref-lds_function_availability",
|
||||
"desc": "测试 texlive-bibleref-lds 宏包在 LaTeX 文档中的可用性,验证其核心命令(如 \\bibleref)能否被正确加载和识别。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-bibleref-lds_function_basic_usage",
|
||||
"desc": "测试 texlive-bibleref-lds 的基本引用功能,使用 \\bibleref 命令引用标准经文并编译生成包含正确引用的PDF文档。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-bibleref-lds_function_options",
|
||||
"desc": "测试 texlive-bibleref-lds 宏包的可选参数功能,验证加载时使用不同选项(如lds)是否能按预期影响引用格式或内容。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,96 +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-01
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 texlive-bibleref-lds 宏包在 LaTeX 文档中的可用性,验证其核心命令(如 \bibleref)能否被正确加载和识别。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试 texlive-bibleref-lds 宏包在 LaTeX 文档中的可用性"
|
||||
|
||||
LOG_INFO "步骤1:检查系统中是否已安装 texlive-bibleref-lds 宏包"
|
||||
if dnf list installed texlive-bibleref-lds &>/dev/null; then
|
||||
LOG_INFO "检测到 texlive-bibleref-lds 已安装,测试完成后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "未检测到 texlive-bibleref-lds 安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查 yum 源中是否存在 texlive-bibleref-lds 软件包"
|
||||
if ! dnf list available texlive-bibleref-lds &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-bibleref-lds 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装 texlive-bibleref-lds 软件包"
|
||||
dnf install -y texlive-bibleref-lds
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-bibleref-lds 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:创建一个测试 LaTeX 文档,尝试加载 bibleref-lds 宏包并使用 \\bibleref 命令"
|
||||
TEST_TEX_FILE="/tmp/test_bibleref.tex"
|
||||
cat > "$TEST_TEX_FILE" << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{bibleref-lds}
|
||||
\begin{document}
|
||||
测试文档。
|
||||
|
||||
\bibleref{John}{3}{16} 是一个著名的圣经引用。
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试 LaTeX 文件失败"
|
||||
|
||||
LOG_INFO "步骤5:使用 pdflatex 编译测试文档,检查宏包是否能被正确加载"
|
||||
pdflatex -interaction=nonstopmode "$TEST_TEX_FILE" > /tmp/tex_compile.log 2>&1
|
||||
TEX_COMPILE_RESULT=$?
|
||||
|
||||
if [ $TEX_COMPILE_RESULT -ne 0 ]; then
|
||||
LOG_ERROR "LaTeX 编译失败,可能由于 bibleref-lds 宏包加载问题或 \\bibleref 命令不可用"
|
||||
LOG_ERROR "编译日志摘要:"
|
||||
grep -A 5 -B 5 "error\|undefined" /tmp/tex_compile.log || cat /tmp/tex_compile.log
|
||||
exit $TEX_COMPILE_RESULT
|
||||
else
|
||||
LOG_INFO "LaTeX 编译成功,未发现与 bibleref-lds 宏包相关的错误"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:检查生成的 PDF 日志中是否包含 \\bibleref 命令的处理信息(可选验证)"
|
||||
if grep -q "bibleref" /tmp/tex_compile.log; then
|
||||
LOG_INFO "在编译日志中检测到与 bibleref 相关的处理信息"
|
||||
else
|
||||
LOG_INFO "编译日志中未明确显示 bibleref 处理信息,但这可能正常,取决于 latex 版本和日志级别"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7:环境清理"
|
||||
rm -f "$TEST_TEX_FILE" /tmp/test_bibleref.aux /tmp/test_bibleref.log /tmp/test_bibleref.pdf /tmp/tex_compile.log
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "步骤8:卸载测试安装的 texlive-bibleref-lds 软件包"
|
||||
dnf remove -y texlive-bibleref-lds
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-bibleref-lds 失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装 texlive-bibleref-lds,保持安装状态,不进行卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:texlive-bibleref-lds 宏包在 LaTeX 文档中的基本可用性验证通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,95 +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-01
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 texlive-bibleref-lds 的基本引用功能,使用 \bibleref 命令引用标准经文并编译生成包含正确引用的PDF文档。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 texlive-bibleref-lds 的基本引用功能"
|
||||
|
||||
# 检查 yum 源中是否存在 texlive-bibleref-lds 软件包
|
||||
LOG_INFO "检查 yum 源中是否存在 texlive-bibleref-lds 软件包"
|
||||
dnf list texlive-bibleref-lds 2>/dev/null | grep -q texlive-bibleref-lds
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中不存在 texlive-bibleref-lds 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装 texlive-bibleref-lds
|
||||
LOG_INFO "检查是否已安装 texlive-bibleref-lds"
|
||||
rpm -q texlive-bibleref-lds >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-bibleref-lds 已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-bibleref-lds 未安装,将进行安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装 texlive-bibleref-lds
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装 texlive-bibleref-lds"
|
||||
dnf install -y texlive-bibleref-lds
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-bibleref-lds 失败"
|
||||
fi
|
||||
|
||||
# 创建测试 LaTeX 文档
|
||||
LOG_INFO "创建测试 LaTeX 文档"
|
||||
cat > test_bibleref.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{bibleref-lds}
|
||||
\begin{document}
|
||||
这是一个测试文档,引用标准经文:\bibleref{John}{3}{16}。
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试 LaTeX 文档失败"
|
||||
|
||||
# 检查 \bibleref 命令是否支持
|
||||
LOG_INFO "检查 \bibleref 命令是否支持"
|
||||
pdflatex -halt-on-error test_bibleref.tex 2>&1 | grep -q "Undefined control sequence.*bibleref"
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "\bibleref 命令不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 编译 LaTeX 文档生成 PDF
|
||||
LOG_INFO "编译 LaTeX 文档生成 PDF"
|
||||
pdflatex -halt-on-error test_bibleref.tex >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "编译 LaTeX 文档失败"
|
||||
|
||||
# 检查生成的 PDF 文件是否存在
|
||||
LOG_INFO "检查生成的 PDF 文件是否存在"
|
||||
[ -f test_bibleref.pdf ]
|
||||
CHECK_RESULT $? 0 0 "未生成 PDF 文件"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_bibleref.tex test_bibleref.aux test_bibleref.log test_bibleref.pdf
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果脚本开始时未安装,则卸载 texlive-bibleref-lds
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 texlive-bibleref-lds"
|
||||
dnf remove -y texlive-bibleref-lds
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-bibleref-lds 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,92 +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-01
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 texlive-bibleref-lds 宏包的可选参数功能,验证加载时使用不同选项(如lds)是否能按预期影响引用格式或内容。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-bibleref-lds宏包
|
||||
LOG_INFO "检查是否已安装texlive-bibleref-lds宏包"
|
||||
rpm -q texlive-bibleref-lds > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-bibleref-lds宏包已安装"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-bibleref-lds宏包未安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-bibleref-lds软件包"
|
||||
dnf list available texlive-bibleref-lds > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-bibleref-lds软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-bibleref-lds软件包"
|
||||
dnf install -y texlive-bibleref-lds
|
||||
CHECK_RESULT $? 0 0 "安装texlive-bibleref-lds软件包失败"
|
||||
fi
|
||||
|
||||
# 创建测试LaTeX文档
|
||||
LOG_INFO "创建测试LaTeX文档"
|
||||
cat > test_bibleref.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{lds}{bibleref}
|
||||
\begin{document}
|
||||
测试texlive-bibleref-lds宏包的可选参数功能。
|
||||
引用格式测试:\bibleverse{Gen}{1}{1}。
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败"
|
||||
|
||||
# 测试编译LaTeX文档
|
||||
LOG_INFO "测试编译LaTeX文档"
|
||||
pdflatex -interaction=nonstopmode test_bibleref.tex > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "编译LaTeX文档失败"
|
||||
|
||||
# 检查生成的PDF文件
|
||||
LOG_INFO "检查生成的PDF文件"
|
||||
if [ -f test_bibleref.pdf ]; then
|
||||
LOG_INFO "PDF文件生成成功"
|
||||
else
|
||||
LOG_ERROR "PDF文件生成失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_bibleref.tex test_bibleref.aux test_bibleref.log test_bibleref.pdf
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果最初未安装,则卸载软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-bibleref-lds软件包"
|
||||
dnf remove -y texlive-bibleref-lds
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-bibleref-lds软件包失败"
|
||||
else
|
||||
LOG_INFO "保持texlive-bibleref-lds软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user