This commit is contained in:
2026-04-17 12:46:04 +08:00
108 changed files with 0 additions and 7701 deletions

View File

@@ -1,194 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/dbus-python/dbus-python-devel",
"machine num": 1,
"cases": [
{
"name": "test_dbus-python-devel_dbus-binding-tool_default",
"desc": "测试 dbus-binding-tool 默认执行行为"
},
{
"name": "test_dbus-python-devel_dbus-daemon_version",
"desc": "测试 dbus-daemon 的 --version 参数,验证版本信息输出"
},
{
"name": "test_dbus-python-devel_dbus-daemon_session",
"desc": "测试 dbus-daemon 的 --session 参数,验证会话模式启动"
},
{
"name": "test_dbus-python-devel_dbus-daemon_system",
"desc": "测试 dbus-daemon 的 --system 参数,验证系统模式启动"
},
{
"name": "test_dbus-python-devel_dbus-daemon_config-file",
"desc": "测试 dbus-daemon 的 --config-file=FILE 参数,验证指定配置文件启动"
},
{
"name": "test_dbus-python-devel_dbus-daemon_print-address",
"desc": "测试 dbus-daemon 的 --print-address 参数,验证地址输出功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_print-pid",
"desc": "测试 dbus-daemon 的 --print-pid 参数验证进程ID输出功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_introspect",
"desc": "测试 dbus-daemon 的 --introspect 参数,验证自省功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_address",
"desc": "测试 dbus-daemon 的 --address=ADDRESS 参数,验证指定地址启动"
},
{
"name": "test_dbus-python-devel_dbus-daemon_nopidfile",
"desc": "测试 dbus-daemon 的 --nopidfile 参数验证不生成PID文件功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_nosyslog",
"desc": "测试 dbus-daemon 的 --nosyslog 参数,验证禁用系统日志功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_syslog",
"desc": "测试 dbus-daemon 的 --syslog 参数,验证启用系统日志功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_syslog-only",
"desc": "测试 dbus-daemon 的 --syslog-only 参数,验证仅使用系统日志功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_nofork",
"desc": "测试 dbus-daemon 的 --nofork 参数,验证不进行进程分叉功能"
},
{
"name": "test_dbus-python-devel_dbus-daemon_fork",
"desc": "测试 dbus-daemon 的 --fork 参数,验证进行进程分叉功能"
},
{
"name": "test_dbus-python-devel_dbus-launch_default",
"desc": "测试 dbus-launch 命令的默认行为"
},
{
"name": "test_dbus-python-devel_dbus-monitor_system",
"desc": "测试 dbus-monitor 使用 --system 参数监控系统总线"
},
{
"name": "test_dbus-python-devel_dbus-monitor_session",
"desc": "测试 dbus-monitor 使用 --session 参数监控会话总线"
},
{
"name": "test_dbus-python-devel_dbus-monitor_address",
"desc": "测试 dbus-monitor 使用 --address 参数指定地址监控总线"
},
{
"name": "test_dbus-python-devel_dbus-monitor_monitor",
"desc": "测试 dbus-monitor 使用 --monitor 参数监控消息"
},
{
"name": "test_dbus-python-devel_dbus-monitor_profile",
"desc": "测试 dbus-monitor 使用 --profile 参数分析消息性能"
},
{
"name": "test_dbus-python-devel_dbus-monitor_pcap",
"desc": "测试 dbus-monitor 使用 --pcap 参数以 pcap 格式输出消息"
},
{
"name": "test_dbus-python-devel_dbus-monitor_binary",
"desc": "测试 dbus-monitor 使用 --binary 参数以二进制格式输出消息"
},
{
"name": "test_dbus-python-devel_dbus-run-session_version",
"desc": "测试 dbus-run-session 的版本信息"
},
{
"name": "test_dbus-python-devel_dbus-run-session_help",
"desc": "测试 dbus-run-session 的帮助信息"
},
{
"name": "test_dbus-python-devel_dbus-send_help",
"desc": "测试 dbus-send 命令的 --help 参数,验证是否显示帮助信息"
},
{
"name": "test_dbus-python-devel_dbus-send_system",
"desc": "测试 dbus-send 命令的 --system 参数,验证是否连接到系统总线"
},
{
"name": "test_dbus-python-devel_dbus-send_session",
"desc": "测试 dbus-send 命令的 --session 参数,验证是否连接到会话总线"
},
{
"name": "test_dbus-python-devel_dbus-send_bus",
"desc": "测试 dbus-send 命令的 --bus=ADDRESS 参数,验证是否连接到指定地址的总线"
},
{
"name": "test_dbus-python-devel_dbus-send_peer",
"desc": "测试 dbus-send 命令的 --peer=ADDRESS 参数,验证是否连接到指定地址的对等连接"
},
{
"name": "test_dbus-python-devel_dbus-send_sender",
"desc": "测试 dbus-send 命令的 --sender=NAME 参数,验证是否设置发送者名称"
},
{
"name": "test_dbus-python-devel_dbus-send_dest",
"desc": "测试 dbus-send 命令的 --dest=NAME 参数,验证是否设置目标名称"
},
{
"name": "test_dbus-python-devel_dbus-send_type",
"desc": "测试 dbus-send 命令的 --type=TYPE 参数,验证是否设置消息类型"
},
{
"name": "test_dbus-python-devel_dbus-send_print-reply",
"desc": "测试 dbus-send 命令的 --print-reply 参数,验证是否打印回复"
},
{
"name": "test_dbus-python-devel_dbus-send_reply-timeout",
"desc": "测试 dbus-send 命令的 --reply-timeout=MSEC 参数,验证是否设置回复超时时间"
},
{
"name": "test_dbus-python-devel_dbus-test-tool_black-hole",
"desc": "测试 dbus-test-tool 的 black-hole 子命令功能"
},
{
"name": "test_dbus-python-devel_dbus-test-tool_echo",
"desc": "测试 dbus-test-tool 的 echo 子命令功能"
},
{
"name": "test_dbus-python-devel_dbus-test-tool_spam",
"desc": "测试 dbus-test-tool 的 spam 子命令功能"
},
{
"name": "test_dbus-python-devel_function_install",
"desc": "测试软件包安装功能"
},
{
"name": "test_dbus-python-devel_function_uninstall",
"desc": "测试软件包卸载功能"
},
{
"name": "test_dbus-python-devel_function_integration",
"desc": "测试综合功能集成"
},
{
"name": "test_dbus-python-devel_function_version",
"desc": "测试软件包版本信息"
},
{
"name": "test_dbus-python-devel_function_basic_import",
"desc": "测试Python模块导入功能"
},
{
"name": "test_dbus-python-devel_function_import",
"desc": "测试Python模块导入功能"
},
{
"name": "test_dbus-python-devel_function_basic_usage",
"desc": "测试基础DBus通信功能"
},
{
"name": "test_dbus-python-devel_function_method_call",
"desc": "测试DBus方法调用"
},
{
"name": "test_dbus-python-devel_function_signal_receive",
"desc": "测试DBus信号接收"
}
]
}

View File

@@ -2,21 +2,9 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/gtksourceview4/gtksourceview4-devel",
"machine num": 1,
"cases": [
{
"name": "test_gtksourceview4-devel_function_syntax",
"desc": "Test syntax highlighting functionality"
},
{
"name": "test_gtksourceview4-devel_function_lang",
"desc": "Test language detection functionality"
},
{
"name": "test_gtksourceview4-devel_function_style",
"desc": "Test style scheme loading"
},
{
"name": "test_gtksourceview4-devel_function_search",
"desc": "Test text search feature"
}
]
}

View File

@@ -6,10 +6,6 @@
"name": "test_hibernate4-osgi_install_package",
"desc": "测试软件包 hibernate4-osgi 的安装功能",
"machine num": 1
},
{
"name": "test_hibernate4-osgi_function_query",
"desc": "测试软件包 hibernate4-osgi 的查询功能"
}
]
}

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/libXfixes/libXfixes-help",
"machine num": 1,
"cases": [
{
"name": "test_libXfixes-help_function_install",
"desc": "测试通过包管理器如apt、yum成功安装libXfixes-help软件包"
},
{
"name": "test_libXfixes-help_function_query",
"desc": "测试查询已安装的libXfixes-help软件包版本信息"

View File

@@ -1,30 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/python-flask-session/python-flask-session-help",
"machine num": 1,
"cases": [
{
"name": "test_python-flask-session-help_function_init",
"desc": "Test session initialization"
},
{
"name": "test_python-flask-session-help_function_install",
"desc": "Test package installation"
},
{
"name": "test_python-flask-session-help_function_import",
"desc": "Test module import and version"
},
{
"name": "test_python-flask-session-help_function_basic_use",
"desc": "Test basic session usage"
},
{
"name": "test_python-flask-session-help_function_config",
"desc": "Test session configuration options"
},
{
"name": "test_python-flask-session-help_function_uninstall",
"desc": "Test package uninstallation"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/qt5-qtenginio/qt5-qtenginio-help",
"machine num": 1,
"cases": [
{
"name": "test_qt5-qtenginio-help_function_basic",
"desc": "Test basic functionality of qt5-qtenginio-help"
}
]
}

View File

@@ -1,26 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/qt5-qttools/qt5-qdbusviewer",
"machine num": 1,
"cases": [
{
"name": "test_qt5-qdbusviewer_qdbusviewer-qt5",
"desc": "测试 qdbusviewer-qt5 命令的基本功能"
},
{
"name": "test_qt5-qdbusviewer_function_dbuslist",
"desc": "测试列出DBus服务功能"
},
{
"name": "test_qt5-qdbusviewer_function_dbusintro",
"desc": "测试DBus接口自省功能"
},
{
"name": "test_qt5-qdbusviewer_function_dbuscall",
"desc": "测试DBus方法调用功能"
},
{
"name": "test_qt5-qdbusviewer_function_dbusprop",
"desc": "测试DBus属性读写功能"
}
]
}

View File

@@ -6,21 +6,9 @@
"name": "test_qt6-qtpdf-examples_function_install",
"desc": "测试软件包qt6-qtpdf-examples的安装功能是否正常。"
},
{
"name": "test_qt6-qtpdf-examples_function_uninstall",
"desc": "测试软件包qt6-qtpdf-examples的卸载功能是否正常确保卸载后相关文件被移除。"
},
{
"name": "test_qt6-qtpdf-examples_function_check",
"desc": "检查qt6-qtpdf-examples软件包是否已正确安装到系统中。"
},
{
"name": "test_qt6-qtpdf-examples_function_examples",
"desc": "验证软件包安装后其包含的示例程序如PDF查看器示例能否被找到并可执行。"
},
{
"name": "test_qt6-qtpdf-examples_function_viewer",
"desc": "测试软件包提供的PDF查看器示例程序的基本功能如打开和渲染PDF文件。"
}
]
}

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-f/texlive-datetime2-serbian",
"machine num": 1,
"cases": [
{
"name": "test_texlive-datetime2-serbian_function_datefmt",
"desc": "Test date formatting functionality"
},
{
"name": "test_texlive-datetime2-serbian_function_install",
"desc": "Test installation of the texlive-datetime2-serbian package"
@@ -13,18 +9,6 @@
{
"name": "test_texlive-datetime2-serbian_function_remove",
"desc": "Test removal of the texlive-datetime2-serbian package"
},
{
"name": "test_texlive-datetime2-serbian_function_checkinstalled",
"desc": "Test checking if the package is installed"
},
{
"name": "test_texlive-datetime2-serbian_function_serbiancyr",
"desc": "Test Serbian Cyrillic date formatting"
},
{
"name": "test_texlive-datetime2-serbian_function_serbianlat",
"desc": "Test Serbian Latin date formatting"
}
]
}

View File

@@ -5,18 +5,6 @@
{
"name": "test_texlive-docmute-doc_install",
"desc": "测试软件包是否可以通过包管理器成功安装。"
},
{
"name": "test_texlive-docmute-doc_package_present",
"desc": "测试软件包文件(如.sty文件是否存在于TeX Live系统中。"
},
{
"name": "test_texlive-docmute-doc_documentation_present",
"desc": "测试软件包文档文件(如.pdf文件是否存在于TeX Live文档目录中。"
},
{
"name": "test_texlive-docmute-doc_remove",
"desc": "测试软件包是否可以通过包管理器成功卸载。"
}
]
}

View File

@@ -5,22 +5,6 @@
{
"name": "test_texlive-dyntree-doc_function_install",
"desc": "Verify package installation"
},
{
"name": "test_texlive-dyntree-doc_function_uninstall",
"desc": "Verify package removal"
},
{
"name": "test_texlive-dyntree-doc_function_doc_exist",
"desc": "Check documentation files existence"
},
{
"name": "test_texlive-dyntree-doc_function_doc_content",
"desc": "Validate key documentation content"
},
{
"name": "test_texlive-dyntree-doc_function_list_files",
"desc": "List installed package files"
}
]
}

View File

@@ -6,21 +6,9 @@
"name": "test_texlive-libgreek-doc_function_install",
"desc": "Test package installation"
},
{
"name": "test_texlive-libgreek-doc_function_uninstall",
"desc": "Test package removal"
},
{
"name": "test_texlive-libgreek-doc_function_verify",
"desc": "Verify package is installed"
},
{
"name": "test_texlive-libgreek-doc_function_listfiles",
"desc": "List package documentation files"
},
{
"name": "test_texlive-libgreek-doc_function_viewdoc",
"desc": "Check documentation accessibility"
}
]
}

View File

@@ -7,11 +7,6 @@
"desc": "测试 texlive-mpcolornames-doc 软件包的卸载功能",
"machine num": 1
},
{
"name": "test_texlive-mpcolornames-doc_upgrade",
"desc": "测试 texlive-mpcolornames-doc 软件包的升级功能",
"machine num": 1
},
{
"name": "test_texlive-mpcolornames-doc_install",
"desc": "测试 texlive-mpcolornames-doc 软件包的安装功能",
@@ -21,32 +16,6 @@
"name": "test_texlive-mpcolornames-doc_downgrade",
"desc": "测试 texlive-mpcolornames-doc 软件包的降级功能",
"machine num": 1
},
{
"name": "test_texlive-mpcolornames-doc_rollback",
"desc": "测试 texlive-mpcolornames-doc 软件包的回滚功能",
"machine num": 1
},
{
"name": "test_texlive-mpcolornames-doc_reinstall",
"desc": "测试 texlive-mpcolornames-doc 软件包的重新安装功能",
"machine num": 1
},
{
"name": "test_texlive-mpcolornames-doc_function_install",
"desc": "测试 texlive-mpcolornames-doc 软件包的基本安装功能"
},
{
"name": "test_texlive-mpcolornames-doc_function_verify",
"desc": "验证 texlive-mpcolornames-doc 软件包文件是否完整"
},
{
"name": "test_texlive-mpcolornames-doc_function_usage",
"desc": "测试 texlive-mpcolornames-doc 文档内容的可访问性"
},
{
"name": "test_texlive-mpcolornames-doc_function_conflict",
"desc": "测试 texlive-mpcolornames-doc 与其他包的安装冲突"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-w/texlive-textcase",
"machine num": 1,
"cases": [
{
"name": "test_texlive-textcase_function_caseconv",
"desc": "Test case conversion functionality"
}
]
}

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-titlepic",
"machine num": 1,
"cases": [
{
"name": "test_texlive-titlepic_function_title",
"desc": "Test title generation functionality"
},
{
"name": "test_texlive-titlepic_function_install",
"desc": "Test installation of the texlive-titlepic package"
@@ -13,14 +9,6 @@
{
"name": "test_texlive-titlepic_function_uninstall",
"desc": "Test removal of the texlive-titlepic package"
},
{
"name": "test_texlive-titlepic_function_usage",
"desc": "Test basic usage of the titlepic package in a LaTeX document"
},
{
"name": "test_texlive-titlepic_function_includegraphics",
"desc": "Test including an image in document title"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-vgrid",
"machine num": 1,
"cases": [
{
"name": "test_texlive-vgrid_function_install",
"desc": "Test installation of texlive-vgrid package"
}
]
}

View File

@@ -1,61 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-binding-tool 默认执行行为
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel软件包是否在yum源中
LOG_INFO "检查yum源中是否存在dbus-python-devel软件包..."
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包退出测试"
exit 255
fi
# 检查dbus-binding-tool命令是否已安装
LOG_INFO "检查dbus-binding-tool命令是否已安装..."
command -v dbus-binding-tool > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-binding-tool命令已安装跳过安装步骤"
INSTALLED=true
else
LOG_INFO "dbus-binding-tool命令未安装开始安装..."
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
INSTALLED=false
fi
# 测试dbus-binding-tool默认执行行为
LOG_INFO "测试dbus-binding-tool默认执行行为..."
dbus-binding-tool --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "dbus-binding-tool默认执行失败"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "清理环境卸载dbus-python-devel软件包..."
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
fi
LOG_INFO "测试脚本执行完毕"
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --address=ADDRESS 参数,验证指定地址启动
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-daemon
LOG_INFO "检查是否已安装dbus-python-devel和dbus-daemon"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装"
installed=false
fi
# 检查yum源中是否有dbus-python-devel和dbus-daemon
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-daemon"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel或dbus-daemon"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel和dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 测试--address参数
LOG_INFO "测试--address参数验证指定地址启动"
dbus-daemon --address=unix:path=/tmp/test-dbus.sock > /dev/null 2>&1 &
pid=$!
sleep 1
# 检查进程是否启动成功
ps -p $pid > /dev/null 2>&1
CHECK_RESULT $? 0 0 "指定地址启动失败"
# 检查socket文件是否存在
LOG_INFO "检查socket文件是否存在"
[ -S /tmp/test-dbus.sock ]
CHECK_RESULT $? 0 0 "socket文件未创建"
# 清理测试环境
LOG_INFO "清理测试环境"
kill $pid > /dev/null 2>&1
rm -f /tmp/test-dbus.sock > /dev/null 2>&1
# 如果脚本开始时未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载dbus-python-devel和dbus-daemon"
dnf remove -y dbus-python-devel dbus-daemon > /dev/null
}
main "$@"

View File

@@ -1,87 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --config-file=FILE 参数,验证指定配置文件启动
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel和dbus-daemon是否已安装
LOG_INFO "检查dbus-python-devel和dbus-daemon是否已安装"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装"
installed=false
fi
# 检查yum源中是否有dbus-python-devel和dbus-daemon软件包
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-daemon软件包"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel或dbus-daemon软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel和dbus-daemon软件包"
dnf install -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 创建临时配置文件用于测试
LOG_INFO "创建临时配置文件用于测试"
temp_config=$(mktemp /tmp/dbus-config.XXXXXX)
cat > "$temp_config" <<EOF
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<type>session</type>
<listen>unix:path=/tmp/dbus-test-socket</listen>
</busconfig>
EOF
# 验证--config-file参数
LOG_INFO "验证--config-file参数"
dbus-daemon --config-file="$temp_config" --print-address > /dev/null 2>&1
CHECK_RESULT $? 0 0 "指定配置文件启动失败"
# 清理临时配置文件
LOG_INFO "清理临时配置文件"
rm -f "$temp_config"
# 如果之前未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载dbus-python-devel和dbus-daemon软件包"
dnf remove -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel和dbus-daemon失败"
# 再次检查是否卸载成功
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 1 0 "卸载后仍检测到dbusp-tyhon-devl或dbu-damon存在"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,111 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --fork 参数,验证进行进程分叉功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查yum源中是否存在指定软件包
check_package_exist() {
dnf list available "$1" &> /dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $1 在yum源中不存在"
exit 255
fi
}
# 检查命令参数是否支持
check_command_option() {
if ! "$1" --help | grep -q "$2"; then
LOG_ERROR "命令 $1 不支持参数 $2"
exit 255
fi
}
# 检查dbus-daemon是否已安装
check_dbus_installed() {
rpm -q dbus-daemon &> /dev/null
return $?
}
# 安装dbus-daemon软件包
install_dbus() {
LOG_INFO "正在安装dbus-daemon软件包..."
dnf install -y dbus-daemon &> /dev/null
CHECK_RESULT $? 0 0 "安装dbus-daemon失败"
}
# 卸载dbus-daemon软件包
uninstall_dbus() {
LOG_INFO "正在卸载dbus-daemon软件包..."
dnf remove -y dbus-daemon &> /dev/null
CHECK_RESULT $? 0 0 "卸载dbus-daemon失败"
}
# 测试dbus-daemon的--fork参数功能
test_dbus_fork() {
LOG_INFO "测试开始验证dbus-daemon的--fork参数功能"
# 检查--fork参数是否支持
check_command_option "dbus-daemon" "--fork"
# 启动dbus-daemon并分叉进程
LOG_INFO "启动dbus-daemon并分叉进程..."
dbus-daemon --fork --print-address &> /tmp/dbus_address.txt
# 检查进程是否分叉成功(应有两个进程)
LOG_INFO "检查dbus-daemon进程数..."
process_count=$(ps aux | grep "[d]bus-daemon" | wc -l)
# --fork参数预期结果为2个进程
CHECK_RESULT "$process_count" 2 0 "--fork参数未成功分叉进程"
# 清理临时文件并停止dbus-daemon
LOG_INFO "清理临时文件并停止dbus-daemon..."
killall dbus-daemon &> /dev/null
rm -f /tmp/dbus_address.txt
}
# ------------------------主流程------------------------
LOG_INFO "检查环境准备情况..."
# Step1:检查yum源中是否存在dbus-daemon软件包
check_package_exist "dbus-daemon"
# Step2:检查是否已安装,若未安装则标记为需要清理环境
need_cleanup=0
if ! check_dbus_installed; then
need_cleanup=1
install_dbus
fi
# Step3:执行测试用例
test_dbus_fork
# Step4:环境恢复(若初始未安装则卸载)
if [ "$need_cleanup" -eq 1 ]; then
uninstall_dbus
fi
LOG_INFO "测试完成,环境已恢复。"
}
main "$@"

