From 8b589dd3f3d3a4f166b1ca66ca95d15bca126b45 Mon Sep 17 00:00:00 2001 From: honghua Date: Sat, 18 Apr 2026 02:47:04 +0800 Subject: [PATCH] update testcase for testsuite gnu-getopt-help --- .../pkg_test/gnu-getopt/gnu-getopt-help.json | 14 ---- .../test_gnu-getopt-help_function_basic.sh | 72 ------------------ .../test_gnu-getopt-help_function_parse.sh | 75 ------------------- 3 files changed, 161 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/gnu-getopt/gnu-getopt-help.json delete mode 100644 testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_basic.sh delete mode 100644 testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_parse.sh diff --git a/suite2cases/function_test/pkg_test/gnu-getopt/gnu-getopt-help.json b/suite2cases/function_test/pkg_test/gnu-getopt/gnu-getopt-help.json deleted file mode 100644 index d9f3395d414..00000000000 --- a/suite2cases/function_test/pkg_test/gnu-getopt/gnu-getopt-help.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help", - "machine num": 1, - "cases": [ - { - "name": "test_gnu-getopt-help_function_basic", - "desc": "Test basic functionality of gnu-getopt-help" - }, - { - "name": "test_gnu-getopt-help_function_parse", - "desc": "Test parsing functionality of gnu-getopt-help" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_basic.sh b/testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_basic.sh deleted file mode 100644 index 62f5f345f27..00000000000 --- a/testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_basic.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-29 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality of gnu-getopt-help -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装gnu-getopt-help - LOG_INFO "检查是否已安装gnu-getopt-help..." - rpm -q gnu-getopt-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "gnu-getopt-help已安装,保持安装状态" - installed=true - else - LOG_INFO "gnu-getopt-help未安装,将在测试后卸载" - installed=false - fi - - # 检查yum源中是否有gnu-getopt-help软件包 - LOG_INFO "检查yum源中是否有gnu-getopt-help软件包..." - dnf list available gnu-getopt-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到gnu-getopt-help软件包" - exit 255 - fi - - # 安装gnu-getopt-help(如果未安装) - if [ "$installed" = false ]; then - LOG_INFO "安装gnu-getopt-help..." - dnf install -y gnu-getopt-help - CHECK_RESULT $? 0 0 "安装gnu-getopt-help失败" - fi - - # 测试gnu-getopt-help基本功能 - LOG_INFO "测试gnu-getopt-help基本功能..." - gnu-getopt-help --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "gnu-getopt-help --help命令执行失败" - - # 测试不支持的参数(应失败) - LOG_INFO "测试不支持的参数(应失败)..." - gnu-getopt-help --invalid-option > /dev/null 2>&1 - if [ $? -ne 255 ]; then - LOG_ERROR "不支持的参数未按预期退出" - exit 255 - fi - - # 清理环境(如果之前未安装) - if [ "$installed" = false ]; then - LOG_INFO "卸载gnu-getopt-help..." - dnf remove -y gnu-getopt-help - CHECK_RESULT $? 0 0 "卸载gnu-getopt-help失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_parse.sh b/testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_parse.sh deleted file mode 100644 index 94ea96fd7c9..00000000000 --- a/testcases/function_test/pkg_test/gnu-getopt/gnu-getopt-help/test_gnu-getopt-help_function_parse.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-10 -# @License : Mulan PSL v2 -# @Desc : Test parsing functionality of gnu-getopt-help -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试gnu-getopt-help的解析功能 - LOG_INFO "开始测试gnu-getopt-help的解析功能" - - # 检查是否已安装gnu-getopt-help - LOG_INFO "检查gnu-getopt-help是否已安装" - if ! dnf list installed gnu-getopt-help &>/dev/null; then - LOG_INFO "gnu-getopt-help未安装,将进行安装" - # 检查yum源中是否有该软件包 - if ! dnf list available gnu-getopt-help &>/dev/null; then - LOG_ERROR "yum源中未找到gnu-getopt-help软件包" - exit 255 - fi - # 安装软件包 - dnf install -y gnu-getopt-help - CHECK_RESULT $? 0 0 "安装gnu-getopt-help失败" - # 标记需要卸载 - NEED_UNINSTALL=1 - else - LOG_INFO "gnu-getopt-help已安装,无需重复安装" - fi - - # 测试命令参数解析功能 - LOG_INFO "测试gnu-getopt-help的命令参数解析功能" - output=$(gnu-getopt-help --help) - CHECK_RESULT $? 0 0 "执行gnu-getopt-help --help失败" - - # 检查输出是否包含帮助信息 - if [[ "$output" != *"Usage:"* ]]; then - LOG_ERROR "gnu-getopt-help --help输出不符合预期" - exit 255 - fi - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数" - gnu-getopt-help --invalid-option &>/dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "不支持的参数未返回预期退出码255" - exit 255 - fi - - # 清理环境 - if [ "$NEED_UNINSTALL" -eq 1 ]; then - LOG_INFO "卸载gnu-getopt-help" - dnf remove -y gnu-getopt-help - CHECK_RESULT $? 0 0 "卸载gnu-getopt-help失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file