update testcase for testsuite texlive-ltxfileinfo
This commit is contained in:
@@ -14,189 +14,25 @@
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__upper_v",
|
||||
"desc": "测试版本信息打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__d",
|
||||
"desc": "测试文件日期打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__v",
|
||||
"desc": "测试文件版本打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__i",
|
||||
"desc": "测试文件描述文本打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__l",
|
||||
"desc": "测试文件完整路径打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__f",
|
||||
"desc": "测试单行输出文件信息功能(包含文件、日期、版本和描述)"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__s",
|
||||
"desc": "测试标记格式错误数据(使用星号)"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo__c",
|
||||
"desc": "测试标记格式错误数据(使用红色ANSI颜色)"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_help",
|
||||
"desc": "测试帮助文档打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_fullhelp",
|
||||
"desc": "测试完整文档打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_version",
|
||||
"desc": "测试版本信息打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_date",
|
||||
"desc": "测试文件日期打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_fileversion",
|
||||
"desc": "测试文件版本打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_description",
|
||||
"desc": "测试文件描述文本打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_path",
|
||||
"desc": "测试文件完整路径打印功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_singleline",
|
||||
"desc": "测试单行输出文件信息功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_markasterisk",
|
||||
"desc": "测试标记格式错误数据(星号)"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_markcolor",
|
||||
"desc": "测试标记格式错误数据(颜色)"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_h",
|
||||
"desc": "测试ltxfileinfo命令的-h选项,应打印帮助信息"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_help",
|
||||
"desc": "测试ltxfileinfo命令的--help选项,应打印帮助信息"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_upper_v",
|
||||
"desc": "测试ltxfileinfo命令的-V选项,应打印脚本版本"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_d",
|
||||
"desc": "测试ltxfileinfo命令的-d选项,应仅打印文件的日期"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_date",
|
||||
"desc": "测试ltxfileinfo命令的--date选项,应仅打印文件的日期"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_v",
|
||||
"desc": "测试ltxfileinfo命令的-v选项,应仅打印文件的版本"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_version",
|
||||
"desc": "测试ltxfileinfo命令的--version选项,应仅打印文件的版本"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_i",
|
||||
"desc": "测试ltxfileinfo命令的-i选项,应仅打印文件的描述文本"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_info",
|
||||
"desc": "测试ltxfileinfo命令的--info选项,应仅打印文件的描述文本"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_l",
|
||||
"desc": "测试ltxfileinfo命令的-l选项,应打印文件的完整路径"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_location",
|
||||
"desc": "测试ltxfileinfo命令的--location选项,应打印文件的完整路径"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_f",
|
||||
"desc": "测试ltxfileinfo命令的-f选项,应以单行四个制表符分隔的字段输出文件、日期、版本和信息"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_flat",
|
||||
"desc": "测试ltxfileinfo命令的--flat选项,应以单行四个制表符分隔的字段输出文件、日期、版本和信息"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_s",
|
||||
"desc": "测试ltxfileinfo命令的-s选项,应用星号标记格式错误的数据"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_star",
|
||||
"desc": "测试ltxfileinfo命令的--star选项,应用星号标记格式错误的数据"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_c",
|
||||
"desc": "测试ltxfileinfo命令的-c选项,应用红色(ANSI着色)标记格式错误的数据"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_color",
|
||||
"desc": "测试ltxfileinfo命令的--color选项,应用红色(ANSI着色)标记格式错误的数据"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_upper_d",
|
||||
"desc": "测试ltxfileinfo命令的-D选项,应保留临时文件用于调试"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_debug",
|
||||
"desc": "测试ltxfileinfo命令的--debug选项,应保留临时文件用于调试"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_d_v_i",
|
||||
"desc": "测试ltxfileinfo命令组合使用-d、-v、-i选项,应依次打印文件的日期、版本和描述文本"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_f_s",
|
||||
"desc": "测试ltxfileinfo命令组合使用-f和-s选项,应以单行格式输出并对格式错误的数据标记星号"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_f_c",
|
||||
"desc": "测试ltxfileinfo命令组合使用-f和-c选项,应以单行格式输出并对格式错误的数据进行红色标记"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_d_l",
|
||||
"desc": "测试ltxfileinfo命令组合使用-d和-l选项,应打印文件的日期和完整路径"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_ltxfileinfo_v_location",
|
||||
"desc": "测试ltxfileinfo命令组合使用-v和--location选项,应打印文件的版本和完整路径"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_install",
|
||||
"desc": "测试软件包安装功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_check_installed",
|
||||
"desc": "测试检查软件包是否已安装"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_basic_usage",
|
||||
"desc": "测试ltxfileinfo基本文件信息查询"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_combined_options",
|
||||
"desc": "测试组合选项查询文件信息"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-ltxfileinfo_function_uninstall",
|
||||
"desc": "测试软件包卸载功能"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,99 +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 : 测试ltxfileinfo基本文件信息查询
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试ltxfileinfo基本文件信息查询功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查texlive-ltxfileinfo软件包是否在yum源中"
|
||||
dnf list texlive-ltxfileinfo &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "texlive-ltxfileinfo软件包不在yum源中,无法进行测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查ltxfileinfo命令是否已安装"
|
||||
which ltxfileinfo &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "ltxfileinfo命令已安装,记录安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "ltxfileinfo命令未安装,将在测试过程中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3: 安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证ltxfileinfo命令基本功能"
|
||||
LOG_INFO "步骤4.1: 测试ltxfileinfo --version命令"
|
||||
ltxfileinfo --version
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo --version失败"
|
||||
|
||||
LOG_INFO "步骤4.2: 测试ltxfileinfo --help命令"
|
||||
ltxfileinfo --help
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo --help失败"
|
||||
|
||||
LOG_INFO "步骤4.3: 测试ltxfileinfo查询不存在的文件"
|
||||
ltxfileinfo /tmp/nonexistent-file.tex 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "查询不存在的文件应该失败但成功了"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4.4: 创建测试LaTeX文件进行查询"
|
||||
TEST_FILE="/tmp/test-ltxfileinfo.tex"
|
||||
cat > "$TEST_FILE" << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, LaTeX!
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
ltxfileinfo "$TEST_FILE"
|
||||
CHECK_RESULT $? 0 0 "查询测试LaTeX文件信息失败"
|
||||
|
||||
LOG_INFO "步骤4.5: 测试不支持的参数"
|
||||
ltxfileinfo --invalid-param 2>/dev/null
|
||||
if [ $? -ne 255 ]; then
|
||||
LOG_ERROR "不支持的参数应该返回255但返回了其他值"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5: 清理测试文件"
|
||||
rm -f "$TEST_FILE"
|
||||
CHECK_RESULT $? 0 0 "删除测试文件失败"
|
||||
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤6: 卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo软件包失败"
|
||||
LOG_INFO "已恢复到测试前的环境状态"
|
||||
else
|
||||
LOG_INFO "步骤6: 保持texlive-ltxfileinfo软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "ltxfileinfo基本文件信息查询功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,86 +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 : 测试检查软件包是否已安装
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试检查软件包是否已安装"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-ltxfileinfo"
|
||||
|
||||
# 步骤1:检查yum源中是否存在该软件包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME"
|
||||
dnf list available $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在软件包 $PACKAGE_NAME"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在软件包 $PACKAGE_NAME"
|
||||
|
||||
# 步骤2:检查当前环境是否已安装该软件包
|
||||
LOG_INFO "步骤2:检查当前环境是否已安装软件包 $PACKAGE_NAME"
|
||||
rpm -q $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 安装成功"
|
||||
fi
|
||||
|
||||
# 步骤4:检查软件包是否已安装
|
||||
LOG_INFO "步骤4:检查软件包是否已安装"
|
||||
rpm -q $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 未正确安装"
|
||||
|
||||
# 步骤5:执行软件包相关命令检查(例如查看版本信息)
|
||||
LOG_INFO "步骤5:执行软件包相关命令检查"
|
||||
# 假设软件包提供了一个可执行命令 ltxfileinfo,检查其版本
|
||||
if command -v ltxfileinfo &>/dev/null; then
|
||||
ltxfileinfo --version &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "命令 ltxfileinfo 执行失败"
|
||||
LOG_INFO "命令 ltxfileinfo 执行成功"
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未提供 ltxfileinfo 命令,跳过命令检查"
|
||||
fi
|
||||
|
||||
# 步骤6:清理环境,恢复到之前的状态
|
||||
LOG_INFO "步骤6:清理环境,恢复到之前的状态"
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
LOG_INFO "卸载软件包 $PACKAGE_NAME"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 卸载成功"
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 在测试前已安装,保持安装状态"
|
||||
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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试组合选项查询文件信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:组合选项查询文件信息"
|
||||
LOG_INFO "步骤1:检查texlive-ltxfileinfo软件包是否已在yum源中"
|
||||
if ! dnf list texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "texlive-ltxfileinfo软件包在yum源中存在"
|
||||
|
||||
LOG_INFO "步骤2:检查当前环境是否已安装texlive-ltxfileinfo软件包"
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo软件包未安装,将进行安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤3:安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo软件包失败"
|
||||
LOG_INFO "texlive-ltxfileinfo软件包安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证ltxfileinfo命令是否支持--help选项"
|
||||
ltxfileinfo --help
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持--help选项或执行失败"
|
||||
|
||||
LOG_INFO "步骤5:验证ltxfileinfo命令是否支持--version选项"
|
||||
ltxfileinfo --version
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持--version选项或执行失败"
|
||||
|
||||
LOG_INFO "步骤6:验证ltxfileinfo命令是否支持组合选项--help --version"
|
||||
ltxfileinfo --help --version 2>&1 | grep -q "usage"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持组合选项--help --version或输出不符合预期"
|
||||
|
||||
LOG_INFO "步骤7:创建一个简单的LaTeX文件用于测试"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, world!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文件失败"
|
||||
|
||||
LOG_INFO "步骤8:使用ltxfileinfo命令查询测试文件信息"
|
||||
ltxfileinfo test.tex
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo查询文件信息失败"
|
||||
|
||||
LOG_INFO "步骤9:使用组合选项--verbose --help查询测试文件信息"
|
||||
ltxfileinfo --verbose test.tex 2>&1 | head -5
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo使用组合选项--verbose查询文件信息失败"
|
||||
|
||||
LOG_INFO "步骤10:清理测试文件"
|
||||
rm -f test.tex
|
||||
CHECK_RESULT $? 0 0 "删除测试文件失败"
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤11:卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo软件包失败"
|
||||
LOG_INFO "texlive-ltxfileinfo软件包卸载成功"
|
||||
else
|
||||
LOG_INFO "步骤11:测试开始前已安装texlive-ltxfileinfo,保持安装状态,不进行卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:组合选项查询文件信息"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,69 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试文件日期打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查环境是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo"
|
||||
if dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "开始安装texlive-ltxfileinfo"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试文件日期打印功能
|
||||
LOG_INFO "测试文件日期打印功能"
|
||||
ltxfileinfo_output=$(ltxfileinfo --date test.tex 2>&1)
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo --date参数不支持或执行失败"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
CHECK_RESULT $? 0 0 "文件日期打印功能测试失败"
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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 : 2025-11-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试文件描述文本打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的文件描述文本打印功能
|
||||
LOG_INFO "测试ltxfileinfo命令的文件描述文本打印功能"
|
||||
ltxfileinfo --description /usr/share/texmf/tex/latex/base/article.cls
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令执行失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试文件版本打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试文件版本打印功能
|
||||
|
||||
LOG_INFO "开始测试texlive-ltxfileinfo的文件版本打印功能"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
if ! dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "环境未安装texlive-ltxfileinfo,将进行安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "环境已安装texlive-ltxfileinfo,跳过安装步骤"
|
||||
fi
|
||||
|
||||
# 测试文件版本打印功能
|
||||
LOG_INFO "测试ltxfileinfo命令的文件版本打印功能"
|
||||
ltxfileinfo --version
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令执行失败"
|
||||
|
||||
# 检查参数是否存在或不支持
|
||||
LOG_INFO "检查ltxfileinfo命令不支持的参数"
|
||||
ltxfileinfo --invalid-option &>/dev/null
|
||||
if [ $? -ne 255 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--invalid-option参数但未返回255"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 环境恢复
|
||||
if ! dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo以恢复环境"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "环境已保持安装状态,无需卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
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-11-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试完整文档打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试完整文档打印功能
|
||||
|
||||
LOG_INFO "开始测试texlive-ltxfileinfo的完整文档打印功能"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
if ! dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将进行安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
# 标记为需要卸载
|
||||
NEED_UNINSTALL=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,无需重复安装"
|
||||
fi
|
||||
|
||||
# 测试完整文档打印功能
|
||||
LOG_INFO "测试texlive-ltxfileinfo的--help参数"
|
||||
texlive-ltxfileinfo --help
|
||||
CHECK_RESULT $? 0 0 "执行texlive-ltxfileinfo --help失败"
|
||||
|
||||
LOG_INFO "测试texlive-ltxfileinfo的完整文档打印功能成功"
|
||||
|
||||
# 清理环境
|
||||
if [ "$NEED_UNINSTALL" == "1" ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试帮助文档打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试帮助文档打印功能
|
||||
|
||||
LOG_INFO "开始测试texlive-ltxfileinfo的帮助文档打印功能"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
if ! dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将进行安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
# 标记需要卸载
|
||||
UNINSTALL_NEEDED=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,无需重新安装"
|
||||
UNINSTALL_NEEDED=0
|
||||
fi
|
||||
|
||||
# 测试帮助文档打印功能
|
||||
LOG_INFO "测试texlive-ltxfileinfo --help命令"
|
||||
texlive-ltxfileinfo --help
|
||||
CHECK_RESULT $? 0 0 "执行texlive-ltxfileinfo --help失败"
|
||||
|
||||
# 测试不支持的参数(假设--invalid-param为不支持参数)
|
||||
LOG_INFO "测试不支持参数的情况"
|
||||
texlive-ltxfileinfo --invalid-param &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_INFO "不支持参数测试通过(预期失败)"
|
||||
else
|
||||
LOG_ERROR "不支持参数测试未通过(预期失败但实际成功)"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$UNINSTALL_NEEDED" -eq 1 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo以恢复环境"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包安装功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查环境是否已安装texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查texlive-ltxfileinfo是否已安装"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试中安装并最终卸载"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
|
||||
# 验证安装是否成功
|
||||
LOG_INFO "验证texlive-ltxfileinfo是否安装成功"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "texlive-ltxfileinfo安装后验证失败"
|
||||
|
||||
# 测试ltxfileinfo命令
|
||||
LOG_INFO "测试ltxfileinfo命令"
|
||||
ltxfileinfo --version
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令执行失败"
|
||||
|
||||
# 测试ltxfileinfo命令的无效参数
|
||||
LOG_INFO "测试ltxfileinfo命令的无效参数"
|
||||
ltxfileinfo --invalid-parameter > /dev/null 2>&1
|
||||
if [ $? -ne 255 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持无效参数或退出码不符合预期"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理环境
|
||||
LOG_INFO "清理环境"
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "环境已安装texlive-ltxfileinfo,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,58 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试标记格式错误数据(颜色)
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试标记格式错误数据(颜色)功能"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查texlive-ltxfileinfo是否已安装"
|
||||
if ! dnf list installed texlive-ltxfileinfo &> /dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将进行安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available texlive-ltxfileinfo &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo已安装"
|
||||
fi
|
||||
|
||||
# 测试标记格式错误数据(颜色)功能
|
||||
LOG_INFO "测试标记格式错误数据(颜色)功能"
|
||||
ltxfileinfo --markcolor=invalidcolor test.tex
|
||||
CHECK_RESULT $? 255 0 "标记颜色参数无效时未返回正确退出码"
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if ! dnf list installed texlive-ltxfileinfo &> /dev/null; then
|
||||
LOG_INFO "清理环境:卸载texlive-ltxfileinfo"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "保持环境:不卸载texlive-ltxfileinfo"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试标记格式错误数据(颜色)功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试文件完整路径打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束时将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试结束后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo(如果未安装)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试文件完整路径打印功能
|
||||
LOG_INFO "测试文件完整路径打印功能"
|
||||
texlua $(kpsewhich ltxfileinfo.lua) --path test.tex > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "文件完整路径打印功能测试失败"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,68 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试单行输出文件信息功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试单行输出文件信息功能"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo"
|
||||
if dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试单行输出文件信息功能
|
||||
LOG_INFO "测试ltxfileinfo命令的单行输出文件信息功能"
|
||||
ltxfileinfo --help | grep -q "singleline"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo不支持单行输出文件信息参数"
|
||||
|
||||
LOG_INFO "执行ltxfileinfo单行输出文件信息命令"
|
||||
ltxfileinfo --singleline /usr/share/texlive/texmf-dist/tex/latex/base/article.cls
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo单行输出文件信息命令失败"
|
||||
|
||||
# 清理环境(如果最初未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试单行输出文件信息功能完成"
|
||||
}
|
||||
|
||||
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 : 测试软件包卸载功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 环境检查:是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo软件包"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "检测到texlive-ltxfileinfo已安装,脚本结束将保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "检测到texlive-ltxfileinfo未安装,测试将包含安装步骤"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包,退出"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ ${INSTALLED_BEFORE} -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
LOG_INFO "安装texlive-ltxfileinfo成功"
|
||||
fi
|
||||
|
||||
# 验证软件包安装成功
|
||||
LOG_INFO "验证texlive-ltxfileinfo软件包是否安装成功"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "验证texlive-ltxfileinfo安装失败"
|
||||
|
||||
# 测试卸载功能
|
||||
LOG_INFO "开始测试texlive-ltxfileinfo卸载功能"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
LOG_INFO "卸载texlive-ltxfileinfo成功"
|
||||
|
||||
# 验证软件包已卸载
|
||||
LOG_INFO "验证texlive-ltxfileinfo软件包是否已卸载"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "验证texlive-ltxfileinfo卸载失败,软件包仍然存在"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "验证texlive-ltxfileinfo卸载成功,软件包已不存在"
|
||||
fi
|
||||
|
||||
# 环境恢复:如果测试前已安装,则重新安装
|
||||
if [ ${INSTALLED_BEFORE} -eq 1 ]; then
|
||||
LOG_INFO "恢复环境:重新安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "重新安装texlive-ltxfileinfo失败"
|
||||
LOG_INFO "重新安装texlive-ltxfileinfo成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试版本信息打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已经安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已经安装texlive-ltxfileinfo"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包
|
||||
if ! $installed; then
|
||||
LOG_INFO "开始安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo软件包失败"
|
||||
fi
|
||||
|
||||
# 测试版本信息打印功能
|
||||
LOG_INFO "测试版本信息打印功能"
|
||||
ltxfileinfo --version > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo --version命令执行失败"
|
||||
|
||||
# 清理环境
|
||||
if ! $installed; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,76 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试标记格式错误数据(使用红色ANSI颜色)
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试:测试标记格式错误数据(使用红色ANSI颜色)"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo软件包"
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试步骤中安装并在脚本结束前卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包(如果未安装)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "正在安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的参数支持情况
|
||||
LOG_INFO "测试ltxfileinfo命令的参数支持情况"
|
||||
ltxfileinfo --help &>/dev/null
|
||||
CHECK_RESULT $? 0 255 "ltxfileinfo命令不支持--help参数"
|
||||
|
||||
# 测试标记格式错误数据(使用红色ANSI颜色)
|
||||
LOG_INFO "测试标记格式错误数据(使用红色ANSI颜色)"
|
||||
output=$(ltxfileinfo --color=always invalidfile.tex 2>&1)
|
||||
if [[ "$output" == *"\033[31m"* ]]; then
|
||||
LOG_INFO "检测到红色ANSI颜色标记,测试通过"
|
||||
else
|
||||
LOG_ERROR "未检测到红色ANSI颜色标记,测试失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境(如果脚本开始时未安装texlive-ltxfileinfo)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "正在卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,87 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试文件日期打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查texlive-ltxfileinfo是否已安装"
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的文件日期打印功能
|
||||
LOG_INFO "测试ltxfileinfo命令的文件日期打印功能"
|
||||
TEST_FILE="/tmp/test_ltxfileinfo.tex"
|
||||
echo "\documentclass{article}\begin{document}Test\end{document}" > "$TEST_FILE"
|
||||
|
||||
# 检查ltxfileinfo命令是否支持--date参数
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持--date参数"
|
||||
if ! ltxfileinfo --help | grep -q -- "--date"; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--date参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行ltxfileinfo --date命令并验证结果
|
||||
LOG_INFO "执行ltxfileinfo --date命令"
|
||||
ltx_file_date=$(ltxfileinfo --date "$TEST_FILE")
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo --date命令执行失败"
|
||||
|
||||
# 验证输出结果是否符合预期(假设输出包含日期格式)
|
||||
if [[ "$ltx_file_date" =~ [0-9]{4}-[0-9]{2}-[0-9]{2} ]]; then
|
||||
LOG_INFO "文件日期打印功能测试通过"
|
||||
else
|
||||
LOG_ERROR "文件日期打印功能测试失败,输出不符合预期: $ltx_file_date"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
rm -f "$TEST_FILE"
|
||||
|
||||
# 卸载texlive-ltxfileinfo软件包(如果脚本开始时未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试单行输出文件信息功能(包含文件、日期、版本和描述)
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已经安装了texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo软件包..."
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态。"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试完成后卸载。"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包..."
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "正在安装texlive-ltxfileinfo软件包..."
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败。"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的单行输出文件信息功能(包含文件、日期、版本和描述)
|
||||
LOG_INFO "测试ltxfileinfo命令的单行输出文件信息功能..."
|
||||
output=$(ltxfileinfo --help)
|
||||
if ! echo "$output" | grep -q "--version"; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--version参数。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
version_output=$(ltxfileinfo --version)
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo --version失败。"
|
||||
|
||||
# 验证输出是否包含文件、日期、版本和描述信息
|
||||
LOG_INFO "验证输出是否包含文件、日期、版本和描述信息..."
|
||||
if [[ "$version_output" =~ file:|date:|version:|description: ]]; then
|
||||
LOG_INFO "输出信息验证成功:$version_output"
|
||||
else
|
||||
LOG_ERROR "输出信息验证失败,未找到预期的文件、日期、版本或描述信息。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "正在卸载texlive-ltxfileinfo软件包..."
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败。"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复。"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试文件描述文本打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo软件包"
|
||||
if dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,脚本结束后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的文件描述文本打印功能
|
||||
LOG_INFO "测试ltxfileinfo命令的文件描述文本打印功能"
|
||||
ltxfileinfo --help | grep "description" &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持--help参数"
|
||||
|
||||
# 清理环境(如果脚本开始时未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,71 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试文件完整路径打印功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试文件完整路径打印功能"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo软件包
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试完成后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试完成后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-ltxfileinfo软件包(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的参数支持情况
|
||||
LOG_INFO "测试ltxfileinfo命令的参数支持情况"
|
||||
ltxfileinfo --help &>/dev/null
|
||||
CHECK_RESULT $? 0 255 "ltxfileinfo命令不支持--help参数"
|
||||
|
||||
# 测试文件完整路径打印功能
|
||||
LOG_INFO "测试文件完整路径打印功能"
|
||||
TEST_FILE="/usr/share/texlive/texmf-dist/tex/latex/base/article.cls"
|
||||
ltxfileinfo "$TEST_FILE" | grep -q "File: $TEST_FILE"
|
||||
CHECK_RESULT $? 0 0 "文件完整路径打印功能测试失败"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试文件完整路径打印功能完成"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,71 +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-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试标记格式错误数据(使用星号)
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试标记格式错误数据(使用星号)"
|
||||
|
||||
# 检查yum源中是否存在texlive-ltxfileinfo包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
installed=true
|
||||
LOG_INFO "texlive-ltxfileinfo已安装"
|
||||
else
|
||||
installed=false
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将进行安装"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的参数支持情况
|
||||
LOG_INFO "测试ltxfileinfo命令的参数支持情况"
|
||||
ltxfileinfo --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "ltxfileinfo命令不支持--help参数"
|
||||
|
||||
# 测试标记格式错误数据(使用星号)
|
||||
LOG_INFO "测试标记格式错误数据(使用星号)"
|
||||
ltxfileinfo "*" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 1 0 "ltxfileinfo命令未能正确处理标记格式错误数据"
|
||||
|
||||
# 清理环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,104 +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 : 测试ltxfileinfo命令的-c选项,应用红色(ANSI着色)标记格式错误的数据
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-ltxfileinfo包
|
||||
LOG_INFO "检查texlive-ltxfileinfo包是否已安装"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo包已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo包未安装,将在测试过程中安装并在结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 若未安装,则安装texlive-ltxfileinfo包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo包"
|
||||
dnf install -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo包失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
command -v ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 检查ltxfileinfo命令是否支持-c选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-c选项"
|
||||
ltxfileinfo --help 2>&1 | grep -q "\-c"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-c选项"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试文件,包含格式错误的数据
|
||||
LOG_INFO "创建测试文件test.tex,包含格式错误的数据"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, World!
|
||||
\errorcommand{test}
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo命令的-c选项,应用红色标记格式错误的数据
|
||||
LOG_INFO "测试ltxfileinfo命令的-c选项,应用红色标记格式错误的数据"
|
||||
output=$(ltxfileinfo -c test.tex 2>&1)
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令执行失败"
|
||||
echo "$output" | grep -q "errorcommand"
|
||||
CHECK_RESULT $? 0 0 "未检测到格式错误的数据"
|
||||
|
||||
# 检查输出中是否包含ANSI红色标记(以\033[31m开头)
|
||||
LOG_INFO "检查输出中是否包含ANSI红色标记"
|
||||
if echo "$output" | grep -q $"\033\[31m"; then
|
||||
LOG_INFO "输出中包含ANSI红色标记"
|
||||
else
|
||||
LOG_ERROR "输出中未包含ANSI红色标记"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.tex
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 若测试前未安装,则卸载texlive-ltxfileinfo包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo包"
|
||||
dnf remove -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,88 +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 : 测试ltxfileinfo命令的--color选项,应用红色(ANSI着色)标记格式错误的数据
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断是否已经安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo软件包"
|
||||
if dnf list installed texlive-ltxfileinfo &> /dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,测试过程中将安装并最终卸载"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ ${INSTALLED_BEFORE} -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
which ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 检查ltxfileinfo命令是否支持--color选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持--color选项"
|
||||
ltxfileinfo --help 2>&1 | grep -q "\-\-color"
|
||||
CHECK_RESULT $? 0 255 "ltxfileinfo命令不支持--color选项"
|
||||
|
||||
# 创建一个包含格式错误的LaTeX文件用于测试
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
cat > test_error.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\section{Test}
|
||||
This is a test file with a missing closing brace: {
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo命令的--color选项
|
||||
LOG_INFO "测试ltxfileinfo命令的--color选项,应用红色标记格式错误的数据"
|
||||
ltxfileinfo --color test_error.tex 2>&1 | grep -q -E "\x1b\[31m|\x1b\[0;31m"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令的--color选项未应用红色标记格式错误数据"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_error.tex
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ ${INSTALLED_BEFORE} -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,89 +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 : 测试ltxfileinfo命令的-d选项,应仅打印文件的日期
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试过程中安装并在结束时卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 创建测试用的LaTeX文件
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
TEST_FILE="test.tex"
|
||||
cat > $TEST_FILE << EOF
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Test document.
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo命令的-d选项,应仅打印文件的日期
|
||||
LOG_INFO "测试ltxfileinfo命令的-d选项,应仅打印文件的日期"
|
||||
OUTPUT=$(ltxfileinfo -d $TEST_FILE 2>&1)
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令执行失败"
|
||||
|
||||
# 验证输出是否仅包含日期信息
|
||||
LOG_INFO "验证输出是否仅包含日期信息"
|
||||
if echo "$OUTPUT" | grep -qE "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"; then
|
||||
LOG_INFO "输出符合预期,仅包含日期信息"
|
||||
else
|
||||
LOG_ERROR "输出不符合预期,输出内容为:$OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f $TEST_FILE
|
||||
CHECK_RESULT $? 0 0 "删除测试文件失败"
|
||||
|
||||
# 如果脚本开始时未安装,则在结束时卸载软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试ltxfileinfo命令组合使用-d和-l选项,应打印文件的日期和完整路径
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 设置环境变量
|
||||
PACKAGE_NAME="texlive-ltxfileinfo"
|
||||
COMMAND="ltxfileinfo"
|
||||
OPTIONS="-d -l"
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
LOG_INFO "检查yum源中是否存在软件包 ${PACKAGE_NAME}"
|
||||
dnf list available ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查命令参数是否支持
|
||||
LOG_INFO "检查命令参数是否支持"
|
||||
${COMMAND} --help 2>&1 | grep -q -- "-d" && ${COMMAND} --help 2>&1 | grep -q -- "-l"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令参数 -d 或 -l 不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装软件包
|
||||
LOG_INFO "检查是否已安装软件包 ${PACKAGE_NAME}"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,测试结束后保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "软件包未安装,开始安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "安装软件包 ${PACKAGE_NAME}"
|
||||
dnf install -y ${PACKAGE_NAME} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试步骤:创建测试文件
|
||||
LOG_INFO "创建测试文件"
|
||||
TEST_FILE="/tmp/test_ltxfileinfo.tex"
|
||||
echo "\documentclass{article}\begin{document}test\end{document}" > ${TEST_FILE}
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试步骤:执行ltxfileinfo命令组合使用-d和-l选项
|
||||
LOG_INFO "执行命令: ${COMMAND} ${OPTIONS} ${TEST_FILE}"
|
||||
${COMMAND} ${OPTIONS} ${TEST_FILE} > /tmp/ltxfileinfo_output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行命令失败"
|
||||
|
||||
# 验证输出结果:应打印文件的日期和完整路径
|
||||
LOG_INFO "验证输出结果"
|
||||
grep -q "Date:" /tmp/ltxfileinfo_output.txt && grep -q "File:" /tmp/ltxfileinfo_output.txt
|
||||
CHECK_RESULT $? 0 0 "输出结果不符合预期,未打印文件的日期和完整路径"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f ${TEST_FILE} /tmp/ltxfileinfo_output.txt
|
||||
CHECK_RESULT $? 0 0 "清理临时文件失败"
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "卸载软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试ltxfileinfo命令组合使用-d、-v、-i选项,应依次打印文件的日期、版本和描述文本
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试ltxfileinfo命令组合使用-d、-v、-i选项
|
||||
LOG_INFO "开始测试ltxfileinfo命令组合使用-d、-v、-i选项"
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中没有找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo"
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试结束后保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试前安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 创建测试用的LaTeX文件
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
TEST_FILE="test_ltxfileinfo.tex"
|
||||
cat > "$TEST_FILE" << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
This is a test file for ltxfileinfo.
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 将LaTeX文件编译为DVI格式
|
||||
LOG_INFO "将LaTeX文件编译为DVI格式"
|
||||
latex "$TEST_FILE" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "编译LaTeX文件失败"
|
||||
|
||||
# 获取生成的DVI文件名
|
||||
DVI_FILE="${TEST_FILE%.tex}.dvi"
|
||||
|
||||
# 检查ltxfileinfo命令是否支持-d选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-d选项"
|
||||
if ! ltxfileinfo --help 2>&1 | grep -q -- "-d"; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-d选项"
|
||||
# 清理测试文件
|
||||
rm -f "$TEST_FILE" "${TEST_FILE%.tex}".*
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否支持-v选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-v选项"
|
||||
if ! ltxfileinfo --help 2>&1 | grep -q -- "-v"; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-v选项"
|
||||
# 清理测试文件
|
||||
rm -f "$TEST_FILE" "${TEST_FILE%.tex}".*
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否支持-i选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-i选项"
|
||||
if ! ltxfileinfo --help 2>&1 | grep -q -- "-i"; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-i选项"
|
||||
# 清理测试文件
|
||||
rm -f "$TEST_FILE" "${TEST_FILE%.tex}".*
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令组合使用-d、-v、-i选项
|
||||
LOG_INFO "测试ltxfileinfo命令组合使用-d、-v、-i选项"
|
||||
ltxfileinfo -d -v -i "$DVI_FILE" > output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo命令失败"
|
||||
|
||||
# 检查输出结果
|
||||
LOG_INFO "检查输出结果"
|
||||
# 检查是否包含日期信息
|
||||
if ! grep -q "date\|日期\|Date" output.txt; then
|
||||
LOG_ERROR "输出中未找到日期信息"
|
||||
rm -f "$TEST_FILE" "${TEST_FILE%.tex}".* output.txt
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查是否包含版本信息
|
||||
if ! grep -q "version\|版本\|Version" output.txt; then
|
||||
LOG_ERROR "输出中未找到版本信息"
|
||||
rm -f "$TEST_FILE" "${TEST_FILE%.tex}".* output.txt
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查是否包含描述文本
|
||||
if ! grep -q "description\|描述\|Description" output.txt; then
|
||||
LOG_ERROR "输出中未找到描述文本"
|
||||
rm -f "$TEST_FILE" "${TEST_FILE%.tex}".* output.txt
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "ltxfileinfo命令组合使用-d、-v、-i选项测试通过"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f "$TEST_FILE" "${TEST_FILE%.tex}".* output.txt
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,87 +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 : 测试ltxfileinfo命令的--date选项,应仅打印文件的日期
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
installed=$?
|
||||
|
||||
# 如果未安装,则进行安装
|
||||
if [ $installed -ne 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,开始安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
LOG_INFO "安装texlive-ltxfileinfo成功"
|
||||
fi
|
||||
|
||||
# 创建测试用的LaTeX文件
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, World!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo命令的--date选项
|
||||
LOG_INFO "测试ltxfileinfo命令的--date选项"
|
||||
# 首先检查--date参数是否支持
|
||||
ltxfileinfo --date test.tex 2>&1 | grep -q "unrecognized option"
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--date选项"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行命令并检查结果
|
||||
output=$(ltxfileinfo --date test.tex 2>&1)
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo --date命令失败"
|
||||
|
||||
# 验证输出仅包含日期信息
|
||||
# 预期输出格式为:YYYY-MM-DD HH:MM:SS
|
||||
echo "$output" | grep -qE "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$"
|
||||
CHECK_RESULT $? 0 0 "输出不符合日期格式"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.tex
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果脚本开始时未安装,则卸载软件包
|
||||
if [ $installed -ne 0 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
LOG_INFO "卸载texlive-ltxfileinfo成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,104 +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 : 测试ltxfileinfo命令的-f选项,应以单行四个制表符分隔的字段输出文件、日期、版本和信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试ltxfileinfo命令的-f选项功能"
|
||||
LOG_INFO "步骤1:检查环境中是否已安装texlive-ltxfileinfo软件包"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试前安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查ltxfileinfo命令是否存在"
|
||||
which ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
LOG_INFO "步骤5:检查ltxfileinfo命令是否支持-f选项"
|
||||
ltxfileinfo --help 2>&1 | grep -q "\-f"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持-f选项"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-f选项"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:创建一个简单的LaTeX测试文件"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, world!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
LOG_INFO "步骤7:执行ltxfileinfo -f命令测试"
|
||||
output=$(ltxfileinfo -f test.tex 2>&1)
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo -f命令执行失败"
|
||||
|
||||
LOG_INFO "步骤8:验证输出格式是否符合预期"
|
||||
line_count=$(echo "$output" | wc -l)
|
||||
if [ "$line_count" -eq 1 ]; then
|
||||
field_count=$(echo "$output" | tr "\t" "\n" | wc -l)
|
||||
if [ "$field_count" -eq 4 ]; then
|
||||
LOG_INFO "输出格式正确:单行四个制表符分隔的字段"
|
||||
else
|
||||
LOG_ERROR "输出字段数量不正确"
|
||||
CHECK_RESULT 1 0 0 "输出格式验证失败"
|
||||
fi
|
||||
else
|
||||
LOG_ERROR "输出行数不正确"
|
||||
CHECK_RESULT 1 0 0 "输出格式验证失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤9:清理测试文件"
|
||||
rm -f test.tex
|
||||
CHECK_RESULT $? 0 0 "删除测试文件失败"
|
||||
|
||||
LOG_INFO "步骤10:环境恢复"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载测试安装的texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "保持原安装状态,不卸载texlive-ltxfileinfo"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,108 +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 : 测试ltxfileinfo命令组合使用-f和-c选项,应以单行格式输出并对格式错误的数据进行红色标记
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已经安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查texlive-ltxfileinfo软件包是否已安装"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
pkg_installed=$?
|
||||
|
||||
# 如果未安装,则尝试从yum源安装
|
||||
if [ $pkg_installed -ne 0 ]; then
|
||||
LOG_INFO "软件包未安装,尝试从yum源查找"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
|
||||
# 设置标记,表示测试过程中安装了软件包
|
||||
installed_during_test=1
|
||||
else
|
||||
LOG_INFO "软件包已安装,测试完成后将保持安装状态"
|
||||
installed_during_test=0
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令组合使用-f和-c选项
|
||||
LOG_INFO "测试ltxfileinfo命令组合使用-f和-c选项"
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
which ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 检查-f和-c选项是否支持
|
||||
LOG_INFO "检查-f和-c选项是否支持"
|
||||
ltxfileinfo --help 2>&1 | grep -q "\-f"
|
||||
CHECK_RESULT $? 0 255 "ltxfileinfo命令不支持-f选项"
|
||||
|
||||
ltxfileinfo --help 2>&1 | grep -q "\-c"
|
||||
CHECK_RESULT $? 0 255 "ltxfileinfo命令不支持-c选项"
|
||||
|
||||
# 创建测试文件
|
||||
LOG_INFO "创建测试文件"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello World!
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# 创建格式错误的数据文件
|
||||
LOG_INFO "创建格式错误的数据文件"
|
||||
cat > bad_data.tex << "EOF"
|
||||
错误的数据格式
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# 测试正常文件
|
||||
LOG_INFO "测试正常文件,使用-f和-c选项"
|
||||
ltxfileinfo -f -c test.tex > output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令执行失败"
|
||||
|
||||
# 验证输出格式
|
||||
LOG_INFO "验证输出格式是否为单行格式"
|
||||
line_count=$(wc -l < output.txt)
|
||||
CHECK_RESULT $line_count 1 0 "输出不是单行格式"
|
||||
|
||||
# 测试格式错误的数据
|
||||
LOG_INFO "测试格式错误的数据文件"
|
||||
ltxfileinfo -f -c bad_data.tex 2>&1 | grep -q "错误\|error\|Error"
|
||||
CHECK_RESULT $? 0 0 "格式错误的数据未正确标记"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.tex bad_data.tex output.txt
|
||||
|
||||
# 环境恢复
|
||||
LOG_INFO "恢复测试环境"
|
||||
if [ $installed_during_test -eq 1 ]; then
|
||||
LOG_INFO "卸载测试过程中安装的软件包"
|
||||
dnf remove -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,115 +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 : 测试ltxfileinfo命令组合使用-f和-s选项,应以单行格式输出并对格式错误的数据标记星号
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义测试软件包名称
|
||||
PACKAGE_NAME="texlive-ltxfileinfo"
|
||||
|
||||
# 检查yum源中是否存在指定软件包
|
||||
LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包..."
|
||||
dnf list available "${PACKAGE_NAME}" &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查环境是否已安装软件包
|
||||
LOG_INFO "检查环境是否已安装${PACKAGE_NAME}软件包..."
|
||||
rpm -q "${PACKAGE_NAME}" &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "环境已安装${PACKAGE_NAME}软件包,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "环境未安装${PACKAGE_NAME}软件包,测试前将安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "${INSTALLED_BEFORE_TEST}" = "false" ]; then
|
||||
LOG_INFO "安装${PACKAGE_NAME}软件包..."
|
||||
dnf install -y "${PACKAGE_NAME}"
|
||||
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败"
|
||||
fi
|
||||
|
||||
# 验证ltxfileinfo命令是否存在
|
||||
LOG_INFO "验证ltxfileinfo命令是否存在..."
|
||||
which ltxfileinfo &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 验证-f和-s参数是否支持
|
||||
LOG_INFO "验证-f和-s参数是否支持..."
|
||||
ltxfileinfo --help 2>&1 | grep -q -- "-f"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo不支持-f参数"
|
||||
ltxfileinfo --help 2>&1 | grep -q -- "-s"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo不支持-s参数"
|
||||
|
||||
# 创建测试文件
|
||||
LOG_INFO "创建测试文件..."
|
||||
TEST_FILE="test_ltxfileinfo.tex"
|
||||
cat > "${TEST_FILE}" << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello World!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo命令组合使用-f和-s选项
|
||||
LOG_INFO "测试ltxfileinfo命令组合使用-f和-s选项..."
|
||||
ltxfileinfo -f -s "${TEST_FILE}" > output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo -f -s命令失败"
|
||||
|
||||
# 检查输出是否为单行格式
|
||||
LOG_INFO "检查输出是否为单行格式..."
|
||||
LINE_COUNT=$(wc -l < output.txt)
|
||||
CHECK_RESULT ${LINE_COUNT} 1 0 "输出不是单行格式"
|
||||
|
||||
# 创建格式错误的测试文件
|
||||
LOG_INFO "创建格式错误的测试文件..."
|
||||
BAD_TEST_FILE="bad_test_ltxfileinfo.tex"
|
||||
cat > "${BAD_TEST_FILE}" << "EOF"
|
||||
错误的内容
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建格式错误的测试文件失败"
|
||||
|
||||
# 测试格式错误的数据是否标记星号
|
||||
LOG_INFO "测试格式错误的数据是否标记星号..."
|
||||
ltxfileinfo -f -s "${BAD_TEST_FILE}" 2>&1 | grep -q "*"
|
||||
CHECK_RESULT $? 0 0 "格式错误的数据未标记星号"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件..."
|
||||
rm -f "${TEST_FILE}" "${BAD_TEST_FILE}" output.txt
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 恢复环境:如果测试前未安装,则卸载软件包
|
||||
if [ "${INSTALLED_BEFORE_TEST}" = "false" ]; then
|
||||
LOG_INFO "卸载${PACKAGE_NAME}软件包..."
|
||||
dnf remove -y "${PACKAGE_NAME}"
|
||||
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装${PACKAGE_NAME}软件包,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,111 +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 : 测试ltxfileinfo命令的--flat选项,应以单行四个制表符分隔的字段输出文件、日期、版本和信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查当前环境是否已安装texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查texlive-ltxfileinfo软件包是否已安装"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo软件包未安装,将在测试结束后卸载"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
dnf list texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo软件包失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
command -v ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 检查ltxfileinfo命令是否支持--flat选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持--flat选项"
|
||||
ltxfileinfo --help | grep -q -- "--flat"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--flat选项"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建一个简单的LaTeX文件用于测试
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, World!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo命令的--flat选项
|
||||
LOG_INFO "测试ltxfileinfo命令的--flat选项"
|
||||
ltxfileinfo --flat test.tex > output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo --flat命令失败"
|
||||
|
||||
# 检查输出格式是否符合预期:单行四个制表符分隔的字段
|
||||
LOG_INFO "检查输出格式是否符合预期"
|
||||
LINE_COUNT=$(wc -l < output.txt)
|
||||
if [ "$LINE_COUNT" -eq 1 ]; then
|
||||
LOG_INFO "输出为单行,符合预期"
|
||||
else
|
||||
LOG_ERROR "输出不是单行,不符合预期"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查字段数量是否为4个
|
||||
FIELD_COUNT=$(awk -F"\t" "{print NF}" output.txt)
|
||||
if [ "$FIELD_COUNT" -eq 4 ]; then
|
||||
LOG_INFO "输出包含四个制表符分隔的字段,符合预期"
|
||||
else
|
||||
LOG_ERROR "输出字段数量不是4个,不符合预期"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.tex output.txt
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试ltxfileinfo命令的-h选项,应打印帮助信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-ltxfileinfo"
|
||||
|
||||
# 步骤1: 检查是否已安装软件包
|
||||
LOG_INFO "步骤1: 检查是否已安装软件包"
|
||||
rpm -q $PACKAGE_NAME
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试过程中安装并在结束后卸载"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
# 步骤2: 检查yum源中是否有该软件包
|
||||
LOG_INFO "步骤2: 检查yum源中是否有软件包 $PACKAGE_NAME"
|
||||
dnf list available $PACKAGE_NAME > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3: 如果未安装,则安装软件包
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "步骤3: 安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4: 检查ltxfileinfo命令的-h选项是否存在
|
||||
LOG_INFO "步骤4: 检查ltxfileinfo命令的-h选项"
|
||||
ltxfileinfo -h > /dev/null 2>&1
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-h选项"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5: 执行ltxfileinfo -h命令并检查是否打印帮助信息
|
||||
LOG_INFO "步骤5: 执行ltxfileinfo -h命令并检查帮助信息"
|
||||
ltxfileinfo -h 2>&1 | grep -q "Usage\|用法"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo -h未打印帮助信息"
|
||||
|
||||
# 步骤6: 清理环境
|
||||
LOG_INFO "步骤6: 清理环境"
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
LOG_INFO "已卸载测试安装的软件包"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,75 +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 : 测试ltxfileinfo命令的--help选项,应打印帮助信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断当前环境是否已安装texlive-ltxfileinfo包
|
||||
LOG_INFO "检查texlive-ltxfileinfo包是否已安装"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
INSTALLED=$?
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo包已安装,测试后将保持安装状态"
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo包未安装,将在测试前安装"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在该软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -ne 0 ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo包失败"
|
||||
fi
|
||||
|
||||
# 测试ltxfileinfo命令的--help选项
|
||||
LOG_INFO "测试ltxfileinfo命令的--help选项"
|
||||
ltxfileinfo --help > /tmp/ltxfileinfo_help_output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo --help命令失败"
|
||||
|
||||
# 检查输出是否包含帮助信息
|
||||
LOG_INFO "检查ltxfileinfo --help输出是否包含帮助信息"
|
||||
grep -i "usage\|help\|选项" /tmp/ltxfileinfo_help_output.txt > /dev/null
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo --help未打印帮助信息"
|
||||
|
||||
LOG_INFO "ltxfileinfo --help选项测试通过"
|
||||
|
||||
# 清理临时文件
|
||||
rm -f /tmp/ltxfileinfo_help_output.txt
|
||||
|
||||
# 环境恢复:如果测试前未安装,则卸载软件包
|
||||
if [ $INSTALLED -ne 0 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo包失败"
|
||||
LOG_INFO "环境已恢复到测试前状态"
|
||||
else
|
||||
LOG_INFO "保持texlive-ltxfileinfo包安装状态"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,90 +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 : 测试ltxfileinfo命令的-i选项,应仅打印文件的描述文本
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试ltxfileinfo命令的-i选项功能"
|
||||
LOG_INFO "检查texlive-ltxfileinfo软件包是否已安装"
|
||||
if rpm -q texlive-ltxfileinfo > /dev/null 2>&1; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试结束后将保持安装状态"
|
||||
already_installed=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,测试前将安装该软件包"
|
||||
already_installed=0
|
||||
fi
|
||||
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Test document for ltxfileinfo -i option.
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-i参数"
|
||||
ltxfileinfo --help 2>&1 | grep -q -- "-i"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-i参数"
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "执行ltxfileinfo -i test.tex命令"
|
||||
output=$(ltxfileinfo -i test.tex 2>&1)
|
||||
ret=$?
|
||||
CHECK_RESULT $ret 0 0 "ltxfileinfo -i命令执行失败"
|
||||
|
||||
LOG_INFO "验证输出应仅包含文件描述文本"
|
||||
if echo "$output" | grep -q "LaTeX2e"; then
|
||||
LOG_INFO "输出正确包含文件描述"
|
||||
else
|
||||
LOG_ERROR "输出不符合预期,未找到文件描述文本"
|
||||
CHECK_RESULT 1 0 0 "输出验证失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.tex
|
||||
CHECK_RESULT $? 0 0 "删除测试文件失败"
|
||||
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,84 +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 : 测试ltxfileinfo命令的--info选项,应仅打印文件的描述文本
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试ltxfileinfo命令的--info选项功能"
|
||||
LOG_INFO "步骤1:检查texlive-ltxfileinfo软件包是否在yum源中"
|
||||
dnf list available texlive-ltxfileinfo &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查是否已安装texlive-ltxfileinfo"
|
||||
rpm -q texlive-ltxfileinfo &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,跳过安装步骤"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,开始安装"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:验证ltxfileinfo命令的--info选项"
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
cat > testfile.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
This is a test file.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
LOG_INFO "执行ltxfileinfo --info testfile.tex"
|
||||
ltxfileinfo --info testfile.tex &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--info选项或选项不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查--info选项是否仅打印文件的描述文本"
|
||||
output=$(ltxfileinfo --info testfile.tex 2>&1)
|
||||
if echo "$output" | grep -q "This is a test file"; then
|
||||
LOG_INFO "--info选项正确打印了文件的描述文本"
|
||||
CHECK_RESULT 0 0 0 "描述文本打印不符合预期"
|
||||
else
|
||||
LOG_ERROR "--info选项未能正确打印文件的描述文本"
|
||||
CHECK_RESULT 1 0 0 "描述文本打印不符合预期"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:清理临时测试文件"
|
||||
rm -f testfile.tex
|
||||
|
||||
LOG_INFO "步骤6:环境恢复"
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "保持texlive-ltxfileinfo安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,146 +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 : 测试ltxfileinfo命令的-l选项,应打印文件的完整路径
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $*" >&2
|
||||
}
|
||||
|
||||
# 定义检查函数
|
||||
CHECK_RESULT() {
|
||||
local actual=$1
|
||||
local expected=$2
|
||||
local exit_code=$3
|
||||
local msg=$4
|
||||
|
||||
if [ "$actual" -ne "$expected" ]; then
|
||||
LOG_ERROR "$msg"
|
||||
exit $exit_code
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义SSH命令函数(示例,实际使用时可能已有定义)
|
||||
SSH_CMD() {
|
||||
local cmd=$1
|
||||
local node_ip=$2
|
||||
local node_password=$3
|
||||
local node_user=$4
|
||||
|
||||
# 这里只是示例,实际应根据环境实现
|
||||
sshpass -p "$node_password" ssh -o StrictHostKeyChecking=no "${node_user}@${node_ip}" "$cmd"
|
||||
}
|
||||
|
||||
# 测试脚本开始
|
||||
LOG_INFO "开始测试ltxfileinfo命令的-l选项"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查texlive-ltxfileinfo是否已安装"
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试完成后将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试前安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 255 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
if ! command -v ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "ltxfileinfo命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查-l选项是否支持
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-l选项"
|
||||
if ! ltxfileinfo --help 2>&1 | grep -q -- "-l"; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-l选项"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试用的LaTeX文件
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
TEST_FILE="/tmp/test_ltxfileinfo.tex"
|
||||
cat > "$TEST_FILE" << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, world!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 1 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo -l命令
|
||||
LOG_INFO "执行ltxfileinfo -l命令"
|
||||
output=$(ltxfileinfo -l "$TEST_FILE" 2>&1)
|
||||
exit_code=$?
|
||||
|
||||
# 检查命令执行是否成功
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo -l命令执行失败,退出码: $exit_code"
|
||||
exit $exit_code
|
||||
fi
|
||||
|
||||
# 检查输出是否包含文件完整路径
|
||||
LOG_INFO "检查输出是否包含文件完整路径"
|
||||
if echo "$output" | grep -q "$TEST_FILE"; then
|
||||
LOG_INFO "测试通过:ltxfileinfo -l正确打印了文件的完整路径"
|
||||
else
|
||||
LOG_ERROR "测试失败:ltxfileinfo -l未打印文件的完整路径"
|
||||
LOG_ERROR "命令输出:$output"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f "$TEST_FILE"
|
||||
CHECK_RESULT $? 0 1 "删除测试文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 1 "卸载texlive-ltxfileinfo失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装texlive-ltxfileinfo,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,82 +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 : 测试ltxfileinfo命令的--location选项,应打印文件的完整路径
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试ltxfileinfo命令的--location选项功能"
|
||||
LOG_INFO "步骤1:检查系统中是否已安装texlive-ltxfileinfo软件包"
|
||||
if dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo软件包已安装,测试结束后将保持安装状态"
|
||||
already_installed=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo软件包未安装,将在测试过程中安装"
|
||||
already_installed=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包,无法继续测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证ltxfileinfo命令是否支持--location参数"
|
||||
ltxfileinfo --help 2>&1 | grep -q "\-\-location"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持--location参数" 255
|
||||
|
||||
LOG_INFO "步骤5:创建一个简单的LaTeX文件用于测试"
|
||||
test_file="test_document.tex"
|
||||
cat > $test_file << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, world!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文件失败"
|
||||
|
||||
LOG_INFO "步骤6:执行ltxfileinfo --location命令测试"
|
||||
ltxfileinfo --location $test_file > output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo --location命令失败"
|
||||
|
||||
LOG_INFO "步骤7:验证输出结果包含文件完整路径"
|
||||
expected_path=$(realpath $test_file)
|
||||
grep -q "$expected_path" output.txt
|
||||
CHECK_RESULT $? 0 0 "输出结果未包含文件的完整路径"
|
||||
|
||||
LOG_INFO "步骤8:清理测试文件"
|
||||
rm -f $test_file output.txt
|
||||
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "步骤9:卸载测试安装的texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo软件包失败"
|
||||
else
|
||||
LOG_INFO "测试完成,保持texlive-ltxfileinfo软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,108 +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 : 测试ltxfileinfo命令的-s选项,应用星号标记格式错误的数据
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试ltxfileinfo命令的-s选项,应用星号标记格式错误的数据"
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查系统是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查系统是否已安装texlive-ltxfileinfo"
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试结束后保持安装状态"
|
||||
installed_before_test=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试过程中安装"
|
||||
installed_before_test=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed_before_test" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
command -v ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 检查ltxfileinfo命令是否支持-s选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-s选项"
|
||||
ltxfileinfo --help 2>&1 | grep -q -- "-s"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持-s选项"
|
||||
|
||||
# 创建测试用的LaTeX文件
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, world!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo -s命令
|
||||
LOG_INFO "执行ltxfileinfo -s test.tex命令"
|
||||
ltxfileinfo -s test.tex
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo -s命令执行失败"
|
||||
|
||||
# 创建格式错误的LaTeX文件
|
||||
LOG_INFO "创建格式错误的LaTeX文件"
|
||||
cat > error.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Missing closing brace {
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建错误测试文件失败"
|
||||
|
||||
# 测试ltxfileinfo -s命令对格式错误的文件
|
||||
LOG_INFO "执行ltxfileinfo -s error.tex命令,检查是否用星号标记错误"
|
||||
output=$(ltxfileinfo -s error.tex 2>&1)
|
||||
echo "$output" | grep -q "*"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo -s未用星号标记格式错误"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.tex error.tex
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$installed_before_test" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
LOG_INFO "测试环境已恢复"
|
||||
else
|
||||
LOG_INFO "测试完成,保持texlive-ltxfileinfo安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,91 +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 : 测试ltxfileinfo命令的--star选项,应用星号标记格式错误的数据
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断是否已安装texlive-ltxfileinfo
|
||||
LOG_INFO "检查是否已安装texlive-ltxfileinfo软件包"
|
||||
if dnf list installed texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将在测试中安装并在结束时卸载"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
if ! command -v ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "ltxfileinfo命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否支持--star选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持--star选项"
|
||||
if ! ltxfileinfo --help 2>&1 | grep -q -- "--star"; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--star选项"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试文件,包含格式错误的数据
|
||||
LOG_INFO "创建包含格式错误数据的测试文件"
|
||||
cat > test_error.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\section{Test Section}
|
||||
This is a test document with \incorrect{command}.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# 使用ltxfileinfo的--star选项测试格式错误的数据
|
||||
LOG_INFO "执行ltxfileinfo --star命令测试格式错误的数据"
|
||||
ltxfileinfo --star test_error.tex
|
||||
# 由于格式错误,命令预期会失败,检查退出码非0
|
||||
CHECK_RESULT $? 0 1 "ltxfileinfo --star命令未按预期处理格式错误数据"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_error.tex
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,119 +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 : 测试ltxfileinfo命令的-D选项,应保留临时文件用于调试
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 设置环境变量
|
||||
SCRIPT_DIR=$(cd $(dirname $0); pwd)
|
||||
LOG_FILE="${SCRIPT_DIR}/test_texlive-ltxfileinfo_ltxfileinfo_upper_d.log"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-ltxfileinfo"
|
||||
|
||||
# 检查软件包是否已在yum源中
|
||||
LOG_INFO "检查yum源中是否存在软件包${PACKAGE_NAME}"
|
||||
dnf list available ${PACKAGE_NAME} > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在软件包${PACKAGE_NAME}"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查当前环境是否已安装软件包
|
||||
LOG_INFO "检查当前环境是否已安装软件包${PACKAGE_NAME}"
|
||||
rpm -q ${PACKAGE_NAME} > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包${PACKAGE_NAME}已安装"
|
||||
INSTALLED_BEFORE_TEST=1
|
||||
else
|
||||
LOG_INFO "软件包${PACKAGE_NAME}未安装"
|
||||
INSTALLED_BEFORE_TEST=0
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then
|
||||
LOG_INFO "安装软件包${PACKAGE_NAME}"
|
||||
dnf install -y ${PACKAGE_NAME} > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装软件包${PACKAGE_NAME}失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
which ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 检查ltxfileinfo命令是否支持-D选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-D选项"
|
||||
ltxfileinfo -D --help > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-D选项"
|
||||
# 清理环境
|
||||
if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then
|
||||
LOG_INFO "卸载软件包${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME} > /dev/null 2>&1
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建一个简单的LaTeX文件用于测试
|
||||
LOG_INFO "创建测试用的LaTeX文件"
|
||||
TEST_LATEX_FILE="${SCRIPT_DIR}/test_document.tex"
|
||||
cat > ${TEST_LATEX_FILE} << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, World!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文件失败"
|
||||
|
||||
# 测试ltxfileinfo命令的-D选项
|
||||
LOG_INFO "测试ltxfileinfo命令的-D选项"
|
||||
ltxfileinfo -D ${TEST_LATEX_FILE} > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo -D命令执行失败"
|
||||
|
||||
# 检查是否生成了临时文件
|
||||
LOG_INFO "检查是否生成了临时文件"
|
||||
TEMP_FILES=$(find /tmp -name "ltxfileinfo*" -type f 2>/dev/null | head -5)
|
||||
if [ -n "${TEMP_FILES}" ]; then
|
||||
LOG_INFO "临时文件已生成,可用于调试:"
|
||||
for file in ${TEMP_FILES}; do
|
||||
LOG_INFO " ${file}"
|
||||
done
|
||||
else
|
||||
LOG_INFO "未发现临时文件"
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f ${TEST_LATEX_FILE}
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 恢复环境:如果测试前未安装,则卸载软件包
|
||||
if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then
|
||||
LOG_INFO "卸载软件包${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME} > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载软件包${PACKAGE_NAME}失败"
|
||||
else
|
||||
LOG_INFO "保持软件包${PACKAGE_NAME}的安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,101 +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 : 测试ltxfileinfo命令的-v选项,应仅打印文件的版本
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试ltxfileinfo命令的-v选项"
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
LOG_INFO "检查yum源中是否存在texlive-ltxfileinfo软件包"
|
||||
if ! dnf list available texlive-ltxfileinfo &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在texlive-ltxfileinfo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 判断是否已经安装
|
||||
LOG_INFO "检查是否已经安装texlive-ltxfileinfo"
|
||||
if rpm -q texlive-ltxfileinfo &>/dev/null; then
|
||||
INSTALLED=true
|
||||
LOG_INFO "texlive-ltxfileinfo已安装,测试后保持安装状态"
|
||||
else
|
||||
INSTALLED=false
|
||||
LOG_INFO "texlive-ltxfileinfo未安装,将进行安装测试"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo软件包"
|
||||
dnf install -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否存在
|
||||
LOG_INFO "检查ltxfileinfo命令是否存在"
|
||||
command -v ltxfileinfo &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不存在"
|
||||
|
||||
# 检查-v选项是否支持
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-v选项"
|
||||
ltxfileinfo --help 2>&1 | grep -q -- "-v"
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持-v选项"
|
||||
|
||||
# 创建一个简单的LaTeX文件用于测试
|
||||
LOG_INFO "创建一个测试用的LaTeX文件"
|
||||
TEST_FILE="test_ltxfileinfo.tex"
|
||||
cat > "$TEST_FILE" << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Hello, World!
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试文件失败"
|
||||
|
||||
# 测试-v选项
|
||||
LOG_INFO "执行ltxfileinfo -v命令"
|
||||
OUTPUT=$(ltxfileinfo -v "$TEST_FILE" 2>&1)
|
||||
RET=$?
|
||||
CHECK_RESULT $RET 0 0 "ltxfileinfo -v命令执行失败"
|
||||
|
||||
# 检查输出是否仅包含版本信息
|
||||
LOG_INFO "检查输出是否仅包含版本信息"
|
||||
if echo "$OUTPUT" | grep -q -v "^[0-9]\+\.[0-9]\+"; then
|
||||
LOG_ERROR "输出内容不符合预期,应仅包含版本号"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "ltxfileinfo -v选项测试通过"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f "$TEST_FILE"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo软件包"
|
||||
dnf remove -y texlive-ltxfileinfo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo失败"
|
||||
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-02-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试ltxfileinfo命令组合使用-v和--location选项,应打印文件的版本和完整路径
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试ltxfileinfo命令组合使用-v和--location选项,应打印文件的版本和完整路径"
|
||||
|
||||
# 检查是否已安装texlive-ltxfileinfo包
|
||||
LOG_INFO "检查texlive-ltxfileinfo包是否已安装"
|
||||
rpm -q texlive-ltxfileinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-ltxfileinfo包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-ltxfileinfo包未安装,将在测试前安装并在测试后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-ltxfileinfo包
|
||||
LOG_INFO "检查yum源中是否有texlive-ltxfileinfo包"
|
||||
dnf list available texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-ltxfileinfo包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-ltxfileinfo包,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-ltxfileinfo包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-ltxfileinfo包"
|
||||
dnf install -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-ltxfileinfo包失败"
|
||||
fi
|
||||
|
||||
# 检查ltxfileinfo命令是否支持-v和--location选项
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持-v选项"
|
||||
ltxfileinfo -v > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持-v选项"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持-v选项,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "检查ltxfileinfo命令是否支持--location选项"
|
||||
ltxfileinfo --location > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "ltxfileinfo命令不支持--location选项"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "ltxfileinfo命令不支持--location选项,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行ltxfileinfo命令组合使用-v和--location选项
|
||||
LOG_INFO "执行ltxfileinfo命令组合使用-v和--location选项"
|
||||
output=$(ltxfileinfo -v --location 2>&1)
|
||||
CHECK_RESULT $? 0 0 "执行ltxfileinfo命令失败"
|
||||
|
||||
# 检查输出是否包含版本和完整路径信息
|
||||
LOG_INFO "检查输出是否包含版本信息"
|
||||
echo "$output" | grep -q "version"
|
||||
CHECK_RESULT $? 0 0 "输出中未找到版本信息"
|
||||
|
||||
LOG_INFO "检查输出是否包含完整路径信息"
|
||||
echo "$output" | grep -q "/"
|
||||
CHECK_RESULT $? 0 0 "输出中未找到完整路径信息"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载texlive-ltxfileinfo包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-ltxfileinfo包"
|
||||
dnf remove -y texlive-ltxfileinfo > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-ltxfileinfo包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user