View File

@@ -1,69 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --introspect 参数,验证自省功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-daemon
LOG_INFO "检查是否已安装dbus-python-devel和dbus-daemon"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装"
installed=false
fi
# 检查yum源中是否有dbus-python-devel和dbus-daemon软件包
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-daemon软件包"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中缺少dbus-python-devel或dbus-daemon软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel和dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 验证dbus-daemon的--introspect参数功能
LOG_INFO "验证dbus-daemon的--introspect参数功能"
output=$(dbus-daemon --introspect)
CHECK_RESULT $? 0 0 "dbus-daemon --introspect执行失败"
# 检查输出是否包含自省信息
LOG_INFO "检查输出是否包含自省信息"
echo "$output" | grep -q "<node"
CHECK_RESULT $? 0 0 "输出中未找到自省信息"
# 恢复环境
if [ "$installed" = false ]; then
LOG_INFO "卸载之前安装的软件包"
dnf remove -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbusp- python- devel或d bus- daemon失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,103 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --nofork 参数,验证不进行进程分叉功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel和dbus-daemon是否已安装
LOG_INFO "检查dbus-python-devel和dbus-daemon是否已安装"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装"
installed=false
fi
# 检查yum源中是否存在dbus-python-devel和dbus-daemon
LOG_INFO "检查yum源中是否存在dbus-python-devel和dbus-daemon"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在dbus-python-devel或dbus-daemon"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel和dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 测试--nofork参数是否存在或支持
LOG_INFO "测试--nofork参数是否存在或支持"
if ! dbus-daemon --help | grep -q -- "--nofork"; then
LOG_ERROR "不支持--nofork参数"
# 如果之前未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载dbus-python-devel和dbus-daemon"
dnf remove -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel和dbus-daemon失败"
fi
exit 255
fi
# 执行带--nofork参数的dbus-daemon命令并验证
LOG_INFO "执行带--nofork参数的dbus-daemon命令"
ps aux | grep -v grep | grep -q dbus-daemon
if [ $? -eq 0 ]; then
LOG_INFO "dbus-daemon进程已存在停止当前进程"
pkill dbus-daemon
fi
dbuser=$(id -un)
dbpath="/run/user/$(id -u)/dbase"
mkdir -p "$dbpath"
chown "$dbuser" "$dbpath"
LOG_INFO "启动dbuse daemon进程不进行分叉(--nofork)"
DBUS_VERBOSE=1 dbuse daemon --session --nofork --address=unix:path="$dbpath"/session_buse_socket &
pid=$!
sleep 2
#检查进程是否存在且未分叉(只有一个进程)
LOG_INFO "验证进程是否未分叉(只有一个进程)"
count=$(ps aux | grep -v grep | grep -c "$pid.*--nofork")
CHECK_RESULT $count 1 0 "验证进程未分叉失败"
#清理环境
LOG_INFO "清理环境"
kill -9 $pid
rm -rf "$dbe path"
#如果之前未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INF0 “卸载db us- python -devel and d bus- daemon”
dnf remove -y db us- python- devel d bus-da emon > /dev/null 2>&1
CHECK_RESULT $? θ θ “卸载db us- python-d e vel and d bus-da emon失败”
fi
LOG_INF0 “测试完成”
exit θ
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --nopidfile 参数验证不生成PID文件功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 dbus-daemon 的 --nopidfile 参数验证不生成PID文件功能"
# 检查软件包是否在yum源中
LOG_INFO "检查软件包 dbus-python-devel 和 dbus-daemon 是否在yum源中"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 255 "软件包 dbus-python-devel 或 dbus-daemon 不在yum源中"
# 检查环境是否已安装软件包
LOG_INFO "检查环境是否已安装 dbus-python-devel 和 dbus-daemon"
installed=false
if rpm -q dbus-python-devel > /dev/null 2>&1 && rpm -q dbus-daemon > /dev/null 2>&1; then
installed=true
LOG_INFO "环境已安装 dbus-python-devel 和 dbus-daemon"
else
LOG_INFO "环境未安装 dbus-python-devel 和 dbus-daemon将进行安装"
fi
# 若未安装则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装 dbus-python-devel 和 dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 检查 --nopidfile 参数是否存在
LOG_INFO "检查 --nopidfile 参数是否存在"
dbus-daemon --help | grep -q -- "--nopidfile"
CHECK_RESULT $? 0 255 "--nopidfile 参数不存在或不支持"
# 验证不生成PID文件功能
LOG_INFO "验证 --nopidfile 参数不生成PID文件功能"
pid_file="/var/run/dbus/pid"
# 清理可能存在的PID文件
if [ -f "$pid_file" ]; then
rm -f "$pid_file"
fi
# 启动 dbus-daemon 并指定 --nopidfile 参数
dbus-daemon --system --nopidfile > /dev/null 2>&1 &
sleep
}
main "$@"

View File

@@ -1,83 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --nosyslog 参数,验证禁用系统日志功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel和dbus-daemon软件包是否在yum源中
LOG_INFO "检查yum源中是否存在dbus-python-devel和dbus-daemon软件包"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel或dbus-daemon软件包"
exit 255
fi
# 检查dbus-daemon是否已安装
LOG_INFO "检查dbus-daemon是否已安装"
rpm -q dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "dbus-daemon已安装脚本结束后将保持安装状态"
else
installed=false
LOG_INFO "dbus-daemon未安装将在测试完成后卸载"
fi
# 安装dbus-python-devel和dbus-daemon软件包如果未安装
if [ "$installed" = false ]; then
LOG_INFO "开始安装dbus-python-devel和dbus-daemon软件包"
dnf install -y dbus-python-devel dbus-daemon
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 检查--nosyslog参数是否支持
LOG_INFO "检查dbus-daemon是否支持--nosyslog参数"
dbus-daemon --help | grep -- "--nosyslog" > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-daemon不支持--nosyslog参数"
if [ "$installed" = false ]; then
dnf remove -y dbus-python-devel dbus-daemon
fi
exit 255
fi
# 测试--nosyslog参数功能
LOG_INFO "测试--nosyslog参数功能"
systemctl stop rsyslog > /dev/null 2>&1 # 临时停止rsyslog服务以避免干扰
CHECK_RESULT $? 0 0 "停止rsyslog服务失败"
LOG_INFO "启动dbus-daemon并禁用系统日志"
/usr/bin/dbus-daemon --system --nosyslog > /dev/null 2>&1 &
CHECK_RESULT $? 0 0 "启动带--nosyslog参数的dbus-daemon失败"
LOG_INFO "验证系统日志中是否无相关日志"
journalctl -u dbus --since="1 minute ago" | grep -i dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 1 0 "系统日志中仍存在dbus-daemon日志"
# 清理环境(如果初始未安装)
if [ "$installed" = false ]; then
LOG_INFO "卸载dbusp-ython-devel和dbsu-dameon软件包"
dnf remove -y dbusp-ythond-evevl dbsu-dameon
CHECKESUL_T$?00"卸载失败"
fi
systemctl start rsylog >/dev/nul l2>&1 #恢复rsylog服务
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --print-address 参数,验证地址输出功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel和dbus-daemon是否已安装
LOG_INFO "检查dbus-python-devel和dbus-daemon是否已安装"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装"
installed=false
fi
# 检查yum源中是否存在dbus-python-devel和dbus-daemon
LOG_INFO "检查yum源中是否存在dbus-python-devel和dbus-daemon"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在dbus-python-devel或dbus-daemon"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "开始安装dbus-python-devel和dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 测试--print-address参数功能
LOG_INFO "测试dbus-daemon的--print-address参数功能"
dbus-daemon --print-address > /dev/null 2>&1
CHECK_RESULT $? 0 0 "--print-address参数不支持或执行失败"
# 获取并验证输出地址
LOG_INFO "获取并验证输出地址"
address=$(dbus-daemon --print-address)
if [ -z "$address" ]; then
LOG_ERROR "--print-address未输出有效地址"
exit 255
else
LOG_INFO "输出地址: $address"
fi
# 恢复环境
if [ "$installed" = false ]; then
LOG_INFO "卸载临时安装的软件包"
dnf remove -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载软件包失败"
fi
}
main "$@"

View File

@@ -1,60 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --print-pid 参数验证进程ID输出功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-daemon
LOG_INFO "检查是否已安装dbus-python-devel和dbus-daemon"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装"
installed=false
fi
# 检查yum源中是否有dbus-python-devel和dbus-daemon软件包
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-daemon软件包"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中缺少dbus-python-devel或dbus-daemon软件包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中缺少dbus-python-devel或dbus-daemon软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel和dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 测试dbus-daemon的--print-pid参数
LOG_INFO "测试dbus-daemon的--print-pid参数"
dbus-daemon --print-pid > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行--print-pid参数失败"
# 验证进程ID输出功能
LOG_INFO "验证进程ID输出功能"
pid=$(db
}
main "$@"

View File

@@ -1,71 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --session 参数,验证会话模式启动
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-daemon
LOG_INFO "检查是否已安装dbus-python-devel和dbus-daemon"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装脚本结束时将保持安装状态"
INSTALLED=1
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装将在测试结束后卸载"
INSTALLED=0
fi
# 检查yum源中是否存在dbus-python-devel和dbus-daemon
LOG_INFO "检查yum源中是否存在dbus-python-devel和dbus-daemon"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在dbus-python-devel或dbus-daemon"
# 安装dbus-python-devel和dbus-daemon
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装dbus-python-devel和dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon
CHECK_RESULT $? 0 0 "安装失败"
fi
# 验证--session参数是否支持
LOG_INFO "验证dbus-daemon的--session参数是否支持"
dbus-daemon --help | grep -q -- "--session"
CHECK_RESULT $? 0 255 "--session参数不支持"
# 启动dbus-daemon会话模式
LOG_INFO "启动dbus-daemon会话模式"
dbus-daemon --session
CHECK_RESULT $? 0 0 "启动会话模式失败"
# 检查会话模式是否成功启动
LOG_INFO "检查会话模式是否成功启动"
ps aux | grep -q "[d]bus-daemon --session"
CHECK_RESULT $? 0 0 "会话模式未成功启动"
# 清理环境:如果之前未安装,则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载dbus-python-devel和dbus-daemon"
dnf remove -y dbus-python-devel dbus-daemon
CHECK_RESULT $? 0 0 "卸载失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --syslog-only 参数,验证仅使用系统日志功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-daemon
LOG_INFO "检查是否已安装dbus-python-devel和dbus-daemon"
rpm -q dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-daemon已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-daemon未安装"
installed=false
fi
# 检查yum源中是否存在dbus-python-devel和dbus-daemon
LOG_INFO "检查yum源中是否存在dbus-python-devel和dbus-daemon"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中不存在dbus-python-devel或dbus-daemon"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在dbus-python-devel或dbus-daemon"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel和dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
fi
# 检查dbus-daemon是否支持--syslog-only参数
LOG_INFO "检查dbus-daemon是否支持--syslog-only参数"
dbus-daemon --help | grep -- "--syslog-only" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "dbus-daemon不支持--syslog-only参数"
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-daemon不支持--syslog-only参数"
exit 255
fi
# 测试--syslog-only参数功能
LOG_INFO "测试--syslog-only参数功能"
systemctl stop dbus > /dev/null 2>&1
dbus-daemon --syslog-only --print-address > /tmp/dbus-address 2>&1 &
pid=$!
sleep 2
# 检查进程是否运行正常
ps -p $pid > /dev/null 2>&1
CHECK_RESULT $? 0 0 "dbu sdaemon进程未正常运行"
# 检查日志是否记录
LOG_INFO "检查系统日志是否记录"
journalctl -u dbux --since "1 minute ago" | grep -- "--syslog-only" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "系统日志未记录--syslog-only相关信息"
#清理测试环境
kill -9 $pid > /dev/null 2>&1
rm -f /tmp/dbus-address > /dev/null 2>&1
systemctl start dbux > /dev/null 22&11
#如果脚本开始时未安装软件包,则在结束时卸载
if [ "$installed" = false ]; then
LOG_INFO_卸载db us_python_de vel和d bus_da emon"
dnf remove -y db us_python_de vel d bus_da emon >/ dev/null 22&11
fi
LOG_INF O_测试完成"
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --syslog 参数,验证启用系统日志功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-daemon
LOG_INFO "检查是否已安装dbus-python-devel和dbus-daemon"
if ! dnf list installed dbus-python-devel &>/dev/null || ! dnf list installed dbus-daemon &>/dev/null; then
LOG_INFO "环境未安装dbus-python-devel或dbus-daemon将进行安装"
# 检查yum源中是否有dbus-python-devel和dbus-daemon
if ! dnf list available dbus-python-devel &>/dev/null || ! dnf list available dbus-daemon &>/dev/null; then
LOG_ERROR "yum源中缺少dbus-python-devel或dbus-daemon软件包"
exit 255
fi
# 安装软件包
dnf install -y dbus-python-devel dbus-daemon
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-daemon失败"
# 标记需要卸载
NEED_UNINSTALL=1
else
LOG_INFO "环境已安装dbus-python-devel和dbus-daemon"
NEED_UNINSTALL=0
fi
# 测试--syslog参数
LOG_INFO "测试--syslog参数验证启用系统日志功能"
if ! dbus-daemon --help | grep -q -- "--syslog"; then
LOG_ERROR "--syslog参数不存在或不支持"
exit 255
fi
# 启动dbus-daemon并启用系统日志
LOG_INFO "启动dbus-daemon并启用系统日志"
dbus-daemon --syslog --print-address > /tmp/dbus-address.txt &
DBUS_PID=$!
CHECK_RESULT $? 0 0 "启动dbus-daemon失败"
# 检查是否成功启用系统日志功能
LOG_INFO "检查是否成功启用系统日志功能"
if grep -q "syslog" /tmp/dbus-address.txt; then
LOG_INFO "成功启用系统日志功能"
else
LOG_ERROR "启用系统日志功能失败"
kill $DBUS_PID &>/dev/null
rm -f /tmp/dbus-address.txt
exit 1
fi
# 清理临时文件
rm -f /tmp/dbus-address.txt
# 停止dbus-daemon
kill $DBUS_PID &>/dev/null
# 恢复环境(如果之前未安装)
if [ $NEED_UNINSTALL -eq 1 ]; then
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --system 参数,验证系统模式启动
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 dbus-daemon 的 --system 参数,验证系统模式启动"
# 检查是否已安装 dbus-python-devel 和 dbus-daemon
LOG_INFO "检查是否已安装 dbus-python-devel 和 dbus-daemon"
dnf list installed dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel 和 dbus-daemon 已安装"
INSTALLED=1
else
LOG_INFO "dbus-python-devel 和 dbus-daemon 未安装"
INSTALLED=0
fi
# 检查 yum 源中是否有 dbus-python-devel 和 dbus-daemon
LOG_INFO "检查 yum 源中是否有 dbus-python-devel 和 dbus-daemon"
dnf list available dbus-python-devel dbus-daemon > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 dbus-python-devel 或 dbus-daemon"
exit 255
fi
# 如果未安装,则安装软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装 dbus-python-devel 和 dbus-daemon"
dnf install -y dbus-python-devel dbus-daemon
CHECK_RESULT $? 0 0 "安装失败"
fi
# 验证 --system 参数
LOG_INFO "验证 --system 参数"
dbus-daemon --system --print-address > /dev/null 2>&1
CHECK_RESULT $? 0 0 "--system 参数不支持或执行失败"
#清理环境
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载 dbuspythondevel anddbusdaemon"
dnf remove -y dbuspythondeveldb usdaemon
CHECK_RESULT $?00"卸载失败"
fi
LOG_INF O"测试完成"
}
main "$@"

View File

@@ -1,71 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-daemon 的 --version 参数,验证版本信息输出
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 dbus-daemon 的 --version 参数,验证版本信息输出"
# 检查是否已安装 dbus-python-devel 和 dbus-daemon
LOG_INFO "检查环境是否已安装 dbus-python-devel 和 dbus-daemon"
if ! dnf list installed dbus-python-devel &> /dev/null || ! command -v dbus-daemon &> /dev/null; then
LOG_INFO "环境未安装,将进行安装"
# 检查 yum 源中是否有 dbus-python-devel
LOG_INFO "检查 yum 源中是否存在 dbus-python-devel"
if ! dnf list available dbus-python-devel &> /dev/null; then
LOG_ERROR "yum 源中不存在 dbus-python-devel退出测试"
exit 255
fi
# 安装 dbus-python-devel
LOG_INFO "安装 dbus-python-devel"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装 dbus-python-devel 失败"
# 标记需要卸载
NEED_UNINSTALL=1
else
LOG_INFO "环境已安装,无需重复安装"
fi
# 检查 --version 参数是否支持
LOG_INFO "检查 --version 参数是否支持"
if ! dbus-daemon --help | grep -q -- "--version"; then
LOG_ERROR "--version 参数不支持,退出测试"
exit 255
fi
# 执行命令并验证版本信息输出
LOG_INFO "执行 dbus-daemon --version 命令并验证输出"
VERSION_OUTPUT=$(dbus-daemon --version)
CHECK_RESULT $? 0 0 "执行 dbus-daemon --version 失败"
LOG_INFO "dbus-daemon version: $VERSION_OUTPUT"
# 清理环境
if [ "$NEED_UNINSTALL" -eq 1 ]; then
LOG_INFO "卸载 dbus-python-devel"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0-1 0 "卸载 dbus-python-devel 失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-launch 命令的默认行为
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel软件包
LOG_INFO "检查是否已安装dbus-python-devel软件包"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel已安装"
installed=true
else
LOG_INFO "dbus-python-devel未安装"
installed=false
fi
# 检查yum源中是否有dbus-python-devel软件包
LOG_INFO "检查yum源中是否有dbus-python-devel软件包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
# 如果未安装则安装dbus-python-devel软件包
if [ "$installed" = false ]; then
LOG_INFO "开始安装dbus-python-devel软件包"
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
LOG_INFO "dbus-python-devel安装成功"
fi
# 测试dbus-launch命令的默认行为
LOG_INFO "测试dbus-launch命令的默认行为"
dbus-launch > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行dbus-launch命令失败"
# 如果之前未安装则卸载dbus-python-devel软件包
if [ "$installed" = false ]; then
LOG_INFO "开始卸载dbus-python-devel软件包"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
LOG_INFO "dbus-python-devel卸载成功"
fi
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-monitor 使用 --address 参数指定地址监控总线
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel包
LOG_INFO "检查是否已安装dbus-python-devel包"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel已安装"
INSTALLED=1
else
LOG_INFO "dbus-python-devel未安装"
INSTALLED=0
fi
# 检查yum源中是否存在dbus-python-devel包
LOG_INFO "检查yum源中是否存在dbus-python-devel包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在dbus-python-devel包"
exit 255
fi
# 如果未安装则安装dbus-python-devel包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "开始安装dbus-python-devel包"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
# 检查dbus-monitor命令是否支持--address参数
LOG_INFO "检查dbus-monitor命令是否支持--address参数"
dbus-monitor --help | grep -- "--address" > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-monitor不支持--address参数"
exit 255
fi
# 测试dbus-monitor使用--address参数指定地址监控总线
LOG_INFO "测试dbus-monitor使用--address参数指定地址监控总线"
dbus-monitor --address=unix:path=/var/run/dbus/system_bus_socket > /dev/null 2>&1 &
MONITOR_PID=$!
sleep 2
# 检查dbus-monitor是否成功启动并监控总线
ps -p $MONITOR_PID > /dev/null 2>&1
CHECK_RESULT $? 0 0 "dbus-monitor未成功启动"
# 结束监控进程
kill $MONITOR_PID > /dev/null 2>&1
# 如果之前未安装则卸载dbus-python-devel包以恢复环境
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载dbus-python-devel包以恢复环境"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $?
}
main "$@"

View File

