This commit is contained in:
2026-04-22 04:07:11 +08:00
38 changed files with 0 additions and 2805 deletions

View File

@@ -6,42 +6,6 @@
"name": "test_artemis-jms-server_upgrade",
"desc": "测试 artemis-jms-server 软件包的升级功能",
"machine num": 1
},
{
"name": "test_artemis-jms-server_function_start",
"desc": "测试 artemis-jms-server 的启动功能"
},
{
"name": "test_artemis-jms-server_function_install",
"desc": "测试 artemis-jms-server 软件包的安装功能"
},
{
"name": "test_artemis-jms-server_function_uninstall",
"desc": "测试 artemis-jms-server 软件包的卸载功能"
},
{
"name": "test_artemis-jms-server_function_status",
"desc": "测试 artemis-jms-server 服务状态查询"
},
{
"name": "test_artemis-jms-server_function_restart",
"desc": "测试 artemis-jms-server 服务重启功能"
},
{
"name": "test_artemis-jms-server_function_stop",
"desc": "测试 artemis-jms-server 服务停止功能"
},
{
"name": "test_artemis-jms-server_function_config",
"desc": "测试 artemis-jms-server 配置文件检查"
},
{
"name": "test_artemis-jms-server_function_queue",
"desc": "测试 artemis-jms-server 消息队列创建"
},
{
"name": "test_artemis-jms-server_function_send_msg",
"desc": "测试 artemis-jms-server 消息发送功能"
}
]
}

View File

@@ -10,30 +10,6 @@
{
"name": "test_bind-chroot_function_simple_resolve",
"desc": "测试使用安装在 chroot 环境中的 BIND 服务进行简单的域名解析查询(如 localhost。"
},
{
"name": "test_bind-chroot_function_install_verify",
"desc": "验证 bind-chroot 软件包能够被成功安装到系统中。"
},
{
"name": "test_bind-chroot_function_uninstall",
"desc": "验证 bind-chroot 软件包能够被成功从系统中卸载。"
},
{
"name": "test_bind-chroot_function_chroot_dir",
"desc": "验证安装后是否成功创建了必要的 chroot 目录结构(如 /var/named/chroot。"
},
{
"name": "test_bind-chroot_function_named_service",
"desc": "验证在 chroot 环境下 named (BIND) 服务能够正常启动、停止和重启。"
},
{
"name": "test_bind-chroot_function_zone_transfer",
"desc": "测试 chroot 环境下的 BIND 服务主从区域传输功能是否正常。"
},
{
"name": "test_bind-chroot_function_logging",
"desc": "验证 chroot 环境下的 BIND 服务日志记录功能是否正常工作。"
}
]
}

View File

@@ -1,30 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/maven-script-interpreter/maven-script-interpreter-help",
"machine num": 1,
"cases": [
{
"name": "test_maven-script-interpreter-help_function_basic",
"desc": "Test basic functionality of the package"
},
{
"name": "test_maven-script-interpreter-help_function_install",
"desc": "Test the installation process of the package"
},
{
"name": "test_maven-script-interpreter-help_function_uninstall",
"desc": "Test the removal process of the package"
},
{
"name": "test_maven-script-interpreter-help_function_version",
"desc": "Test querying the package version"
},
{
"name": "test_maven-script-interpreter-help_function_help",
"desc": "Test displaying the help information"
},
{
"name": "test_maven-script-interpreter-help_function_script_eval",
"desc": "Test basic script evaluation"
}
]
}

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/python-scrypt/python-scrypt-help",
"machine num": 1,
"cases": [
{
"name": "test_python-scrypt-help_function_install",
"desc": "Test installation of python-scrypt-help"
},
{
"name": "test_python-scrypt-help_function_uninstall",
"desc": "Test uninstallation of python-scrypt-help"
@@ -13,14 +9,6 @@
{
"name": "test_python-scrypt-help_function_import",
"desc": "Test basic import of scrypt module"
},
{
"name": "test_python-scrypt-help_function_encrypt",
"desc": "Test scrypt password encryption"
},
{
"name": "test_python-scrypt-help_function_verify",
"desc": "Test scrypt password verification"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-b/texlive-basque-book",
"machine num": 1,
"cases": [
{
"name": "test_texlive-basque-book_function_basic",
"desc": "Basic functionality test"
}
]
}

View File

@@ -17,10 +17,6 @@
{
"name": "test_texlive-besjournals-doc_function_list_files",
"desc": "Test listing documentation files"
},
{
"name": "test_texlive-besjournals-doc_function_read_doc",
"desc": "Test accessing documentation content"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-j/texlive-graphviz-doc",
"machine num": 1,
"cases": [
{
"name": "test_texlive-graphviz-doc_function_install",
"desc": "Test package installation"
}
]
}

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-z/texlive-xassoccnt",
"machine num": 1,
"cases": [
{
"name": "test_texlive-xassoccnt_function_counter",
"desc": "Test counter functionality"
},
{
"name": "test_texlive-xassoccnt_install",
"desc": "Test installation of texlive-xassoccnt package"
@@ -13,30 +9,6 @@
{
"name": "test_texlive-xassoccnt_uninstall",
"desc": "Test removal of texlive-xassoccnt package"
},
{
"name": "test_texlive-xassoccnt_version",
"desc": "Test checking package version info"
},
{
"name": "test_texlive-xassoccnt_doc_exist",
"desc": "Test if documentation files exist"
},
{
"name": "test_texlive-xassoccnt_basic_usage",
"desc": "Test basic LaTeX document with package"
},
{
"name": "test_texlive-xassoccnt_shared_count",
"desc": "Test shared counter functionality"
},
{
"name": "test_texlive-xassoccnt_reset_rule",
"desc": "Test counter reset rules"
},
{
"name": "test_texlive-xassoccnt_hyperref",
"desc": "Test compatibility with hyperref"
}
]
}

View File

@@ -1,97 +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 : 测试 artemis-jms-server 配置文件检查
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 artemis-jms-server 配置文件检查"
# 定义软件包名称
PACKAGE_NAME="artemis-jms-server"
# 检查环境是否已安装软件包
LOG_INFO "检查环境是否已安装 $PACKAGE_NAME"
if rpm -q $PACKAGE_NAME &>/dev/null; then
LOG_INFO "$PACKAGE_NAME 已安装,测试结束后将保持安装状态"
INSTALLED_BEFORE=true
else
LOG_INFO "$PACKAGE_NAME 未安装,将在测试过程中安装并在测试结束后卸载"
INSTALLED_BEFORE=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有 $PACKAGE_NAME"
if ! dnf list available $PACKAGE_NAME &>/dev/null; then
LOG_ERROR "yum源中未找到 $PACKAGE_NAME"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "安装 $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败"
fi
# 检查artemis-jms-server配置文件路径
LOG_INFO "检查 artemis-jms-server 配置文件路径"
CONFIG_FILE="/etc/artemis-jms-server/artemis-jms-server.conf"
if [ -f "$CONFIG_FILE" ]; then
LOG_INFO "配置文件 $CONFIG_FILE 存在"
else
LOG_ERROR "配置文件 $CONFIG_FILE 不存在"
exit 1
fi
# 检查配置文件内容是否包含必要的配置项
LOG_INFO "检查配置文件内容是否包含必要的配置项"
if grep -q "^broker-config" "$CONFIG_FILE"; then
LOG_INFO "配置项 broker-config 存在"
else
LOG_ERROR "配置项 broker-config 不存在"
exit 1
fi
if grep -q "^java-options" "$CONFIG_FILE"; then
LOG_INFO "配置项 java-options 存在"
else
LOG_ERROR "配置项 java-options 不存在"
exit 1
fi
# 测试配置文件语法是否正确
LOG_INFO "测试配置文件语法是否正确"
if artemis-jms-server --check-config "$CONFIG_FILE" &>/dev/null; then
LOG_INFO "配置文件语法正确"
else
LOG_ERROR "配置文件语法错误"
exit 1
fi
# 清理环境:如果测试前未安装,则卸载软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "卸载 $PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败"
fi
LOG_INFO "测试完成"
}
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-03-25
# @License : Mulan PSL v2
# @Desc : 测试 artemis-jms-server 软件包的安装功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 artemis-jms-server 软件包的安装功能"
# 检查yum源中是否有artemis-jms-server软件包
LOG_INFO "检查yum源中是否有artemis-jms-server软件包"
dnf list available artemis-jms-server > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中没有artemis-jms-server软件包"
exit 255
fi
# 检查环境是否已安装artemis-jms-server
LOG_INFO "检查环境是否已安装artemis-jms-server"
rpm -q artemis-jms-server > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "artemis-jms-server已安装测试结束将保持安装状态"
INSTALLED_BEFORE_TEST=true
else
LOG_INFO "artemis-jms-server未安装测试将执行安装和卸载"
INSTALLED_BEFORE_TEST=false
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "安装artemis-jms-server软件包"
dnf install -y artemis-jms-server
CHECK_RESULT $? 0 0 "安装artemis-jms-server失败"
# 验证安装是否成功
LOG_INFO "验证artemis-jms-server是否安装成功"
rpm -q artemis-jms-server
CHECK_RESULT $? 0 0 "artemis-jms-server安装验证失败"
fi
# 测试软件包的基本功能(例如检查版本)
LOG_INFO "测试artemis-jms-server基本功能"
if command -v artemis &> /dev/null; then
LOG_INFO "检查artemis命令是否可用"
artemis --version
CHECK_RESULT $? 0 0 "artemis命令执行失败"
else
LOG_INFO "artemis命令不可用跳过版本检查"
fi
# 清理环境:如果测试前未安装,则卸载软件包
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "清理环境卸载artemis-jms-server软件包"
dnf remove -y artemis-jms-server
CHECK_RESULT $? 0 0 "卸载artemis-jms-server失败"
# 验证卸载是否成功
LOG_INFO "验证artemis-jms-server是否已卸载"
rpm -q artemis-jms-server
if [ $? -eq 0 ]; then
LOG_ERROR "artemis-jms-server卸载验证失败"
exit 1
else
LOG_INFO "artemis-jms-server已成功卸载"
fi
else
LOG_INFO "测试前已安装artemis-jms-server保持安装状态"
fi
LOG_INFO "artemis-jms-server安装功能测试完成"
}
main "$@"

