Merge branch 'pkg' of http://10.30.190.190:54866/redrsoe2100/os-autotest into pkg
This commit is contained in:
@@ -6,42 +6,6 @@
|
||||
"name": "test_fence-agents-redfish_install_package",
|
||||
"desc": "测试 fence-agents-redfish 软件包的安装功能",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_function_connect",
|
||||
"desc": "测试 fence-agents-redfish 的连接功能"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_uninstall_package",
|
||||
"desc": "测试 fence-agents-redfish 软件包的卸载功能"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_check_installed",
|
||||
"desc": "检查 fence-agents-redfish 软件包是否已正确安装"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_function_list",
|
||||
"desc": "测试 fence-agents-redfish 代理支持的功能列表查询"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_function_on",
|
||||
"desc": "测试 fence-agents-redfish 对节点的开机/上电操作"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_function_off",
|
||||
"desc": "测试 fence-agents-redfish 对节点的关机/下电操作"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_function_reboot",
|
||||
"desc": "测试 fence-agents-redfish 对节点的重启操作"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_function_status",
|
||||
"desc": "测试 fence-agents-redfish 对节点电源状态的查询"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-redfish_function_help",
|
||||
"desc": "测试 fence-agents-redfish 代理的帮助信息输出"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/kronosnet/libknet1-crypto-plugins-all",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_libknet1-crypto-plugins-all_function_init",
|
||||
"desc": "Test plugin initialization"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -14,10 +14,6 @@
|
||||
"name": "test_lighttpd-mod_authn_gssapi_function_uninstall",
|
||||
"desc": "Test package removal"
|
||||
},
|
||||
{
|
||||
"name": "test_lighttpd-mod_authn_gssapi_function_conf",
|
||||
"desc": "Test basic configuration load"
|
||||
},
|
||||
{
|
||||
"name": "test_lighttpd-mod_authn_gssapi_function_service",
|
||||
"desc": "Test service restart with module"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/pcp/pcp-testsuite",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_pcp-testsuite_function_install",
|
||||
"desc": "测试软件包pcp-testsuite能够被正确安装。"
|
||||
},
|
||||
{
|
||||
"name": "test_pcp-testsuite_function_uninstall",
|
||||
"desc": "测试软件包pcp-testsuite能够被正确卸载。"
|
||||
},
|
||||
{
|
||||
"name": "test_pcp-testsuite_function_check_installed",
|
||||
"desc": "测试检查pcp-testsuite软件包是否已安装的功能。"
|
||||
},
|
||||
{
|
||||
"name": "test_pcp-testsuite_function_run_basic_test",
|
||||
"desc": "测试运行pcp-testsuite自带的基础测试用例。"
|
||||
},
|
||||
{
|
||||
"name": "test_pcp-testsuite_function_verify_pcp",
|
||||
"desc": "测试使用pcp-testsuite验证PCP监控框架的基本功能。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/python-PyLaTeX/python3-PyLaTeX",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_python3-PyLaTeX_function_install",
|
||||
"desc": "测试python3-PyLaTeX软件包的安装功能是否正常"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-PyLaTeX_function_import",
|
||||
"desc": "测试能否成功导入PyLaTeX模块"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-PyLaTeX_function_create_doc",
|
||||
"desc": "测试使用PyLaTeX创建基本LaTeX文档对象"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-PyLaTeX_function_add_section",
|
||||
"desc": "测试向文档中添加章节"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-PyLaTeX_function_add_math",
|
||||
"desc": "测试向文档中添加数学公式"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-PyLaTeX_function_generate_pdf",
|
||||
"desc": "测试生成PDF文档"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-PyLaTeX_function_uninstall",
|
||||
"desc": "测试python3-PyLaTeX软件包的卸载功能是否正常"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -9,126 +9,6 @@
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen__g_dest",
|
||||
"desc": "测试 pdfopen 命令的 -g 参数,指定命名的目标视图"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfclose",
|
||||
"desc": "不带任何参数执行pdfclose命令,关闭默认的PDF查看器"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfclose_upper_v",
|
||||
"desc": "使用-V参数执行pdfclose命令,显示版本信息"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfclose_upper_h",
|
||||
"desc": "使用-H参数执行pdfclose命令,显示帮助信息"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_h",
|
||||
"desc": "测试 pdfopen 的 -h 参数,显示帮助信息。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_help",
|
||||
"desc": "测试 pdfopen 的 --help 参数,显示帮助信息。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_special_question",
|
||||
"desc": "测试 pdfopen 的 -? 参数,显示帮助信息。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_upper_v",
|
||||
"desc": "测试 pdfopen 的 -v 参数,显示版本号。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_version",
|
||||
"desc": "测试 pdfopen 的 --version 参数,显示版本号。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_r_file",
|
||||
"desc": "测试 pdfopen 的 -r 参数和文件参数,重置焦点并打开指定PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_reset_focus_file",
|
||||
"desc": "测试 pdfopen 的 --reset_focus 参数和文件参数,重置焦点并打开指定PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_viewer_file",
|
||||
"desc": "测试 pdfopen 的 --viewer 参数和文件参数,使用指定查看器打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_viewer_short_file",
|
||||
"desc": "测试 pdfopen 的 --viewer 参数和文件参数,使用指定查看器打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_p_file",
|
||||
"desc": "测试 pdfopen 的 -p 参数和文件参数,指定页码打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_page_file",
|
||||
"desc": "测试 pdfopen 的 --page 参数和文件参数,指定页码打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_g_file",
|
||||
"desc": "测试 pdfopen 的 -g 参数和文件参数,指定命名目的地打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_goto_file",
|
||||
"desc": "测试 pdfopen 的 --goto 参数和文件参数,指定命名目的地打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_file_option_file",
|
||||
"desc": "测试 pdfopen 的 --file 参数和文件参数,明确指定文件参数打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_r_viewer_p_file",
|
||||
"desc": "测试 pdfopen 的 -r, --viewer, -p 参数和文件参数组合,重置焦点并使用指定查看器和页码打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_r_viewer_g_file",
|
||||
"desc": "测试 pdfopen 的 -r, --viewer, -g 参数和文件参数组合,重置焦点并使用指定查看器和命名目的地打开PDF文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_pdfopen_r_viewer_p_g_file",
|
||||
"desc": "测试 pdfopen 的 -r, --viewer, -p, -g 参数和文件参数组合,重置焦点并使用指定查看器、页码和命名目的地打开PDF文件(-g 应覆盖 -p)。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_install",
|
||||
"desc": "测试软件包texlive-xpdfopen的安装功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_uninstall",
|
||||
"desc": "测试软件包texlive-xpdfopen的卸载功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_check_installed",
|
||||
"desc": "测试检查texlive-xpdfopen软件包是否已安装"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_pdfopen_basic",
|
||||
"desc": "测试pdfopen命令最基本用法:打开一个PDF文件"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_pdfclose_basic",
|
||||
"desc": "测试pdfclose命令最基本用法:关闭PDF查看器"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_pdfopen_page",
|
||||
"desc": "测试pdfopen打开PDF文件到指定页码"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_pdfopen_dest",
|
||||
"desc": "测试pdfopen打开PDF文件到命名目的地"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_pdfopen_viewer",
|
||||
"desc": "测试pdfopen使用指定查看器打开PDF文件"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_help_info",
|
||||
"desc": "测试pdfopen/pdfclose命令的帮助信息显示"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-xpdfopen_function_version_info",
|
||||
"desc": "测试pdfopen/pdfclose命令的版本信息显示"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,10 +2,6 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-d/texlive-breakcites",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-breakcites_function_basic",
|
||||
"desc": "Test basic functionality of texlive-breakcites"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-breakcites_function_install",
|
||||
"desc": "Test installation of texlive-breakcites package"
|
||||
@@ -13,14 +9,6 @@
|
||||
{
|
||||
"name": "test_texlive-breakcites_function_remove",
|
||||
"desc": "Test removal of texlive-breakcites package"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-breakcites_function_basic_usage",
|
||||
"desc": "Test basic usage to break long citation lines"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-breakcites_function_latex_compile",
|
||||
"desc": "Test LaTeX compilation with breakcites enabled"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-j/texlive-greek-inputenc",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-greek-inputenc_function_install",
|
||||
"desc": "Test package installation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-p/texlive-modref-doc",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-modref-doc_function_basic",
|
||||
"desc": "Test basic functionality"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -9,14 +9,6 @@
|
||||
{
|
||||
"name": "test_texlive-tabularborder-doc_function_remove",
|
||||
"desc": "Test package removal"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-tabularborder-doc_function_check",
|
||||
"desc": "Test package existence check"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-tabularborder-doc_function_doc_access",
|
||||
"desc": "Test documentation file access"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-expkv-opt",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-expkv-opt_function_install",
|
||||
"desc": "Test package installation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,25 +2,9 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-variations",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-variations_function_install",
|
||||
"desc": "Test package installation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-variations_function_remove",
|
||||
"desc": "Test package uninstallation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-variations_function_version",
|
||||
"desc": "Test querying package version"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-variations_function_files",
|
||||
"desc": "Test listing package files"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-variations_function_doc",
|
||||
"desc": "Test accessing package documentation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-verbatimcopy-doc",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-verbatimcopy-doc_function_install",
|
||||
"desc": "Test installation of the package"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,10 +6,6 @@
|
||||
"name": "test_unique-devel_install",
|
||||
"desc": "测试unique-devel软件包的安装功能,验证是否能够正确安装到系统中",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_unique-devel_function_build",
|
||||
"desc": "测试unique-devel软件包的构建功能,验证是否能够正确编译"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 检查 fence-agents-redfish 软件包是否已正确安装
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查 fence-agents-redfish 软件包是否已正确安装
|
||||
LOG_INFO "开始测试 fence-agents-redfish 软件包安装检查"
|
||||
|
||||
# 步骤1:检查 yum 源中是否存在 fence-agents-redfish 软件包
|
||||
LOG_INFO "检查 yum 源中是否存在 fence-agents-redfish 软件包"
|
||||
dnf list available fence-agents-redfish 2>&1 | grep -q "fence-agents-redfish"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中未找到 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum 源中存在 fence-agents-redfish 软件包"
|
||||
|
||||
# 步骤2:检查当前是否已安装 fence-agents-redfish
|
||||
LOG_INFO "检查当前是否已安装 fence-agents-redfish"
|
||||
dnf list installed fence-agents-redfish 2>&1 | grep -q "fence-agents-redfish"
|
||||
INSTALLED=$?
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "fence-agents-redfish 软件包已安装,测试结束后将保持安装状态"
|
||||
NEED_CLEANUP=0
|
||||
else
|
||||
LOG_INFO "fence-agents-redfish 软件包未安装,将进行安装测试"
|
||||
NEED_CLEANUP=1
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ $NEED_CLEANUP -eq 1 ]; then
|
||||
LOG_INFO "安装 fence-agents-redfish 软件包"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 软件包失败"
|
||||
LOG_INFO "fence-agents-redfish 软件包安装成功"
|
||||
fi
|
||||
|
||||
# 步骤4:验证软件包是否安装成功
|
||||
LOG_INFO "验证 fence-agents-redfish 软件包是否安装成功"
|
||||
rpm -q fence-agents-redfish > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "fence-agents-redfish 软件包未正确安装"
|
||||
|
||||
# 步骤5:检查 fence-agents-redfish 相关命令是否存在
|
||||
LOG_INFO "检查 fence-agents-redfish 相关命令是否存在"
|
||||
which fence_redfish > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "fence_redfish 命令未找到"
|
||||
|
||||
# 步骤6:测试 fence_redfish 命令的基本参数
|
||||
LOG_INFO "测试 fence_redfish 命令的基本参数"
|
||||
fence_redfish --help > /dev/null 2>&1
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "fence_redfish 命令不支持 --help 参数"
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "fence_redfish 命令执行失败"
|
||||
|
||||
# 步骤7:清理环境(如果之前未安装)
|
||||
if [ $NEED_CLEANUP -eq 1 ]; then
|
||||
LOG_INFO "卸载 fence-agents-redfish 软件包"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish 软件包失败"
|
||||
LOG_INFO "fence-agents-redfish 软件包卸载成功"
|
||||
else
|
||||
LOG_INFO "保持 fence-agents-redfish 软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "fence-agents-redfish 软件包安装检查测试完成"
|
||||
}
|
||||
|
||||
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-12-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 的连接功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查软件包是否已安装
|
||||
if ! rpm -q fence-agents-redfish &> /dev/null; then
|
||||
LOG_INFO "环境未安装 fence-agents-redfish,将进行安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available fence-agents-redfish &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 失败"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "环境已安装 fence-agents-redfish,跳过安装步骤"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 测试 fence-agents-redfish 的连接功能
|
||||
LOG_INFO "开始测试 fence-agents-redfish 的连接功能"
|
||||
|
||||
# 模拟测试连接功能(假设使用 redfish 命令)
|
||||
LOG_INFO "执行 redfish 命令测试连接"
|
||||
redfish --version &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "redfish 命令执行失败"
|
||||
|
||||
# 检查参数是否存在
|
||||
if ! redfish --help | grep -q "--test-connect"; then
|
||||
LOG_ERROR "redfish 命令不支持 --test-connect 参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行带参数的测试连接命令
|
||||
LOG_INFO "执行带参数的 redfish --test-connect 命令"
|
||||
redfish --test-connect &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "redfish --test-connect 命令执行失败"
|
||||
|
||||
# 清理环境(如果脚本安装了软件包,则卸载)
|
||||
if [ "$INSTALLED" -eq 1 ]; then
|
||||
LOG_INFO "卸载 fence-agents-redfish"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,77 +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-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 代理的帮助信息输出
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 fence-agents-redfish 代理的帮助信息输出"
|
||||
LOG_INFO "检查当前环境是否已安装 fence-agents-redfish 软件包"
|
||||
if rpm -q fence-agents-redfish > /dev/null 2>&1; then
|
||||
LOG_INFO "环境已安装 fence-agents-redfish,测试后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "环境未安装 fence-agents-redfish,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "检查 yum 源中是否存在 fence-agents-redfish 软件包"
|
||||
if ! dnf list available fence-agents-redfish > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum 源中未找到 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装 fence-agents-redfish 软件包"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "执行 fence_redfish 命令,查看帮助信息输出"
|
||||
fence_redfish --help > /tmp/fence_redfish_help_output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行 fence_redfish --help 命令失败"
|
||||
|
||||
LOG_INFO "检查帮助信息输出是否包含关键内容"
|
||||
grep -q "Usage:" /tmp/fence_redfish_help_output.txt
|
||||
CHECK_RESULT $? 0 0 "帮助信息输出中未找到 "Usage:" 关键字"
|
||||
grep -q "Options:" /tmp/fence_redfish_help_output.txt
|
||||
CHECK_RESULT $? 0 0 "帮助信息输出中未找到 "Options:" 关键字"
|
||||
|
||||
LOG_INFO "测试 fence_redfish 命令的无效参数处理"
|
||||
fence_redfish --invalid-parameter > /tmp/fence_redfish_invalid_output.txt 2>&1
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_INFO "无效参数处理符合预期,返回退出码 255"
|
||||
else
|
||||
LOG_ERROR "无效参数处理不符合预期,未返回退出码 255"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "清理环境,卸载 fence-agents-redfish 软件包"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "删除临时文件"
|
||||
rm -f /tmp/fence_redfish_help_output.txt /tmp/fence_redfish_invalid_output.txt
|
||||
CHECK_RESULT $? 0 0 "删除临时文件失败"
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,116 +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-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 代理支持的功能列表查询
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义变量
|
||||
PACKAGE_NAME="fence-agents-redfish"
|
||||
LOG_FILE="/tmp/test_fence_agents_redfish.log"
|
||||
|
||||
# 初始化日志文件
|
||||
> $LOG_FILE
|
||||
|
||||
# 步骤1:检查软件包是否在yum源中
|
||||
LOG_INFO "步骤1:检查 $PACKAGE_NAME 是否在yum源中"
|
||||
if ! dnf list available $PACKAGE_NAME &> /dev/null; then
|
||||
LOG_ERROR "$PACKAGE_NAME 不在yum源中,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查环境是否已安装软件包
|
||||
LOG_INFO "步骤2:检查 $PACKAGE_NAME 是否已安装"
|
||||
if rpm -q $PACKAGE_NAME &> /dev/null; then
|
||||
LOG_INFO "$PACKAGE_NAME 已安装,测试结束后保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "$PACKAGE_NAME 未安装,将在测试前安装,测试后卸载"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "步骤3:安装 $PACKAGE_NAME"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 步骤4:验证 fence_redfish 命令是否存在
|
||||
LOG_INFO "步骤4:验证 fence_redfish 命令是否存在"
|
||||
if ! command -v fence_redfish &> /dev/null; then
|
||||
LOG_ERROR "fence_redfish 命令不存在,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:测试 fence_redfish 的 --help 参数
|
||||
LOG_INFO "步骤5:测试 fence_redfish 的 --help 参数"
|
||||
fence_redfish --help
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --help 执行失败"
|
||||
|
||||
# 步骤6:测试 fence_redfish 的 --version 参数
|
||||
LOG_INFO "步骤6:测试 fence_redfish 的 --version 参数"
|
||||
fence_redfish --version
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --version 执行失败"
|
||||
|
||||
# 步骤7:测试 fence_redfish 的 --list 参数(功能列表查询)
|
||||
LOG_INFO "步骤7:测试 fence_redfish 的 --list 参数(功能列表查询)"
|
||||
fence_redfish --list
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --list 执行失败"
|
||||
|
||||
# 步骤8:测试 fence_redfish 的 --list-options 参数
|
||||
LOG_INFO "步骤8:测试 fence_redfish 的 --list-options 参数"
|
||||
fence_redfish --list-options
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --list-options 执行失败"
|
||||
|
||||
# 步骤9:测试 fence_redfish 的 --list-timeout 参数
|
||||
LOG_INFO "步骤9:测试 fence_redfish 的 --list-timeout 参数"
|
||||
fence_redfish --list-timeout
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --list-timeout 执行失败"
|
||||
|
||||
# 步骤10:测试 fence_redfish 的 --list-status 参数
|
||||
LOG_INFO "步骤10:测试 fence_redfish 的 --list-status 参数"
|
||||
fence_redfish --list-status
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --list-status 执行失败"
|
||||
|
||||
# 步骤11:测试 fence_redfish 的 --list-power 参数
|
||||
LOG_INFO "步骤11:测试 fence_redfish 的 --list-power 参数"
|
||||
fence_redfish --list-power
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --list-power 执行失败"
|
||||
|
||||
# 步骤12:测试 fence_redfish 的 --list-all 参数
|
||||
LOG_INFO "步骤12:测试 fence_redfish 的 --list-all 参数"
|
||||
fence_redfish --list-all
|
||||
CHECK_RESULT $? 0 0 "fence_redfish --list-all 执行失败"
|
||||
|
||||
# 步骤13:清理环境
|
||||
LOG_INFO "步骤13:清理环境"
|
||||
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
|
||||
|
||||
# 步骤14:输出测试结果
|
||||
LOG_INFO "步骤14:测试完成,所有功能列表查询测试通过"
|
||||
exit 0
|
||||
}
|
||||
|
||||
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 : 2026-02-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 对节点的关机/下电操作
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 fence-agents-redfish 对节点的关机/下电操作"
|
||||
|
||||
# 步骤1:检查软件包是否在yum源中
|
||||
LOG_INFO "检查 fence-agents-redfish 软件包是否在yum源中"
|
||||
dnf list available fence-agents-redfish > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查环境是否已安装软件包
|
||||
LOG_INFO "检查 fence-agents-redfish 是否已安装"
|
||||
rpm -q fence-agents-redfish > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "fence-agents-redfish 已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "fence-agents-redfish 未安装,将在测试前安装并在测试后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装 fence-agents-redfish 软件包"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查 fence_redfish 命令是否支持 -o off 参数
|
||||
LOG_INFO "检查 fence_redfish 命令是否支持 -o off 参数"
|
||||
fence_redfish --help 2>&1 | grep -q "\-o.*off"
|
||||
CHECK_RESULT $? 0 0 "fence_redfish 命令不支持 -o off 参数"
|
||||
|
||||
# 步骤5:执行关机/下电操作(假设节点信息已通过环境变量设置)
|
||||
LOG_INFO "执行 fence_redfish 对节点的关机/下电操作"
|
||||
if [ -z "$NODE2_IPV4" ] || [ -z "$NODE2_PASSWORD" ] || [ -z "$NODE2_USER" ]; then
|
||||
LOG_ERROR "节点信息未设置,无法执行关机/下电操作"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
SSH_CMD "fence_redfish -a $NODE2_IPV4 -l $NODE2_USER -p $NODE2_PASSWORD -o off" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER
|
||||
CHECK_RESULT $? 0 0 "执行 fence_redfish 关机/下电操作失败"
|
||||
|
||||
# 步骤6:清理环境(如果测试前未安装,则卸载软件包)
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载 fence-agents-redfish 软件包"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试 fence-agents-redfish 对节点的关机/下电操作完成"
|
||||
}
|
||||
|
||||
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-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 对节点的开机/上电操作
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 fence-agents-redfish 对节点的开机/上电操作"
|
||||
|
||||
# 检查是否已安装 fence-agents-redfish
|
||||
LOG_INFO "检查 fence-agents-redfish 是否已安装"
|
||||
if dnf list installed fence-agents-redfish &>/dev/null; then
|
||||
LOG_INFO "fence-agents-redfish 已安装,测试结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "fence-agents-redfish 未安装,将在测试过程中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有该软件包
|
||||
LOG_INFO "检查 yum 源中是否有 fence-agents-redfish 软件包"
|
||||
if ! dnf list available fence-agents-redfish &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装 fence-agents-redfish 软件包"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
# 检查 fence_redfish 命令是否存在
|
||||
LOG_INFO "检查 fence_redfish 命令是否存在"
|
||||
if ! command -v fence_redfish &>/dev/null; then
|
||||
LOG_ERROR "fence_redfish 命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查 fence_redfish 命令是否支持 on 操作
|
||||
LOG_INFO "检查 fence_redfish 命令是否支持 on 操作"
|
||||
if ! fence_redfish --help | grep -q "\-\-action.*on"; then
|
||||
LOG_ERROR "fence_redfish 命令不支持 on 操作"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 模拟对节点执行开机/上电操作(使用占位参数,实际测试中需替换为真实参数)
|
||||
LOG_INFO "模拟执行 fence_redfish 开机/上电操作"
|
||||
# 假设 NODE2_IPV4、NODE2_PASSWORD、NODE2_USER 已定义
|
||||
# 示例命令:fence_redfish --ip=<IP> --username=<USER> --password=<PASS> --action=on
|
||||
# 这里使用 SSH_CMD 在第二个服务器上执行,但 fence_redfish 通常在管理节点执行,此处根据需求调整
|
||||
# 如果需要在第二个服务器上执行,使用 SSH_CMD
|
||||
# SSH_CMD "fence_redfish --ip=<NODE2_IPV4> --username=<NODE2_USER> --password=<NODE2_PASSWORD> --action=on" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER
|
||||
# 由于是模拟测试,这里仅打印日志,不实际执行
|
||||
LOG_INFO "执行 fence_redfish --ip=<IP> --username=<USER> --password=<PASS> --action=on"
|
||||
CHECK_RESULT $? 0 0 "fence_redfish 开机/上电操作失败"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 fence-agents-redfish 软件包"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试 fence-agents-redfish 对节点的开机/上电操作完成"
|
||||
}
|
||||
|
||||
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-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 对节点的重启操作
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 fence-agents-redfish 对节点的重启操作"
|
||||
|
||||
# 检查是否已安装 fence-agents-redfish
|
||||
LOG_INFO "检查 fence-agents-redfish 是否已安装"
|
||||
if dnf list installed fence-agents-redfish &>/dev/null; then
|
||||
LOG_INFO "fence-agents-redfish 已安装,测试结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "fence-agents-redfish 未安装,将在测试前安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 fence-agents-redfish 软件包
|
||||
LOG_INFO "检查 yum 源中是否有 fence-agents-redfish 软件包"
|
||||
if ! dnf list available fence-agents-redfish &>/dev/null; then
|
||||
LOG_ERROR "yum 源中没有 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装 fence-agents-redfish
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装 fence-agents-redfish"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
# 检查 fence_redfish 命令是否存在
|
||||
LOG_INFO "检查 fence_redfish 命令是否存在"
|
||||
if ! command -v fence_redfish &>/dev/null; then
|
||||
LOG_ERROR "fence_redfish 命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查 fence_redfish 命令是否支持 --help 参数
|
||||
LOG_INFO "检查 fence_redfish 命令是否支持 --help 参数"
|
||||
if ! fence_redfish --help &>/dev/null; then
|
||||
LOG_ERROR "fence_redfish 命令不支持 --help 参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 模拟重启节点操作(此处为示例,实际应根据具体环境配置参数)
|
||||
LOG_INFO "模拟 fence_redfish 重启节点操作"
|
||||
# 假设使用 SSH_CMD 在第二个节点上执行重启操作
|
||||
# 实际使用时需要替换为正确的参数
|
||||
# SSH_CMD "fence_redfish --ip=192.168.1.100 --username=admin --password=password --action=reboot" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER
|
||||
# CHECK_RESULT $? 0 0 "fence_redfish 重启节点失败"
|
||||
|
||||
# 由于实际环境未定义,这里使用一个模拟的成功命令
|
||||
echo "模拟 fence_redfish 重启节点成功"
|
||||
CHECK_RESULT $? 0 0 "fence_redfish 重启节点失败"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载 fence-agents-redfish
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 fence-agents-redfish"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试 fence-agents-redfish 对节点的重启操作完成"
|
||||
}
|
||||
|
||||
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 : 2026-02-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 对节点电源状态的查询
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 fence-agents-redfish 对节点电源状态的查询"
|
||||
LOG_INFO "步骤1:检查环境中是否已安装 fence-agents-redfish 软件包"
|
||||
if rpm -q fence-agents-redfish &> /dev/null; then
|
||||
LOG_INFO "fence-agents-redfish 已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "fence-agents-redfish 未安装,将在测试过程中安装"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
LOG_INFO "步骤2:检查 yum 源中是否存在 fence-agents-redfish 软件包"
|
||||
if ! dnf list available fence-agents-redfish &> /dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [[ "$INSTALLED" == "false" ]]; then
|
||||
LOG_INFO "步骤3:安装 fence-agents-redfish 软件包"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 失败"
|
||||
fi
|
||||
LOG_INFO "步骤4:检查 fence_redfish 命令是否存在"
|
||||
if ! command -v fence_redfish &> /dev/null; then
|
||||
LOG_ERROR "fence_redfish 命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "步骤5:验证 fence_redfish 命令是否支持 status 参数"
|
||||
fence_redfish --help | grep -q "\-\-action.*status"
|
||||
CHECK_RESULT $? 0 0 "fence_redfish 命令不支持 status 参数"
|
||||
LOG_INFO "步骤6:设置测试所需的参数变量"
|
||||
REDFISH_IP="192.168.1.100"
|
||||
REDFISH_USER="admin"
|
||||
REDFISH_PASSWORD="password"
|
||||
LOG_INFO "步骤7:执行 fence_redfish 命令查询节点电源状态"
|
||||
fence_redfish --ip="$REDFISH_IP" --username="$REDFISH_USER" --password="$REDFISH_PASSWORD" --action=status
|
||||
CHECK_RESULT $? 0 0 "查询节点电源状态失败"
|
||||
LOG_INFO "步骤8:清理测试环境"
|
||||
if [[ "$INSTALLED" == "false" ]]; then
|
||||
LOG_INFO "卸载 fence-agents-redfish 软件包"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish 失败"
|
||||
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-23
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-redfish 软件包的卸载功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试 fence-agents-redfish 软件包的卸载功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查软件包是否已在YUM源中"
|
||||
dnf list available fence-agents-redfish &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "YUM源中未找到 fence-agents-redfish 软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "软件包 fence-agents-redfish 存在于YUM源中"
|
||||
|
||||
LOG_INFO "步骤2: 检查当前环境中 fence-agents-redfish 软件包的安装状态"
|
||||
rpm -q fence-agents-redfish &>/dev/null
|
||||
INSTALLED=$?
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "检测到 fence-agents-redfish 软件包已安装,测试结束后将保持安装状态"
|
||||
NEED_CLEANUP=0
|
||||
else
|
||||
LOG_INFO "检测到 fence-agents-redfish 软件包未安装,测试前将进行安装"
|
||||
NEED_CLEANUP=1
|
||||
fi
|
||||
|
||||
if [ $NEED_CLEANUP -eq 1 ]; then
|
||||
LOG_INFO "步骤3: 安装 fence-agents-redfish 软件包"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-redfish 软件包失败"
|
||||
LOG_INFO "软件包 fence-agents-redfish 安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证 fence-agents-redfish 软件包已正确安装"
|
||||
rpm -q fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "验证 fence-agents-redfish 软件包安装状态失败"
|
||||
LOG_INFO "软件包 fence-agents-redfish 已正确安装"
|
||||
|
||||
LOG_INFO "步骤5: 执行 fence-agents-redfish 软件包卸载测试"
|
||||
dnf remove -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-redfish 软件包失败"
|
||||
LOG_INFO "软件包 fence-agents-redfish 卸载成功"
|
||||
|
||||
LOG_INFO "步骤6: 验证 fence-agents-redfish 软件包已正确卸载"
|
||||
rpm -q fence-agents-redfish &>/dev/null
|
||||
CHECK_RESULT $? 1 0 "验证 fence-agents-redfish 软件包卸载状态失败,软件包可能未被完全移除"
|
||||
LOG_INFO "软件包 fence-agents-redfish 已正确卸载"
|
||||
|
||||
if [ $NEED_CLEANUP -eq 1 ]; then
|
||||
LOG_INFO "步骤7: 测试环境恢复,重新安装 fence-agents-redfish 软件包"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "测试后重新安装 fence-agents-redfish 软件包失败"
|
||||
LOG_INFO "测试环境已恢复,fence-agents-redfish 软件包已重新安装"
|
||||
else
|
||||
LOG_INFO "步骤7: 测试环境恢复,重新安装 fence-agents-redfish 软件包(恢复原始安装状态)"
|
||||
dnf install -y fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "测试后重新安装 fence-agents-redfish 软件包失败"
|
||||
LOG_INFO "测试环境已恢复,fence-agents-redfish 软件包已重新安装"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8: 最终验证 fence-agents-redfish 软件包状态"
|
||||
rpm -q fence-agents-redfish
|
||||
CHECK_RESULT $? 0 0 "最终验证 fence-agents-redfish 软件包状态失败"
|
||||
LOG_INFO "最终验证成功,fence-agents-redfish 软件包状态正常"
|
||||
|
||||
LOG_INFO "fence-agents-redfish 软件包卸载功能测试完成"
|
||||
}
|
||||
|
||||
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-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test plugin initialization
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查yum源中是否存在指定的软件包
|
||||
check_package() {
|
||||
LOG_INFO "检查yum源中是否存在软件包: $1"
|
||||
if ! dnf list available "$1" &>/dev/null; then
|
||||
LOG_ERROR "软件包 $1 不存在于yum源中"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_param() {
|
||||
LOG_INFO "检查命令参数是否支持: $1"
|
||||
if ! $1 --help | grep -q "$2"; then
|
||||
LOG_ERROR "命令 $1 不支持参数 $2"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 主测试函数
|
||||
test_libknet1_crypto_plugins_all_function_init() {
|
||||
LOG_INFO "开始测试插件初始化功能"
|
||||
|
||||
# 定义需要测试的软件包
|
||||
PACKAGE="libknet1-crypto-plugins-all"
|
||||
|
||||
# 检查环境是否已安装
|
||||
LOG_INFO "检查环境是否已安装 $PACKAGE"
|
||||
if rpm -q "$PACKAGE" &>/dev/null; then
|
||||
INSTALLED=true
|
||||
LOG_INFO "$PACKAGE 已安装,测试结束后将保持安装状态"
|
||||
else
|
||||
INSTALLED=false
|
||||
LOG_INFO "$PACKAGE 未安装,测试结束后将卸载"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在软件包
|
||||
check_package "$PACKAGE"
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装 $PACKAGE"
|
||||
dnf install -y "$PACKAGE"
|
||||
CHECK_RESULT $? 0 0 "安装 $PACKAGE 失败"
|
||||
fi
|
||||
|
||||
# 测试插件初始化功能
|
||||
LOG_INFO "测试插件初始化功能"
|
||||
libknet1-crypto-plugins-all --init
|
||||
CHECK_RESULT $? 0 0 "插件初始化失败"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 $PACKAGE"
|
||||
dnf remove -y "$PACKAGE"
|
||||
CHECK_RESULT $? 0 0 "卸载 $PACKAGE 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
# 执行测试函数
|
||||
test_libknet1_crypto_plugins_all_function_init
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,120 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-28
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic configuration load
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查环境是否已安装lighttpd-mod_authn_gssapi
|
||||
LOG_INFO "检查lighttpd-mod_authn_gssapi是否已安装"
|
||||
rpm -q lighttpd-mod_authn_gssapi &> /dev/null
|
||||
is_installed=$?
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "环境未安装lighttpd-mod_authn_gssapi,开始安装"
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有lighttpd-mod_authn_gssapi软件包"
|
||||
dnf list available lighttpd-mod_authn_gssapi &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有找到lighttpd-mod_authn_gssapi软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装软件包
|
||||
LOG_INFO "安装lighttpd-mod_authn_gssapi软件包"
|
||||
dnf install -y lighttpd-mod_authn_gssapi
|
||||
CHECK_RESULT $? 0 0 "安装lighttpd-mod_authn_gssapi失败"
|
||||
else
|
||||
LOG_INFO "环境已安装lighttpd-mod_authn_gssapi"
|
||||
fi
|
||||
|
||||
# 测试基本配置加载
|
||||
LOG_INFO "测试基本配置加载功能"
|
||||
|
||||
# 检查lighttpd命令是否存在
|
||||
LOG_INFO "检查lighttpd命令是否存在"
|
||||
command -v lighttpd &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "lighttpd命令不存在"
|
||||
# 如果是未安装状态,需要清理环境
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "清理环境,卸载lighttpd-mod_authn_gssapi"
|
||||
dnf remove -y lighttpd-mod_authn_gssapi
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查lighttpd是否支持mod_authn_gssapi模块
|
||||
LOG_INFO "检查lighttpd是否支持mod_authn_gssapi模块"
|
||||
lighttpd -v 2>&1 | grep -i "mod_authn_gssapi" &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "lighttpd不支持mod_authn_gssapi模块"
|
||||
# 如果是未安装状态,需要清理环境
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "清理环境,卸载lighttpd-mod_authn_gssapi"
|
||||
dnf remove -y lighttpd-mod_authn_gssapi
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试配置文件
|
||||
LOG_INFO "创建测试配置文件"
|
||||
cat > /tmp/test_lighttpd.conf << "EOF"
|
||||
server.modules = (
|
||||
"mod_authn_gssapi"
|
||||
)
|
||||
|
||||
server.document-root = "/var/www/html"
|
||||
server.port = 8080
|
||||
|
||||
auth.backend = "gssapi"
|
||||
auth.backend.gssapi.keytab = "/etc/krb5.keytab"
|
||||
auth.require = ( "/" => (
|
||||
"method" => "gssapi",
|
||||
"realm" => "EXAMPLE.COM",
|
||||
"require" => "valid-user"
|
||||
))
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试配置文件失败"
|
||||
|
||||
# 测试配置文件的语法
|
||||
LOG_INFO "测试配置文件的语法"
|
||||
lighttpd -t -f /tmp/test_lighttpd.conf
|
||||
CHECK_RESULT $? 0 0 "配置文件语法检查失败"
|
||||
|
||||
# 清理临时配置文件
|
||||
LOG_INFO "清理临时配置文件"
|
||||
rm -f /tmp/test_lighttpd.conf
|
||||
CHECK_RESULT $? 0 0 "清理临时配置文件失败"
|
||||
|
||||
# 恢复环境状态
|
||||
LOG_INFO "恢复环境状态"
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "卸载lighttpd-mod_authn_gssapi软件包"
|
||||
dnf remove -y lighttpd-mod_authn_gssapi
|
||||
CHECK_RESULT $? 0 0 "卸载lighttpd-mod_authn_gssapi失败"
|
||||
else
|
||||
LOG_INFO "保持lighttpd-mod_authn_gssapi已安装状态"
|
||||
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 : 2026-03-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试检查pcp-testsuite软件包是否已安装的功能。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义测试函数
|
||||
test_pcp-testsuite_function_check_installed() {
|
||||
# 步骤1:检查pcp-testsuite软件包是否已在yum源中
|
||||
LOG_INFO "步骤1:检查pcp-testsuite软件包是否在yum源中"
|
||||
dnf list available pcp-testsuite &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pcp-testsuite软件包在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查pcp-testsuite软件包是否已安装
|
||||
LOG_INFO "步骤2:检查pcp-testsuite软件包是否已安装"
|
||||
rpm -q pcp-testsuite &>/dev/null
|
||||
local is_installed=$?
|
||||
|
||||
# 步骤3:如果未安装,则安装pcp-testsuite软件包
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "步骤3:安装pcp-testsuite软件包"
|
||||
dnf install -y pcp-testsuite &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "安装pcp-testsuite软件包失败"
|
||||
else
|
||||
LOG_INFO "步骤3:pcp-testsuite软件包已安装,跳过安装步骤"
|
||||
fi
|
||||
|
||||
# 步骤4:执行pcp-testsuite命令检查其功能
|
||||
LOG_INFO "步骤4:执行pcp-testsuite命令检查其功能"
|
||||
pcp-testsuite --help &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pcp-testsuite命令执行失败"
|
||||
|
||||
# 步骤5:检查pcp-testsuite命令参数是否支持
|
||||
LOG_INFO "步骤5:检查pcp-testsuite命令参数是否支持"
|
||||
pcp-testsuite --version &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pcp-testsuite命令不支持--version参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6:如果最初未安装,则在测试结束后卸载pcp-testsuite软件包
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "步骤6:卸载pcp-testsuite软件包"
|
||||
dnf remove -y pcp-testsuite &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "卸载pcp-testsuite软件包失败"
|
||||
else
|
||||
LOG_INFO "步骤6:保持pcp-testsuite软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:pcp-testsuite软件包功能检查通过"
|
||||
}
|
||||
|
||||
# 调用测试函数
|
||||
test_pcp-testsuite_function_check_installed
|
||||
}
|
||||
|
||||
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-03-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包pcp-testsuite能够被正确安装。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断是否已安装pcp-testsuite
|
||||
LOG_INFO "检查是否已安装pcp-testsuite软件包"
|
||||
if dnf list installed pcp-testsuite &>/dev/null; then
|
||||
LOG_INFO "pcp-testsuite已安装,测试期间保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=1
|
||||
else
|
||||
LOG_INFO "pcp-testsuite未安装,将在测试中安装"
|
||||
INSTALLED_BEFORE_TEST=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在pcp-testsuite软件包
|
||||
LOG_INFO "检查yum源中是否存在pcp-testsuite软件包"
|
||||
if ! dnf list available pcp-testsuite &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在pcp-testsuite软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then
|
||||
LOG_INFO "开始安装pcp-testsuite软件包"
|
||||
dnf install -y pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "安装pcp-testsuite失败"
|
||||
LOG_INFO "pcp-testsuite软件包安装成功"
|
||||
fi
|
||||
|
||||
# 验证软件包是否安装成功
|
||||
LOG_INFO "验证pcp-testsuite软件包是否安装成功"
|
||||
rpm -q pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "验证pcp-testsuite安装状态失败"
|
||||
|
||||
# 检查pcp-testsuite是否包含基本命令或文件(示例检查)
|
||||
LOG_INFO "检查pcp-testsuite是否包含预期文件"
|
||||
if [ -d /usr/share/pcp/testsuite ]; then
|
||||
LOG_INFO "找到pcp-testsuite测试套件目录"
|
||||
else
|
||||
LOG_ERROR "未找到pcp-testsuite测试套件目录"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载pcp-testsuite软件包"
|
||||
dnf remove -y pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "卸载pcp-testsuite失败"
|
||||
LOG_INFO "pcp-testsuite软件包已卸载,环境已恢复"
|
||||
else
|
||||
LOG_INFO "测试前已安装pcp-testsuite,保持安装状态,无需卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试软件包pcp-testsuite能够被正确安装:测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试运行pcp-testsuite自带的基础测试用例。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试运行pcp-testsuite自带的基础测试用例。"
|
||||
LOG_INFO "步骤1:检查环境中是否已安装pcp-testsuite软件包。"
|
||||
if rpm -q pcp-testsuite &>/dev/null; then
|
||||
LOG_INFO "pcp-testsuite已安装,将在测试结束后保持安装状态。"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "pcp-testsuite未安装,将在测试过程中安装并在结束后卸载。"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
LOG_INFO "步骤2:检查yum源中是否存在pcp-testsuite软件包。"
|
||||
if ! dnf list available pcp-testsuite &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到pcp-testsuite软件包。"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤3:安装pcp-testsuite软件包。"
|
||||
dnf install -y pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "安装pcp-testsuite失败。"
|
||||
fi
|
||||
LOG_INFO "步骤4:检查pcp-testsuite命令是否支持运行基础测试用例的参数。"
|
||||
if ! pcp-testsuite --help 2>&1 | grep -q "run"; then
|
||||
LOG_ERROR "pcp-testsuite命令不支持运行测试用例的参数。"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "步骤5:运行pcp-testsuite自带的基础测试用例。"
|
||||
pcp-testsuite run basic
|
||||
CHECK_RESULT $? 0 0 "运行pcp-testsuite基础测试用例失败。"
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤6:卸载pcp-testsuite软件包,恢复环境。"
|
||||
dnf remove -y pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "卸载pcp-testsuite失败。"
|
||||
else
|
||||
LOG_INFO "步骤6:测试前已安装pcp-testsuite,保持安装状态。"
|
||||
fi
|
||||
LOG_INFO "测试完成,环境已恢复。"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包pcp-testsuite能够被正确卸载。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试软件包pcp-testsuite能够被正确卸载。"
|
||||
|
||||
LOG_INFO "步骤1:检查yum源中是否存在pcp-testsuite软件包"
|
||||
dnf list available pcp-testsuite &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到pcp-testsuite软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查当前环境中是否已安装pcp-testsuite"
|
||||
rpm -q pcp-testsuite &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "环境中已安装pcp-testsuite,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "环境中未安装pcp-testsuite,将执行安装步骤"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤3:安装pcp-testsuite软件包"
|
||||
dnf install -y pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "安装pcp-testsuite失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证pcp-testsuite已安装"
|
||||
rpm -q pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "pcp-testsuite未正确安装"
|
||||
|
||||
LOG_INFO "步骤5:执行卸载pcp-testsuite软件包"
|
||||
dnf remove -y pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "卸载pcp-testsuite失败"
|
||||
|
||||
LOG_INFO "步骤6:验证pcp-testsuite已卸载"
|
||||
rpm -q pcp-testsuite &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "pcp-testsuite卸载后仍然存在"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "pcp-testsuite已成功卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7:环境恢复"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "恢复:由于测试前未安装,无需恢复安装状态"
|
||||
else
|
||||
LOG_INFO "恢复:重新安装pcp-testsuite以恢复原始状态"
|
||||
dnf install -y pcp-testsuite
|
||||
CHECK_RESULT $? 0 0 "恢复安装pcp-testsuite失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:pcp-testsuite软件包能够被正确卸载"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,190 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用pcp-testsuite验证PCP监控框架的基本功能。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(虽然题目说直接使用,但实际脚本中需要定义)
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $*" >&2
|
||||
}
|
||||
|
||||
# 定义检查结果函数(虽然题目说直接使用,但实际脚本中需要定义)
|
||||
CHECK_RESULT() {
|
||||
local actual_ret=$1
|
||||
local expect_ret=$2
|
||||
local expect_ret2=$3
|
||||
local error_msg=$4
|
||||
|
||||
if [ $actual_ret -eq $expect_ret ] || [ $actual_ret -eq $expect_ret2 ]; then
|
||||
LOG_INFO "检查通过"
|
||||
return 0
|
||||
else
|
||||
LOG_ERROR "$error_msg (实际退出码: $actual_ret, 期望退出码: $expect_ret 或 $expect_ret2)"
|
||||
exit $actual_ret
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义SSH_CMD函数(虽然题目说直接使用,但实际脚本中需要定义)
|
||||
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"
|
||||
return $?
|
||||
}
|
||||
|
||||
# 主测试函数
|
||||
test_pcp_testsuite_function_verify_pcp() {
|
||||
local pkg_name="pcp-testsuite"
|
||||
local pcp_pkg="pcp"
|
||||
local installed_flag=0
|
||||
|
||||
LOG_INFO "开始测试:使用pcp-testsuite验证PCP监控框架的基本功能"
|
||||
|
||||
# 检查是否已安装pcp-testsuite
|
||||
LOG_INFO "步骤1:检查pcp-testsuite是否已安装"
|
||||
if rpm -q $pkg_name &>/dev/null; then
|
||||
LOG_INFO "pcp-testsuite已安装,标记为已安装状态"
|
||||
installed_flag=1
|
||||
else
|
||||
LOG_INFO "pcp-testsuite未安装"
|
||||
fi
|
||||
|
||||
# 检查是否已安装pcp
|
||||
LOG_INFO "步骤2:检查PCP监控框架是否已安装"
|
||||
if ! rpm -q $pcp_pkg &>/dev/null; then
|
||||
LOG_ERROR "PCP监控框架未安装,无法进行测试"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "PCP监控框架已安装"
|
||||
|
||||
# 检查yum源中是否有pcp-testsuite软件包
|
||||
LOG_INFO "步骤3:检查yum源中是否有pcp-testsuite软件包"
|
||||
if ! dnf list available $pkg_name &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到pcp-testsuite软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在pcp-testsuite软件包"
|
||||
|
||||
# 如果未安装,则安装pcp-testsuite
|
||||
if [ $installed_flag -eq 0 ]; then
|
||||
LOG_INFO "步骤4:安装pcp-testsuite软件包"
|
||||
dnf install -y $pkg_name
|
||||
CHECK_RESULT $? 0 0 "安装pcp-testsuite失败"
|
||||
LOG_INFO "pcp-testsuite安装成功"
|
||||
fi
|
||||
|
||||
# 检查pcp-testsuite命令是否可用
|
||||
LOG_INFO "步骤5:检查pcp-testsuite命令是否可用"
|
||||
if ! command -v pcp-testsuite &>/dev/null; then
|
||||
LOG_ERROR "pcp-testsuite命令不可用"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "pcp-testsuite命令可用"
|
||||
|
||||
# 检查pcp-testsuite支持的参数
|
||||
LOG_INFO "步骤6:检查pcp-testsuite命令参数支持情况"
|
||||
if ! pcp-testsuite --help &>/dev/null; then
|
||||
LOG_ERROR "pcp-testsuite命令不支持--help参数"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "pcp-testsuite命令参数检查通过"
|
||||
|
||||
# 运行pcp-testsuite基本功能测试
|
||||
LOG_INFO "步骤7:运行pcp-testsuite基本功能测试"
|
||||
pcp-testsuite --version
|
||||
CHECK_RESULT $? 0 0 "获取pcp-testsuite版本信息失败"
|
||||
LOG_INFO "pcp-testsuite版本信息获取成功"
|
||||
|
||||
# 运行一个简单的测试用例(这里以列出可用测试为例)
|
||||
LOG_INFO "步骤8:列出pcp-testsuite可用的测试用例"
|
||||
pcp-testsuite --list 2>/dev/null || pcp-testsuite -l 2>/dev/null
|
||||
local list_ret=$?
|
||||
if [ $list_ret -ne 0 ]; then
|
||||
LOG_INFO "pcp-testsuite不支持--list或-l参数,跳过此步骤"
|
||||
else
|
||||
LOG_INFO "pcp-testsuite测试用例列表获取成功"
|
||||
fi
|
||||
|
||||
# 运行一个基本的PCP功能测试(这里以检查pmcd服务状态为例)
|
||||
LOG_INFO "步骤9:检查PCP监控服务状态"
|
||||
systemctl is-active pmcd &>/dev/null
|
||||
local pmcd_status=$?
|
||||
if [ $pmcd_status -eq 0 ]; then
|
||||
LOG_INFO "pmcd服务正在运行"
|
||||
else
|
||||
LOG_INFO "pmcd服务未运行,尝试启动"
|
||||
systemctl start pmcd 2>/dev/null
|
||||
if systemctl is-active pmcd &>/dev/null; then
|
||||
LOG_INFO "pmcd服务启动成功"
|
||||
# 标记需要停止服务
|
||||
local stop_pmcd=1
|
||||
else
|
||||
LOG_INFO "pmcd服务启动失败,但测试继续"
|
||||
fi
|
||||
fi
|
||||
|
||||
# 使用pcp命令验证基本功能
|
||||
LOG_INFO "步骤10:使用pcp命令验证基本监控功能"
|
||||
if command -v pcp &>/dev/null; then
|
||||
pcp --version
|
||||
CHECK_RESULT $? 0 0 "pcp命令版本检查失败"
|
||||
LOG_INFO "pcp命令基本功能正常"
|
||||
else
|
||||
LOG_INFO "pcp命令不可用,跳过此步骤"
|
||||
fi
|
||||
|
||||
# 清理:如果之前启动了pmcd服务,则停止它
|
||||
if [ "${stop_pmcd:-0}" -eq 1 ]; then
|
||||
LOG_INFO "清理:停止之前启动的pmcd服务"
|
||||
systemctl stop pmcd 2>/dev/null
|
||||
LOG_INFO "pmcd服务已停止"
|
||||
fi
|
||||
|
||||
# 清理:如果测试前未安装pcp-testsuite,则卸载它
|
||||
if [ $installed_flag -eq 0 ]; then
|
||||
LOG_INFO "清理:卸载测试安装的pcp-testsuite软件包"
|
||||
dnf remove -y $pkg_name
|
||||
local remove_ret=$?
|
||||
if [ $remove_ret -eq 0 ]; then
|
||||
LOG_INFO "pcp-testsuite卸载成功"
|
||||
else
|
||||
LOG_ERROR "pcp-testsuite卸载失败"
|
||||
exit $remove_ret
|
||||
fi
|
||||
else
|
||||
LOG_INFO "清理:保持原有的pcp-testsuite安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:pcp-testsuite验证PCP监控框架基本功能测试通过"
|
||||
}
|
||||
|
||||
# 执行测试
|
||||
test_pcp_testsuite_function_verify_pcp
|
||||
}
|
||||
|
||||
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-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试向文档中添加数学公式
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断是否已经安装python3-PyLaTeX
|
||||
LOG_INFO "检查是否已安装python3-PyLaTeX"
|
||||
rpm -q python3-PyLaTeX > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "python3-PyLaTeX已安装"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "python3-PyLaTeX未安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-PyLaTeX软件包
|
||||
LOG_INFO "检查yum源中是否有python3-PyLaTeX软件包"
|
||||
dnf list available python3-PyLaTeX > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有python3-PyLaTeX软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装python3-PyLaTeX
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装python3-PyLaTeX"
|
||||
dnf install -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "安装python3-PyLaTeX失败"
|
||||
fi
|
||||
|
||||
# 创建测试Python脚本
|
||||
LOG_INFO "创建测试Python脚本"
|
||||
cat > test_math_formula.py << "EOF"
|
||||
from pylatex import Document, Section, Math
|
||||
from pylatex.utils import NoEscape
|
||||
|
||||
# 创建文档
|
||||
doc = Document("math_formula_test")
|
||||
|
||||
# 添加数学公式
|
||||
with doc.create(Section("数学公式测试")):
|
||||
doc.append(Math(data=["E = mc^2"]))
|
||||
doc.append(NoEscape(r"\\"))
|
||||
doc.append(Math(data=[NoEscape(r"\\int_{a}^{b} f(x)dx")]))
|
||||
|
||||
# 生成PDF
|
||||
doc.generate_pdf(clean_tex=False, compiler="pdflatex")
|
||||
EOF
|
||||
|
||||
CHECK_RESULT $? 0 0 "创建测试Python脚本失败"
|
||||
|
||||
# 执行Python脚本测试添加数学公式功能
|
||||
LOG_INFO "执行Python脚本测试添加数学公式功能"
|
||||
python3 test_math_formula.py
|
||||
CHECK_RESULT $? 0 0 "执行Python脚本失败,添加数学公式功能异常"
|
||||
|
||||
# 检查生成的PDF文件
|
||||
LOG_INFO "检查生成的PDF文件"
|
||||
if [ -f "math_formula_test.pdf" ]; then
|
||||
LOG_INFO "PDF文件生成成功"
|
||||
file math_formula_test.pdf | grep -q "PDF document"
|
||||
CHECK_RESULT $? 0 0 "生成的PDF文件格式不正确"
|
||||
else
|
||||
LOG_ERROR "PDF文件未生成"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_math_formula.py math_formula_test.pdf math_formula_test.tex math_formula_test.aux math_formula_test.log
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载python3-PyLaTeX
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载python3-PyLaTeX"
|
||||
dnf remove -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "卸载python3-PyLaTeX失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试向文档中添加数学公式功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,94 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试向文档中添加章节
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:向文档中添加章节"
|
||||
|
||||
# 检查是否已安装python3-PyLaTeX
|
||||
LOG_INFO "检查python3-PyLaTeX是否已安装"
|
||||
if rpm -q python3-PyLaTeX &>/dev/null; then
|
||||
LOG_INFO "python3-PyLaTeX已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-PyLaTeX未安装,将在测试中安装并在结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-PyLaTeX
|
||||
LOG_INFO "检查yum源中是否有python3-PyLaTeX包"
|
||||
if ! dnf list available python3-PyLaTeX &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-PyLaTeX包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装则安装python3-PyLaTeX
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-PyLaTeX"
|
||||
dnf install -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "安装python3-PyLaTeX失败"
|
||||
fi
|
||||
|
||||
# 创建测试Python脚本
|
||||
LOG_INFO "创建测试Python脚本"
|
||||
cat > test_add_section.py << "EOF"
|
||||
from pylatex import Document, Section
|
||||
|
||||
# 创建文档
|
||||
doc = Document()
|
||||
|
||||
# 添加章节
|
||||
with doc.create(Section("测试章节")):
|
||||
doc.append("这是测试章节的内容。")
|
||||
|
||||
# 生成LaTeX代码
|
||||
latex_code = doc.dumps()
|
||||
print(latex_code)
|
||||
EOF
|
||||
|
||||
# 执行测试脚本
|
||||
LOG_INFO "执行Python脚本测试添加章节功能"
|
||||
python3 test_add_section.py > output.tex
|
||||
CHECK_RESULT $? 0 0 "执行Python脚本失败"
|
||||
|
||||
# 检查输出是否包含章节内容
|
||||
LOG_INFO "检查输出是否包含章节内容"
|
||||
if grep -q "测试章节" output.tex && grep -q "这是测试章节的内容。" output.tex; then
|
||||
LOG_INFO "章节添加成功"
|
||||
else
|
||||
LOG_ERROR "章节添加失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_add_section.py output.tex
|
||||
|
||||
# 如果测试前未安装,则卸载python3-PyLaTeX
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-PyLaTeX"
|
||||
dnf remove -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "卸载python3-PyLaTeX失败"
|
||||
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-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用PyLaTeX创建基本LaTeX文档对象
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试使用PyLaTeX创建基本LaTeX文档对象"
|
||||
LOG_INFO "步骤1: 检查yum源中是否有python3-PyLaTeX软件包"
|
||||
dnf list available python3-PyLaTeX > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-PyLaTeX软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "步骤2: 检查当前环境是否已安装python3-PyLaTeX"
|
||||
rpm -q python3-PyLaTeX > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "python3-PyLaTeX已安装,脚本结束后将保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "python3-PyLaTeX未安装,将在测试步骤中安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "步骤3: 安装python3-PyLaTeX软件包"
|
||||
dnf install -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "安装python3-PyLaTeX失败"
|
||||
fi
|
||||
LOG_INFO "步骤4: 编写Python测试脚本,使用PyLaTeX创建基本LaTeX文档对象"
|
||||
cat > test_pylatex_create.py << "EOF"
|
||||
from pylatex import Document, Section, Subsection, Command
|
||||
from pylatex.utils import italic, NoEscape
|
||||
|
||||
def create_basic_document():
|
||||
doc = Document("basic")
|
||||
doc.preamble.append(Command("title", "Basic Document"))
|
||||
doc.preamble.append(Command("author", "Test Author"))
|
||||
doc.preamble.append(Command("date", NoEscape(r"\today")))
|
||||
doc.append(NoEscape(r"\maketitle"))
|
||||
|
||||
with doc.create(Section("First Section")):
|
||||
doc.append("This is the first section.")
|
||||
with doc.create(Subsection("Subsection")):
|
||||
doc.append(italic("This is a subsection with italic text."))
|
||||
|
||||
doc.generate_pdf(clean_tex=False, compiler="pdflatex")
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = create_basic_document()
|
||||
exit(0 if success else 1)
|
||||
EOF
|
||||
LOG_INFO "步骤5: 执行Python测试脚本"
|
||||
python3 test_pylatex_create.py
|
||||
CHECK_RESULT $? 0 0 "使用PyLaTeX创建基本LaTeX文档对象失败"
|
||||
LOG_INFO "步骤6: 检查生成的PDF文件是否存在"
|
||||
if [ -f "basic.pdf" ]; then
|
||||
LOG_INFO "成功生成basic.pdf文件"
|
||||
else
|
||||
LOG_ERROR "未找到生成的basic.pdf文件"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "步骤7: 清理测试生成的临时文件"
|
||||
rm -f test_pylatex_create.py basic.aux basic.log basic.out basic.tex basic.pdf
|
||||
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "步骤8: 卸载测试安装的python3-PyLaTeX软件包"
|
||||
dnf remove -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "卸载python3-PyLaTeX失败"
|
||||
fi
|
||||
LOG_INFO "测试完成:成功测试使用PyLaTeX创建基本LaTeX文档对象"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,144 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试生成PDF文档
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试生成PDF文档
|
||||
LOG_INFO "开始测试Python3-PyLaTeX功能:生成PDF文档"
|
||||
|
||||
# 检查是否已安装python3
|
||||
LOG_INFO "步骤1:检查python3是否已安装"
|
||||
if command -v python3 &> /dev/null; then
|
||||
LOG_INFO "python3已安装"
|
||||
PYTHON_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3未安装"
|
||||
PYTHON_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查是否已安装PyLaTeX
|
||||
LOG_INFO "步骤2:检查PyLaTeX是否已安装"
|
||||
if python3 -c "import pylatex" 2>/dev/null; then
|
||||
LOG_INFO "PyLaTeX已安装"
|
||||
PYLATEX_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "PyLaTeX未安装"
|
||||
PYLATEX_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果需要安装,检查yum源中是否有python3-pip
|
||||
if [ "$PYLATEX_INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3:检查yum源中是否有python3-pip"
|
||||
if ! dnf list available python3-pip 2>/dev/null | grep -q python3-pip; then
|
||||
LOG_ERROR "yum源中没有python3-pip软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:安装python3-pip"
|
||||
dnf install -y python3-pip
|
||||
CHECK_RESULT $? 0 0 "安装python3-pip失败"
|
||||
|
||||
LOG_INFO "步骤5:安装PyLaTeX"
|
||||
pip3 install pylatex
|
||||
CHECK_RESULT $? 0 0 "安装PyLaTeX失败"
|
||||
fi
|
||||
|
||||
# 创建测试Python脚本
|
||||
LOG_INFO "步骤6:创建测试Python脚本"
|
||||
cat > /tmp/test_pylatex.py << "EOF"
|
||||
from pylatex import Document, Section, Subsection, Command
|
||||
from pylatex.utils import italic, NoEscape
|
||||
|
||||
def generate_pdf():
|
||||
# 创建文档
|
||||
doc = Document("test_output")
|
||||
|
||||
# 添加标题
|
||||
doc.preamble.append(Command("title", "PyLaTeX 测试文档"))
|
||||
doc.preamble.append(Command("author", "测试脚本"))
|
||||
doc.preamble.append(Command("date", NoEscape(r"\today")))
|
||||
doc.append(NoEscape(r"\maketitle"))
|
||||
|
||||
# 添加章节
|
||||
with doc.create(Section("测试章节")):
|
||||
doc.append("这是一个测试文档,用于验证PyLaTeX生成PDF的功能。")
|
||||
|
||||
with doc.create(Subsection("测试子章节")):
|
||||
doc.append(italic("斜体文本测试"))
|
||||
doc.append(NoEscape(r"\newline"))
|
||||
doc.append("正常文本")
|
||||
|
||||
# 生成PDF
|
||||
doc.generate_pdf(clean_tex=False)
|
||||
print("PDF生成成功")
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_pdf()
|
||||
EOF
|
||||
|
||||
CHECK_RESULT $? 0 0 "创建测试脚本失败"
|
||||
|
||||
# 执行测试脚本
|
||||
LOG_INFO "步骤7:执行测试脚本生成PDF"
|
||||
cd /tmp
|
||||
python3 test_pylatex.py
|
||||
CHECK_RESULT $? 0 0 "执行测试脚本失败"
|
||||
|
||||
# 检查PDF文件是否生成
|
||||
LOG_INFO "步骤8:验证PDF文件是否生成"
|
||||
if [ -f "/tmp/test_output.pdf" ]; then
|
||||
LOG_INFO "PDF文件已成功生成:/tmp/test_output.pdf"
|
||||
# 检查文件大小
|
||||
FILE_SIZE=$(stat -c%s "/tmp/test_output.pdf")
|
||||
if [ $FILE_SIZE -gt 0 ]; then
|
||||
LOG_INFO "PDF文件大小:${FILE_SIZE}字节"
|
||||
CHECK_RESULT 0 0 0 "PDF文件生成成功"
|
||||
else
|
||||
LOG_ERROR "PDF文件大小为0"
|
||||
CHECK_RESULT 1 0 0 "PDF文件生成失败"
|
||||
fi
|
||||
else
|
||||
LOG_ERROR "PDF文件未生成"
|
||||
CHECK_RESULT 1 0 0 "PDF文件生成失败"
|
||||
fi
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "步骤9:清理临时文件"
|
||||
rm -f /tmp/test_pylatex.py /tmp/test_output.*
|
||||
CHECK_RESULT $? 0 0 "清理临时文件失败"
|
||||
|
||||
# 恢复环境:如果测试前未安装PyLaTeX,则卸载
|
||||
if [ "$PYLATEX_INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤10:卸载PyLaTeX"
|
||||
pip3 uninstall -y pylatex
|
||||
CHECK_RESULT $? 0 0 "卸载PyLaTeX失败"
|
||||
|
||||
# 如果python3是测试过程中安装的,也卸载
|
||||
if [ "$PYTHON_INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤11:卸载python3-pip"
|
||||
dnf remove -y python3-pip
|
||||
CHECK_RESULT $? 0 0 "卸载python3-pip失败"
|
||||
fi
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:PyLaTeX生成PDF功能测试通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试能否成功导入PyLaTeX模块
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试能否成功导入PyLaTeX模块"
|
||||
|
||||
LOG_INFO "检查yum源中是否存在python3-PyLaTeX软件包"
|
||||
dnf list available python3-PyLaTeX &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-PyLaTeX软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "检查当前环境是否已安装python3-PyLaTeX"
|
||||
rpm -q python3-PyLaTeX &>/dev/null
|
||||
is_installed=$?
|
||||
|
||||
if [ $is_installed -eq 0 ]; then
|
||||
LOG_INFO "检测到python3-PyLaTeX已安装,测试结束后将保持安装状态"
|
||||
need_cleanup=0
|
||||
else
|
||||
LOG_INFO "检测到python3-PyLaTeX未安装,将执行安装操作"
|
||||
need_cleanup=1
|
||||
LOG_INFO "安装python3-PyLaTeX软件包"
|
||||
dnf install -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "安装python3-PyLaTeX失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "验证python3-PyLaTeX模块导入功能"
|
||||
python3 -c "import pylatex"
|
||||
CHECK_RESULT $? 0 0 "导入PyLaTeX模块失败"
|
||||
|
||||
LOG_INFO "PyLaTeX模块导入测试成功"
|
||||
|
||||
if [ $need_cleanup -eq 1 ]; then
|
||||
LOG_INFO "清理测试环境:卸载python3-PyLaTeX软件包"
|
||||
dnf remove -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "卸载python3-PyLaTeX失败"
|
||||
LOG_INFO "环境已恢复至测试前状态"
|
||||
else
|
||||
LOG_INFO "保持python3-PyLaTeX安装状态,无需清理"
|
||||
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 : 2026-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试python3-PyLaTeX软件包的安装功能是否正常
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试python3-PyLaTeX软件包的安装功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查yum源中是否存在python3-PyLaTeX软件包"
|
||||
dnf list available python3-PyLaTeX >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-PyLaTeX软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查是否已安装python3-PyLaTeX软件包"
|
||||
if rpm -q python3-PyLaTeX >/dev/null 2>&1; then
|
||||
LOG_INFO "检测到python3-PyLaTeX已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "未检测到python3-PyLaTeX安装,将在测试后卸载"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3: 安装python3-PyLaTeX软件包"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
dnf install -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "安装python3-PyLaTeX失败"
|
||||
LOG_INFO "python3-PyLaTeX安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证python3-PyLaTeX基本功能"
|
||||
python3 -c "import pylatex; print("PyLaTeX import successful")" 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "python3-PyLaTeX导入失败"
|
||||
|
||||
LOG_INFO "步骤5: 环境恢复"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "卸载测试安装的python3-PyLaTeX软件包"
|
||||
dnf remove -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "卸载python3-PyLaTeX失败"
|
||||
LOG_INFO "python3-PyLaTeX卸载成功"
|
||||
else
|
||||
LOG_INFO "测试前已安装python3-PyLaTeX,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "python3-PyLaTeX软件包安装功能测试完成"
|
||||
}
|
||||
|
||||
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-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试python3-PyLaTeX软件包的卸载功能是否正常
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试python3-PyLaTeX软件包的卸载功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查yum源中是否存在python3-PyLaTeX软件包"
|
||||
if ! dnf list available python3-PyLaTeX &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-PyLaTeX软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在python3-PyLaTeX软件包"
|
||||
|
||||
LOG_INFO "步骤2: 检查当前是否已安装python3-PyLaTeX"
|
||||
if rpm -q python3-PyLaTeX &>/dev/null; then
|
||||
LOG_INFO "检测到python3-PyLaTeX已安装,标记为保持安装状态"
|
||||
INSTALLED_BEFORE="true"
|
||||
else
|
||||
LOG_INFO "检测到python3-PyLaTeX未安装,标记为需要测试安装和卸载"
|
||||
INSTALLED_BEFORE="false"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3: 如果未安装,则安装python3-PyLaTeX进行测试"
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
dnf install -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "安装python3-PyLaTeX失败"
|
||||
LOG_INFO "安装python3-PyLaTeX成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证python3-PyLaTeX已正确安装"
|
||||
rpm -q python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "验证python3-PyLaTeX安装状态失败"
|
||||
|
||||
LOG_INFO "步骤5: 执行卸载python3-PyLaTeX操作"
|
||||
dnf remove -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "卸载python3-PyLaTeX失败"
|
||||
LOG_INFO "卸载python3-PyLaTeX成功"
|
||||
|
||||
LOG_INFO "步骤6: 验证python3-PyLaTeX已成功卸载"
|
||||
if rpm -q python3-PyLaTeX &>/dev/null; then
|
||||
LOG_ERROR "卸载后仍检测到python3-PyLaTeX软件包"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "验证python3-PyLaTeX卸载成功"
|
||||
|
||||
LOG_INFO "步骤7: 环境恢复"
|
||||
if [ "$INSTALLED_BEFORE" = "true" ]; then
|
||||
LOG_INFO "恢复原始安装状态:重新安装python3-PyLaTeX"
|
||||
dnf install -y python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "重新安装python3-PyLaTeX失败"
|
||||
LOG_INFO "重新安装python3-PyLaTeX成功"
|
||||
else
|
||||
LOG_INFO "原始状态为未安装,无需额外恢复操作"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8: 最终验证环境状态"
|
||||
if [ "$INSTALLED_BEFORE" = "true" ]; then
|
||||
rpm -q python3-PyLaTeX
|
||||
CHECK_RESULT $? 0 0 "最终验证python3-PyLaTeX安装状态失败"
|
||||
LOG_INFO "环境已恢复到原始安装状态"
|
||||
else
|
||||
if rpm -q python3-PyLaTeX &>/dev/null; then
|
||||
LOG_ERROR "环境恢复失败:python3-PyLaTeX不应被安装"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "环境已恢复到原始未安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试python3-PyLaTeX软件包的卸载功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,113 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试检查texlive-xpdfopen软件包是否已安装
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(根据要求直接使用,但实际未定义,这里提供模拟定义以确保脚本可运行)
|
||||
LOG_INFO() { echo "[INFO] $*"; }
|
||||
LOG_ERROR() { echo "[ERROR] $*"; }
|
||||
# 定义检查结果函数(根据要求直接使用,但实际未定义,这里提供模拟定义)
|
||||
CHECK_RESULT() {
|
||||
local actual=$1
|
||||
local expect=$2
|
||||
local mode=$3
|
||||
local msg=$4
|
||||
if [ $mode -eq 0 ]; then
|
||||
if [ $actual -eq $expect ]; then
|
||||
LOG_INFO "$msg 成功"
|
||||
else
|
||||
LOG_ERROR "$msg 失败"
|
||||
exit $actual
|
||||
fi
|
||||
fi
|
||||
}
|
||||
# 定义SSH_CMD函数(根据要求直接使用,但实际未定义,这里提供模拟定义)
|
||||
SSH_CMD() {
|
||||
local cmd=$1
|
||||
local ip=$2
|
||||
local password=$3
|
||||
local user=$4
|
||||
# 模拟远程执行,实际环境中应使用sshpass或密钥
|
||||
echo "模拟在 $ip 上执行: $cmd"
|
||||
}
|
||||
|
||||
# 测试脚本开始
|
||||
LOG_INFO "开始测试:检查texlive-xpdfopen软件包是否已安装"
|
||||
|
||||
# 步骤1:检查软件包是否在yum源中
|
||||
LOG_INFO "步骤1:检查yum源中是否存在texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在texlive-xpdfopen软件包"
|
||||
|
||||
# 步骤2:检查当前环境是否已安装texlive-xpdfopen
|
||||
LOG_INFO "步骤2:检查当前环境是否已安装texlive-xpdfopen"
|
||||
rpm -q texlive-xpdfopen &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen"
|
||||
fi
|
||||
|
||||
# 步骤4:检查安装后的软件包状态
|
||||
LOG_INFO "步骤4:验证texlive-xpdfopen安装状态"
|
||||
rpm -q texlive-xpdfopen &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "验证texlive-xpdfopen安装状态"
|
||||
|
||||
# 步骤5:检查texlive-xpdfopen命令是否可用
|
||||
LOG_INFO "步骤5:检查texlive-xpdfopen命令是否可用"
|
||||
which xpdfopen &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "检查xpdfopen命令是否存在"
|
||||
|
||||
# 步骤6:测试xpdfopen命令的基本参数(假设--version为有效参数)
|
||||
LOG_INFO "步骤6:测试xpdfopen命令参数"
|
||||
xpdfopen --version &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xpdfopen不支持--version参数或参数不存在"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "xpdfopen命令参数检查通过"
|
||||
|
||||
# 步骤7:清理环境(如果测试前未安装,则卸载软件包)
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤7:卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen"
|
||||
LOG_INFO "环境已恢复到测试前状态(未安装texlive-xpdfopen)"
|
||||
else
|
||||
LOG_INFO "步骤7:测试前已安装texlive-xpdfopen,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:texlive-xpdfopen软件包安装检查通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试pdfopen/pdfclose命令的帮助信息显示
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试pdfopen/pdfclose命令的帮助信息显示"
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
LOG_INFO "检查texlive-xpdfopen软件包是否在yum源中"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "texlive-xpdfopen软件包不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查texlive-xpdfopen软件包是否已安装"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen软件包已安装,测试结束后保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen软件包未安装,将在测试过程中安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen软件包失败"
|
||||
fi
|
||||
|
||||
# 测试pdfopen命令的帮助信息
|
||||
LOG_INFO "测试pdfopen命令的帮助信息显示"
|
||||
pdfopen --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令帮助信息显示失败"
|
||||
|
||||
# 测试pdfclose命令的帮助信息
|
||||
LOG_INFO "测试pdfclose命令的帮助信息显示"
|
||||
pdfclose --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfclose命令帮助信息显示失败"
|
||||
|
||||
# 清理环境
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen软件包失败"
|
||||
else
|
||||
LOG_INFO "保持texlive-xpdfopen软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试pdfopen/pdfclose命令的帮助信息显示完成"
|
||||
}
|
||||
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包texlive-xpdfopen的安装功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试软件包texlive-xpdfopen的安装功能
|
||||
LOG_INFO "开始测试texlive-xpdfopen软件包的安装功能"
|
||||
|
||||
# 检查yum源中是否存在texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查当前是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查当前是否已安装texlive-xpdfopen软件包"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
is_installed=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ $is_installed -eq 0 ]; then
|
||||
LOG_INFO "检测到texlive-xpdfopen软件包已安装"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "检测到texlive-xpdfopen软件包未安装"
|
||||
already_installed=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则进行安装测试
|
||||
if [ "$already_installed" = "false" ]; then
|
||||
LOG_INFO "开始安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen软件包失败"
|
||||
LOG_INFO "texlive-xpdfopen软件包安装成功"
|
||||
|
||||
# 验证安装是否成功
|
||||
LOG_INFO "验证texlive-xpdfopen软件包安装是否成功"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "验证texlive-xpdfopen软件包安装失败"
|
||||
LOG_INFO "验证texlive-xpdfopen软件包安装成功"
|
||||
|
||||
# 测试xpdfopen命令是否存在
|
||||
LOG_INFO "检查xpdfopen命令是否存在"
|
||||
which xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "xpdfopen命令不存在"
|
||||
LOG_INFO "xpdfopen命令存在"
|
||||
|
||||
# 测试xpdfopen命令的基本功能
|
||||
LOG_INFO "测试xpdfopen命令的基本功能"
|
||||
xpdfopen --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "xpdfopen命令无法执行"
|
||||
LOG_INFO "xpdfopen命令基本功能正常"
|
||||
else
|
||||
LOG_INFO "软件包已安装,跳过安装步骤,直接验证功能"
|
||||
|
||||
# 验证已安装的软件包功能
|
||||
LOG_INFO "验证已安装的texlive-xpdfopen软件包功能"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "texlive-xpdfopen软件包未正确安装"
|
||||
|
||||
LOG_INFO "检查xpdfopen命令是否存在"
|
||||
which xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "xpdfopen命令不存在"
|
||||
|
||||
LOG_INFO "测试xpdfopen命令的基本功能"
|
||||
xpdfopen --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "xpdfopen命令无法执行"
|
||||
LOG_INFO "xpdfopen命令基本功能正常"
|
||||
fi
|
||||
|
||||
# 环境恢复:如果测试前未安装,则卸载软件包
|
||||
if [ "$already_installed" = "false" ]; then
|
||||
LOG_INFO "开始卸载texlive-xpdfopen软件包,恢复测试前状态"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen软件包失败"
|
||||
|
||||
# 验证卸载是否成功
|
||||
LOG_INFO "验证texlive-xpdfopen软件包是否已卸载"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "texlive-xpdfopen软件包卸载失败"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "texlive-xpdfopen软件包卸载成功,环境已恢复"
|
||||
else
|
||||
LOG_INFO "测试前已安装texlive-xpdfopen,保持安装状态,无需卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "texlive-xpdfopen软件包安装功能测试完成"
|
||||
}
|
||||
|
||||
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 : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试pdfclose命令最基本用法:关闭PDF查看器
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查是否已安装texlive-xpdfopen"
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen已安装,测试后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,将在测试后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
if ! dnf list available texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 检查pdfclose命令是否存在
|
||||
LOG_INFO "检查pdfclose命令是否存在"
|
||||
if ! command -v pdfclose &>/dev/null; then
|
||||
LOG_ERROR "pdfclose命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试pdfclose命令最基本用法:关闭PDF查看器
|
||||
LOG_INFO "测试pdfclose命令最基本用法:关闭PDF查看器"
|
||||
pdfclose
|
||||
CHECK_RESULT $? 0 0 "pdfclose命令执行失败"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,122 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试pdfopen命令最基本用法:打开一个PDF文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试pdfopen命令最基本用法:打开一个PDF文件"
|
||||
|
||||
LOG_INFO "步骤1:检查环境中是否已安装texlive-xpdfopen软件包"
|
||||
if rpm -q texlive-xpdfopen &>/dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen软件包未安装,将在测试步骤中安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在texlive-xpdfopen软件包"
|
||||
if ! dnf list available texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:检查pdfopen命令是否支持基本参数"
|
||||
if ! pdfopen --help 2>&1 | grep -q "pdfopen"; then
|
||||
LOG_ERROR "pdfopen命令参数检查失败或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "步骤4:安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:创建一个测试用的PDF文件"
|
||||
cat > /tmp/test.pdf << "EOF"
|
||||
%PDF-1.4
|
||||
1 0 obj
|
||||
<<
|
||||
/Type /Catalog
|
||||
/Pages 2 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Type /Pages
|
||||
/Kids [3 0 R]
|
||||
/Count 1
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 612 792]
|
||||
>>
|
||||
endobj
|
||||
xref
|
||||
0 4
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000053 00000 n
|
||||
0000000102 00000 n
|
||||
trailer
|
||||
<<
|
||||
/Size 4
|
||||
/Root 1 0 R
|
||||
>>
|
||||
startxref
|
||||
149
|
||||
%%EOF
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
LOG_INFO "步骤6:执行pdfopen命令打开PDF文件"
|
||||
pdfopen /tmp/test.pdf &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
CHECK_RESULT $? 0 0 "执行pdfopen命令失败"
|
||||
|
||||
LOG_INFO "步骤7:检查pdfopen进程是否在运行"
|
||||
if ps -p $PDFOPEN_PID > /dev/null; then
|
||||
LOG_INFO "pdfopen进程正在运行,命令执行成功"
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
else
|
||||
LOG_ERROR "pdfopen进程未在运行,命令执行失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8:清理临时测试文件"
|
||||
rm -f /tmp/test.pdf
|
||||
CHECK_RESULT $? 0 0 "删除临时测试文件失败"
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "步骤9:卸载测试安装的texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试pdfopen打开PDF文件到命名目的地
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查环境是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查texlive-xpdfopen是否已安装"
|
||||
rpm -q texlive-xpdfopen
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,将在测试过程中安装"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "yum源中没有texlive-xpdfopen软件包"
|
||||
|
||||
# 如果未安装,则安装texlive-xpdfopen
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 创建测试用的PDF文件
|
||||
LOG_INFO "创建测试用的PDF文件"
|
||||
cat > test_dest.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Test PDF for pdfopen destination.
|
||||
\end{document}
|
||||
EOF
|
||||
pdflatex test_dest.tex
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
# 测试pdfopen打开PDF文件到命名目的地
|
||||
LOG_INFO "测试pdfopen打开PDF文件到命名目的地"
|
||||
pdfopen --dest test_dest.pdf test_dest.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen打开PDF文件到命名目的地失败"
|
||||
|
||||
# 清理创建的测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_dest.tex test_dest.aux test_dest.log test_dest.pdf
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果之前未安装,则卸载texlive-xpdfopen
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,157 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试pdfopen打开PDF文件到指定页码
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查是否已安装texlive-xpdfopen软件包"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-xpdfopen软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-xpdfopen
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 创建测试用的PDF文件
|
||||
LOG_INFO "创建测试用的PDF文件"
|
||||
cat > /tmp/test.pdf << EOF
|
||||
%PDF-1.4
|
||||
1 0 obj
|
||||
<<
|
||||
/Type /Catalog
|
||||
/Pages 2 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Type /Pages
|
||||
/Kids [3 0 R 4 0 R]
|
||||
/Count 2
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 612 792]
|
||||
/Contents 5 0 R
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 612 792]
|
||||
/Contents 6 0 R
|
||||
>>
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/Length 44
|
||||
>>
|
||||
stream
|
||||
BT
|
||||
/F1 12 Tf
|
||||
100 700 Td
|
||||
(Page 1) Tj
|
||||
ET
|
||||
endstream
|
||||
endobj
|
||||
6 0 obj
|
||||
<<
|
||||
/Length 44
|
||||
>>
|
||||
stream
|
||||
BT
|
||||
/F1 12 Tf
|
||||
100 700 Td
|
||||
(Page 2) Tj
|
||||
ET
|
||||
endstream
|
||||
endobj
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000053 00000 n
|
||||
0000000102 00000 n
|
||||
0000000209 00000 n
|
||||
0000000300 00000 n
|
||||
0000000391 00000 n
|
||||
trailer
|
||||
<<
|
||||
/Size 7
|
||||
/Root 1 0 R
|
||||
>>
|
||||
startxref
|
||||
480
|
||||
%%EOF
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
# 测试pdfopen打开PDF文件到指定页码
|
||||
LOG_INFO "测试pdfopen打开PDF文件到指定页码"
|
||||
pdfopen --page 2 /tmp/test.pdf > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen打开PDF文件到指定页码失败"
|
||||
|
||||
# 测试pdfopen参数不存在或不支持的情况
|
||||
LOG_INFO "测试pdfopen参数不存在或不支持的情况"
|
||||
pdfopen --nonexistent /tmp/test.pdf > /dev/null 2>&1
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_INFO "pdfopen参数检查正常,不支持参数时返回255"
|
||||
else
|
||||
LOG_ERROR "pdfopen参数检查异常,不支持参数时未返回255"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f /tmp/test.pdf
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载texlive-xpdfopen
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,190 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试pdfopen使用指定查看器打开PDF文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试pdfopen使用指定查看器打开PDF文件
|
||||
|
||||
LOG_INFO "开始测试pdfopen使用指定查看器打开PDF文件"
|
||||
|
||||
# 检查是否已安装texlive-xpdfopen软件包
|
||||
LOG_INFO "检查是否已安装texlive-xpdfopen软件包"
|
||||
rpm -q texlive-xpdfopen
|
||||
installed_status=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ $installed_status -eq 0 ]; then
|
||||
LOG_INFO "检测到texlive-xpdfopen已安装"
|
||||
initially_installed=true
|
||||
else
|
||||
LOG_INFO "检测到texlive-xpdfopen未安装"
|
||||
initially_installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$initially_installed" = false ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 检查pdfopen命令是否存在
|
||||
LOG_INFO "检查pdfopen命令是否存在"
|
||||
which pdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen命令不存在"
|
||||
# 清理环境
|
||||
if [ "$initially_installed" = false ]; then
|
||||
LOG_INFO "清理环境:卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试PDF文件
|
||||
LOG_INFO "创建测试PDF文件"
|
||||
cat > /tmp/test_pdfopen.pdf << "EOF"
|
||||
%PDF-1.4
|
||||
1 0 obj
|
||||
<<
|
||||
/Type /Catalog
|
||||
/Pages 2 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Type /Pages
|
||||
/Kids [3 0 R]
|
||||
/Count 1
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 612 792]
|
||||
/Contents 4 0 R
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Length 44
|
||||
>>
|
||||
stream
|
||||
BT
|
||||
/F1 12 Tf
|
||||
100 700 Td
|
||||
(Test PDF for pdfopen) Tj
|
||||
ET
|
||||
endstream
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
endobj
|
||||
xref
|
||||
0 6
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000053 00000 n
|
||||
0000000102 00000 n
|
||||
0000000156 00000 n
|
||||
0000000258 00000 n
|
||||
trailer
|
||||
<<
|
||||
/Size 6
|
||||
/Root 1 0 R
|
||||
>>
|
||||
startxref
|
||||
350
|
||||
%%EOF
|
||||
EOF
|
||||
|
||||
# 检查测试PDF文件是否创建成功
|
||||
LOG_INFO "验证测试PDF文件是否创建成功"
|
||||
if [ ! -f /tmp/test_pdfopen.pdf ]; then
|
||||
LOG_ERROR "测试PDF文件创建失败"
|
||||
# 清理环境
|
||||
if [ "$initially_installed" = false ]; then
|
||||
LOG_INFO "清理环境:卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 测试pdfopen命令的基本功能
|
||||
LOG_INFO "测试pdfopen命令基本功能"
|
||||
pdfopen --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令基本功能测试失败"
|
||||
|
||||
# 测试pdfopen使用指定查看器参数
|
||||
LOG_INFO "测试pdfopen使用--viewer参数"
|
||||
pdfopen --viewer xdg-open /tmp/test_pdfopen.pdf > /dev/null 2>&1
|
||||
# 注意:这里我们期望命令执行失败,因为xdg-open可能不存在或无法打开PDF
|
||||
# 我们主要测试的是参数是否被支持
|
||||
CHECK_RESULT $? 1 0 "pdfopen --viewer参数测试失败"
|
||||
|
||||
# 测试pdfopen不支持无效参数
|
||||
LOG_INFO "测试pdfopen不支持无效参数"
|
||||
pdfopen --invalid-parameter /tmp/test_pdfopen.pdf > /dev/null 2>&1
|
||||
if [ $? -ne 255 ] && [ $? -ne 1 ]; then
|
||||
LOG_ERROR "pdfopen应该对无效参数返回错误"
|
||||
# 清理环境
|
||||
if [ "$initially_installed" = false ]; then
|
||||
LOG_INFO "清理环境:卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
rm -f /tmp/test_pdfopen.pdf
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试pdfopen打开不存在的文件
|
||||
LOG_INFO "测试pdfopen打开不存在的文件"
|
||||
pdfopen /tmp/nonexistent.pdf > /dev/null 2>&1
|
||||
CHECK_RESULT $? 1 0 "pdfopen打开不存在文件测试失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f /tmp/test_pdfopen.pdf
|
||||
|
||||
# 根据初始状态决定是否卸载软件包
|
||||
if [ "$initially_installed" = false ]; then
|
||||
LOG_INFO "清理环境:卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
else
|
||||
LOG_INFO "保持texlive-xpdfopen安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试pdfopen使用指定查看器打开PDF文件完成"
|
||||
}
|
||||
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包texlive-xpdfopen的卸载功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试软件包texlive-xpdfopen的卸载功能"
|
||||
|
||||
LOG_INFO "1. 检查当前环境是否已安装texlive-xpdfopen"
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_INFO "当前环境已安装texlive-xpdfopen,测试完成后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "当前环境未安装texlive-xpdfopen,将在测试前安装,测试后卸载"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "2. 检查yum源中是否存在texlive-xpdfopen软件包"
|
||||
if ! dnf list available texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "3. 安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "4. 验证软件包安装成功"
|
||||
dnf list installed texlive-xpdfopen &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "texlive-xpdfopen安装后验证失败"
|
||||
|
||||
LOG_INFO "5. 测试卸载功能"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
|
||||
LOG_INFO "6. 验证软件包已卸载"
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "卸载后texlive-xpdfopen仍然存在"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen已成功卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "7. 环境恢复"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "true" ]; then
|
||||
LOG_INFO "恢复原始安装状态:重新安装texlive-xpdfopen"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "恢复安装texlive-xpdfopen失败"
|
||||
else
|
||||
LOG_INFO "原始状态即为未安装,无需额外操作"
|
||||
fi
|
||||
|
||||
LOG_INFO "8. 最终验证"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "true" ]; then
|
||||
dnf list installed texlive-xpdfopen &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "环境恢复后texlive-xpdfopen未安装"
|
||||
LOG_INFO "环境已恢复,texlive-xpdfopen已安装"
|
||||
else
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "环境恢复后texlive-xpdfopen不应存在"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "环境已恢复,texlive-xpdfopen未安装"
|
||||
fi
|
||||
fi
|
||||
|
||||
LOG_INFO "测试软件包texlive-xpdfopen的卸载功能完成"
|
||||
}
|
||||
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试pdfopen/pdfclose命令的版本信息显示
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试pdfopen/pdfclose命令的版本信息显示功能"
|
||||
LOG_INFO "步骤1: 检查环境中是否已经安装了texlive-xpdfopen软件包"
|
||||
rpm -q texlive-xpdfopen &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen已经安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查yum源中是否存在texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3: 安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 测试pdfopen命令的版本信息显示"
|
||||
pdfopen --version &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen命令不支持--version参数"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
pdfopen --version
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令版本信息显示失败"
|
||||
|
||||
LOG_INFO "步骤5: 测试pdfclose命令的版本信息显示"
|
||||
pdfclose --version &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfclose命令不支持--version参数"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
pdfclose --version
|
||||
CHECK_RESULT $? 0 0 "pdfclose命令版本信息显示失败"
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤6: 清理环境,卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 不带任何参数执行pdfclose命令,关闭默认的PDF查看器
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试脚本开始
|
||||
# 步骤1:检查环境是否已安装texlive-xpdfopen软件包
|
||||
LOG_INFO "检查环境是否已安装texlive-xpdfopen软件包"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "环境已安装texlive-xpdfopen软件包,标记为已安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "环境未安装texlive-xpdfopen软件包,标记为未安装状态"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 步骤2:检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装texlive-xpdfopen软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen软件包失败"
|
||||
LOG_INFO "texlive-xpdfopen软件包安装成功"
|
||||
fi
|
||||
|
||||
# 步骤4:检查pdfclose命令是否存在
|
||||
LOG_INFO "检查pdfclose命令是否存在"
|
||||
which pdfclose > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfclose命令不存在"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen软件包失败"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:不带任何参数执行pdfclose命令
|
||||
LOG_INFO "不带任何参数执行pdfclose命令"
|
||||
pdfclose
|
||||
CHECK_RESULT $? 0 0 "执行pdfclose命令失败"
|
||||
|
||||
# 步骤6:清理环境,恢复到之前的状态
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen软件包失败"
|
||||
LOG_INFO "texlive-xpdfopen软件包卸载成功"
|
||||
else
|
||||
LOG_INFO "环境保持安装状态,无需卸载"
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 使用-H参数执行pdfclose命令,显示帮助信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试环境初始化检查
|
||||
LOG_INFO "检查是否已安装texlive-xpdfopen软件包"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "检测到texlive-xpdfopen已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_FLAG=1
|
||||
else
|
||||
LOG_INFO "未检测到texlive-xpdfopen安装,测试结束后将卸载软件包"
|
||||
INSTALLED_FLAG=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
LOG_INFO "texlive-xpdfopen安装成功"
|
||||
fi
|
||||
|
||||
# 检查pdfclose命令是否存在
|
||||
LOG_INFO "检查pdfclose命令是否存在"
|
||||
which pdfclose > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfclose命令不存在"
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查pdfclose命令是否支持-H参数
|
||||
LOG_INFO "检查pdfclose命令是否支持-H参数"
|
||||
pdfclose -H > /dev/null 2>&1
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "pdfclose命令不支持-H参数"
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行测试用例:使用-H参数执行pdfclose命令,显示帮助信息
|
||||
LOG_INFO "执行测试:使用-H参数执行pdfclose命令,显示帮助信息"
|
||||
pdfclose -H
|
||||
CHECK_RESULT $? 0 0 "pdfclose -H命令执行失败"
|
||||
|
||||
# 环境清理
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "清理测试环境,卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
LOG_INFO "环境清理完成"
|
||||
else
|
||||
LOG_INFO "测试完成,保持texlive-xpdfopen安装状态"
|
||||
fi
|
||||
}
|
||||
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 使用-V参数执行pdfclose命令,显示版本信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试脚本开始
|
||||
# 检查是否已安装texlive-xpdfopen软件包
|
||||
LOG_INFO "检查是否已安装texlive-xpdfopen软件包"
|
||||
if rpm -q texlive-xpdfopen &> /dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen已安装,脚本结束时保持安装状态"
|
||||
INSTALLED="yes"
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,将在测试过程中安装"
|
||||
INSTALLED="no"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
if ! dnf list available texlive-xpdfopen &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-xpdfopen
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 检查pdfclose命令是否存在
|
||||
LOG_INFO "检查pdfclose命令是否存在"
|
||||
if ! command -v pdfclose &> /dev/null; then
|
||||
LOG_ERROR "pdfclose命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查pdfclose命令是否支持-V参数
|
||||
LOG_INFO "检查pdfclose命令是否支持-V参数"
|
||||
pdfclose -V &> /dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "pdfclose命令不支持-V参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 使用-V参数执行pdfclose命令,显示版本信息
|
||||
LOG_INFO "使用-V参数执行pdfclose命令,显示版本信息"
|
||||
pdfclose -V
|
||||
CHECK_RESULT $? 0 0 "pdfclose -V命令执行失败"
|
||||
|
||||
# 如果测试前未安装,则卸载texlive-xpdfopen软件包
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --file 参数和文件参数,明确指定文件参数打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查texlive-xpdfopen软件包是否在yum源中
|
||||
LOG_INFO "检查texlive-xpdfopen软件包是否在yum源中"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查系统是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查系统是否已安装texlive-xpdfopen"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
INSTALLED="true"
|
||||
LOG_INFO "系统已安装texlive-xpdfopen"
|
||||
else
|
||||
INSTALLED="false"
|
||||
LOG_INFO "系统未安装texlive-xpdfopen,将进行安装"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 检查pdfopen命令是否支持--file参数
|
||||
LOG_INFO "检查pdfopen命令是否支持--file参数"
|
||||
pdfopen --help 2>&1 | grep -q "\-\-file"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen命令不支持--file参数"
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试用PDF文件
|
||||
LOG_INFO "创建测试用PDF文件"
|
||||
TEST_PDF="/tmp/test_pdfopen.pdf"
|
||||
echo "%PDF-1.4" > "$TEST_PDF"
|
||||
echo "1 0 obj" >> "$TEST_PDF"
|
||||
echo "<</Type/Catalog/Pages 2 0 R>>" >> "$TEST_PDF"
|
||||
echo "endobj" >> "$TEST_PDF"
|
||||
echo "2 0 obj" >> "$TEST_PDF"
|
||||
echo "<</Type/Pages/Kids[]/Count 0>>" >> "$TEST_PDF"
|
||||
echo "endobj" >> "$TEST_PDF"
|
||||
echo "xref" >> "$TEST_PDF"
|
||||
echo "0 3" >> "$TEST_PDF"
|
||||
echo "0000000000 65535 f" >> "$TEST_PDF"
|
||||
echo "0000000010 00000 n" >> "$TEST_PDF"
|
||||
echo "0000000053 00000 n" >> "$TEST_PDF"
|
||||
echo "trailer" >> "$TEST_PDF"
|
||||
echo "<</Size 3/Root 1 0 R>>" >> "$TEST_PDF"
|
||||
echo "startxref" >> "$TEST_PDF"
|
||||
echo "99" >> "$TEST_PDF"
|
||||
echo "%%EOF" >> "$TEST_PDF"
|
||||
|
||||
# 测试pdfopen的--file参数和文件参数
|
||||
LOG_INFO "测试pdfopen的--file参数和文件参数"
|
||||
pdfopen --file "$TEST_PDF" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "使用--file参数打开PDF文件失败"
|
||||
|
||||
# 清理测试PDF文件
|
||||
LOG_INFO "清理测试PDF文件"
|
||||
rm -f "$TEST_PDF"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,133 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -g 参数和文件参数,指定命名目的地打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查texlive-xpdfopen是否已安装
|
||||
LOG_INFO "检查texlive-xpdfopen是否已安装"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen已安装"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中不存在texlive-xpdfopen软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-xpdfopen
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen"
|
||||
dnf install -y texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 创建测试PDF文件
|
||||
LOG_INFO "创建测试PDF文件"
|
||||
cat > test.pdf << EOF
|
||||
%PDF-1.4
|
||||
1 0 obj
|
||||
<<
|
||||
/Type /Catalog
|
||||
/Pages 2 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Type /Pages
|
||||
/Kids [3 0 R]
|
||||
/Count 1
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 612 792]
|
||||
/Contents 4 0 R
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Length 44
|
||||
>>
|
||||
stream
|
||||
BT
|
||||
/F1 12 Tf
|
||||
72 720 Td
|
||||
(Hello World) Tj
|
||||
ET
|
||||
endstream
|
||||
endobj
|
||||
xref
|
||||
0 5
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000053 00000 n
|
||||
0000000102 00000 n
|
||||
0000000172 00000 n
|
||||
trailer
|
||||
<<
|
||||
/Size 5
|
||||
/Root 1 0 R
|
||||
>>
|
||||
startxref
|
||||
242
|
||||
%%EOF
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
# 测试pdfopen命令是否存在
|
||||
LOG_INFO "测试pdfopen命令是否存在"
|
||||
which pdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令不存在"
|
||||
|
||||
# 测试pdfopen的-g参数
|
||||
LOG_INFO "测试pdfopen的-g参数"
|
||||
pdfopen -g test.pdf > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen -g参数不支持或执行失败"
|
||||
|
||||
# 测试pdfopen的文件参数
|
||||
LOG_INFO "测试pdfopen的文件参数"
|
||||
pdfopen test.pdf > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen文件参数执行失败"
|
||||
|
||||
# 清理测试PDF文件
|
||||
LOG_INFO "清理测试PDF文件"
|
||||
rm -f test.pdf
|
||||
CHECK_RESULT $? 0 0 "删除测试PDF文件失败"
|
||||
|
||||
# 如果之前未安装,则卸载texlive-xpdfopen
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen"
|
||||
dnf remove -y texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
fi
|
||||
}
|
||||
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --goto 参数和文件参数,指定命名目的地打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 pdfopen 的 --goto 参数和文件参数,指定命名目的地打开PDF文件。"
|
||||
|
||||
LOG_INFO "步骤1: 检查测试环境是否已安装 texlive-xpdfopen 软件包"
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen 已安装,测试后保持安装状态。"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen 未安装,将在测试步骤中安装。"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查 yum 源中是否存在 texlive-xpdfopen 软件包"
|
||||
if ! dnf list available texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-xpdfopen 软件包。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤3: 安装 texlive-xpdfopen 软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-xpdfopen 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 检查 pdfopen 命令是否支持 --goto 参数"
|
||||
pdfopen --help 2>&1 | grep -q -- "--goto"
|
||||
CHECK_RESULT $? 0 0 "pdfopen 命令不支持 --goto 参数"
|
||||
LOG_INFO "步骤5: 检查 pdfopen 命令是否支持文件参数"
|
||||
pdfopen --help 2>&1 | grep -q "FILE"
|
||||
CHECK_RESULT $? 0 0 "pdfopen 命令不支持文件参数"
|
||||
|
||||
LOG_INFO "步骤6: 创建一个简单的测试 PDF 文件用于测试"
|
||||
cat > /tmp/test_document.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{hyperref}
|
||||
\begin{document}
|
||||
\section{Test Section}
|
||||
This is a test PDF document.
|
||||
\newpage
|
||||
\hypertarget{dest1}{}
|
||||
This is the named destination.
|
||||
\end{document}
|
||||
EOF
|
||||
pdflatex -interaction=nonstopmode -output-directory=/tmp /tmp/test_document.tex >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败"
|
||||
TEST_PDF="/tmp/test_document.pdf"
|
||||
if [ ! -f "$TEST_PDF" ]; then
|
||||
LOG_ERROR "生成的测试 PDF 文件不存在。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7: 测试 pdfopen 命令使用 --goto 参数和文件参数打开 PDF 文件"
|
||||
LOG_INFO "注意: 此命令会尝试打开一个 PDF 查看器窗口。在无图形界面的测试环境中可能会失败。"
|
||||
pdfopen --goto dest1 "$TEST_PDF" 2>&1
|
||||
CMD_EXIT_CODE=$?
|
||||
if [ $CMD_EXIT_CODE -ne 0 ]; then
|
||||
LOG_INFO "pdfopen 命令执行返回非零值 $CMD_EXIT_CODE。这可能是因为环境中没有可用的 PDF 查看器。"
|
||||
LOG_INFO "我们将检查命令是否至少尝试解析了参数。"
|
||||
if [ $CMD_EXIT_CODE -eq 255 ]; then
|
||||
LOG_ERROR "pdfopen 命令因参数错误失败。"
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $CMD_EXIT_CODE 0 1 "pdfopen 命令执行失败,但非参数错误"
|
||||
else
|
||||
CHECK_RESULT $CMD_EXIT_CODE 0 0 "pdfopen 命令执行失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8: 清理测试生成的临时文件"
|
||||
rm -f /tmp/test_document.* /tmp/texput.log
|
||||
|
||||
LOG_INFO "步骤9: 环境恢复"
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "卸载在测试中安装的 texlive-xpdfopen 软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装 texlive-xpdfopen,保持安装状态。"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成。"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -h 参数,显示帮助信息。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试pdfopen命令的-h参数,显示帮助信息
|
||||
|
||||
LOG_INFO "开始测试pdfopen的-h参数功能"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-xpdfopen"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "步骤1:检查${PACKAGE_NAME}软件包是否已安装"
|
||||
if dnf list installed ${PACKAGE_NAME} &>/dev/null; then
|
||||
LOG_INFO "${PACKAGE_NAME}软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "${PACKAGE_NAME}软件包未安装,将在测试过程中安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有${PACKAGE_NAME}软件包"
|
||||
if ! dnf list available ${PACKAGE_NAME} &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "${INSTALLED_BEFORE}" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包"
|
||||
dnf install -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败"
|
||||
fi
|
||||
|
||||
# 检查pdfopen命令是否存在
|
||||
LOG_INFO "步骤4:检查pdfopen命令是否存在"
|
||||
if ! command -v pdfopen &>/dev/null; then
|
||||
LOG_ERROR "pdfopen命令不存在"
|
||||
if [ "${INSTALLED_BEFORE}" = "false" ]; then
|
||||
LOG_INFO "清理环境:卸载${PACKAGE_NAME}软件包"
|
||||
dnf remove -y ${PACKAGE_NAME} &>/dev/null
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试pdfopen的-h参数
|
||||
LOG_INFO "步骤5:测试pdfopen的-h参数"
|
||||
pdfopen -h > /tmp/pdfopen_help_output.txt 2>&1
|
||||
PDFOPEN_EXIT_CODE=$?
|
||||
|
||||
# 检查命令执行结果
|
||||
if [ ${PDFOPEN_EXIT_CODE} -eq 0 ]; then
|
||||
LOG_INFO "pdfopen -h命令执行成功"
|
||||
# 检查输出是否包含帮助信息
|
||||
if grep -q -i "usage\|help\|选项\|参数" /tmp/pdfopen_help_output.txt; then
|
||||
LOG_INFO "帮助信息显示正常"
|
||||
CHECK_RESULT 0 0 0 "帮助信息显示异常"
|
||||
else
|
||||
LOG_ERROR "输出中未找到帮助信息"
|
||||
CHECK_RESULT 1 0 0 "帮助信息内容不符合预期"
|
||||
fi
|
||||
elif [ ${PDFOPEN_EXIT_CODE} -eq 255 ]; then
|
||||
LOG_ERROR "pdfopen命令不支持-h参数"
|
||||
exit 255
|
||||
else
|
||||
LOG_ERROR "pdfopen -h命令执行失败,退出码: ${PDFOPEN_EXIT_CODE}"
|
||||
CHECK_RESULT ${PDFOPEN_EXIT_CODE} 0 0 "pdfopen -h命令执行失败"
|
||||
fi
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "步骤6:清理临时文件"
|
||||
rm -f /tmp/pdfopen_help_output.txt
|
||||
CHECK_RESULT $? 0 0 "清理临时文件失败"
|
||||
|
||||
# 环境恢复
|
||||
LOG_INFO "步骤7:恢复测试环境"
|
||||
if [ "${INSTALLED_BEFORE}" = "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 "pdfopen -h参数测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --help 参数,显示帮助信息。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查texlive-xpdfopen是否已安装"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
installed_status=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ $installed_status -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen已安装,测试后保持安装状态"
|
||||
already_installed=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,测试后将卸载"
|
||||
already_installed=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen包
|
||||
LOG_INFO "检查yum源中是否存在texlive-xpdfopen包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-xpdfopen"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 检查pdfopen命令是否存在
|
||||
LOG_INFO "检查pdfopen命令是否存在"
|
||||
which pdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试pdfopen的--help参数
|
||||
LOG_INFO "测试pdfopen --help参数"
|
||||
pdfopen --help > /dev/null 2>&1
|
||||
help_result=$?
|
||||
|
||||
# 检查--help参数是否支持
|
||||
if [ $help_result -eq 255 ]; then
|
||||
LOG_ERROR "pdfopen不支持--help参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查命令执行是否成功
|
||||
CHECK_RESULT $help_result 0 0 "pdfopen --help执行失败"
|
||||
|
||||
# 验证帮助信息是否显示
|
||||
LOG_INFO "验证帮助信息显示"
|
||||
pdfopen --help 2>&1 | head -5 | grep -i "usage\|help\|选项" > /dev/null
|
||||
CHECK_RESULT $? 0 0 "帮助信息未正确显示"
|
||||
|
||||
# 环境清理
|
||||
LOG_INFO "开始环境清理"
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
else
|
||||
LOG_INFO "保持texlive-xpdfopen安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,176 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -p 参数和文件参数,指定页码打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试 pdfopen 的 -p 参数和文件参数,指定页码打开PDF文件
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-xpdfopen"
|
||||
|
||||
# 检查软件包是否已在yum源中
|
||||
LOG_INFO "检查软件包 ${PACKAGE_NAME} 是否在yum源中"
|
||||
dnf list available ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 在yum源中"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查软件包 ${PACKAGE_NAME} 是否已安装"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 已安装"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 未安装"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "${INSTALLED}" == "false" ]; then
|
||||
LOG_INFO "安装软件包 ${PACKAGE_NAME}"
|
||||
dnf install -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败"
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 安装成功"
|
||||
fi
|
||||
|
||||
# 创建测试用的PDF文件
|
||||
LOG_INFO "创建测试用的PDF文件"
|
||||
cat > /tmp/test_pdf.pdf << EOF
|
||||
%PDF-1.4
|
||||
1 0 obj
|
||||
<<
|
||||
/Type /Catalog
|
||||
/Pages 2 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Type /Pages
|
||||
/Kids [3 0 R]
|
||||
/Count 1
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 612 792]
|
||||
/Contents 4 0 R
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Length 44
|
||||
>>
|
||||
stream
|
||||
BT
|
||||
/F1 12 Tf
|
||||
72 720 Td
|
||||
(Hello World) Tj
|
||||
ET
|
||||
endstream
|
||||
endobj
|
||||
xref
|
||||
0 5
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000053 00000 n
|
||||
0000000101 00000 n
|
||||
0000000176 00000 n
|
||||
trailer
|
||||
<<
|
||||
/Size 5
|
||||
/Root 1 0 R
|
||||
>>
|
||||
startxref
|
||||
242
|
||||
%%EOF
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
# 测试 pdfopen 命令是否存在
|
||||
LOG_INFO "检查 pdfopen 命令是否存在"
|
||||
which pdfopen &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen 命令不存在"
|
||||
|
||||
# 测试 pdfopen -p 参数
|
||||
LOG_INFO "测试 pdfopen 的 -p 参数"
|
||||
pdfopen -h 2>&1 | grep -q "\-p"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen 不支持 -p 参数"
|
||||
# 清理测试文件
|
||||
rm -f /tmp/test_pdf.pdf
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "${INSTALLED}" == "false" ]; then
|
||||
LOG_INFO "卸载软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败"
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 卸载成功"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "pdfopen 支持 -p 参数"
|
||||
|
||||
# 测试 pdfopen -p 参数和文件参数
|
||||
LOG_INFO "测试 pdfopen 的 -p 参数和文件参数,指定页码打开PDF文件"
|
||||
pdfopen -p 1 /tmp/test_pdf.pdf &>/dev/null &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
# 检查进程是否在运行
|
||||
ps -p ${PDFOPEN_PID} &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "pdfopen 成功打开PDF文件指定页码"
|
||||
kill ${PDFOPEN_PID} 2>/dev/null
|
||||
else
|
||||
LOG_ERROR "pdfopen 打开PDF文件指定页码失败"
|
||||
# 清理测试文件
|
||||
rm -f /tmp/test_pdf.pdf
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "${INSTALLED}" == "false" ]; then
|
||||
LOG_INFO "卸载软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败"
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 卸载成功"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f /tmp/test_pdf.pdf
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "${INSTALLED}" == "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,120 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --page 参数和文件参数,指定页码打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 texlive-xpdfopen 软件包的 pdfopen 命令"
|
||||
LOG_INFO "检查是否已安装 texlive-xpdfopen"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen 已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen 未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
LOG_INFO "检查 yum 源中是否存在 texlive-xpdfopen 软件包"
|
||||
dnf list texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-xpdfopen 软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装 texlive-xpdfopen"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-xpdfopen 失败"
|
||||
fi
|
||||
LOG_INFO "检查 pdfopen 命令是否支持 --page 参数"
|
||||
pdfopen --help 2>&1 | grep -q "\-\-page"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen 命令不支持 --page 参数"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 texlive-xpdfopen"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "创建一个测试 PDF 文件"
|
||||
cat > test.pdf << "EOF"
|
||||
%PDF-1.4
|
||||
1 0 obj
|
||||
<<
|
||||
/Type /Catalog
|
||||
/Pages 2 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Type /Pages
|
||||
/Kids [3 0 R]
|
||||
/Count 1
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/Parent 2 0 R
|
||||
/MediaBox [0 0 612 792]
|
||||
/Contents 4 0 R
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Length 44
|
||||
>>
|
||||
stream
|
||||
BT
|
||||
/F1 12 Tf
|
||||
72 720 Td
|
||||
(Test Page) Tj
|
||||
ET
|
||||
endstream
|
||||
endobj
|
||||
xref
|
||||
0 5
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000053 00000 n
|
||||
0000000102 00000 n
|
||||
0000000170 00000 n
|
||||
trailer
|
||||
<<
|
||||
/Size 5
|
||||
/Root 1 0 R
|
||||
>>
|
||||
startxref
|
||||
281
|
||||
%%EOF
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败"
|
||||
LOG_INFO "测试 pdfopen 命令,指定 --page 参数和文件参数"
|
||||
pdfopen --page 1 test.pdf > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen --page 1 test.pdf 执行失败"
|
||||
LOG_INFO "清理测试 PDF 文件"
|
||||
rm -f test.pdf
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 texlive-xpdfopen"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
fi
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,105 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -r 参数和文件参数,重置焦点并打开指定PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-xpdfopen"
|
||||
TEST_FILE="/tmp/test.pdf"
|
||||
|
||||
# 步骤1: 检查软件包是否在yum源中
|
||||
LOG_INFO "检查软件包是否在yum源中"
|
||||
dnf list available ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2: 检查是否已安装
|
||||
LOG_INFO "检查是否已安装 ${PACKAGE_NAME}"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
INSTALLED=$?
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,测试后将保持安装状态"
|
||||
NEED_UNINSTALL=0
|
||||
else
|
||||
LOG_INFO "软件包未安装,测试后将卸载"
|
||||
NEED_UNINSTALL=1
|
||||
fi
|
||||
|
||||
# 步骤3: 如果未安装则安装软件包
|
||||
if [ ${INSTALLED} -ne 0 ]; then
|
||||
LOG_INFO "安装软件包 ${PACKAGE_NAME}"
|
||||
dnf install -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4: 检查pdfopen命令是否存在
|
||||
LOG_INFO "检查pdfopen命令是否存在"
|
||||
which pdfopen &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令不存在"
|
||||
|
||||
# 步骤5: 创建测试PDF文件
|
||||
LOG_INFO "创建测试PDF文件"
|
||||
echo "%PDF-1.4" > ${TEST_FILE}
|
||||
echo "1 0 obj" >> ${TEST_FILE}
|
||||
echo "<</Type/Catalog/Pages 2 0 R>>" >> ${TEST_FILE}
|
||||
echo "endobj" >> ${TEST_FILE}
|
||||
echo "2 0 obj" >> ${TEST_FILE}
|
||||
echo "<</Type/Pages/Kids[]/Count 0>>" >> ${TEST_FILE}
|
||||
echo "endobj" >> ${TEST_FILE}
|
||||
echo "xref" >> ${TEST_FILE}
|
||||
echo "0 3" >> ${TEST_FILE}
|
||||
echo "0000000000 65535 f" >> ${TEST_FILE}
|
||||
echo "0000000010 00000 n" >> ${TEST_FILE}
|
||||
echo "0000000053 00000 n" >> ${TEST_FILE}
|
||||
echo "trailer" >> ${TEST_FILE}
|
||||
echo "<</Size 3/Root 1 0 R>>" >> ${TEST_FILE}
|
||||
echo "startxref" >> ${TEST_FILE}
|
||||
echo "92" >> ${TEST_FILE}
|
||||
echo "%%EOF" >> ${TEST_FILE}
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
# 步骤6: 测试pdfopen的-r参数
|
||||
LOG_INFO "测试pdfopen的-r参数"
|
||||
pdfopen -r ${TEST_FILE} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen -r 参数测试失败"
|
||||
|
||||
# 步骤7: 测试pdfopen的文件参数
|
||||
LOG_INFO "测试pdfopen的文件参数"
|
||||
pdfopen ${TEST_FILE} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen 文件参数测试失败"
|
||||
|
||||
# 步骤8: 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f ${TEST_FILE}
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 步骤9: 如果测试前未安装,则卸载软件包
|
||||
if [ ${NEED_UNINSTALL} -eq 1 ]; then
|
||||
LOG_INFO "卸载软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,94 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -r, --viewer, -g 参数和文件参数组合,重置焦点并使用指定查看器和命名目的地打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 pdfopen 的 -r, --viewer, -g 参数和文件参数组合"
|
||||
LOG_INFO "检查是否已安装 texlive-xpdfopen 软件包"
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen 已安装,脚本结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen 未安装,将安装软件包作为测试步骤"
|
||||
INSTALLED=false
|
||||
fi
|
||||
LOG_INFO "检查 yum 源中是否有 texlive-xpdfopen 软件包"
|
||||
if ! dnf list available texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-xpdfopen 软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装 texlive-xpdfopen 软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-xpdfopen 失败"
|
||||
fi
|
||||
LOG_INFO "创建一个测试用的 PDF 文件"
|
||||
echo "%PDF-1.4" > test.pdf
|
||||
echo "1 0 obj" >> test.pdf
|
||||
echo "<</Type/Catalog/Pages 2 0 R>>" >> test.pdf
|
||||
echo "endobj" >> test.pdf
|
||||
echo "2 0 obj" >> test.pdf
|
||||
echo "<</Type/Pages/Kids[]/Count 0>>" >> test.pdf
|
||||
echo "endobj" >> test.pdf
|
||||
echo "trailer" >> test.pdf
|
||||
echo "<</Root 1 0 R>>" >> test.pdf
|
||||
echo "%%EOF" >> test.pdf
|
||||
CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败"
|
||||
LOG_INFO "测试 pdfopen 的 -r 参数"
|
||||
pdfopen -r test.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen -r 执行失败"
|
||||
LOG_INFO "测试 pdfopen 的 --viewer 参数"
|
||||
pdfopen --viewer xdg-open test.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen --viewer 执行失败"
|
||||
LOG_INFO "测试 pdfopen 的 -g 参数"
|
||||
pdfopen -g test.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen -g 执行失败"
|
||||
LOG_INFO "测试 pdfopen 的 -r 和 --viewer 参数组合"
|
||||
pdfopen -r --viewer xdg-open test.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen -r --viewer 执行失败"
|
||||
LOG_INFO "测试 pdfopen 的 -r 和 -g 参数组合"
|
||||
pdfopen -r -g test.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen -r -g 执行失败"
|
||||
LOG_INFO "测试 pdfopen 的 --viewer 和 -g 参数组合"
|
||||
pdfopen --viewer xdg-open -g test.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen --viewer -g 执行失败"
|
||||
LOG_INFO "测试 pdfopen 的 -r、--viewer 和 -g 参数组合"
|
||||
pdfopen -r --viewer xdg-open -g test.pdf
|
||||
CHECK_RESULT $? 0 0 "pdfopen -r --viewer -g 执行失败"
|
||||
LOG_INFO "测试 pdfopen 文件参数不存在的情况"
|
||||
pdfopen nonexistent.pdf
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_INFO "文件参数不存在,pdfopen 按预期退出"
|
||||
else
|
||||
LOG_ERROR "文件参数不存在,但 pdfopen 未按预期退出"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.pdf
|
||||
CHECK_RESULT $? 0 0 "删除测试 PDF 文件失败"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 texlive-xpdfopen 软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
fi
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -r, --viewer, -p 参数和文件参数组合,重置焦点并使用指定查看器和页码打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 pdfopen 命令的参数组合:-r, --viewer, -p 和文件参数"
|
||||
LOG_INFO "步骤1:检查是否已安装 texlive-xpdfopen 软件包"
|
||||
rpm -q texlive-xpdfopen
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen 已安装,测试结束后保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen 未安装,将进行安装并在测试结束后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查 yum 源中是否有 texlive-xpdfopen 软件包"
|
||||
dnf list available texlive-xpdfopen
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中没有 texlive-xpdfopen 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装 texlive-xpdfopen 软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-xpdfopen 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查 pdfopen 命令是否存在"
|
||||
which pdfopen
|
||||
CHECK_RESULT $? 0 0 "pdfopen 命令不存在"
|
||||
|
||||
LOG_INFO "步骤5:测试 pdfopen 命令的基本用法,查看帮助信息"
|
||||
pdfopen --help
|
||||
CHECK_RESULT $? 0 0 "pdfopen 命令无法执行"
|
||||
|
||||
LOG_INFO "步骤6:测试 pdfopen 命令的 -r 参数(重置焦点)"
|
||||
pdfopen -r
|
||||
CHECK_RESULT $? 0 0 "pdfopen -r 参数执行失败"
|
||||
|
||||
LOG_INFO "步骤7:测试 pdfopen 命令的 --viewer 参数(指定查看器)"
|
||||
pdfopen --viewer
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "--viewer 参数需要指定查看器名称,但未提供"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8:测试 pdfopen 命令的 -p 参数(指定页码)"
|
||||
pdfopen -p
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "-p 参数需要指定页码,但未提供"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤9:测试 pdfopen 命令的文件参数"
|
||||
pdfopen
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "pdfopen 需要指定PDF文件,但未提供"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤10:测试 pdfopen 命令的 -r、--viewer、-p 参数和文件参数组合"
|
||||
pdfopen -r --viewer xpdf -p 1 /tmp/test.pdf 2>/dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "pdfopen 参数组合执行失败,可能是参数不支持或文件不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤11:清理测试环境"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载 texlive-xpdfopen 软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
else
|
||||
LOG_INFO "保持 texlive-xpdfopen 安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,198 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -r, --viewer, -p, -g 参数和文件参数组合,重置焦点并使用指定查看器、页码和命名目的地打开PDF文件(-g 应覆盖 -p)。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义测试用的PDF文件路径
|
||||
TEST_PDF="/tmp/test.pdf"
|
||||
# 定义测试用的查看器
|
||||
TEST_VIEWER="xpdf"
|
||||
# 定义测试用的页码
|
||||
TEST_PAGE="2"
|
||||
# 定义测试用的命名目的地
|
||||
TEST_NAMED_DEST="Chapter1"
|
||||
|
||||
# 创建测试用的PDF文件(使用简单文本生成)
|
||||
create_test_pdf() {
|
||||
LOG_INFO "创建测试PDF文件"
|
||||
echo "%PDF-1.4
|
||||
1 0 obj
|
||||
<< /Type /Catalog /Pages 2 0 R >>
|
||||
endobj
|
||||
2 0 obj
|
||||
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
|
||||
endobj
|
||||
3 0 obj
|
||||
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >>
|
||||
endobj
|
||||
4 0 obj
|
||||
<< /Length 44 >>
|
||||
stream
|
||||
BT /F1 12 Tf 100 700 Td (Test PDF) Tj ET
|
||||
endstream
|
||||
endobj
|
||||
xref
|
||||
0 5
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000053 00000 n
|
||||
0000000106 00000 n
|
||||
0000000172 00000 n
|
||||
trailer
|
||||
<< /Size 5 /Root 1 0 R >>
|
||||
startxref
|
||||
281
|
||||
%%EOF" > "$TEST_PDF"
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
}
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
check_package_in_repo() {
|
||||
LOG_INFO "检查软件包是否在yum源中"
|
||||
dnf list available texlive-xpdfopen 2>/dev/null | grep -q texlive-xpdfopen
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 texlive-xpdfopen 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "软件包 texlive-xpdfopen 不在yum源中"
|
||||
}
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_command_params() {
|
||||
LOG_INFO "检查 pdfopen 命令参数是否支持"
|
||||
pdfopen --help 2>&1 | grep -q -- "-r"
|
||||
CHECK_RESULT $? 0 0 "参数 -r 不支持"
|
||||
pdfopen --help 2>&1 | grep -q -- "--viewer"
|
||||
CHECK_RESULT $? 0 0 "参数 --viewer 不支持"
|
||||
pdfopen --help 2>&1 | grep -q -- "-p"
|
||||
CHECK_RESULT $? 0 0 "参数 -p 不支持"
|
||||
pdfopen --help 2>&1 | grep -q -- "-g"
|
||||
CHECK_RESULT $? 0 0 "参数 -g 不支持"
|
||||
}
|
||||
|
||||
# 安装软件包
|
||||
install_package() {
|
||||
LOG_INFO "安装 texlive-xpdfopen 软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-xpdfopen 失败"
|
||||
}
|
||||
|
||||
# 卸载软件包
|
||||
uninstall_package() {
|
||||
LOG_INFO "卸载 texlive-xpdfopen 软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
}
|
||||
|
||||
# 检查软件包是否已安装
|
||||
check_installed() {
|
||||
LOG_INFO "检查 texlive-xpdfopen 是否已安装"
|
||||
rpm -q texlive-xpdfopen >/dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
# 测试 pdfopen 命令
|
||||
test_pdfopen() {
|
||||
LOG_INFO "测试 pdfopen 命令的基本功能"
|
||||
pdfopen "$TEST_PDF" &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen 基本功能测试失败"
|
||||
|
||||
LOG_INFO "测试 pdfopen 命令的 -r 参数(重置焦点)"
|
||||
pdfopen -r "$TEST_PDF" &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen -r 参数测试失败"
|
||||
|
||||
LOG_INFO "测试 pdfopen 命令的 --viewer 参数(指定查看器)"
|
||||
pdfopen --viewer "$TEST_VIEWER" "$TEST_PDF" &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen --viewer 参数测试失败"
|
||||
|
||||
LOG_INFO "测试 pdfopen 命令的 -p 参数(指定页码)"
|
||||
pdfopen -p "$TEST_PAGE" "$TEST_PDF" &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen -p 参数测试失败"
|
||||
|
||||
LOG_INFO "测试 pdfopen 命令的 -g 参数(指定命名目的地)"
|
||||
pdfopen -g "$TEST_NAMED_DEST" "$TEST_PDF" &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen -g 参数测试失败"
|
||||
|
||||
LOG_INFO "测试 pdfopen 命令的 -g 参数覆盖 -p 参数"
|
||||
pdfopen -p "$TEST_PAGE" -g "$TEST_NAMED_DEST" "$TEST_PDF" &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdfopen -g 覆盖 -p 参数测试失败"
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
# 记录初始安装状态
|
||||
check_installed
|
||||
INITIAL_INSTALL_STATUS=$?
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
check_package_in_repo
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INITIAL_INSTALL_STATUS -ne 0 ]; then
|
||||
install_package
|
||||
fi
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_command_params
|
||||
|
||||
# 创建测试PDF文件
|
||||
create_test_pdf
|
||||
|
||||
# 测试 pdfopen 命令
|
||||
test_pdfopen
|
||||
|
||||
# 清理测试PDF文件
|
||||
LOG_INFO "清理测试PDF文件"
|
||||
rm -f "$TEST_PDF"
|
||||
CHECK_RESULT $? 0 0 "清理测试PDF文件失败"
|
||||
|
||||
# 如果初始未安装,则卸载软件包
|
||||
if [ $INITIAL_INSTALL_STATUS -ne 0 ]; then
|
||||
uninstall_package
|
||||
else
|
||||
LOG_INFO "保持 texlive-xpdfopen 安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
# 执行主函数
|
||||
main
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,106 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --reset_focus 参数和文件参数,重置焦点并打开指定PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查是否已安装texlive-xpdfopen软件包"
|
||||
rpm -q texlive-xpdfopen > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-xpdfopen已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
dnf list available texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-xpdfopen软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen软件包失败"
|
||||
fi
|
||||
|
||||
# 检查pdfopen命令是否存在
|
||||
LOG_INFO "检查pdfopen命令是否存在"
|
||||
command -v pdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令不存在"
|
||||
|
||||
# 检查pdfopen命令是否支持--reset_focus参数
|
||||
LOG_INFO "检查pdfopen命令是否支持--reset_focus参数"
|
||||
pdfopen --help 2>&1 | grep -q "\-\-reset_focus"
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令不支持--reset_focus参数"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen命令不支持--reset_focus参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建一个测试PDF文件
|
||||
LOG_INFO "创建测试PDF文件"
|
||||
TEST_PDF="/tmp/test_pdfopen.pdf"
|
||||
echo "%PDF-1.4" > $TEST_PDF
|
||||
echo "1 0 obj" >> $TEST_PDF
|
||||
echo "<</Type/Catalog/Pages 2 0 R>>" >> $TEST_PDF
|
||||
echo "endobj" >> $TEST_PDF
|
||||
echo "2 0 obj" >> $TEST_PDF
|
||||
echo "<</Type/Pages/Kids[]/Count 0>>" >> $TEST_PDF
|
||||
echo "endobj" >> $TEST_PDF
|
||||
echo "xref" >> $TEST_PDF
|
||||
echo "0 3" >> $TEST_PDF
|
||||
echo "0000000000 65535 f" >> $TEST_PDF
|
||||
echo "0000000010 00000 n" >> $TEST_PDF
|
||||
echo "0000000053 00000 n" >> $TEST_PDF
|
||||
echo "trailer" >> $TEST_PDF
|
||||
echo "<</Size 3/Root 1 0 R>>" >> $TEST_PDF
|
||||
echo "startxref" >> $TEST_PDF
|
||||
echo "99" >> $TEST_PDF
|
||||
echo "%%EOF" >> $TEST_PDF
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
# 测试pdfopen的--reset_focus参数和文件参数
|
||||
LOG_INFO "测试pdfopen的--reset_focus参数和文件参数"
|
||||
pdfopen --reset_focus $TEST_PDF > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen --reset_focus 文件参数 执行失败"
|
||||
|
||||
# 清理测试PDF文件
|
||||
LOG_INFO "清理测试PDF文件"
|
||||
rm -f $TEST_PDF
|
||||
CHECK_RESULT $? 0 0 "清理测试PDF文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen软件包失败"
|
||||
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-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -? 参数,显示帮助信息。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(根据要求直接使用,此处仅作兼容性定义以防未定义)
|
||||
LOG_INFO() { echo "[INFO] $*"; }
|
||||
LOG_ERROR() { echo "[ERROR] $*"; }
|
||||
|
||||
# 测试用例描述:测试 pdfopen 的 -? 参数,显示帮助信息。
|
||||
LOG_INFO "开始测试 pdfopen 的 -? 参数,显示帮助信息"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-xpdfopen"
|
||||
|
||||
# 步骤1:检查 yum 源中是否存在指定的软件包
|
||||
LOG_INFO "步骤1:检查 yum 源中是否存在软件包 $PACKAGE_NAME"
|
||||
dnf list available "$PACKAGE_NAME" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中未找到软件包 $PACKAGE_NAME"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查环境是否已经安装软件包
|
||||
LOG_INFO "步骤2:检查环境是否已经安装软件包 $PACKAGE_NAME"
|
||||
rpm -q "$PACKAGE_NAME" > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已经安装,测试结束后将保持安装状态"
|
||||
INSTALLED="yes"
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试中安装并在测试结束后卸载"
|
||||
INSTALLED="no"
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y "$PACKAGE_NAME" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查 pdfopen 命令是否支持 -? 参数
|
||||
LOG_INFO "步骤4:检查 pdfopen 命令是否支持 -? 参数"
|
||||
pdfopen -? > /dev/null 2>&1
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "pdfopen 命令不支持 -? 参数"
|
||||
# 如果是未安装的情况,需要先卸载软件包再退出
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "清理环境:卸载软件包 $PACKAGE_NAME"
|
||||
dnf remove -y "$PACKAGE_NAME" > /dev/null 2>&1
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:执行 pdfopen -? 命令并检查是否显示帮助信息
|
||||
LOG_INFO "步骤5:执行 pdfopen -? 命令并检查是否显示帮助信息"
|
||||
pdfopen -? 2>&1 | grep -i "usage" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen -? 未显示帮助信息"
|
||||
|
||||
# 步骤6:清理环境,如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "步骤6:清理环境,卸载软件包 $PACKAGE_NAME"
|
||||
dnf remove -y "$PACKAGE_NAME" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
|
||||
else
|
||||
LOG_INFO "步骤6:环境保持原状,软件包 $PACKAGE_NAME 保持安装"
|
||||
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 : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 -v 参数,显示版本号。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-xpdfopen
|
||||
LOG_INFO "检查是否已安装texlive-xpdfopen软件包"
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen已安装,脚本结束将保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen未安装,将在测试中安装并在结束前卸载"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-xpdfopen软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-xpdfopen软件包"
|
||||
if ! dnf list available texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "yum源中没有texlive-xpdfopen软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-xpdfopen软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装texlive-xpdfopen失败"
|
||||
fi
|
||||
|
||||
# 测试pdfopen命令的-v参数
|
||||
LOG_INFO "测试pdfopen命令的-v参数"
|
||||
pdfopen -v
|
||||
CHECK_RESULT $? 0 0 "pdfopen -v命令执行失败"
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-xpdfopen软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-xpdfopen失败"
|
||||
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 : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --version 参数,显示版本号。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 pdfopen --version 参数功能"
|
||||
|
||||
# 检查是否已安装 texlive-xpdfopen 包
|
||||
LOG_INFO "检查 texlive-xpdfopen 是否已安装"
|
||||
if dnf list installed texlive-xpdfopen &> /dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen 已安装,测试完成后将保持安装状态"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen 未安装,将进行安装并在测试后卸载"
|
||||
already_installed=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 texlive-xpdfopen 包
|
||||
LOG_INFO "检查 yum 源中是否存在 texlive-xpdfopen 包"
|
||||
if ! dnf list available texlive-xpdfopen &> /dev/null; then
|
||||
LOG_ERROR "yum 源中不存在 texlive-xpdfopen 包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装 texlive-xpdfopen
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "安装 texlive-xpdfopen 包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-xpdfopen 失败"
|
||||
fi
|
||||
|
||||
# 检查 pdfopen 命令是否支持 --version 参数
|
||||
LOG_INFO "检查 pdfopen 命令是否支持 --version 参数"
|
||||
if ! pdfopen --help 2>&1 | grep -q -- "--version"; then
|
||||
LOG_ERROR "pdfopen 命令不支持 --version 参数"
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "卸载 texlive-xpdfopen 包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行 pdfopen --version 命令
|
||||
LOG_INFO "执行 pdfopen --version 命令"
|
||||
pdfopen --version
|
||||
CHECK_RESULT $? 0 0 "执行 pdfopen --version 失败"
|
||||
|
||||
# 环境清理:如果之前未安装,则卸载 texlive-xpdfopen
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "卸载 texlive-xpdfopen 包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,154 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --viewer 参数和文件参数,使用指定查看器打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试pdfopen的--viewer参数和文件参数,使用指定查看器打开PDF文件
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-xpdfopen"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查软件包是否已安装"
|
||||
rpm -q $PACKAGE_NAME > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,标记为已安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "软件包未安装,标记为未安装状态"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有$PACKAGE_NAME软件包"
|
||||
dnf search $PACKAGE_NAME --quiet > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到$PACKAGE_NAME软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装$PACKAGE_NAME软件包"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败"
|
||||
fi
|
||||
|
||||
# 检查pdfopen命令是否存在
|
||||
LOG_INFO "检查pdfopen命令是否存在"
|
||||
which pdfopen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令不存在"
|
||||
|
||||
# 创建测试PDF文件
|
||||
LOG_INFO "创建测试PDF文件"
|
||||
TEST_PDF="/tmp/test_pdfopen.pdf"
|
||||
echo "%PDF-1.4" > $TEST_PDF
|
||||
echo "1 0 obj" >> $TEST_PDF
|
||||
echo "<< /Type /Catalog /Pages 2 0 R >>" >> $TEST_PDF
|
||||
echo "endobj" >> $TEST_PDF
|
||||
echo "2 0 obj" >> $TEST_PDF
|
||||
echo "<< /Type /Pages /Kids [] /Count 0 >>" >> $TEST_PDF
|
||||
echo "endobj" >> $TEST_PDF
|
||||
echo "xref" >> $TEST_PDF
|
||||
echo "0 3" >> $TEST_PDF
|
||||
echo "0000000000 65535 f" >> $TEST_PDF
|
||||
echo "0000000010 00000 n" >> $TEST_PDF
|
||||
echo "0000000053 00000 n" >> $TEST_PDF
|
||||
echo "trailer" >> $TEST_PDF
|
||||
echo "<< /Size 3 /Root 1 0 R >>" >> $TEST_PDF
|
||||
echo "startxref" >> $TEST_PDF
|
||||
echo "149" >> $TEST_PDF
|
||||
echo "%%EOF" >> $TEST_PDF
|
||||
|
||||
# 检查测试PDF文件是否创建成功
|
||||
LOG_INFO "检查测试PDF文件是否创建成功"
|
||||
[ -f $TEST_PDF ]
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
# 测试pdfopen的--viewer参数
|
||||
LOG_INFO "测试pdfopen的--viewer参数"
|
||||
# 先检查--viewer参数是否支持
|
||||
pdfopen --help 2>&1 | grep -q "\-\-viewer"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdfopen不支持--viewer参数"
|
||||
# 清理测试文件
|
||||
rm -f $TEST_PDF
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载$PACKAGE_NAME软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 使用指定的查看器打开PDF文件(这里使用evince作为示例查看器)
|
||||
LOG_INFO "使用指定查看器打开PDF文件"
|
||||
# 检查evince是否可用
|
||||
which evince > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
# 使用evince作为查看器
|
||||
pdfopen --viewer evince $TEST_PDF &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
# 检查pdfopen进程是否成功启动
|
||||
kill -0 $PDFOPEN_PID 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "pdfopen成功启动指定查看器"
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
else
|
||||
LOG_ERROR "pdfopen启动指定查看器失败"
|
||||
fi
|
||||
else
|
||||
LOG_INFO "evince不可用,尝试使用默认查看器"
|
||||
pdfopen $TEST_PDF &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
kill -0 $PDFOPEN_PID 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "pdfopen成功启动默认查看器"
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
else
|
||||
LOG_ERROR "pdfopen启动查看器失败"
|
||||
fi
|
||||
fi
|
||||
|
||||
# 测试文件参数
|
||||
LOG_INFO "测试pdfopen的文件参数"
|
||||
pdfopen --version > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "pdfopen命令执行失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f $TEST_PDF
|
||||
CHECK_RESULT $? 0 0 "删除测试PDF文件失败"
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载$PACKAGE_NAME软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME失败"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 pdfopen 的 --viewer 参数和文件参数,使用指定查看器打开PDF文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 pdfopen 的 --viewer 参数和文件参数,使用指定查看器打开PDF文件。"
|
||||
|
||||
LOG_INFO "检查是否已安装 texlive-xpdfopen 软件包"
|
||||
if dnf list installed texlive-xpdfopen &>/dev/null; then
|
||||
LOG_INFO "texlive-xpdfopen 已安装,测试完成后将保持安装状态。"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-xpdfopen 未安装,将在测试过程中安装。"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
LOG_INFO "检查 yum 源中是否有 texlive-xpdfopen 软件包"
|
||||
if ! dnf list available texlive-xpdfopen &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-xpdfopen 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装 texlive-xdfopen 软件包"
|
||||
dnf install -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-xpdfopen 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "创建测试用的简短PDF文件"
|
||||
cat > test_short.pdf << EOF
|
||||
%PDF-1.4
|
||||
1 0 obj << /Type /Catalog /Pages 2 0 R >>
|
||||
endobj
|
||||
2 0 obj << /Type /Pages /Kids [] /Count 0 >>
|
||||
endobj
|
||||
xref
|
||||
0 3
|
||||
0000000000 65535 f
|
||||
0000000009 00000 n
|
||||
0000000058 00000 n
|
||||
trailer << /Size 3 /Root 1 0 R >>
|
||||
startxref
|
||||
117
|
||||
%%EOF
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试PDF文件失败"
|
||||
|
||||
LOG_INFO "测试 pdfopen 命令是否存在"
|
||||
if ! command -v pdfopen &>/dev/null; then
|
||||
LOG_ERROR "pdfopen 命令未找到"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
dnf remove -y texlive-xpdfopen
|
||||
fi
|
||||
rm -f test_short.pdf
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "测试 pdfopen 的 --viewer 参数是否支持"
|
||||
pdfopen --help 2>&1 | grep -q "\-\-viewer"
|
||||
CHECK_RESULT $? 0 255 "pdfopen 命令不支持 --viewer 参数"
|
||||
|
||||
LOG_INFO "使用指定查看器(这里假设使用 xdg-open 作为示例查看器)打开PDF文件"
|
||||
pdfopen --viewer xdg-open test_short.pdf &
|
||||
PDFOPEN_PID=$!
|
||||
sleep 2
|
||||
|
||||
LOG_INFO "检查 pdfopen 进程是否成功启动"
|
||||
if ps -p $PDFOPEN_PID > /dev/null; then
|
||||
LOG_INFO "pdfopen 进程运行正常"
|
||||
kill $PDFOPEN_PID 2>/dev/null
|
||||
else
|
||||
LOG_ERROR "pdfopen 进程启动失败"
|
||||
CHECK_RESULT 1 0 0 "pdfopen 进程启动失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_short.pdf
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 texlive-xpdfopen 软件包"
|
||||
dnf remove -y texlive-xpdfopen
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-xpdfopen 失败"
|
||||
else
|
||||
LOG_INFO "保持 texlive-xpdfopen 安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality of texlive-breakcites
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 texlive-breakcites 的基本功能"
|
||||
|
||||
# 检查是否已安装 texlive-breakcites
|
||||
LOG_INFO "检查是否已安装 texlive-breakcites"
|
||||
if dnf list installed texlive-breakcites &> /dev/null; then
|
||||
LOG_INFO "texlive-breakcites 已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-breakcites 未安装,测试结束后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 texlive-breakcites 软件包
|
||||
LOG_INFO "检查 yum 源中是否有 texlive-breakcites 软件包"
|
||||
if ! dnf list available texlive-breakcites &> /dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-breakcites 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装 texlive-breakcites
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在安装 texlive-breakcites"
|
||||
dnf install -y texlive-breakcites
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-breakcites 失败"
|
||||
fi
|
||||
|
||||
# 测试 texlive-breakcites 的基本功能
|
||||
LOG_INFO "测试 texlive-breakcites 的基本功能"
|
||||
texdoc breakcites &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "texdoc breakcites 命令执行失败"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在卸载 texlive-breakcites"
|
||||
dnf remove -y texlive-breakcites
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-breakcites 失败"
|
||||
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-03-11
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic usage to break long citation lines
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test basic usage to break long citation lines"
|
||||
|
||||
# 检查是否已经安装texlive-breakcites包
|
||||
LOG_INFO "步骤1:检查texlive-breakcites是否已安装"
|
||||
dnf list installed texlive-breakcites > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-breakcites已安装,测试结束后保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-breakcites未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-breakcites包
|
||||
LOG_INFO "步骤2:检查yum源中是否有texlive-breakcites包"
|
||||
dnf list available texlive-breakcites > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-breakcites包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-breakcites
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive-breakcites包"
|
||||
dnf install -y texlive-breakcites
|
||||
CHECK_RESULT $? 0 0 "安装texlive-breakcites失败"
|
||||
fi
|
||||
|
||||
# 测试breakcites命令的基本用法
|
||||
LOG_INFO "步骤4:测试breakcites命令的基本用法"
|
||||
breakcites --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "breakcites命令不支持--help参数"
|
||||
|
||||
# 测试breakcites命令处理输入文件
|
||||
LOG_INFO "步骤5:测试breakcites命令处理输入文件"
|
||||
cat > test_input.tex << "EOF"
|
||||
\cite{longcitationkey1,longcitationkey2,longcitationkey3,longcitationkey4,longcitationkey5}
|
||||
EOF
|
||||
|
||||
breakcites test_input.tex > test_output.tex 2>&1
|
||||
CHECK_RESULT $? 0 0 "breakcites命令处理输入文件失败"
|
||||
|
||||
# 检查输出文件是否生成
|
||||
LOG_INFO "步骤6:检查输出文件是否生成"
|
||||
if [ -f test_output.tex ]; then
|
||||
LOG_INFO "输出文件test_output.tex生成成功"
|
||||
else
|
||||
LOG_ERROR "输出文件test_output.tex未生成"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "步骤7:清理测试文件"
|
||||
rm -f test_input.tex test_output.tex
|
||||
|
||||
# 如果测试前未安装,则卸载texlive-breakcites
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤8:卸载texlive-breakcites包"
|
||||
dnf remove -y texlive-breakcites
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-breakcites失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic usage to break long citation lines"
|
||||
}
|
||||
|
||||
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-03-11
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test LaTeX compilation with breakcites enabled
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试:Test LaTeX compilation with breakcites enabled"
|
||||
|
||||
LOG_INFO "步骤1:检查系统是否已安装texlive-breakcites"
|
||||
if dnf list installed texlive-breakcites &>/dev/null; then
|
||||
LOG_INFO "texlive-breakcites已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "texlive-breakcites未安装,将在测试中安装并在结束后卸载"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在texlive-breakcites软件包"
|
||||
if ! dnf list available texlive-breakcites &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-breakcites软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:如果未安装,则安装texlive-breakcites"
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
dnf install -y texlive-breakcites
|
||||
CHECK_RESULT $? 0 0 "安装texlive-breakcites失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:创建一个简单的测试LaTeX文件test.tex"
|
||||
cat > test.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{breakcites}
|
||||
\begin{document}
|
||||
Test citation \cite{test2024}.
|
||||
\bibliographystyle{plain}
|
||||
\bibliography{test}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
LOG_INFO "步骤5:创建一个简单的测试参考文献文件test.bib"
|
||||
cat > test.bib << "EOF"
|
||||
@article{test2024,
|
||||
author = {Test Author},
|
||||
title = {Test Title},
|
||||
journal = {Test Journal},
|
||||
year = {2024}
|
||||
}
|
||||
EOF
|
||||
|
||||
LOG_INFO "步骤6:尝试使用pdflatex编译LaTeX文件(第一次运行,生成aux文件)"
|
||||
pdflatex -interaction=nonstopmode test.tex &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdflatex第一次编译失败"
|
||||
|
||||
LOG_INFO "步骤7:运行bibtex生成参考文献"
|
||||
bibtex test &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "bibtex运行失败"
|
||||
|
||||
LOG_INFO "步骤8:再次使用pdflatex编译LaTeX文件(第二次运行,处理参考文献)"
|
||||
pdflatex -interaction=nonstopmode test.tex &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdflatex第二次编译失败"
|
||||
|
||||
LOG_INFO "步骤9:第三次使用pdflatex编译LaTeX文件(确保交叉引用正确)"
|
||||
pdflatex -interaction=nonstopmode test.tex &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "pdflatex第三次编译失败"
|
||||
|
||||
LOG_INFO "步骤10:检查是否成功生成PDF文件"
|
||||
if [ -f test.pdf ]; then
|
||||
LOG_INFO "成功:test.pdf已生成,LaTeX编译测试通过"
|
||||
else
|
||||
LOG_ERROR "失败:未生成test.pdf文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤11:清理测试生成的临时文件"
|
||||
rm -f test.tex test.bib test.aux test.log test.bbl test.blg test.out test.pdf
|
||||
|
||||
LOG_INFO "步骤12:环境恢复"
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "卸载测试安装的texlive-breakcites软件包"
|
||||
dnf remove -y texlive-breakcites
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-breakcites失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装texlive-breakcites,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test LaTeX compilation with breakcites enabled"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,73 +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-09-19
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package installation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test package installation"
|
||||
|
||||
# 检查是否已安装texlive-greek-inputenc
|
||||
LOG_INFO "检查texlive-greek-inputenc是否已安装"
|
||||
if dnf list installed texlive-greek-inputenc &>/dev/null; then
|
||||
LOG_INFO "texlive-greek-inputenc已安装,测试结束将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-greek-inputenc未安装,将在测试结束后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-greek-inputenc
|
||||
LOG_INFO "检查yum源中是否存在texlive-greek-inputenc"
|
||||
if ! dnf list available texlive-greek-inputenc &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在texlive-greek-inputenc包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-greek-inputenc
|
||||
LOG_INFO "开始安装texlive-greek-inputenc"
|
||||
dnf install -y texlive-greek-inputenc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-greek-inputenc失败"
|
||||
|
||||
# 验证安装
|
||||
LOG_INFO "验证texlive-greek-inputenc是否安装成功"
|
||||
dnf list installed texlive-greek-inputenc &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "验证texlive-greek-inputenc安装失败"
|
||||
|
||||
# 测试功能(示例命令,需根据实际需求调整)
|
||||
LOG_INFO "测试texlive-greek-inputenc功能"
|
||||
command_to_test="some_tex_command --greek-inputenc"
|
||||
if ! command -v some_tex_command &>/dev/null; then
|
||||
LOG_ERROR "命令some_tex_command不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
$command_to_test
|
||||
CHECK_RESULT $? 0 0 "测试texlive-greek-inputenc功能失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-greek-inputenc以恢复环境"
|
||||
dnf remove -y texlive-greek-inputenc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-greek-inputenc失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test package installation"
|
||||
}
|
||||
|
||||
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-09-27
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装texlive-modref-doc软件包
|
||||
LOG_INFO "检查是否已安装texlive-modref-doc软件包"
|
||||
rpm -q texlive-modref-doc
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-modref-doc已安装,脚本结束时保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-modref-doc未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-modref-doc软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-modref-doc软件包"
|
||||
dnf list available texlive-modref-doc > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中不存在texlive-modref-doc软件包"
|
||||
|
||||
# 安装texlive-modref-doc软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装texlive-modref-doc软件包"
|
||||
dnf install -y texlive-modref-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-modref-doc软件包失败"
|
||||
fi
|
||||
|
||||
# 测试基本功能
|
||||
LOG_INFO "测试基本功能"
|
||||
command_to_test --param
|
||||
CHECK_RESULT $? 0 255 "参数不存在或不支持"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-modref-doc软件包"
|
||||
dnf remove -y texlive-modref-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-modref-doc软件包失败"
|
||||
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-03-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package existence check
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始执行软件包存在性检查测试"
|
||||
LOG_INFO "检查测试环境是否已安装texlive-tabularborder-doc软件包"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
if rpm -q texlive-tabularborder-doc &> /dev/null; then
|
||||
LOG_INFO "软件包texlive-tabularborder-doc已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "软件包texlive-tabularborder-doc未安装,将在测试中安装,并在测试结束后卸载"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "检查yum源中是否存在texlive-tabularborder-doc软件包"
|
||||
dnf list available texlive-tabularborder-doc &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-tabularborder-doc软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "开始安装texlive-tabularborder-doc软件包"
|
||||
dnf install -y texlive-tabularborder-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-tabularborder-doc软件包失败"
|
||||
LOG_INFO "软件包安装成功"
|
||||
fi
|
||||
|
||||
# 验证软件包是否可查询
|
||||
LOG_INFO "验证软件包信息查询功能"
|
||||
rpm -qi texlive-tabularborder-doc &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "查询texlive-tabularborder-doc软件包信息失败"
|
||||
|
||||
# 验证软件包文件列表
|
||||
LOG_INFO "验证软件包文件列表"
|
||||
rpm -ql texlive-tabularborder-doc &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "获取texlive-tabularborder-doc软件包文件列表失败"
|
||||
|
||||
LOG_INFO "软件包存在性检查测试通过"
|
||||
|
||||
# 环境清理:如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "清理测试环境,卸载texlive-tabularborder-doc软件包"
|
||||
dnf remove -y texlive-tabularborder-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-tabularborder-doc软件包失败"
|
||||
LOG_INFO "环境清理完成"
|
||||
else
|
||||
LOG_INFO "测试前软件包已安装,保持安装状态,无需清理"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test documentation file access
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试文档文件访问功能"
|
||||
|
||||
# 检查是否已安装texlive-tabularborder-doc软件包
|
||||
LOG_INFO "检查texlive-tabularborder-doc是否已安装"
|
||||
rpm -q texlive-tabularborder-doc
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-tabularborder-doc已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-tabularborder-doc未安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-tabularborder-doc软件包"
|
||||
dnf list available texlive-tabularborder-doc
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-tabularborder-doc软件包"
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-tabularborder-doc软件包"
|
||||
dnf install -y texlive-tabularborder-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-tabularborder-doc失败"
|
||||
fi
|
||||
|
||||
# 测试文档文件访问
|
||||
LOG_INFO "测试文档文件访问功能"
|
||||
LOG_INFO "查找texlive-tabularborder-doc文档文件"
|
||||
find /usr/share/doc -name "*tabularborder*" -type f | head -5
|
||||
CHECK_RESULT $? 0 0 "未找到texlive-tabularborder-doc文档文件"
|
||||
|
||||
# 检查文档文件是否可读
|
||||
LOG_INFO "检查文档文件是否可读"
|
||||
DOC_FILE=$(find /usr/share/doc -name "*tabularborder*" -type f | head -1)
|
||||
if [ -n "$DOC_FILE" ]; then
|
||||
ls -l "$DOC_FILE"
|
||||
CHECK_RESULT $? 0 0 "文档文件列表失败"
|
||||
|
||||
file "$DOC_FILE"
|
||||
CHECK_RESULT $? 0 0 "文档文件类型检查失败"
|
||||
|
||||
head -10 "$DOC_FILE"
|
||||
CHECK_RESULT $? 0 0 "文档文件内容读取失败"
|
||||
else
|
||||
LOG_ERROR "未找到可用的文档文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载texlive-tabularborder-doc软件包"
|
||||
dnf remove -y texlive-tabularborder-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-tabularborder-doc失败"
|
||||
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-10-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package installation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查texlive-expkv-opt软件包是否已安装
|
||||
LOG_INFO "检查texlive-expkv-opt软件包是否已安装"
|
||||
rpm -q texlive-expkv-opt
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-expkv-opt软件包已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-expkv-opt软件包未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-expkv-opt软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-expkv-opt软件包"
|
||||
dnf list available texlive-expkv-opt > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中不存在texlive-expkv-opt软件包"
|
||||
|
||||
# 如果未安装,则安装texlive-expkv-opt软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装texlive-expkv-opt软件包"
|
||||
dnf install -y texlive-expkv-opt
|
||||
CHECK_RESULT $? 0 0 "安装texlive-expkv-opt软件包失败"
|
||||
fi
|
||||
|
||||
# 测试texlive-expkv-opt功能
|
||||
LOG_INFO "测试texlive-expkv-opt功能"
|
||||
some_texlive_command --test > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "texlive-expkv-opt功能测试失败,参数不支持或不存在"
|
||||
|
||||
# 如果之前未安装,则在脚本结束前卸载texlive-expkv-opt软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-expkv-opt软件包以恢复环境"
|
||||
dnf remove -y texlive-expkv-opt
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-expkv-opt软件包失败"
|
||||
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-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test accessing package documentation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试脚本:Test accessing package documentation
|
||||
|
||||
LOG_INFO "开始测试:访问包文档功能"
|
||||
|
||||
# 步骤1:检查当前环境是否已安装texlive软件包
|
||||
LOG_INFO "步骤1:检查texlive软件包是否已安装"
|
||||
rpm -q texlive > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive软件包已安装,测试结束后保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive软件包未安装,将在测试过程中安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 步骤2:检查yum源中是否有texlive软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有texlive软件包"
|
||||
dnf list available texlive > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中没有找到texlive软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有texlive软件包,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装texlive软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive软件包"
|
||||
dnf install -y texlive
|
||||
CHECK_RESULT $? 0 0 "安装texlive软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查texdoc命令是否存在
|
||||
LOG_INFO "步骤4:检查texdoc命令是否存在"
|
||||
which texdoc > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "texdoc命令不存在"
|
||||
|
||||
# 步骤5:检查texdoc命令参数支持情况
|
||||
LOG_INFO "步骤5:检查texdoc命令参数支持情况"
|
||||
texdoc --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "texdoc命令不支持--help参数"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "texdoc命令参数不支持,退出测试"
|
||||
# 清理环境
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
dnf remove -y texlive
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6:测试访问包文档功能
|
||||
LOG_INFO "步骤6:测试访问包文档功能"
|
||||
texdoc --list lshort > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "访问lshort包文档失败"
|
||||
|
||||
# 步骤7:测试搜索包文档功能
|
||||
LOG_INFO "步骤7:测试搜索包文档功能"
|
||||
texdoc --search latex > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "搜索latex相关文档失败"
|
||||
|
||||
# 步骤8:清理测试环境
|
||||
LOG_INFO "步骤8:清理测试环境"
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载测试安装的texlive软件包"
|
||||
dnf remove -y texlive
|
||||
CHECK_RESULT $? 0 0 "卸载texlive软件包失败"
|
||||
else
|
||||
LOG_INFO "保持texlive软件包安装状态"
|
||||
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-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test listing package files
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-variations"
|
||||
LOG_INFO "开始测试: Test listing package files"
|
||||
|
||||
# 步骤1: 检查软件包是否在yum源中存在
|
||||
LOG_INFO "步骤1: 检查软件包是否在yum源中存在"
|
||||
dnf list available "${PACKAGE_NAME}" &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 ${PACKAGE_NAME} 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2: 检查是否已安装
|
||||
LOG_INFO "步骤2: 检查是否已安装"
|
||||
INSTALLED=false
|
||||
if rpm -q "${PACKAGE_NAME}" &>/dev/null; then
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 未安装"
|
||||
fi
|
||||
|
||||
# 步骤3: 如果未安装,则安装软件包
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "步骤3: 安装软件包 ${PACKAGE_NAME}"
|
||||
dnf install -y "${PACKAGE_NAME}"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败"
|
||||
fi
|
||||
|
||||
# 步骤4: 测试列出包文件功能
|
||||
LOG_INFO "步骤4: 测试列出包文件功能"
|
||||
rpm -ql "${PACKAGE_NAME}" &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "列出软件包 ${PACKAGE_NAME} 文件失败"
|
||||
|
||||
# 步骤5: 验证列出的文件列表是否非空
|
||||
LOG_INFO "步骤5: 验证列出的文件列表是否非空"
|
||||
FILE_LIST=$(rpm -ql "${PACKAGE_NAME}" 2>/dev/null | head -5)
|
||||
if [ -z "${FILE_LIST}" ]; then
|
||||
LOG_ERROR "软件包 ${PACKAGE_NAME} 列出的文件列表为空"
|
||||
CHECK_RESULT 1 0 0 "软件包文件列表为空"
|
||||
else
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 文件列表示例:"
|
||||
echo "${FILE_LIST}"
|
||||
CHECK_RESULT $? 0 0 "获取文件列表失败"
|
||||
fi
|
||||
|
||||
# 步骤6: 清理环境
|
||||
LOG_INFO "步骤6: 清理环境"
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "卸载测试安装的软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y "${PACKAGE_NAME}"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败"
|
||||
else
|
||||
LOG_INFO "保持原有安装状态,不卸载软件包"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成: Test listing package files"
|
||||
}
|
||||
|
||||
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-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package installation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查texlive-variations软件包是否已安装
|
||||
LOG_INFO "检查texlive-variations软件包是否已安装"
|
||||
rpm -q texlive-variations > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-variations软件包已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-variations软件包未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在texlive-variations软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-variations软件包"
|
||||
dnf list available texlive-variations > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-variations软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-variations软件包
|
||||
LOG_INFO "安装texlive-variations软件包"
|
||||
dnf install -y texlive-variations > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-variations软件包失败"
|
||||
|
||||
# 验证texlive-variations软件包是否成功安装
|
||||
LOG_INFO "验证texlive-variations软件包是否成功安装"
|
||||
rpm -q texlive-variations > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "texlive-variations软件包未成功安装"
|
||||
|
||||
# 执行测试命令(示例命令,根据实际需求调整)
|
||||
LOG_INFO "执行测试命令"
|
||||
tex --version > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "测试命令执行失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-variations软件包"
|
||||
dnf remove -y texlive-variations > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-variations软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,85 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test querying package version
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试查询软件包版本
|
||||
LOG_INFO "开始测试:查询软件包版本"
|
||||
|
||||
# 检查是否已经安装
|
||||
LOG_INFO "检查是否已安装软件包"
|
||||
dnf list installed texlive-variations &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,测试结束后保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试中安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-variations软件包"
|
||||
dnf list available texlive-variations &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-variations软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-variations软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-variations软件包"
|
||||
dnf install -y texlive-variations
|
||||
CHECK_RESULT $? 0 0 "安装texlive-variations失败"
|
||||
fi
|
||||
|
||||
# 测试查询软件包版本
|
||||
LOG_INFO "测试查询texlive-variations软件包版本"
|
||||
dnf info texlive-variations | grep -q "Version"
|
||||
CHECK_RESULT $? 0 0 "查询软件包版本失败"
|
||||
|
||||
# 测试使用rpm命令查询版本
|
||||
LOG_INFO "测试使用rpm命令查询texlive-variations版本"
|
||||
rpm -q texlive-variations
|
||||
CHECK_RESULT $? 0 0 "使用rpm查询软件包版本失败"
|
||||
|
||||
# 测试使用错误参数
|
||||
LOG_INFO "测试使用不支持的参数"
|
||||
dnf info texlive-variations --invalid-param 2>/dev/null
|
||||
if [ $? -eq 255 ] || [ $? -eq 1 ]; then
|
||||
LOG_ERROR "dnf命令不支持--invalid-param参数"
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "dnf命令应返回非零退出码"
|
||||
|
||||
# 清理环境
|
||||
LOG_INFO "清理测试环境"
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载测试安装的texlive-variations软件包"
|
||||
dnf remove -y texlive-variations
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-variations失败"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
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-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test installation of the package
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试安装texlive-verbatimcopy-doc包"
|
||||
|
||||
# 检查软件包是否已在yum源中
|
||||
LOG_INFO "检查yum源中是否存在texlive-verbatimcopy-doc包"
|
||||
dnf list available texlive-verbatimcopy-doc &> /dev/null
|
||||
CHECK_RESULT $? 0 255 "yum源中不存在texlive-verbatimcopy-doc包"
|
||||
|
||||
# 检查是否已安装软件包
|
||||
LOG_INFO "检查是否已安装texlive-verbatimcopy-doc包"
|
||||
if rpm -q texlive-verbatimcopy-doc &> /dev/null; then
|
||||
LOG_INFO "texlive-verbatimcopy-doc包已安装,跳过安装步骤"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-verbatimcopy-doc包未安装,准备安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 安装软件包(如果未安装)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "开始安装texlive-verbatimcopy-doc包"
|
||||
dnf install -y texlive-verbatimcopy-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-verbatimcopy-doc包失败"
|
||||
fi
|
||||
|
||||
# 验证软件包功能(示例命令)
|
||||
LOG_INFO "验证texlive-verbatimcopy-doc包功能"
|
||||
some_command_related_to_texlive_verbatimcopy_doc
|
||||
CHECK_RESULT $? 0 255 "texlive-verbatimcopy-doc包功能验证失败"
|
||||
|
||||
# 卸载软件包(如果脚本安装了它)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-verbatimcopy-doc包"
|
||||
dnf remove -y texlive-verbatimcopy-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-verbatimcopy-doc包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试安装texlive-verbatimcopy-doc包"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +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-12-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试unique-devel软件包的构建功能,验证是否能够正确编译
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试unique-devel软件包的构建功能,验证是否能够正确编译
|
||||
|
||||
LOG_INFO "开始测试unique-devel软件包的构建功能"
|
||||
|
||||
# 检查yum源中是否存在unique-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在unique-devel软件包"
|
||||
dnf list available unique-devel > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到unique-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装unique-devel软件包
|
||||
LOG_INFO "检查是否已安装unique-devel软件包"
|
||||
rpm -q unique-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "unique-devel软件包已安装,无需重新安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "unique-devel软件包未安装,开始安装"
|
||||
dnf install -y unique-devel
|
||||
CHECK_RESULT $? 0 0 "安装unique-devel软件包失败"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 验证构建功能
|
||||
LOG_INFO "验证unique-devel软件包的构建功能"
|
||||
build_command="unique-devel-build --test" # 假设构建命令为unique-devel-build --test
|
||||
$build_command
|
||||
CHECK_RESULT $? 0 0 "构建unique-devel软件包失败"
|
||||
|
||||
# 清理环境:如果脚本开始时未安装unique-devel,则卸载
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "清理环境:卸载unique-devel软件包"
|
||||
dnf remove -y unique-devel
|
||||
CHECK_RESULT $? 0 0 "卸载unique-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:unique-devel软件包的构建功能验证通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user