@@ -1,69 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-monitor 使用 --binary 参数以二进制格式输出消息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 dbus-monitor 使用 --binary 参数以二进制格式输出消息"
# 检查是否已安装 dbus-python-devel 和 dbus-monitor
LOG_INFO "检查是否已安装 dbus-python-devel 和 dbus-monitor"
if ! dnf list installed dbus-python-devel &> /dev/null || ! dnf list installed dbus-monitor &> /dev/null; then
LOG_INFO "未安装 dbus-python-devel 或 dbus-monitor开始安装"
if ! dnf list available dbus-python-devel &> /dev/null || ! dnf list available dbus-monitor &> /dev/null; then
LOG_ERROR "yum源中未找到 dbus-python-devel 或 dbus-monitor 软件包"
exit 255
fi
dnf install -y dbus-python-devel dbus-monitor
CHECK_RESULT $? 0 0 "安装失败"
INSTALLED=1
else
LOG_INFO "dbus-python-devel 和 dbus-monitor 已安装"
INSTALLED=0
fi
# 检查 --binary 参数是否支持
LOG_INFO "检查 --binary 参数是否支持"
dbus-monitor --help | grep -- "--binary" &> /dev/null
CHECK_RESULT $? 0 255 "--binary 参数不支持"
# 执行测试命令
LOG_INFO "执行测试命令dbus-monitor --binary"
dbus-monitor --binary &> /dev/null &
PID=$!
sleep 2
# 检查进程是否运行
ps -p $PID &> /dev/null
CHECK_RESULT $? 0 0 "dbus-monitor 进程未运行"
# 清理进程
kill -9 $PID &> /dev/null
#恢复环境
if [ $INSTALLED -eq 1 ]; then
LOG_INFO "卸载临时安装的软件包"
dnf remove -y dbus-python-devel dbus-monitor
CHECK_RESULT $? 0 0 "卸载失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,58 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-monitor 使用 --monitor 参数监控消息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-monitor
LOG_INFO "检查是否已安装dbus-python-devel和dbus-monitor"
if ! dnf list installed dbus-python-devel &> /dev/null || ! dnf list installed dbus-monitor &> /dev/null; then
LOG_INFO "dbus-python-devel或dbus-monitor未安装将进行安装"
# 检查yum源中是否有dbus-python-devel和dbus-monitor
if ! dnf list available dbus-python-devel &> /dev/null || ! dnf list available dbus-monitor &> /dev/null; then
LOG_ERROR "yum源中缺少dbus-python-devel或dbus-monitor软件包"
exit 255
fi
# 安装软件包
dnf install -y dbus-python-devel dbus-monitor
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-monitor失败"
# 标记需要卸载
NEED_UNINSTALL=1
else
LOG_INFO "dbus-python-devel和dbus-monitor已安装"
fi
# 测试dbus-monitor的--monitor参数
LOG_INFO "测试dbus-monitor的--monitor参数"
dbus-monitor --monitor &> /dev/null
CHECK_RESULT $? 0 0 "dbus-monitor --monitor参数不支持或执行失败"
# 清理环境
if [ "$NEED_UNINSTALL" -eq 1 ]; then
LOG_INFO "卸载dbus-python-devel和dbus-monitor"
dnf remove -y dbus-python-devel dbus-monitor
CHECK_RESULT $? 0 0 "卸载dbus-python-devel和dbus-monitor失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,68 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-monitor 使用 --pcap 参数以 pcap 格式输出消息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本test_dbus-python-devel_dbus-monitor_pcap
# 步骤1检查是否已安装dbus-python-devel和dbus-monitor
LOG_INFO "检查是否已安装dbus-python-devel和dbus-monitor"
rpm -q dbus-python-devel dbus-monitor > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-monitor已安装脚本结束后将保持安装状态"
INSTALLED=1
else
LOG_INFO "dbus-python-devel和dbus-monitor未安装将在测试结束后卸载"
INSTALLED=0
fi
# 步骤2检查yum源中是否存在dbus-python-devel和dbus-monitor软件包
LOG_INFO "检查yum源中是否存在dbus-python-devel和dbus-monitor软件包"
dnf list available dbus-python-devel dbus-monitor > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在dbus-python-devel或dbus-monitor软件包"
# 步骤3安装dbus-python-devel和dbus-monitor
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装dbus-python-devel和dbus-monitor"
dnf install -y dbus-python-devel dbus-monitor
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-monitor失败"
fi
# 步骤4检查--pcap参数是否支持
LOG_INFO "检查--pcap参数是否支持"
dbus-monitor --help | grep -- "--pcap" > /dev/null 2>&1
CHECK_RESULT $? 0 255 "dbus-monitor不支持--pcap参数"
# 步骤5使用--pcap参数运行dbus-monitor并捕获输出
LOG_INFO "使用--pcap参数运行dbus-monitor并捕获输出"
OUTPUT_FILE="/tmp/dbus-monitor-pcap-output.pcap"
# 启动dbus-monitor并重定向输出到文件后台运行
dbus-monitor --pcap > "$OUTPUT_FILE" &
MONITOR_PID=$!
# 等待一段时间确保捕获到数据
sleep 5
# 停止dbu
}
main "$@"

View File

@@ -1,65 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-monitor 使用 --profile 参数分析消息性能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装 dbus-python-devel 和 dbus-monitor
LOG_INFO "检查是否已安装 dbus-python-devel 和 dbus-monitor"
rpm -q dbus-python-devel > /dev/null 2>&1
dbus_python_devel_installed=$?
rpm -q dbus-monitor > /dev/null 2>&1
dbus_monitor_installed=$?
# 如果未安装,则尝试安装
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_monitor_installed -ne 0 ]; then
LOG_INFO "尝试安装 dbus-python-devel 和 dbus-monitor"
dnf list available dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在 dbus-python-devel"
dnf list available dbus-monitor > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在 dbus-monitor"
dnf install -y dbus-python-devel dbus-monitor
CHECK_RESULT $? 0 0 "安装 dbus-python-devel 和 dbus-monitor失败"
need_uninstall=1
else
LOG_INFO "dbus-python-devel和dbus-monitor已安装无需重复安装"
fi
# 检查 --profile 参数是否支持
LOG_INFO "检查 --profile 参数是否支持"
dbus-monitor --help | grep -- "--profile" > /dev/null 2>&1
CHECK_RESULT $? 0 255 "--profile 参数不支持"
#执行带--profile参数的dbus-monitor命令并分析性能结果这里仅模拟测试
LOG_INFO "执行带--profile参数的dbus-monitor命令"
output=$(dbu s-mo nitor --profile)
CHECK_RESULT$ ? 00"执行db us-mo nit or--pr ofile失败"
#清理环境(如果之前未安装,则卸载)
if[ "$need_uninstall"=1];then
LOG_INFO"卸载d bus-py thon-de vel和d bus-mo nito r"
dn f remove -y dbu s-py thon-d evel dbu s-mo nito r
CH ECK_RES ULT$ ?00"卸载失败"
fi
LOG_IN FO"测试完成"
}
main "$@"

View File

@@ -1,76 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-monitor 使用 --session 参数监控会话总线
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试 dbus-monitor 使用 --session 参数监控会话总线
LOG_INFO "开始测试 dbus-monitor 使用 --session 参数监控会话总线"
# 检查是否已安装 dbus-python-devel 包
LOG_INFO "检查是否已安装 dbus-python-devel"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel 已安装"
installed=true
else
LOG_INFO "dbus-python-devel 未安装"
installed=false
fi
# 检查 yum 源中是否有 dbus-python-devel 包
LOG_INFO "检查 yum 源中是否有 dbus-python-devel 包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 dbus-python-devel 包"
exit 255
fi
# 如果未安装,则安装 dbus-python-devel
if [ "$installed" = false ]; then
LOG_INFO "安装 dbus-python-devel"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装 dbus-python-devel失败"
fi
# 检查 dbus-monitor 命令是否支持 --session 参数
LOG_INFO "检查 dbus-monitor --session 参数是否支持"
dbus-monitor --help | grep -q -- "--session"
CHECK_RESULT $? 0 0 "--session 参数不支持"
#测试运行 dbus-monitor --session
LOG_INFO "测试运行 dbus-monitor --session"
timeout 5 dbus-monitor --session > /dev/null 2>&1
CHECK_RESULT $? 0 0 "dbus-monitor --session 执行失败"
#恢复环境
if [ "$installed" = false ]; then
LOG_INFO "卸载 dbus-python-devel"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbuspython开发包失败"
fi
LOG_INFO "测试完成"
exit 0
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-monitor 使用 --system 参数监控系统总线
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试 dbus-monitor 使用 --system 参数监控系统总线
LOG_INFO "开始测试 dbus-monitor 使用 --system 参数监控系统总线"
# 检查是否已安装 dbus-python-devel 和 dbus-monitor
LOG_INFO "检查是否已安装 dbus-python-devel 和 dbus-monitor"
rpm -q dbus-python-devel > /dev/null 2>&1
dbus_python_devel_installed=$?
rpm -q dbus-monitor > /dev/null 2>&1
dbus_monitor_installed=$?
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_monitor_installed -ne 0 ]; then
LOG_INFO "未完全安装 dbus-python-devel 或 dbus-monitor准备安装"
# 检查 yum 源中是否有 dbus-python-devel 和 dbus-monitor
LOG_INFO "检查 yum 源中是否有 dbus-python-devel 和 dbus-monitor"
dnf list available dbus-python-devel dbus-monitor > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum 源中缺少 dbus-python-devel 或 dbus-monitor"
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中缺少 dbus-python-devel 或 dbus-monitor"
exit 255
fi
# 安装软件包
LOG_INFO "安装 dbus-python-devel 和 dbus-monitor"
dnf install -y dbus-python-devel dbus-monitor > /dev/null
CHECK_RESULT $? 0 0 "安装 dbustools失败"
# 标记需要卸载
need_uninstall=1
else
LOG_INFO "dbustools 已安装,无需重新安装"
fi
#测试步骤使用dbustools的dbustest工具进行测试
LOG_INFO"开始测试步骤使用dbustest工具进行测试"
#检查是否存在--system参数支持
LOG_INFO"检查是否存在--system参数支持"
command="dbustest --system"
$command --help | grep "\-\-system" >/dev/null2>&1
CHECK_RESULT$?00"--system参数不支持"
if[$?-ne0];then
LOG_ERROR"--system参数不支持"
exit255
fi
#执行命令并检查结果
LOG_INFO"执行命令:$command"
$command>/tmp/dbustest.log2>&1&
pid=$!
sleep5
#检查进程是否运行正常(假设成功运行时会有输出)
grep-q"Success"/tmp/dbustest.log||{kill-9$pid;exit1;}
kill-9$pid
CHECK_RESULT$?00"命令执行失败"
#清理临时文件
rm-f/tmp/dbustest.log
if[$need_uninstall-eq1];then
LOG INFO “卸载 dbustools”
dnf remove -y *tools*
CHECK RESULT $? 0 0 “卸载失败”
fi
LOG INFO “测试完成”
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-run-session 的帮助信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel软件包
LOG_INFO "检查是否已安装dbus-python-devel软件包"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel已安装脚本结束后将保持安装状态"
INSTALLED=1
else
LOG_INFO "dbus-python-devel未安装将在测试后卸载"
INSTALLED=0
fi
# 检查yum源中是否存在dbus-python-devel软件包
LOG_INFO "检查yum源中是否存在dbus-python-devel软件包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在dbus-python-devel软件包"
exit 255
fi
# 安装dbus-python-devel软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "开始安装dbus-python-devel软件包"
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
# 检查dbus-run-session命令是否存在
LOG_INFO "检查dbus-run-session命令是否存在"
which dbus-run-session > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-run-session命令不存在"
if [ $INSTALLED -eq 0 ]; then
dnf remove -y dbus-python-devel > /dev/null 2>&1
fi
exit 255
fi
# 检查dbus-run-session是否支持--help参数
LOG_INFO "检查dbus-run-session是否支持--help参数"
dbus-run-session --help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-run-session不支持--help参数"
if [ $INSTALLED -eq 0 ]; then
dnf remove -y dbus-python-devel > /dev/null 2>&1
fi
exit 255
fi
#获取并验证帮助信息
LOG_INFO"获取并验证dbux- run- session的帮助信息"
dbux- run- session -- help | grep"Usage:" > / dev/ null 2>&1
CHECK_RESULT $? 0 0"获取帮助信息失败"
#清理环境
if [ $INSTALLED-eq 0 ];then
LOG_INFO"卸载d bus- python- de vel软件包"
dnf remove - y d bus- python- de vel >/ dev/ null 2>&l
CHECK_RESULT $? 00"卸载d bus- python- de vel失败"
fi
}
main "$@"

View File

@@ -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-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-run-session 的版本信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-run-session
LOG_INFO "检查是否已安装dbus-python-devel和dbus-run-session"
rpm -q dbus-python-devel > /dev/null 2>&1
dbus_python_devel_installed=$?
rpm -q dbus-run-session > /dev/null 2>&1
dbus_run_session_installed=$?
# 如果未安装,则安装软件包
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_run_session_installed -ne 0 ]; then
LOG_INFO "开始安装dbus-python-devel和dbus-run-session"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
dnf list available dbus-run-session > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-run-session软件包"
exit 255
fi
dnf install -y dbus-python-devel dbus-run-session
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-run-session失败"
else
LOG_INFO "dbus-python-devel和dbus-run-session已安装"
fi
# 测试dbus-run-session的版本信息
LOG_INFO "测试dbus-run-session的版本信息"
dbus-run-session --version > /dev/null 2>&1
if [ $? -eq 0 ]; then
version_output=$(dbus-run-session --version)
LOG_INFO "dbus-run-session版本信息: $version_output"
else
LOG_ERROR "无法获取dbus-run-session版本信息可能参数不支持"
exit 255
fi
# 清理环境
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_run_session_installed -ne 0 ]; then
LOG_INFO "清理环境,卸载之前安装的软件包"
dnf remove -y db
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --bus=ADDRESS 参数,验证是否连接到指定地址的总线
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-send
LOG_INFO "检查是否已安装dbus-python-devel和dbus-send"
rpm -q dbus-python-devel > /dev/null 2>&1
dbus_python_devel_installed=$?
rpm -q dbus-send > /dev/null 2>&1
dbus_send_installed=$?
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_send_installed -ne 0 ]; then
LOG_INFO "环境未安装,开始安装软件包"
# 检查yum源中是否有dbus-python-devel和dbus-send
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
dnf list available dbus-send > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-send软件包"
exit 255
fi
# 安装软件包
dnf install -y dbus-python-devel dbus-send > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-send失败"
else
LOG_INFO "环境已安装,无需重复安装"
fi
# 测试dbus-send命令的--bus=ADDRESS参数
LOG_INFO "测试dbus-send命令的--bus=ADDRESS参数"
# 检查--bus参数是否支持
LOG_INFO "检查--bus参数是否支持"
dbus-send --help | grep -q -- "--bus"
if [ $? -ne 0 ]; then
LOG_ERROR "--bus参数不支持"
exit 255
fi
# 执行测试命令假设总线地址为unix:path=/var/run/dbus/system_bus_socket
LOG_INFO "执行测试命令dbus-send --bus=unix:path=/var/run/dbus/system_bus_socket --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames"
output=$(dbus-send --bus=unix:path=/var/run/dbus/system_bus_socket --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames 2>&1)
CHECK_RESULT $? 0 0 "执行命令失败"
# 验证输出结果是否包含预期内容(假设预期输出包含"org.freedesktop.DBus"
LOG_INFO "验证输出结果"
echo "$output" | grep -q "org.freedesktop.DBus"
CHECK_RESULT $? 0 0 "输出结果不符合预期"
# 环境恢复:如果脚本开始时安装了软件包,则卸载
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbu_send_installed -ne 0 ]; then
LOG_INFO "卸载临时安装的软件包"
dnf remove -y dbus-python-devel dbus-send > /dev/null 2>&1
CHECK_RESULT $? 0 0 “卸载软件包失败”
fi
LOG_INFO “测试完成”
exit
}
main "$@"

View File

@@ -1,78 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --dest=NAME 参数,验证是否设置目标名称
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-send
LOG_INFO "检查是否已安装dbus-python-devel和dbus-send"
if ! dnf list installed dbus-python-devel &>/dev/null || ! command -v dbus-send &>/dev/null; then
LOG_INFO "dbus-python-devel或dbus-send未安装将进行安装"
installed=false
else
LOG_INFO "dbus-python-devel和dbus-send已安装"
installed=true
fi
# 检查yum源中是否存在dbus-python-devel
LOG_INFO "检查yum源中是否存在dbus-python-devel"
if ! dnf list available dbus-python-devel &>/dev/null; then
LOG_ERROR "yum源中不存在dbus-python-devel退出"
exit 255
fi
# 如果未安装则安装dbus-python-devel
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
# 测试dbus-send命令的--dest参数
LOG_INFO "测试dbus-send命令的--dest参数"
if ! dbus-send --help | grep -q -- "--dest"; then
LOG_ERROR "dbus-send不支持--dest参数退出"
exit 255
fi
# 执行dbus-send命令并验证--dest参数功能
LOG_INFO "执行dbus-send命令并验证--dest参数功能"
output=$(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.Peer.Ping 2>&1)
CHECK_RESULT $? 0 0 "执行dbus-send命令失败"
# 验证输出是否包含预期结果
LOG_INFO "验证输出是否包含预期结果"
if echo "$output" | grep -q "method return"; then
LOG_INFO "--dest参数功能验证成功"
else
LOG_ERROR "--dest参数功能验证失败"
exit 1
fi
# 恢复环境
if [ "$installed" = false ]; then
LOG_INFO "卸载dbus-python-devel以恢复环境"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,73 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --help 参数,验证是否显示帮助信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel和dbus-send软件包是否已安装
LOG_INFO "检查dbus-python-devel和dbus-send软件包是否已安装"
dnf list installed dbus-python-devel > /dev/null 2>&1
dbus_python_devel_installed=$?
dnf list installed dbus-send > /dev/null 2>&1
dbus_send_installed=$?
# 如果未安装,则尝试安装
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_send_installed -ne 0 ]; then
LOG_INFO "检测到未安装dbus-python-devel或dbus-send尝试安装"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
dnf list available dbus-send > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-send软件包"
exit 255
fi
dnf install -y dbus-python-devel dbus-send
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-send失败"
installed_during_test=1
else
LOG_INFO "检测到dbus-python-devel和dbus-send已安装"
installed_during_test=0
fi
# 测试dbus-send命令的--help参数
LOG_INFO "测试dbus-send命令的--help参数验证是否显示帮助信息"
output=$(dbus-send --help 2>&1)
CHECK_RESULT $? 0 0 "执行dbus-send --help失败"
# 检查输出是否包含帮助信息
echo "$output" | grep -q "Usage:"
CHECK_RESULT $? 0 0 "--help参数未显示帮助信息"
# 清理环境
if [ $installed_during_test -eq 1 ]; then
LOG_INFO "清理环境,卸载测试期间安装的软件包"
dnf remove -y dbus-python-devel dbus-send > /dev/null 2>&1
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --peer=ADDRESS 参数,验证是否连接到指定地址的对等连接
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel和dbus-send软件包是否已安装
LOG_INFO "检查dbus-python-devel和dbus-send软件包是否已安装"
rpm -q dbus-python-devel dbus-send > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-send软件包已安装"
installed=true
else
LOG_INFO "dbus-python-devel和dbus-send软件包未安装"
installed=false
fi
# 检查yum源中是否有dbus-python-devel和dbus-send软件包
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-send软件包"
dnf list available dbus-python-devel dbus-send > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中缺少dbus-python-devel或dbus-send软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "开始安装dbus-python-devel和dbus-send软件包"
dnf install -y dbus-python-devel dbus-send
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-send软件包失败"
fi
# 测试--peer=ADDRESS参数
LOG_INFO "测试--peer=ADDRESS参数"
bus_address=$(grep -oP "unix:abstract=/tmp/dbus-\w+" /var/run/dbus/system_bus_socket)
if [ -z "$bus_address" ]; then
LOG_ERROR "无法获取DBUS_SESSION_BUS_ADDRESS"
exit 255
fi
LOG_INFO "使用dbus-send命令测试--peer=ADDRESS参数"
result=$(dbus-send --peer="$bus_address" --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames 2>&1)
CHECK_RESULT $? 0 0 "执行dbus-send命令失败"
# 验证输出结果
echo "$result" | grep -q "array \["
CHECK_RESULT $? 0 0 "--peer=ADDRESS参数未生效"
# 清理环境:如果脚本开始时未安装软件包,则卸载
if [ "$installed" = false ]; then
LOG_INFO "卸载临时安装的软件包"
dnf remove -y dbus-python-devel dbus-send > /dev/null 2>&1
fi
}
main "$@"

View File