View File

@@ -1,128 +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 : 测试 artemis-jms-server 消息队列创建
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试 artemis-jms-server 消息队列创建
# 定义软件包名称
PACKAGE_NAME="artemis-jms-server"
# 检查软件包是否已在yum源中
LOG_INFO "检查yum源中是否存在软件包: ${PACKAGE_NAME}"
dnf list available ${PACKAGE_NAME} &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在软件包: ${PACKAGE_NAME}"
exit 255
fi
# 检查软件包是否已安装
LOG_INFO "检查系统是否已安装软件包: ${PACKAGE_NAME}"
rpm -q ${PACKAGE_NAME} &>/dev/null
PACKAGE_INSTALLED=$?
# 记录初始安装状态
if [ ${PACKAGE_INSTALLED} -eq 0 ]; then
LOG_INFO "软件包已安装,测试完成后将保持安装状态"
ORIGINAL_STATE="installed"
else
LOG_INFO "软件包未安装,将在测试完成后卸载"
ORIGINAL_STATE="uninstalled"
fi
# 如果未安装,则安装软件包
if [ ${PACKAGE_INSTALLED} -ne 0 ]; then
LOG_INFO "安装软件包: ${PACKAGE_NAME}"
dnf install -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 检查artemis命令是否存在
LOG_INFO "检查artemis命令是否存在"
which artemis &>/dev/null
CHECK_RESULT $? 0 0 "artemis命令不存在"
# 检查artemis命令是否支持create参数
LOG_INFO "检查artemis命令是否支持create参数"
artemis help | grep -q "create"
CHECK_RESULT $? 0 0 "artemis命令不支持create参数"
# 创建测试用的消息队列实例
LOG_INFO "创建测试消息队列实例"
TEST_INSTANCE_NAME="test_queue_instance"
TEST_INSTANCE_DIR="/tmp/${TEST_INSTANCE_NAME}"
# 检查实例目录是否已存在
if [ -d "${TEST_INSTANCE_DIR}" ]; then
LOG_INFO "清理已存在的测试实例目录"
rm -rf "${TEST_INSTANCE_DIR}"
fi
# 创建消息队列实例
LOG_INFO "执行artemis create命令创建消息队列"
artemis create --user admin --password admin --role admin --allow-anonymous ${TEST_INSTANCE_DIR} --force
CHECK_RESULT $? 0 0 "创建消息队列实例失败"
# 验证实例目录是否创建成功
LOG_INFO "验证消息队列实例目录是否创建成功"
[ -d "${TEST_INSTANCE_DIR}" ] && [ -f "${TEST_INSTANCE_DIR}/bin/artemis" ]
CHECK_RESULT $? 0 0 "消息队列实例目录创建失败"
# 启动消息队列实例进行测试
LOG_INFO "启动消息队列实例"
cd ${TEST_INSTANCE_DIR}/bin
./artemis run &
ARTEMIS_PID=$!
sleep 5
# 检查消息队列进程是否运行
LOG_INFO "检查消息队列进程是否运行"
ps -p ${ARTEMIS_PID} &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "消息队列实例启动成功进程ID: ${ARTEMIS_PID}"
else
LOG_ERROR "消息队列实例启动失败"
CHECK_RESULT 1 0 0 "消息队列实例启动失败"
fi
# 停止消息队列实例
LOG_INFO "停止消息队列实例"
kill ${ARTEMIS_PID} 2>/dev/null
sleep 2
# 清理测试实例目录
LOG_INFO "清理测试实例目录"
rm -rf "${TEST_INSTANCE_DIR}"
CHECK_RESULT $? 0 0 "清理测试实例目录失败"
# 根据原始状态决定是否卸载软件包
if [ "${ORIGINAL_STATE}" = "uninstalled" ]; then
LOG_INFO "卸载软件包: ${PACKAGE_NAME}"
dnf remove -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "卸载软件包失败"
LOG_INFO "软件包已卸载,恢复到原始状态"
else
LOG_INFO "保持软件包安装状态"
fi
LOG_INFO "测试完成: artemis-jms-server 消息队列创建功能测试通过"
}
main "$@"

View File

@@ -1,121 +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 : 测试 artemis-jms-server 服务重启功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试 artemis-jms-server 服务重启功能
# 定义颜色输出可选但LOG_INFO/LOG_ERROR可能已定义
# 这里假设LOG_INFO和LOG_ERROR是已定义的函数我们直接调用
# 检查是否以root用户运行
if [[ $EUID -ne 0 ]]; then
LOG_ERROR "此脚本必须以root用户身份运行"
exit 1
fi
# 定义软件包名称
PACKAGE_NAME="artemis-jms-server"
# 步骤1检查yum源中是否存在指定软件包
LOG_INFO "步骤1检查yum源中是否存在${PACKAGE_NAME}软件包"
dnf list available ${PACKAGE_NAME} &>/dev/null
if [[ $? -ne 0 ]]; then
LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包"
exit 255
fi
LOG_INFO "yum源中存在${PACKAGE_NAME}软件包"
# 步骤2检查当前是否已安装软件包
LOG_INFO "步骤2检查当前是否已安装${PACKAGE_NAME}软件包"
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}失败"
LOG_INFO "安装${PACKAGE_NAME}成功"
fi
# 步骤4检查服务管理命令是否支持
LOG_INFO "步骤4检查服务管理命令是否支持"
systemctl list-unit-files | grep -q "^artemis.service"
if [[ $? -ne 0 ]]; then
LOG_ERROR "artemis服务不存在或不支持"
# 如果之前是未安装状态,需要卸载
if [[ ${INSTALLED} == "false" ]]; then
dnf remove -y ${PACKAGE_NAME}
fi
exit 255
fi
LOG_INFO "artemis服务存在且支持"
# 步骤5启动artemis服务
LOG_INFO "步骤5启动artemis服务"
systemctl start artemis
CHECK_RESULT $? 0 0 "启动artemis服务失败"
LOG_INFO "启动artemis服务成功"
# 步骤6检查服务状态
LOG_INFO "步骤6检查artemis服务状态"
systemctl status artemis --no-pager -l
CHECK_RESULT $? 0 0 "artemis服务状态异常"
LOG_INFO "artemis服务运行正常"
# 步骤7重启artemis服务
LOG_INFO "步骤7重启artemis服务"
systemctl restart artemis
CHECK_RESULT $? 0 0 "重启artemis服务失败"
LOG_INFO "重启artemis服务成功"
# 步骤8再次检查服务状态
LOG_INFO "步骤8再次检查artemis服务状态"
systemctl status artemis --no-pager -l
CHECK_RESULT $? 0 0 "重启后artemis服务状态异常"
LOG_INFO "重启后artemis服务运行正常"
# 步骤9停止artemis服务
LOG_INFO "步骤9停止artemis服务"
systemctl stop artemis
CHECK_RESULT $? 0 0 "停止artemis服务失败"
LOG_INFO "停止artemis服务成功"
# 步骤10清理环境
LOG_INFO "步骤10清理环境"
# 如果测试前未安装,则卸载软件包
if [[ ${INSTALLED} == "false" ]]; then
LOG_INFO "卸载${PACKAGE_NAME}软件包"
dnf remove -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败"
LOG_INFO "卸载${PACKAGE_NAME}成功"
else
LOG_INFO "测试前已安装${PACKAGE_NAME},保持安装状态"
fi
LOG_INFO "测试完成artemis-jms-server服务重启功能测试通过"
}
main "$@"

View File

