diff --git a/suite2cases/function_test/pkg_test/flac/flac-help.json b/suite2cases/function_test/pkg_test/flac/flac-help.json index d98c9dd40e9..2784ea6b1fb 100644 --- a/suite2cases/function_test/pkg_test/flac/flac-help.json +++ b/suite2cases/function_test/pkg_test/flac/flac-help.json @@ -6,29 +6,13 @@ "name": "test_flac-help_function_install", "desc": "Test the installation of flac-help package" }, - { - "name": "test_flac-help_function_uninstall", - "desc": "Test the uninstallation of flac-help package" - }, { "name": "test_flac-help_function_basic_cmd", "desc": "Test basic command usage" }, - { - "name": "test_flac-help_function_check_install", - "desc": "Check if flac-help package is installed on the system" - }, - { - "name": "test_flac-help_function_help_output", - "desc": "Test the help command output for usage information" - }, { "name": "test_flac-help_function_version", "desc": "Test the version command to verify package version" - }, - { - "name": "test_flac-help_function_basic_usage", - "desc": "Test a basic example usage of the flac-help tool" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_basic_usage.sh b/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_basic_usage.sh deleted file mode 100644 index bbf9efb77fb..00000000000 --- a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_basic_usage.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-30 -# @License : Mulan PSL v2 -# @Desc : Test a basic example usage of the flac-help tool -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称和命令 - PACKAGE_NAME="flac" - COMMAND="flac" - EXPECTED_PARAM="--help" - - # 检查软件包是否已在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 "检查命令是否已安装: ${COMMAND}" - command -v ${COMMAND} &>/dev/null - INSTALLED=$? - - # 如果未安装,则安装软件包 - if [ ${INSTALLED} -ne 0 ]; then - LOG_INFO "安装软件包: ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 检查命令是否支持指定参数 - LOG_INFO "检查命令是否支持参数: ${EXPECTED_PARAM}" - ${COMMAND} ${EXPECTED_PARAM} &>/dev/null - if [ $? -eq 255 ]; then - LOG_ERROR "命令不支持参数: ${EXPECTED_PARAM}" - # 如果之前未安装,则卸载软件包 - if [ ${INSTALLED} -ne 0 ]; then - LOG_INFO "卸载软件包: ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 测试基本用法 - LOG_INFO "测试 flac-help 工具的基本用法" - ${COMMAND} ${EXPECTED_PARAM} | grep -q "usage:" - CHECK_RESULT $? 0 0 "flac-help 工具基本用法测试失败" - - # 环境清理:如果之前未安装,则卸载软件包 - if [ ${INSTALLED} -ne 0 ]; then - LOG_INFO "卸载软件包: ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "保持软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_check_install.sh b/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_check_install.sh deleted file mode 100644 index d1430e44d3e..00000000000 --- a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_check_install.sh +++ /dev/null @@ -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-30 -# @License : Mulan PSL v2 -# @Desc : Check if flac-help package is installed on the system -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查flac-help软件包是否已安装 - LOG_INFO "开始检查flac-help软件包是否已安装" - - # 检查是否已经安装了flac-help软件包 - LOG_INFO "检查系统中是否已安装flac-help软件包" - rpm -q flac-help - if [ $? -eq 0 ]; then - LOG_INFO "flac-help软件包已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "flac-help软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有flac-help软件包 - LOG_INFO "检查yum源中是否有flac-help软件包" - dnf list available flac-help 2>/dev/null | grep -q flac-help - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到flac-help软件包" - exit 255 - fi - - # 如果未安装,则安装flac-help软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "开始安装flac-help软件包" - dnf install -y flac-help - CHECK_RESULT $? 0 0 "安装flac-help软件包失败" - LOG_INFO "flac-help软件包安装成功" - fi - - # 检查flac-help命令是否可用 - LOG_INFO "检查flac-help命令是否可用" - flac-help --help >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "flac-help命令执行失败" - - # 检查flac-help命令的基本功能 - LOG_INFO "检查flac-help命令的基本功能" - flac-help --version >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "flac-help --version命令执行失败" - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数" - flac-help --invalid-parameter 2>/dev/null - if [ $? -ne 255 ] && [ $? -ne 1 ]; then - LOG_ERROR "flac-help不支持--invalid-parameter参数,但未返回预期错误码" - exit 255 - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "清理环境:卸载flac-help软件包" - dnf remove -y flac-help - CHECK_RESULT $? 0 0 "卸载flac-help软件包失败" - LOG_INFO "flac-help软件包卸载成功" - else - LOG_INFO "保持flac-help软件包安装状态" - fi - - LOG_INFO "flac-help软件包检查完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_help_output.sh b/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_help_output.sh deleted file mode 100644 index 2df5a4da8a7..00000000000 --- a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_help_output.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-30 -# @License : Mulan PSL v2 -# @Desc : Test the help command output for usage information -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:验证flac命令的帮助信息输出" - - # 检查是否已安装flac - if ! command -v flac &> /dev/null; then - LOG_INFO "flac未安装,开始安装flac软件包" - - # 检查yum源中是否有flac软件包 - if ! dnf list available flac --quiet 2>/dev/null | grep -q flac; then - LOG_ERROR "yum源中未找到flac软件包" - exit 255 - fi - - # 安装flac - dnf install -y flac - CHECK_RESULT $? 0 0 "安装flac失败" - - INSTALLED_FLAC=1 - LOG_INFO "flac安装成功" - else - LOG_INFO "flac已安装" - INSTALLED_FLAC=0 - fi - - # 测试flac --help参数 - LOG_INFO "测试flac --help参数" - flac --help > /tmp/flac_help_output.txt 2>&1 - CHECK_RESULT $? 0 0 "flac --help执行失败" - - # 检查输出是否包含使用信息 - LOG_INFO "检查帮助输出是否包含使用信息" - if grep -q -i "usage\|用法\|help\|帮助" /tmp/flac_help_output.txt; then - LOG_INFO "帮助输出包含使用信息" - CHECK_RESULT $? 0 0 "帮助输出不包含使用信息" - else - LOG_ERROR "帮助输出不包含使用信息" - exit 1 - fi - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数" - flac --invalid-parameter 2>/dev/null - if [ $? -eq 255 ]; then - LOG_INFO "不支持的参数正确处理" - else - LOG_ERROR "不支持的参数未正确处理" - exit 255 - fi - - # 清理临时文件 - rm -f /tmp/flac_help_output.txt - - # 恢复环境:如果测试前未安装flac,则卸载 - if [ $INSTALLED_FLAC -eq 1 ]; then - LOG_INFO "卸载测试安装的flac软件包" - dnf remove -y flac - CHECK_RESULT $? 0 0 "卸载flac失败" - LOG_INFO "flac卸载成功" - fi - - LOG_INFO "测试完成:flac帮助命令输出测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_uninstall.sh b/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_uninstall.sh deleted file mode 100644 index ec2b6a40a53..00000000000 --- a/testcases/function_test/pkg_test/flac/flac-help/test_flac-help_function_uninstall.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-09-10 -# @License : Mulan PSL v2 -# @Desc : Test the uninstallation of flac-help package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查flac-help软件包是否已安装 - LOG_INFO "检查flac-help软件包是否已安装" - rpm -q flac-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "flac-help软件包已安装,保持安装状态" - installed=true - else - LOG_INFO "flac-help软件包未安装,将在测试后卸载" - installed=false - fi - - # 检查yum源中是否存在flac-help软件包 - LOG_INFO "检查yum源中是否存在flac-help软件包" - dnf list available flac-help > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在flac-help软件包" - - # 安装flac-help软件包 - LOG_INFO "安装flac-help软件包" - dnf install -y flac-help - CHECK_RESULT $? 0 0 "安装flac-help软件包失败" - - # 测试flac-help命令的帮助功能 - LOG_INFO "测试flac-help命令的帮助功能" - flac-help --help > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "flac-help命令不支持--help参数" - - # 卸载flac-help软件包(如果最初未安装) - if [ "$installed" = false ]; then - LOG_INFO "卸载flac-help软件包" - dnf remove -y flac-help - CHECK_RESULT $? 0 0 "卸载flac-help软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file