@@ -1,73 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --print-reply 参数,验证是否打印回复
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel软件包是否已安装
LOG_INFO "检查dbus-python-devel软件包是否已安装"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel软件包已安装"
INSTALLED=true
else
LOG_INFO "dbus-python-devel软件包未安装"
INSTALLED=false
fi
# 检查yum源中是否存在dbus-python-devel软件包
LOG_INFO "检查yum源中是否存在dbus-python-devel软件包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
# 如果未安装则安装dbus-python-devel软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装dbus-python-devel软件包"
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel软件包失败"
LOG_INFO "dbus-python-devel软件包安装成功"
fi
# 测试dbus-send命令的--print-reply参数
LOG_INFO "测试dbus-send命令的--print-reply参数"
DBUS_SEND_OUTPUT=$(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames 2>&1)
CHECK_RESULT $? 0 0 "执行dbus-send命令失败"
# 检查输出是否包含回复信息
LOG_INFO "验证输出是否包含回复信息"
echo "$DBUS_SEND_OUTPUT" | grep -q "method return" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "未找到预期的回复信息"
# 恢复环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始卸载dbus-python-devel软件包"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel软件包失败"
LOG_INFO "dbus-python-devel软件包卸载成功"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --reply-timeout=MSEC 参数,验证是否设置回复超时时间
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-send
LOG_INFO "检查是否已安装dbus-python-devel和dbus-send"
if ! dnf list installed dbus-python-devel &> /dev/null || ! command -v dbus-send &> /dev/null; then
LOG_INFO "环境未安装dbus-python-devel或dbus-send将进行安装"
# 检查yum源中是否有dbus-python-devel
if ! dnf list available dbus-python-devel &> /dev/null; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
# 安装dbus-python-devel
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
INSTALLED=true
else
LOG_INFO "环境已安装dbus-python-devel和dbus-send"
INSTALLED=false
fi
# 测试dbus-send的--reply-timeout参数
LOG_INFO "测试dbus-send的--reply-timeout参数"
# 检查--reply-timeout参数是否支持
if ! dbus-send --help | grep -q -- "--reply-timeout"; then
LOG_ERROR "dbus-send不支持--reply-timeout参数"
exit 255
fi
# 执行dbus-send命令并设置回复超时时间
LOG_INFO "执行dbus-send命令并设置回复超时时间为1000毫秒"
dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply --reply-timeout=1000 /org/freedesktop/DBUS org.freedesktop.DBus.Peer.Ping
CHECK_RESULT $? 0 0 "设置回复超时时间失败"
# 清理环境,如果脚本开始时未安装则卸载软件包
if [ "$INSTALLED" = true ]; then
LOG_INFO "清理环境卸载dbus-python-devel"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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 : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --sender=NAME 参数,验证是否设置发送者名称
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-send
LOG_INFO "检查是否已安装dbus-python-devel和dbus-send"
if ! dnf list installed dbus-python-devel > /dev/null 2>&1; then
LOG_INFO "dbus-python-devel未安装将进行安装"
INSTALLED_DBUS_PYTHON_DEVEL=1
else
LOG_INFO "dbus-python-devel已安装"
INSTALLED_DBUS_PYTHON_DEVEL=0
fi
if ! dnf list installed dbus-tools > /dev/null 2>&1; then
LOG_INFO "dbus-tools未安装将进行安装"
INSTALLED_DBUS_TOOLS=1
else
LOG_INFO "dbus-tools已安装"
INSTALLED_DBUS_TOOLS=0
fi
# 检查yum源中是否有dbus-python-devel和dbus-tools
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-tools"
if ! dnf list available dbus-python-devel > /dev/null 2>&1; then
LOG_ERROR "yum源中未找到dbus-python-devel"
exit 255
fi
if ! dnf list available dbus-tools > /dev/null 2>&1; then
LOG_ERROR "yum源中未找到dbus-tools"
exit 255
fi
# 安装dbus-python-devel和dbus-tools如果未安装
if [ $INSTALLED_DBUS_PYTHON_DEVEL -eq 1 ]; then
LOG_INFO "正在安装dbus-python-devel"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败" || exit $?
fi
if [ $INSTALLED_DBUS_TOOLS -eq 1 ]; then
LOG_INFO "正在安装dbus-tools"
dnf install -y dbus-tools
CHECK_RESULT $? 0 0 "安装dbus-tools失败" || exit $?
fi
# 检查--sender参数是否支持
LOG_INFO "检查--sender参数是否支持"
if ! dbus-send --help | grep -q -- "--sender"; then
LOG_ERROR "不支持--sender参数"
exit 255
fi
# 测试--sender参数功能设置发送者名称并验证结果是否符合预期
LOG_INFO "测试--sender参数功能"
TEST_SENDER_NAME="test_sender"
DBUS_SEND_RESULT=$(timeout 5 dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply --sender=$TEST_SENDER_NAME /org/freedesktop/DBUS org.freedesktop.DBus.ListNames 2>&1)
CHECK_RESULT $? 0 0 "执行命令失败" || exit $?
if echo "$DBUS_SEND_RESULT" | grep -q "$TEST_SENDER_NAME"; then
LOG_INFO "--sender参数功能正常"
else
LOG_ERROR "--sender参数功能异常"
exit $?
fi
# 清理环境(如果脚本开始时未安装则卸载)
LOG_INFO "清理环境"
if [ $INSTALLED_DBUS_PYTHON_DEVEL -eq 1 ]; then
LOG_INFO "卸载之前由脚本安装的dbuspythondel包..."
dnf remove-y dbuspythondel
CHECKRESULT$?00"卸载失败"||exit$?
fi
if[${INSTALLEDDBUSTOOLS}-eq1];then
echo“卸载之前由脚本安葬的dbustools包...”
dnfremove-ydbustools
CHECKRESULT$?00“卸载失败”||exit$?
fi
}
main "$@"

View File

@@ -1,80 +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-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --session 参数,验证是否连接到会话总线
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-send
LOG_INFO "检查是否已安装dbus-python-devel和dbus-send"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_INFO "dbus-python-devel未安装准备安装"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
INSTALLED_DBUS_PYTHON_DEVEL=1
else
LOG_INFO "dbus-python-devel已安装"
INSTALLED_DBUS_PYTHON_DEVEL=0
fi
rpm -q dbus-send > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_INFO "dbus-send未安装准备安装"
dnf list available dbus-send > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-send软件包"
exit 255
fi
dnf install -y dbus-send > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-send失败"
INSTALLED_DBUS_SEND=1
else
LOG_INFO "dbus-send已安装"
INSTALLED_DBUS_SEND=0
fi
# 测试dbus-send的--session参数
LOG_INFO "测试dbus-send的--session参数验证是否连接到会话总线"
DBUS_SEND_OUTPUT=$(dbus-send --session --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DB org.freedesktop.DBus.ListNames 2>&1)
CHECK_RESULT $? 0 0 "执行dbus-send命令失败"
echo "$DBUS_SEND_OUTPUT" | grep -q "array \["
CHECK_RESULT $? 0 0 "dbus-send未正确连接到会话总线"
# 清理环境,恢复到之前的状态
LOG_INFO "清理环境,恢复到之前的状态"
if [ "$INSTALLED_DBUS_PYTHON_DEVEL" -eq 1 ]; then
LOG_INFO "卸载dbus-python-devel"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
fi
if [ "$INSTALLED_DBUS_SEND" -eq 1 ]; then
LOG_INFO “卸载dbu s- sen d”
dn f remov e - y dbu s- sen d> /de v/ nul l 2>&
CHE CK_ RES UL T $ ? 0 0 “卸載d bu s- sen d失敗”
f i
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --system 参数,验证是否连接到系统总线
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-send
LOG_INFO "检查是否已安装dbus-python-devel和dbus-send"
rpm -q dbus-python-devel > /dev/null 2>&1
dbus_python_devel_installed=$?
rpm -q dbus-send > /dev/null 2>&1
dbus_send_installed=$?
# 如果未安装,则安装软件包
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_send_installed -ne 0 ]; then
LOG_INFO "安装dbus-python-devel和dbus-send"
dnf list available dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在dbus-python-devel软件包"
dnf list available dbus-send > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在dbus-send软件包"
dnf install -y dbus-python-devel dbus-send
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 检查--system参数是否支持
LOG_INFO "检查--system参数是否支持"
dbus-send --help | grep -q -- "--system"
CHECK_RESULT $? 0 255 "dbus-send不支持--system参数"
# 测试连接到系统总线
LOG_INFO "测试dbus-send --system连接到系统总线"
dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
CHECK_RESULT $? 0 0 "无法连接到系统总线"
# 恢复环境
if [ $dbus_python_devel_installed -ne 0 ] || [ $dbus_send_installed -ne 0 ]; then
LOG_INFO "卸载dbus-python-devel和dbus-send"
dnf remove -y dbus-python-devel dbus-send
CHECK_RESULT $? 0 0 "卸载软件包失败"
fi
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-send 命令的 --type=TYPE 参数,验证是否设置消息类型
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-send
LOG_INFO "检查是否已安装dbus-python-devel和dbus-send"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_INFO "dbus-python-devel未安装开始安装"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
INSTALLED_DBUS_PYTHON_DEVEL=1
else
LOG_INFO "dbus-python-devel已安装"
INSTALLED_DBUS_PYTHON_DEVEL=0
fi
# 检查dbus-send命令是否支持--type参数
LOG_INFO "检查dbus-send命令是否支持--type参数"
dbus-send --help | grep -q -- "--type"
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-send命令不支持--type参数"
exit 255
fi
# 测试--type参数设置消息类型功能
LOG_INFO "测试--type参数设置消息类型功能"
dbus-send --session --dest=org.freedesktop.DBus --type=signal / org.freedesktop.DBus.Peer.Ping > /dev/null 2>&1
CHECK_RESULT $? 0 0 "设置消息类型失败"
# 清理环境,恢复到之前的状态
if [ ${INSTALLED_DBUS_PYTHON_DEVEL} -eq 1 ]; then
LOG_INFO "卸载dbus-python-devel"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
}
main "$@"

View File

@@ -1,68 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-test-tool 的 black-hole 子命令功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-test-tool
LOG_INFO "检查是否已安装dbus-python-devel和dbus-test-tool"
rpm -q dbus-python-devel dbus-test-tool > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-test-tool已安装"
INSTALLED=1
else
LOG_INFO "dbus-python-devel和dbus-test-tool未安装"
INSTALLED=0
fi
# 检查yum源中是否有dbus-python-devel和dbus-test-tool
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-test-tool"
dnf list available dbus-python-devel dbus-test-tool > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中缺少dbus-python-devel或dbus-test-tool"
exit 255
fi
# 如果未安装,则安装软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装dbus-python-devel和dbus-test-tool"
dnf install -y dbus-python-devel dbus-test-tool
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-test-tool失败"
fi
# 测试dbus-test-tool的black-hole子命令功能
LOG_INFO "测试dbus-test-tool的black-hole子命令功能"
dbus-test-tool black-hole --help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-test-tool不支持black-hole子命令"
exit 255
fi
# 执行black-hole子命令测试
LOG_INFO "执行black-hole子命令测试"
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus dbus-test-tool black-hole > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行black-hole子命令失败"
# 清理环境,如果之前未安装则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载dbus-python-devel和dbus-test-tool"
dnf remove -y db
}
main "$@"

View File

@@ -1,68 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-test-tool 的 echo 子命令功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-test-tool
LOG_INFO "检查是否已安装dbus-python-devel和dbus-test-tool"
if ! dnf list installed dbus-python-devel &>/dev/null || ! dnf list installed dbus-test-tool &>/dev/null; then
LOG_INFO "未安装dbus-python-devel或dbus-test-tool将进行安装"
# 检查yum源中是否有dbus-python-devel和dbus-test-tool
if ! dnf list available dbus-python-devel &>/dev/null || ! dnf list available dbus-test-tool &>/dev/null; then
LOG_ERROR "yum源中缺少dbus-python-devel或dbus-test-tool软件包"
exit 255
fi
# 安装软件包
dnf install -y dbus-python-devel dbus-test-tool
CHECK_RESULT $? 0 0 "安装dbus-python-devel和dbus-test-tool失败"
# 标记需要卸载
NEED_UNINSTALL=1
else
LOG_INFO "已安装dbus-python-devel和dbus-test-tool无需安装"
NEED_UNINSTALL=0
fi
# 测试echo子命令功能
LOG_INFO "测试dbus-test-tool的echo子命令功能"
if ! dbus-test-tool echo --help &>/dev/null; then
LOG_ERROR "echo子命令参数不支持或不存在"
exit 255
fi
# 执行echo子命令
LOG_INFO "执行echo子命令测试"
output=$(dbus-test-tool echo "test_message")
CHECK_RESULT $? 0 0 "执行echo子命令失败"
expected_output="test_message"
CHECK_RESULT "$output" "$expected_output" 0 "echo子命令输出不符合预期"
# 清理环境(如果之前未安装)
if [ "$NEED_UNINSTALL" -eq 1 ]; then
LOG_INFO "卸载dbus-python-devel和dbus-test-tool"
dnf remove -y dbus-python-devel dbus-test-tool
CHECK_RESULT $? 0 0 "卸载dbus-python-devel和dbus-test-tool失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试 dbus-test-tool 的 spam 子命令功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装dbus-python-devel和dbus-test-tool
LOG_INFO "检查是否已安装dbus-python-devel和dbus-test-tool"
rpm -q dbus-python-devel dbus-test-tool > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel和dbus-test-tool已安装"
INSTALLED=1
else
LOG_INFO "dbus-python-devel和dbus-test-tool未安装"
INSTALLED=0
fi
# 检查yum源中是否有dbus-python-devel和dbus-test-tool
LOG_INFO "检查yum源中是否有dbus-python-devel和dbus-test-tool"
dnf list available dbus-python-devel dbus-test-tool > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel或dbus-test-tool"
exit 255
fi
# 如果未安装,则安装软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装dbus-python-devel和dbus-test-tool"
dnf install -y dbus-python-devel dbus-test-tool > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装失败"
fi
# 检查spam子命令是否支持
LOG_INFO "检查dbus-test-tool的spam子命令是否支持"
dbus-test-tool spam --help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "dbus-test-tool不支持spam子命令"
exit 255
fi
# 测试spam子命令功能
LOG_INFO "测试spam子命令功能"
output=$(dbus-test-tool spam 2>&1)
CHECK_RESULT $? 0 0 "执行失败"
# 检查输出结果是否符合预期(假设预期输出包含"spamming"
echo "$output" | grep -q "spamming"
CHECK_RESULT $? 0 0 "输出不符合预期"
# 如果脚本开始时未安装软件包,则在结束时卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载dbus-python-devel和dbus-test-tool"
dnf remove -y dbus-python-devel dbus-test-tool > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载失败"
fi
}
main "$@"

View File

@@ -1,83 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-01-28
# @License : Mulan PSL v2
# @Desc : 测试Python模块导入功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "测试Python模块导入功能开始"
LOG_INFO "步骤1: 检查环境是否已经安装dbus-python-devel软件包"
if dnf list installed | grep -q "dbus-python-devel"; then
LOG_INFO "环境已安装dbus-python-devel软件包脚本将保持安装状态"
already_installed=1
else
LOG_INFO "环境未安装dbus-python-devel软件包"
already_installed=0
fi
LOG_INFO "步骤2: 检查yum源中是否存在dbus-python-devel软件包"
if ! dnf search dbus-python-devel 2>/dev/null | grep -q "dbus-python-devel"; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
LOG_INFO "步骤3: 如果环境未安装dbus-python-devel软件包则开始安装"
if [ $already_installed -eq 0 ]; then
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel软件包失败"
else
LOG_INFO "已安装,跳过安装步骤"
fi
LOG_INFO "步骤4: 验证安装是否成功"
if dnf list installed | grep -q "dbus-python-devel"; then
LOG_INFO "dbus-python-devel软件包安装验证成功"
else
LOG_ERROR "dbus-python-devel软件包安装验证失败"
exit 1
fi
LOG_INFO "步骤5: 测试Python模块导入功能"
LOG_INFO "步骤5.1: 检查python命令是否支持-c参数"
if ! python -c "print("Hello")" &>/dev/null; then
LOG_ERROR "python命令不支持-c参数"
exit 255
fi
LOG_INFO "步骤5.2: 导入dbus模块"
python -c "import dbus"
CHECK_RESULT $? 0 0 "导入dbus模块失败"
LOG_INFO "步骤5.3: 导入dbus.glib模块"
python -c "import dbus.glib"
CHECK_RESULT $? 0 0 "导入dbus.glib模块失败"
LOG_INFO "步骤6: 清理环境"
if [ $already_installed -eq 0 ]; then
LOG_INFO "卸载dbus-python-devel软件包"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel软件包失败"
LOG_INFO "dbus-python-devel软件包已卸载"
else
LOG_INFO "环境已安装dbus-python-devel保持安装状态"
fi
LOG_INFO "测试Python模块导入功能结束"
}
main "$@"

View File

@@ -1,88 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-02-21
# @License : Mulan PSL v2
# @Desc : 测试基础DBus通信功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试基础DBus通信功能"
LOG_INFO "步骤1检查环境是否已安装dbus-python-devel软件包"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel已安装测试结束后将保持安装状态"
INSTALLED="yes"
else
LOG_INFO "dbus-python-devel未安装将在测试步骤中安装并在测试结束后卸载"
INSTALLED="no"
fi
LOG_INFO "步骤2检查yum源中是否存在dbus-python-devel软件包"
dnf list available dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中未找到dbus-python-devel软件包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
if [ "$INSTALLED" = "no" ]; then
LOG_INFO "步骤3安装dbus-python-devel软件包"
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
LOG_INFO "步骤4验证dbus-python-devel基础功能"
python3 -c "import dbus; print("DBus模块导入成功")" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "DBus模块导入失败"
LOG_INFO "步骤5测试DBus系统总线连接"
python3 -c "
import dbus
try:
bus = dbus.SystemBus()
print("系统总线连接成功")
except Exception as e:
print("系统总线连接失败:", e)
exit(1)
" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "DBus系统总线连接失败"
LOG_INFO "步骤6测试DBus会话总线连接"
python3 -c "
import dbus
try:
bus = dbus.SessionBus()
print("会话总线连接成功")
except Exception as e:
print("会话总线连接失败:", e)
exit(1)
" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "DBus会话总线连接失败"
LOG_INFO "步骤7清理测试环境"
if [ "$INSTALLED" = "no" ]; then
LOG_INFO "卸载dbus-python-devel软件包"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
else
LOG_INFO "保持dbus-python-devel安装状态"
fi
LOG_INFO "基础DBus通信功能测试完成"
}
main "$@"

View File

@@ -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 : 2026-02-21
# @License : Mulan PSL v2
# @Desc : 测试Python模块导入功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 判断是否已安装dbus-python-devel
LOG_INFO "检查dbus-python-devel是否已安装"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel已安装"
INSTALLED=1
else
LOG_INFO "dbus-python-devel未安装"
INSTALLED=0
fi
# 检查yum源中是否有dbus-python-devel软件包
LOG_INFO "检查yum源中是否有dbus-python-devel软件包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中没有dbus-python-devel软件包"
exit 255
fi
# 如果未安装则安装
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装dbus-python-devel软件包"
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
# 测试Python模块导入功能
LOG_INFO "测试Python模块导入功能"
python3 -c "import dbus" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "导入dbus模块失败"
python3 -c "import dbus.service" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "导入dbus.service模块失败"
python3 -c "import dbus.mainloop.glib" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "导入dbus.mainloop.glib模块失败"
# 环境恢复:如果之前未安装,则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载dbus-python-devel软件包"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,69 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试软件包安装功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查dbus-python-devel软件包是否已安装
LOG_INFO "检查dbus-python-devel软件包是否已安装"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel软件包已安装脚本结束后保持安装状态"
installed=true
else
LOG_INFO "dbus-python-devel软件包未安装将在测试完成后卸载"
installed=false
fi
# 检查yum源中是否存在dbus-python-devel软件包
LOG_INFO "检查yum源中是否存在dbus-python-devel软件包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
# 安装dbus-python-devel软件包
LOG_INFO "开始安装dbus-python-devel软件包"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel软件包失败"
# 验证软件包是否成功安装
LOG_INFO "验证dbus-python-devel软件包是否成功安装"
rpm -q dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "dbus-python-devel软件包未正确安装"
# 执行测试命令(示例命令,可根据实际需求调整)
LOG_INFO "执行测试命令"
python3 -c "import dbus; print(dbus.__version__)" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "测试命令执行失败"
# 清理环境
if [ "$installed" = false ]; then
LOG_INFO "卸载dbus-python-devel软件包"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel软件包失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-08-14
# @License : Mulan PSL v2
# @Desc : 测试综合功能集成
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试综合功能集成
LOG_INFO "开始测试综合功能集成"
# 检查是否已安装dbus-python-devel
LOG_INFO "检查dbus-python-devel是否已安装"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "dbus-python-devel已安装"
installed=true
else
LOG_INFO "dbus-python-devel未安装"
installed=false
fi
# 检查yum源中是否有dbus-python-devel包
LOG_INFO "检查yum源中是否有dbus-python-devel包"
dnf list available dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中没有dbus-python-devel包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中没有dbus-python-devel包退出"
exit 255
fi
# 如果未安装则安装dbus-python-devel
if [ "$installed" = false ]; then
LOG_INFO "安装dbus-python-devel"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
# 测试命令参数是否存在
LOG_INFO "测试命令参数是否存在"
dbus-send --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "命令参数不支持或不存在"
if [ $? -ne 0 ]; then
LOG_ERROR "命令参数不支持或不存在,退出"
exit 255
fi
# 执行测试命令
LOG_INFO "执行测试命令"
dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行测试命令失败"
# SSH_CMD示例假设需要在第二个节点执行
LOG_INFO "在第二个节点上执行命令示例(假设)"
SSH_CMD ls $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER > /dev/null 2>&1
# 环境恢复如果脚本开始时未安装则卸载dbus-python-devel
if [ "$installed" = false ]; then
LOG_INFO "卸载dbus-python-devel以恢复环境"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
fi
LOG_INFO "测试综合功能集成完成"
}
main "$@"

View File

@@ -1,78 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-02-21
# @License : Mulan PSL v2
# @Desc : 测试DBus方法调用
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试DBus方法调用功能"
LOG_INFO "步骤1: 检查DBus-python-devel软件包是否在yum源中可用"
if ! dnf list available dbus-python-devel &>/dev/null; then
LOG_ERROR "yum源中未找到dbus-python-devel软件包"
exit 255
fi
LOG_INFO "步骤2: 检查是否已安装dbus-python-devel"
if rpm -q dbus-python-devel &>/dev/null; then
LOG_INFO "dbus-python-devel已安装将保持安装状态"
already_installed=1
else
LOG_INFO "dbus-python-devel未安装将进行安装"
already_installed=0
LOG_INFO "步骤3: 安装dbus-python-devel软件包"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
LOG_INFO "步骤4: 验证dbus-python-devel安装成功"
python3 -c "import dbus"
CHECK_RESULT $? 0 0 "无法导入dbus模块"
LOG_INFO "步骤5: 创建测试DBus方法调用的Python脚本"
cat > /tmp/test_dbus_method.py << "EOF"
import dbus
try:
bus = dbus.SystemBus()
proxy = bus.get_object("org.freedesktop.DBus", "/org/freedesktop/DBus")
iface = dbus.Interface(proxy, "org.freedesktop.DBus")
result = iface.ListNames()
print("DBus方法调用成功返回结果类型:", type(result))
except Exception as e:
print(f"DBus方法调用失败: {e}")
exit(1)
EOF
LOG_INFO "步骤6: 执行DBus方法调用测试"
python3 /tmp/test_dbus_method.py
CHECK_RESULT $? 0 0 "DBus方法调用测试失败"
LOG_INFO "步骤7: 清理临时文件"
rm -f /tmp/test_dbus_method.py
if [ $already_installed -eq 0 ]; then
LOG_INFO "步骤8: 卸载测试安装的dbus-python-devel软件包"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
else
LOG_INFO "步骤8: 保持dbus-python-devel安装状态无需卸载"
fi
LOG_INFO "DBus方法调用测试完成"
}
main "$@"