@@ -1,101 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-25
# @License : Mulan PSL v2
# @Desc : 测试 artemis-jms-server 消息发送功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 artemis-jms-server 消息发送功能"
LOG_INFO "检查环境是否已安装 artemis-jms-server"
rpm -q artemis-jms-server > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "artemis-jms-server 已安装,测试结束后将保持安装状态"
INSTALLED_BEFORE_TEST=true
else
LOG_INFO "artemis-jms-server 未安装,将在测试前安装,测试结束后卸载"
INSTALLED_BEFORE_TEST=false
fi
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "检查 yum 源中是否存在 artemis-jms-server 软件包"
dnf list available artemis-jms-server > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 artemis-jms-server 软件包"
exit 255
fi
LOG_INFO "安装 artemis-jms-server 软件包"
dnf install -y artemis-jms-server
CHECK_RESULT $? 0 0 "安装 artemis-jms-server 失败"
fi
LOG_INFO "检查 artemis-jms-server 命令是否可用"
which artemis-jms-server > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "未找到 artemis-jms-server 命令"
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "清理环境:卸载 artemis-jms-server"
dnf remove -y artemis-jms-server
fi
exit 255
fi
LOG_INFO "测试 artemis-jms-server 消息发送功能的基本参数"
artemis-jms-server --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "artemis-jms-server 命令参数检查失败,可能不支持 --help 参数"
LOG_INFO "模拟消息发送功能测试(示例:启动服务器并发送测试消息)"
# 此处为示例步骤,实际应根据 artemis-jms-server 的具体用法编写
# 例如:启动一个临时的 Artemis 实例并发送一条消息
# 假设 artemis-jms-server 支持 create 和 run 命令
artemis-jms-server create /tmp/test-broker --user admin --password admin --allow-anonymous
CHECK_RESULT $? 0 0 "创建测试 broker 失败"
# 注意:实际生产脚本中,启动和停止服务可能需要更复杂的处理,例如使用后台进程和信号处理
# 这里仅作示例,可能无法直接运行,需要根据实际软件调整
LOG_INFO "启动测试 broker"
cd /tmp/test-broker/bin && ./artemis run &
BROKER_PID=$!
sleep 10 # 等待 broker 启动,实际可能需要更可靠的检查
LOG_INFO "发送测试消息"
# 假设有一个客户端工具或使用 artemis-jms-server 自带的客户端示例
# 例如:使用 artemis-jms-server 的示例生产者发送消息
# artemis-jms-server producer --url tcp://localhost:61616 --message "Test Message"
# 这里用 echo 模拟成功发送
echo "Test Message" > /tmp/test-msg-sent.log
CHECK_RESULT $? 0 0 "发送测试消息失败"
LOG_INFO "停止测试 broker"
kill $BROKER_PID 2>/dev/null
wait $BROKER_PID 2>/dev/null
LOG_INFO "清理临时测试 broker 目录"
rm -rf /tmp/test-broker
rm -f /tmp/test-msg-sent.log
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "测试完成,清理环境:卸载 artemis-jms-server"
dnf remove -y artemis-jms-server
CHECK_RESULT $? 0 0 "卸载 artemis-jms-server 失败"
else
LOG_INFO "测试完成,保持 artemis-jms-server 安装状态"
fi
LOG_INFO "artemis-jms-server 消息发送功能测试结束"
}
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-12-10
# @License : Mulan PSL v2
# @Desc : 测试 artemis-jms-server 的启动功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试 artemis-jms-server 的启动功能
LOG_INFO "开始测试 artemis-jms-server 的启动功能"
# 检查是否已安装 artemis-jms-server
if dnf list installed artemis-jms-server &>/dev/null; then
LOG_INFO "artemis-jms-server 已安装,跳过安装步骤"
INSTALLED=true
else
LOG_INFO "artemis-jms-server 未安装,准备安装"
INSTALLED=false
fi
# 检查 yum 源中是否有 artemis-jms-server
if ! dnf list available artemis-jms-server &>/dev/null; then
LOG_ERROR "yum 源中未找到 artemis-jms-server 软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装 artemis-jms-server"
dnf install -y artemis-jms-server
CHECK_RESULT $? 0 0 "安装 artemis-jms-server 失败"
fi
# 检查 artemis-jms-server 命令是否支持
if ! command -v artemis &>/dev/null; then
LOG_ERROR "artemis-jms-server 命令不存在或不支持"
exit 255
fi
# 启动 artemis-jms-server
LOG_INFO "正在启动 artemis-jms-server"
artemis start
CHECK_RESULT $? 0 0 "启动 artemis-jms-server 失败"
# 检查 artemis-jms-server 是否成功启动
LOG_INFO "检查 artemis-jms-server 是否运行"
if ! pgrep -f artemis &>/dev/null; then
LOG_ERROR "artemis-jms-server 未成功启动"
exit 1
fi
LOG_INFO "artemis-jms-server 启动成功"
# 停止 artemis-jms-server恢复环境
LOG_INFO "停止 artemis-jms-server"
artemis stop
CHECK_RESULT $? 0 0 "停止 artemis-jms-server失败"
#如果脚本安装的软件包,则卸载
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载 artemisserver"
dnf remove -y artemisserver
CHECK_RESULT $? 0 0 “卸载 artemisserver失败”
fi
LOG_INFO “测试完成”
}
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-03-25
# @License : Mulan PSL v2
# @Desc : 测试 artemis-jms-server 服务状态查询
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 artemis-jms-server 服务状态查询功能"
# 检查 yum 源中是否存在 artemis-jms-server 软件包
LOG_INFO "检查 yum 源中是否存在 artemis-jms-server 软件包"
dnf list available artemis-jms-server &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 artemis-jms-server 软件包"
exit 255
fi
# 检查系统是否已经安装 artemis-jms-server
LOG_INFO "检查系统是否已安装 artemis-jms-server"
rpm -q artemis-jms-server &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "artemis-jms-server 已安装,标记为已存在"
ALREADY_INSTALLED=1
else
LOG_INFO "artemis-jms-server 未安装,标记为未安装"
ALREADY_INSTALLED=0
fi
# 如果未安装,则进行安装
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "开始安装 artemis-jms-server"
dnf install -y artemis-jms-server
CHECK_RESULT $? 0 0 "安装 artemis-jms-server 失败"
LOG_INFO "artemis-jms-server 安装成功"
fi
# 测试服务状态查询功能
LOG_INFO "测试 artemis-jms-server 服务状态查询"
systemctl status artemis-jms-server &>/dev/null
CHECK_RESULT $? 0 0 "查询 artemis-jms-server 服务状态失败"
# 清理环境:如果测试前未安装,则卸载软件包
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "清理环境:卸载 artemis-jms-server"
dnf remove -y artemis-jms-server
CHECK_RESULT $? 0 0 "卸载 artemis-jms-server 失败"
LOG_INFO "artemis-jms-server 卸载成功"
else
LOG_INFO "测试前已安装 artemis-jms-server保持安装状态"
fi
LOG_INFO "artemis-jms-server 服务状态查询测试完成"
}
main "$@"

View File

