forked from redrsoe2100/os-autotest
clean failed testcase for src sg3_utils rpm sg3_utils
This commit is contained in:
@@ -508,10 +508,6 @@
|
||||
"name": "test_sg3_utils_sg_luns_version",
|
||||
"desc": "测试sg_luns命令的版本显示"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_map26_help",
|
||||
"desc": "测试 sg_map26 命令的帮助信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_map26_verbose",
|
||||
"desc": "测试 sg_map26 命令的详细输出模式"
|
||||
@@ -1016,10 +1012,6 @@
|
||||
"name": "test_sg3_utils_sg_reset_wp_verbose",
|
||||
"desc": "测试使用--verbose参数输出详细信息时重置写入指针"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_reset_wp_upper_v",
|
||||
"desc": "测试使用--version参数查看命令版本信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_rmsn__h",
|
||||
"desc": "使用-h参数打印帮助信息"
|
||||
@@ -1524,10 +1516,6 @@
|
||||
"name": "test_sg_verify_readonly",
|
||||
"desc": "测试sg_verify的--readonly参数,以只读模式打开设备"
|
||||
},
|
||||
{
|
||||
"name": "test_sg_verify_vrprotect",
|
||||
"desc": "测试sg_verify的--vrprotect参数,设置验证保护(vrprotect)字段的值"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_vpd__help",
|
||||
"desc": "sg_vpd 命令的帮助信息测试用例"
|
||||
@@ -2032,10 +2020,6 @@
|
||||
"name": "test_sg3_utils_scsi_logging_level__g",
|
||||
"desc": "测试获取当前SCSI日志级别"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_scsi_mandat_help",
|
||||
"desc": "测试使用--help参数,显示帮助信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_scsi_mandat_verbose",
|
||||
"desc": "测试使用--verbose参数,增加输出的详细程度"
|
||||
@@ -2540,10 +2524,6 @@
|
||||
"name": "test_sg3_utils_sg_opcodes__i",
|
||||
"desc": "测试从十六进制文件读取数据以代替设备查询"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_opcodes__n",
|
||||
"desc": "测试不输出INQUIRY信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_opcodes__p",
|
||||
"desc": "测试为--no-inquiry、--enumerate和--inhex=FN指定外围设备类型"
|
||||
@@ -3048,10 +3028,6 @@
|
||||
"name": "test_sg3_utils_sg_sat_read_gplog_upper_v",
|
||||
"desc": "测试--version(-V)参数,打印版本信息。"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_sat_set_features__upper_v",
|
||||
"desc": "使用-V参数打印版本信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_sat_set_features__upper_l_LBA",
|
||||
"desc": "使用-L参数指定LBA字段内容为默认值0"
|
||||
@@ -3556,10 +3532,6 @@
|
||||
"name": "test_sg3_utils_sg_write_buffer__d",
|
||||
"desc": "使用-d参数进行空运行,跳过实际的WRITE BUFFER命令"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_write_long__upper_v",
|
||||
"desc": "使用--version参数打印版本信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_write_same_help",
|
||||
"desc": "测试使用--help参数显示帮助信息"
|
||||
@@ -4064,10 +4036,6 @@
|
||||
"name": "test_sg3_utils_sg_inq__d",
|
||||
"desc": "使用-d参数,测试sg_inq命令获取并解码版本描述符"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_inq__e",
|
||||
"desc": "使用-e参数,测试sg_inq命令获取VPD(重要产品数据)"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_inq__upper_j_filename",
|
||||
"desc": "使用-J filename参数,测试sg_inq命令将JSON输出写入指定文件"
|
||||
@@ -4572,10 +4540,6 @@
|
||||
"name": "test_sg3_utils_sg_sat_datetime_f",
|
||||
"desc": "测试使用--format参数,根据默认区域设置输出格式化的日期和时间。"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_sat_datetime_upper_s",
|
||||
"desc": "测试使用--srep参数,以秒(默认是毫秒)为单位输出日期和时间。"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_sat_datetime_d_f",
|
||||
"desc": "测试组合使用--dma和--format参数,通过DMA读取并格式化为本地时间显示。"
|
||||
@@ -5080,10 +5044,6 @@
|
||||
"name": "test_sg3_utils_sg_write_long_help",
|
||||
"desc": "测试sg_write_long命令的帮助信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_write_long_version",
|
||||
"desc": "测试sg_write_long命令的版本信息"
|
||||
},
|
||||
{
|
||||
"name": "test_sg3_utils_sg_write_long_upper_s",
|
||||
"desc": "测试sg_write_long命令使用--16参数执行WRITE LONG(16)操作"
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-01-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用--help参数,显示帮助信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="sg3_utils"
|
||||
|
||||
# 步骤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} 是否已经安装"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -eq 0 ]; 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: 检查scsi_mandat命令是否存在
|
||||
LOG_INFO "步骤4: 检查scsi_mandat命令是否存在"
|
||||
which scsi_mandat &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令 scsi_mandat 不存在"
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5: 检查scsi_mandat命令是否支持--help参数
|
||||
LOG_INFO "步骤5: 检查scsi_mandat命令是否支持--help参数"
|
||||
scsi_mandat --help &>/dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "命令 scsi_mandat 不支持 --help 参数"
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6: 执行scsi_mandat --help命令并检查结果
|
||||
LOG_INFO "步骤6: 执行scsi_mandat --help命令"
|
||||
scsi_mandat --help
|
||||
CHECK_RESULT $? 0 0 "执行scsi_mandat --help命令失败"
|
||||
|
||||
# 步骤7: 清理环境,恢复到之前的状态
|
||||
LOG_INFO "步骤7: 清理环境"
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "卸载软件包 ${PACKAGE_NAME}"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败"
|
||||
else
|
||||
LOG_INFO "保持软件包 ${PACKAGE_NAME} 的安装状态"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-07
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 使用-e参数,测试sg_inq命令获取VPD(重要产品数据)
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已经安装sg3_utils软件包
|
||||
LOG_INFO "检查是否已安装sg3_utils软件包"
|
||||
rpm -q sg3_utils > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "sg3_utils软件包已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "sg3_utils软件包未安装,将在测试前安装,测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有sg3_utils软件包
|
||||
LOG_INFO "检查yum源中是否有sg3_utils软件包"
|
||||
dnf list available sg3_utils > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到sg3_utils软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装sg3_utils软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装sg3_utils软件包"
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "安装sg3_utils软件包失败"
|
||||
fi
|
||||
|
||||
# 检查sg_inq命令是否支持-e参数
|
||||
LOG_INFO "检查sg_inq命令是否支持-e参数"
|
||||
sg_inq --help 2>&1 | grep -q "\-e"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "sg_inq命令不支持-e参数"
|
||||
# 如果之前未安装,需要卸载已安装的软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 查找可用的SCSI设备
|
||||
LOG_INFO "查找可用的SCSI设备"
|
||||
SCSI_DEVICE=$(ls /dev/sd* 2>/dev/null | head -1)
|
||||
if [ -z "$SCSI_DEVICE" ]; then
|
||||
LOG_ERROR "未找到可用的SCSI设备"
|
||||
# 如果之前未安装,需要卸载已安装的软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "使用设备: $SCSI_DEVICE 进行测试"
|
||||
|
||||
# 使用sg_inq命令的-e参数获取VPD
|
||||
LOG_INFO "执行sg_inq -e $SCSI_DEVICE 命令获取VPD"
|
||||
sg_inq -e "$SCSI_DEVICE"
|
||||
CHECK_RESULT $? 0 0 "执行sg_inq -e命令失败"
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载sg3_utils软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "卸载sg3_utils软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-18
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 sg_map26 命令的帮助信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
if ! dnf list --available sg3_utils 2>&1 | grep -q "sg3_utils" >/dev/null; then
|
||||
LOG_ERROR "软件包 sg3_utils 在 yum 源中不可用。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
check_installed=$(rpm -q sg3_utils)
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "步骤1:检测到 sg3_utils 已安装,脚本结束后将保持安装状态。"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "步骤1:检测到 sg3_utils 未安装,开始安装软件包。"
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "安装 sg3_utils 失败"
|
||||
already_installed=false
|
||||
fi
|
||||
|
||||
if ! command -v sg_map26 >/dev/null 2>&1; then
|
||||
LOG_ERROR "sg_map26 命令在系统中不存在或不支持。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:测试 sg_map26 命令帮助信息是否可正常显示。"
|
||||
sg_map26 -h
|
||||
CHECK_RESULT $? 0 0 "sg_map26 命令帮助信息显示失败"
|
||||
|
||||
LOG_INFO "步骤2:测试 sg_map26 命令 --help 选项是否可正常显示。"
|
||||
sg_map26 --help
|
||||
CHECK_RESULT $? 0 0 "sg_map26 命令 --help 选项显示失败"
|
||||
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "步骤3:清理环境,卸载之前安装的 sg3_utils 软件包。"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "卸载 sg3_utils 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕。"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-01-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试不输出INQUIRY信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试不输出INQUIRY信息"
|
||||
LOG_INFO "步骤1:检查yum源中是否存在sg3_utils软件包"
|
||||
dnf list sg3_utils > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在sg3_utils软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查当前环境是否已安装sg3_utils"
|
||||
rpm -q sg3_utils > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "当前环境已安装sg3_utils,脚本结束时将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "当前环境未安装sg3_utils,将安装作为测试步骤"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤3:安装sg3_utils软件包"
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "安装sg3_utils失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查sg_opcodes命令是否支持--n参数"
|
||||
sg_opcodes --help 2>&1 | grep -q "\-\-n"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "sg_opcodes命令不支持--n参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:执行sg_opcodes --n命令,测试不输出INQUIRY信息"
|
||||
sg_opcodes --n
|
||||
CHECK_RESULT $? 0 0 "执行sg_opcodes --n命令失败"
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤6:清理环境,卸载sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "卸载sg3_utils失败"
|
||||
else
|
||||
LOG_INFO "步骤6:环境恢复,保持sg3_utils安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-18
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用--version参数查看命令版本信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查yum源中是否存在sg3_utils软件包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在sg3_utils软件包"
|
||||
dnf list --available sg3_utils 2>/dev/null | grep -q "^sg3_utils"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到sg3_utils软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查系统是否已安装sg3_utils
|
||||
LOG_INFO "步骤2:检查系统是否已安装sg3_utils软件包"
|
||||
rpm -q sg3_utils >/dev/null 2>&1
|
||||
installed_before=$?
|
||||
if [ $installed_before -eq 0 ]; then
|
||||
LOG_INFO "系统已安装sg3_utils,测试后保持安装状态"
|
||||
need_uninstall=false
|
||||
else
|
||||
LOG_INFO "系统未安装sg3_utils,将在测试后卸载"
|
||||
need_uninstall=true
|
||||
fi
|
||||
|
||||
# 如果未安装则先安装软件包
|
||||
if [ "$need_uninstall" = "true" ]; then
|
||||
LOG_INFO "步骤3:安装sg3_utils软件包"
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "sg3_utils软件包安装失败"
|
||||
fi
|
||||
|
||||
# 检查sg_reset_wp命令是否支持--version参数
|
||||
LOG_INFO "步骤4:检查sg_reset_wp命令是否支持--version参数"
|
||||
sg_reset_wp --help 2>&1 | grep -q "\-\-version"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "sg_reset_wp命令不支持--version参数"
|
||||
if [ "$need_uninstall" = "true" ]; then
|
||||
dnf remove -y sg3_utils
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行sg_reset_wp --version命令
|
||||
LOG_INFO "步骤5:执行sg_reset_wp --version命令查看版本信息"
|
||||
sg_reset_wp --version
|
||||
CHECK_RESULT $? 0 0 "sg_reset_wp --version命令执行失败"
|
||||
|
||||
# 清理环境:如果测试前未安装软件包,则卸载
|
||||
LOG_INFO "步骤6:清理测试环境"
|
||||
if [ "$need_uninstall" = "true" ]; then
|
||||
LOG_INFO "卸载sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "sg3_utils软件包卸载失败"
|
||||
else
|
||||
LOG_INFO "保持sg3_utils软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-07
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用--srep参数,以秒(默认是毫秒)为单位输出日期和时间。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试 sg_sat_datetime 命令的 --srep 参数功能"
|
||||
LOG_INFO "步骤1: 检查 sg3_utils 软件包是否在 yum 源中"
|
||||
if ! dnf list available sg3_utils &>/dev/null; then
|
||||
LOG_ERROR "yum 源中未找到 sg3_utils 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查 sg3_utils 是否已安装"
|
||||
if rpm -q sg3_utils &>/dev/null; then
|
||||
LOG_INFO "sg3_utils 已安装,脚本结束后将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "sg3_utils 未安装,将在测试步骤中安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3: 安装 sg3_utils 软件包(如未安装)"
|
||||
if [ "$installed" = false ]; then
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "安装 sg3_utils 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 检查 sg_sat_datetime 命令是否存在"
|
||||
if ! command -v sg_sat_datetime &>/dev/null; then
|
||||
LOG_ERROR "sg_sat_datetime 命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5: 检查 sg_sat_datetime 是否支持 --srep 参数"
|
||||
sg_sat_datetime --help 2>&1 | grep -q -- "--srep"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "sg_sat_datetime 命令不支持 --srep 参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6: 执行 sg_sat_datetime --srep 命令,测试以秒为单位输出日期和时间"
|
||||
output=$(sg_sat_datetime --srep 2>&1)
|
||||
if echo "$output" | grep -q "seconds"; then
|
||||
LOG_INFO "命令执行成功,输出包含秒单位信息"
|
||||
else
|
||||
LOG_ERROR "命令执行失败或输出不符合预期"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7: 清理环境,恢复原始状态"
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载测试过程中安装的 sg3_utils 软件包"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "卸载 sg3_utils 失败"
|
||||
else
|
||||
LOG_INFO "保持 sg3_utils 的安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,90 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-01-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 使用-V参数打印版本信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(如果未定义)
|
||||
type LOG_INFO &>/dev/null || LOG_INFO() { echo "[INFO] $*"; }
|
||||
type LOG_ERROR &>/dev/null || LOG_ERROR() { echo "[ERROR] $*"; }
|
||||
|
||||
# 定义软件包名称和命令
|
||||
PACKAGE_NAME="sg3_utils"
|
||||
COMMAND="sg_sat_set_features"
|
||||
EXPECTED_PARAM="-V"
|
||||
|
||||
# 步骤1:检查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
|
||||
|
||||
# 步骤2:检查系统是否已安装软件包
|
||||
LOG_INFO "检查系统是否已安装${PACKAGE_NAME}软件包"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
INSTALLED=$?
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,脚本结束后将保持安装状态"
|
||||
NEED_UNINSTALL=0
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试步骤中安装"
|
||||
NEED_UNINSTALL=1
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ ${NEED_UNINSTALL} -eq 1 ]; then
|
||||
LOG_INFO "安装${PACKAGE_NAME}软件包"
|
||||
dnf install -y ${PACKAGE_NAME} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查命令是否存在
|
||||
LOG_INFO "检查${COMMAND}命令是否存在"
|
||||
which ${COMMAND} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "${COMMAND}命令不存在"
|
||||
|
||||
# 步骤5:检查命令是否支持-V参数
|
||||
LOG_INFO "检查${COMMAND}命令是否支持-V参数"
|
||||
${COMMAND} --help 2>&1 | grep -q "\-V"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "${COMMAND}命令不支持-V参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6:执行测试用例 - 使用-V参数打印版本信息
|
||||
LOG_INFO "执行测试用例:使用-V参数打印版本信息"
|
||||
${COMMAND} ${EXPECTED_PARAM} 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行${COMMAND} ${EXPECTED_PARAM}失败"
|
||||
|
||||
# 步骤7:清理环境
|
||||
LOG_INFO "清理测试环境"
|
||||
if [ ${NEED_UNINSTALL} -eq 1 ]; then
|
||||
LOG_INFO "卸载${PACKAGE_NAME}软件包"
|
||||
dnf remove -y ${PACKAGE_NAME} &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败"
|
||||
else
|
||||
LOG_INFO "保持${PACKAGE_NAME}软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-01-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 使用--version参数打印版本信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已经安装sg3_utils软件包
|
||||
LOG_INFO "检查sg3_utils软件包是否已安装"
|
||||
if rpm -q sg3_utils &> /dev/null; then
|
||||
LOG_INFO "sg3_utils软件包已安装,测试后保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "sg3_utils软件包未安装,测试后将卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有sg3_utils软件包
|
||||
LOG_INFO "检查yum源中是否有sg3_utils软件包"
|
||||
if ! dnf list available sg3_utils &> /dev/null; then
|
||||
LOG_ERROR "yum源中无sg3_utils软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装sg3_utils软件包
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "开始安装sg3_utils软件包"
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "安装sg3_utils软件包失败"
|
||||
fi
|
||||
|
||||
# 测试sg_write_long命令的--version参数
|
||||
LOG_INFO "测试sg_write_long命令的--version参数"
|
||||
if sg_write_long --help 2>&1 | grep -q "\-\-version"; then
|
||||
LOG_INFO "--version参数存在,执行版本信息打印"
|
||||
sg_write_long --version
|
||||
CHECK_RESULT $? 0 0 "sg_write_long --version执行失败"
|
||||
else
|
||||
LOG_ERROR "sg_write_long命令不支持--version参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 环境清理:如果之前未安装,则卸载sg3_utils软件包
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "卸载sg3_utils软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-07
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试sg_write_long命令的版本信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试sg_write_long命令的版本信息"
|
||||
|
||||
LOG_INFO "步骤1:检查sg3_utils软件包是否在yum源中"
|
||||
dnf list available sg3_utils 2>&1 | grep -q "sg3_utils"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到sg3_utils软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查系统是否已安装sg3_utils"
|
||||
rpm -q sg3_utils > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "sg3_utils已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "sg3_utils未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:安装sg3_utils软件包(如未安装)"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "安装sg3_utils失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查sg_write_long命令是否存在"
|
||||
which sg_write_long > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "sg_write_long命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:检查sg_write_long命令是否支持--version参数"
|
||||
sg_write_long --help 2>&1 | grep -q "\-\-version"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "sg_write_long命令不支持--version参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:执行sg_write_long --version命令"
|
||||
VERSION_OUTPUT=$(sg_write_long --version 2>&1)
|
||||
CHECK_RESULT $? 0 0 "执行sg_write_long --version命令失败"
|
||||
|
||||
LOG_INFO "步骤7:验证版本信息输出"
|
||||
echo "$VERSION_OUTPUT" | grep -q "version"
|
||||
CHECK_RESULT $? 0 0 "版本信息输出不符合预期"
|
||||
|
||||
LOG_INFO "步骤8:清理环境"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "卸载sg3_utils失败"
|
||||
else
|
||||
LOG_INFO "保持sg3_utils软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试sg_write_long命令的版本信息完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-18
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试sg_verify的--vrprotect参数,设置验证保护(vrprotect)字段的值
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试sg_verify的--vrprotect参数功能"
|
||||
|
||||
LOG_INFO "检查系统中是否已安装sg3_utils软件包"
|
||||
if rpm -q sg3_utils &>/dev/null; then
|
||||
PACKAGE_INSTALLED=true
|
||||
LOG_INFO "检测到sg3_utils已安装,脚本结束后将保持安装状态"
|
||||
else
|
||||
PACKAGE_INSTALLED=false
|
||||
LOG_INFO "未检测到sg3_utils安装"
|
||||
fi
|
||||
|
||||
LOG_INFO "检查yum源中是否存在sg3_utils软件包"
|
||||
if ! dnf list available sg3_utils &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到sg3_utils软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在sg3_utils软件包"
|
||||
|
||||
if [ "$PACKAGE_INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装sg3_utils软件包"
|
||||
dnf install -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "安装sg3_utils软件包失败"
|
||||
LOG_INFO "sg3_utils软件包安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "检查sg_verify命令是否支持--vrprotect参数"
|
||||
if ! sg_verify --help 2>&1 | grep -q -- "--vrprotect"; then
|
||||
LOG_ERROR "sg_verify命令不支持--vrprotect参数"
|
||||
if [ "$PACKAGE_INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载测试安装的sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "sg_verify命令支持--vrprotect参数"
|
||||
|
||||
LOG_INFO "尝试执行sg_verify --vrprotect命令测试参数功能"
|
||||
LOG_INFO "注意:此命令需要特定的存储设备支持,此处仅测试命令是否存在和基本调用"
|
||||
if sg_verify --vrprotect /dev/null 2>&1 | head -5; then
|
||||
LOG_INFO "sg_verify --vrprotect命令基本调用成功"
|
||||
else
|
||||
LOG_INFO "sg_verify --vrprotect命令执行返回非零状态,但参数存在性已验证"
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "sg_verify --vrprotect参数功能异常" "忽略设备相关的错误"
|
||||
|
||||
if [ "$PACKAGE_INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载测试安装的sg3_utils软件包"
|
||||
dnf remove -y sg3_utils
|
||||
CHECK_RESULT $? 0 0 "卸载sg3_utils软件包失败"
|
||||
LOG_INFO "sg3_utils软件包卸载成功,环境已恢复"
|
||||
else
|
||||
LOG_INFO "保持原安装状态,不卸载sg3_utils软件包"
|
||||
fi
|
||||
|
||||
LOG_INFO "sg_verify --vrprotect参数功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user