Merge branch 'pkg' of http://10.30.190.190:54866/redrsoe2100/os-autotest into pkg
This commit is contained in:
@@ -30,14 +30,6 @@
|
||||
{
|
||||
"name": "test_adwaita-icon-theme_function_icon_path",
|
||||
"desc": "测试验证adwaita-icon-theme图标文件标准安装路径的功能。"
|
||||
},
|
||||
{
|
||||
"name": "test_adwaita-icon-theme_function_theme_switch",
|
||||
"desc": "测试系统切换到adwaita图标主题的功能。"
|
||||
},
|
||||
{
|
||||
"name": "test_adwaita-icon-theme_function_file_integrity",
|
||||
"desc": "测试adwaita-icon-theme安装后关键文件的完整性。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -9,22 +9,6 @@
|
||||
{
|
||||
"name": "test_freeradius-devel_function_uninstall",
|
||||
"desc": "Test removal of freeradius-devel package"
|
||||
},
|
||||
{
|
||||
"name": "test_freeradius-devel_function_headers",
|
||||
"desc": "Test presence of development header files"
|
||||
},
|
||||
{
|
||||
"name": "test_freeradius-devel_function_libs",
|
||||
"desc": "Test presence of static/dynamic libraries"
|
||||
},
|
||||
{
|
||||
"name": "test_freeradius-devel_function_pkgconfig",
|
||||
"desc": "Test pkg-config file availability and correctness"
|
||||
},
|
||||
{
|
||||
"name": "test_freeradius-devel_function_compile",
|
||||
"desc": "Test basic compile/link with freeradius library"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -10,14 +10,6 @@
|
||||
"name": "test_libbsd-ctor-static_function_check_version",
|
||||
"desc": "测试安装后能否通过包管理器查询到 libbsd-ctor-static 软件包的版本信息。"
|
||||
},
|
||||
{
|
||||
"name": "test_libbsd-ctor-static_function_file_exist",
|
||||
"desc": "测试安装后关键的静态库文件(如 libbsd-ctor.a)是否存在于预期的系统目录中。"
|
||||
},
|
||||
{
|
||||
"name": "test_libbsd-ctor-static_function_link_static",
|
||||
"desc": "测试使用 libbsd-ctor-static 的静态库文件(libbsd-ctor.a)进行编译链接,验证其基本功能可用。"
|
||||
},
|
||||
{
|
||||
"name": "test_libbsd-ctor-static_function_uninstall",
|
||||
"desc": "测试 libbsd-ctor-static 软件包能否通过包管理器成功卸载,并验证相关文件被移除。"
|
||||
|
||||
@@ -6,14 +6,6 @@
|
||||
"name": "test_msv-rngconv_install_package",
|
||||
"desc": "测试msv-rngconv软件包的安装功能,验证安装是否成功",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_msv-rngconv_rngconv__help",
|
||||
"desc": "测试 rngconv 命令的 --help 参数"
|
||||
},
|
||||
{
|
||||
"name": "test_msv-rngconv_function_convert",
|
||||
"desc": "测试 rngconv 命令的转换功能,验证输入文件是否能正确转换为输出格式"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,25 +2,9 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/plymouth/plymouth-devel",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_plymouth-devel_function_install",
|
||||
"desc": "Test the installation of plymouth-devel package"
|
||||
},
|
||||
{
|
||||
"name": "test_plymouth-devel_function_uninstall",
|
||||
"desc": "Test the uninstallation of plymouth-devel package"
|
||||
},
|
||||
{
|
||||
"name": "test_plymouth-devel_function_check_installed",
|
||||
"desc": "Test if plymouth-devel package is installed"
|
||||
},
|
||||
{
|
||||
"name": "test_plymouth-devel_function_verify_files",
|
||||
"desc": "Test if essential header files exist after installation"
|
||||
},
|
||||
{
|
||||
"name": "test_plymouth-devel_function_build_example",
|
||||
"desc": "Test building a simple program with plymouth-devel"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/python-requests-ntlm/python-requests_ntlm-help",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_python-requests_ntlm-help_function_auth",
|
||||
"desc": "Test NTLM authentication"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,26 +6,6 @@
|
||||
"name": "test_qt5-qtscxml-examples_install",
|
||||
"desc": "测试qt5-qtscxml-examples软件包的安装功能,验证是否能够正确安装",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtscxml-examples_function_parsing",
|
||||
"desc": "测试qt5-qtscxml-examples软件包的SCXML解析功能,验证是否能正确解析SCXML文件"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtscxml-examples_uninstall",
|
||||
"desc": "测试软件包qt5-qtscxml-examples的卸载功能,验证能否通过包管理器正确卸载且无残留"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtscxml-examples_examples_run",
|
||||
"desc": "测试qt5-qtscxml-examples中示例程序的运行功能,验证示例能否正常启动和执行"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtscxml-examples_function_scxml",
|
||||
"desc": "测试软件包提供的SCXML状态机核心功能,验证能否正确加载和解释SCXML文件"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtscxml-examples_integration",
|
||||
"desc": "测试qt5-qtscxml-examples与Qt5框架的集成功能,验证其状态机功能能否与Qt应用正常交互"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/rubygem-activerecord/rubygem-activerecord-doc",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_rubygem-activerecord-doc_function_doc",
|
||||
"desc": "Verify documentation generation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,10 +7,6 @@
|
||||
"desc": "测试 rubygem-erubi-doc 软件包的安装功能,验证是否能够成功安装到系统中。",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_rubygem-erubi-doc_function_render",
|
||||
"desc": "测试 rubygem-erubi-doc 的模板渲染功能,验证是否能正确渲染模板。"
|
||||
},
|
||||
{
|
||||
"name": "test_rubygem-erubi-doc_function_install",
|
||||
"desc": "验证 rubygem-erubi-doc 软件包是否能够成功安装到系统中。"
|
||||
@@ -18,18 +14,6 @@
|
||||
{
|
||||
"name": "test_rubygem-erubi-doc_function_uninstall",
|
||||
"desc": "验证 rubygem-erubi-doc 软件包是否能够被正确、干净地卸载。"
|
||||
},
|
||||
{
|
||||
"name": "test_rubygem-erubi-doc_function_escape",
|
||||
"desc": "验证 erubi 的自动 HTML 转义功能是否能正确工作,防止 XSS 攻击。"
|
||||
},
|
||||
{
|
||||
"name": "test_rubygem-erubi-doc_function_options",
|
||||
"desc": "验证 erubi 在初始化时接受不同的配置选项(如转义模式)并生效。"
|
||||
},
|
||||
{
|
||||
"name": "test_rubygem-erubi-doc_function_performance",
|
||||
"desc": "验证 erubi 模板渲染的基本性能,确保在常规使用场景下无明显延迟。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -18,10 +18,6 @@
|
||||
"name": "test_taglib-devel_taglib-config_prefix",
|
||||
"desc": "测试taglib-config的--prefix选项,用于获取安装前缀信息"
|
||||
},
|
||||
{
|
||||
"name": "test_taglib-devel_function_install",
|
||||
"desc": "测试taglib-devel软件包的安装功能"
|
||||
},
|
||||
{
|
||||
"name": "test_taglib-devel_function_check_install",
|
||||
"desc": "测试验证taglib-devel软件包是否已正确安装"
|
||||
@@ -29,14 +25,6 @@
|
||||
{
|
||||
"name": "test_taglib-devel_function_remove",
|
||||
"desc": "测试taglib-devel软件包的卸载功能"
|
||||
},
|
||||
{
|
||||
"name": "test_taglib-devel_function_compile_with",
|
||||
"desc": "测试使用taglib库进行简单程序编译"
|
||||
},
|
||||
{
|
||||
"name": "test_taglib-devel_function_header_files",
|
||||
"desc": "测试taglib开发头文件的存在与可用性"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-d/texlive-chkfloat",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-chkfloat_function_basic",
|
||||
"desc": "Test basic functionality of texlive-chkfloat"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-g/texlive-dtk-doc",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-dtk-doc_function_basic",
|
||||
"desc": "Basic functionality test for texlive-dtk-doc"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-g/texlive-dviincl",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-dviincl_function_basic",
|
||||
"desc": "Test basic functionality of texlive-dviincl"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,14 +13,6 @@
|
||||
{
|
||||
"name": "test_texlive-luaxml-doc_function_remove",
|
||||
"desc": "Test package removal"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-luaxml-doc_function_verify_files",
|
||||
"desc": "Test existence of key documentation files"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-luaxml-doc_function_list_files",
|
||||
"desc": "Test listing installed documentation files"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-t/texlive-reflectgraphics",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-reflectgraphics_function_basic",
|
||||
"desc": "Test basic functionality of reflectgraphics"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,10 +2,6 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-type1cm",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-type1cm_function_basic",
|
||||
"desc": "Test basic commands"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-type1cm_function_install",
|
||||
"desc": "Test package installation via package manager"
|
||||
@@ -14,17 +10,9 @@
|
||||
"name": "test_texlive-type1cm_function_uninstall",
|
||||
"desc": "Test package removal via package manager"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-type1cm_function_basic_usage",
|
||||
"desc": "Test basic LaTeX document compilation with type1cm"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-type1cm_function_check_installed",
|
||||
"desc": "Verify package files are present in TeX system"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-type1cm_function_scale_cmds",
|
||||
"desc": "Test scaling commands like \\scalebox and \\resizebox with type1cm"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-tablvar",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-tablvar_function_basic",
|
||||
"desc": "Basic functionality test"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-venn",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-venn_function_draw",
|
||||
"desc": "Test drawing Venn diagrams"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/uwsgi/uwsgi-stats-pusher-file",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_uwsgi-stats-pusher-file_function_config",
|
||||
"desc": "Test configuration file parsing"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -506,10 +506,6 @@
|
||||
"name": "test_xz_xz_c",
|
||||
"desc": "测试使用 -c 参数输出到标准输出"
|
||||
},
|
||||
{
|
||||
"name": "test_xz_xz_e",
|
||||
"desc": "测试使用 -e 参数尝试提高压缩率"
|
||||
},
|
||||
{
|
||||
"name": "test_xz_xz_q",
|
||||
"desc": "测试使用 -q 参数抑制警告"
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试adwaita-icon-theme安装后关键文件的完整性。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试adwaita-icon-theme安装后关键文件的完整性"
|
||||
|
||||
# 检查是否已安装adwaita-icon-theme
|
||||
LOG_INFO "检查adwaita-icon-theme是否已安装"
|
||||
rpm -q adwaita-icon-theme &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "adwaita-icon-theme已安装,脚本结束时将保持安装状态"
|
||||
already_installed=1
|
||||
else
|
||||
LOG_INFO "adwaita-icon-theme未安装,将在测试过程中安装"
|
||||
already_installed=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有adwaita-icon-theme包
|
||||
LOG_INFO "检查yum源中是否存在adwaita-icon-theme包"
|
||||
dnf list available adwaita-icon-theme &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到adwaita-icon-theme包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到adwaita-icon-theme包,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装adwaita-icon-theme
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "安装adwaita-icon-theme"
|
||||
dnf install -y adwaita-icon-theme
|
||||
CHECK_RESULT $? 0 0 "安装adwaita-icon-theme失败"
|
||||
fi
|
||||
|
||||
# 定义关键文件列表
|
||||
key_files=(
|
||||
"/usr/share/icons/Adwaita/index.theme"
|
||||
"/usr/share/icons/Adwaita/scalable/actions/address-book-new-symbolic.svg"
|
||||
"/usr/share/icons/Adwaita/16x16/actions/address-book-new.png"
|
||||
"/usr/share/icons/Adwaita/icon-theme.cache"
|
||||
)
|
||||
|
||||
# 检查关键文件是否存在
|
||||
LOG_INFO "检查关键文件是否存在"
|
||||
for file in "${key_files[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
LOG_INFO "文件 $file 存在"
|
||||
else
|
||||
LOG_ERROR "文件 $file 不存在"
|
||||
CHECK_RESULT 1 0 0 "关键文件 $file 缺失"
|
||||
fi
|
||||
done
|
||||
|
||||
# 检查文件完整性(通过rpm验证)
|
||||
LOG_INFO "通过rpm验证adwaita-icon-theme文件完整性"
|
||||
rpm -V adwaita-icon-theme
|
||||
CHECK_RESULT $? 0 0 "adwaita-icon-theme文件完整性验证失败"
|
||||
|
||||
# 清理环境:如果之前未安装,则卸载adwaita-icon-theme
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "卸载adwaita-icon-theme"
|
||||
dnf remove -y adwaita-icon-theme
|
||||
CHECK_RESULT $? 0 0 "卸载adwaita-icon-theme失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,102 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试系统切换到adwaita图标主题的功能。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试系统切换到adwaita图标主题的功能"
|
||||
|
||||
# 检查是否已安装adwaita-icon-theme
|
||||
LOG_INFO "检查是否已安装adwaita-icon-theme"
|
||||
rpm -q adwaita-icon-theme > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "adwaita-icon-theme已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "adwaita-icon-theme未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有adwaita-icon-theme软件包
|
||||
LOG_INFO "检查yum源中是否有adwaita-icon-theme软件包"
|
||||
dnf list available adwaita-icon-theme > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到adwaita-icon-theme软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装adwaita-icon-theme
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装adwaita-icon-theme"
|
||||
dnf install -y adwaita-icon-theme
|
||||
CHECK_RESULT $? 0 0 "安装adwaita-icon-theme失败"
|
||||
fi
|
||||
|
||||
# 检查gsettings命令是否可用
|
||||
LOG_INFO "检查gsettings命令是否可用"
|
||||
command -v gsettings > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "gsettings命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查gsettings是否支持设置图标主题
|
||||
LOG_INFO "检查gsettings是否支持设置图标主题"
|
||||
gsettings list-schemas | grep -q org.gnome.desktop.interface
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "gsettings不支持org.gnome.desktop.interface模式"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 获取当前图标主题
|
||||
LOG_INFO "获取当前图标主题"
|
||||
CURRENT_THEME=$(gsettings get org.gnome.desktop.interface icon-theme)
|
||||
LOG_INFO "当前图标主题为:$CURRENT_THEME"
|
||||
|
||||
# 切换到adwaita图标主题
|
||||
LOG_INFO "切换到adwaita图标主题"
|
||||
gsettings set org.gnome.desktop.interface icon-theme "Adwaita"
|
||||
CHECK_RESULT $? 0 0 "切换到adwaita图标主题失败"
|
||||
|
||||
# 验证图标主题是否已切换
|
||||
LOG_INFO "验证图标主题是否已切换"
|
||||
NEW_THEME=$(gsettings get org.gnome.desktop.interface icon-theme)
|
||||
if [ "$NEW_THEME" = ""Adwaita"" ]; then
|
||||
LOG_INFO "图标主题已成功切换到Adwaita"
|
||||
else
|
||||
LOG_ERROR "图标主题切换失败,当前主题为:$NEW_THEME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 恢复原始图标主题
|
||||
LOG_INFO "恢复原始图标主题"
|
||||
gsettings set org.gnome.desktop.interface icon-theme $CURRENT_THEME
|
||||
CHECK_RESULT $? 0 0 "恢复原始图标主题失败"
|
||||
|
||||
# 如果测试前未安装,则卸载adwaita-icon-theme
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载adwaita-icon-theme"
|
||||
dnf remove -y adwaita-icon-theme
|
||||
CHECK_RESULT $? 0 0 "卸载adwaita-icon-theme失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试系统切换到adwaita图标主题的功能完成"
|
||||
}
|
||||
|
||||
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-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic compile/link with freeradius library
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test basic compile/link with freeradius library"
|
||||
|
||||
# 步骤1:检查freeradius-devel软件包是否在yum源中
|
||||
LOG_INFO "检查yum源中是否存在freeradius-devel软件包"
|
||||
if ! dnf list available freeradius-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在freeradius-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查是否已安装freeradius-devel
|
||||
LOG_INFO "检查是否已安装freeradius-devel软件包"
|
||||
if rpm -q freeradius-devel &>/dev/null; then
|
||||
LOG_INFO "freeradius-devel已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "freeradius-devel未安装,将在测试步骤中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装freeradius-devel
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装freeradius-devel软件包"
|
||||
dnf install -y freeradius-devel
|
||||
CHECK_RESULT $? 0 0 "安装freeradius-devel失败"
|
||||
fi
|
||||
|
||||
# 步骤4:验证freeradius库的基本编译和链接功能
|
||||
LOG_INFO "测试freeradius库的基本编译和链接功能"
|
||||
|
||||
# 创建测试C程序
|
||||
cat > test_freeradius.c << "EOF"
|
||||
#include <freeradius-devel/radiusd.h>
|
||||
#include <freeradius-devel/modules.h>
|
||||
#include <freeradius-devel/rad_assert.h>
|
||||
|
||||
int main() {
|
||||
// 测试基本的库函数调用
|
||||
rad_assert(1 == 1);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 步骤5:编译测试程序
|
||||
LOG_INFO "编译测试程序"
|
||||
gcc -o test_freeradius test_freeradius.c -lfreeradius-server -lfreeradius-util
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
# 步骤6:运行测试程序
|
||||
LOG_INFO "运行测试程序"
|
||||
./test_freeradius
|
||||
CHECK_RESULT $? 0 0 "运行测试程序失败"
|
||||
|
||||
# 步骤7:清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test_freeradius.c test_freeradius
|
||||
|
||||
# 步骤8:如果测试前未安装,则卸载freeradius-devel
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载freeradius-devel软件包"
|
||||
dnf remove -y freeradius-devel
|
||||
CHECK_RESULT $? 0 0 "卸载freeradius-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic compile/link with freeradius library"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,72 +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-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test presence of development header files
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:检查开发头文件是否存在"
|
||||
|
||||
# 检查是否已安装 freeradius-devel
|
||||
if rpm -q freeradius-devel &> /dev/null; then
|
||||
LOG_INFO "freeradius-devel 已安装,测试后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "freeradius-devel 未安装,测试前将安装,测试后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 freeradius-devel 软件包
|
||||
LOG_INFO "检查 yum 源中是否存在 freeradius-devel 软件包"
|
||||
if ! dnf list available freeradius-devel &> /dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 freeradius-devel 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装 freeradius-devel 软件包"
|
||||
dnf install -y freeradius-devel
|
||||
CHECK_RESULT $? 0 0 "安装 freeradius-devel 失败"
|
||||
fi
|
||||
|
||||
# 测试开发头文件是否存在
|
||||
LOG_INFO "检查开发头文件是否存在"
|
||||
HEADER_FILES="/usr/include/freeradius/radius.h /usr/include/freeradius/server.h"
|
||||
for file in $HEADER_FILES; do
|
||||
if [ -f "$file" ]; then
|
||||
LOG_INFO "找到头文件: $file"
|
||||
else
|
||||
LOG_ERROR "未找到头文件: $file"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
LOG_INFO "开发头文件存在性检查通过"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载 freeradius-devel 软件包"
|
||||
dnf remove -y freeradius-devel
|
||||
CHECK_RESULT $? 0 0 "卸载 freeradius-devel 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,84 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test presence of static/dynamic libraries
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 freeradius-devel 软件包的静态/动态库文件是否存在"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="freeradius-devel"
|
||||
|
||||
# 检查软件包是否已在 yum 源中
|
||||
LOG_INFO "检查 yum 源中是否存在 $PACKAGE_NAME 软件包"
|
||||
dnf list available $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中不存在 $PACKAGE_NAME 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查当前环境中是否已安装该软件包
|
||||
LOG_INFO "检查当前环境中是否已安装 $PACKAGE_NAME 软件包"
|
||||
rpm -q $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
INSTALLED="true"
|
||||
LOG_INFO "$PACKAGE_NAME 软件包已安装,测试结束后将保持安装状态"
|
||||
else
|
||||
INSTALLED="false"
|
||||
LOG_INFO "$PACKAGE_NAME 软件包未安装,测试结束后将卸载该软件包"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" == "false" ]; then
|
||||
LOG_INFO "安装 $PACKAGE_NAME 软件包"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 软件包失败"
|
||||
fi
|
||||
|
||||
# 测试步骤:检查静态库文件是否存在
|
||||
LOG_INFO "检查 freeradius-devel 软件包中的静态库文件是否存在"
|
||||
STATIC_LIBS=$(rpm -ql $PACKAGE_NAME | grep "\.a$")
|
||||
if [ -z "$STATIC_LIBS" ]; then
|
||||
LOG_ERROR "未找到静态库文件"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "找到静态库文件:$STATIC_LIBS"
|
||||
fi
|
||||
|
||||
# 测试步骤:检查动态库文件是否存在
|
||||
LOG_INFO "检查 freeradius-devel 软件包中的动态库文件是否存在"
|
||||
DYNAMIC_LIBS=$(rpm -ql $PACKAGE_NAME | grep "\.so$")
|
||||
if [ -z "$DYNAMIC_LIBS" ]; then
|
||||
LOG_ERROR "未找到动态库文件"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "找到动态库文件:$DYNAMIC_LIBS"
|
||||
fi
|
||||
|
||||
# 环境恢复:如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" == "false" ]; then
|
||||
LOG_INFO "卸载 $PACKAGE_NAME 软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test pkg-config file availability and correctness
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
PKG_NAME="freeradius-devel"
|
||||
LOG_INFO "测试开始:Test pkg-config file availability and correctness"
|
||||
|
||||
LOG_INFO "步骤1: 检查yum源中是否存在软件包${PKG_NAME}"
|
||||
dnf list available ${PKG_NAME} &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包${PKG_NAME}在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查当前环境是否已安装${PKG_NAME}"
|
||||
rpm -q ${PKG_NAME} &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包${PKG_NAME}已安装,标记为已安装状态"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "软件包${PKG_NAME}未安装,标记为未安装状态"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "步骤3: 安装软件包${PKG_NAME}"
|
||||
dnf install -y ${PKG_NAME} &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "安装软件包${PKG_NAME}失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 检查pkg-config命令是否存在"
|
||||
which pkg-config &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "pkg-config命令不存在"
|
||||
|
||||
LOG_INFO "步骤5: 检查pkg-config是否支持freeradius-devel软件包"
|
||||
pkg-config --exists freeradius-devel &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "pkg-config不支持freeradius-devel软件包"
|
||||
|
||||
LOG_INFO "步骤6: 获取freeradius-devel的版本信息"
|
||||
VERSION=$(pkg-config --modversion freeradius-devel 2>/dev/null)
|
||||
if [ -z "${VERSION}" ]; then
|
||||
LOG_ERROR "无法获取freeradius-devel的版本信息"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "freeradius-devel版本: ${VERSION}"
|
||||
|
||||
LOG_INFO "步骤7: 检查pkg-config返回的CFLAGS是否正确"
|
||||
CFLAGS=$(pkg-config --cflags freeradius-devel 2>/dev/null)
|
||||
if [ -z "${CFLAGS}" ]; then
|
||||
LOG_ERROR "无法获取freeradius-devel的CFLAGS"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "freeradius-devel CFLAGS: ${CFLAGS}"
|
||||
|
||||
LOG_INFO "步骤8: 检查pkg-config返回的LIBS是否正确"
|
||||
LIBS=$(pkg-config --libs freeradius-devel 2>/dev/null)
|
||||
if [ -z "${LIBS}" ]; then
|
||||
LOG_ERROR "无法获取freeradius-devel的LIBS"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "freeradius-devel LIBS: ${LIBS}"
|
||||
|
||||
LOG_INFO "步骤9: 环境恢复"
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "卸载软件包${PKG_NAME}"
|
||||
dnf remove -y ${PKG_NAME} &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "卸载软件包${PKG_NAME}失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试结束:pkg-config文件可用性和正确性测试完成"
|
||||
}
|
||||
|
||||
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-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试安装后关键的静态库文件(如 libbsd-ctor.a)是否存在于预期的系统目录中。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(根据要求直接使用)
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $1"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $1"
|
||||
}
|
||||
|
||||
# 定义检查结果函数(根据要求直接使用)
|
||||
CHECK_RESULT() {
|
||||
if [ $1 -ne $2 ]; then
|
||||
LOG_ERROR "$4"
|
||||
exit $3
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义远程执行函数(根据要求直接使用)
|
||||
SSH_CMD() {
|
||||
# 模拟SSH_CMD函数,实际环境中应有具体实现
|
||||
command=$1
|
||||
node_ip=$2
|
||||
node_password=$3
|
||||
node_user=$4
|
||||
# 这里只是示例,实际应根据具体SSH实现来编写
|
||||
echo "SSH to $node_user@$node_ip executing: $command"
|
||||
# 假设成功执行
|
||||
return 0
|
||||
}
|
||||
|
||||
# 测试脚本开始
|
||||
LOG_INFO "开始测试libbsd-ctor静态库文件是否存在"
|
||||
|
||||
# 步骤1:检查软件包是否在yum源中
|
||||
LOG_INFO "步骤1:检查libbsd-devel软件包是否在yum源中"
|
||||
dnf list available libbsd-devel &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到libbsd-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "libbsd-devel软件包存在于yum源中"
|
||||
|
||||
# 步骤2:检查是否已安装libbsd-devel
|
||||
LOG_INFO "步骤2:检查系统是否已安装libbsd-devel"
|
||||
rpm -q libbsd-devel &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "libbsd-devel已安装,标记为已安装状态"
|
||||
INSTALLED="yes"
|
||||
else
|
||||
LOG_INFO "libbsd-devel未安装,标记为未安装状态"
|
||||
INSTALLED="no"
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "步骤3:安装libbsd-devel软件包"
|
||||
dnf install -y libbsd-devel
|
||||
CHECK_RESULT $? 0 0 "安装libbsd-devel失败"
|
||||
LOG_INFO "libbsd-devel安装成功"
|
||||
fi
|
||||
|
||||
# 步骤4:检查静态库文件是否存在
|
||||
LOG_INFO "步骤4:检查libbsd-ctor.a静态库文件是否存在于系统目录"
|
||||
STATIC_LIB="/usr/lib64/libbsd-ctor.a"
|
||||
if [ -f "$STATIC_LIB" ]; then
|
||||
LOG_INFO "静态库文件 $STATIC_LIB 存在"
|
||||
else
|
||||
LOG_ERROR "静态库文件 $STATIC_LIB 不存在"
|
||||
# 如果是因为安装步骤失败导致文件不存在,退出码应为1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 步骤5:清理环境(如果测试前未安装,则卸载软件包)
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "步骤5:卸载libbsd-devel软件包"
|
||||
dnf remove -y libbsd-devel
|
||||
CHECK_RESULT $? 0 0 "卸载libbsd-devel失败"
|
||||
LOG_INFO "libbsd-devel卸载成功"
|
||||
else
|
||||
LOG_INFO "步骤5:测试前已安装libbsd-devel,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,libbsd-ctor静态库文件存在性验证通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,95 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用 libbsd-ctor-static 的静态库文件(libbsd-ctor.a)进行编译链接,验证其基本功能可用。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断是否已安装libbsd-ctor-static软件包
|
||||
LOG_INFO "检查是否已安装libbsd-ctor-static软件包"
|
||||
rpm -q libbsd-ctor-static > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "libbsd-ctor-static已安装,标记为已安装状态"
|
||||
INSTALLED_FLAG=1
|
||||
else
|
||||
LOG_INFO "libbsd-ctor-static未安装,标记为未安装状态"
|
||||
INSTALLED_FLAG=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在libbsd-ctor-static软件包
|
||||
LOG_INFO "检查yum源中是否存在libbsd-ctor-static软件包"
|
||||
dnf list available libbsd-ctor-static > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在libbsd-ctor-static软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED_FLAG -eq 0 ]; then
|
||||
LOG_INFO "开始安装libbsd-ctor-static软件包"
|
||||
dnf install -y libbsd-ctor-static
|
||||
CHECK_RESULT $? 0 0 "安装libbsd-ctor-static失败"
|
||||
fi
|
||||
|
||||
# 检查libbsd-ctor.a静态库文件是否存在
|
||||
LOG_INFO "检查libbsd-ctor.a静态库文件是否存在"
|
||||
if [ ! -f /usr/lib64/libbsd-ctor.a ]; then
|
||||
LOG_ERROR "libbsd-ctor.a静态库文件不存在"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 创建一个简单的C测试程序
|
||||
LOG_INFO "创建测试C程序test_libbsd.c"
|
||||
cat > test_libbsd.c << "EOF"
|
||||
#include <stdio.h>
|
||||
#include <bsd/string.h>
|
||||
|
||||
int main() {
|
||||
char dest[20] = "Hello";
|
||||
char src[] = " World";
|
||||
strlcat(dest, src, sizeof(dest));
|
||||
printf("Result: %s\n", dest);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 使用libbsd-ctor.a静态库编译测试程序
|
||||
LOG_INFO "使用libbsd-ctor.a静态库编译测试程序"
|
||||
gcc -static test_libbsd.c -o test_libbsd -L/usr/lib64 -lbsd-ctor
|
||||
CHECK_RESULT $? 0 0 "使用libbsd-ctor.a静态库编译失败"
|
||||
|
||||
# 运行编译后的可执行文件
|
||||
LOG_INFO "运行编译后的可执行文件"
|
||||
./test_libbsd
|
||||
CHECK_RESULT $? 0 0 "运行测试程序失败"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test_libbsd.c test_libbsd
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ $INSTALLED_FLAG -eq 0 ]; then
|
||||
LOG_INFO "卸载libbsd-ctor-static软件包"
|
||||
dnf remove -y libbsd-ctor-static
|
||||
CHECK_RESULT $? 0 0 "卸载libbsd-ctor-static失败"
|
||||
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 : 2025-12-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 rngconv 命令的转换功能,验证输入文件是否能正确转换为输出格式
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装msv-rngconv软件包
|
||||
LOG_INFO "检查msv-rngconv软件包是否已安装"
|
||||
if rpm -q msv-rngconv &>/dev/null; then
|
||||
LOG_INFO "msv-rngconv软件包已安装,测试完成后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "msv-rngconv软件包未安装,测试完成后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在msv-rngconv软件包
|
||||
LOG_INFO "检查yum源中是否存在msv-rngconv软件包"
|
||||
if ! dnf list available msv-rngconv &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到msv-rngconv软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 若未安装则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装msv-rngconv软件包"
|
||||
dnf install -y msv-rngconv &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "安装msv-rngconv软件包失败"
|
||||
fi
|
||||
|
||||
# 准备测试文件
|
||||
LOG_INFO "准备测试输入文件"
|
||||
echo "test input data" > input.txt
|
||||
|
||||
# 执行rngconv命令进行转换
|
||||
LOG_INFO "执行rngconv命令进行转换"
|
||||
rngconv input.txt output.txt
|
||||
CHECK_RESULT $? 0 0 "rngconv命令执行失败"
|
||||
|
||||
# 检查输出文件是否存在
|
||||
LOG_INFO "检查输出文件是否存在"
|
||||
[ -f output.txt ]
|
||||
CHECK_RESULT $? 0 0 "输出文件未生成"
|
||||
|
||||
# 检查输出文件内容是否符合预期
|
||||
LOG_INFO "检查输出文件内容是否符合预期"
|
||||
grep -q "test input data" output.txt
|
||||
CHECK_RESULT $? 0 0 "输出文件内容不符合预期"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f input.txt output.txt
|
||||
|
||||
# 若之前未安装则卸载软件包以恢复环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载msv-rngconv软件包以恢复环境"
|
||||
dnf remove -y msv-rngconv &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "卸载msv-rngconv软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,59 +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-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 rngconv 命令的 --help 参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 rngconv 命令的 --help 参数"
|
||||
|
||||
# 检查是否已安装软件包
|
||||
LOG_INFO "检查是否已安装 msv-rngconv 软件包"
|
||||
if ! dnf list installed msv-rngconv &>/dev/null; then
|
||||
LOG_INFO "msv-rngconv 未安装,准备安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available msv-rngconv &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到 msv-rngconv 软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y msv-rngconv
|
||||
CHECK_RESULT $? 0 0 "安装 msv-rngconv 失败"
|
||||
# 标记需要卸载
|
||||
UNINSTALL_NEEDED=1
|
||||
else
|
||||
LOG_INFO "msv-rngconv 已安装"
|
||||
UNINSTALL_NEEDED=0
|
||||
fi
|
||||
|
||||
# 测试 --help 参数
|
||||
LOG_INFO "测试 rngconv --help 参数"
|
||||
rngconv --help &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "rngconv --help 执行失败"
|
||||
|
||||
# 清理环境
|
||||
if [ $UNINSTALL_NEEDED -eq 1 ]; then
|
||||
LOG_INFO "卸载 msv-rngconv 软件包"
|
||||
dnf remove -y msv-rngconv
|
||||
CHECK_RESULT $? 0 0 "卸载 msv-rngconv 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-01-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test building a simple program with plymouth-devel
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "测试开始:使用plymouth-devel构建一个简单程序"
|
||||
|
||||
# 检查环境是否已安装plymouth-devel
|
||||
LOG_INFO "步骤1:检查plymouth-devel是否已安装"
|
||||
if dnf list installed plymouth-devel &>/dev/null; then
|
||||
LOG_INFO "plymouth-devel已安装,测试结束后将保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "plymouth-devel未安装,将在测试过程中安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有plymouth-devel软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有plymouth-devel软件包"
|
||||
if ! dnf list available plymouth-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到plymouth-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装plymouth-devel
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装plymouth-devel软件包"
|
||||
dnf install -y plymouth-devel
|
||||
CHECK_RESULT $? 0 0 "安装plymouth-devel失败"
|
||||
fi
|
||||
|
||||
# 创建测试程序源代码
|
||||
LOG_INFO "步骤4:创建测试程序源代码"
|
||||
cat > test_plymouth.c << "EOF"
|
||||
#include <plymouth.h>
|
||||
|
||||
int main() {
|
||||
plymouth_init();
|
||||
plymouth_show_message("Hello, Plymouth!");
|
||||
plymouth_quit();
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 编译测试程序
|
||||
LOG_INFO "步骤5:编译测试程序"
|
||||
gcc test_plymouth.c -o test_plymouth $(pkg-config --cflags --libs plymouth)
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
# 运行测试程序
|
||||
LOG_INFO "步骤6:运行测试程序"
|
||||
./test_plymouth
|
||||
CHECK_RESULT $? 0 0 "运行测试程序失败"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "步骤7:清理临时文件"
|
||||
rm -f test_plymouth.c test_plymouth
|
||||
|
||||
# 如果测试开始时未安装,则卸载plymouth-devel
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤8:卸载plymouth-devel软件包"
|
||||
dnf remove -y plymouth-devel
|
||||
CHECK_RESULT $? 0 0 "卸载plymouth-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试结束:使用plymouth-devel构建一个简单程序成功"
|
||||
}
|
||||
|
||||
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-01-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test if plymouth-devel package is installed
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:检查plymouth-devel软件包是否安装"
|
||||
|
||||
# 检查plymouth-devel是否已安装
|
||||
LOG_INFO "步骤1:检查plymouth-devel是否已安装"
|
||||
rpm -q plymouth-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "plymouth-devel已安装,测试将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "plymouth-devel未安装,将进行安装测试"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有plymouth-devel软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有plymouth-devel软件包"
|
||||
dnf list available plymouth-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到plymouth-devel软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到plymouth-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装plymouth-devel
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装plymouth-devel软件包"
|
||||
dnf install -y plymouth-devel
|
||||
CHECK_RESULT $? 0 0 "安装plymouth-devel失败"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "安装plymouth-devel失败"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "plymouth-devel安装成功"
|
||||
fi
|
||||
|
||||
# 检查安装后的软件包
|
||||
LOG_INFO "步骤4:验证plymouth-devel软件包是否安装成功"
|
||||
rpm -q plymouth-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "plymouth-devel未正确安装"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "plymouth-devel未正确安装"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "plymouth-devel已正确安装"
|
||||
|
||||
# 测试plymouth-devel相关功能
|
||||
LOG_INFO "步骤5:测试plymouth-devel相关功能"
|
||||
# 这里可以添加具体的功能测试命令,例如检查某个文件是否存在
|
||||
# 示例:检查plymouth-devel提供的头文件
|
||||
if [ -f /usr/include/plymouth.h ]; then
|
||||
LOG_INFO "plymouth.h头文件存在"
|
||||
else
|
||||
LOG_ERROR "plymouth.h头文件不存在"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 环境恢复:如果测试前未安装,则卸载plymouth-devel
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤6:恢复环境,卸载plymouth-devel软件包"
|
||||
dnf remove -y plymouth-devel
|
||||
CHECK_RESULT $? 0 0 "卸载plymouth-devel失败"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "卸载plymouth-devel失败"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "plymouth-devel卸载成功,环境已恢复"
|
||||
else
|
||||
LOG_INFO "步骤6:测试前已安装plymouth-devel,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:plymouth-devel软件包安装测试通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-08-12
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test the installation of plymouth-devel package
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查plymouth-devel软件包是否已安装
|
||||
LOG_INFO "检查plymouth-devel软件包是否已安装"
|
||||
rpm -q plymouth-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "plymouth-devel软件包已安装,脚本结束时保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "plymouth-devel软件包未安装,将在测试后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有plymouth-devel软件包
|
||||
LOG_INFO "检查yum源中是否有plymouth-devel软件包"
|
||||
dnf list available plymouth-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中未找到plymouth-devel软件包"
|
||||
|
||||
# 安装plymouth-devel软件包
|
||||
LOG_INFO "安装plymouth-devel软件包"
|
||||
dnf install -y plymouth-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装plymouth-devel软件包失败"
|
||||
|
||||
# 验证plymouth-devel软件包是否成功安装
|
||||
LOG_INFO "验证plymouth-devel软件包是否成功安装"
|
||||
rpm -q plymouth-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "plymouth-devel软件包未正确安装"
|
||||
|
||||
# 测试plymouth-devel功能(示例命令,根据实际需求调整)
|
||||
LOG_INFO "测试plymouth-devel功能"
|
||||
some_plymouth_command --test > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "plymouth-devel功能测试失败或参数不支持"
|
||||
|
||||
# 根据初始状态决定是否卸载plymouth-devel软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载plymouth-devel软件包"
|
||||
dnf remove -y plymouth-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载plymouth-devel软件包失败"
|
||||
LOG_INFO "环境已恢复至初始状态"
|
||||
else
|
||||
LOG_INFO "保持环境中的plymouth-devel软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-01-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test if essential header files exist after installation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "测试开始:验证plymouth-devel软件包安装后必要的头文件是否存在"
|
||||
LOG_INFO "步骤1:检查当前环境中是否已安装plymouth-devel软件包"
|
||||
rpm -q plymouth-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "plymouth-devel软件包已安装,测试过程中将保持安装状态"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "plymouth-devel软件包未安装,将在测试过程中安装并随后卸载"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
LOG_INFO "步骤2:检查yum源中是否存在plymouth-devel软件包"
|
||||
dnf list available plymouth-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到plymouth-devel软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到plymouth-devel软件包,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装plymouth-devel软件包"
|
||||
dnf install -y plymouth-devel
|
||||
CHECK_RESULT $? 0 0 "安装plymouth-devel软件包失败"
|
||||
fi
|
||||
LOG_INFO "步骤4:验证必要的头文件是否存在"
|
||||
HEADER_FILES="/usr/include/plymouth-1/ply-boot-splash.h /usr/include/plymouth-1/ply-event-loop.h /usr/include/plymouth-1/ply-keyboard.h /usr/include/plymouth-1/ply-list.h /usr/include/plymouth-1/ply-logger.h /usr/include/plymouth-1/ply-renderer.h /usr/include/plymouth-1/ply-terminal.h /usr/include/plymouth-1/ply-trigger.h /usr/include/plymouth-1/ply-window.h"
|
||||
for file in $HEADER_FILES; do
|
||||
if [ -f "$file" ]; then
|
||||
LOG_INFO "头文件 $file 存在"
|
||||
else
|
||||
LOG_ERROR "头文件 $file 不存在"
|
||||
CHECK_RESULT 1 0 0 "必要的头文件缺失"
|
||||
fi
|
||||
done
|
||||
LOG_INFO "步骤5:清理测试环境"
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载plymouth-devel软件包"
|
||||
dnf remove -y plymouth-devel
|
||||
CHECK_RESULT $? 0 0 "卸载plymouth-devel软件包失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装plymouth-devel,保持安装状态,无需卸载"
|
||||
fi
|
||||
LOG_INFO "测试结束:plymouth-devel软件包安装后必要的头文件验证完成"
|
||||
}
|
||||
|
||||
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 : 2025-12-11
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test NTLM authentication
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 测试脚本:test_python-requests_ntlm-help_function_auth
|
||||
# 测试用例描述:Test NTLM authentication
|
||||
|
||||
# 检查软件包是否已安装
|
||||
check_package_installed() {
|
||||
if dnf list installed "$1" &>/dev/null; then
|
||||
LOG_INFO "软件包 $1 已安装"
|
||||
return 0
|
||||
else
|
||||
LOG_INFO "软件包 $1 未安装"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
check_package_available() {
|
||||
if dnf list available "$1" &>/dev/null; then
|
||||
LOG_INFO "软件包 $1 在yum源中可用"
|
||||
return 0
|
||||
else
|
||||
LOG_ERROR "软件包 $1 在yum源中不可用"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装软件包
|
||||
install_package() {
|
||||
LOG_INFO "正在安装软件包 $1"
|
||||
dnf install -y "$1"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $1 失败"
|
||||
}
|
||||
|
||||
# 卸载软件包
|
||||
uninstall_package() {
|
||||
LOG_INFO "正在卸载软件包 $1"
|
||||
dnf remove -y "$1"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $1 失败"
|
||||
}
|
||||
|
||||
# NTLM认证测试主函数
|
||||
test_ntlm_auth() {
|
||||
local package="python3-requests-ntlm"
|
||||
|
||||
# 检查环境是否已安装
|
||||
if check_package_installed "$package"; then
|
||||
LOG_INFO "环境已安装,无需重新安装"
|
||||
env_installed=true
|
||||
else
|
||||
LOG_INFO "环境未安装,将进行安装"
|
||||
env_installed=false
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
check_package_available "$package" || exit
|
||||
|
||||
# 安装软件包作为测试步骤的一部分
|
||||
install_package "$package" || exit
|
||||
|
||||
LOG_INFO "$package 已成功安装,开始执行NTLM认证测试"
|
||||
|
||||
# 模拟NTLM认证测试步骤(示例)
|
||||
SSH_CMD "python3 -c "import requests; from requests_ntlm import HttpNtlmAuth; print(\"NTLM认证模块加载成功\")"" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER" || exit
|
||||
|
||||
|
||||
# 清理环境(仅在脚本开始时未安装的情况下)
|
||||
if ! $env_installed; then
|
||||
|
||||
LOG_INFO "$package 为临时安装,测试完成后将卸载"
|
||||
uninstall_package "$package" || exit
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Main execution block for the test script.
|
||||
main() {
|
||||
test_ntlm_auth
|
||||
|
||||
return ?
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
exit ?
|
||||
|
||||
}
|
||||
|
||||
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-02-21
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试qt5-qtscxml-examples中示例程序的运行功能,验证示例能否正常启动和执行
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试qt5-qtscxml-examples示例程序运行功能"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE="qt5-qtscxml-examples"
|
||||
LOG_INFO "测试软件包: ${PACKAGE}"
|
||||
|
||||
# 检查软件包是否已在yum源中
|
||||
LOG_INFO "检查yum源中是否存在${PACKAGE}软件包"
|
||||
dnf list available ${PACKAGE} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到${PACKAGE}软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在${PACKAGE}软件包"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查${PACKAGE}是否已安装"
|
||||
rpm -q ${PACKAGE} &>/dev/null
|
||||
PACKAGE_INSTALLED=$?
|
||||
|
||||
if [ ${PACKAGE_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "${PACKAGE}已安装,测试完成后将保持安装状态"
|
||||
NEED_CLEANUP=0
|
||||
else
|
||||
LOG_INFO "${PACKAGE}未安装,将进行安装测试"
|
||||
NEED_CLEANUP=1
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ ${NEED_CLEANUP} -eq 1 ]; then
|
||||
LOG_INFO "安装${PACKAGE}软件包"
|
||||
dnf install -y ${PACKAGE}
|
||||
CHECK_RESULT $? 0 0 "安装${PACKAGE}失败"
|
||||
LOG_INFO "${PACKAGE}安装成功"
|
||||
fi
|
||||
|
||||
# 获取示例程序路径
|
||||
LOG_INFO "查找${PACKAGE}示例程序"
|
||||
EXAMPLE_PATH=$(rpm -ql ${PACKAGE} | grep -E "/examples/.*/.*example$" | head -1)
|
||||
if [ -z "${EXAMPLE_PATH}" ]; then
|
||||
LOG_ERROR "未找到${PACKAGE}的示例程序"
|
||||
if [ ${NEED_CLEANUP} -eq 1 ]; then
|
||||
dnf remove -y ${PACKAGE}
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "找到示例程序: ${EXAMPLE_PATH}"
|
||||
|
||||
# 检查示例程序是否可执行
|
||||
LOG_INFO "检查示例程序是否可执行"
|
||||
if [ ! -x "${EXAMPLE_PATH}" ]; then
|
||||
LOG_ERROR "示例程序不可执行: ${EXAMPLE_PATH}"
|
||||
if [ ${NEED_CLEANUP} -eq 1 ]; then
|
||||
dnf remove -y ${PACKAGE}
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 运行示例程序(使用超时防止程序阻塞)
|
||||
LOG_INFO "运行示例程序: ${EXAMPLE_PATH}"
|
||||
timeout 5s ${EXAMPLE_PATH} --help &>/dev/null
|
||||
CHECK_RESULT $? 0 124 "示例程序运行失败或超时"
|
||||
LOG_INFO "示例程序启动成功"
|
||||
|
||||
# 测试示例程序基本功能
|
||||
LOG_INFO "测试示例程序基本执行功能"
|
||||
timeout 10s ${EXAMPLE_PATH} &>/dev/null &
|
||||
EXAMPLE_PID=$!
|
||||
sleep 2
|
||||
|
||||
# 检查进程是否在运行
|
||||
if ps -p ${EXAMPLE_PID} > /dev/null; then
|
||||
LOG_INFO "示例程序正在执行"
|
||||
# 结束示例程序
|
||||
kill -9 ${EXAMPLE_PID} 2>/dev/null
|
||||
wait ${EXAMPLE_PID} 2>/dev/null
|
||||
else
|
||||
LOG_ERROR "示例程序未能持续执行"
|
||||
if [ ${NEED_CLEANUP} -eq 1 ]; then
|
||||
dnf remove -y ${PACKAGE}
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境
|
||||
if [ ${NEED_CLEANUP} -eq 1 ]; then
|
||||
LOG_INFO "卸载${PACKAGE}软件包"
|
||||
dnf remove -y ${PACKAGE}
|
||||
CHECK_RESULT $? 0 0 "卸载${PACKAGE}失败"
|
||||
LOG_INFO "${PACKAGE}卸载成功"
|
||||
else
|
||||
LOG_INFO "保持${PACKAGE}安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "qt5-qtscxml-examples示例程序运行功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,74 +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-06
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试qt5-qtscxml-examples软件包的SCXML解析功能,验证是否能正确解析SCXML文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试qt5-qtscxml-examples软件包的SCXML解析功能"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查qt5-qtscxml-examples是否已安装"
|
||||
if dnf list installed qt5-qtscxml-examples &>/dev/null; then
|
||||
LOG_INFO "qt5-qtscxml-examples已安装,跳过安装步骤"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "qt5-qtscxml-examples未安装,准备安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在该软件包
|
||||
LOG_INFO "检查yum源中是否存在qt5-qtscxml-examples"
|
||||
if ! dnf list available qt5-qtscxml-examples &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到qt5-qtscxml-examples软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装qt5-qtscxml-examples"
|
||||
dnf install -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "安装qt5-qtscxml-examples失败"
|
||||
fi
|
||||
|
||||
# 验证SCXML解析功能
|
||||
LOG_INFO "验证SCXML解析功能"
|
||||
EXAMPLE_PATH="/usr/lib64/qt5/examples/scxml/statemachine/statemachine"
|
||||
if [ ! -f "$EXAMPLE_PATH" ]; then
|
||||
LOG_ERROR "未找到SCXML示例文件"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行示例命令
|
||||
LOG_INFO "执行SCXML示例命令"
|
||||
$EXAMPLE_PATH --help &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "SCXML解析功能测试失败"
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载qt5-qtscxml-examples"
|
||||
dnf remove -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "卸载qt5-qtscxml-examples失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-21
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包提供的SCXML状态机核心功能,验证能否正确加载和解释SCXML文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试软件包提供的SCXML状态机核心功能,验证能否正确加载和解释SCXML文件"
|
||||
|
||||
# 步骤1:检查yum源中是否存在qt5-qtscxml-examples软件包
|
||||
LOG_INFO "检查yum源中是否存在qt5-qtscxml-examples软件包"
|
||||
dnf list available qt5-qtscxml-examples 2>&1 | grep -q "qt5-qtscxml-examples"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到qt5-qtscxml-examples软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查环境是否已安装qt5-qtscxml-examples软件包
|
||||
LOG_INFO "检查环境是否已安装qt5-qtscxml-examples软件包"
|
||||
rpm -q qt5-qtscxml-examples > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "环境已安装qt5-qtscxml-examples软件包,脚本结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "环境未安装qt5-qtscxml-examples软件包,将进行安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "安装qt5-qtscxml-examples软件包"
|
||||
dnf install -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "安装qt5-qtscxml-examples软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4:验证SCXML状态机核心功能
|
||||
LOG_INFO "验证SCXML状态机核心功能:尝试加载和解释示例SCXML文件"
|
||||
# 假设示例文件位于 /usr/share/qt5/examples/scxml/statemachine/statemachine.scxml
|
||||
EXAMPLE_FILE="/usr/share/qt5/examples/scxml/statemachine/statemachine.scxml"
|
||||
if [ -f "$EXAMPLE_FILE" ]; then
|
||||
LOG_INFO "找到示例SCXML文件:$EXAMPLE_FILE"
|
||||
# 使用scxml工具加载和解释SCXML文件(假设工具名为scxml)
|
||||
scxml --validate "$EXAMPLE_FILE"
|
||||
CHECK_RESULT $? 0 0 "加载和解释SCXML文件失败"
|
||||
else
|
||||
LOG_ERROR "未找到示例SCXML文件:$EXAMPLE_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 步骤5:清理环境(如果之前未安装,则卸载软件包)
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "卸载qt5-qtscxml-examples软件包"
|
||||
dnf remove -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "卸载qt5-qtscxml-examples软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:SCXML状态机核心功能测试通过"
|
||||
}
|
||||
|
||||
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-21
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试qt5-qtscxml-examples与Qt5框架的集成功能,验证其状态机功能能否与Qt应用正常交互
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试qt5-qtscxml-examples与Qt5框架的集成功能,验证其状态机功能能否与Qt应用正常交互"
|
||||
|
||||
LOG_INFO "步骤1:检查是否已安装qt5-qtscxml-examples软件包"
|
||||
rpm -q qt5-qtscxml-examples
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "qt5-qtscxml-examples已安装,测试后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "qt5-qtscxml-examples未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否有qt5-qtscxml-examples软件包"
|
||||
dnf list available qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到qt5-qtscxml-examples软件包,退出"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到qt5-qtscxml-examples软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装qt5-qtscxml-examples软件包"
|
||||
dnf install -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "安装qt5-qtscxml-examples软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证qt5-qtscxml-examples示例程序能否正常运行"
|
||||
EXAMPLE_PATH="/usr/lib64/qt5/examples/scxml"
|
||||
if [ -d "$EXAMPLE_PATH" ]; then
|
||||
LOG_INFO "找到qt5-qtscxml-examples示例程序目录"
|
||||
cd "$EXAMPLE_PATH" || exit 1
|
||||
ls -la
|
||||
CHECK_RESULT $? 0 0 "无法列出qt5-qtscxml-examples示例程序"
|
||||
else
|
||||
LOG_ERROR "未找到qt5-qtscxml-examples示例程序目录"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:运行一个简单的Qt SCXML示例程序"
|
||||
if [ -f "statemachine/statemachine.pro" ]; then
|
||||
cd statemachine || exit 1
|
||||
qmake
|
||||
CHECK_RESULT $? 0 0 "qmake命令执行失败"
|
||||
make
|
||||
CHECK_RESULT $? 0 0 "make命令执行失败"
|
||||
./statemachine &
|
||||
PID=$!
|
||||
sleep 2
|
||||
kill $PID 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "Qt SCXML示例程序运行异常"
|
||||
LOG_INFO "Qt SCXML示例程序运行正常"
|
||||
else
|
||||
LOG_ERROR "未找到statemachine示例程序"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:清理编译生成的文件"
|
||||
make clean
|
||||
CHECK_RESULT $? 0 0 "清理编译文件失败"
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤7:卸载qt5-qtscxml-examples软件包"
|
||||
dnf remove -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "卸载qt5-qtscxml-examples软件包失败"
|
||||
LOG_INFO "已卸载qt5-qtscxml-examples软件包"
|
||||
else
|
||||
LOG_INFO "测试前已安装qt5-qtscxml-examples,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:qt5-qtscxml-examples与Qt5框架集成功能正常"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-21
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包qt5-qtscxml-examples的卸载功能,验证能否通过包管理器正确卸载且无残留
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试qt5-qtscxml-examples软件包的卸载功能"
|
||||
LOG_INFO "步骤1:检查系统中是否已安装qt5-qtscxml-examples软件包"
|
||||
rpm -q qt5-qtscxml-examples
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包qt5-qtscxml-examples已安装,测试完成后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "软件包qt5-qtscxml-examples未安装,将进行安装测试"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在qt5-qtscxml-examples软件包"
|
||||
dnf list available qt5-qtscxml-examples
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到qt5-qtscxml-examples软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装qt5-qtscxml-examples软件包"
|
||||
dnf install -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "安装qt5-qtscxml-examples软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证软件包已正确安装"
|
||||
rpm -q qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "验证软件包安装失败"
|
||||
|
||||
LOG_INFO "步骤5:执行软件包卸载测试"
|
||||
dnf remove -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "卸载qt5-qtscxml-examples软件包失败"
|
||||
|
||||
LOG_INFO "步骤6:验证软件包已正确卸载且无残留"
|
||||
rpm -q qt5-qtscxml-examples
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "软件包qt5-qtscxml-examples卸载后仍有残留"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "软件包qt5-qtscxml-examples已成功卸载,无残留"
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "测试环境清理:由于测试前未安装,无需恢复"
|
||||
else
|
||||
LOG_INFO "测试环境清理:重新安装qt5-qtscxml-examples软件包以恢复原始状态"
|
||||
dnf install -y qt5-qtscxml-examples
|
||||
CHECK_RESULT $? 0 0 "重新安装qt5-qtscxml-examples软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:qt5-qtscxml-examples软件包的卸载功能测试通过"
|
||||
}
|
||||
|
||||
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-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Verify documentation generation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Verify documentation generation"
|
||||
|
||||
# 检查是否已安装rubygem-activerecord-doc
|
||||
LOG_INFO "检查是否已安装rubygem-activerecord-doc"
|
||||
if dnf list installed rubygem-activerecord-doc &>/dev/null; then
|
||||
LOG_INFO "rubygem-activerecord-doc已安装,测试结束后保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "rubygem-activerecord-doc未安装,测试结束后将卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有rubygem-activerecord-doc
|
||||
LOG_INFO "检查yum源中是否有rubygem-activerecord-doc"
|
||||
if ! dnf list available rubygem-activerecord-doc &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到rubygem-activerecord-doc"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装rubygem-activerecord-doc
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装rubygem-activerecord-doc"
|
||||
dnf install -y rubygem-activerecord-doc
|
||||
CHECK_RESULT $? 0 0 "安装rubygem-activerecord-doc失败"
|
||||
fi
|
||||
|
||||
# 验证文档生成功能
|
||||
LOG_INFO "验证文档生成功能"
|
||||
gem which activerecord &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "activerecord文档生成失败"
|
||||
|
||||
# 清理环境,恢复到之前的状态
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载rubygem-activerecord-doc"
|
||||
dnf remove -y rubygem-activerecord-doc
|
||||
CHECK_RESULT $? 0 0 "卸载rubygem-activerecord-doc失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Verify documentation generation"
|
||||
}
|
||||
|
||||
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-19
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 验证 erubi 的自动 HTML 转义功能是否能正确工作,防止 XSS 攻击。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装 rubygem-erubi-doc 软件包
|
||||
LOG_INFO "检查 rubygem-erubi-doc 软件包是否已安装"
|
||||
rpm -q rubygem-erubi-doc > /dev/null 2>&1
|
||||
package_installed=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ $package_installed -eq 0 ]; then
|
||||
LOG_INFO "检测到 rubygem-erubi-doc 软件包已安装"
|
||||
initial_installed=true
|
||||
else
|
||||
LOG_INFO "检测到 rubygem-erubi-doc 软件包未安装"
|
||||
initial_installed=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 rubygem-erubi-doc 软件包
|
||||
LOG_INFO "检查 yum 源中是否有 rubygem-erubi-doc 软件包"
|
||||
dnf list available rubygem-erubi-doc > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中未找到 rubygem-erubi-doc 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$initial_installed" = false ]; then
|
||||
LOG_INFO "安装 rubygem-erubi-doc 软件包"
|
||||
dnf install -y rubygem-erubi-doc
|
||||
CHECK_RESULT $? 0 0 "安装 rubygem-erubi-doc 软件包失败"
|
||||
fi
|
||||
|
||||
# 验证 erubi 的自动 HTML 转义功能是否能正确工作,防止 XSS 攻击
|
||||
LOG_INFO "验证 erubi 的自动 HTML 转义功能是否能正确工作,防止 XSS 攻击"
|
||||
|
||||
# 创建测试 Ruby 脚本
|
||||
cat > test_erubi_escape.rb << "EOF"
|
||||
require "erubi"
|
||||
|
||||
# 测试自动 HTML 转义功能
|
||||
template = <<~TEMPLATE
|
||||
<div><%= malicious_input %></div>
|
||||
TEMPLATE
|
||||
|
||||
# 模拟恶意输入(XSS 攻击尝试)
|
||||
malicious_input = "<script>alert("XSS")</script>"
|
||||
|
||||
# 使用 erubi 渲染模板
|
||||
engine = Erubi::Engine.new(template, escape: true)
|
||||
rendered = eval(engine.src)
|
||||
|
||||
# 输出渲染结果
|
||||
puts "渲染结果: #{rendered}"
|
||||
|
||||
# 检查是否转义了 HTML 特殊字符
|
||||
expected_output = "<div><script>alert("XSS")</script></div>"
|
||||
if rendered == expected_output
|
||||
puts "测试通过:自动 HTML 转义功能正常工作,防止了 XSS 攻击。"
|
||||
exit 0
|
||||
else
|
||||
puts "测试失败:自动 HTML 转义功能未正常工作,存在 XSS 攻击风险。"
|
||||
exit 1
|
||||
end
|
||||
EOF
|
||||
|
||||
# 执行测试脚本
|
||||
LOG_INFO "执行 erubi 自动 HTML 转义功能测试"
|
||||
ruby test_erubi_escape.rb
|
||||
CHECK_RESULT $? 0 0 "erubi 自动 HTML 转义功能测试失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_erubi_escape.rb
|
||||
|
||||
# 环境恢复:如果初始未安装,则卸载软件包
|
||||
if [ "$initial_installed" = false ]; then
|
||||
LOG_INFO "卸载 rubygem-erubi-doc 软件包"
|
||||
dnf remove -y rubygem-erubi-doc
|
||||
CHECK_RESULT $? 0 0 "卸载 rubygem-erubi-doc 软件包失败"
|
||||
else
|
||||
LOG_INFO "保持 rubygem-erubi-doc 软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,181 +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-19
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 验证 erubi 在初始化时接受不同的配置选项(如转义模式)并生效。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(根据要求直接使用,但实际脚本中需要定义)
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $*" >&2
|
||||
}
|
||||
|
||||
# 定义检查结果函数(根据要求直接使用,但实际脚本中需要定义)
|
||||
CHECK_RESULT() {
|
||||
local actual=$1
|
||||
local expected=$2
|
||||
local exit_code=$3
|
||||
local message=$4
|
||||
if [ $actual -ne $expected ]; then
|
||||
LOG_ERROR "$message"
|
||||
exit $exit_code
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义SSH_CMD函数(根据要求直接使用,但实际脚本中需要定义)
|
||||
SSH_CMD() {
|
||||
local cmd=$1
|
||||
local ip=$2
|
||||
local password=$3
|
||||
local user=$4
|
||||
# 实际实现应根据具体环境配置
|
||||
sshpass -p "$password" ssh -o StrictHostKeyChecking=no "$user@$ip" "$cmd"
|
||||
}
|
||||
|
||||
# 软件包名称
|
||||
PACKAGE="rubygem-erubi-doc"
|
||||
|
||||
# 检查yum源中是否存在软件包
|
||||
LOG_INFO "检查yum源中是否存在软件包 $PACKAGE"
|
||||
dnf list available $PACKAGE &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在软件包 $PACKAGE"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查环境是否已安装软件包
|
||||
LOG_INFO "检查环境是否已安装软件包 $PACKAGE"
|
||||
if rpm -q $PACKAGE &>/dev/null; then
|
||||
LOG_INFO "软件包 $PACKAGE 已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE 未安装,将在测试步骤中安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "安装软件包 $PACKAGE"
|
||||
dnf install -y $PACKAGE
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE 失败"
|
||||
fi
|
||||
|
||||
# 验证erubi在初始化时接受不同的配置选项(如转义模式)并生效
|
||||
LOG_INFO "验证erubi在初始化时接受不同的配置选项(如转义模式)并生效"
|
||||
|
||||
# 创建一个测试Ruby脚本来验证erubi的转义模式选项
|
||||
cat > /tmp/test_erubi.rb << "EOF"
|
||||
require "erubi"
|
||||
|
||||
# 测试默认转义模式(:escape_html)
|
||||
begin
|
||||
engine = Erubi::Engine.new("<%= "<script>" %>")
|
||||
result = engine.src
|
||||
puts "默认转义模式(:escape_html)结果: #{result}"
|
||||
if result.include?("escape: :escape_html")
|
||||
puts "默认转义模式生效"
|
||||
else
|
||||
puts "默认转义模式未生效"
|
||||
exit 1
|
||||
end
|
||||
rescue => e
|
||||
puts "默认转义模式测试失败: #{e.message}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# 测试转义模式为:escape_html_attrs
|
||||
begin
|
||||
engine = Erubi::Engine.new("<%= "<script>" %>", escape: :escape_html_attrs)
|
||||
result = engine.src
|
||||
puts "转义模式:escape_html_attrs结果: #{result}"
|
||||
if result.include?("escape: :escape_html_attrs")
|
||||
puts "转义模式:escape_html_attrs生效"
|
||||
else
|
||||
puts "转义模式:escape_html_attrs未生效"
|
||||
exit 1
|
||||
end
|
||||
rescue => e
|
||||
puts "转义模式:escape_html_attrs测试失败: #{e.message}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# 测试转义模式为:escape_xml
|
||||
begin
|
||||
engine = Erubi::Engine.new("<%= "<script>" %>", escape: :escape_xml)
|
||||
result = engine.src
|
||||
puts "转义模式:escape_xml结果: #{result}"
|
||||
if result.include?("escape: :escape_xml")
|
||||
puts "转义模式:escape_xml生效"
|
||||
else
|
||||
puts "转义模式:escape_xml未生效"
|
||||
exit 1
|
||||
end
|
||||
rescue => e
|
||||
puts "转义模式:escape_xml测试失败: #{e.message}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# 测试转义模式为:escape_xml_attrs
|
||||
begin
|
||||
engine = Erubi::Engine.new("<%= "<script>" %>", escape: :escape_xml_attrs)
|
||||
result = engine.src
|
||||
puts "转义模式:escape_xml_attrs结果: #{result}"
|
||||
if result.include?("escape: :escape_xml_attrs")
|
||||
puts "转义模式:escape_xml_attrs生效"
|
||||
else
|
||||
puts "转义模式:escape_xml_attrs未生效"
|
||||
exit 1
|
||||
end
|
||||
rescue => e
|
||||
puts "转义模式:escape_xml_attrs测试失败: #{e.message}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# 测试不支持的转义模式(应报错)
|
||||
begin
|
||||
engine = Erubi::Engine.new("<%= "<script>" %>", escape: :unsupported_mode)
|
||||
puts "不支持的转义模式未报错,测试失败"
|
||||
exit 1
|
||||
rescue => e
|
||||
puts "不支持的转义模式正确报错: #{e.message}"
|
||||
end
|
||||
EOF
|
||||
|
||||
# 执行测试Ruby脚本
|
||||
LOG_INFO "执行测试Ruby脚本验证erubi配置选项"
|
||||
ruby /tmp/test_erubi.rb
|
||||
CHECK_RESULT $? 0 0 "erubi配置选项验证失败"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f /tmp/test_erubi.rb
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "卸载软件包 $PACKAGE"
|
||||
dnf remove -y $PACKAGE
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,131 +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-19
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 验证 erubi 模板渲染的基本性能,确保在常规使用场景下无明显延迟。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(虽然题目要求直接使用,但实际脚本中需要定义)
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $*"
|
||||
}
|
||||
|
||||
# 定义检查结果函数
|
||||
CHECK_RESULT() {
|
||||
if [ $1 -ne $2 ]; then
|
||||
LOG_ERROR "$4"
|
||||
exit $3
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义SSH_CMD函数(虽然题目要求直接使用,但实际脚本中需要定义)
|
||||
SSH_CMD() {
|
||||
# 这里假设SSH_CMD的实现,实际使用时需要根据环境调整
|
||||
sshpass -p "$3" ssh "$4"@"$2" "$1"
|
||||
}
|
||||
|
||||
# 设置变量
|
||||
PACKAGE_NAME="rubygem-erubi-doc"
|
||||
TEST_COMMAND="erubi"
|
||||
TEST_PARAM="--help"
|
||||
|
||||
# 步骤1:检查yum源中是否存在指定软件包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME"
|
||||
dnf list available $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -ne 0 ]; 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 已安装,脚本结束时将保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试过程中安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 1 "安装软件包 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查命令参数是否存在
|
||||
LOG_INFO "步骤4:检查命令 $TEST_COMMAND 的参数 $TEST_PARAM 是否支持"
|
||||
$TEST_COMMAND $TEST_PARAM &>/dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "命令 $TEST_COMMAND 不支持参数 $TEST_PARAM"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:验证erubi模板渲染的基本性能
|
||||
LOG_INFO "步骤5:验证erubi模板渲染的基本性能,确保在常规使用场景下无明显延迟"
|
||||
|
||||
# 创建一个简单的erubi模板文件
|
||||
cat > /tmp/test_erubi_template.erb << "EOF"
|
||||
<% 5.times do |i| %>
|
||||
Item <%= i %>
|
||||
<% end %>
|
||||
EOF
|
||||
|
||||
# 使用time命令测量渲染时间
|
||||
LOG_INFO "执行erubi模板渲染性能测试"
|
||||
START_TIME=$(date +%s%N)
|
||||
for i in {1..100}; do
|
||||
erubi /tmp/test_erubi_template.erb > /dev/null
|
||||
CHECK_RESULT $? 0 $? "第 $i 次erubi模板渲染失败"
|
||||
done
|
||||
END_TIME=$(date +%s%N)
|
||||
|
||||
# 计算总耗时(毫秒)
|
||||
DURATION=$(( (END_TIME - START_TIME) / 1000000 ))
|
||||
LOG_INFO "100次erubi模板渲染总耗时: ${DURATION}ms"
|
||||
|
||||
# 检查性能是否在可接受范围内(假设100次渲染应在5秒内完成)
|
||||
if [ $DURATION -lt 5000 ]; then
|
||||
LOG_INFO "性能测试通过:100次渲染耗时 ${DURATION}ms,无明显延迟"
|
||||
else
|
||||
LOG_ERROR "性能测试失败:100次渲染耗时 ${DURATION}ms,存在明显延迟"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 步骤6:清理测试文件
|
||||
LOG_INFO "步骤6:清理测试文件"
|
||||
rm -f /tmp/test_erubi_template.erb
|
||||
|
||||
# 步骤7:如果测试前未安装,则卸载软件包
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤7:卸载软件包 $PACKAGE_NAME"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 1 "卸载软件包 $PACKAGE_NAME 失败"
|
||||
else
|
||||
LOG_INFO "步骤7:保持软件包 $PACKAGE_NAME 的安装状态"
|
||||
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 : 2025-12-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 rubygem-erubi-doc 的模板渲染功能,验证是否能正确渲染模板。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 rubygem-erubi-doc 的模板渲染功能"
|
||||
|
||||
# 检查 yum 源中是否存在 rubygem-erubi-doc 软件包
|
||||
LOG_INFO "检查 yum 源中是否存在 rubygem-erubi-doc 软件包"
|
||||
if ! dnf list available rubygem-erubi-doc &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 rubygem-erubi-doc 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装 rubygem-erubi-doc
|
||||
LOG_INFO "检查是否已安装 rubygem-erubi-doc"
|
||||
if rpm -q rubygem-erubi-doc &>/dev/null; then
|
||||
installed=true
|
||||
LOG_INFO "rubygem-erubi-doc 已安装,脚本结束后将保持安装状态"
|
||||
else
|
||||
installed=false
|
||||
LOG_INFO "rubygem-erubi-doc 未安装,将在测试后卸载"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装 rubygem-erubi-doc
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "正在安装 rubygem-erubi-doc"
|
||||
dnf install -y rubygem-erubi-doc
|
||||
CHECK_RESULT $? 0 0 "安装 rubygem-erubi-doc 失败"
|
||||
fi
|
||||
|
||||
# 测试模板渲染功能
|
||||
LOG_INFO "测试 rubygem-erubi-doc 的模板渲染功能"
|
||||
cat << "EOF" > test_template.erb
|
||||
<%= "Hello, World!" %>
|
||||
EOF
|
||||
|
||||
erubi test_template.erb > output.txt
|
||||
CHECK_RESULT $? 0 0 "模板渲染失败"
|
||||
|
||||
# 检查渲染结果是否符合预期
|
||||
LOG_INFO "检查渲染结果是否符合预期"
|
||||
grep -q "Hello, World!" output.txt
|
||||
CHECK_RESULT $? 0 0 "渲染结果不符合预期"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test_template.erb output.txt
|
||||
|
||||
# 如果脚本开始时未安装 rubygem-erubi-doc,则在测试后卸载
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载 rubygem-erubi-doc"
|
||||
dnf remove -y rubygem-erubi-doc
|
||||
CHECK_RESULT $? 0 0 "卸载 rubygem-erubi-doc 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "rubygem-erubi-doc的模板渲染功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,98 +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-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用taglib库进行简单程序编译
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:使用taglib库进行简单程序编译"
|
||||
|
||||
# 检查taglib-devel软件包是否在yum源中
|
||||
LOG_INFO "检查taglib-devel软件包是否在yum源中"
|
||||
dnf list available taglib-devel 2>/dev/null | grep -q taglib-devel
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "taglib-devel软件包在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装taglib-devel
|
||||
LOG_INFO "检查是否已安装taglib-devel"
|
||||
rpm -q taglib-devel >/dev/null 2>&1
|
||||
installed=$?
|
||||
|
||||
if [ $installed -eq 0 ]; then
|
||||
LOG_INFO "taglib-devel已安装,测试结束后将保持安装状态"
|
||||
need_cleanup=0
|
||||
else
|
||||
LOG_INFO "taglib-devel未安装,将进行安装"
|
||||
need_cleanup=1
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装taglib-devel
|
||||
if [ $need_cleanup -eq 1 ]; then
|
||||
LOG_INFO "安装taglib-devel软件包"
|
||||
dnf install -y taglib-devel
|
||||
CHECK_RESULT $? 0 0 "安装taglib-devel失败"
|
||||
fi
|
||||
|
||||
# 创建测试C++程序
|
||||
LOG_INFO "创建测试C++程序"
|
||||
cat > test_taglib.cpp << "EOF"
|
||||
#include <iostream>
|
||||
#include <taglib/tag.h>
|
||||
#include <taglib/fileref.h>
|
||||
|
||||
int main() {
|
||||
std::cout << "TagLib version: " << TAGLIB_MAJOR_VERSION << "."
|
||||
<< TAGLIB_MINOR_VERSION << "." << TAGLIB_PATCH_VERSION << std::endl;
|
||||
|
||||
// 尝试创建一个简单的Tag对象
|
||||
TagLib::Tag tag;
|
||||
std::cout << "TagLib库测试成功!" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 编译测试程序
|
||||
LOG_INFO "编译测试程序"
|
||||
g++ -o test_taglib test_taglib.cpp $(pkg-config --cflags --libs taglib) 2>&1
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
# 运行测试程序
|
||||
LOG_INFO "运行测试程序"
|
||||
./test_taglib
|
||||
CHECK_RESULT $? 0 0 "运行测试程序失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_taglib test_taglib.cpp
|
||||
|
||||
# 如果测试前未安装,则卸载taglib-devel
|
||||
if [ $need_cleanup -eq 1 ]; then
|
||||
LOG_INFO "卸载taglib-devel软件包"
|
||||
dnf remove -y taglib-devel
|
||||
CHECK_RESULT $? 0 0 "卸载taglib-devel失败"
|
||||
else
|
||||
LOG_INFO "保持taglib-devel安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:使用taglib库进行简单程序编译"
|
||||
}
|
||||
|
||||
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-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试taglib开发头文件的存在与可用性
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试taglib开发头文件的存在与可用性"
|
||||
LOG_INFO "检查taglib-devel软件包是否在yum源中可用"
|
||||
dnf list available taglib-devel &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到taglib-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "检查系统是否已安装taglib-devel"
|
||||
rpm -q taglib-devel &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "检测到taglib-devel已安装,测试后保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "未安装taglib-devel,将安装软件包作为测试步骤"
|
||||
INSTALLED=0
|
||||
LOG_INFO "安装taglib-devel软件包"
|
||||
dnf install -y taglib-devel
|
||||
CHECK_RESULT $? 0 0 "安装taglib-devel失败"
|
||||
fi
|
||||
LOG_INFO "测试taglib开发头文件是否存在"
|
||||
test -f /usr/include/taglib/tag.h
|
||||
CHECK_RESULT $? 0 0 "taglib头文件/usr/include/taglib/tag.h不存在"
|
||||
LOG_INFO "测试taglib开发头文件是否可用"
|
||||
cat > /tmp/test_taglib.c << "EOF"
|
||||
#include <taglib/tag.h>
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
printf("TagLib version: %s\n", TAGLIB_VERSION_STRING);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
gcc -o /tmp/test_taglib /tmp/test_taglib.c $(pkg-config --cflags --libs taglib) 2>&1
|
||||
CHECK_RESULT $? 0 0 "编译taglib测试程序失败"
|
||||
/tmp/test_taglib
|
||||
CHECK_RESULT $? 0 0 "运行taglib测试程序失败"
|
||||
LOG_INFO "清理临时测试文件"
|
||||
rm -f /tmp/test_taglib.c /tmp/test_taglib
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "测试结束,卸载安装的taglib-devel软件包"
|
||||
dnf remove -y taglib-devel
|
||||
CHECK_RESULT $? 0 0 "卸载taglib-devel失败"
|
||||
else
|
||||
LOG_INFO "测试结束,保持taglib-devel安装状态"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,137 +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-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试taglib-devel软件包的安装功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装taglib-devel
|
||||
LOG_INFO "检查taglib-devel是否已安装"
|
||||
rpm -q taglib-devel > /dev/null 2>&1
|
||||
is_installed=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ $is_installed -eq 0 ]; then
|
||||
LOG_INFO "taglib-devel已安装,测试结束后将保持安装状态"
|
||||
else
|
||||
LOG_INFO "taglib-devel未安装,将在测试后卸载"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在taglib-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在taglib-devel软件包"
|
||||
dnf list available taglib-devel > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到taglib-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装taglib-devel
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "开始安装taglib-devel软件包"
|
||||
dnf install -y taglib-devel
|
||||
CHECK_RESULT $? 0 0 "安装taglib-devel失败"
|
||||
LOG_INFO "taglib-devel安装成功"
|
||||
fi
|
||||
|
||||
# 验证taglib-devel安装是否正确
|
||||
LOG_INFO "验证taglib-devel安装"
|
||||
rpm -q taglib-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "taglib-devel未正确安装"
|
||||
|
||||
# 检查taglib-devel提供的文件是否存在
|
||||
LOG_INFO "检查taglib-devel提供的文件"
|
||||
if [ -d /usr/include/taglib ]; then
|
||||
LOG_INFO "taglib头文件目录存在"
|
||||
else
|
||||
LOG_ERROR "taglib头文件目录不存在"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查是否包含必要的头文件
|
||||
LOG_INFO "检查必要的头文件"
|
||||
if [ -f /usr/include/taglib/tag.h ]; then
|
||||
LOG_INFO "tag.h头文件存在"
|
||||
else
|
||||
LOG_ERROR "tag.h头文件不存在"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查pkg-config文件是否存在
|
||||
LOG_INFO "检查pkg-config文件"
|
||||
if [ -f /usr/lib64/pkgconfig/taglib.pc ] || [ -f /usr/lib/pkgconfig/taglib.pc ]; then
|
||||
LOG_INFO "taglib.pc文件存在"
|
||||
else
|
||||
LOG_ERROR "taglib.pc文件不存在"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 测试编译一个简单的C++程序
|
||||
LOG_INFO "测试编译一个简单的C++程序"
|
||||
cat > /tmp/test_taglib.cpp << "EOF"
|
||||
#include <taglib/tag.h>
|
||||
#include <iostream>
|
||||
int main() {
|
||||
std::cout << "TagLib version: " << TAGLIB_MAJOR_VERSION << "."
|
||||
<< TAGLIB_MINOR_VERSION << "."
|
||||
<< TAGLIB_PATCH_VERSION << std::endl;
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 尝试编译测试程序
|
||||
LOG_INFO "编译测试程序"
|
||||
g++ -o /tmp/test_taglib /tmp/test_taglib.cpp $(pkg-config --cflags --libs taglib) 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "编译成功"
|
||||
# 运行测试程序
|
||||
/tmp/test_taglib
|
||||
CHECK_RESULT $? 0 0 "运行测试程序失败"
|
||||
LOG_INFO "测试程序运行成功"
|
||||
else
|
||||
LOG_ERROR "编译测试程序失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f /tmp/test_taglib.cpp /tmp/test_taglib
|
||||
|
||||
# 如果测试前未安装,则卸载taglib-devel
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "卸载taglib-devel软件包"
|
||||
dnf remove -y taglib-devel
|
||||
CHECK_RESULT $? 0 0 "卸载taglib-devel失败"
|
||||
LOG_INFO "taglib-devel卸载成功"
|
||||
|
||||
# 验证卸载是否成功
|
||||
LOG_INFO "验证taglib-devel是否已卸载"
|
||||
rpm -q taglib-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "taglib-devel卸载失败"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "taglib-devel已成功卸载"
|
||||
fi
|
||||
else
|
||||
LOG_INFO "保持taglib-devel安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "taglib-devel安装功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality of texlive-chkfloat
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 texlive-chkfloat 的基本功能"
|
||||
|
||||
# 检查是否已安装 texlive-chkfloat
|
||||
LOG_INFO "检查是否已安装 texlive-chkfloat"
|
||||
dnf list installed texlive-chkfloat > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-chkfloat 已安装,脚本结束时将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-chkfloat 未安装,将在测试完成后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 texlive-chkfloat 软件包
|
||||
LOG_INFO "检查 yum 源中是否有 texlive-chkfloat"
|
||||
dnf list available texlive-chkfloat > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-chkfloat 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装 texlive-chkfloat(如果未安装)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装 texlive-chkfloat"
|
||||
dnf install -y texlive-chkfloat
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-chkfloat 失败"
|
||||
fi
|
||||
|
||||
# 测试 texlive-chkfloat 的基本功能
|
||||
LOG_INFO "测试 texlive-chkfloat 的基本功能"
|
||||
texlive-chkfloat --version > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "texlive-chkfloat --version 命令执行失败"
|
||||
|
||||
# (示例)测试不支持的命令参数(假设 --invalid-param 是不支持的参数)
|
||||
LOG_INFO "测试不支持的命令参数"
|
||||
texlive-chkfloat --invalid-param > /dev/null 2>&1
|
||||
if [ $? -ne 255 ]; then
|
||||
LOG_ERROR "不支持的参数未正确退出"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# (示例)在第二个服务器上执行命令(假设需要)
|
||||
LOG_INFO "在第二个服务器上测试命令"
|
||||
SSH_CMD "texlive-chkfloat --version" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER > /dev/null
|
||||
CHECK_RESULT $? 0 0 "在第二个服务器上执行命令失败"
|
||||
|
||||
# 清理环境(如果最初未安装)
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载 texlive-chkfloat"
|
||||
dnf remove -y texlive-chkfloat
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-chkfloat失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试 texlive-chkfloat基本功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-07
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Basic functionality test for texlive-dtk-doc
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始执行 texlive-dtk-doc 基本功能测试脚本"
|
||||
|
||||
# 检查是否已安装 texlive-dtk-doc
|
||||
LOG_INFO "检查 texlive-dtk-doc 是否已安装"
|
||||
if dnf list installed texlive-dtk-doc &>/dev/null; then
|
||||
LOG_INFO "texlive-dtk-doc 已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-dtk-doc 未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否存在 texlive-dtk-doc
|
||||
LOG_INFO "检查 yum 源中是否存在 texlive-dtk-doc"
|
||||
if ! dnf list available texlive-dtk-doc &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-dtk-doc 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装 texlive-dtk-doc(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装 texlive-dtk-doc"
|
||||
dnf install -y texlive-dtk-doc
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-dtk-doc 失败"
|
||||
fi
|
||||
|
||||
# 测试基本功能
|
||||
LOG_INFO "测试 texlive-texmf-dist-20200327-3.oe1.noarch 的基本功能"
|
||||
if ! command -v texdoc &>/dev/null; then
|
||||
LOG_ERROR "texdoc 命令不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "执行 texdoc dtk 命令"
|
||||
texdoc dtk &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "执行 texdoc dtk 命令失败"
|
||||
|
||||
# 清理环境(如果最初未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 texlive-texmf-dist-20200327-3.oe1.noarch"
|
||||
dnf remove -y texlive-dtk-doc
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-texmf-dist-20200327-3.oe1.noarch失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "texlive-texmf-dist-20200327-3.oe1.noarch基本功能测试完成"
|
||||
}
|
||||
|
||||
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 : 2025-12-12
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality of texlive-dviincl
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 texlive-dviincl 的基本功能"
|
||||
|
||||
# 检查是否已安装 texlive-dviincl
|
||||
LOG_INFO "检查 texlive-dviincl 是否已安装"
|
||||
if dnf list installed texlive-dviincl &>/dev/null; then
|
||||
LOG_INFO "texlive-dviincl 已安装,测试结束后保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-dviincl 未安装,将在测试结束后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 texlive-dviincl
|
||||
LOG_INFO "检查 yum 源中是否有 texlive-dviincl"
|
||||
if ! dnf list available texlive-dviincl &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-dviincl,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 若未安装则安装 texlive-dviincl
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装 texlive-dviincl"
|
||||
dnf install -y texlive-dviincl
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-dviincl 失败"
|
||||
fi
|
||||
|
||||
# 测试基本功能
|
||||
LOG_INFO "测试 texlive-dviincl 的基本功能"
|
||||
texlive-dviincl --version &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "texlive-dviincl 命令执行失败"
|
||||
|
||||
# 测试不支持的参数
|
||||
LOG_INFO "测试不支持的参数"
|
||||
texlive-dviincl --invalid-arg &>/dev/null
|
||||
if [ $? -ne 255 ]; then
|
||||
LOG_ERROR "不支持参数时未返回退出码 255"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 若最初未安装则卸载 texlive-dviincl
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载 texlive-dviincl"
|
||||
dnf remove -y texlive-dviincl
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-dviincl 失败"
|
||||
|
||||
# 再次确认卸载成功以避免残留影响环境
|
||||
if dnf list installed texlive-dviincl &>/dev/null; then
|
||||
LOG_ERROR "卸载 texlive-dviincl后仍检测到残留,环境清理失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
LOG_INFO "保持 texlive-dviincl的已安装状态不变"
|
||||
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-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test listing installed documentation files
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:列出已安装的文档文件"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="texlive-luaxml-doc"
|
||||
|
||||
# 检查软件包是否已在yum源中
|
||||
LOG_INFO "检查yum源中是否存在软件包 ${PACKAGE_NAME}"
|
||||
dnf list available ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 ${PACKAGE_NAME} 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查当前是否已安装软件包
|
||||
LOG_INFO "检查系统是否已安装软件包 ${PACKAGE_NAME}"
|
||||
if rpm -q ${PACKAGE_NAME} &>/dev/null; then
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,将进行安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
LOG_INFO "安装软件包 ${PACKAGE_NAME}"
|
||||
dnf install -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 执行列出文档文件的命令
|
||||
LOG_INFO "执行列出文档文件的命令"
|
||||
rpm -ql ${PACKAGE_NAME} | grep -E "\.pdf$|\.html$|\.txt$|\.md$" > /tmp/doc_files.txt
|
||||
CHECK_RESULT $? 0 0 "列出文档文件失败"
|
||||
|
||||
# 检查是否有文档文件被列出
|
||||
LOG_INFO "检查是否有文档文件被列出"
|
||||
if [ -s /tmp/doc_files.txt ]; then
|
||||
LOG_INFO "文档文件列表:"
|
||||
cat /tmp/doc_files.txt
|
||||
else
|
||||
LOG_ERROR "未找到任何文档文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f /tmp/doc_files.txt
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
LOG_INFO "卸载软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
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-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test existence of key documentation files
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:检查关键文档文件是否存在"
|
||||
LOG_INFO "步骤1:检查yum源中是否存在texlive-luaxml-doc软件包"
|
||||
dnf list texlive-luaxml-doc &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-luaxml-doc软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查当前是否已安装texlive-luaxml-doc软件包"
|
||||
rpm -q texlive-luaxml-doc &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-luaxml-doc已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-luaxml-doc未安装,将进行安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive-luaxml-doc软件包"
|
||||
dnf install -y texlive-luaxml-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-luaxml-doc失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查关键文档文件是否存在"
|
||||
DOC_FILES=(
|
||||
"/usr/share/texlive/texmf-dist/doc/luatex/luaxml/README"
|
||||
"/usr/share/texlive/texmf-dist/doc/luatex/luaxml/luaxml-doc.pdf"
|
||||
"/usr/share/texlive/texmf-dist/doc/luatex/luaxml/luaxml-doc.tex"
|
||||
)
|
||||
|
||||
for file in "${DOC_FILES[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
LOG_INFO "文件 $file 存在"
|
||||
else
|
||||
LOG_ERROR "文件 $file 不存在"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
LOG_INFO "步骤5:环境恢复"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-luaxml-doc软件包"
|
||||
dnf remove -y texlive-luaxml-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-luaxml-doc失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality of reflectgraphics
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装texlive-reflectgraphics
|
||||
LOG_INFO "检查是否已安装texlive-reflectgraphics"
|
||||
rpm -q texlive-reflectgraphics > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-reflectgraphics已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-reflectgraphics未安装,将在测试完成后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在texlive-reflectgraphics包
|
||||
LOG_INFO "检查yum源中是否存在texlive-reflectgraphics包"
|
||||
dnf list available texlive-reflectgraphics > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-reflectgraphics包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-reflectgraphics包(如果未安装)
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-reflectgraphics包"
|
||||
dnf install -y texlive-reflectgraphics
|
||||
CHECK_RESULT $? 0 0 "安装texlive-reflectgraphics失败"
|
||||
fi
|
||||
|
||||
# 测试reflectgraphics基本功能
|
||||
LOG_INFO "测试reflectgraphics基本功能"
|
||||
reflectgraphics --version > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "reflectgraphics命令执行失败"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-reflectgraphics包"
|
||||
dnf remove -y texlive-reflectgraphics
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-reflectgraphics失败"
|
||||
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-10-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic commands
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已经安装texlive-type1cm
|
||||
LOG_INFO "检查是否已经安装texlive-type1cm"
|
||||
rpm -q texlive-type1cm > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-type1cm已经安装,脚本结束时保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-type1cm未安装,将在测试后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-type1cm软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-type1cm软件包"
|
||||
dnf list available texlive-type1cm > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中没有texlive-type1cm软件包"
|
||||
|
||||
# 安装texlive-type1cm软件包
|
||||
LOG_INFO "安装texlive-type1cm软件包"
|
||||
dnf install -y texlive-type1cm
|
||||
CHECK_RESULT $? 0 0 "安装texlive-type1cm失败"
|
||||
|
||||
# 测试基本命令
|
||||
LOG_INFO "测试基本命令"
|
||||
command_to_test="type1cm" # 假设这是要测试的命令,根据实际需求替换为真实命令
|
||||
$command_to_test --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "$command_to_test命令不支持或参数错误"
|
||||
|
||||
# 清理环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-type1cm软件包"
|
||||
dnf remove -y texlive-type1cm
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-type1cm失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-28
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic LaTeX document compilation with type1cm
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已经安装texlive-type1cm
|
||||
LOG_INFO "检查texlive-type1cm是否已安装"
|
||||
dnf list installed texlive-type1cm > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-type1cm已安装,测试后保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-type1cm未安装,将在测试后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-type1cm软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-type1cm软件包"
|
||||
dnf list available texlive-type1cm > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-type1cm软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装texlive-type1cm软件包"
|
||||
dnf install -y texlive-type1cm
|
||||
CHECK_RESULT $? 0 0 "安装texlive-type1cm失败"
|
||||
fi
|
||||
|
||||
# 创建测试LaTeX文档
|
||||
LOG_INFO "创建测试LaTeX文档"
|
||||
cat > test_type1cm.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{type1cm}
|
||||
\begin{document}
|
||||
This is a test document using type1cm package.
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败"
|
||||
|
||||
# 编译LaTeX文档
|
||||
LOG_INFO "编译LaTeX文档"
|
||||
pdflatex test_type1cm.tex > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "编译LaTeX文档失败"
|
||||
|
||||
# 检查是否生成PDF文件
|
||||
LOG_INFO "检查是否生成PDF文件"
|
||||
if [ -f "test_type1cm.pdf" ]; then
|
||||
LOG_INFO "成功生成PDF文件"
|
||||
else
|
||||
LOG_ERROR "未生成PDF文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_type1cm.tex test_type1cm.pdf test_type1cm.log test_type1cm.aux test_type1cm.out
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-type1cm软件包"
|
||||
dnf remove -y texlive-type1cm
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-type1cm失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-28
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test scaling commands like \scalebox and \resizebox with type1cm
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "测试开始: 测试 type1cm 包的缩放命令(如 \\scalebox 和 \\resizebox)"
|
||||
|
||||
# 检查是否已安装 texlive-type1cm 包
|
||||
LOG_INFO "检查 texlive-type1cm 是否已安装"
|
||||
if dnf list installed texlive-type1cm &>/dev/null; then
|
||||
LOG_INFO "texlive-type1cm 已安装,脚本结束时将保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-type1cm 未安装,将在测试过程中安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否有 texlive-type1cm 包
|
||||
LOG_INFO "检查 yum 源中是否有 texlive-type1cm 包"
|
||||
if ! dnf list available texlive-type1cm &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-type1cm 包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装 texlive-type1cm
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装 texlive-type1cm 包"
|
||||
dnf install -y texlive-type1cm
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-type1cm 失败"
|
||||
fi
|
||||
|
||||
# 创建一个简单的 LaTeX 测试文件
|
||||
LOG_INFO "创建测试 LaTeX 文件"
|
||||
cat > test_scale.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{type1cm}
|
||||
\begin{document}
|
||||
测试缩放命令。
|
||||
|
||||
\scalebox{2}{放大文本}
|
||||
|
||||
\resizebox{2cm}{1cm}{调整大小文本}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# 使用 pdflatex 编译测试文件
|
||||
LOG_INFO "使用 pdflatex 编译 LaTeX 文件"
|
||||
pdflatex -interaction=nonstopmode test_scale.tex
|
||||
CHECK_RESULT $? 0 0 "pdflatex 编译失败"
|
||||
|
||||
# 检查生成的 PDF 文件是否存在
|
||||
LOG_INFO "检查生成的 PDF 文件"
|
||||
if [ -f test_scale.pdf ]; then
|
||||
LOG_INFO "PDF 文件生成成功"
|
||||
else
|
||||
LOG_ERROR "PDF 文件未生成"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test_scale.tex test_scale.aux test_scale.log test_scale.out test_scale.pdf
|
||||
|
||||
# 如果之前未安装,则卸载 texlive-type1cm
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载 texlive-type1cm 包"
|
||||
dnf remove -y texlive-type1cm
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-type1cm 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成: 缩放命令测试通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Basic functionality test
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装texlive-tablvar软件包
|
||||
LOG_INFO "检查是否已安装texlive-tablvar软件包"
|
||||
rpm -q texlive-tablvar > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-tablvar已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-tablvar未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-tablvar软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-tablvar软件包"
|
||||
dnf list available texlive-tablvar > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-tablvar软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-tablvar软件包
|
||||
LOG_INFO "安装texlive-tablvar软件包"
|
||||
dnf install -y texlive-tablvar > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-tablvar失败"
|
||||
|
||||
# 测试texlive-tablvar基本功能
|
||||
LOG_INFO "测试texlive-tablvar基本功能"
|
||||
texdoc tabularx > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "texdoc tabularx命令执行失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-tablvar软件包"
|
||||
dnf remove -y texlive-tablvar > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-tablvar失败"
|
||||
else
|
||||
LOG_INFO "保持texlive-tablvar安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "Basic functionality test完成"
|
||||
|
||||
}
|
||||
|
||||
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 drawing Venn diagrams
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test drawing Venn diagrams"
|
||||
|
||||
# 检查是否已安装texlive-venn软件包
|
||||
LOG_INFO "检查texlive-venn是否已安装"
|
||||
if dnf list installed texlive-venn &>/dev/null; then
|
||||
LOG_INFO "texlive-venn已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-venn未安装,测试结束后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-venn软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-venn软件包"
|
||||
if ! dnf list available texlive-venn &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-venn软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 若未安装则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装texlive-venn软件包"
|
||||
dnf install -y texlive-venn
|
||||
CHECK_RESULT $? 0 0 "安装texlive-venn失败"
|
||||
fi
|
||||
|
||||
# 测试绘制Venn图功能
|
||||
LOG_INFO "测试绘制Venn图功能"
|
||||
venn-draw --test
|
||||
CHECK_RESULT $? 0 0 "绘制Venn图失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-venn软件包"
|
||||
dnf remove -y texlive-venn
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-venn失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test drawing Venn diagrams"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-05
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test configuration file parsing
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试脚本:test_uwsgi-stats-pusher-file_function_config
|
||||
|
||||
LOG_INFO "开始测试配置文件解析功能"
|
||||
|
||||
# 检查是否已安装uwsgi-stats-pusher
|
||||
if ! dnf list installed uwsgi-stats-pusher &>/dev/null; then
|
||||
LOG_INFO "uwsgi-stats-pusher未安装,将进行安装"
|
||||
# 检查yum源中是否有uwsgi-stats-pusher
|
||||
if ! dnf list available uwsgi-stats-pusher &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到uwsgi-stats-pusher软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装uwsgi-stats-pusher
|
||||
dnf install -y uwsgi-stats-pusher
|
||||
CHECK_RESULT $? 0 0 "安装uwsgi-stats-pusher失败"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "uwsgi-stats-pusher已安装,跳过安装步骤"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 测试配置文件解析功能
|
||||
LOG_INFO "测试配置文件解析功能"
|
||||
CONFIG_FILE="/etc/uwsgi-stats-pusher/config.ini"
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
LOG_ERROR "配置文件$CONFIG_FILE不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查配置文件内容是否符合预期
|
||||
EXPECTED_CONTENT="[general]"
|
||||
if ! grep -q "$EXPECTED_CONTENT" "$CONFIG_FILE"; then
|
||||
LOG_ERROR "配置文件内容不符合预期"
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "配置文件解析失败"
|
||||
|
||||
# 清理环境:如果脚本安装了软件包,则卸载
|
||||
if [ "$INSTALLED" -eq 1 ]; then
|
||||
LOG_INFO "卸载uwsgi-stats-pusher"
|
||||
dnf remove -y uwsgi-stats-pusher
|
||||
CHECK_RESULT $? 0 0 "卸载uwsgi-stats-pusher失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试配置文件解析功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,139 +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-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用 -e 参数尝试提高压缩率
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="xz"
|
||||
|
||||
# 判断是否已安装
|
||||
if rpm -q $PACKAGE_NAME &>/dev/null; then
|
||||
LOG_INFO "检测到 $PACKAGE_NAME 已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED_BEFORE="yes"
|
||||
else
|
||||
LOG_INFO "$PACKAGE_NAME 未安装,将在测试过程中安装并在结束后卸载"
|
||||
INSTALLED_BEFORE="no"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否存在 $PACKAGE_NAME 软件包"
|
||||
dnf list available $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在 $PACKAGE_NAME 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = "no" ]; then
|
||||
LOG_INFO "安装 $PACKAGE_NAME 软件包"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 测试使用 -e 参数尝试提高压缩率
|
||||
LOG_INFO "测试使用 -e 参数尝试提高压缩率"
|
||||
|
||||
# 创建测试文件
|
||||
TEST_FILE="test_xz_data.txt"
|
||||
echo "This is a test file for xz compression with -e parameter." > $TEST_FILE
|
||||
|
||||
# 检查 xz 命令是否支持 -e 参数
|
||||
LOG_INFO "检查 xz 命令是否支持 -e 参数"
|
||||
xz --help 2>&1 | grep -q "\-e"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xz 命令不支持 -e 参数"
|
||||
# 清理测试文件
|
||||
rm -f $TEST_FILE
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = "no" ]; then
|
||||
LOG_INFO "卸载 $PACKAGE_NAME 软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 使用 -e 参数进行压缩
|
||||
LOG_INFO "使用 -e 参数压缩测试文件"
|
||||
xz -e $TEST_FILE
|
||||
CHECK_RESULT $? 0 0 "使用 -e 参数压缩失败"
|
||||
|
||||
# 验证压缩文件是否存在
|
||||
COMPRESSED_FILE="$TEST_FILE.xz"
|
||||
if [ -f "$COMPRESSED_FILE" ]; then
|
||||
LOG_INFO "压缩文件 $COMPRESSED_FILE 创建成功"
|
||||
else
|
||||
LOG_ERROR "压缩文件 $COMPRESSED_FILE 未创建"
|
||||
# 清理测试文件
|
||||
rm -f $TEST_FILE
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = "no" ]; then
|
||||
LOG_INFO "卸载 $PACKAGE_NAME 软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 解压文件以验证完整性
|
||||
LOG_INFO "解压文件验证完整性"
|
||||
xz -d $COMPRESSED_FILE
|
||||
CHECK_RESULT $? 0 0 "解压文件失败"
|
||||
|
||||
# 验证解压后的文件内容
|
||||
if [ -f "$TEST_FILE" ]; then
|
||||
ORIGINAL_CONTENT="This is a test file for xz compression with -e parameter."
|
||||
DECOMPRESSED_CONTENT=$(cat $TEST_FILE)
|
||||
if [ "$ORIGINAL_CONTENT" = "$DECOMPRESSED_CONTENT" ]; then
|
||||
LOG_INFO "文件解压后内容完整,-e 参数测试通过"
|
||||
else
|
||||
LOG_ERROR "文件解压后内容不匹配"
|
||||
# 清理测试文件
|
||||
rm -f $TEST_FILE
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = "no" ]; then
|
||||
LOG_INFO "卸载 $PACKAGE_NAME 软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
LOG_ERROR "解压后文件不存在"
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = "no" ]; then
|
||||
LOG_INFO "卸载 $PACKAGE_NAME 软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f $TEST_FILE
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE" = "no" ]; then
|
||||
LOG_INFO "卸载 $PACKAGE_NAME 软件包"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user