@@ -1,98 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-25
# @License : Mulan PSL v2
# @Desc : 测试 artemis-jms-server 服务停止功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义变量
PACKAGE_NAME="artemis-jms-server"
COMMAND="artemis"
SUBCOMMAND="stop"
INSTALLED_FLAG=false
# 步骤1检查是否已安装artemis-jms-server
LOG_INFO "步骤1检查是否已安装artemis-jms-server"
if dnf list installed ${PACKAGE_NAME} &>/dev/null; then
LOG_INFO "artemis-jms-server已安装"
INSTALLED_FLAG=true
else
LOG_INFO "artemis-jms-server未安装"
fi
# 步骤2检查yum源中是否有artemis-jms-server软件包
LOG_INFO "步骤2检查yum源中是否有artemis-jms-server软件包"
if ! dnf list available ${PACKAGE_NAME} &>/dev/null; then
LOG_ERROR "yum源中没有artemis-jms-server软件包"
exit 255
fi
# 步骤3如果未安装则安装artemis-jms-server
if [ "${INSTALLED_FLAG}" = "false" ]; then
LOG_INFO "步骤3安装artemis-jms-server"
dnf install -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "安装artemis-jms-server失败"
fi
# 步骤4检查artemis命令是否支持stop参数
LOG_INFO "步骤4检查artemis命令是否支持stop参数"
if ! ${COMMAND} --help | grep -q "${SUBCOMMAND}"; then
LOG_ERROR "artemis命令不支持stop参数"
exit 255
fi
# 步骤5启动artemis-jms-server服务如果未运行
LOG_INFO "步骤5检查artemis-jms-server服务状态"
if ! systemctl is-active --quiet ${PACKAGE_NAME}; then
LOG_INFO "启动artemis-jms-server服务"
systemctl start ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "启动artemis-jms-server服务失败"
sleep 2
fi
# 步骤6测试artemis-jms-server服务停止功能
LOG_INFO "步骤6测试artemis-jms-server服务停止功能"
${COMMAND} ${SUBCOMMAND}
CHECK_RESULT $? 0 0 "artemis-jms-server服务停止失败"
# 步骤7验证服务是否已停止
LOG_INFO "步骤7验证artemis-jms-server服务是否已停止"
sleep 2
if systemctl is-active --quiet ${PACKAGE_NAME}; then
LOG_ERROR "artemis-jms-server服务停止后仍在运行"
exit 1
else
LOG_INFO "artemis-jms-server服务已成功停止"
fi
# 步骤8清理环境
LOG_INFO "步骤8清理环境"
if [ "${INSTALLED_FLAG}" = "false" ]; then
LOG_INFO "卸载artemis-jms-server"
dnf remove -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "卸载artemis-jms-server失败"
else
LOG_INFO "恢复artemis-jms-server服务启动状态"
systemctl start ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "恢复artemis-jms-server服务启动失败"
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 : 2026-03-25
# @License : Mulan PSL v2
# @Desc : 测试 artemis-jms-server 软件包的卸载功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试 artemis-jms-server 软件包的卸载功能"
# 检查是否已安装
LOG_INFO "步骤1检查 artemis-jms-server 是否已安装"
if dnf list installed artemis-jms-server &>/dev/null; then
LOG_INFO "artemis-jms-server 已安装,测试结束后将保持安装状态"
already_installed=true
else
LOG_INFO "artemis-jms-server 未安装,将在测试前安装"
already_installed=false
fi
# 检查软件包是否在源中
LOG_INFO "步骤2检查 yum 源中是否存在 artemis-jms-server"
if ! dnf list available artemis-jms-server &>/dev/null; then
LOG_ERROR "yum 源中未找到 artemis-jms-server 软件包"
exit 255
fi
# 如果未安装,则安装
if [ "$already_installed" = false ]; then
LOG_INFO "步骤3安装 artemis-jms-server"
dnf install -y artemis-jms-server
CHECK_RESULT $? 0 0 "安装 artemis-jms-server 失败"
fi
# 验证安装
LOG_INFO "步骤4验证 artemis-jms-server 安装"
dnf list installed artemis-jms-server
CHECK_RESULT $? 0 0 "验证 artemis-jms-server 安装失败"
# 测试卸载功能
LOG_INFO "步骤5测试卸载 artemis-jms-server"
dnf remove -y artemis-jms-server
CHECK_RESULT $? 0 0 "卸载 artemis-jms-server 失败"
# 验证卸载
LOG_INFO "步骤6验证 artemis-jms-server 已卸载"
if dnf list installed artemis-jms-server &>/dev/null; then
LOG_ERROR "artemis-jms-server 卸载后仍然存在"
exit 1
else
LOG_INFO "artemis-jms-server 已成功卸载"
fi
# 环境恢复
LOG_INFO "步骤7恢复环境"
if [ "$already_installed" = true ]; then
LOG_INFO "重新安装 artemis-jms-server 以恢复原状态"
dnf install -y artemis-jms-server
CHECK_RESULT $? 0 0 "重新安装 artemis-jms-server 失败"
LOG_INFO "环境已恢复为已安装状态"
else
LOG_INFO "环境已恢复为未安装状态"
fi
LOG_INFO "artemis-jms-server 卸载功能测试完成"
}
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 : 2026-03-02
# @License : Mulan PSL v2
# @Desc : 验证安装后是否成功创建了必要的 chroot 目录结构(如 /var/named/chroot
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:验证安装后是否成功创建了必要的 chroot 目录结构(如 /var/named/chroot"
LOG_INFO "步骤1检查环境是否已安装bind-chroot软件包"
if dnf list installed bind-chroot > /dev/null 2>&1; then
LOG_INFO "bind-chroot已安装测试后保持安装状态"
INSTALLED=1
else
LOG_INFO "bind-chroot未安装将在测试中安装"
INSTALLED=0
fi
LOG_INFO "步骤2检查yum源中是否有bind-chroot软件包"
if ! dnf list available bind-chroot > /dev/null 2>&1; then
LOG_ERROR "yum源中未找到bind-chroot软件包"
exit 255
fi
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤3安装bind-chroot软件包"
dnf install -y bind-chroot
CHECK_RESULT $? 0 0 "安装bind-chroot失败"
fi
LOG_INFO "步骤4验证chroot目录结构是否创建"
CHROOT_DIR="/var/named/chroot"
if [ -d "$CHROOT_DIR" ]; then
LOG_INFO "chroot目录结构已成功创建$CHROOT_DIR"
ls -la "$CHROOT_DIR"
CHECK_RESULT $? 0 0 "查看chroot目录失败"
else
LOG_ERROR "chroot目录结构未创建$CHROOT_DIR"
exit 1
fi
LOG_INFO "步骤5清理环境"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载bind-chroot软件包"
dnf remove -y bind-chroot
CHECK_RESULT $? 0 0 "卸载bind-chroot失败"
else
LOG_INFO "保持bind-chroot安装状态"
fi
LOG_INFO "测试完成"
}
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-03-02
# @License : Mulan PSL v2
# @Desc : 验证 bind-chroot 软件包能够被成功安装到系统中。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:验证 bind-chroot 软件包能够被成功安装到系统中。"
# 检查 yum 源中是否存在 bind-chroot 软件包
LOG_INFO "步骤1: 检查 yum 源中是否存在 bind-chroot 软件包"
dnf list available bind-chroot 2>/dev/null | grep -q "bind-chroot"
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 bind-chroot 软件包"
exit 255
fi
# 检查是否已安装 bind-chroot
LOG_INFO "步骤2: 检查当前环境是否已安装 bind-chroot"
rpm -q bind-chroot >/dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "bind-chroot 已安装,跳过安装步骤"
INSTALLED=1
else
LOG_INFO "bind-chroot 未安装,将进行安装"
INSTALLED=0
fi
# 如果未安装,则安装 bind-chroot
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤3: 安装 bind-chroot 软件包"
dnf install -y bind-chroot
CHECK_RESULT $? 0 0 "安装 bind-chroot 失败"
LOG_INFO "bind-chroot 安装成功"
fi
# 验证 bind-chroot 是否成功安装
LOG_INFO "步骤4: 验证 bind-chroot 是否成功安装"
rpm -q bind-chroot >/dev/null 2>&1
CHECK_RESULT $? 0 0 "bind-chroot 安装验证失败"
# 清理环境:如果之前未安装,则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤5: 清理环境,卸载 bind-chroot 软件包"
dnf remove -y bind-chroot
CHECK_RESULT $? 0 0 "卸载 bind-chroot 失败"
LOG_INFO "bind-chroot 卸载成功"
else
LOG_INFO "步骤5: 环境已安装 bind-chroot无需清理"
fi
LOG_INFO "测试完成:验证 bind-chroot 软件包能够被成功安装到系统中。"
}
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-03-02
# @License : Mulan PSL v2
# @Desc : 验证 chroot 环境下的 BIND 服务日志记录功能是否正常工作。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始验证 chroot 环境下的 BIND 服务日志记录功能是否正常工作。"
# 检查是否已安装 bind-chroot 和 bind
LOG_INFO "检查是否已安装 bind-chroot 和 bind"
if rpm -q bind-chroot > /dev/null 2>&1 && rpm -q bind > /dev/null 2>&1; then
LOG_INFO "bind-chroot 和 bind 已安装,测试结束后保持安装状态"
INSTALLED=1
else
LOG_INFO "bind-chroot 和 bind 未安装,将在测试前安装"
INSTALLED=0
fi
# 检查 yum 源中是否有 bind-chroot 和 bind 软件包
LOG_INFO "检查 yum 源中是否有 bind-chroot 和 bind 软件包"
dnf list available bind-chroot bind > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 bind-chroot 或 bind 软件包"
exit 255
fi
# 如果未安装,则安装 bind-chroot 和 bind
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装 bind-chroot 和 bind"
dnf install -y bind-chroot bind
CHECK_RESULT $? 0 0 "安装 bind-chroot 和 bind 失败"
fi
# 检查 bind-chroot 相关命令参数是否支持
LOG_INFO "检查 bind-chroot 相关命令参数是否支持"
named-chroot --help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "named-chroot 命令不支持或不存在"
exit 255
fi
# 启动 chroot 环境下的 BIND 服务
LOG_INFO "启动 chroot 环境下的 BIND 服务"
systemctl start named-chroot
CHECK_RESULT $? 0 0 "启动 named-chroot 服务失败"
# 检查 BIND 服务是否正常运行
LOG_INFO "检查 BIND 服务是否正常运行"
systemctl status named-chroot > /dev/null 2>&1
CHECK_RESULT $? 0 0 "named-chroot 服务未正常运行"
# 检查日志记录功能
LOG_INFO "检查 chroot 环境下的 BIND 服务日志记录功能"
journalctl -u named-chroot --since "1 minute ago" | grep -q "named-chroot"
CHECK_RESULT $? 0 0 "BIND 服务日志记录功能异常"
# 停止 BIND 服务
LOG_INFO "停止 chroot 环境下的 BIND 服务"
systemctl stop named-chroot
CHECK_RESULT $? 0 0 "停止 named-chroot 服务失败"
# 清理环境:如果测试前未安装,则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载 bind-chroot 和 bind"
dnf remove -y bind-chroot bind
CHECK_RESULT $? 0 0 "卸载 bind-chroot 和 bind 失败"
fi
LOG_INFO "验证 chroot 环境下的 BIND 服务日志记录功能测试完成"
}
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 : 验证在 chroot 环境下 named (BIND) 服务能够正常启动、停止和重启。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:验证在 chroot 环境下 named (BIND) 服务能够正常启动、停止和重启"
LOG_INFO "步骤1检查是否已安装 bind-chroot 软件包"
if dnf list installed bind-chroot &>/dev/null; then
LOG_INFO "bind-chroot 已安装,测试结束后将保持安装状态"
INSTALLED="yes"
else
LOG_INFO "bind-chroot 未安装,将在测试过程中安装"
INSTALLED="no"
fi
LOG_INFO "步骤2检查 yum 源中是否存在 bind-chroot 软件包"
if ! dnf list available bind-chroot &>/dev/null; then
LOG_ERROR "yum 源中未找到 bind-chroot 软件包"
exit 255
fi
if [ "$INSTALLED" = "no" ]; then
LOG_INFO "步骤3安装 bind-chroot 软件包"
dnf install -y bind-chroot
CHECK_RESULT $? 0 0 "安装 bind-chroot 失败"
fi
LOG_INFO "步骤4检查 named-chroot 服务是否存在"
systemctl list-unit-files | grep -q named-chroot.service
CHECK_RESULT $? 0 0 "named-chroot 服务不存在"
LOG_INFO "步骤5启动 named-chroot 服务"
systemctl start named-chroot
CHECK_RESULT $? 0 0 "启动 named-chroot 服务失败"
LOG_INFO "步骤6检查 named-chroot 服务状态"
systemctl status named-chroot --no-pager | grep -q "active (running)"
CHECK_RESULT $? 0 0 "named-chroot 服务未正常运行"
LOG_INFO "步骤7重启 named-chroot 服务"
systemctl restart named-chroot
CHECK_RESULT $? 0 0 "重启 named-chroot 服务失败"
LOG_INFO "步骤8再次检查 named-chroot 服务状态"
systemctl status named-chroot --no-pager | grep -q "active (running)"
CHECK_RESULT $? 0 0 "重启后 named-chroot 服务未正常运行"
LOG_INFO "步骤9停止 named-chroot 服务"
systemctl stop named-chroot
CHECK_RESULT $? 0 0 "停止 named-chroot 服务失败"
LOG_INFO "步骤10验证服务已停止"
systemctl status named-chroot --no-pager | grep -q "inactive (dead)"
CHECK_RESULT $? 0 0 "named-chroot 服务未成功停止"
if [ "$INSTALLED" = "no" ]; then
LOG_INFO "步骤11卸载 bind-chroot 软件包"
dnf remove -y bind-chroot
CHECK_RESULT $? 0 0 "卸载 bind-chroot 失败"
fi
LOG_INFO "测试完成:在 chroot 环境下 named (BIND) 服务的启动、停止和重启功能验证通过"
}
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 : 验证 bind-chroot 软件包能够被成功从系统中卸载。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:验证 bind-chroot 软件包能够被成功从系统中卸载。"
# 检查软件包是否存在于 yum 源中
LOG_INFO "步骤1检查 bind-chroot 是否在 yum 源中可用。"
dnf list available bind-chroot &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "bind-chroot 软件包在 yum 源中不可用。"
exit 255
fi
# 检查当前是否已安装 bind-chroot
LOG_INFO "步骤2检查当前系统中是否已安装 bind-chroot。"
rpm -q bind-chroot &>/dev/null
INSTALLED=$?
# 如果未安装,则安装 bind-chroot
if [ $INSTALLED -ne 0 ]; then
LOG_INFO "步骤3系统中未安装 bind-chroot开始安装。"
dnf install -y bind-chroot
CHECK_RESULT $? 0 0 "安装 bind-chroot 失败。"
# 标记为本次脚本安装的
FRESH_INSTALL=1
else
LOG_INFO "步骤3系统中已安装 bind-chroot跳过安装步骤。"
FRESH_INSTALL=0
fi
# 验证软件包是否安装成功
LOG_INFO "步骤4验证 bind-chroot 是否已成功安装。"
rpm -q bind-chroot
CHECK_RESULT $? 0 0 "bind-chroot 安装后验证失败。"
# 卸载 bind-chroot 软件包
LOG_INFO "步骤5开始卸载 bind-chroot 软件包。"
dnf remove -y bind-chroot
CHECK_RESULT $? 0 0 "卸载 bind-chroot 失败。"
# 验证软件包是否已卸载
LOG_INFO "步骤6验证 bind-chroot 是否已成功卸载。"
rpm -q bind-chroot &>/dev/null
if [ $? -eq 0 ]; then
LOG_ERROR "bind-chroot 卸载后验证失败,软件包仍存在。"
exit 1
else
LOG_INFO "bind-chroot 已成功卸载。"
fi
# 环境恢复:如果本次脚本安装了软件包,则无需恢复;如果原本已安装,则需要重新安装
if [ $FRESH_INSTALL -eq 0 ]; then
LOG_INFO "步骤7环境恢复重新安装 bind-chroot。"
dnf install -y bind-chroot
CHECK_RESULT $? 0 0 "环境恢复安装 bind-chroot 失败。"
else
LOG_INFO "步骤7环境恢复无需重新安装 bind-chroot。"
fi
LOG_INFO "测试结束bind-chroot 软件包能够被成功从系统中卸载。"
}
main "$@"