View File

@@ -1,119 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-02-21
# @License : Mulan PSL v2
# @Desc : 测试DBus信号接收
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试DBus信号接收功能"
# 检查软件包是否存在
LOG_INFO "检查yum源中是否存在dbus-python-devel软件包"
if ! dnf list available dbus-python-devel &>/dev/null; then
LOG_ERROR "yum源中不存在dbus-python-devel软件包"
exit 255
fi
# 检查当前环境是否已安装软件包
LOG_INFO "检查当前环境是否已安装dbus-python-devel"
if rpm -q dbus-python-devel &>/dev/null; then
LOG_INFO "dbus-python-devel已安装测试结束后将保持安装状态"
ALREADY_INSTALLED=1
else
LOG_INFO "dbus-python-devel未安装将在测试过程中安装"
ALREADY_INSTALLED=0
fi
# 安装软件包(如果未安装)
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "安装dbus-python-devel软件包"
dnf install -y dbus-python-devel
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
# 检查命令参数支持
LOG_INFO "检查dbus-send命令是否支持--type参数"
if ! dbus-send --help 2>&1 | grep -q "\-\-type"; then
LOG_ERROR "dbus-send命令不支持--type参数"
exit 255
fi
# 测试DBus信号接收
LOG_INFO "启动测试DBus信号接收"
# 这里需要根据实际测试场景编写具体的DBus信号接收测试代码
# 示例创建一个简单的DBus信号发送和接收测试
cat > test_dbus_signal.py << "EOF"
#!/usr/bin/env python3
import dbus
import dbus.service
import dbus.mainloop.glib
from gi.repository import GLib
class TestObject(dbus.service.Object):
def __init__(self, bus_name, object_path):
dbus.service.Object.__init__(self, bus_name, object_path)
@dbus.service.signal(dbus_interface="com.example.Test", signature="s")
def TestSignal(self, message):
print(f"Signal emitted: {message}")
def signal_handler(message):
print(f"Signal received: {message}")
GLib.MainLoop().quit()
if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
# 创建测试对象
test_obj = TestObject(bus, "/com/example/Test")
# 添加信号接收器
bus.add_signal_receiver(signal_handler,
dbus_interface="com.example.Test",
signal_name="TestSignal")
# 发送测试信号
test_obj.TestSignal("Hello DBus Signal")
# 运行主循环等待信号
loop = GLib.MainLoop()
loop.run()
EOF
LOG_INFO "执行DBus信号接收测试"
python3 test_dbus_signal.py
CHECK_RESULT $? 0 0 "DBus信号接收测试失败"
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_dbus_signal.py
# 卸载软件包(如果测试前未安装)
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "卸载dbus-python-devel软件包"
dnf remove -y dbus-python-devel
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
else
LOG_INFO "保持dbus-python-devel软件包安装状态"
fi
LOG_INFO "DBus信号接收测试完成"
}
main "$@"

View File

@@ -1,68 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-08-14
# @License : Mulan PSL v2
# @Desc : 测试软件包卸载功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查yum源中是否存在dbus-python-devel软件包
LOG_INFO "检查yum源中是否存在dbus-python-devel软件包"
dnf list available dbus-python-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在dbus-python-devel软件包"
exit 255
fi
# 检查当前环境是否已安装dbus-python-devel
LOG_INFO "检查当前环境是否已安装dbus-python-devel"
rpm -q dbus-python-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "dbus-python-devel已安装"
else
installed=false
LOG_INFO "dbus-python-devel未安装"
fi
# 如果未安装则安装dbus-python-devel
if [ "$installed" = false ]; then
LOG_INFO "开始安装dbus-python-devel"
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装dbus-python-devel失败"
fi
# 测试卸载功能
LOG_INFO "测试卸载功能"
dnf remove -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载dbus-python-devel失败"
# 如果最初未安装,则重新安装以恢复环境;否则无需操作(保持原状态)
if [ "$installed" = false ]; then
LOG_INFO "恢复环境重新安装dbus-python-devel"
dnf install -y dbus-python-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "恢复环境失败"
else
LOG_INFO "无需恢复环境dbus-python-devel已保持原安装状态"
fi
LOG_INFO "测试脚本执行完毕"
}
main "$@"

View File

@@ -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-01-28
# @License : Mulan PSL v2
# @Desc : 测试软件包版本信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义日志函数
LOG_INFO() {
echo "[INFO] $1"
}
LOG_ERROR() {
echo "[ERROR] $1"
}
# 定义常量
PACKAGE_NAME="dbus-python-devel"
TEST_COMMAND="python3 -c \"import dbus; print(dbus.__version__)\""
# 步骤1检查软件包是否存在于yum源中
LOG_INFO "步骤1检查软件包是否存在于yum源中"
dnf list available "$PACKAGE_NAME" &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中"
exit 255
fi
# 步骤2检查当前是否已安装软件包
LOG_INFO "步骤2检查当前是否已安装软件包"
if rpm -q "$PACKAGE_NAME" &>/dev/null; then
LOG_INFO "软件包 $PACKAGE_NAME 已安装"
INSTALLED_BEFORE=true
else
LOG_INFO "软件包 $PACKAGE_NAME 未安装"
INSTALLED_BEFORE=false
fi
# 步骤3如果未安装则安装软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "步骤3安装软件包 $PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 步骤4测试软件包版本信息
LOG_INFO "步骤4测试软件包版本信息"
eval "$TEST_COMMAND" &>/dev/null
CHECK_RESULT $? 0 0 "获取软件包版本信息失败"
# 步骤5获取并打印版本信息
LOG_INFO "步骤5获取并打印版本信息"
VERSION=$(eval "$TEST_COMMAND" 2>/dev/null)
if [ -n "$VERSION" ]; then
LOG_INFO "dbus-python-devel 版本: $VERSION"
else
LOG_ERROR "无法获取版本信息"
CHECK_RESULT 1 0 0 "版本信息为空"
fi
# 步骤6清理环境恢复到之前的状态
LOG_INFO "步骤6清理环境恢复到之前的状态"
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "卸载软件包 $PACKAGE_NAME"
dnf remove -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "卸载软件包失败"
else
LOG_INFO "保持软件包 $PACKAGE_NAME 的安装状态"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,65 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-09
# @License : Mulan PSL v2
# @Desc : Test language detection functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试语言检测功能
LOG_INFO "开始测试语言检测功能"
# 检查是否已安装gtksourceview4-devel软件包
LOG_INFO "检查gtksourceview4-devel是否已安装"
if rpm -q gtksourceview4-devel > /dev/null; then
LOG_INFO "gtksourceview4-devel已安装测试完成后将保持安装状态"
installed=true
else
LOG_INFO "gtksourceview4-devel未安装测试完成后将卸载"
installed=false
fi
# 检查yum源中是否有gtksourceview4-devel软件包
LOG_INFO "检查yum源中是否有gtksourceview4-devel软件包"
if ! dnf list available gtksourceview4-devel > /dev/null 2>&1; then
LOG_ERROR "yum源中未找到gtksourceview4-devel软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装gtksourceview4-devel软件包"
dnf install -y gtksourceview4-devel
CHECK_RESULT $? 0 0 "安装gtksourceview4-devel失败"
fi
# 测试语言检测功能
LOG_INFO "测试语言检测功能"
command_output=$(gtksourceview4-devel --lang-detect testfile.txt)
CHECK_RESULT $? 0 0 "语言检测功能测试失败"
# 如果最初未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载gtksourceview4-devel软件包"
dnf remove -y gtksourceview4-devel
CHECK_RESULT $? 0 0 "卸载gtksourceview4-devel失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-09
# @License : Mulan PSL v2
# @Desc : Test text search feature
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试文本搜索功能"
# 检查是否已安装gtksourceview4-devel软件包
LOG_INFO "检查gtksourceview4-devel是否已安装"
if rpm -q gtksourceview4-devel &>/dev/null; then
LOG_INFO "gtksourceview4-devel已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "gtksourceview4-devel未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有gtksourceview4-devel软件包
LOG_INFO "检查yum源中是否存在gtksourceview4-devel软件包"
if ! dnf list available gtksourceview4-devel &>/dev/null; then
LOG_ERROR "yum源中未找到gtksourceview4-devel软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装gtksourceview4-devel软件包"
dnf install -y gtksourceview4-devel
CHECK_RESULT $? 0 0 "安装gtksourceview4-devel失败"
fi
# 测试文本搜索功能
LOG_INFO "测试文本搜索功能"
gtksourceview4-search "test"
CHECK_RESULT $? 0 0 "文本搜索功能测试失败"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在卸载gtksourceview4-devel软件包"
dnf remove -y gtksourceview4-devel
CHECK_RESULT $? 0 0 "卸载gtksourceview4-devel失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-30
# @License : Mulan PSL v2
# @Desc : Test syntax highlighting functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装gtksourceview4-devel软件包
LOG_INFO "检查gtksourceview4-devel是否已安装"
rpm -q gtksourceview4-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "gtksourceview4-devel已安装脚本结束时保持安装状态"
INSTALLED=1
else
LOG_INFO "gtksourceview4-devel未安装将在测试后卸载"
INSTALLED=0
fi
# 检查yum源中是否有gtksourceview4-devel软件包
LOG_INFO "检查yum源中是否有gtksourceview4-devel软件包"
dnf list available gtksourceview4-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到gtksourceview4-devel软件包"
exit 255
fi
# 安装gtksourceview4-devel软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装gtksourceview4-devel软件包"
dnf install -y gtksourceview4-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装gtksourceview4-devel失败"
fi
# 测试语法高亮功能
LOG_INFO "测试语法高亮功能"
gtksourceview4-devel --version > /dev/null 2>&1
CHECK_RESULT $? 0 0 "gtksourceview4-devel命令执行失败"
# 清理环境
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载gtksourceview4-devel软件包"
dnf remove -y gtksourceview4-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载gtksourceview4-devel失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,71 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-12
# @License : Mulan PSL v2
# @Desc : 测试软件包 hibernate4-osgi 的查询功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 hibernate4-osgi 的查询功能"
# 检查是否已安装 hibernate4-osgi
LOG_INFO "检查是否已安装 hibernate4-osgi"
if dnf list installed hibernate4-osgi &>/dev/null; then
LOG_INFO "hibernate4-osgi 已安装,脚本结束时将保持安装状态"
installed=true
else
LOG_INFO "hibernate4-osgi 未安装,将在测试后卸载"
installed=false
fi
# 检查 yum 源中是否有 hibernate4-osgi 软件包
LOG_INFO "检查 yum 源中是否有 hibernate4-osgi"
if ! dnf list available hibernate4-osgi &>/dev/null; then
LOG_ERROR "yum 源中未找到 hibernate4-osgi 软件包"
exit 255
fi
# 如果未安装,则安装 hibernate4-osgi
if [ "$installed" = false ]; then
LOG_INFO "正在安装 hibernate4-osgi"
dnf install -y hibernate4-osgi
CHECK_RESULT $? 0 0 "安装 hibernate4-osgi 失败"
fi
# 测试查询功能
LOG_INFO "测试 hibernate4-osgi 的查询功能"
query_output=$(hibernate4-osgi query)
CHECK_RESULT $? 0 0 "hibernate4-osgi query 命令执行失败"
# 验证查询结果是否符合预期
LOG_INFO "验证查询结果是否符合预期"
if [[ "$query_output" != *"expected_output"* ]]; then
LOG_ERROR "查询结果不符合预期"
exit 1
fi
# 如果最初未安装,则在测试完成后卸载 hibernate4-osgi
if [ "$installed" = false ]; then
LOG_INFO "正在卸载 hibernate4-osgi"
dnf remove -y hibernate4-osgi
CHECK_RESULT $? 0 0 "卸载 hibernate4-osgi 失败"
fi
LOG_INFO "hibernate4-osgi 查询功能测试完成"
}
main "$@"

View File

@@ -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-03-08
# @License : Mulan PSL v2
# @Desc : 测试通过包管理器如apt、yum成功安装libXfixes-help软件包
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "步骤1检查libXfixes-help软件包是否在yum源中"
dnf list available libXfixes-help 2>/dev/null | grep -q libXfixes-help
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到libXfixes-help软件包"
exit 255
fi
LOG_INFO "步骤2检查环境中是否已安装libXfixes-help软件包"
rpm -q libXfixes-help >/dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "环境中已安装libXfixes-help软件包标记为已安装状态"
INSTALLED=true
else
LOG_INFO "环境中未安装libXfixes-help软件包标记为未安装状态"
INSTALLED=false
fi
LOG_INFO "步骤3若未安装则安装libXfixes-help软件包"
if [ "$INSTALLED" = false ]; then
dnf install -y libXfixes-help
CHECK_RESULT $? 0 0 "安装libXfixes-help软件包失败"
LOG_INFO "安装libXfixes-help软件包成功"
fi
LOG_INFO "步骤4验证libXfixes-help软件包功能"
# 这里假设libXfixes-help软件包安装后提供了一个可执行命令或库文件例如通过man page验证
# 根据实际软件包情况调整验证命令
man -w libXfixes >/dev/null 2>&1
CHECK_RESULT $? 0 0 "libXfixes-help软件包功能验证失败"
LOG_INFO "步骤5环境清理若脚本开始时未安装则卸载软件包"
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载libXfixes-help软件包"
dnf remove -y libXfixes-help
CHECK_RESULT $? 0 0 "卸载libXfixes-help软件包失败"
LOG_INFO "卸载libXfixes-help软件包成功"
else
LOG_INFO "脚本开始时软件包已安装,保持安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,219 +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-21
# @License : Mulan PSL v2
# @Desc : Test basic session usage
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本test_python-flask-session-help_function_basic_use
# 测试用例描述Test basic session usage
# 定义颜色输出
LOG_INFO() {
echo -e "\033[32m[INFO]\033[0m $1"
}
LOG_ERROR() {
echo -e "\033[31m[ERROR]\033[0m $1"
}
# 检查软件包是否在yum源中
check_package_in_repo() {
local package_name=$1
LOG_INFO "检查软件包 $package_name 是否在yum源中"
dnf list available $package_name 2>/dev/null | grep -q $package_name
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $package_name 不在yum源中"
exit 255
fi
LOG_INFO "软件包 $package_name 在yum源中"
}
# 检查命令参数是否支持
check_command_option() {
local cmd=$1
local option=$2
LOG_INFO "检查命令 $cmd 是否支持参数 $option"
$cmd --help 2>&1 | grep -q -- $option
if [ $? -ne 0 ]; then
LOG_ERROR "命令 $cmd 不支持参数 $option"
exit 255
fi
LOG_INFO "命令 $cmd 支持参数 $option"
}
# 检查是否已安装
check_installed() {
LOG_INFO "检查python3-flask-session-help-function是否已安装"
rpm -q python3-flask-session-help-function >/dev/null 2>&1
return $?
}
# 安装软件包
install_package() {
local package_name=$1
LOG_INFO "安装软件包 $package_name"
dnf install -y $package_name
CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败"
}
# 卸载软件包
uninstall_package() {
local package_name=$1
LOG_INFO "卸载软件包 $package_name"
dnf remove -y $package_name
CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败"
}
# 测试基本session使用
test_basic_session_usage() {
LOG_INFO "开始测试基本session使用功能"
# 创建测试Python脚本
cat > /tmp/test_flask_session.py << "EOF"
from flask import Flask, session
from flask_session import Session
import os
app = Flask(__name__)
app.config["SECRET_KEY"] = "test_secret_key"
app.config["SESSION_TYPE"] = "filesystem"
app.config["SESSION_FILE_DIR"] = "/tmp/flask_session"
Session(app)
@app.route("/set")
def set_session():
session["test_key"] = "test_value"
return "Session set"
@app.route("/get")
def get_session():
return session.get("test_key", "Not found")
@app.route("/clear")
def clear_session():
session.clear()
return "Session cleared"
if __name__ == "__main__":
os.makedirs("/tmp/flask_session", exist_ok=True)
app.run(debug=False)
EOF
LOG_INFO "启动Flask应用进行session测试"
python3 /tmp/test_flask_session.py &
FLASK_PID=$!
sleep 2
# 测试设置session
LOG_INFO "测试设置session"
curl -s http://localhost:5000/set
CHECK_RESULT $? 0 0 "设置session失败"
# 测试获取session
LOG_INFO "测试获取session"
result=$(curl -s http://localhost:5000/get)
if [ "$result" == "test_value" ]; then
LOG_INFO "获取session成功: $result"
else
LOG_ERROR "获取session失败期望"test_value",实际得到: $result"
kill $FLASK_PID 2>/dev/null
return 1
fi
# 测试清除session
LOG_INFO "测试清除session"
curl -s http://localhost:5000/clear
CHECK_RESULT $? 0 0 "清除session失败"
# 验证session已清除
LOG_INFO "验证session已清除"
result=$(curl -s http://localhost:5000/get)
if [ "$result" == "Not found" ]; then
LOG_INFO "session清除验证成功"
else
LOG_ERROR "session清除验证失败"
kill $FLASK_PID 2>/dev/null
return 1
fi
kill $FLASK_PID 2>/dev/null
rm -f /tmp/test_flask_session.py
rm -rf /tmp/flask_session
LOG_INFO "基本session使用测试完成"
return 0
}
# 主函数
main() {
LOG_INFO "开始执行测试脚本test_python-flask-session-help_function_basic_use"
# 检查软件包是否在yum源中
check_package_in_repo python3-flask-session-help-function
# 检查dnf命令是否支持-y参数
check_command_option dnf "-y"
# 检查是否已安装
check_installed
already_installed=$?
if [ $already_installed -eq 0 ]; then
LOG_INFO "检测到python3-flask-session-help-function已安装测试后保持安装状态"
need_uninstall=false
else
LOG_INFO "python3-flask-session-help-function未安装将在测试前安装"
need_uninstall=true
install_package python3-flask-session-help-function
fi
# 执行测试
test_basic_session_usage
test_result=$?
# 环境恢复
LOG_INFO "开始环境恢复"
if [ "$need_uninstall" = true ] && [ $test_result -eq 0 ]; then
uninstall_package python3-flask-session-help-function
else
LOG_INFO "保持软件包安装状态"
fi
# 清理临时文件
rm -f /tmp/test_flask_session.py 2>/dev/null
rm -rf /tmp/flask_session 2>/dev/null
LOG_INFO "测试脚本执行完成"
if [ $test_result -eq 0 ]; then
LOG_INFO "测试通过"
exit 0
else
LOG_ERROR "测试失败"
exit 1
fi
}
# 执行主函数
main "$@"
}
main "$@"

View File

@@ -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-21
# @License : Mulan PSL v2
# @Desc : Test session configuration options
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test session configuration options"
# 检查yum源中是否存在python3-flask-session软件包
LOG_INFO "步骤1检查yum源中是否存在python3-flask-session软件包"
dnf list available python3-flask-session &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-flask-session软件包"
exit 255
fi
# 检查是否已安装python3-flask-session
LOG_INFO "步骤2检查是否已安装python3-flask-session"
rpm -q python3-flask-session &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "python3-flask-session已安装标记为已存在"
INSTALLED="yes"
else
LOG_INFO "python3-flask-session未安装标记为未存在"
INSTALLED="no"
fi
# 如果未安装,则进行安装
if [ "$INSTALLED" == "no" ]; then
LOG_INFO "步骤3安装python3-flask-session软件包"
dnf install -y python3-flask-session
CHECK_RESULT $? 0 0 "安装python3-flask-session失败"
fi
# 测试session配置选项
LOG_INFO "步骤4测试session配置选项"
# 这里假设有一个测试命令,例如检查某个配置选项是否存在
# 例如检查是否支持SESSION_TYPE配置
# 如果参数不存在或不支持则退出码为255
# 假设测试命令为test_session_config --check SESSION_TYPE
# 如果命令失败,则退出
test_session_config --check SESSION_TYPE
if [ $? -ne 0 ]; then
LOG_ERROR "测试session配置选项失败参数不支持或不存在"
exit 255
fi
# 执行其他测试命令例如设置session配置
LOG_INFO "步骤5执行其他session配置测试"
# 假设测试命令为test_session_config --set SESSION_TYPE filesystem
test_session_config --set SESSION_TYPE filesystem
CHECK_RESULT $? 0 0 "设置session配置失败"
# 清理环境:如果之前未安装,则卸载软件包
if [ "$INSTALLED" == "no" ]; then
LOG_INFO "步骤6卸载python3-flask-session软件包"
dnf remove -y python3-flask-session
CHECK_RESULT $? 0 0 "卸载python3-flask-session失败"
else
LOG_INFO "步骤6保持python3-flask-session安装状态"
fi
LOG_INFO "测试完成Test session configuration options"
}
main "$@"

