update testcase for testsuite istack-commons-tools
This commit is contained in:
@@ -6,21 +6,9 @@
|
||||
"name": "test_istack-commons-tools_function_install",
|
||||
"desc": "Test package installation"
|
||||
},
|
||||
{
|
||||
"name": "test_istack-commons-tools_function_validate",
|
||||
"desc": "Test package validation functionality"
|
||||
},
|
||||
{
|
||||
"name": "test_istack-commons-tools_function_uninstall",
|
||||
"desc": "Test package removal"
|
||||
},
|
||||
{
|
||||
"name": "test_istack-commons-tools_function_version",
|
||||
"desc": "Test version query"
|
||||
},
|
||||
{
|
||||
"name": "test_istack-commons-tools_function_basic_usage",
|
||||
"desc": "Test a core tool (e.g., schemagen)"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test a core tool (e.g., schemagen)
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "1. 检查是否已安装schemagen工具"
|
||||
if command -v schemagen &> /dev/null; then
|
||||
LOG_INFO "schemagen工具已安装,测试结束后将保持安装状态。"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "schemagen工具未安装,将在测试步骤中安装,并在测试结束后卸载。"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
LOG_INFO "2. 检查yum源中是否存在schemagen软件包"
|
||||
dnf list available schemagen &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到schemagen软件包。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "3. 安装schemagen软件包"
|
||||
dnf install -y schemagen
|
||||
CHECK_RESULT $? 0 0 "安装schemagen软件包失败。"
|
||||
fi
|
||||
|
||||
LOG_INFO "4. 测试schemagen基本用法:查看帮助信息"
|
||||
schemagen --help
|
||||
CHECK_RESULT $? 0 0 "执行schemagen --help命令失败。"
|
||||
|
||||
LOG_INFO "5. 测试schemagen基本用法:查看版本信息"
|
||||
schemagen --version
|
||||
CHECK_RESULT $? 0 0 "执行schemagen --version命令失败。"
|
||||
|
||||
LOG_INFO "6. 测试schemagen基本用法:指定不支持的参数"
|
||||
schemagen --invalid-option &> /dev/null
|
||||
if [ $? -ne 255 ]; then
|
||||
LOG_ERROR "schemagen未正确处理不支持的参数。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "7. 清理测试环境"
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载schemagen软件包"
|
||||
dnf remove -y schemagen
|
||||
CHECK_RESULT $? 0 0 "卸载schemagen软件包失败。"
|
||||
else
|
||||
LOG_INFO "测试开始时schemagen已安装,测试结束后保持安装状态。"
|
||||
fi
|
||||
|
||||
LOG_INFO "8. 测试完成,环境已恢复。"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-05
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package validation functionality
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查软件包是否已安装
|
||||
if rpm -q istack-commons-tools &>/dev/null; then
|
||||
LOG_INFO "istack-commons-tools 已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "istack-commons-tools 未安装,将在测试完成后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在istack-commons-tools软件包
|
||||
LOG_INFO "检查yum源中是否存在istack-commons-tools软件包"
|
||||
if ! dnf list available istack-commons-tools &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到istack-commons-tools软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装istack-commons-tools软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在安装istack-commons-tools软件包"
|
||||
dnf install -y istack-commons-tools
|
||||
CHECK_RESULT $? 0 0 "安装istack-commons-tools失败"
|
||||
fi
|
||||
|
||||
# 测试功能验证命令是否存在或支持
|
||||
LOG_INFO "测试功能验证命令是否存在或支持"
|
||||
if ! command -v validate_function &>/dev/null; then
|
||||
LOG_ERROR "validate_function命令不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行功能验证命令
|
||||
LOG_INFO "执行功能验证命令"
|
||||
validate_function --test-param
|
||||
CHECK_RESULT $? 0 0 "功能验证命令执行失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在卸载istack-commons-tools软件包"
|
||||
dnf remove -y istack-commons-tools
|
||||
CHECK_RESULT $? 0 0 "卸载istack-commons-tools失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test version query
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试版本查询功能"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
if dnf list installed istack-commons-tools 2>/dev/null | grep -q istack-commons-tools; then
|
||||
LOG_INFO "检测到istack-commons-tools已安装"
|
||||
ALREADY_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "未检测到istack-commons-tools安装"
|
||||
ALREADY_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则尝试安装
|
||||
if [ "$ALREADY_INSTALLED" = false ]; then
|
||||
LOG_INFO "检查yum源中是否存在istack-commons-tools软件包"
|
||||
if ! dnf list available istack-commons-tools 2>/dev/null | grep -q istack-commons-tools; then
|
||||
LOG_ERROR "yum源中未找到istack-commons-tools软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "安装istack-commons-tools软件包"
|
||||
dnf install -y istack-commons-tools
|
||||
CHECK_RESULT $? 0 0 "安装istack-commons-tools失败"
|
||||
fi
|
||||
|
||||
# 测试版本查询
|
||||
LOG_INFO "测试版本查询命令"
|
||||
istack-commons-tools version
|
||||
CHECK_RESULT $? 0 0 "版本查询命令执行失败"
|
||||
|
||||
# 测试带参数版本查询(假设支持--version参数)
|
||||
LOG_INFO "测试带--version参数的版本查询"
|
||||
istack-commons-tools --version
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "不支持--version参数"
|
||||
exit 255
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "带参数版本查询失败"
|
||||
|
||||
# 环境恢复
|
||||
if [ "$ALREADY_INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载istack-commons-tools软件包"
|
||||
dnf remove -y istack-commons-tools
|
||||
CHECK_RESULT $? 0 0 "卸载istack-commons-tools失败"
|
||||
else
|
||||
LOG_INFO "保持istack-commons-tools安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "版本查询功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user