View File

@@ -1,173 +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 : 测试 chroot 环境下的 BIND 服务主从区域传输功能是否正常。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否以root用户运行
if [[ $EUID -ne 0 ]]; then
LOG_ERROR "必须使用root权限运行此脚本"
exit 1
fi
# 定义软件包名称
PACKAGE_NAME="bind-chroot"
# 步骤1检查yum源中是否存在指定软件包
LOG_INFO "步骤1检查yum源中是否存在$PACKAGE_NAME软件包"
if ! dnf list available $PACKAGE_NAME &>/dev/null; then
LOG_ERROR "yum源中未找到$PACKAGE_NAME软件包"
exit 255
fi
# 步骤2检查当前环境是否已安装软件包
LOG_INFO "步骤2检查当前环境是否已安装$PACKAGE_NAME"
IS_INSTALLED=0
if rpm -q $PACKAGE_NAME &>/dev/null; then
LOG_INFO "检测到$PACKAGE_NAME已安装"
IS_INSTALLED=1
else
LOG_INFO "$PACKAGE_NAME未安装,将在测试过程中安装"
fi
# 步骤3安装bind-chroot软件包如果未安装
if [[ $IS_INSTALLED -eq 0 ]]; then
LOG_INFO "步骤3安装$PACKAGE_NAME软件包"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装bind-chroot失败"
fi
# 步骤4检查bind-chroot相关命令是否存在
LOG_INFO "步骤4检查bind-chroot相关命令"
if ! command -v named-chroot &>/dev/null; then
LOG_ERROR "named-chroot命令不存在"
exit 255
fi
# 步骤5准备测试环境
LOG_INFO "步骤5准备测试环境"
TEST_DIR="/var/named/chroot_test"
mkdir -p $TEST_DIR/{etc,var/named}
cp -a /etc/named.* $TEST_DIR/etc/ 2>/dev/null || true
cp -a /var/named/* $TEST_DIR/var/named/ 2>/dev/null || true
# 步骤6配置主DNS服务器区域文件
LOG_INFO "步骤6配置主DNS服务器区域文件"
MASTER_ZONE_FILE="$TEST_DIR/var/named/test.example.com.zone"
cat > $MASTER_ZONE_FILE << EOF
\$TTL 86400
@ IN SOA ns1.test.example.com. admin.test.example.com. (
2024010101 ; Serial
3600 ; Refresh
1800 ; Retry
604800 ; Expire
86400 ; Minimum TTL
)
IN NS ns1.test.example.com.
IN NS ns2.test.example.com.
ns1 IN A 192.168.1.1
ns2 IN A 192.168.1.2
www IN A 192.168.1.100
EOF
CHECK_RESULT $? 0 0 "创建主区域文件失败"
# 步骤7配置从DNS服务器区域文件
LOG_INFO "步骤7配置从DNS服务器区域文件"
SLAVE_ZONE_FILE="$TEST_DIR/var/named/slave.test.example.com.zone"
cat > $SLAVE_ZONE_FILE << EOF
\$TTL 86400
@ IN SOA ns1.test.example.com. admin.test.example.com. (
2024010101 ; Serial
3600 ; Refresh
1800 ; Retry
604800 ; Expire
86400 ; Minimum TTL
)
IN NS ns1.test.example.com.
IN NS ns2.test.example.com.
EOF
CHECK_RESULT $? 0 0 "创建从区域文件失败"
# 步骤8配置named.conf文件
LOG_INFO "步骤8配置named.conf文件"
NAMED_CONF="$TEST_DIR/etc/named.conf"
cat > $NAMED_CONF << EOF
options {
directory "/var/named";
allow-transfer { any; };
};
zone "test.example.com" IN {
type master;
file "test.example.com.zone";
allow-transfer { any; };
};
zone "slave.test.example.com" IN {
type slave;
file "slave.test.example.com.zone";
masters { 127.0.0.1; };
};
EOF
CHECK_RESULT $? 0 0 "创建named.conf文件失败"
# 步骤9启动chroot环境下的BIND服务
LOG_INFO "步骤9启动chroot环境下的BIND服务"
named-chroot -u named -t $TEST_DIR -c $TEST_DIR/etc/named.conf
CHECK_RESULT $? 0 0 "启动chroot环境下的BIND服务失败"
# 等待服务启动
sleep 3
# 步骤10测试区域传输功能
LOG_INFO "步骤10测试区域传输功能"
# 尝试从主服务器传输区域数据到从服务器
dig @127.0.0.1 test.example.com AXFR > /tmp/zone_transfer_result.txt 2>&1
CHECK_RESULT $? 0 0 "区域传输失败"
# 步骤11验证区域传输结果
LOG_INFO "步骤11验证区域传输结果"
if grep -q "www.test.example.com" /tmp/zone_transfer_result.txt; then
LOG_INFO "区域传输成功,从服务器获取到正确的区域数据"
else
LOG_ERROR "区域传输失败,未获取到正确的区域数据"
CHECK_RESULT 1 0 0 "区域传输验证失败"
fi
# 步骤12停止BIND服务
LOG_INFO "步骤12停止BIND服务"
pkill -f "named-chroot.*$TEST_DIR" || true
sleep 2
# 步骤13清理测试环境
LOG_INFO "步骤13清理测试环境"
rm -rf $TEST_DIR
rm -f /tmp/zone_transfer_result.txt
# 步骤14卸载软件包如果测试前未安装
if [[ $IS_INSTALLED -eq 0 ]]; then
LOG_INFO "步骤14卸载$PACKAGE_NAME软件包"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载bind-chroot失败"
else
LOG_INFO "步骤14保持$PACKAGE_NAME安装状态"
fi
LOG_INFO "测试完成chroot环境下的BIND服务主从区域传输功能测试成功"
}
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-12-03
# @License : Mulan PSL v2
# @Desc : Test basic functionality of the package
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本test_maven-script-interpreter-help_function_basic
LOG_INFO "开始测试包的基本功能"
# 检查软件包是否已安装
LOG_INFO "检查软件包是否已安装"
if dnf list installed | grep -q "maven-script-interpreter-help"; then
LOG_INFO "软件包已安装,跳过安装步骤"
INSTALLED=true
else
LOG_INFO "软件包未安装,准备安装"
INSTALLED=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有该软件包"
if ! dnf list available | grep -q "maven-script-interpreter-help"; then
LOG_ERROR "yum源中未找到软件包maven-script-interpreter-help"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装软件包maven-script-interpreter-help"
dnf install -y maven-script-interpreter-help
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 测试基本功能
LOG_INFO "测试基本功能执行命令maven-script-interpreter-help --help"
maven-script-interpreter-help --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行命令maven-script-interpreter-help --help失败"
# 测试不支持参数的情况
LOG_INFO "测试不支持参数的情况执行命令maven-script-interpreter-help --invalid-arg"
maven-script-interpreter-help --invalid-arg > /dev/null 2>&1
if [ $? -ne 255 ]; then
LOG_ERROR "参数--invalid-arg未被正确处理"
exit 255
fi
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "清理环境卸载软件包maven-script-interpreter-help"
dnf remove -y maven-script-interpreter-help
CHECK_RESULT $? 0 0 "卸载软件包失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,56 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-19
# @License : Mulan PSL v2
# @Desc : Test displaying the help information
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:显示帮助信息"
LOG_INFO "步骤1检查是否已安装maven-script-interpreter软件包"
rpm -q maven-script-interpreter > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "maven-script-interpreter已安装测试后将保持安装状态"
INSTALLED=1
else
LOG_INFO "maven-script-interpreter未安装测试前将安装测试后将卸载"
INSTALLED=0
LOG_INFO "步骤2检查yum源中是否有maven-script-interpreter软件包"
dnf list available maven-script-interpreter > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中没有找到maven-script-interpreter软件包"
LOG_INFO "步骤3安装maven-script-interpreter软件包"
dnf install -y maven-script-interpreter > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装maven-script-interpreter失败"
fi
LOG_INFO "步骤4执行maven-script-interpreter命令并检查帮助信息"
maven-script-interpreter --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行maven-script-interpreter --help命令失败"
LOG_INFO "步骤5清理环境"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载maven-script-interpreter软件包"
dnf remove -y maven-script-interpreter > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载maven-script-interpreter失败"
else
LOG_INFO "保持maven-script-interpreter安装状态"
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 : 2026-03-11
# @License : Mulan PSL v2
# @Desc : Test scrypt password encryption
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本Test scrypt password encryption
LOG_INFO "1. 检查python3-scrypt软件包是否在yum源中"
dnf list available python3-scrypt 2>/dev/null | grep -q python3-scrypt
if [ $? -ne 0 ]; then
LOG_ERROR "python3-scrypt软件包不在yum源中"
exit 255
fi
LOG_INFO "2. 检查是否已安装python3-scrypt"
dnf list installed python3-scrypt 2>/dev/null | grep -q python3-scrypt
if [ $? -eq 0 ]; then
already_installed=1
LOG_INFO "python3-scrypt已安装"
else
already_installed=0
LOG_INFO "python3-scrypt未安装将进行安装"
fi
LOG_INFO "3. 如果未安装则安装python3-scrypt"
if [ $already_installed -eq 0 ]; then
dnf install -y python3-scrypt
CHECK_RESULT $? 0 0 "安装python3-scrypt失败"
fi
LOG_INFO "4. 验证scrypt命令行工具是否存在"
which scrypt 2>/dev/null
CHECK_RESULT $? 0 0 "scrypt命令不存在"
LOG_INFO "5. 测试scrypt命令的help参数"
scrypt --help 2>&1 | grep -q "usage:"
CHECK_RESULT $? 0 0 "scrypt命令不支持--help参数" 255
LOG_INFO "6. 测试scrypt命令的encrypt功能"
echo "testpassword" > test_input.txt
scrypt enc test_input.txt test_encrypted.txt 2>&1
CHECK_RESULT $? 0 0 "scrypt加密失败"
LOG_INFO "7. 测试scrypt命令的decrypt功能"
scrypt dec test_encrypted.txt test_decrypted.txt 2>&1
CHECK_RESULT $? 0 0 "scrypt解密失败"
LOG_INFO "8. 验证加密解密结果"
original_hash=$(md5sum test_input.txt | awk "{print $1}")
decrypted_hash=$(md5sum test_decrypted.txt | awk "{print $1}")
[ "$original_hash" = "$decrypted_hash" ]
CHECK_RESULT $? 0 0 "加密解密后数据不一致"
LOG_INFO "9. 清理测试文件"
rm -f test_input.txt test_encrypted.txt test_decrypted.txt
LOG_INFO "10. 环境恢复"
if [ $already_installed -eq 0 ]; then
LOG_INFO "卸载测试安装的python3-scrypt软件包"
dnf remove -y python3-scrypt
CHECK_RESULT $? 0 0 "卸载python3-scrypt失败"
else
LOG_INFO "保持python3-scrypt已安装状态"
fi
}
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-12
# @License : Mulan PSL v2
# @Desc : Test installation of python-scrypt-help
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test installation of python-scrypt-help"
# 检查yum源中是否存在python-scrypt-help软件包
LOG_INFO "检查yum源中是否存在python-scrypt-help软件包"
dnf list available python-scrypt-help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在python-scrypt-help软件包"
exit 255
fi
# 检查是否已安装python-scrypt-help
LOG_INFO "检查是否已安装python-scrypt-help"
rpm -q python-scrypt-help > /dev/null 2>&1
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "python-scrypt-help已安装"
else
installed=false
LOG_INFO "python-scrypt-help未安装将进行安装"
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装python-scrypt-help"
dnf install -y python-scrypt-help
CHECK_RESULT $? 0 0 "安装python-scrypt-help失败"
fi
# 测试python-scrypt-help的帮助命令
LOG_INFO "测试python-scrypt-help的帮助命令"
python-scrypt-help --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行python-scrypt-help --help失败"
# 清理环境
if [ "$installed" = false ]; then
LOG_INFO "卸载python-scrypt-help"
dnf remove -y python-scrypt-help
CHECK_RESULT $? 0 0 "卸载python-scrypt-help失败"
fi
LOG_INFO "测试完成Test installation of python-scrypt-help"
}
main "$@"

View File

@@ -1,94 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-11
# @License : Mulan PSL v2
# @Desc : Test scrypt password verification
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test scrypt password verification"
LOG_INFO "步骤1检查环境是否已安装python3-scrypt软件包"
rpm -q python3-scrypt
if [ $? -eq 0 ]; then
LOG_INFO "环境已安装python3-scrypt软件包测试结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "环境未安装python3-scrypt软件包将在测试步骤中安装"
INSTALLED=false
fi
LOG_INFO "步骤2检查yum源中是否存在python3-scrypt软件包"
dnf list available python3-scrypt
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-scrypt软件包"
exit 255
fi
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤3安装python3-scrypt软件包"
dnf install -y python3-scrypt
CHECK_RESULT $? 0 0 "安装python3-scrypt软件包失败"
fi
LOG_INFO "步骤4验证scrypt命令是否存在"
which scrypt
CHECK_RESULT $? 0 0 "scrypt命令不存在"
LOG_INFO "步骤5测试scrypt命令的help参数"
scrypt --help
if [ $? -ne 0 ]; then
LOG_ERROR "scrypt命令不支持--help参数"
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "清理环境卸载python3-scrypt软件包"
dnf remove -y python3-scrypt
fi
exit 255
fi
LOG_INFO "步骤6测试scrypt密码验证功能"
TEST_PASSWORD="testpassword123"
TEST_SALT="testsalt"
EXPECTED_HASH="$(echo -n "$TEST_PASSWORD" | scrypt enc -P -s "$TEST_SALT" 2>/dev/null)"
if [ -z "$EXPECTED_HASH" ]; then
LOG_ERROR "生成scrypt哈希失败"
CHECK_RESULT 1 0 0 "生成scrypt哈希失败"
fi
echo -n "$TEST_PASSWORD" | scrypt enc -P -s "$TEST_SALT" | scrypt dec -P -s "$TEST_SALT" 2>/dev/null
CHECK_RESULT $? 0 0 "scrypt密码验证失败"
LOG_INFO "步骤7测试多服务器场景如果配置了第二个服务器"
if [ -n "$NODE2_IPV4" ] && [ -n "$NODE2_PASSWORD" ] && [ -n "$NODE2_USER" ]; then
LOG_INFO "在第二个服务器上执行scrypt命令测试"
SSH_CMD "which scrypt" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER"
CHECK_RESULT $? 0 0 "第二个服务器上scrypt命令不存在"
else
LOG_INFO "未配置第二个服务器,跳过多服务器测试"
fi
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "步骤8清理环境卸载python3-scrypt软件包"
dnf remove -y python3-scrypt
CHECK_RESULT $? 0 0 "卸载python3-scrypt软件包失败"
else
LOG_INFO "环境已安装python3-scrypt软件包保持安装状态"
fi
LOG_INFO "测试完成Test scrypt password verification"
}
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-11-25
# @License : Mulan PSL v2
# @Desc : Basic functionality test
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# Basic functionality test for texlive-basque-book
LOG_INFO "开始测试texlive-basque-book的基本功能"
# 检查软件包是否已安装
if dnf list installed texlive-basque-book &>/dev/null; then
LOG_INFO "texlive-basque-book已安装测试后将保持安装状态"
installed=true
else
LOG_INFO "texlive-basque-book未安装测试后将卸载"
installed=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否存在texlive-basque-book"
if ! dnf list available texlive-basque-book &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-basque-book软件包"
exit 255
fi
# 安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装texlive-basque-book"
dnf install -y texlive-basque-book
CHECK_RESULT $? 0 0 "安装texlive-basque-book失败"
fi
# 测试基本功能
LOG_INFO "测试texlive-basque-book的基本功能"
texlive-basque-book --version
CHECK_RESULT $? 0 0 "texlive-basque-book版本检查失败"
# 测试不支持的命令参数
LOG_INFO "测试不支持的命令参数"
texlive-basque-book --invalid-arg 2>/dev/null
if [ $? -ne 255 ]; then
LOG_ERROR "不支持的命令参数未返回255退出码"
exit 255
fi
# 清理环境
if [ "$installed" = false ]; then
LOG_INFO "卸载texlive-basque-book"
dnf remove -y texlive-basque-book
CHECK_RESULT $? 0 0 "卸载texlive-basque-book失败"
fi
LOG_INFO "texlive-basque-book基本功能测试完成"
}
main "$@"

View File

@@ -1,114 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-02-25
# @License : Mulan PSL v2
# @Desc : Test accessing documentation content
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本Test accessing documentation content
# 定义软件包名称
PACKAGE_NAME="texlive-besjournals-doc"
# 步骤1检查yum源中是否存在指定的软件包
LOG_INFO "步骤1检查yum源中是否存在软件包 ${PACKAGE_NAME}"
dnf list available ${PACKAGE_NAME} &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 ${PACKAGE_NAME} 在yum源中不存在"
exit 255
fi
CHECK_RESULT $? 0 0 "检查软件包在yum源中是否存在失败"
# 步骤2检查当前环境是否已经安装了软件包
LOG_INFO "步骤2检查当前环境是否已经安装了软件包 ${PACKAGE_NAME}"
rpm -q ${PACKAGE_NAME} &>/dev/null
PACKAGE_INSTALLED=$?
if [ ${PACKAGE_INSTALLED} -eq 0 ]; then
LOG_INFO "软件包 ${PACKAGE_NAME} 已经安装,测试结束后将保持安装状态"
NEED_UNINSTALL=0
else
LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,将在测试结束后卸载"
NEED_UNINSTALL=1
fi
# 步骤3如果未安装则安装软件包
if [ ${NEED_UNINSTALL} -eq 1 ]; then
LOG_INFO "步骤3安装软件包 ${PACKAGE_NAME}"
dnf install -y ${PACKAGE_NAME} &>/dev/null
CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败"
fi
# 步骤4测试访问文档内容
LOG_INFO "步骤4测试访问文档内容"
# 检查文档目录是否存在
DOC_DIR="/usr/share/texlive/texmf-dist/doc/latex/besjournals"
if [ -d "${DOC_DIR}" ]; then
LOG_INFO "文档目录存在: ${DOC_DIR}"
# 检查目录下是否有文件
FILE_COUNT=$(find "${DOC_DIR}" -type f -name "*.pdf" -o -name "*.txt" -o -name "*.tex" 2>/dev/null | wc -l)
if [ ${FILE_COUNT} -gt 0 ]; then
LOG_INFO "文档目录中包含 ${FILE_COUNT} 个文档文件"
# 尝试读取一个文档文件如果有PDF文件优先检查PDF
SAMPLE_FILE=$(find "${DOC_DIR}" -type f -name "*.pdf" 2>/dev/null | head -1)
if [ -z "${SAMPLE_FILE}" ]; then
SAMPLE_FILE=$(find "${DOC_DIR}" -type f -name "*.txt" 2>/dev/null | head -1)
fi
if [ -z "${SAMPLE_FILE}" ]; then
SAMPLE_FILE=$(find "${DOC_DIR}" -type f -name "*.tex" 2>/dev/null | head -1)
fi
if [ -n "${SAMPLE_FILE}" ]; then
LOG_INFO "尝试读取文档文件: ${SAMPLE_FILE}"
if [ -r "${SAMPLE_FILE}" ]; then
LOG_INFO "文档文件可读"
# 如果是文本文件,尝试读取前几行
if [[ "${SAMPLE_FILE}" == *.txt ]] || [[ "${SAMPLE_FILE}" == *.tex ]]; then
head -5 "${SAMPLE_FILE}" &>/dev/null
CHECK_RESULT $? 0 0 "读取文档文件内容失败"
fi
else
LOG_ERROR "文档文件不可读: ${SAMPLE_FILE}"
exit 1
fi
else
LOG_ERROR "文档目录中未找到支持的文档文件格式"
exit 1
fi
else
LOG_ERROR "文档目录中未找到任何文档文件"
exit 1
fi
else
LOG_ERROR "文档目录不存在: ${DOC_DIR}"
exit 1
fi
# 步骤5环境恢复
LOG_INFO "步骤5环境恢复"
if [ ${NEED_UNINSTALL} -eq 1 ]; then
LOG_INFO "卸载测试安装的软件包 ${PACKAGE_NAME}"
dnf remove -y ${PACKAGE_NAME} &>/dev/null
CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败"
LOG_INFO "环境已恢复到测试前的状态"
else
LOG_INFO "保持软件包 ${PACKAGE_NAME} 的安装状态"
fi
LOG_INFO "测试完成:成功访问文档内容"
}
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-09-26
# @License : Mulan PSL v2
# @Desc : Test package installation
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-graphviz-doc软件包
LOG_INFO "检查是否已安装texlive-graphviz-doc软件包"
rpm -q texlive-graphviz-doc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-graphviz-doc已安装脚本结束时保持安装状态"
installed=true
else
installed=false
fi
# 检查yum源中是否有texlive-graphviz-doc软件包
LOG_INFO "检查yum源中是否有texlive-graphviz-doc软件包"
dnf list available texlive-graphviz-doc > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在texlive-graphviz-doc软件包"
# 安装texlive-graphviz-doc软件包
if [ "$installed" = false ]; then
LOG_INFO "开始安装texlive-graphviz-doc软件包"
dnf install -y texlive-graphviz-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-graphviz-doc软件包失败"
fi
# 验证texlive-graphviz-doc功能是否正常
LOG_INFO "验证texlive-graphviz-doc功能是否正常"
dot -V > /dev/null 2>&1
CHECK_RESULT $? 0 255 "texlive-graphviz-doc功能验证失败"
# 清理环境,如果脚本开始时未安装则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载texlive-graphviz-doc软件包"
dnf remove -y texlive-graphviz-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-graphviz-doc软件包失败"
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 : 2026-02-26
# @License : Mulan PSL v2
# @Desc : Test basic LaTeX document with package
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试基础LaTeX文档及包使用
LOG_INFO "1. 检查yum源中是否存在texlive-xassoccnt包"
dnf list available texlive-xassoccnt > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-xassoccnt包"
exit 255
fi
LOG_INFO "2. 检查texlive-xassoccnt是否已安装"
dnf list installed texlive-xassoccnt > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-xassoccnt已安装标记为已安装状态"
INSTALLED=true
else
LOG_INFO "texlive-xassoccnt未安装标记为未安装状态"
INSTALLED=false
fi
LOG_INFO "3. 如果未安装则安装texlive-xassoccnt包"
if [ "$INSTALLED" = "false" ]; then
dnf install -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "安装texlive-xassoccnt失败"
fi
LOG_INFO "4. 检查latex命令是否存在"
which latex > /dev/null 2>&1
CHECK_RESULT $? 0 0 "未找到latex命令"
LOG_INFO "5. 创建测试LaTeX文档"
cat > test_document.tex << "EOF"
\documentclass{article}
\usepackage{xassoccnt}
\NewTotalDocumentCounter{totpages}
\DeclareAssociatedCounters{page}{totpages}
\begin{document}
This is a test document.
\newpage
This is page 2.
\end{document}
EOF
CHECK_RESULT $? 0 0 "创建测试文档失败"
LOG_INFO "6. 使用latex编译测试文档"
latex -interaction=nonstopmode test_document.tex > /dev/null 2>&1
CHECK_RESULT $? 0 0 "latex编译失败"
LOG_INFO "7. 检查生成的DVI文件"
if [ -f "test_document.dvi" ]; then
LOG_INFO "DVI文件生成成功"
CHECK_RESULT $? 0 0 "DVI文件生成失败"
else
LOG_ERROR "DVI文件未生成"
exit 1
fi
LOG_INFO "8. 检查生成的辅助文件"
if [ -f "test_document.aux" ]; then
LOG_INFO "辅助文件生成成功"
CHECK_RESULT $? 0 0 "辅助文件生成失败"
else
LOG_ERROR "辅助文件未生成"
exit 1
fi
LOG_INFO "9. 清理生成的中间文件"
rm -f test_document.aux test_document.log test_document.dvi test_document.tex
LOG_INFO "10. 环境恢复:如果测试前未安装,则卸载软件包"
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "卸载texlive-xassoccnt包"
dnf remove -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "卸载texlive-xassoccnt失败"
else
LOG_INFO "保持texlive-xassoccnt安装状态"
fi
LOG_INFO "11. 测试完成"
}
main "$@"

View File

@@ -1,97 +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-26
# @License : Mulan PSL v2
# @Desc : Test if documentation files exist
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试文档文件是否存在
LOG_INFO "开始测试检查texlive-xassoccnt软件包文档文件是否存在"
# 检查软件包是否已在yum源中
LOG_INFO "步骤1检查yum源中是否存在texlive-xassoccnt软件包"
dnf list texlive-xassoccnt > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在texlive-xassoccnt软件包"
exit 255
fi
# 检查软件包是否已安装
LOG_INFO "步骤2检查texlive-xassoccnt软件包是否已安装"
rpm -q texlive-xassoccnt > /dev/null 2>&1
package_installed=$?
# 记录初始安装状态
if [ $package_installed -eq 0 ]; then
LOG_INFO "texlive-xassoccnt软件包已安装测试后保持安装状态"
was_installed=true
else
LOG_INFO "texlive-xassoccnt软件包未安装将在测试后卸载"
was_installed=false
fi
# 如果未安装,则安装软件包
if [ "$was_installed" = "false" ]; then
LOG_INFO "步骤3安装texlive-xassoccnt软件包"
dnf install -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "安装texlive-xassoccnt软件包失败"
fi
# 检查文档文件是否存在
LOG_INFO "步骤4检查texlive-xassoccnt文档文件是否存在"
rpm -ql texlive-xassoccnt | grep -E "\.pdf$|\.html$|\.txt$|README|LICENSE" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "texlive-xassoccnt软件包文档文件不存在"
# 验证特定文档文件是否存在
LOG_INFO "步骤5验证特定文档文件路径是否存在"
doc_files=$(rpm -ql texlive-xassoccnt | grep -E "/doc/|/usr/share/doc/" | head -5)
if [ -z "$doc_files" ]; then
LOG_ERROR "未找到texlive-xassoccnt文档文件"
exit 1
fi
# 检查文档文件是否可访问
LOG_INFO "步骤6检查文档文件是否可访问"
for doc_file in $doc_files; do
if [ -f "$doc_file" ]; then
LOG_INFO "文档文件存在:$doc_file"
# 检查文件是否可读
if [ -r "$doc_file" ]; then
LOG_INFO "文档文件可读:$doc_file"
else
LOG_ERROR "文档文件不可读:$doc_file"
exit 1
fi
fi
done
# 环境清理:如果测试前未安装,则卸载软件包
if [ "$was_installed" = "false" ]; then
LOG_INFO "步骤7清理环境卸载texlive-xassoccnt软件包"
dnf remove -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "卸载texlive-xassoccnt软件包失败"
LOG_INFO "环境已恢复到测试前状态"
else
LOG_INFO "步骤7保持texlive-xassoccnt软件包安装状态"
fi
LOG_INFO "测试完成texlive-xassoccnt文档文件存在性测试通过"
}
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-11-26
# @License : Mulan PSL v2
# @Desc : Test counter functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-xassoccnt
LOG_INFO "检查是否已安装texlive-xassoccnt"
rpm -q texlive-xassoccnt > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-xassoccnt已安装脚本结束时保持安装状态"
installed=true
else
LOG_INFO "texlive-xassoccnt未安装将在测试结束后卸载"
installed=false
fi
# 检查yum源中是否有texlive-xassoccnt
LOG_INFO "检查yum源中是否有texlive-xassoccnt"
dnf list available texlive-xassoccnt > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-xassoccnt软件包"
exit 255
fi
# 安装texlive-xassoccnt
LOG_INFO "安装texlive-xassoccnt"
dnf install -y texlive-xassoccnt > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-xassoccnt失败"
# 测试counter功能
LOG_INFO "测试counter功能"
echo "\documentclass{article}
\usepackage{xassoccnt}
\DeclareTotalCounter{testcounter}
\begin{document}
\TotalValue{testcounter}
\end{document}" > test.tex
pdflatex test.tex > /dev/null 2>&1
CHECK_RESULT $? 0 0 "测试counter功能失败"
# 清理测试文件
rm -f test.tex test.aux test.log test.pdf > /dev/null 2>&1
# 如果初始未安装则卸载texlive-xassoccnt
if [ "$installed" = false ]; then
LOG_INFO "卸载texlive-xassoccnt"
dnf remove -y texlive-xassoccnt > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-xassoccnt失败"
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-02-26
# @License : Mulan PSL v2
# @Desc : Test compatibility with hyperref
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已经安装了texlive-xassoccnt-hyperref软件包
LOG_INFO "检查是否已经安装texlive-xassoccnt-hyperref软件包"
if dnf list installed texlive-xassoccnt-hyperref &>/dev/null; then
LOG_INFO "texlive-xassoccnt-hyperref已经安装脚本结束后将保持安装状态"
already_installed=true
else
LOG_INFO "texlive-xassoccnt-hyperref未安装将在测试过程中安装"
already_installed=false
fi
# 检查yum源中是否有texlive-xassoccnt-hyperref软件包
LOG_INFO "检查yum源中是否有texlive-xassoccnt-hyperref软件包"
if ! dnf list available texlive-xassoccnt-hyperref &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-xassoccnt-hyperref软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$already_installed" = false ]; then
LOG_INFO "安装texlive-xassoccnt-hyperref软件包"
dnf install -y texlive-xassoccnt-hyperref
CHECK_RESULT $? 0 0 "安装texlive-xassoccnt-hyperref失败"
fi
# 测试兼容性检查hyperref宏包是否正常工作
LOG_INFO "测试texlive-xassoccnt-hyperref与hyperref的兼容性"
# 创建一个简单的LaTeX测试文件
cat > test_hyperref.tex << "EOF"
\documentclass{article}
\usepackage{hyperref}
\usepackage{xassoccnt}
\NewCounterDocument{testcounter}
\begin{document}
测试文档
\end{document}
EOF
# 尝试编译测试文档
LOG_INFO "编译测试LaTeX文档"
pdflatex -interaction=nonstopmode test_hyperref.tex
CHECK_RESULT $? 0 0 "编译测试文档失败,兼容性测试未通过"
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_hyperref.tex test_hyperref.aux test_hyperref.log test_hyperref.pdf
# 如果之前未安装,则在测试结束后卸载软件包
if [ "$already_installed" = false ]; then
LOG_INFO "卸载texlive-xassoccnt-hyperref软件包"
dnf remove -y texlive-xassoccnt-hyperref
CHECK_RESULT $? 0 0 "卸载texlive-xassoccnt-hyperref失败"
else
LOG_INFO "保持texlive-xassoccnt-hyperref的安装状态"
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 : 2026-02-26
# @License : Mulan PSL v2
# @Desc : Test counter reset rules
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test counter reset rules"
# 检查是否已安装texlive-xassoccnt软件包
LOG_INFO "步骤1检查texlive-xassoccnt软件包是否已安装"
if rpm -q texlive-xassoccnt &> /dev/null; then
LOG_INFO "texlive-xassoccnt已安装测试结束后将保持安装状态"
INSTALLED=1
else
LOG_INFO "texlive-xassoccnt未安装将在测试过程中安装并在结束后卸载"
INSTALLED=0
fi
# 检查yum源中是否有texlive-xassoccnt软件包
LOG_INFO "步骤2检查yum源中是否存在texlive-xassoccnt软件包"
if ! dnf list available texlive-xassoccnt &> /dev/null; then
LOG_ERROR "yum源中未找到texlive-xassoccnt软件包"
exit 255
fi
# 安装texlive-xassoccnt软件包如果未安装
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤3安装texlive-xassoccnt软件包"
dnf install -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "安装texlive-xassoccnt软件包失败"
fi
# 测试texlive-xassoccnt的counter reset规则功能
LOG_INFO "步骤4测试counter reset规则功能"
# 假设测试命令为texlive-xassoccnt --test-reset-rule
# 检查命令参数是否存在
if ! texlive-xassoccnt --help | grep -q "test-reset-rule"; then
LOG_ERROR "texlive-xassoccnt不支持--test-reset-rule参数"
exit 255
fi
# 执行测试命令
texlive-xassoccnt --test-reset-rule
CHECK_RESULT $? 0 0 "counter reset规则测试失败"
# 清理环境:如果之前未安装,则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤5卸载texlive-xassoccnt软件包"
dnf remove -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "卸载texlive-xassoccnt软件包失败"
fi
LOG_INFO "测试完成Test counter reset rules"
}
main "$@"

View File

@@ -1,104 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-02-26
# @License : Mulan PSL v2
# @Desc : Test shared counter functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试共享计数器功能"
# 检查软件包是否在yum源中
LOG_INFO "检查texlive-xassoccnt软件包是否在yum源中"
dnf list available texlive-xassoccnt >/dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在texlive-xassoccnt软件包"
exit 255
fi
# 检查当前是否已安装
LOG_INFO "检查当前是否已安装texlive-xassoccnt"
rpm -q texlive-xassoccnt >/dev/null 2>&1
already_installed=$?
if [ $already_installed -eq 0 ]; then
LOG_INFO "检测到texlive-xassoccnt已安装测试后保持安装状态"
need_uninstall=0
else
LOG_INFO "未安装texlive-xassoccnt将进行安装测试"
need_uninstall=1
# 安装软件包
LOG_INFO "安装texlive-xassoccnt软件包"
dnf install -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "安装texlive-xassoccnt失败"
fi
# 检查命令参数支持
LOG_INFO "检查共享计数器功能命令"
# 假设测试共享计数器功能的具体命令是xassoccnt-test
if ! command -v xassoccnt-test >/dev/null 2>&1; then
LOG_ERROR "xassoccnt-test命令不存在"
if [ $need_uninstall -eq 1 ]; then
dnf remove -y texlive-xassoccnt
fi
exit 255
fi
# 检查命令参数
LOG_INFO "检查xassoccnt-test命令参数支持"
xassoccnt-test --help >/dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "xassoccnt-test命令不支持--help参数"
if [ $need_uninstall -eq 1 ]; then
dnf remove -y texlive-xassoccnt
fi
exit 255
fi
# 执行共享计数器功能测试
LOG_INFO "执行共享计数器基本功能测试"
xassoccnt-test --version
CHECK_RESULT $? 0 0 "共享计数器版本检查失败"
LOG_INFO "执行共享计数器计数测试"
# 这里假设xassoccnt-test有--test-count参数进行计数测试
xassoccnt-test --test-count
CHECK_RESULT $? 0 0 "共享计数器计数功能测试失败"
# 多服务器场景测试(如果需要)
LOG_INFO "检查是否需要多服务器测试"
if [ -n "$NODE2_IPV4" ] && [ -n "$NODE2_PASSWORD" ] && [ -n "$NODE2_USER" ]; then
LOG_INFO "在第二个服务器上测试共享计数器功能"
SSH_CMD "xassoccnt-test --version" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER"
CHECK_RESULT $? 0 0 "第二个服务器共享计数器测试失败"
fi
# 环境清理
LOG_INFO "清理测试环境"
if [ $need_uninstall -eq 1 ]; then
LOG_INFO "卸载测试安装的texlive-xassoccnt软件包"
dnf remove -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "卸载texlive-xassoccnt失败"
else
LOG_INFO "保持原有安装状态不卸载texlive-xassoccnt"
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 : 2026-02-26
# @License : Mulan PSL v2
# @Desc : Test checking package version info
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-xassoccnt包
LOG_INFO "检查是否已安装texlive-xassoccnt包"
rpm -q texlive-xassoccnt > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "检测到texlive-xassoccnt已安装脚本结束后将保持安装状态"
INSTALLED_BEFORE=1
else
LOG_INFO "未检测到texlive-xassoccnt安装将执行安装测试"
INSTALLED_BEFORE=0
fi
# 检查yum源中是否存在texlive-xassoccnt包
LOG_INFO "检查yum源中是否存在texlive-xassoccnt包"
dnf list available texlive-xassoccnt > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中不存在texlive-xassoccnt包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在texlive-xassoccnt包"
exit 255
fi
# 如果未安装则安装texlive-xassoccnt包
if [ $INSTALLED_BEFORE -eq 0 ]; then
LOG_INFO "安装texlive-xassoccnt包"
dnf install -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "安装texlive-xassoccnt包失败"
fi
# 测试检查包版本信息
LOG_INFO "执行测试检查texlive-xassoccnt包版本信息"
rpm -q texlive-xassoccnt --qf "%{VERSION}-%{RELEASE}\n"
CHECK_RESULT $? 0 0 "获取texlive-xassoccnt包版本信息失败"
# 清理环境如果之前未安装则卸载texlive-xassoccnt包
if [ $INSTALLED_BEFORE -eq 0 ]; then
LOG_INFO "清理环境卸载texlive-xassoccnt包"
dnf remove -y texlive-xassoccnt
CHECK_RESULT $? 0 0 "卸载texlive-xassoccnt包失败"
fi
LOG_INFO "测试完成"
}
main "$@"