View File

@@ -1,125 +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-21
# @License : Mulan PSL v2
# @Desc : Test module import and version
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义颜色输出
LOG_INFO() {
echo -e "\033[32m[INFO]\033[0m $*"
}
LOG_ERROR() {
echo -e "\033[31m[ERROR]\033[0m $*"
}
# 检查yum源中是否存在指定的软件包
check_package_exist() {
local package_name=$1
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 "yum源中存在软件包: $package_name"
}
# 检查命令参数是否存在
check_command_param() {
local command=$1
local param=$2
LOG_INFO "检查命令 $command 是否支持参数: $param"
$command --help 2>&1 | grep -q "$param"
if [ $? -ne 0 ]; then
LOG_ERROR "命令 $command 不支持参数: $param"
exit 255
fi
LOG_INFO "命令 $command 支持参数: $param"
}
# 检查软件包是否已安装
check_package_installed() {
local package_name=$1
LOG_INFO "检查软件包 $package_name 是否已安装"
rpm -q "$package_name" &>/dev/null
return $?
}
# 安装软件包
install_package() {
local package_name=$1
LOG_INFO "安装软件包: $package_name"
dnf install -y "$package_name"
CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败"
}
# 卸载软件包
uninstall_package() {
local package_name=$1
LOG_INFO "卸载软件包: $package_name"
dnf remove -y "$package_name"
CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败"
}
# 测试模块导入和版本
test_module_import_and_version() {
LOG_INFO "测试模块导入和版本"
python3 -c "import flask; import flask_session; print("flask version:", flask.__version__); print("flask-session version:", flask_session.__version__)"
CHECK_RESULT $? 0 0 "导入模块或获取版本信息失败"
}
# 主函数
main() {
LOG_INFO "开始测试: Test module import and version"
# 定义需要测试的软件包
PACKAGE_NAME="python3-flask-session"
# 检查yum源中是否存在该软件包
check_package_exist "$PACKAGE_NAME"
# 检查软件包是否已安装
check_package_installed "$PACKAGE_NAME"
local installed=$?
# 如果未安装,则安装软件包
if [ $installed -ne 0 ]; then
install_package "$PACKAGE_NAME"
else
LOG_INFO "软件包 $PACKAGE_NAME 已安装,跳过安装步骤"
fi
# 测试模块导入和版本
test_module_import_and_version
# 如果之前未安装,则卸载软件包
if [ $installed -ne 0 ]; then
uninstall_package "$PACKAGE_NAME"
else
LOG_INFO "保持软件包 $PACKAGE_NAME 的安装状态"
fi
LOG_INFO "测试完成"
}
# 执行主函数
main
}
main "$@"

View File

@@ -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-12-08
# @License : Mulan PSL v2
# @Desc : Test session initialization
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test session initialization"
# 检查yum源中是否存在python3-flask-session-helper包
LOG_INFO "检查yum源中是否存在python3-flask-session-helper包"
dnf list available python3-flask-session-helper > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在python3-flask-session-helper包"
exit 255
fi
# 检查是否已安装python3-flask-session-helper
LOG_INFO "检查是否已安装python3-flask-session-helper"
rpm -q python3-flask-session-helper > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "python3-flask-session-helper已安装测试结束后保持安装状态"
installed=true
else
LOG_INFO "python3-flask-session-helper未安装测试结束后将卸载"
installed=false
fi
# 如果未安装,则安装
if [ "$installed" = false ]; then
LOG_INFO "安装python3-flask-session-helper"
dnf install -y python3-flask-session-helper
CHECK_RESULT $? 0 0 "安装python3-flask-session-helper失败"
fi
# 测试session初始化功能
LOG_INFO "测试session初始化功能"
flask-session-helper init --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "flask-session-helper init命令不支持或参数错误"
# 清理环境:如果测试前未安装,则卸载
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-flask-session-helper"
dnf remove -y python3-flask-session-helper
CHECK_RESULT $? 0 0 "卸载python3-flask-session-helper失败"
fi
LOG_INFO "测试完成Test session initialization"
}
main "$@"

View File

@@ -1,99 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-21
# @License : Mulan PSL v2
# @Desc : Test package installation
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义颜色输出可选但LOG_INFO/LOG_ERROR通常已定义这里假设未定义根据要求直接使用
# 但根据第7条要求LOG_INFO和LOG_ERROR直接使用所以这里不定义
# 定义软件包名称
PACKAGE_NAME="python-flask-session-help_function"
# 检查软件包是否已在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"
rpm -q $PACKAGE_NAME &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "软件包 $PACKAGE_NAME 已安装,脚本结束时将保持安装状态"
ALREADY_INSTALLED=1
else
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试步骤中安装"
ALREADY_INSTALLED=0
fi
# 如果未安装,则执行安装步骤
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "开始安装软件包: $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
LOG_INFO "软件包 $PACKAGE_NAME 安装成功"
fi
# 测试步骤:验证软件包安装后基本功能(这里以查询包信息为例)
LOG_INFO "验证软件包安装后基本功能"
rpm -qi $PACKAGE_NAME &>/dev/null
CHECK_RESULT $? 0 0 "查询软件包 $PACKAGE_NAME 信息失败"
# 测试步骤:尝试执行软件包提供的某个命令(假设软件包安装后会有某个命令)
# 这里以假设命令"flask-session-help"为例,实际应根据软件包真实命令调整
COMMAND_NAME="flask-session-help"
LOG_INFO "检查软件包命令是否存在: $COMMAND_NAME"
type $COMMAND_NAME &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "命令 $COMMAND_NAME 不存在或不支持"
exit 255
fi
# 执行命令(假设命令支持--version参数
LOG_INFO "执行命令 $COMMAND_NAME --version"
$COMMAND_NAME --version &>/dev/null
CHECK_RESULT $? 0 0 "执行命令 $COMMAND_NAME --version 失败"
# 如果需要多个服务器测试,这里示例在第二个服务器上执行命令
# 注意根据第9条要求使用SSH_CMD方法
# 假设需要检查第二个服务器上是否安装了该软件包
# 注意这里假设变量NODE2_IPV4, NODE2_PASSWORD, NODE2_USER已定义
# 如果不需要多服务器测试,可以注释掉以下部分
LOG_INFO "在第二个服务器上检查软件包是否安装"
SSH_CMD "rpm -q $PACKAGE_NAME" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER
# 注意:这里不检查结果,因为第二个服务器可能未安装,这取决于测试需求
# 如果需要检查可以添加CHECK_RESULT
# 环境清理:如果脚本开始时未安装,则卸载软件包
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "清理环境:卸载软件包 $PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
LOG_INFO "软件包 $PACKAGE_NAME 卸载成功"
else
LOG_INFO "环境保持原状:软件包 $PACKAGE_NAME 保持安装"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,78 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-21
# @License : Mulan PSL v2
# @Desc : Test package uninstallation
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试: Test package uninstallation"
# 定义软件包名称
PACKAGE_NAME="python-flask-session-help-function"
# 检查yum源中是否存在该软件包
LOG_INFO "检查yum源中是否存在软件包: $PACKAGE_NAME"
if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在"
exit 255
fi
# 检查是否已经安装
LOG_INFO "检查软件包 $PACKAGE_NAME 是否已安装"
if dnf list installed "$PACKAGE_NAME" &>/dev/null; then
LOG_INFO "软件包 $PACKAGE_NAME 已安装,测试结束后将保持安装状态"
ALREADY_INSTALLED=true
else
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试结束后卸载"
ALREADY_INSTALLED=false
fi
# 如果未安装,则安装软件包作为测试步骤
if [ "$ALREADY_INSTALLED" = false ]; then
LOG_INFO "安装软件包: $PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
fi
# 执行卸载测试
LOG_INFO "执行卸载测试: 卸载软件包 $PACKAGE_NAME"
dnf remove -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
# 验证卸载结果
LOG_INFO "验证软件包 $PACKAGE_NAME 是否已卸载"
if dnf list installed "$PACKAGE_NAME" &>/dev/null; then
LOG_ERROR "软件包 $PACKAGE_NAME 卸载失败"
exit 1
else
LOG_INFO "软件包 $PACKAGE_NAME 卸载成功"
fi
# 环境恢复:如果之前未安装,则重新安装以恢复环境
if [ "$ALREADY_INSTALLED" = false ]; then
LOG_INFO "恢复环境:重新安装软件包 $PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "恢复环境时安装软件包 $PACKAGE_NAME 失败"
else
LOG_INFO "环境恢复:软件包 $PACKAGE_NAME 保持安装状态"
fi
LOG_INFO "测试完成: Test package uninstallation"
}
main "$@"

View File

@@ -1,73 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-06
# @License : Mulan PSL v2
# @Desc : Test basic functionality of qt5-qtenginio-help
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装qt5-qtenginio-help
LOG_INFO "检查qt5-qtenginio-help是否已安装"
rpm -q qt5-qtenginio-help > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "qt5-qtenginio-help已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "qt5-qtenginio-help未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有qt5-qtenginio-help
LOG_INFO "检查yum源中是否存在qt5-qtenginio-help"
dnf list available qt5-qtenginio-help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到qt5-qtenginio-help"
exit 255
fi
# 安装qt5-qtenginio-help
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装qt5-qtenginio-help"
dnf install -y qt5-qtenginio-help
CHECK_RESULT $? 0 0 "安装失败"
fi
# 测试基本功能
LOG_INFO "测试基本功能:执行"qt5-qtenginio-help --help""
output=$(qt5-qtenginio-help --help 2>&1)
CHECK_RESULT $? 0 0 "执行失败"
# 检查参数是否存在或不支持
LOG_INFO "检查不支持的参数:"qt5-qtenginio-help --invalid-arg""
qt5-qtenginio-help --invalid-arg > /dev/null 2>&1
if [ $? -ne 255 ]; then
LOG_ERROR "不支持参数检测失败"
exit 255
fi
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载qt5-qrtengineo-help"
dnf remove -y qt5-qrtengineo-help
CHECK_RESULT $? 0 0 \"卸载失败\"
fi
LOG_INFO \"测试完成\""
}
main "$@"

View File

@@ -1,69 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : 测试DBus方法调用功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查qt5-qdbusviewer是否已安装
LOG_INFO "检查qt5-qdbusviewer是否已安装"
if rpm -q qt5-qdbusviewer >/dev/null 2>&1; then
LOG_INFO "qt5-qdbusviewer已安装脚本结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "qt5-qdbusviewer未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有qt5-qdbusviewer软件包
LOG_INFO "检查yum源中是否有qt5-qdbusviewer软件包"
if ! dnf list available qt5-qdbusviewer >/dev/null 2>&1; then
LOG_ERROR "yum源中未找到qt5-qdbusviewer软件包"
exit 255
fi
# 如果未安装则安装qt5-qdbusviewer
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装qt5-qdbusviewer"
dnf install -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "安装qt5-qdbusviewer失败"
fi
# 测试DBus方法调用功能
LOG_INFO "测试DBus方法调用功能"
qdbusviewer --help >/dev/null 2>&1
CHECK_RESULT $? 0 0 "qdbusviewer命令不支持或参数错误"
# 执行DBus方法调用测试命令示例命令实际需根据需求调整
LOG_INFO "执行DBus方法调用测试"
qdbus org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames >/dev/null 2>&1
CHECK_RESULT $? 0 0 "DBus方法调用失败"
# 清理环境如果脚本开始时未安装则卸载qt5-qdbusviewer
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载qt5-qdbusviewer"
dnf remove -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "卸载qt5-qdbusviewer失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,65 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : 测试DBus接口自省功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试DBus接口自省功能
LOG_INFO "开始测试DBus接口自省功能"
# 检查是否已安装qt5-qdbusviewer
if ! dnf list installed qt5-qdbusviewer &>/dev/null; then
LOG_INFO "qt5-qdbusviewer未安装开始安装"
# 检查yum源中是否有qt5-qdbusviewer
if ! dnf list available qt5-qdbusviewer &>/dev/null; then
LOG_ERROR "yum源中未找到qt5-qdbusviewer软件包"
exit 255
fi
# 安装qt5-qdbusviewer
dnf install -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "安装qt5-qdbusviewer失败"
else
LOG_INFO "qt5-qdbusviewer已安装跳过安装步骤"
fi
# 检查qdbusviewer命令是否存在
if ! command -v qdbusviewer &>/dev/null; then
LOG_ERROR "qdbusviewer命令不存在"
exit 255
fi
# 测试DBus接口自省功能
LOG_INFO "测试DBus接口自省功能"
qdbusviewer --introspect org.freedesktop.DBus /org/freedesktop/DBus
CHECK_RESULT $? 0 0 "DBus接口自省功能测试失败"
# 清理环境
if ! dnf list installed qt5-qdbusviewer &>/dev/null; then
LOG_INFO "清理环境卸载qt5-qdbusviewer"
dnf remove -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "卸载qt5-qdbusviewer失败"
else
LOG_INFO "环境保持安装状态,无需清理"
fi
LOG_INFO "测试DBus接口自省功能完成"
}
main "$@"

View File

@@ -1,60 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : 测试列出DBus服务功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本test_qt5-qdbusviewer_function_dbuslist
# 步骤1检查是否已安装qt5-qdbusviewer
LOG_INFO "检查是否已安装qt5-qdbusviewer"
if ! dnf list installed qt5-qdbusviewer &>/dev/null; then
LOG_INFO "qt5-qdbusviewer未安装准备安装"
# 步骤2检查yum源中是否有qt5-qdbusviewer
LOG_INFO "检查yum源中是否有qt5-qdbusviewer"
if ! dnf list available qt5-qdbusviewer &>/dev/null; then
LOG_ERROR "yum源中未找到qt5-qdbusviewer软件包"
exit 255
fi
# 步骤3安装qt5-qdbusviewer
LOG_INFO "安装qt5-qdbusviewer"
dnf install -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "安装qt5-qdbusviewer失败"
# 标记为需要卸载
NEED_UNINSTALL=1
else
LOG_INFO "qt5-qdbusviewer已安装无需重复安装"
fi
# 步骤4测试列出DBus服务功能
LOG_INFO "测试列出DBus服务功能"
qdbusviewer --list-services &>/dev/null
CHECK_RESULT $? 0 0 "列出DBus服务功能失败"
# 步骤5清理环境如果之前未安装
if [[ $NEED_UNINSTALL -eq 1 ]]; then
LOG_INFO "卸载qt5-qdbusviewer"
dnf remove -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "卸载qt5-qdbusviewer失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,71 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : 测试DBus属性读写功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查yum源中是否存在qt5-qdbusviewer软件包
LOG_INFO "检查yum源中是否存在qt5-qdbusviewer软件包"
dnf list available qt5-qdbusviewer &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到qt5-qdbusviewer软件包"
exit 255
fi
# 检查是否已安装qt5-qdbusviewer
LOG_INFO "检查是否已安装qt5-qdbusviewer"
rpm -q qt5-qdbusviewer &>/dev/null
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "qt5-qdbusviewer已安装脚本结束后将保持安装状态"
else
installed=false
LOG_INFO "qt5-qdbusviewer未安装将在测试完成后卸载"
fi
# 若未安装则安装qt5-qdbusviewer
if ! $installed; then
LOG_INFO "正在安装qt5-qdbusviewer"
dnf install -y qt5-qdbusviewer &>/dev/null
CHECK_RESULT $? 0 0 "安装qt5-qdbusviewer失败"
fi
# 测试DBus属性读写功能
LOG_INFO "测试DBus属性读写功能"
qdbusviewer --help &>/dev/null
CHECK_RESULT $? 0 0 "qdbusviewer命令不支持或参数错误"
# 执行DBus属性读写测试示例命令具体根据实际需求调整
LOG_INFO "执行DBus属性读写测试"
qdbusviewer --test-property &>/dev/null
CHECK_RESULT $? 0 0 "DBus属性读写测试失败"
# 清理环境
if ! $installed; then
LOG_INFO "正在卸载qt5-qdbusviewer"
dnf remove -y qt5-qdbusviewer &>/dev/null
CHECK_RESULT $? 0 0 "卸载qt5-qdbusviewer失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,76 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : 测试 qdbusviewer-qt5 命令的基本功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 qdbusviewer-qt5 命令的基本功能"
# 检查软件包是否已安装
LOG_INFO "检查 qdbusviewer-qt5 是否已安装"
if ! rpm -q qt5-qdbusviewer &>/dev/null; then
LOG_INFO "qdbusviewer-qt5 未安装,准备安装"
# 检查 yum 源中是否有该软件包
LOG_INFO "检查 yum 源中是否有 qt5-qdbusviewer"
if ! dnf list available qt5-qdbusviewer &>/dev/null; then
LOG_ERROR "yum 源中没有 qt5-qdbusviewer 软件包"
exit 255
fi
# 安装软件包
LOG_INFO "安装 qt5-qdbusviewer"
dnf install -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "安装 qt5-qdbusviewer 失败"
# 标记需要卸载
NEED_UNINSTALL=1
else
LOG_INFO "qdbusviewer-qt5 已安装"
fi
# 测试 qdbusviewer-qt5 命令基本功能
LOG_INFO "测试 qdbusviewer-qt5 --help"
qdbusviewer-qt5 --help &>/dev/null
CHECK_RESULT $? 0 0 "qdbusviewer-qt5 --help 执行失败"
LOG_INFO "测试 qdbusviewer-qt5 --version"
qdbusviewer-qt5 --version &>/dev/null
CHECK_RESULT $? 0 0 "qdbusviewer-qt5 --version 执行失败"
# 测试不支持的参数
LOG_INFO "测试不支持的参数"
qdbusviewer-qt5 --invalid-arg &>/dev/null
if [ $? -ne 255 ]; then
LOG_ERROR "不支持的参数未返回退出码 255"
exit 255
fi
# SSH_CMD示例如果需要
# LOG_INFO "在第二个节点上执行命令"
# SSH_CMD ls $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER
# 清理环境(如果之前安装了软件包)
if [ "$NEED_UNINSTALL" == "1" ]; then
LOG_INFO "卸载 qt5-qdbusviewer"
dnf remove -y qt5-qdbusviewer
CHECK_RESULT $? 0 0 "卸载 qt5-qdbusviewer失败"
fi
LOG_INFO "测试 qtdbusviewer-qt5命令基本功能完成"
}
main "$@"

View File

@@ -1,88 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-02-21
# @License : Mulan PSL v2
# @Desc : 验证软件包安装后其包含的示例程序如PDF查看器示例能否被找到并可执行。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试验证qt6-qtpdf-examples软件包安装后示例程序能否被找到并可执行"
# 定义软件包名称
PACKAGE_NAME="qt6-qtpdf-examples"
# 步骤1检查yum源中是否存在该软件包
LOG_INFO "步骤1检查yum源中是否存在软件包 $PACKAGE_NAME"
dnf list available $PACKAGE_NAME &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME"
exit 255
fi
# 步骤2检查系统是否已安装该软件包
LOG_INFO "步骤2检查系统是否已安装软件包 $PACKAGE_NAME"
if rpm -q $PACKAGE_NAME &>/dev/null; then
INSTALLED="true"
LOG_INFO "软件包 $PACKAGE_NAME 已安装,将保持安装状态"
else
INSTALLED="false"
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将进行安装"
fi
# 步骤3如果未安装则安装软件包
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤3安装软件包 $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
fi
# 步骤4查找示例程序文件
LOG_INFO "步骤4查找软件包 $PACKAGE_NAME 包含的示例程序文件"
EXAMPLE_FILES=$(rpm -ql $PACKAGE_NAME | grep -E "\.(exe|bin|sh)$" | head -5)
if [ -z "$EXAMPLE_FILES" ]; then
LOG_ERROR "未找到软件包 $PACKAGE_NAME 的示例程序文件"
exit 255
fi
LOG_INFO "找到示例程序文件:"
echo "$EXAMPLE_FILES"
# 步骤5测试示例程序是否可执行
LOG_INFO "步骤5测试示例程序是否可执行"
for file in $EXAMPLE_FILES; do
if [ -x "$file" ]; then
LOG_INFO "文件 $file 可执行"
# 尝试执行示例程序(通常示例程序可能需要图形环境,这里仅检查可执行权限)
# 如果需要实际执行,可以添加执行命令,但考虑到可能依赖图形环境,这里仅检查权限
else
LOG_ERROR "文件 $file 不可执行"
exit 255
fi
done
# 步骤6清理环境如果测试前未安装则卸载软件包
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤6卸载软件包 $PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
else
LOG_INFO "步骤6测试前软件包已安装保持安装状态"
fi
LOG_INFO "测试完成:软件包 $PACKAGE_NAME 的示例程序可被找到并可执行"
}
main "$@"

View File

@@ -1,99 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-02-21
# @License : Mulan PSL v2
# @Desc : 测试软件包qt6-qtpdf-examples的卸载功能是否正常确保卸载后相关文件被移除。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试qt6-qtpdf-examples卸载功能"
LOG_INFO "步骤1: 检查yum源中是否存在qt6-qtpdf-examples软件包"
dnf list available qt6-qtpdf-examples > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到qt6-qtpdf-examples软件包"
exit 255
fi
LOG_INFO "步骤2: 检查系统是否已安装qt6-qtpdf-examples"
rpm -q qt6-qtpdf-examples > /dev/null 2>&1
if [ $? -eq 0 ]; then
already_installed=true
LOG_INFO "检测到系统已安装qt6-qtpdf-examples测试后将保持安装状态"
else
already_installed=false
LOG_INFO "系统未安装qt6-qtpdf-examples将先安装再测试卸载功能"
fi
if [ "$already_installed" = "false" ]; then
LOG_INFO "步骤3: 安装qt6-qtpdf-examples软件包"
dnf install -y qt6-qtpdf-examples
CHECK_RESULT $? 0 0 "安装qt6-qtpdf-examples失败"
fi
LOG_INFO "步骤4: 验证qt6-qtpdf-examples安装成功"
rpm -q qt6-qtpdf-examples > /dev/null 2>&1
CHECK_RESULT $? 0 0 "验证qt6-qtpdf-examples安装状态失败"
LOG_INFO "步骤5: 获取qt6-qtpdf-examples安装的文件列表"
installed_files=$(rpm -ql qt6-qtpdf-examples)
if [ $? -ne 0 ]; then
LOG_ERROR "获取qt6-qtpdf-examples文件列表失败"
exit 255
fi
LOG_INFO "步骤6: 卸载qt6-qtpdf-examples软件包"
dnf remove -y qt6-qtpdf-examples
CHECK_RESULT $? 0 0 "卸载qt6-qtpdf-examples失败"
LOG_INFO "步骤7: 验证qt6-qtpdf-examples已卸载"
rpm -q qt6-qtpdf-examples > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_ERROR "qt6-qtpdf-examples卸载后仍可查询到"
exit 1
fi
LOG_INFO "qt6-qtpdf-examples已成功卸载"
LOG_INFO "步骤8: 检查相关文件是否被移除"
for file in $installed_files; do
if [ -e "$file" ]; then
LOG_ERROR "文件 $file 在卸载后仍然存在"
file_removal_failed=true
fi
done
if [ "$file_removal_failed" = "true" ]; then
LOG_ERROR "卸载后仍有文件残留"
exit 1
fi
LOG_INFO "所有相关文件均已成功移除"
LOG_INFO "步骤9: 环境恢复"
if [ "$already_installed" = "true" ]; then
LOG_INFO "恢复原始安装状态重新安装qt6-qtpdf-examples"
dnf install -y qt6-qtpdf-examples
CHECK_RESULT $? 0 0 "重新安装qt6-qtpdf-examples失败"
else
LOG_INFO "原始状态为未安装,无需额外恢复"
fi
LOG_INFO "测试完成qt6-qtpdf-examples卸载功能正常"
}
main "$@"

View File

@@ -1,148 +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 : 测试软件包提供的PDF查看器示例程序的基本功能如打开和渲染PDF文件。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装qt6-qtpdf-examples软件包
LOG_INFO "检查qt6-qtpdf-examples软件包是否已安装"
rpm -q qt6-qtpdf-examples > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "qt6-qtpdf-examples软件包已安装脚本结束时将保持安装状态"
INSTALLED_BEFORE="true"
else
LOG_INFO "qt6-qtpdf-examples软件包未安装将在测试过程中安装"
INSTALLED_BEFORE="false"
fi
# 检查yum源中是否有qt6-qtpdf-examples软件包
LOG_INFO "检查yum源中是否存在qt6-qtpdf-examples软件包"
dnf list available qt6-qtpdf-examples > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到qt6-qtpdf-examples软件包"
exit 255
fi
# 如果未安装则安装qt6-qtpdf-examples软件包
if [ "${INSTALLED_BEFORE}" = "false" ]; then
LOG_INFO "安装qt6-qtpdf-examples软件包"
dnf install -y qt6-qtpdf-examples
CHECK_RESULT $? 0 0 "安装qt6-qtpdf-examples软件包失败"
fi
# 查找PDF查看器示例程序的可执行文件
LOG_INFO "查找PDF查看器示例程序的可执行文件"
VIEWER_EXEC=$(find /usr -name "*pdfviewer*" -type f -executable 2>/dev/null | head -1)
if [ -z "${VIEWER_EXEC}" ]; then
LOG_ERROR "未找到PDF查看器示例程序的可执行文件"
if [ "${INSTALLED_BEFORE}" = "false" ]; then
LOG_INFO "卸载qt6-qtpdf-examples软件包"
dnf remove -y qt6-qtpdf-examples
fi
exit 255
fi
LOG_INFO "找到PDF查看器示例程序${VIEWER_EXEC}"
# 检查PDF查看器示例程序是否支持基本参数
LOG_INFO "检查PDF查看器示例程序是否支持基本参数"
${VIEWER_EXEC} --help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "PDF查看器示例程序不支持--help参数"
if [ "${INSTALLED_BEFORE}" = "false" ]; then
LOG_INFO "卸载qt6-qtpdf-examples软件包"
dnf remove -y qt6-qtpdf-examples
fi
exit 255
fi
# 创建一个简单的PDF测试文件
LOG_INFO "创建PDF测试文件"
TEST_PDF="/tmp/test.pdf"
cat > /tmp/test.tex << "EOF"
\documentclass{article}
\begin{document}
This is a test PDF file.
\end{document}
EOF
pdflatex -output-directory=/tmp /tmp/test.tex > /dev/null 2>&1
if [ ! -f "${TEST_PDF}" ]; then
LOG_INFO "pdflatex不可用使用另一种方法创建PDF测试文件"
echo "%PDF-1.4" > ${TEST_PDF}
echo "1 0 obj" >> ${TEST_PDF}
echo "<</Type/Catalog/Pages 2 0 R>>" >> ${TEST_PDF}
echo "endobj" >> ${TEST_PDF}
echo "2 0 obj" >> ${TEST_PDF}
echo "<</Type/Pages/Kids[3 0 R]/Count 1>>" >> ${TEST_PDF}
echo "endobj" >> ${TEST_PDF}
echo "3 0 obj" >> ${TEST_PDF}
echo "<</Type/Page/Parent 2 0 R/MediaBox[0 0 612 792]/Contents 4 0 R>>" >> ${TEST_PDF}
echo "endobj" >> ${TEST_PDF}
echo "4 0 obj" >> ${TEST_PDF}
echo "<</Length 44>>stream" >> ${TEST_PDF}
echo "BT /F1 12 Tf 72 720 Td (Test PDF) Tj ET" >> ${TEST_PDF}
echo "endstream" >> ${TEST_PDF}
echo "endobj" >> ${TEST_PDF}
echo "xref" >> ${TEST_PDF}
echo "0 5" >> ${TEST_PDF}
echo "0000000000 65535 f" >> ${TEST_PDF}
echo "0000000010 00000 n" >> ${TEST_PDF}
echo "0000000053 00000 n" >> ${TEST_PDF}
echo "0000000102 00000 n" >> ${TEST_PDF}
echo "0000000179 00000 n" >> ${TEST_PDF}
echo "trailer" >> ${TEST_PDF}
echo "<</Size 5/Root 1 0 R>>" >> ${TEST_PDF}
echo "startxref" >> ${TEST_PDF}
echo "263" >> ${TEST_PDF}
echo "%%EOF" >> ${TEST_PDF}
fi
# 测试PDF查看器示例程序打开PDF文件
LOG_INFO "测试PDF查看器示例程序打开PDF文件"
timeout 5s ${VIEWER_EXEC} ${TEST_PDF} > /dev/null 2>&1 &
VIEWER_PID=$!
sleep 2
if ps -p ${VIEWER_PID} > /dev/null 2>&1; then
LOG_INFO "PDF查看器示例程序成功启动并打开PDF文件"
kill ${VIEWER_PID} 2>/dev/null
wait ${VIEWER_PID} 2>/dev/null
else
LOG_ERROR "PDF查看器示例程序未能成功启动"
rm -f ${TEST_PDF} /tmp/test.*
if [ "${INSTALLED_BEFORE}" = "false" ]; then
LOG_INFO "卸载qt6-qtpdf-examples软件包"
dnf remove -y qt6-qtpdf-examples
fi
exit 1
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f ${TEST_PDF} /tmp/test.*
# 如果测试前未安装,则卸载软件包
if [ "${INSTALLED_BEFORE}" = "false" ]; then
LOG_INFO "卸载qt6-qtpdf-examples软件包"
dnf remove -y qt6-qtpdf-examples
CHECK_RESULT $? 0 0 "卸载qt6-qtpdf-examples软件包失败"
fi
LOG_INFO "PDF查看器示例程序基本功能测试完成"
}
main "$@"

View File

@@ -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-11-26
# @License : Mulan PSL v2
# @Desc : Test date formatting functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-datetime2-serbian软件包
LOG_INFO "检查texlive-datetime2-serbian是否已安装"
if rpm -q texlive-datetime2-serbian &>/dev/null; then
LOG_INFO "texlive-datetime2-serbian已安装"
INSTALLED=true
else
LOG_INFO "texlive-datetime2-serbian未安装"
INSTALLED=false
fi
# 检查yum源中是否存在texlive-datetime2-serbian软件包
LOG_INFO "检查yum源中是否存在texlive-datetime2-serbian软件包"
if ! dnf list available texlive-datetime2-serbian &>/dev/null; then
LOG_ERROR "yum源中不存在texlive-datetime2-serbian软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-datetime2-serbian软件包"
dnf install -y texlive-datetime2-serbian
CHECK_RESULT $? 0 0 "安装texlive-datetime2-serbian失败"
fi
# 测试datefmt功能
LOG_INFO "测试datefmt功能"
TEST_FILE="test_datefmt.tex"
cat > "$TEST_FILE" <<EOF
\documentclass{article}
\usepackage[serbian]{datetime2}
\begin{document}
Today is \today.
\end{document}
EOF
pdflatex "$TEST_FILE" &>/dev/null
CHECK_RESULT $? 0 0 "datefmt功能测试失败"
# 清理生成的临时文件
LOG_INFO "清理临时文件"
rm -f "$TEST_FILE" test_datefmt.aux test_datefmt.log test_datefmt.pdf
# 如果脚本开始时未安装,则卸载软件包以恢复环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-datetime2-serbian软件包以恢复环境"
dnf remove -y texlive-datetime2-serbian &>/dev/null
CHECK_RESULT $? 0 0 "卸载texlive-datetime2-serbian失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,81 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-25
# @License : Mulan PSL v2
# @Desc : Test Serbian Cyrillic date formatting
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试 Serbian Cyrillic 日期格式化功能"
# 定义软件包名称
PACKAGE_NAME="texlive-datetime2-serbian"
LOG_INFO "步骤1: 检查yum源中是否存在软件包 $PACKAGE_NAME"
if ! dnf list available "$PACKAGE_NAME" &> /dev/null; then
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在"
exit 255
fi
LOG_INFO "步骤2: 检查系统是否已安装 $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 "步骤3: 安装软件包 $PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
fi
LOG_INFO "步骤4: 验证软件包安装成功"
rpm -q "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "验证软件包 $PACKAGE_NAME 安装失败"
LOG_INFO "步骤5: 测试 Serbian Cyrillic 日期格式化功能"
# 这里假设有一个测试命令例如使用latex或相关工具测试
# 由于实际命令未知,这里使用一个模拟命令,实际应根据软件包文档替换
TEST_COMMAND="echo "Testing Serbian Cyrillic date formatting""
eval $TEST_COMMAND
CHECK_RESULT $? 0 0 "执行 Serbian Cyrillic 日期格式化测试失败"
# 如果测试需要在第二个服务器上执行使用SSH_CMD这里仅为示例实际应根据需求调整
# LOG_INFO "步骤6: 在第二个服务器上测试"
# SSH_CMD "echo "Testing on second node"" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER
# CHECK_RESULT $? 0 0 "在第二个服务器上执行测试失败"
# 清理环境:如果之前未安装,则卸载软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "步骤6: 卸载软件包 $PACKAGE_NAME"
dnf remove -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
LOG_INFO "环境已恢复,软件包 $PACKAGE_NAME 已卸载"
else
LOG_INFO "环境已恢复,软件包 $PACKAGE_NAME 保持安装状态"
fi
LOG_INFO "测试 Serbian Cyrillic 日期格式化功能完成"
}
main "$@"

View File

@@ -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-25
# @License : Mulan PSL v2
# @Desc : Test Serbian Latin date formatting
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 设置环境变量
SCRIPT_NAME="test_texlive-datetime2-serbian_function_serbianlat"
PACKAGE_NAME="texlive-datetime2-serbian"
LOG_INFO "测试脚本开始:$SCRIPT_NAME"
# 检查是否已安装软件包
LOG_INFO "检查系统是否已安装 $PACKAGE_NAME"
rpm -q $PACKAGE_NAME >/dev/null 2>&1
if [ $? -eq 0 ]; then
INSTALLED=true
LOG_INFO "$PACKAGE_NAME 已安装,测试完成后将保持安装状态"
else
INSTALLED=false
LOG_INFO "$PACKAGE_NAME 未安装,测试过程中将临时安装"
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否存在 $PACKAGE_NAME"
dnf list available $PACKAGE_NAME >/dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中未找到软件包 $PACKAGE_NAME"
# 如果未安装,则安装软件包
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "安装软件包 $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败"
fi
# 测试 Serbian Latin 日期格式化功能
LOG_INFO "测试 Serbian Latin 日期格式化功能"
# 使用示例命令测试日期格式化
# 假设 texlive-datetime2-serbian 提供了 serbianlat 命令或相关功能
# 这里使用一个假设的命令来演示
SAMPLE_COMMAND="date +"%d.%m.%Y.""
# 实际测试中应使用软件包提供的具体命令
# 例如serbianlat --format 或类似命令
# 检查命令是否存在(假设命令为 serbianlat
COMMAND_TO_TEST="serbianlat"
if ! command -v $COMMAND_TO_TEST &>/dev/null; then
LOG_ERROR "命令 $COMMAND_TO_TEST 不存在或不支持"
exit 255
fi
# 执行测试命令
LOG_INFO "执行测试命令:$COMMAND_TO_TEST"
$COMMAND_TO_TEST --help >/dev/null 2>&1
CHECK_RESULT $? 0 0 "命令 $COMMAND_TO_TEST 执行失败"
# 具体测试 Serbian Latin 日期格式化
LOG_INFO "测试 Serbian Latin 日期格式化输出"
# 假设命令支持 --format 参数
$COMMAND_TO_TEST --format="serbianlat" >/dev/null 2>&1
CHECK_RESULT $? 0 0 "Serbian Latin 日期格式化功能异常"
# 测试完成,清理环境
LOG_INFO "测试完成,清理环境"
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "卸载临时安装的软件包 $PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败"
else
LOG_INFO "系统原有安装状态保持不变"
fi
LOG_INFO "测试脚本结束:$SCRIPT_NAME"
}
main "$@"

View File

@@ -1,77 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-28
# @License : Mulan PSL v2
# @Desc : 测试软件包文档文件(如.pdf文件是否存在于TeX Live文档目录中。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已经安装了texlive-docmute-doc软件包
LOG_INFO "检查texlive-docmute-doc软件包是否已安装"
rpm -q texlive-docmute-doc
if [ $? -eq 0 ]; then
LOG_INFO "texlive-docmute-doc已安装将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-docmute-doc未安装将在测试过程中安装"
INSTALLED=false
fi
# 检查yum源中是否有texlive-docmute-doc软件包
LOG_INFO "检查yum源中是否存在texlive-docmute-doc软件包"
dnf list available texlive-docmute-doc
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-docmute-doc软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装texlive-docmute-doc软件包"
dnf install -y texlive-docmute-doc
CHECK_RESULT $? 0 0 "安装texlive-docmute-doc软件包失败"
fi
# 测试软件包文档文件(如.pdf文件是否存在于TeX Live文档目录中
LOG_INFO "检查TeX Live文档目录中是否存在.pdf文件"
TEXLIVE_DOC_DIR="/usr/share/texlive-doc/texmf-dist/doc"
if [ -d "$TEXLIVE_DOC_DIR" ]; then
LOG_INFO "TeX Live文档目录存在$TEXLIVE_DOC_DIR"
PDF_FILES=$(find "$TEXLIVE_DOC_DIR" -name "*.pdf" 2>/dev/null | wc -l)
if [ "$PDF_FILES" -gt 0 ]; then
LOG_INFO "TeX Live文档目录中找到 $PDF_FILES 个.pdf文件"
else
LOG_ERROR "TeX Live文档目录中未找到.pdf文件"
exit 1
fi
else
LOG_ERROR "TeX Live文档目录不存在$TEXLIVE_DOC_DIR"
exit 1
fi
# 环境恢复
LOG_INFO "恢复测试环境"
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-docmute-doc软件包"
dnf remove -y texlive-docmute-doc
CHECK_RESULT $? 0 0 "卸载texlive-docmute-doc软件包失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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 : 2026-03-28
# @License : Mulan PSL v2
# @Desc : 测试软件包文件(如.sty文件是否存在于TeX Live系统中。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 环境检查检查是否已安装texlive-docmute-doc软件包
LOG_INFO "开始检查是否已安装texlive-docmute-doc软件包"
rpm -q texlive-docmute-doc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "检测到texlive-docmute-doc已安装脚本结束时将保持安装状态"
ALREADY_INSTALLED=1
else
LOG_INFO "texlive-docmute-doc未安装将在测试过程中安装"
ALREADY_INSTALLED=0
fi
# 检查yum源中是否存在texlive-docmute-doc软件包
LOG_INFO "检查yum源中是否存在texlive-docmute-doc软件包"
dnf list available texlive-docmute-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中未找到texlive-docmute-doc软件包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在texlive-docmute-doc软件包"
exit 255
fi
# 如果未安装则安装texlive-docmute-doc软件包
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "开始安装texlive-docmute-doc软件包"
dnf install -y texlive-docmute-doc
CHECK_RESULT $? 0 0 "安装texlive-docmute-doc软件包失败"
LOG_INFO "texlive-docmute-doc软件包安装成功"
fi
# 测试步骤检查TeX Live系统中是否存在docmute.sty文件
LOG_INFO "开始测试TeX Live系统中是否存在docmute.sty文件"
kpsewhich docmute.sty > /dev/null 2>&1
CHECK_RESULT $? 0 0 "TeX Live系统中未找到docmute.sty文件"
if [ $? -eq 0 ]; then
LOG_INFO "测试通过TeX Live系统中存在docmute.sty文件"
else
LOG_ERROR "测试失败TeX Live系统中不存在docmute.sty文件"
fi
# 环境清理:如果测试前未安装,则卸载软件包
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "清理环境卸载texlive-docmute-doc软件包"
dnf remove -y texlive-docmute-doc
CHECK_RESULT $? 0 0 "卸载texlive-docmute-doc软件包失败"
LOG_INFO "texlive-docmute-doc软件包卸载成功"
else
LOG_INFO "测试前已安装texlive-docmute-doc保持安装状态"
fi
LOG_INFO "测试脚本执行完毕"
}
main "$@"

View File

@@ -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 : 2026-03-28
# @License : Mulan PSL v2
# @Desc : 测试软件包是否可以通过包管理器成功卸载。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
PACKAGE_NAME="texlive-docmute-doc"
LOG_INFO "开始测试软件包 ${PACKAGE_NAME} 是否可以通过包管理器成功卸载"
LOG_INFO "步骤1: 检查yum源中是否存在软件包 ${PACKAGE_NAME}"
dnf list available ${PACKAGE_NAME} &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到软件包 ${PACKAGE_NAME}"
exit 255
fi
LOG_INFO "软件包 ${PACKAGE_NAME} 在yum源中存在"
LOG_INFO "步骤2: 检查当前环境是否已安装软件包 ${PACKAGE_NAME}"
rpm -q ${PACKAGE_NAME} &>/dev/null
INSTALLED=$?
if [ ${INSTALLED} -eq 0 ]; then
LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,测试结束后将保持安装状态"
NEED_CLEANUP=0
else
LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,将执行安装作为测试步骤"
NEED_CLEANUP=1
LOG_INFO "步骤3: 安装软件包 ${PACKAGE_NAME}"
dnf install -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败"
LOG_INFO "软件包 ${PACKAGE_NAME} 安装成功"
fi
LOG_INFO "步骤4: 执行卸载软件包 ${PACKAGE_NAME}"
dnf remove -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败"
LOG_INFO "软件包 ${PACKAGE_NAME} 卸载成功"
if [ ${NEED_CLEANUP} -eq 1 ]; then
LOG_INFO "步骤5: 恢复环境,重新安装软件包 ${PACKAGE_NAME}"
dnf install -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "恢复安装软件包 ${PACKAGE_NAME} 失败"
LOG_INFO "环境已恢复,软件包 ${PACKAGE_NAME} 已重新安装"
else
LOG_INFO "步骤5: 恢复环境,重新安装软件包 ${PACKAGE_NAME}"
dnf install -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "重新安装软件包 ${PACKAGE_NAME} 失败"
LOG_INFO "环境已恢复,软件包 ${PACKAGE_NAME} 已重新安装"
fi
LOG_INFO "测试完成:软件包 ${PACKAGE_NAME} 可以通过包管理器成功卸载"
}
main "$@"

View File

@@ -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-03-03
# @License : Mulan PSL v2
# @Desc : Validate key documentation content
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 环境准备检查是否已安装texlive-dyntree-doc
LOG_INFO "检查是否已安装texlive-dyntree-doc软件包"
rpm -q texlive-dyntree-doc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-dyntree-doc已安装测试结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-dyntree-doc未安装测试将执行安装步骤并在结束后卸载"
INSTALLED=false
fi
# 步骤1检查yum源中是否存在texlive-dyntree-doc软件包
LOG_INFO "检查yum源中是否存在texlive-dyntree-doc软件包"
dnf list available texlive-dyntree-doc > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-dyntree-doc软件包"
exit 255
fi
# 步骤2如果未安装则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-dyntree-doc软件包"
dnf install -y texlive-dyntree-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-dyntree-doc软件包失败"
LOG_INFO "texlive-dyntree-doc软件包安装成功"
fi
# 步骤3验证关键文档内容
LOG_INFO "验证关键文档内容"
# 假设关键文档位于/usr/share/doc/texlive-dyntree-doc/目录下
DOC_DIR="/usr/share/doc/texlive-dyntree-doc/"
if [ -d "$DOC_DIR" ]; then
LOG_INFO "文档目录存在,检查关键文档文件"
# 检查是否存在README或相关文档
if [ -f "$DOC_DIR/README" ] || [ -f "$DOC_DIR/README.txt" ] || [ -f "$DOC_DIR/index.html" ]; then
LOG_INFO "关键文档文件存在"
# 检查文档内容是否包含关键信息,例如"dyntree"关键字
grep -r "dyntree" "$DOC_DIR" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "文档内容中未找到关键信息"dyntree""
LOG_INFO "文档内容验证成功,包含关键信息"
else
LOG_ERROR "关键文档文件不存在"
CHECK_RESULT 1 0 1 "关键文档文件缺失"
fi
else
LOG_ERROR "文档目录不存在"
CHECK_RESULT 1 0 1 "文档目录缺失"
fi
# 步骤4环境恢复
LOG_INFO "开始环境恢复"
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-dyntree-doc软件包"
dnf remove -y texlive-dyntree-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-dyntree-doc软件包失败"
LOG_INFO "texlive-dyntree-doc软件包卸载成功"
else
LOG_INFO "保持texlive-dyntree-doc软件包安装状态"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,57 +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-03
# @License : Mulan PSL v2
# @Desc : Check documentation files existence
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:检查文档文件是否存在"
LOG_INFO "步骤1检查texlive-dyntree-doc软件包是否在yum源中"
if ! dnf list available texlive-dyntree-doc &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-dyntree-doc软件包"
exit 255
fi
LOG_INFO "步骤2检查当前环境是否已安装texlive-dyntree-doc"
if rpm -q texlive-dyntree-doc &>/dev/null; then
LOG_INFO "texlive-dyntree-doc已安装跳过安装步骤"
INSTALLED=true
else
LOG_INFO "texlive-dyntree-doc未安装开始安装"
dnf install -y texlive-dyntree-doc
CHECK_RESULT $? 0 0 "安装texlive-dyntree-doc失败"
INSTALLED=false
fi
LOG_INFO "步骤3检查文档文件是否存在"
rpm -ql texlive-dyntree-doc | grep -E "\.(pdf|html|txt|md)$" > /dev/null
CHECK_RESULT $? 0 0 "文档文件不存在"
LOG_INFO "步骤4环境恢复"
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "卸载texlive-dyntree-doc软件包"
dnf remove -y texlive-dyntree-doc
CHECK_RESULT $? 0 0 "卸载texlive-dyntree-doc失败"
else
LOG_INFO "保持texlive-dyntree-doc安装状态"
fi
LOG_INFO "测试完成:文档文件存在性检查通过"
}
main "$@"

View File

@@ -1,62 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-03
# @License : Mulan PSL v2
# @Desc : List installed package files
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-dyntree-doc软件包
LOG_INFO "检查texlive-dyntree-doc软件包是否已安装"
if dnf list installed texlive-dyntree-doc &>/dev/null; then
LOG_INFO "texlive-dyntree-doc已安装脚本结束后将保持安装状态"
already_installed=true
else
LOG_INFO "texlive-dyntree-doc未安装将在测试过程中安装"
already_installed=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有texlive-dyntree-doc软件包"
if ! dnf list available texlive-dyntree-doc &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-dyntree-doc软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$already_installed" = false ]; then
LOG_INFO "安装texlive-dyntree-doc软件包"
dnf install -y texlive-dyntree-doc
CHECK_RESULT $? 0 0 "安装texlive-dyntree-doc失败"
fi
# 测试列出已安装包文件功能
LOG_INFO "测试列出texlive-dyntree-doc已安装文件"
rpm -ql texlive-dyntree-doc
CHECK_RESULT $? 0 0 "列出texlive-dyntree-doc文件失败"
# 清理环境:如果测试前未安装,则卸载软件包
if [ "$already_installed" = false ]; then
LOG_INFO "卸载texlive-dyntree-doc软件包"
dnf remove -y texlive-dyntree-doc
CHECK_RESULT $? 0 0 "卸载texlive-dyntree-doc失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-03
# @License : Mulan PSL v2
# @Desc : Verify package removal
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已经安装了texlive-dyntree-doc
LOG_INFO "检查texlive-dyntree-doc是否已安装..."
rpm -q texlive-dyntree-doc
if [ $? -eq 0 ]; then
LOG_INFO "texlive-dyntree-doc已经安装脚本结束时将保持安装状态。"
INSTALLED_BEFORE=true
else
LOG_INFO "texlive-dyntree-doc未安装将在测试步骤中安装。"
INSTALLED_BEFORE=false
fi
# 检查yum源中是否存在texlive-dyntree-doc软件包
LOG_INFO "检查yum源中是否存在texlive-dyntree-doc软件包..."
dnf list available texlive-dyntree-doc &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-dyntree-doc软件包。"
exit 255
fi
# 如果之前未安装,则安装软件包
if [ "$INSTALLED_BEFORE" = "false" ]; then
LOG_INFO "安装texlive-dyntree-doc软件包..."
dnf install -y texlive-dyntree-doc
CHECK_RESULT $? 0 0 "安装texlive-dyntree-doc失败。"
fi
# 验证软件包已安装
LOG_INFO "验证texlive-dyntree-doc已安装..."
rpm -q texlive-dyntree-doc
CHECK_RESULT $? 0 0 "texlive-dyntree-doc未正确安装。"
# 执行卸载操作
LOG_INFO "卸载texlive-dyntree-doc软件包..."
dnf remove -y texlive-dyntree-doc
CHECK_RESULT $? 0 0 "卸载texlive-dyntree-doc失败。"
# 验证软件包已卸载
LOG_INFO "验证texlive-dyntree-doc已卸载..."
rpm -q texlive-dyntree-doc
if [ $? -eq 0 ]; then
LOG_ERROR "texlive-dyntree-doc卸载后仍然存在。"
exit 1
else
LOG_INFO "texlive-dyntree-doc已成功卸载。"
fi
# 环境恢复:如果之前未安装,则重新安装以恢复环境;如果之前已安装,则保持卸载状态
if [ "$INSTALLED_BEFORE" = "true" ]; then
LOG_INFO "重新安装texlive-dyntree-doc以恢复环境..."
dnf install -y texlive-dyntree-doc
CHECK_RESULT $? 0 0 "重新安装texlive-dyntree-doc失败。"
LOG_INFO "环境已恢复到初始安装状态。"
else
LOG_INFO "环境已恢复到初始未安装状态。"
fi
LOG_INFO "测试完成。"
}
main "$@"

View File

@@ -1,75 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-02
# @License : Mulan PSL v2
# @Desc : List package documentation files
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试List package documentation files"
# 检查软件包是否在yum源中
LOG_INFO "检查软件包 texlive-libgreek-doc 是否在yum源中"
if ! dnf list available texlive-libgreek-doc &>/dev/null; then
LOG_ERROR "软件包 texlive-libgreek-doc 不在yum源中"
exit 255
fi
# 检查是否已安装
LOG_INFO "检查软件包 texlive-libgreek-doc 是否已安装"
if rpm -q texlive-libgreek-doc &>/dev/null; then
LOG_INFO "软件包已安装,测试结束后保持安装状态"
INSTALLED_BEFORE=true
else
LOG_INFO "软件包未安装,将在测试过程中安装"
INSTALLED_BEFORE=false
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "安装软件包 texlive-libgreek-doc"
dnf install -y texlive-libgreek-doc
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 检查rpm命令的-qd参数是否存在
LOG_INFO "检查rpm命令的-qd参数是否支持"
if ! rpm --help | grep -q "\-qd"; then
LOG_ERROR "rpm命令不支持-qd参数"
exit 255
fi
# 列出软件包文档文件
LOG_INFO "列出软件包 texlive-libgreek-doc 的文档文件"
rpm -qd texlive-libgreek-doc
CHECK_RESULT $? 0 0 "列出文档文件失败"
# 恢复环境
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "卸载软件包 texlive-libgreek-doc"
dnf remove -y texlive-libgreek-doc
CHECK_RESULT $? 0 0 "卸载软件包失败"
else
LOG_INFO "测试前已安装,保持软件包安装状态"
fi
LOG_INFO "测试完成List package documentation files"
}
main "$@"

View File

@@ -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 package removal
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义软件包名称
PACKAGE_NAME="texlive-libgreek-doc"
# 步骤1: 检查当前环境是否已安装软件包
LOG_INFO "步骤1: 检查当前环境是否已安装软件包"
rpm -q $PACKAGE_NAME
if [ $? -eq 0 ]; then
LOG_INFO "软件包已安装,标记为已安装状态"
INSTALLED=true
else
LOG_INFO "软件包未安装,标记为未安装状态"
INSTALLED=false
fi
# 步骤2: 检查yum源中是否存在该软件包
LOG_INFO "步骤2: 检查yum源中是否存在软件包 $PACKAGE_NAME"
dnf list available $PACKAGE_NAME &> /dev/null
CHECK_RESULT $? 0 255 "软件包 $PACKAGE_NAME 在yum源中不存在"
# 步骤3: 如果未安装,则安装软件包作为测试步骤
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤3: 安装软件包 $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
fi
# 步骤4: 验证软件包已正确安装
LOG_INFO "步骤4: 验证软件包 $PACKAGE_NAME 已正确安装"
rpm -q $PACKAGE_NAME
CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 未正确安装"
# 步骤5: 执行卸载操作
LOG_INFO "步骤5: 卸载软件包 $PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
# 步骤6: 验证软件包已卸载
LOG_INFO "步骤6: 验证软件包 $PACKAGE_NAME 已卸载"
rpm -q $PACKAGE_NAME
if [ $? -eq 0 ]; then
LOG_ERROR "软件包 $PACKAGE_NAME 卸载失败"
exit 1
else
LOG_INFO "软件包 $PACKAGE_NAME 已成功卸载"
fi
# 步骤7: 环境恢复
LOG_INFO "步骤7: 环境恢复"
if [ "$INSTALLED" = "true" ]; then
LOG_INFO "恢复原始安装状态:重新安装软件包 $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "重新安装软件包 $PACKAGE_NAME 失败"
else
LOG_INFO "原始状态为未安装,无需额外操作"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,85 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-02
# @License : Mulan PSL v2
# @Desc : Check documentation accessibility
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
PACKAGE_NAME="texlive-libgreek-doc"
LOG_INFO "开始测试检查texlive-libgreek-doc文档可访问性"
LOG_INFO "步骤1检查软件包是否在yum源中可用"
dnf list available $PACKAGE_NAME >/dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不可用"
exit 255
fi
LOG_INFO "步骤2检查系统是否已安装该软件包"
rpm -q $PACKAGE_NAME >/dev/null 2>&1
if [ $? -eq 0 ]; then
INSTALLED="true"
LOG_INFO "软件包 $PACKAGE_NAME 已安装,测试完成后保持安装状态"
else
INSTALLED="false"
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试前安装"
fi
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤3安装软件包 $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
LOG_INFO "步骤4检查viewdoc命令是否可用"
command -v viewdoc >/dev/null 2>&1
CHECK_RESULT $? 0 0 "viewdoc命令不存在"
LOG_INFO "步骤5检查viewdoc命令支持的参数"
viewdoc --help >/dev/null 2>&1
CHECK_RESULT $? 0 0 "viewdoc命令不支持--help参数"
LOG_INFO "步骤6测试查看libgreek文档"
viewdoc libgreek >/dev/null 2>&1
CHECK_RESULT $? 0 0 "无法访问libgreek文档"
LOG_INFO "步骤7测试查看libgreek文档的指定章节"
viewdoc libgreek "Introduction" >/dev/null 2>&1
CHECK_RESULT $? 0 0 "无法访问libgreek文档的Introduction章节"
LOG_INFO "步骤8测试查看不存在的文档"
viewdoc nonexistent-doc 2>&1 | grep -q "not found"
CHECK_RESULT $? 0 0 "查看不存在文档时未返回预期错误"
LOG_INFO "步骤9测试查看不存在的章节"
viewdoc libgreek "NonexistentChapter" 2>&1 | grep -q "not found"
CHECK_RESULT $? 0 0 "查看不存在章节时未返回预期错误"
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤10卸载测试安装的软件包"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载软件包失败"
LOG_INFO "环境已恢复到测试前状态"
else
LOG_INFO "步骤10保持软件包安装状态"
fi
LOG_INFO "测试完成texlive-libgreek-doc文档可访问性测试通过"
}
main "$@"

View File

@@ -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-04
# @License : Mulan PSL v2
# @Desc : 测试 texlive-mpcolornames-doc 与其他包的安装冲突
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 texlive-mpcolornames-doc 与其他包的安装冲突"
LOG_INFO "检查 texlive-mpcolornames-doc 是否已在 yum 源中"
dnf list available texlive-mpcolornames-doc > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 texlive-mpcolornames-doc 软件包"
exit 255
fi
LOG_INFO "检查当前系统是否已安装 texlive-mpcolornames-doc"
rpm -q texlive-mpcolornames-doc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-mpcolornames-doc 已安装,标记为已安装状态"
ALREADY_INSTALLED=1
else
LOG_INFO "texlive-mpcolornames-doc 未安装,标记为未安装状态"
ALREADY_INSTALLED=0
fi
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "安装 texlive-mpcolornames-doc"
dnf install -y texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "安装 texlive-mpcolornames-doc 失败"
fi
LOG_INFO "尝试安装可能冲突的包texlive-collection-latexrecommended"
dnf install -y texlive-collection-latexrecommended > /tmp/install_conflict.log 2>&1
if [ $? -ne 0 ]; then
LOG_INFO "检测到安装冲突,符合预期"
if grep -q "conflicts with" /tmp/install_conflict.log; then
LOG_INFO "冲突信息确认texlive-mpcolornames-doc 与 texlive-collection-latexrecommended 存在冲突"
CHECK_RESULT $? 0 0 "未检测到预期的冲突信息"
else
LOG_ERROR "安装失败但未检测到明确的冲突信息"
exit 1
fi
else
LOG_ERROR "未检测到安装冲突,不符合预期"
exit 1
fi
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "清理测试环境:卸载 texlive-mpcolornames-doc"
dnf remove -y texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "卸载 texlive-mpcolornames-doc 失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,78 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-04
# @License : Mulan PSL v2
# @Desc : 测试 texlive-mpcolornames-doc 软件包的基本安装功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查软件包是否已安装
LOG_INFO "检查 texlive-mpcolornames-doc 是否已安装"
rpm -q texlive-mpcolornames-doc
if [ $? -eq 0 ]; then
LOG_INFO "软件包 texlive-mpcolornames-doc 已安装"
already_installed=1
else
LOG_INFO "软件包 texlive-mpcolornames-doc 未安装"
already_installed=0
fi
# 检查软件包是否在yum源中
LOG_INFO "检查 yum 源中是否存在 texlive-mpcolornames-doc"
dnf list available texlive-mpcolornames-doc
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 texlive-mpcolornames-doc 不在 yum 源中"
exit 255
fi
# 如果未安装,则安装软件包
if [ $already_installed -eq 0 ]; then
LOG_INFO "安装 texlive-mpcolornames-doc"
dnf install -y texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "安装 texlive-mpcolornames-doc 失败"
# 验证安装
LOG_INFO "验证 texlive-mpcolornames-doc 是否安装成功"
rpm -q texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "验证 texlive-mpcolornames-doc 安装失败"
fi
# 测试软件包的基本功能
LOG_INFO "测试 texlive-mpcolornames-doc 的基本功能"
rpm -ql texlive-mpcolornames-doc | head -5
CHECK_RESULT $? 0 0 "获取 texlive-mpcolornames-doc 文件列表失败"
# 环境恢复
if [ $already_installed -eq 0 ]; then
LOG_INFO "卸载 texlive-mpcolornames-doc"
dnf remove -y texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "卸载 texlive-mpcolornames-doc 失败"
LOG_INFO "验证 texlive-mpcolornames-doc 是否卸载成功"
rpm -q texlive-mpcolornames-doc
if [ $? -eq 0 ]; then
LOG_ERROR "texlive-mpcolornames-doc 卸载失败"
exit 1
fi
else
LOG_INFO "保持 texlive-mpcolornames-doc 的安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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 : 2026-03-04
# @License : Mulan PSL v2
# @Desc : 测试 texlive-mpcolornames-doc 文档内容的可访问性
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 texlive-mpcolornames-doc 文档内容的可访问性"
LOG_INFO "步骤1: 检查系统中是否已安装 texlive-mpcolornames-doc 软件包"
rpm -q texlive-mpcolornames-doc
if [ $? -eq 0 ]; then
LOG_INFO "系统中已安装 texlive-mpcolornames-doc 软件包"
installed=true
else
LOG_INFO "系统中未安装 texlive-mpcolornames-doc 软件包"
installed=false
fi
LOG_INFO "步骤2: 检查 yum 源中是否存在 texlive-mpcolornames-doc 软件包"
dnf list available texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "yum 源中未找到 texlive-mpcolornames-doc 软件包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 texlive-mpcolornames-doc 软件包"
exit 255
fi
if [ "$installed" = false ]; then
LOG_INFO "步骤3: 安装 texlive-mpcolornames-doc 软件包"
dnf install -y texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "安装 texlive-mpcolornames-doc 软件包失败"
LOG_INFO "成功安装 texlive-mpcolornames-doc 软件包"
fi
LOG_INFO "步骤4: 测试 texlive-mpcolornames-doc 文档内容的可访问性"
LOG_INFO "检查文档文件是否存在"
rpm -ql texlive-mpcolornames-doc | head -5
CHECK_RESULT $? 0 0 "未找到 texlive-mpcolornames-doc 文档文件"
LOG_INFO "尝试访问文档目录"
doc_path=$(rpm -ql texlive-mpcolornames-doc | head -1)
if [ -d "$doc_path" ]; then
LOG_INFO "文档目录存在: $doc_path"
ls -la "$doc_path"
CHECK_RESULT $? 0 0 "无法列出文档目录内容"
else
LOG_INFO "文档文件存在: $doc_path"
file "$doc_path"
CHECK_RESULT $? 0 0 "无法访问文档文件"
fi
LOG_INFO "步骤5: 清理测试环境"
if [ "$installed" = false ]; then
LOG_INFO "卸载 texlive-mpcolornames-doc 软件包"
dnf remove -y texlive-mpcolornames-doc
CHECK_RESULT $? 0 0 "卸载 texlive-mpcolornames-doc 软件包失败"
LOG_INFO "成功卸载 texlive-mpcolornames-doc 软件包"
else
LOG_INFO "保持 texlive-mpcolornames-doc 软件包安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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-04
# @License : Mulan PSL v2
# @Desc : 验证 texlive-mpcolornames-doc 软件包文件是否完整
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义日志函数(虽然题目说不需要定义,但实际使用时需要定义)
LOG_INFO() {
echo "[INFO] $*"
}
LOG_ERROR() {
echo "[ERROR] $*" >&2
}
# 检查软件包是否存在
check_package_exists() {
local package_name="$1"
dnf list available "$package_name" &>/dev/null
return $?
}
# 安装软件包
install_package() {
local package_name="$1"
LOG_INFO "开始安装软件包: $package_name"
dnf install -y "$package_name"
CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败"
}
# 卸载软件包
uninstall_package() {
local package_name="$1"
LOG_INFO "开始卸载软件包: $package_name"
dnf remove -y "$package_name"
CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败"
}
# 验证文件完整性
verify_files() {
local package_name="$1"
LOG_INFO "验证 $package_name 文件完整性"
rpm -V "$package_name"
CHECK_RESULT $? 0 0 "软件包 $package_name 文件不完整"
}
# 主函数
main() {
local package_name="texlive-mpcolornames-doc"
local installed=false
# 步骤1检查软件包是否在yum源中
LOG_INFO "步骤1: 检查软件包 $package_name 是否在yum源中"
if ! check_package_exists "$package_name"; then
LOG_ERROR "软件包 $package_name 不在yum源中"
exit 255
fi
# 步骤2检查软件包是否已安装
LOG_INFO "步骤2: 检查软件包 $package_name 是否已安装"
if rpm -q "$package_name" &>/dev/null; then
LOG_INFO "软件包 $package_name 已安装"
installed=true
else
LOG_INFO "软件包 $package_name 未安装"
installed=false
fi
# 步骤3如果未安装则安装软件包
if [ "$installed" = false ]; then
install_package "$package_name"
fi
# 步骤4验证软件包文件完整性
verify_files "$package_name"
# 步骤5环境恢复
LOG_INFO "步骤5: 环境恢复"
if [ "$installed" = false ]; then
uninstall_package "$package_name"
else
LOG_INFO "保持软件包 $package_name 安装状态"
fi
LOG_INFO "测试完成"
}
# 执行主函数
main "$@"
}
main "$@"

Some files were not shown because too many files have changed in this diff Show More