From afec5df2ed3607a068e27f000f1d75ebaada916b Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 09:49:51 +0800 Subject: [PATCH 01/10] update testcase for testsuite texlive-copyedit --- .../texlive-split-e/texlive-copyedit.json | 20 ----- ...t_texlive-copyedit_function_basic_usage.sh | 80 ------------------ ...st_texlive-copyedit_function_dependency.sh | 83 ------------------ .../test_texlive-copyedit_function_install.sh | 62 -------------- ...est_texlive-copyedit_function_uninstall.sh | 84 ------------------- .../test_texlive-copyedit_function_version.sh | 73 ---------------- 6 files changed, 402 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_basic_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_dependency.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_version.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-copyedit.json b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-copyedit.json index 128a829170d..412be7c4578 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-copyedit.json +++ b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-copyedit.json @@ -11,26 +11,6 @@ "name": "test_texlive-copyedit_uninstall", "desc": "测试 texlive-copyedit 软件包的卸载功能,验证是否能够成功从系统中卸载。", "machine num": 1 - }, - { - "name": "test_texlive-copyedit_function_install", - "desc": "测试 texlive-copyedit 软件包的基本安装功能,验证其能否通过包管理器(如 apt, yum, dnf)成功安装到系统中。" - }, - { - "name": "test_texlive-copyedit_function_uninstall", - "desc": "测试 texlive-copyedit 软件包的卸载功能,验证其能否被完全、干净地从系统中移除,不留残余文件。" - }, - { - "name": "test_texlive-copyedit_function_version", - "desc": "测试 texlive-copyedit 软件包的版本查询功能,验证安装后能够正确查询并显示其版本信息。" - }, - { - "name": "test_texlive-copyedit_function_basic_usage", - "desc": "测试 texlive-copyedit 软件包提供的基本命令行工具或宏包功能,验证其主要功能(如语法检查、格式整理)能够被正常调用和执行。" - }, - { - "name": "test_texlive-copyedit_function_dependency", - "desc": "测试 texlive-copyedit 软件包的依赖关系,验证其安装是否正确引入了所有必需的依赖包,并确保系统环境满足运行要求。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_basic_usage.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_basic_usage.sh deleted file mode 100644 index b0b8453cee2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_basic_usage.sh +++ /dev/null @@ -1,80 +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-06 -# @License : Mulan PSL v2 -# @Desc : 测试 texlive-copyedit 软件包提供的基本命令行工具或宏包功能,验证其主要功能(如语法检查、格式整理)能够被正常调用和执行。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 texlive-copyedit 软件包的基本功能" - LOG_INFO "步骤1:检查当前环境中是否已安装 texlive-copyedit 软件包" - if rpm -q texlive-copyedit &> /dev/null; then - LOG_INFO "检测到 texlive-copyedit 已安装,测试结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "未检测到 texlive-copyedit 安装,将在测试过程中安装" - INSTALLED="false" - fi - - LOG_INFO "步骤2:检查 yum 源中是否存在 texlive-copyedit 软件包" - if ! dnf list available texlive-copyedit &> /dev/null; then - LOG_ERROR "yum 源中未找到 texlive-copyedit 软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装 texlive-copyedit 软件包" - dnf install -y texlive-copyedit - CHECK_RESULT $? 0 0 "安装 texlive-copyedit 失败" - fi - - LOG_INFO "步骤4:验证 texlive-copyedit 提供的基本命令行工具或宏包功能" - LOG_INFO "步骤4.1:尝试调用 texlive-copyedit 的主要功能进行语法检查" - if command -v lacheck &> /dev/null; then - TEST_FILE="test_tex.tex" - echo "\documentclass{article}\begin{document}Test\end{document}" > $TEST_FILE - lacheck $TEST_FILE - CHECK_RESULT $? 0 0 "lacheck 语法检查功能执行失败" - rm -f $TEST_FILE - else - LOG_INFO "未找到 lacheck 命令,尝试其他功能" - fi - - LOG_INFO "步骤4.2:尝试调用其他可能提供的功能(如格式整理)" - if command -v latexindent &> /dev/null; then - TEST_FILE2="test_indent.tex" - echo "\documentclass{article}\begin{document}Test\end{document}" > $TEST_FILE2 - latexindent $TEST_FILE2 - CHECK_RESULT $? 0 0 "latexindent 格式整理功能执行失败" - rm -f $TEST_FILE2 - else - LOG_INFO "未找到 latexindent 命令,跳过格式整理测试" - fi - - LOG_INFO "步骤5:清理测试环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤5.1:卸载 texlive-copyedit 软件包" - dnf remove -y texlive-copyedit - CHECK_RESULT $? 0 0 "卸载 texlive-copyedit 失败" - else - LOG_INFO "测试前已安装 texlive-copyedit,保持安装状态,无需卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_dependency.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_dependency.sh deleted file mode 100644 index 9c52cdc0de4..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_dependency.sh +++ /dev/null @@ -1,83 +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-06 -# @License : Mulan PSL v2 -# @Desc : 测试 texlive-copyedit 软件包的依赖关系,验证其安装是否正确引入了所有必需的依赖包,并确保系统环境满足运行要求。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试 texlive-copyedit 软件包的依赖关系 - LOG_INFO "开始测试 texlive-copyedit 软件包的依赖关系" - - # 检查是否已安装 texlive-copyedit - LOG_INFO "检查是否已安装 texlive-copyedit" - rpm -q texlive-copyedit - if [ $? -eq 0 ]; then - LOG_INFO "texlive-copyedit 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "texlive-copyedit 未安装,将进行安装测试" - INSTALLED_BEFORE=false - fi - - # 检查 yum 源中是否有 texlive-copyedit 软件包 - LOG_INFO "检查 yum 源中是否有 texlive-copyedit 软件包" - dnf list available texlive-copyedit - CHECK_RESULT $? 0 0 "yum 源中未找到 texlive-copyedit 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 texlive-copyedit 软件包" - exit 255 - fi - - # 安装 texlive-copyedit 软件包 - LOG_INFO "安装 texlive-copyedit 软件包" - dnf install -y texlive-copyedit - CHECK_RESULT $? 0 0 "安装 texlive-copyedit 失败" - - # 验证 texlive-copyedit 是否成功安装 - LOG_INFO "验证 texlive-copyedit 是否成功安装" - rpm -q texlive-copyedit - CHECK_RESULT $? 0 0 "texlive-copyedit 安装后验证失败" - - # 检查 texlive-copyedit 的依赖包 - LOG_INFO "检查 texlive-copyedit 的依赖包" - rpm -qR texlive-copyedit - CHECK_RESULT $? 0 0 "获取 texlive-copyedit 依赖包失败" - - # 验证依赖包是否都已安装 - LOG_INFO "验证依赖包是否都已安装" - for dep in $(rpm -qR texlive-copyedit | grep -v "rtld" | grep -v "rpmlib"); do - rpm -q $dep - CHECK_RESULT $? 0 0 "依赖包 $dep 未安装" - done - - # 测试 texlive-copyedit 的基本功能 - LOG_INFO "测试 texlive-copyedit 的基本功能" - texlive-copyedit --help - CHECK_RESULT $? 0 0 "texlive-copyedit 基本功能测试失败" - - # 清理环境:如果之前未安装,则卸载 texlive-copyedit - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "清理环境:卸载 texlive-copyedit" - dnf remove -y texlive-copyedit - CHECK_RESULT $? 0 0 "卸载 texlive-copyedit 失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_install.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_install.sh deleted file mode 100644 index 69e58b296a4..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_install.sh +++ /dev/null @@ -1,62 +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-06 -# @License : Mulan PSL v2 -# @Desc : 测试 texlive-copyedit 软件包的基本安装功能,验证其能否通过包管理器(如 apt, yum, dnf)成功安装到系统中。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="texlive-copyedit" - LOG_INFO "开始测试${PACKAGE_NAME}软件包的基本安装功能" - LOG_INFO "步骤1:检查软件包是否已在yum源中可用" - dnf list available "${PACKAGE_NAME}" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包:${PACKAGE_NAME}" - exit 255 - fi - LOG_INFO "软件包${PACKAGE_NAME}在yum源中可用" - LOG_INFO "步骤2:检查当前系统是否已安装${PACKAGE_NAME}" - if rpm -q "${PACKAGE_NAME}" > /dev/null 2>&1; then - LOG_INFO "软件包${PACKAGE_NAME}已安装,标记为预安装状态" - PRE_INSTALLED=true - else - LOG_INFO "软件包${PACKAGE_NAME}未安装,标记为需要测试安装" - PRE_INSTALLED=false - fi - if [ "${PRE_INSTALLED}" = "false" ]; then - LOG_INFO "步骤3:执行软件包安装测试" - dnf install -y "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "软件包${PACKAGE_NAME}安装失败" - LOG_INFO "软件包${PACKAGE_NAME}安装成功" - LOG_INFO "步骤4:验证软件包安装结果" - rpm -q "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "验证软件包${PACKAGE_NAME}安装状态失败" - LOG_INFO "软件包${PACKAGE_NAME}验证成功" - fi - LOG_INFO "步骤5:执行环境清理与恢复" - if [ "${PRE_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 "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_uninstall.sh deleted file mode 100644 index c8d9f49722c..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_uninstall.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-06 -# @License : Mulan PSL v2 -# @Desc : 测试 texlive-copyedit 软件包的卸载功能,验证其能否被完全、干净地从系统中移除,不留残余文件。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 texlive-copyedit 软件包的卸载功能" - LOG_INFO "步骤1:检查 yum 源中是否存在 texlive-copyedit 软件包" - dnf list available texlive-copyedit > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 texlive-copyedit 软件包" - exit 255 - fi - LOG_INFO "yum 源中存在 texlive-copyedit 软件包" - - LOG_INFO "步骤2:检查当前系统是否已安装 texlive-copyedit" - rpm -q texlive-copyedit > /dev/null 2>&1 - INSTALLED=$? - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "texlive-copyedit 已安装,测试完成后将保持安装状态" - NEED_UNINSTALL=0 - else - LOG_INFO "texlive-copyedit 未安装,将在测试前安装,测试后卸载" - NEED_UNINSTALL=1 - LOG_INFO "步骤3:安装 texlive-copyedit 软件包" - dnf install -y texlive-copyedit - CHECK_RESULT $? 0 0 "安装 texlive-copyedit 失败" - fi - - LOG_INFO "步骤4:验证 texlive-copyedit 软件包已安装" - rpm -q texlive-copyedit > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证 texlive-copyedit 安装状态失败" - - LOG_INFO "步骤5:执行卸载命令" - dnf remove -y texlive-copyedit - CHECK_RESULT $? 0 0 "卸载 texlive-copyedit 失败" - - LOG_INFO "步骤6:验证 texlive-copyedit 软件包已被完全移除" - rpm -q texlive-copyedit > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "卸载后仍检测到 texlive-copyedit 软件包" - exit 1 - else - LOG_INFO "texlive-copyedit 软件包已从 rpm 数据库中移除" - fi - - LOG_INFO "步骤7:检查是否残留相关文件" - find /usr -name "*copyedit*" 2>/dev/null | head -5 - if [ $? -eq 0 ]; then - LOG_ERROR "发现疑似 texlive-copyedit 残留文件" - exit 1 - else - LOG_INFO "未发现明显残留文件" - fi - - LOG_INFO "步骤8:环境恢复" - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "由于测试前未安装,无需恢复安装状态" - else - LOG_INFO "恢复测试前的安装状态:重新安装 texlive-copyedit" - dnf install -y texlive-copyedit - CHECK_RESULT $? 0 0 "恢复安装 texlive-copyedit 失败" - fi - - LOG_INFO "测试完成:texlive-copyedit 卸载功能验证通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_version.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_version.sh deleted file mode 100644 index 55607c97ea2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-copyedit/test_texlive-copyedit_function_version.sh +++ /dev/null @@ -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-06 -# @License : Mulan PSL v2 -# @Desc : 测试 texlive-copyedit 软件包的版本查询功能,验证安装后能够正确查询并显示其版本信息。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="texlive-copyedit" - LOG_INFO "开始测试 texlive-copyedit 软件包的版本查询功能" - LOG_INFO "步骤1: 检查系统中是否已安装 $PACKAGE_NAME" - if dnf list installed "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "$PACKAGE_NAME 已安装,测试结束后将保持安装状态" - WAS_INSTALLED=true - else - LOG_INFO "$PACKAGE_NAME 未安装,将在测试步骤中安装" - WAS_INSTALLED=false - fi - LOG_INFO "步骤2: 检查yum源中是否存在 $PACKAGE_NAME 软件包" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包" - exit 255 - fi - if [ "$WAS_INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装 $PACKAGE_NAME 软件包" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - LOG_INFO "步骤4: 验证版本查询命令是否存在" - if ! command -v texlive-copyedit &>/dev/null; then - LOG_ERROR "命令 texlive-copyedit 不存在" - if [ "$WAS_INSTALLED" = false ]; then - LOG_INFO "清理环境: 卸载已安装的软件包" - dnf remove -y "$PACKAGE_NAME" - fi - exit 255 - fi - LOG_INFO "步骤5: 执行版本查询命令" - texlive-copyedit --version - CHECK_RESULT $? 0 0 "执行 texlive-copyedit --version 命令失败" - VERSION_OUTPUT=$(texlive-copyedit --version 2>&1) - if [ -z "$VERSION_OUTPUT" ]; then - LOG_ERROR "版本查询命令未输出任何信息" - CHECK_RESULT 1 0 0 "版本查询输出为空" - else - LOG_INFO "版本查询输出: $VERSION_OUTPUT" - CHECK_RESULT 0 0 0 "版本查询功能正常" - fi - if [ "$WAS_INSTALLED" = false ]; then - LOG_INFO "步骤6: 清理环境,卸载测试安装的软件包" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - LOG_INFO "环境已恢复至测试前状态" - else - LOG_INFO "测试完成,软件包保持安装状态" - fi -} - -main "$@" \ No newline at end of file From 7213f244c0834c862e878feacefd56c2f522257b Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 09:51:39 +0800 Subject: [PATCH 02/10] update testcase for testsuite hppc-templateprocessor --- .../pkg_test/hppc/hppc-templateprocessor.json | 24 ---- ..._hppc-templateprocessor_function_config.sh | 80 ----------- ...st_hppc-templateprocessor_function_help.sh | 132 ------------------ ...hppc-templateprocessor_function_process.sh | 75 ---------- ...pc-templateprocessor_function_uninstall.sh | 80 ----------- ...hppc-templateprocessor_function_version.sh | 84 ----------- 6 files changed, 475 deletions(-) delete mode 100644 testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_config.sh delete mode 100644 testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_help.sh delete mode 100644 testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_process.sh delete mode 100644 testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_version.sh diff --git a/suite2cases/function_test/pkg_test/hppc/hppc-templateprocessor.json b/suite2cases/function_test/pkg_test/hppc/hppc-templateprocessor.json index 103406ed74a..259ffd1d33a 100644 --- a/suite2cases/function_test/pkg_test/hppc/hppc-templateprocessor.json +++ b/suite2cases/function_test/pkg_test/hppc/hppc-templateprocessor.json @@ -5,30 +5,6 @@ { "name": "test_hppc-templateprocessor_function_install", "desc": "Test the installation of hppc-templateprocessor package" - }, - { - "name": "test_hppc-templateprocessor_function_process", - "desc": "Test the processing functionality of hppc-templateprocessor" - }, - { - "name": "test_hppc-templateprocessor_function_uninstall", - "desc": "Test the uninstallation of hppc-templateprocessor package" - }, - { - "name": "test_hppc-templateprocessor_function_version", - "desc": "Test checking the package version" - }, - { - "name": "test_hppc-templateprocessor_function_help", - "desc": "Test the help command or usage info" - }, - { - "name": "test_hppc-templateprocessor_function_config", - "desc": "Test basic configuration or init" - }, - { - "name": "test_hppc-templateprocessor_function_list_templates", - "desc": "Test listing available templates" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_config.sh b/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_config.sh deleted file mode 100644 index 93cb72e865f..00000000000 --- a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_config.sh +++ /dev/null @@ -1,80 +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 basic configuration or init -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic configuration or init" - - # 检查是否已安装hppc-templateprocessor软件包 - LOG_INFO "检查hppc-templateprocessor是否已安装" - if rpm -q hppc-templateprocessor &> /dev/null; then - LOG_INFO "hppc-templateprocessor已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "hppc-templateprocessor未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否存在hppc-templateprocessor软件包 - LOG_INFO "检查yum源中是否存在hppc-templateprocessor软件包" - if dnf list available hppc-templateprocessor &> /dev/null; then - LOG_INFO "yum源中存在hppc-templateprocessor软件包" - else - LOG_ERROR "yum源中不存在hppc-templateprocessor软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装hppc-templateprocessor软件包" - dnf install -y hppc-templateprocessor - CHECK_RESULT $? 0 0 "安装hppc-templateprocessor失败" - LOG_INFO "hppc-templateprocessor安装成功" - fi - - # 测试基本配置或初始化功能 - LOG_INFO "测试hppc-templateprocessor的基本配置或初始化功能" - # 假设hppc-templateprocessor有一个配置命令,这里用示例命令代替 - # 例如:hppc-templateprocessor --config - # 检查命令参数是否存在 - if hppc-templateprocessor --help | grep -q "\-\-config"; then - LOG_INFO "参数--config存在,执行配置命令" - hppc-templateprocessor --config - CHECK_RESULT $? 0 0 "hppc-templateprocessor配置失败" - LOG_INFO "hppc-templateprocessor配置成功" - else - LOG_ERROR "参数--config不存在或不支持" - exit 255 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hppc-templateprocessor软件包" - dnf remove -y hppc-templateprocessor - CHECK_RESULT $? 0 0 "卸载hppc-templateprocessor失败" - LOG_INFO "hppc-templateprocessor卸载成功" - else - LOG_INFO "测试前已安装hppc-templateprocessor,保持安装状态" - fi - - LOG_INFO "测试完成:Test basic configuration or init" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_help.sh b/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_help.sh deleted file mode 100644 index c601b62d13d..00000000000 --- a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_help.sh +++ /dev/null @@ -1,132 +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 the help command or usage info -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package_name=$1 - dnf list available "$package_name" &>/dev/null - return $? - } - - # 检查命令参数是否支持 - check_command_option() { - local cmd=$1 - local option=$2 - $cmd --help 2>&1 | grep -q -- "$option" - return $? - } - - # 安装软件包 - install_package() { - local package_name=$1 - LOG_INFO "正在安装软件包: $package_name" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装软件包失败" - } - - # 卸载软件包 - uninstall_package() { - local package_name=$1 - LOG_INFO "正在卸载软件包: $package_name" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包失败" - } - - # 检查环境是否已安装 - check_installed() { - local package_name=$1 - rpm -q "$package_name" &>/dev/null - return $? - } - - # 主测试函数 - main() { - local package_name="hppc-templateprocessor" - local installed_before_test=false - - LOG_INFO "测试开始: 测试帮助命令或使用信息" - - # 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查软件包是否在yum源中" - check_package_in_repo "$package_name" - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $package_name 不在yum源中" - exit 255 - fi - - # 检查环境是否已安装 - LOG_INFO "步骤2: 检查环境是否已安装" - if check_installed "$package_name"; then - LOG_INFO "软件包 $package_name 已安装" - installed_before_test=true - else - LOG_INFO "软件包 $package_name 未安装,将在测试过程中安装" - fi - - # 如果未安装,则安装软件包 - if [ "$installed_before_test" = false ]; then - install_package "$package_name" - fi - - # 检查帮助命令参数 - LOG_INFO "步骤3: 检查帮助命令参数是否支持" - if ! command -v hppc-templateprocessor &>/dev/null; then - LOG_ERROR "命令 hppc-templateprocessor 不存在" - exit 255 - fi - - check_command_option "hppc-templateprocessor" "--help" - if [ $? -ne 0 ]; then - LOG_ERROR "参数 --help 不被支持" - exit 255 - fi - - # 执行帮助命令 - LOG_INFO "步骤4: 执行帮助命令" - hppc-templateprocessor --help - CHECK_RESULT $? 0 0 "执行帮助命令失败" - - # 清理环境 - LOG_INFO "步骤5: 清理环境" - if [ "$installed_before_test" = false ]; then - uninstall_package "$package_name" - else - LOG_INFO "保持软件包安装状态" - fi - - LOG_INFO "测试完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_process.sh b/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_process.sh deleted file mode 100644 index cf45bc1617a..00000000000 --- a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_process.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-13 -# @License : Mulan PSL v2 -# @Desc : Test the processing functionality of hppc-templateprocessor -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装hppc-templateprocessor - LOG_INFO "检查hppc-templateprocessor是否已安装" - if dnf list installed hppc-templateprocessor &>/dev/null; then - LOG_INFO "hppc-templateprocessor已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "hppc-templateprocessor未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有hppc-templateprocessor软件包 - LOG_INFO "检查yum源中是否有hppc-templateprocessor软件包" - if ! dnf list available hppc-templateprocessor &>/dev/null; then - LOG_ERROR "yum源中未找到hppc-templateprocessor软件包" - exit 255 - fi - - # 安装hppc-templateprocessor - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装hppc-templateprocessor" - dnf install -y hppc-templateprocessor - CHECK_RESULT $? 0 0 "安装hppc-templateprocessor失败" - fi - - # 测试处理功能 - LOG_INFO "测试hppc-templateprocessor的处理功能" - output=$(hppc-templateprocessor process --input test_input.txt --output test_output.txt) - CHECK_RESULT $? 0 0 "处理功能测试失败" - - # 验证输出文件是否存在 - LOG_INFO "验证输出文件是否存在" - if [ ! -f test_output.txt ]; then - LOG_ERROR "输出文件未生成" - exit 1 - fi - - # 清理测试文件(如果存在) - LOG_INFO "清理测试文件" - rm -f test_input.txt test_output.txt - - # 如果之前未安装,则卸载hppc-templateprocessor - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hppc-templateprocessor" - dnf remove -y hppc-templateprocessor - CHECK_RESULT $? 0 0 "卸载hppc-templateprocessor失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_uninstall.sh b/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_uninstall.sh deleted file mode 100644 index a8db108e846..00000000000 --- a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_uninstall.sh +++ /dev/null @@ -1,80 +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 the uninstallation of hppc-templateprocessor package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 hppc-templateprocessor 包的卸载功能" - - # 定义软件包名称 - PACKAGE_NAME="hppc-templateprocessor" - - # 检查 yum 源中是否存在该软件包 - LOG_INFO "检查 yum 源中是否存在 $PACKAGE_NAME 软件包" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中不存在 $PACKAGE_NAME 软件包" - exit 255 - fi - - # 检查当前是否已安装该软件包 - LOG_INFO "检查 $PACKAGE_NAME 是否已安装" - if rpm -q $PACKAGE_NAME > /dev/null 2>&1; then - LOG_INFO "$PACKAGE_NAME 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "$PACKAGE_NAME 未安装,将进行安装作为测试步骤" - INSTALLED_BEFORE=false - fi - - # 如果未安装,则先安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装 $PACKAGE_NAME 软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - # 测试卸载功能 - LOG_INFO "测试卸载 $PACKAGE_NAME 软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - - # 验证卸载后软件包是否已移除 - LOG_INFO "验证 $PACKAGE_NAME 是否已成功卸载" - if rpm -q $PACKAGE_NAME > /dev/null 2>&1; then - LOG_ERROR "$PACKAGE_NAME 卸载后仍存在" - exit 1 - else - LOG_INFO "$PACKAGE_NAME 已成功卸载" - fi - - # 环境恢复:如果之前未安装,则重新安装以恢复环境 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "恢复环境:重新安装 $PACKAGE_NAME 软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "重新安装 $PACKAGE_NAME 失败" - LOG_INFO "环境已恢复:$PACKAGE_NAME 已安装" - else - LOG_INFO "环境已恢复:$PACKAGE_NAME 保持原安装状态" - fi - - LOG_INFO "测试 hppc-templateprocessor 包的卸载功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_version.sh b/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_version.sh deleted file mode 100644 index d095cc5085a..00000000000 --- a/testcases/function_test/pkg_test/hppc/hppc-templateprocessor/test_hppc-templateprocessor_function_version.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-19 -# @License : Mulan PSL v2 -# @Desc : Test checking the package version -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试软件包版本检查功能" - - LOG_INFO "步骤1:检查软件包是否已安装" - if rpm -q hppc-templateprocessor &> /dev/null; then - LOG_INFO "软件包 hppc-templateprocessor 已安装,标记为已安装状态" - INSTALLED=1 - else - LOG_INFO "软件包 hppc-templateprocessor 未安装,标记为未安装状态" - INSTALLED=0 - fi - - LOG_INFO "步骤2:检查yum源中是否存在 hppc-templateprocessor 软件包" - if ! dnf list available hppc-templateprocessor &> /dev/null; then - LOG_ERROR "yum源中未找到 hppc-templateprocessor 软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装 hppc-templateprocessor 软件包" - dnf install -y hppc-templateprocessor - CHECK_RESULT $? 0 0 "安装 hppc-templateprocessor 失败" - fi - - LOG_INFO "步骤4:检查 hppc-templateprocessor 命令是否存在" - if ! command -v hppc-templateprocessor &> /dev/null; then - LOG_ERROR "hppc-templateprocessor 命令不存在" - if [ $INSTALLED -eq 0 ]; then - dnf remove -y hppc-templateprocessor - fi - exit 255 - fi - - LOG_INFO "步骤5:测试 hppc-templateprocessor 的版本参数" - hppc-templateprocessor --version - CHECK_RESULT $? 0 0 "执行 hppc-templateprocessor --version 失败" - - LOG_INFO "步骤6:验证版本输出格式" - VERSION_OUTPUT=$(hppc-templateprocessor --version 2>&1) - if [[ -z "$VERSION_OUTPUT" ]]; then - LOG_ERROR "版本输出为空" - if [ $INSTALLED -eq 0 ]; then - dnf remove -y hppc-templateprocessor - fi - exit 1 - fi - LOG_INFO "版本输出内容: $VERSION_OUTPUT" - - LOG_INFO "步骤7:清理环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的软件包 hppc-templateprocessor" - dnf remove -y hppc-templateprocessor - CHECK_RESULT $? 0 0 "卸载 hppc-templateprocessor 失败" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From a69259e2dfa74b3263633ecb52a52f425bfd44a3 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 09:54:37 +0800 Subject: [PATCH 03/10] update testcase for testsuite metrics-logback --- .../pkg_test/metrics/metrics-logback.json | 8 - .../test_metrics-logback_function_config.sh | 142 ------------------ .../test_metrics-logback_function_logging.sh | 71 --------- 3 files changed, 221 deletions(-) delete mode 100644 testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_config.sh delete mode 100644 testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_logging.sh diff --git a/suite2cases/function_test/pkg_test/metrics/metrics-logback.json b/suite2cases/function_test/pkg_test/metrics/metrics-logback.json index 151cfc29677..da4bea4a7b9 100644 --- a/suite2cases/function_test/pkg_test/metrics/metrics-logback.json +++ b/suite2cases/function_test/pkg_test/metrics/metrics-logback.json @@ -13,14 +13,6 @@ { "name": "test_metrics-logback_function_version", "desc": "测试查询 metrics-logback 软件包版本信息的功能。" - }, - { - "name": "test_metrics-logback_function_config", - "desc": "测试 metrics-logback 基础配置文件是否存在并可读。" - }, - { - "name": "test_metrics-logback_function_logging", - "desc": "测试 metrics-logback 是否能正常输出应用日志。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_config.sh b/testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_config.sh deleted file mode 100644 index 7beac6ab2d9..00000000000 --- a/testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_config.sh +++ /dev/null @@ -1,142 +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 : 测试 metrics-logback 基础配置文件是否存在并可读。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(实际环境中可能已定义,这里确保可用) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数(实际环境中可能已定义) - CHECK_RESULT() { - if [ $# -lt 4 ]; then - LOG_ERROR "CHECK_RESULT 参数不足" - exit 255 - fi - local actual=$1 - local expect=$2 - local mode=$3 - local msg=$4 - if [ $mode -eq 0 ]; then - if [ $actual -eq $expect ]; then - LOG_INFO "$msg 成功" - return 0 - else - LOG_ERROR "$msg 失败 (实际: $actual, 期望: $expect)" - exit $actual - fi - else - LOG_ERROR "不支持的 CHECK_RESULT 模式" - exit 255 - fi - } - - # 定义 SSH_CMD 函数(实际环境中可能已定义) - SSH_CMD() { - if [ $# -lt 4 ]; then - LOG_ERROR "SSH_CMD 参数不足" - exit 255 - fi - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - # 简单模拟,实际应使用 sshpass 或密钥 - LOG_INFO "在节点 $ip 上执行命令: $cmd" - # 此处为模拟,实际执行应替换为真实 ssh 命令 - return 0 - } - - # 测试用例描述:测试 metrics-logback 基础配置文件是否存在并可读 - LOG_INFO "开始测试: 检查 metrics-logback 基础配置文件是否存在并可读" - - # 步骤1: 检查是否已安装 metrics-logback - LOG_INFO "步骤1: 检查是否已安装 metrics-logback 软件包" - rpm -q metrics-logback > /dev/null 2>&1 - is_installed=$? - if [ $is_installed -eq 0 ]; then - LOG_INFO "metrics-logback 已安装,测试结束后将保持安装状态" - need_cleanup=0 - else - LOG_INFO "metrics-logback 未安装,将在测试前安装并在测试后卸载" - need_cleanup=1 - fi - - # 步骤2: 如果未安装,则安装 metrics-logback - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "步骤2: 安装 metrics-logback 软件包" - # 检查 yum 源中是否有该软件包 - dnf list available metrics-logback > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 metrics-logback 软件包" - exit 255 - fi - dnf install -y metrics-logback > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 metrics-logback 软件包" - fi - - # 步骤3: 检查配置文件是否存在 - LOG_INFO "步骤3: 检查 metrics-logback 配置文件是否存在" - config_file="/etc/metrics-logback/metrics-logback.xml" - if [ -f "$config_file" ]; then - LOG_INFO "配置文件 $config_file 存在" - else - LOG_ERROR "配置文件 $config_file 不存在" - exit 1 - fi - - # 步骤4: 检查配置文件是否可读 - LOG_INFO "步骤4: 检查 metrics-logback 配置文件是否可读" - if [ -r "$config_file" ]; then - LOG_INFO "配置文件 $config_file 可读" - else - LOG_ERROR "配置文件 $config_file 不可读" - exit 1 - fi - - # 步骤5: 可选步骤,如果有多节点,在第二个节点上执行相同检查 - # 假设存在第二个节点信息 - if [ -n "$NODE2_IPV4" ] && [ -n "$NODE2_PASSWORD" ] && [ -n "$NODE2_USER" ]; then - LOG_INFO "步骤5: 在第二个节点上检查 metrics-logback 配置文件" - SSH_CMD "test -f $config_file" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER" - CHECK_RESULT $? 0 0 "检查第二个节点配置文件是否存在" - SSH_CMD "test -r $config_file" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER" - CHECK_RESULT $? 0 0 "检查第二个节点配置文件是否可读" - else - LOG_INFO "步骤5: 未提供第二个节点信息,跳过多节点检查" - fi - - # 步骤6: 清理环境(如果测试前未安装,则卸载软件包) - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "步骤6: 卸载 metrics-logback 软件包以恢复环境" - dnf remove -y metrics-logback > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 metrics-logback 软件包" - else - LOG_INFO "步骤6: 测试前已安装 metrics-logback,保持安装状态,无需卸载" - fi - - LOG_INFO "测试完成: metrics-logback 基础配置文件检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_logging.sh b/testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_logging.sh deleted file mode 100644 index a8e454d60d4..00000000000 --- a/testcases/function_test/pkg_test/metrics/metrics-logback/test_metrics-logback_function_logging.sh +++ /dev/null @@ -1,71 +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 : 测试 metrics-logback 是否能正常输出应用日志。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 metrics-logback 是否能正常输出应用日志。" - - # 检查是否已安装 metrics-logback - LOG_INFO "步骤1:检查 metrics-logback 是否已安装。" - if rpm -q metrics-logback &>/dev/null; then - LOG_INFO "metrics-logback 已安装。" - INSTALLED=true - else - LOG_INFO "metrics-logback 未安装。" - INSTALLED=false - fi - - # 检查 yum 源中是否有 metrics-logback 软件包 - LOG_INFO "步骤2:检查 yum 源中是否有 metrics-logback 软件包。" - if ! dnf list metrics-logback &>/dev/null; then - LOG_ERROR "yum 源中未找到 metrics-logback 软件包。" - exit 255 - fi - - # 如果未安装,则安装 metrics-logback - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装 metrics-logback 软件包。" - dnf install -y metrics-logback - CHECK_RESULT $? 0 0 "安装 metrics-logback 失败。" - fi - - # 测试 metrics-logback 是否能正常输出应用日志 - LOG_INFO "步骤4:测试 metrics-logback 是否能正常输出应用日志。" - # 假设 metrics-logback 提供了一个测试命令或配置文件 - # 这里使用一个示例命令,实际应根据 metrics-logback 的具体情况调整 - TEST_COMMAND="metrics-logback --version" - if $TEST_COMMAND &>/dev/null; then - LOG_INFO "metrics-logback 能正常输出应用日志。" - else - LOG_ERROR "metrics-logback 无法正常输出应用日志。" - CHECK_RESULT $? 0 1 "metrics-logback 测试失败。" - fi - - # 环境恢复:如果之前未安装,则卸载 metrics-logback - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤5:卸载 metrics-logback 软件包。" - dnf remove -y metrics-logback - CHECK_RESULT $? 0 0 "卸载 metrics-logback 失败。" - fi - - LOG_INFO "测试完成。" -} - -main "$@" \ No newline at end of file From 3b27115532cd29e607a4d446af7ebe8de575e1d6 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 09:58:53 +0800 Subject: [PATCH 04/10] update testcase for testsuite elfutils --- .../pkg_test/elfutils/elfutils.json | 4 - .../test_elfutils_eu-strip_upper_f.sh | 86 ------------------- 2 files changed, 90 deletions(-) delete mode 100644 testcases/function_test/pkg_test/elfutils/elfutils/test_elfutils_eu-strip_upper_f.sh diff --git a/suite2cases/function_test/pkg_test/elfutils/elfutils.json b/suite2cases/function_test/pkg_test/elfutils/elfutils.json index 7c57fd18d11..b73ddfdee4a 100644 --- a/suite2cases/function_test/pkg_test/elfutils/elfutils.json +++ b/suite2cases/function_test/pkg_test/elfutils/elfutils.json @@ -507,10 +507,6 @@ "name": "test_elfutils_eu-stack_pid_v", "desc": "组合使用-p和-v选项查看指定进程的堆栈并显示所有详细信息" }, - { - "name": "test_elfutils_eu-strip_upper_f", - "desc": "测试使用-F参数将-f参数指定的文件名嵌入到输出文件中" - }, { "name": "test_elfutils_eu-unstrip_k", "desc": "测试使用 -k 参数,在运行中的内核里查找地址并尝试结合剥离文件与调试信息" diff --git a/testcases/function_test/pkg_test/elfutils/elfutils/test_elfutils_eu-strip_upper_f.sh b/testcases/function_test/pkg_test/elfutils/elfutils/test_elfutils_eu-strip_upper_f.sh deleted file mode 100644 index f077e5fec8a..00000000000 --- a/testcases/function_test/pkg_test/elfutils/elfutils/test_elfutils_eu-strip_upper_f.sh +++ /dev/null @@ -1,86 +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-10 -# @License : Mulan PSL v2 -# @Desc : 测试使用-F参数将-f参数指定的文件名嵌入到输出文件中 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试eu-strip命令的-F参数功能" - LOG_INFO "步骤1: 检查elfutils包是否已在yum源中" - if ! dnf list available elfutils &>/dev/null; then - LOG_ERROR "yum源中未找到elfutils软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查系统是否已安装elfutils" - if rpm -q elfutils &>/dev/null; then - LOG_INFO "elfutils已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "elfutils未安装,将在测试过程中安装" - INSTALLED=false - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3: 安装elfutils软件包" - dnf install -y elfutils - CHECK_RESULT $? 0 0 "安装elfutils失败" - fi - - LOG_INFO "步骤4: 检查eu-strip命令是否支持-F参数" - if ! eu-strip --help 2>&1 | grep -q "\-F"; then - LOG_ERROR "eu-strip命令不支持-F参数" - if [ "$INSTALLED" = "false" ]; then - dnf remove -y elfutils - fi - exit 255 - fi - - LOG_INFO "步骤5: 创建测试文件" - TEST_FILE="test_input" - TEST_OUTPUT="test_output" - echo "int main() { return 0; }" > test_source.c - gcc -o "$TEST_FILE" test_source.c - CHECK_RESULT $? 0 0 "编译测试文件失败" - - LOG_INFO "步骤6: 使用-F参数执行eu-strip命令" - eu-strip -f "$TEST_OUTPUT" -F "$TEST_FILE" "$TEST_FILE" - CHECK_RESULT $? 0 0 "eu-strip命令执行失败" - - LOG_INFO "步骤7: 验证输出文件是否包含指定文件名" - if [ -f "$TEST_OUTPUT" ]; then - LOG_INFO "输出文件创建成功" - # 这里可以添加更详细的验证逻辑,比如检查文件内容 - else - LOG_ERROR "输出文件未创建" - CHECK_RESULT 1 0 0 "输出文件验证失败" - fi - - LOG_INFO "步骤8: 清理临时文件" - rm -f test_source.c "$TEST_FILE" "$TEST_OUTPUT" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤9: 卸载elfutils软件包" - dnf remove -y elfutils - CHECK_RESULT $? 0 0 "卸载elfutils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 2ee82ee4cd8a1edaf6e8e7b3202b12df674586d4 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 10:01:21 +0800 Subject: [PATCH 05/10] update testcase for testsuite glassfish-jaxb-txw2 --- .../glassfish-jaxb/glassfish-jaxb-txw2.json | 16 ---- .../test_glassfish-jaxb-txw2_function_bind.sh | 65 ------------- ...st_glassfish-jaxb-txw2_function_marshal.sh | 92 ------------------- ..._glassfish-jaxb-txw2_function_unmarshal.sh | 83 ----------------- ...t_glassfish-jaxb-txw2_function_validate.sh | 71 -------------- 5 files changed, 327 deletions(-) delete mode 100644 testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_bind.sh delete mode 100644 testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_marshal.sh delete mode 100644 testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_unmarshal.sh delete mode 100644 testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_validate.sh diff --git a/suite2cases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2.json b/suite2cases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2.json index a6ac566207f..9f4af8fc501 100644 --- a/suite2cases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2.json +++ b/suite2cases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2.json @@ -6,22 +6,6 @@ "name": "test_glassfish-jaxb-txw2_install", "desc": "测试glassfish-jaxb-txw2软件包的安装功能,验证安装是否成功。", "machine num": 1 - }, - { - "name": "test_glassfish-jaxb-txw2_function_bind", - "desc": "测试glassfish-jaxb-txw2的数据绑定功能,验证是否能正确绑定数据。" - }, - { - "name": "test_glassfish-jaxb-txw2_function_unmarshal", - "desc": "测试glassfish-jaxb-txw2的解组功能,验证是否能正确解组XML数据。" - }, - { - "name": "test_glassfish-jaxb-txw2_function_marshal", - "desc": "测试glassfish-jaxb-txw2的编组功能,验证是否能正确编组对象为XML。" - }, - { - "name": "test_glassfish-jaxb-txw2_function_validate", - "desc": "测试glassfish-jaxb-txw2的验证功能,验证是否能正确验证XML数据。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_bind.sh b/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_bind.sh deleted file mode 100644 index 467f36f2dec..00000000000 --- a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_bind.sh +++ /dev/null @@ -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 : 2025-12-07 -# @License : Mulan PSL v2 -# @Desc : 测试glassfish-jaxb-txw2的数据绑定功能,验证是否能正确绑定数据。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试glassfish-jaxb-txw2的数据绑定功能,验证是否能正确绑定数据。" - - # 检查软件包是否已安装 - LOG_INFO "检查glassfish-jaxb-txw2软件包是否已安装..." - if dnf list installed glassfish-jaxb-txw2 &>/dev/null; then - LOG_INFO "glassfish-jaxb-txw2软件包已安装,测试完成后将保持安装状态。" - INSTALLED=true - else - LOG_INFO "glassfish-jaxb-txw2软件包未安装,将在测试完成后卸载。" - INSTALLED=false - fi - - # 检查yum源中是否存在该软件包 - LOG_INFO "检查yum源中是否存在glassfish-jaxb-txw2软件包..." - if ! dnf list available glassfish-jaxb-txw2 &>/dev/null; then - LOG_ERROR "yum源中不存在glassfish-jaxb-txw2软件包,退出测试。" - exit 255 - fi - - # 若未安装则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装glassfish-jaxb-txw2软件包..." - dnf install -y glassfish-jaxb-txw2 - CHECK_RESULT $? 0 0 "安装glassfish-jaxb-txw2软件包失败" - fi - - # 测试数据绑定功能 - LOG_INFO "测试glassfish-jaxb-txw2的数据绑定功能..." - # 假设使用命令`txw2-test`进行测试,具体命令根据实际调整 - txw2-test --bind-data sample.xml - CHECK_RESULT $? 0 0 "数据绑定功能测试失败" - - # 若之前未安装则卸载软件包以恢复环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载glassfish-jaxb-txw2软件包以恢复环境..." - dnf remove -y glassfish-jaxb-txw2 - CHECK_RESULT $? 0 0 "卸载glassfish-jaxb-txw2软件包失败" - fi - - LOG_INFO "glassfish-jaxb-txw2的数据绑定功能测试完成。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_marshal.sh b/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_marshal.sh deleted file mode 100644 index 98d678faf46..00000000000 --- a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_marshal.sh +++ /dev/null @@ -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 : 2025-12-07 -# @License : Mulan PSL v2 -# @Desc : 测试glassfish-jaxb-txw2的编组功能,验证是否能正确编组对象为XML。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查环境是否已安装glassfish-jaxb-txw2 - LOG_INFO "检查是否已安装glassfish-jaxb-txw2" - if dnf list installed glassfish-jaxb-txw2 &>/dev/null; then - LOG_INFO "glassfish-jaxb-txw2已安装" - installed=true - else - LOG_INFO "glassfish-jaxb-txw2未安装" - installed=false - fi - - # 检查yum源中是否存在glassfish-jaxb-txw2软件包 - LOG_INFO "检查yum源中是否存在glassfish-jaxb-txw2软件包" - if ! dnf list available glassfish-jaxb-txw2 &>/dev/null; then - LOG_ERROR "yum源中不存在glassfish-jaxb-txw2软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "开始安装glassfish-jaxb-txw2" - dnf install -y glassfish-jaxb-txw2 - CHECK_RESULT $? 0 0 "安装glassfish-jaxb-txw2失败" - fi - - # 验证编组功能 - LOG_INFO "测试glassfish-jaxb-txw2的编组功能" - cat > test_object.java < output.xml - CHECK_RESULT $? 0 0 "编组对象为XML失败" - - # 检查输出文件是否存在且非空 - LOG_INFO "检查输出文件output.xml" - if [ -s output.xml ]; then - LOG_INFO "编组成功,output.xml内容如下:" - cat output.xml - else - LOG_ERROR "编组失败,output.xml为空或不存在" - exit 1 - fi - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f test_object.java test_object.class output.xml - - # 如果脚本开始时未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载glassfish-jaxb-txw2" - dnf remove -y glassfish-jaxb-txw2 - CHECK_RESULT $? 0 0 "卸载glassfish-jaxb-txw2失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_unmarshal.sh b/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_unmarshal.sh deleted file mode 100644 index 27f39a1d131..00000000000 --- a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_unmarshal.sh +++ /dev/null @@ -1,83 +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-07 -# @License : Mulan PSL v2 -# @Desc : 测试glassfish-jaxb-txw2的解组功能,验证是否能正确解组XML数据。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试glassfish-jaxb-txw2的解组功能,验证是否能正确解组XML数据" - - # 检查软件包是否已安装 - LOG_INFO "检查glassfish-jaxb-txw2是否已安装" - if dnf list installed glassfish-jaxb-txw2 &>/dev/null; then - LOG_INFO "glassfish-jaxb-txw2已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "glassfish-jaxb-txw2未安装,将在测试完成后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在glassfish-jaxb-txw2 - LOG_INFO "检查yum源中是否存在glassfish-jaxb-txw2" - if ! dnf list available glassfish-jaxb-txw2 &>/dev/null; then - LOG_ERROR "yum源中不存在glassfish-jaxb-txw2" - exit 255 - fi - - # 安装glassfish-jaxb-txw2 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装glassfish-jaxb-txw2" - dnf install -y glassfish-jaxb-txw2 - CHECK_RESULT $? 0 0 "安装glassfish-jaxb-txw2失败" - fi - - # 准备测试XML数据 - LOG_INFO "准备测试XML数据" - TEST_XML="Test123" - echo "$TEST_XML" > test.xml - CHECK_RESULT $? 0 0 "创建测试XML文件失败" - - # 使用glassfish-jaxb-txw2解组XML数据 - LOG_INFO "使用glassfish-jaxb-txw2解组XML数据" - RESULT=$(java -cp $(rpm -ql glassfish-jaxb-txw2 | grep jaxb-impl.jar) TestUnmarshal test.xml) - CHECK_RESULT $? 0 0 "解组XML数据失败" - - # 验证解组结果是否符合预期 - LOG_INFO "验证解组结果是否符合预期" - EXPECTED="Test:123" - if [ "$RESULT" != "$EXPECTED" ]; then - LOG_ERROR "解组结果不符合预期: $RESULT" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.xml - CHECK_RESULT $? 0 0 "删除测试文件失败" - - # 如果初始未安装,则卸载glassfish-jaxb-txw2以恢复环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载glassfish-jaxb-txw2以恢复环境" - dnf remove -y glassfish-jaxb-txw2 - CHECK_RESULT $? 0 0 "卸载glassfish-jaxb-txw2失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_validate.sh b/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_validate.sh deleted file mode 100644 index 51f33dff0f9..00000000000 --- a/testcases/function_test/pkg_test/glassfish-jaxb/glassfish-jaxb-txw2/test_glassfish-jaxb-txw2_function_validate.sh +++ /dev/null @@ -1,71 +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-07 -# @License : Mulan PSL v2 -# @Desc : 测试glassfish-jaxb-txw2的验证功能,验证是否能正确验证XML数据。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在glassfish-jaxb-txw2软件包 - LOG_INFO "检查yum源中是否存在glassfish-jaxb-txw2软件包" - dnf list available glassfish-jaxb-txw2 > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在glassfish-jaxb-txw2软件包" - exit 255 - fi - - # 检查是否已安装glassfish-jaxb-txw2 - LOG_INFO "检查是否已安装glassfish-jaxb-txw2" - rpm -q glassfish-jaxb-txw2 > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "glassfish-jaxb-txw2已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "glassfish-jaxb-txw2未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 安装glassfish-jaxb-txw2 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装glassfish-jaxb-txw2" - dnf install -y glassfish-jaxb-txw2 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装glassfish-jaxb-txw2失败" - fi - - # 验证XML数据功能测试 - LOG_INFO "开始验证glassfish-jaxb-txw2的XML数据验证功能" - TEST_XML="value" - echo "$TEST_XML" > test.xml - jaxb-validate test.xml > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "XML数据验证失败" - - # 清理测试文件 - rm -f test.xml - - # 恢复环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载glassfish-jaxb-txw2以恢复环境" - dnf remove -y glassfish-jaxb-txw2 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载glassfish-jaxb-txw2失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file From 7097a90127391bc43bbc4dae6f5036261ecb2afb Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 10:07:40 +0800 Subject: [PATCH 06/10] update testcase for testsuite libtevent-help --- .../pkg_test/libtevent/libtevent-help.json | 28 ---- ...t_libtevent-help_function_basic_install.sh | 75 --------- ...st_libtevent-help_function_check_status.sh | 74 --------- ...btevent-help_function_install_reinstall.sh | 67 -------- ...libtevent-help_function_install_upgrade.sh | 111 ------------- ...libtevent-help_function_provide_service.sh | 152 ------------------ ...st_libtevent-help_function_remove_purge.sh | 79 --------- ...libtevent-help_function_verify_checksum.sh | 77 --------- 8 files changed, 663 deletions(-) delete mode 100644 testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_basic_install.sh delete mode 100644 testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_check_status.sh delete mode 100644 testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_reinstall.sh delete mode 100644 testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_upgrade.sh delete mode 100644 testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_provide_service.sh delete mode 100644 testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_remove_purge.sh delete mode 100644 testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_verify_checksum.sh diff --git a/suite2cases/function_test/pkg_test/libtevent/libtevent-help.json b/suite2cases/function_test/pkg_test/libtevent/libtevent-help.json index d5f76b1bcf6..630cacacd48 100644 --- a/suite2cases/function_test/pkg_test/libtevent/libtevent-help.json +++ b/suite2cases/function_test/pkg_test/libtevent/libtevent-help.json @@ -26,37 +26,9 @@ "name": "test_libtevent-help_function_integrity", "desc": "Test package file integrity" }, - { - "name": "test_libtevent-help_function_basic_install", - "desc": "Test basic installation of the package" - }, - { - "name": "test_libtevent-help_function_install_upgrade", - "desc": "Test upgrade installation" - }, - { - "name": "test_libtevent-help_function_install_reinstall", - "desc": "Test reinstall package" - }, - { - "name": "test_libtevent-help_function_remove_purge", - "desc": "Test purge removal of package" - }, { "name": "test_libtevent-help_function_query_files", "desc": "Test query package files" - }, - { - "name": "test_libtevent-help_function_check_status", - "desc": "Test check package status" - }, - { - "name": "test_libtevent-help_function_verify_checksum", - "desc": "Test verify package checksum" - }, - { - "name": "test_libtevent-help_function_provide_service", - "desc": "Test service provided by package" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_basic_install.sh b/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_basic_install.sh deleted file mode 100644 index 6208a42998d..00000000000 --- a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_basic_install.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 : 2026-04-06 -# @License : Mulan PSL v2 -# @Desc : Test basic installation of the package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "测试开始:测试libtevent-help-function软件包的基本安装功能" - - # 检查软件包是否已在yum源中 - LOG_INFO "步骤1:检查yum源中是否存在libtevent-help-function软件包" - if ! dnf list available libtevent-help-function 2>/dev/null | grep -q libtevent-help-function; then - LOG_ERROR "yum源中未找到libtevent-help-function软件包" - exit 255 - fi - - # 检查当前是否已安装软件包 - LOG_INFO "步骤2:检查当前环境是否已安装libtevent-help-function软件包" - if rpm -q libtevent-help-function &>/dev/null; then - already_installed=true - LOG_INFO "软件包已安装,脚本结束时将保持安装状态" - else - already_installed=false - LOG_INFO "软件包未安装,将在测试步骤中安装" - fi - - # 安装软件包(如果未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装libtevent-help-function软件包" - dnf install -y libtevent-help-function - CHECK_RESULT $? 0 0 "安装libtevent-help-function软件包失败" - fi - - # 验证软件包安装成功 - LOG_INFO "步骤4:验证软件包安装成功" - rpm -q libtevent-help-function - CHECK_RESULT $? 0 0 "验证libtevent-help-function软件包安装状态失败" - - # 测试软件包基本功能 - LOG_INFO "步骤5:测试libtevent-help-function软件包基本功能" - if command -v libtevent-help-function &>/dev/null; then - LOG_INFO "软件包基本功能正常" - else - LOG_ERROR "软件包基本功能异常" - exit 1 - fi - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤6:清理环境,卸载libtevent-help-function软件包" - dnf remove -y libtevent-help-function - CHECK_RESULT $? 0 0 "卸载libtevent-help-function软件包失败" - fi - - LOG_INFO "测试结束:libtevent-help-function软件包基本安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_check_status.sh b/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_check_status.sh deleted file mode 100644 index 35e46245d67..00000000000 --- a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_check_status.sh +++ /dev/null @@ -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 : 2026-04-06 -# @License : Mulan PSL v2 -# @Desc : Test check package status -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查包状态功能测试" - - # 检查是否已安装libtevent-help包 - LOG_INFO "步骤1:检查libtevent-help包是否已安装" - if rpm -q libtevent-help &> /dev/null; then - LOG_INFO "libtevent-help包已安装,标记为已安装状态" - INSTALLED=true - else - LOG_INFO "libtevent-help包未安装,标记为未安装状态" - INSTALLED=false - fi - - # 检查yum源中是否有libtevent-help包 - LOG_INFO "步骤2:检查yum源中是否有libtevent-help包" - if ! dnf list available libtevent-help &> /dev/null; then - LOG_ERROR "yum源中未找到libtevent-help包" - exit 255 - fi - - # 如果未安装,则安装libtevent-help包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装libtevent-help包" - dnf install -y libtevent-help - CHECK_RESULT $? 0 0 "安装libtevent-help包失败" - fi - - # 测试check package status命令 - LOG_INFO "步骤4:测试check package status命令" - # 假设check package status命令为libtevent-help --check-status - if ! libtevent-help --help | grep -q "check-status"; then - LOG_ERROR "libtevent-help命令不支持--check-status参数" - exit 255 - fi - - # 执行check package status命令 - LOG_INFO "步骤5:执行check package status命令" - libtevent-help --check-status - CHECK_RESULT $? 0 0 "check package status命令执行失败" - - # 清理环境:如果测试前未安装,则卸载包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤6:清理环境,卸载libtevent-help包" - dnf remove -y libtevent-help - CHECK_RESULT $? 0 0 "卸载libtevent-help包失败" - else - LOG_INFO "步骤6:保持libtevent-help包安装状态" - fi - - LOG_INFO "测试完成:检查包状态功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_reinstall.sh b/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_reinstall.sh deleted file mode 100644 index 4d89c4fbd26..00000000000 --- a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_reinstall.sh +++ /dev/null @@ -1,67 +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-04-06 -# @License : Mulan PSL v2 -# @Desc : Test reinstall package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:Test reinstall package" - - LOG_INFO "步骤1:检查libtevent-help-function软件包是否在yum源中" - dnf list available libtevent-help-function &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "libtevent-help-function软件包不在yum源中" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境中是否已安装libtevent-help-function软件包" - rpm -q libtevent-help-function &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "环境中已安装libtevent-help-function,标记为已安装状态" - INSTALLED_BEFORE="true" - else - LOG_INFO "环境中未安装libtevent-help-function,标记为未安装状态" - INSTALLED_BEFORE="false" - fi - - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤3:安装libtevent-help-function软件包" - dnf install -y libtevent-help-function - CHECK_RESULT $? 0 0 "安装libtevent-help-function软件包失败" - fi - - LOG_INFO "步骤4:重新安装libtevent-help-function软件包" - dnf reinstall -y libtevent-help-function - CHECK_RESULT $? 0 0 "重新安装libtevent-help-function软件包失败" - - LOG_INFO "步骤5:验证libtevent-help-function软件包是否安装成功" - rpm -q libtevent-help-function &>/dev/null - CHECK_RESULT $? 0 0 "libtevent-help-function软件包安装验证失败" - - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤6:清理环境,卸载之前未安装的libtevent-help-function软件包" - dnf remove -y libtevent-help-function - CHECK_RESULT $? 0 0 "卸载libtevent-help-function软件包失败" - else - LOG_INFO "步骤6:环境已安装libtevent-help-function,保持安装状态,无需卸载" - fi - - LOG_INFO "测试完成:Test reinstall package" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_upgrade.sh b/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_upgrade.sh deleted file mode 100644 index 13069a2d945..00000000000 --- a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_install_upgrade.sh +++ /dev/null @@ -1,111 +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-04-06 -# @License : Mulan PSL v2 -# @Desc : Test upgrade installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 检查软件包是否在yum源中 - function check_package_in_repo() { - local pkg=$1 - LOG_INFO "检查yum源中是否存在软件包: $pkg" - if dnf list available "$pkg" &>/dev/null; then - LOG_INFO "软件包 $pkg 存在于yum源中" - return 0 - else - LOG_ERROR "软件包 $pkg 不存在于yum源中" - exit 255 - fi - } - - # 检查命令参数是否支持 - function check_command_option() { - local cmd=$1 - local option=$2 - LOG_INFO "检查命令 $cmd 是否支持参数 $option" - if $cmd --help 2>&1 | grep -q -- "$option"; then - LOG_INFO "命令 $cmd 支持参数 $option" - return 0 - else - LOG_ERROR "命令 $cmd 不支持参数 $option" - exit 255 - fi - } - - # 主测试函数 - function test_upgrade_installation() { - local pkg_name="libtevent-help-function" - local install_state="uninstalled" - - LOG_INFO "=== 开始测试: Test upgrade installation ===" - - # 步骤1: 检查当前环境是否已安装软件包 - LOG_INFO "步骤1: 检查当前环境是否已安装软件包 $pkg_name" - if rpm -q "$pkg_name" &>/dev/null; then - LOG_INFO "软件包 $pkg_name 已安装" - install_state="installed" - else - LOG_INFO "软件包 $pkg_name 未安装" - fi - - # 步骤2: 检查yum源中是否存在软件包 - LOG_INFO "步骤2: 检查yum源中是否存在软件包 $pkg_name" - check_package_in_repo "$pkg_name" - - # 步骤3: 检查dnf命令的upgrade参数是否支持 - LOG_INFO "步骤3: 检查dnf命令是否支持upgrade参数" - check_command_option "dnf" "upgrade" - - # 步骤4: 如果未安装,则安装软件包 - if [ "$install_state" = "uninstalled" ]; then - LOG_INFO "步骤4: 安装软件包 $pkg_name" - dnf install -y "$pkg_name" - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤5: 执行升级安装测试 - LOG_INFO "步骤5: 执行升级安装测试" - dnf upgrade -y "$pkg_name" - CHECK_RESULT $? 0 0 "升级安装失败" - - # 步骤6: 验证升级后软件包状态 - LOG_INFO "步骤6: 验证升级后软件包状态" - rpm -q "$pkg_name" - CHECK_RESULT $? 0 0 "升级后软件包状态异常" - - # 步骤7: 清理环境 - LOG_INFO "步骤7: 清理环境" - if [ "$install_state" = "uninstalled" ]; then - LOG_INFO "卸载测试安装的软件包 $pkg_name" - dnf remove -y "$pkg_name" - CHECK_RESULT $? 0 0 "卸载软件包失败" - LOG_INFO "环境已恢复到未安装状态" - else - LOG_INFO "保持原有安装状态,无需卸载" - fi - - LOG_INFO "=== 测试完成: Test upgrade installation ===" - } - - # 执行测试 - test_upgrade_installation -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_provide_service.sh b/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_provide_service.sh deleted file mode 100644 index f72b47d718d..00000000000 --- a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_provide_service.sh +++ /dev/null @@ -1,152 +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-04-06 -# @License : Mulan PSL v2 -# @Desc : Test service provided by package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试libtevent-help-function-provide-service服务 - LOG_INFO "开始测试libtevent-help-function-provide-service服务" - - # 定义软件包名称 - PACKAGE_NAME="libtevent-help-function-provide-service" - - # 步骤1:检查软件包是否已在yum源中 - LOG_INFO "步骤1:检查软件包是否在yum源中" - dnf list available ${PACKAGE_NAME} 2>/dev/null | grep -q ${PACKAGE_NAME} - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中" - exit 255 - fi - LOG_INFO "软件包 ${PACKAGE_NAME} 在yum源中" - - # 步骤2:检查当前是否已安装软件包 - LOG_INFO "步骤2:检查当前是否已安装软件包" - rpm -q ${PACKAGE_NAME} >/dev/null 2>&1 - if [ $? -eq 0 ]; then - ALREADY_INSTALLED=true - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装" - else - ALREADY_INSTALLED=false - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "${ALREADY_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:检查软件包提供的服务" - # 假设软件包提供tevent-help-function服务 - SERVICE_NAME="tevent-help-function" - - # 检查服务是否存在 - systemctl list-unit-files | grep -q ${SERVICE_NAME}.service - CHECK_RESULT $? 0 0 "服务 ${SERVICE_NAME} 不存在" - - # 步骤5:检查服务状态 - LOG_INFO "步骤5:检查服务状态" - systemctl status ${SERVICE_NAME} >/dev/null 2>&1 - # 服务可能未运行,所以不检查具体状态,只检查命令执行是否成功 - CHECK_RESULT $? 0 1 "检查服务状态失败" - - # 步骤6:测试服务启动 - LOG_INFO "步骤6:测试服务启动" - systemctl start ${SERVICE_NAME} - CHECK_RESULT $? 0 0 "启动服务 ${SERVICE_NAME} 失败" - LOG_INFO "服务 ${SERVICE_NAME} 启动成功" - - # 步骤7:检查服务运行状态 - LOG_INFO "步骤7:检查服务运行状态" - systemctl is-active ${SERVICE_NAME} - CHECK_RESULT $? 0 0 "服务 ${SERVICE_NAME} 未运行" - - # 步骤8:测试服务停止 - LOG_INFO "步骤8:测试服务停止" - systemctl stop ${SERVICE_NAME} - CHECK_RESULT $? 0 0 "停止服务 ${SERVICE_NAME} 失败" - LOG_INFO "服务 ${SERVICE_NAME} 停止成功" - - # 步骤9:测试服务重启 - LOG_INFO "步骤9:测试服务重启" - systemctl restart ${SERVICE_NAME} - CHECK_RESULT $? 0 0 "重启服务 ${SERVICE_NAME} 失败" - LOG_INFO "服务 ${SERVICE_NAME} 重启成功" - - # 步骤10:测试服务重载配置 - LOG_INFO "步骤10:测试服务重载配置" - systemctl reload ${SERVICE_NAME} 2>/dev/null - # reload可能不支持,所以允许失败 - if [ $? -ne 0 ]; then - LOG_INFO "服务 ${SERVICE_NAME} 不支持reload操作" - fi - - # 步骤11:检查服务是否开机自启 - LOG_INFO "步骤11:检查服务是否支持开机自启" - systemctl is-enabled ${SERVICE_NAME} 2>/dev/null - # 服务可能未设置开机自启,所以允许失败 - if [ $? -ne 0 ]; then - LOG_INFO "服务 ${SERVICE_NAME} 未设置开机自启" - fi - - # 步骤12:测试服务提供的命令(假设服务提供tevent-help命令) - LOG_INFO "步骤12:测试服务提供的命令" - # 检查命令是否存在 - which tevent-help >/dev/null 2>&1 - if [ $? -eq 0 ]; then - # 测试命令执行 - tevent-help --help >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "执行tevent-help --help失败" - LOG_INFO "tevent-help命令测试成功" - else - LOG_INFO "tevent-help命令不存在,跳过命令测试" - fi - - # 步骤13:清理环境 - LOG_INFO "步骤13:清理测试环境" - # 停止服务 - systemctl stop ${SERVICE_NAME} 2>/dev/null - - # 如果测试前未安装,则卸载软件包 - if [ "${ALREADY_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 - - # 步骤14:验证环境已恢复 - LOG_INFO "步骤14:验证环境已恢复" - if [ "${ALREADY_INSTALLED}" = "false" ]; then - rpm -q ${PACKAGE_NAME} >/dev/null 2>&1 - CHECK_RESULT $? 1 0 "环境恢复失败,软件包 ${PACKAGE_NAME} 仍存在" - else - rpm -q ${PACKAGE_NAME} >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "环境恢复失败,软件包 ${PACKAGE_NAME} 不存在" - fi - - LOG_INFO "libtevent-help-function-provide-service服务测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_remove_purge.sh b/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_remove_purge.sh deleted file mode 100644 index d6b22eccbe0..00000000000 --- a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_remove_purge.sh +++ /dev/null @@ -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-04-06 -# @License : Mulan PSL v2 -# @Desc : Test purge removal of package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test purge removal of package" - LOG_INFO "步骤1:检查yum源中是否存在libtevent-help软件包" - dnf list available libtevent-help 2>/dev/null | grep -q libtevent-help - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到libtevent-help软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境中是否已安装libtevent-help" - rpm -q libtevent-help > /dev/null 2>&1 - INSTALLED=$? - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "环境中已安装libtevent-help,测试后将保持安装状态" - INITIAL_STATE="installed" - else - LOG_INFO "环境中未安装libtevent-help,测试前将进行安装" - INITIAL_STATE="not_installed" - fi - - LOG_INFO "步骤3:若未安装,则安装libtevent-help软件包" - if [ "$INITIAL_STATE" = "not_installed" ]; then - dnf install -y libtevent-help - CHECK_RESULT $? 0 0 "安装libtevent-help失败" - LOG_INFO "libtevent-help安装成功" - fi - - LOG_INFO "步骤4:测试purge参数(如果支持)" - LOG_INFO "检查libtevent-help命令是否支持--purge参数" - libtevent-help --help 2>&1 | grep -q -- "--purge" - if [ $? -ne 0 ]; then - LOG_ERROR "libtevent-help命令不支持--purge参数" - exit 255 - fi - - LOG_INFO "执行libtevent-help --purge命令" - libtevent-help --purge - CHECK_RESULT $? 0 0 "执行libtevent-help --purge失败" - - LOG_INFO "步骤5:验证purge操作后的状态(根据实际命令功能设计检查点)" - LOG_INFO "此处应根据libtevent-help --purge的实际功能添加验证逻辑" - LOG_INFO "例如:检查某个配置文件是否被删除,或服务状态是否改变" - LOG_INFO "当前为示例,假设验证成功" - - LOG_INFO "步骤6:环境恢复" - if [ "$INITIAL_STATE" = "not_installed" ]; then - LOG_INFO "卸载测试安装的libtevent-help软件包" - dnf remove -y libtevent-help - CHECK_RESULT $? 0 0 "卸载libtevent-help失败" - LOG_INFO "libtevent-help卸载成功,环境已恢复" - else - LOG_INFO "测试前已安装libtevent-help,保持安装状态,无需卸载" - fi - - LOG_INFO "测试完成:Test purge removal of package" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_verify_checksum.sh b/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_verify_checksum.sh deleted file mode 100644 index c435152c502..00000000000 --- a/testcases/function_test/pkg_test/libtevent/libtevent-help/test_libtevent-help_function_verify_checksum.sh +++ /dev/null @@ -1,77 +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-04-06 -# @License : Mulan PSL v2 -# @Desc : Test verify package checksum -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:Test verify package checksum" - - LOG_INFO "步骤1:检查libtevent-help软件包是否已在yum源中" - if ! dnf list available libtevent-help 2>/dev/null | grep -q "libtevent-help"; then - LOG_ERROR "yum源中未找到libtevent-help软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装libtevent-help" - if rpm -q libtevent-help &>/dev/null; then - LOG_INFO "libtevent-help已安装,记录安装状态" - INSTALLED="yes" - else - LOG_INFO "libtevent-help未安装,将在测试步骤中安装" - INSTALLED="no" - fi - - if [[ "$INSTALLED" == "no" ]]; then - LOG_INFO "步骤3:安装libtevent-help软件包" - dnf install -y libtevent-help - CHECK_RESULT $? 0 0 "安装libtevent-help失败" - fi - - LOG_INFO "步骤4:检查verify-checksum命令是否存在" - if ! command -v verify-checksum &>/dev/null; then - LOG_ERROR "verify-checksum命令不存在" - exit 255 - fi - - LOG_INFO "步骤5:检查verify-checksum命令是否支持--help参数" - if ! verify-checksum --help &>/dev/null; then - LOG_ERROR "verify-checksum命令不支持--help参数" - exit 255 - fi - - LOG_INFO "步骤6:执行verify-checksum --help命令" - verify-checksum --help - CHECK_RESULT $? 0 0 "执行verify-checksum --help失败" - - LOG_INFO "步骤7:验证软件包完整性" - verify-checksum - CHECK_RESULT $? 0 0 "验证软件包完整性失败" - - if [[ "$INSTALLED" == "no" ]]; then - LOG_INFO "步骤8:卸载libtevent-help软件包" - dnf remove -y libtevent-help - CHECK_RESULT $? 0 0 "卸载libtevent-help失败" - fi - - LOG_INFO "测试完成:Test verify package checksum" -} - -main "$@" \ No newline at end of file From 20f0248af795542fd7e458d8f2435be66a3f363f Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 10:08:57 +0800 Subject: [PATCH 07/10] update testcase for testsuite texlive-compare --- .../texlive-split-x/texlive-compare.json | 16 --- .../test_texlive-compare_function_compare.sh | 113 ------------------ ...est_texlive-compare_function_dependency.sh | 91 -------------- .../test_texlive-compare_function_help.sh | 83 ------------- .../test_texlive-compare_function_version.sh | 109 ----------------- 5 files changed, 412 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_compare.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_dependency.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_help.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_version.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-compare.json b/suite2cases/function_test/pkg_test/texlive-split-x/texlive-compare.json index f20dda39ef0..dce9058339f 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-compare.json +++ b/suite2cases/function_test/pkg_test/texlive-split-x/texlive-compare.json @@ -13,22 +13,6 @@ { "name": "test_texlive-compare_function_basic", "desc": "Test basic command usage" - }, - { - "name": "test_texlive-compare_function_compare", - "desc": "Test compare command" - }, - { - "name": "test_texlive-compare_function_version", - "desc": "Test version info" - }, - { - "name": "test_texlive-compare_function_help", - "desc": "Test help info" - }, - { - "name": "test_texlive-compare_function_dependency", - "desc": "Test dependency check" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_compare.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_compare.sh deleted file mode 100644 index 908a8b67ecd..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_compare.sh +++ /dev/null @@ -1,113 +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-20 -# @License : Mulan PSL v2 -# @Desc : Test compare command -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装了texlive-compare软件包 - LOG_INFO "检查是否已经安装了texlive-compare软件包" - rpm -q texlive-compare > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到texlive-compare已经安装,脚本结束后将保持安装状态" - already_installed=1 - else - LOG_INFO "texlive-compare未安装,将在测试过程中安装" - already_installed=0 - fi - - # 检查yum源中是否有texlive-compare软件包 - LOG_INFO "检查yum源中是否有texlive-compare软件包" - dnf list available texlive-compare > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有texlive-compare软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有texlive-compare软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-compare - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装texlive-compare软件包" - dnf install -y texlive-compare - CHECK_RESULT $? 0 0 "安装texlive-compare失败" - fi - - # 测试compare命令的基本功能 - LOG_INFO "测试compare命令的基本功能" - compare --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "compare命令不存在或不支持" - - # 创建测试文件 - LOG_INFO "创建测试文件用于compare命令测试" - cat > test_file1.tex << EOF - \documentclass{article} - \begin{document} - Hello World! - \end{document} - EOF - - cat > test_file2.tex << EOF - \documentclass{article} - \begin{document} - Hello OpenEuler! - \end{document} - EOF - - # 使用compare命令比较两个文件 - LOG_INFO "使用compare命令比较两个TeX文件" - compare test_file1.tex test_file2.tex > compare_output.txt 2>&1 - CHECK_RESULT $? 0 0 "compare命令执行失败" - - # 检查compare命令输出结果 - LOG_INFO "检查compare命令输出结果" - if [ -s compare_output.txt ]; then - LOG_INFO "compare命令成功检测到文件差异" - CHECK_RESULT 0 0 0 "compare命令输出检查" - else - LOG_ERROR "compare命令没有检测到文件差异" - CHECK_RESULT 1 0 0 "compare命令输出检查" - fi - - # 测试compare命令的不支持的参数 - LOG_INFO "测试compare命令的不支持的参数" - compare --invalid-param test_file1.tex test_file2.tex > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_INFO "compare命令正确处理了不支持参数的情况" - CHECK_RESULT 0 0 0 "不支持参数测试" - else - LOG_ERROR "compare命令没有正确处理不支持参数" - exit 255 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_file1.tex test_file2.tex compare_output.txt - - # 如果测试开始时未安装,则在测试结束后卸载 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载texlive-compare软件包" - dnf remove -y texlive-compare - CHECK_RESULT $? 0 0 "卸载texlive-compare失败" - else - LOG_INFO "测试开始时已安装texlive-compare,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_dependency.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_dependency.sh deleted file mode 100644 index ec2f057b087..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_dependency.sh +++ /dev/null @@ -1,91 +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-20 -# @License : Mulan PSL v2 -# @Desc : Test dependency check -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否以root用户运行 - if [[ $(id -u) -ne 0 ]]; then - LOG_ERROR "此脚本需要root权限运行" - exit 1 - fi - - # 定义软件包名称 - PACKAGE_NAME="texlive-compare" - - # 步骤1:检查环境是否已安装该软件包 - LOG_INFO "步骤1:检查环境是否已安装 ${PACKAGE_NAME} 软件包" - rpm -q ${PACKAGE_NAME} > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - LOG_INFO "${PACKAGE_NAME} 已安装,脚本结束将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "${PACKAGE_NAME} 未安装,将在测试后卸载" - ALREADY_INSTALLED=0 - fi - - # 步骤2:检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否有 ${PACKAGE_NAME} 软件包" - dnf list available ${PACKAGE_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到 ${PACKAGE_NAME} 软件包" - if [[ $? -ne 0 ]]; then - LOG_ERROR "yum源中未找到 ${PACKAGE_NAME} 软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装软件包 - if [[ ${ALREADY_INSTALLED} -eq 0 ]]; then - LOG_INFO "步骤3:安装 ${PACKAGE_NAME} 软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装 ${PACKAGE_NAME} 失败" - fi - - # 步骤4:测试依赖检查功能 - LOG_INFO "步骤4:测试依赖检查功能" - # 检查texlive-compare命令是否支持依赖检查参数 - texlive-compare --help 2>&1 | grep -q "dependency" - if [[ $? -ne 0 ]]; then - LOG_ERROR "texlive-compare命令不支持依赖检查参数" - # 清理环境 - if [[ ${ALREADY_INSTALLED} -eq 0 ]]; then - LOG_INFO "清理环境:卸载 ${PACKAGE_NAME} 软件包" - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 执行依赖检查 - LOG_INFO "执行texlive-compare依赖检查" - texlive-compare --check-dependencies - CHECK_RESULT $? 0 0 "依赖检查失败" - - # 步骤5:清理环境 - LOG_INFO "步骤5:清理环境" - if [[ ${ALREADY_INSTALLED} -eq 0 ]]; then - LOG_INFO "卸载 ${PACKAGE_NAME} 软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载 ${PACKAGE_NAME} 失败" - else - LOG_INFO "${PACKAGE_NAME} 原本已安装,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_help.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_help.sh deleted file mode 100644 index 76614b9a982..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_help.sh +++ /dev/null @@ -1,83 +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-20 -# @License : Mulan PSL v2 -# @Desc : Test help info -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:Test help info" - LOG_INFO "步骤1:检查yum源中是否存在texlive-compare软件包" - if ! dnf list available texlive-compare &>/dev/null; then - LOG_ERROR "yum源中不存在texlive-compare软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已安装texlive-compare" - if rpm -q texlive-compare &>/dev/null; then - LOG_INFO "texlive-compare已安装,标记为保持安装状态" - keep_installed=true - else - LOG_INFO "texlive-compare未安装,标记为需要卸载" - keep_installed=false - fi - - if [ "$keep_installed" = false ]; then - LOG_INFO "步骤3:安装texlive-compare软件包" - dnf install -y texlive-compare - CHECK_RESULT $? 0 0 "安装texlive-compare失败" - fi - - LOG_INFO "步骤4:执行texlive-compare --help命令" - texlive-compare --help &>/tmp/help_output.txt - help_exit_code=$? - if [ $help_exit_code -eq 0 ]; then - LOG_INFO "texlive-compare --help命令执行成功" - if grep -q "用法\|用法说明\|Usage\|SYNOPSIS" /tmp/help_output.txt; then - LOG_INFO "帮助信息包含预期关键字" - else - LOG_ERROR "帮助信息不包含预期关键字" - CHECK_RESULT 1 0 0 "帮助信息内容检查失败" - fi - else - if [ $help_exit_code -eq 255 ]; then - LOG_ERROR "texlive-compare命令不支持--help参数" - exit 255 - else - LOG_ERROR "texlive-compare --help命令执行失败,退出码: $help_exit_code" - exit $help_exit_code - fi - fi - - LOG_INFO "步骤5:清理临时文件" - rm -f /tmp/help_output.txt - - LOG_INFO "步骤6:环境恢复" - if [ "$keep_installed" = false ]; then - LOG_INFO "卸载texlive-compare软件包" - dnf remove -y texlive-compare - CHECK_RESULT $? 0 0 "卸载texlive-compare失败" - else - LOG_INFO "保持texlive-compare安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_version.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_version.sh deleted file mode 100644 index d2a6d59d0a3..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-compare/test_texlive-compare_function_version.sh +++ /dev/null @@ -1,109 +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-20 -# @License : Mulan PSL v2 -# @Desc : Test version info -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试版本信息 - LOG_INFO "开始测试texlive-compare的版本信息功能" - - # 检查环境是否已安装texlive-compare - LOG_INFO "检查texlive-compare是否已安装" - if rpm -q texlive-compare &>/dev/null; then - LOG_INFO "检测到texlive-compare已安装" - already_installed=true - else - LOG_INFO "未检测到texlive-compare安装" - already_installed=false - fi - - # 检查yum源中是否有texlive-compare软件包 - LOG_INFO "检查yum源中是否有texlive-compare软件包" - dnf list available texlive-compare &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-compare软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-compare - if [ "$already_installed" = false ]; then - LOG_INFO "开始安装texlive-compare" - dnf install -y texlive-compare - CHECK_RESULT $? 0 0 "安装texlive-compare失败" - LOG_INFO "texlive-compare安装成功" - fi - - # 测试texlive-compare命令是否存在 - LOG_INFO "检查texlive-compare命令是否存在" - which texlive-compare &>/dev/null - CHECK_RESULT $? 0 0 "texlive-compare命令不存在" - - # 测试version参数 - LOG_INFO "测试texlive-compare --version参数" - texlive-compare --version &>/dev/null - CHECK_RESULT $? 0 0 "texlive-compare --version参数不支持" - - # 测试-V参数 - LOG_INFO "测试texlive-compare -V参数" - texlive-compare -V &>/dev/null - CHECK_RESULT $? 0 0 "texlive-compare -V参数不支持" - - # 测试version参数返回的版本信息格式 - LOG_INFO "验证版本信息格式" - version_output=$(texlive-compare --version 2>/dev/null | head -1) - if echo "$version_output" | grep -q "texlive-compare"; then - LOG_INFO "版本信息格式正确: $version_output" - CHECK_RESULT $? 0 0 "版本信息格式不正确" - else - LOG_ERROR "版本信息格式不正确: $version_output" - CHECK_RESULT $? 1 0 "版本信息格式验证失败" - fi - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数应返回错误" - texlive-compare --invalid-param &>/dev/null - if [ $? -eq 255 ]; then - LOG_INFO "不支持的参数正确处理,返回退出码255" - CHECK_RESULT $? 255 0 "不支持的参数处理不正确" - else - # 如果不是255退出码,检查是否是非零退出码 - if [ $? -ne 0 ]; then - LOG_INFO "不支持的参数返回错误退出码" - CHECK_RESULT $? 0 0 "不支持的参数处理正确" - else - LOG_ERROR "不支持的参数应该返回错误但执行成功" - CHECK_RESULT $? 1 0 "不支持的参数处理不正确" - fi - fi - - # 环境清理 - LOG_INFO "开始环境清理" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载测试安装的texlive-compare" - dnf remove -y texlive-compare - CHECK_RESULT $? 0 0 "卸载texlive-compare失败" - LOG_INFO "texlive-compare卸载成功" - else - LOG_INFO "保持原有texlive-compare安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 114875efc5d2efc7a2b52073072a442085690cf5 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 10:09:05 +0800 Subject: [PATCH 08/10] update testcase for testsuite uboot-tools-help --- .../uboot-tools/uboot-tools-help.json | 4 - .../test_uboot-tools-help_function_help.sh | 80 ------------------- 2 files changed, 84 deletions(-) delete mode 100644 testcases/function_test/pkg_test/uboot-tools/uboot-tools-help/test_uboot-tools-help_function_help.sh diff --git a/suite2cases/function_test/pkg_test/uboot-tools/uboot-tools-help.json b/suite2cases/function_test/pkg_test/uboot-tools/uboot-tools-help.json index 99df3eaa86d..cbb9fe40926 100644 --- a/suite2cases/function_test/pkg_test/uboot-tools/uboot-tools-help.json +++ b/suite2cases/function_test/pkg_test/uboot-tools/uboot-tools-help.json @@ -10,10 +10,6 @@ "name": "test_uboot-tools-help_function_check", "desc": "测试检查软件包uboot-tools-help是否已安装,验证包管理器的查询功能。" }, - { - "name": "test_uboot-tools-help_function_help", - "desc": "测试软件包uboot-tools-help提供的帮助信息,验证能否正确输出帮助内容。" - }, { "name": "test_uboot-tools-help_function_uninstall", "desc": "测试软件包uboot-tools-help的卸载功能,验证能否从系统中完全移除。" diff --git a/testcases/function_test/pkg_test/uboot-tools/uboot-tools-help/test_uboot-tools-help_function_help.sh b/testcases/function_test/pkg_test/uboot-tools/uboot-tools-help/test_uboot-tools-help_function_help.sh deleted file mode 100644 index 960003acd26..00000000000 --- a/testcases/function_test/pkg_test/uboot-tools/uboot-tools-help/test_uboot-tools-help_function_help.sh +++ /dev/null @@ -1,80 +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 : 测试软件包uboot-tools-help提供的帮助信息,验证能否正确输出帮助内容。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装uboot-tools-help软件包 - LOG_INFO "开始检查系统是否已安装uboot-tools-help软件包" - rpm -q uboot-tools-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到uboot-tools-help软件包已安装,测试结束后将保持安装状态" - INSTALLED="yes" - else - LOG_INFO "检测到uboot-tools-help软件包未安装,将在测试结束后卸载" - INSTALLED="no" - fi - - # 检查yum源中是否存在uboot-tools-help软件包 - LOG_INFO "检查yum源中是否存在uboot-tools-help软件包" - dnf list available uboot-tools-help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到uboot-tools-help软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到uboot-tools-help软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "开始安装uboot-tools-help软件包" - dnf install -y uboot-tools-help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装uboot-tools-help软件包失败" - fi - - # 测试uboot-tools-help提供的帮助信息 - LOG_INFO "测试uboot-tools-help提供的帮助信息" - uboot-tools-help --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "uboot-tools-help --help命令执行失败" - if [ $? -ne 0 ]; then - LOG_ERROR "uboot-tools-help --help命令执行失败,参数可能不存在或不支持" - exit 255 - fi - - # 验证帮助信息是否正确输出 - LOG_INFO "验证uboot-tools-help帮助信息是否正确输出" - HELP_OUTPUT=$(uboot-tools-help --help 2>&1) - if echo "$HELP_OUTPUT" | grep -q "usage\|Usage\|帮助\|help"; then - LOG_INFO "uboot-tools-help帮助信息输出正常" - CHECK_RESULT $? 0 0 "uboot-tools-help帮助信息输出异常" - else - LOG_ERROR "uboot-tools-help帮助信息输出异常" - CHECK_RESULT $? 1 0 "uboot-tools-help帮助信息输出异常" - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "清理环境:卸载uboot-tools-help软件包" - dnf remove -y uboot-tools-help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载uboot-tools-help软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From 98f2b38b5fd7dafa2472d272a2e41929e4e7735e Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 10:09:24 +0800 Subject: [PATCH 09/10] update testcase for testsuite texlive-xnewcommand-doc --- .../texlive-xnewcommand-doc.json | 20 ---- ...test_texlive-xnewcommand-doc_doc_exists.sh | 70 ------------ ...t_texlive-xnewcommand-doc_example_usage.sh | 105 ------------------ ..._texlive-xnewcommand-doc_function_usage.sh | 61 ---------- .../test_texlive-xnewcommand-doc_info_page.sh | 91 --------------- .../test_texlive-xnewcommand-doc_manpage.sh | 73 ------------ 6 files changed, 420 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_doc_exists.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_example_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_function_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_info_page.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_manpage.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc.json b/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc.json index af110873f63..6643d75dfe6 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc", "machine num": 1, "cases": [ - { - "name": "test_texlive-xnewcommand-doc_function_usage", - "desc": "Test basic usage" - }, { "name": "test_texlive-xnewcommand-doc_install", "desc": "Test package installation" @@ -13,22 +9,6 @@ { "name": "test_texlive-xnewcommand-doc_uninstall", "desc": "Test package removal" - }, - { - "name": "test_texlive-xnewcommand-doc_doc_exists", - "desc": "Verify documentation files exist" - }, - { - "name": "test_texlive-xnewcommand-doc_manpage", - "desc": "Check man page availability" - }, - { - "name": "test_texlive-xnewcommand-doc_info_page", - "desc": "Check info page availability" - }, - { - "name": "test_texlive-xnewcommand-doc_example_usage", - "desc": "Test basic LaTeX usage example" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_doc_exists.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_doc_exists.sh deleted file mode 100644 index 749a5a3f60c..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_doc_exists.sh +++ /dev/null @@ -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-17 -# @License : Mulan PSL v2 -# @Desc : Verify documentation files exist -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装texlive-xnewcommand-doc软件包 - LOG_INFO "检查texlive-xnewcommand-doc软件包是否已安装" - rpm -q texlive-xnewcommand-doc - if [ $? -eq 0 ]; then - LOG_INFO "texlive-xnewcommand-doc软件包已安装" - INSTALLED=true - else - LOG_INFO "texlive-xnewcommand-doc软件包未安装" - INSTALLED=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否存在texlive-xnewcommand-doc软件包" - dnf list available texlive-xnewcommand-doc - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-xnewcommand-doc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装texlive-xnewcommand-doc软件包" - dnf install -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "安装texlive-xnewcommand-doc软件包失败" - fi - - # 验证文档文件是否存在 - LOG_INFO "验证texlive-xnewcommand-doc文档文件是否存在" - rpm -ql texlive-xnewcommand-doc | grep -E "\.pdf$|\.html$|\.txt$" | head -5 - CHECK_RESULT $? 0 0 "texlive-xnewcommand-doc文档文件不存在或不符合预期" - - LOG_INFO "验证texlive-xnewcommand-doc文档目录是否存在" - ls -d /usr/share/texlive/texmf-dist/doc/xelatex/xnewcommand - CHECK_RESULT $? 0 0 "texlive-xnewcommand-doc文档目录不存在" - - # 清理环境:如果测试前未安装,则在测试后卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载texlive-xnewcommand-doc软件包" - dnf remove -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "卸载texlive-xnewcommand-doc软件包失败" - else - LOG_INFO "测试前已安装texlive-xnewcommand-doc,保持安装状态" - fi - - LOG_INFO "测试完成:Verify documentation files exist" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_example_usage.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_example_usage.sh deleted file mode 100644 index 68c77de7fb4..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_example_usage.sh +++ /dev/null @@ -1,105 +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 basic LaTeX usage example -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装texlive-xnewcommand-doc软件包 - LOG_INFO "检查texlive-xnewcommand-doc软件包是否已安装" - if rpm -q texlive-xnewcommand-doc &>/dev/null; then - LOG_INFO "texlive-xnewcommand-doc软件包已安装,脚本结束将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "texlive-xnewcommand-doc软件包未安装,将在测试过程中安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有texlive-xnewcommand-doc软件包 - LOG_INFO "检查yum源中是否存在texlive-xnewcommand-doc软件包" - if ! dnf list available texlive-xnewcommand-doc &>/dev/null; then - LOG_ERROR "yum源中不存在texlive-xnewcommand-doc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "开始安装texlive-xnewcommand-doc软件包" - dnf install -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "安装texlive-xnewcommand-doc软件包失败" - fi - - # 检查是否安装了LaTeX基本命令 - LOG_INFO "检查LaTeX基本命令是否可用" - if ! command -v latex &>/dev/null; then - LOG_INFO "LaTeX基本命令未安装,尝试安装texlive-scheme-basic" - dnf install -y texlive-scheme-basic - CHECK_RESULT $? 0 0 "安装texlive-scheme-basic失败" - fi - - # 创建一个简单的LaTeX测试文档 - LOG_INFO "创建简单的LaTeX测试文档" - TEST_FILE="test_latex.tex" - cat > ${TEST_FILE} << "EOF" - \documentclass{article} - \usepackage{xnewcommand} - \begin{document} - This is a test document for xnewcommand package. - \end{document} - EOF - - CHECK_RESULT $? 0 0 "创建LaTeX测试文件失败" - - # 尝试编译LaTeX文档 - LOG_INFO "尝试编译LaTeX测试文档" - latex ${TEST_FILE} &> latex_output.log - CHECK_RESULT $? 0 0 "LaTeX文档编译失败" - - # 检查是否生成了预期的输出文件 - LOG_INFO "检查是否生成了预期的输出文件" - if [ -f "test_latex.dvi" ] || [ -f "test_latex.pdf" ]; then - LOG_INFO "LaTeX编译成功,生成了输出文件" - else - LOG_ERROR "LaTeX编译未生成预期的输出文件" - exit 1 - fi - - # 清理测试生成的文件 - LOG_INFO "清理测试生成的文件" - rm -f ${TEST_FILE} test_latex.aux test_latex.log test_latex.dvi test_latex.pdf latex_output.log - - # 如果脚本开始时未安装软件包,则在测试结束后卸载 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "测试完成,卸载texlive-xnewcommand-doc软件包" - dnf remove -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "卸载texlive-xnewcommand-doc软件包失败" - - # 检查是否还需要卸载texlive-scheme-basic - LOG_INFO "检查是否需要卸载texlive-scheme-basic" - if rpm -q texlive-scheme-basic &>/dev/null; then - dnf remove -y texlive-scheme-basic - CHECK_RESULT $? 0 0 "卸载texlive-scheme-basic失败" - fi - else - LOG_INFO "测试完成,保持texlive-xnewcommand-doc软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_function_usage.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_function_usage.sh deleted file mode 100644 index 9b982c27187..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_function_usage.sh +++ /dev/null @@ -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-10-05 -# @License : Mulan PSL v2 -# @Desc : Test basic usage -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-xnewcommand-doc软件包 - LOG_INFO "检查是否已安装texlive-xnewcommand-doc软件包" - rpm -q texlive-xnewcommand-doc - if [ $? -eq 0 ]; then - LOG_INFO "texlive-xnewcommand-doc已安装,脚本结束时保持安装状态" - installed=true - else - LOG_INFO "texlive-xnewcommand-doc未安装,将在测试结束后卸载" - installed=false - fi - - # 检查yum源中是否有texlive-xnewcommand-doc软件包 - LOG_INFO "检查yum源中是否有texlive-xnewcommand-doc软件包" - dnf list available texlive-xnewcommand-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-xnewcommand-doc软件包" - - # 安装texlive-xnewcommand-doc软件包 - LOG_INFO "安装texlive-xnewcommand-doc软件包" - dnf install -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "安装texlive-xnewcommand-doc失败" - - # 测试基本功能使用 - LOG_INFO "测试基本功能使用" - command_to_test --help > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "命令参数不支持或不存在" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-xnewcommand-doc软件包" - dnf remove -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "卸载texlive-xnewcommand-doc失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_info_page.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_info_page.sh deleted file mode 100644 index e5c5142abc2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_info_page.sh +++ /dev/null @@ -1,91 +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 : Check info page availability -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查 info page 可用性测试脚本 - - LOG_INFO "开始测试 info page 可用性" - - # 定义软件包名称 - PACKAGE_NAME="texlive-xnewcommand-doc" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查软件包是否在yum源中" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中" - exit 255 - fi - - # 步骤2: 检查当前是否已安装 - LOG_INFO "步骤2: 检查当前是否已安装软件包" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,标记为已存在" - PRE_INSTALLED=true - else - LOG_INFO "软件包未安装,标记为未安装" - PRE_INSTALLED=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "$PRE_INSTALLED" = "false" ]; then - LOG_INFO "步骤3: 安装软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4: 检查 info page 命令是否可用 - LOG_INFO "步骤4: 检查 info page 命令是否可用" - info --version > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "info 命令不存在或不支持" - # 如果是未安装状态下,需要先卸载再退出 - if [ "$PRE_INSTALLED" = "false" ]; then - dnf remove -y $PACKAGE_NAME > /dev/null 2>&1 - fi - exit 255 - fi - - # 步骤5: 检查指定软件包的 info page 是否存在 - LOG_INFO "步骤5: 检查指定软件包的 info page 是否存在" - info texlive-xnewcommand > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "info page 不可用" - - # 步骤6: 验证 info page 内容可访问 - LOG_INFO "步骤6: 验证 info page 内容可访问" - info texlive-xnewcommand | head -20 | grep -i "xnewcommand" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "info page 内容访问失败" - - # 步骤7: 清理环境 - LOG_INFO "步骤7: 清理环境" - if [ "$PRE_INSTALLED" = "false" ]; then - LOG_INFO "卸载测试安装的软件包" - 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/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_manpage.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_manpage.sh deleted file mode 100644 index 9b1699036dd..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xnewcommand-doc/test_texlive-xnewcommand-doc_manpage.sh +++ /dev/null @@ -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 : Check man page availability -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查man page可用性" - - # 检查yum源中是否存在texlive-xnewcommand-doc软件包 - LOG_INFO "检查yum源中是否存在texlive-xnewcommand-doc软件包" - dnf list available texlive-xnewcommand-doc &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-xnewcommand-doc软件包" - exit 255 - fi - - # 检查系统是否已安装texlive-xnewcommand-doc - LOG_INFO "检查系统是否已安装texlive-xnewcommand-doc" - if rpm -q texlive-xnewcommand-doc &>/dev/null; then - LOG_INFO "texlive-xnewcommand-doc已安装,将保持安装状态" - ALREADY_INSTALLED=true - else - LOG_INFO "texlive-xnewcommand-doc未安装,将进行安装" - ALREADY_INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "安装texlive-xnewcommand-doc软件包" - dnf install -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "安装texlive-xnewcommand-doc失败" - fi - - # 检查man命令的参数支持 - LOG_INFO "检查man命令的参数支持" - man --help | grep -q "\-k" - if [ $? -ne 0 ]; then - LOG_ERROR "man命令不支持-k参数" - exit 255 - fi - - # 检查man page是否可用 - LOG_INFO "检查texlive-xnewcommand-doc的man page是否可用" - man -k texlive-xnewcommand-doc &>/dev/null - CHECK_RESULT $? 0 0 "texlive-xnewcommand-doc的man page不可用" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "卸载texlive-xnewcommand-doc软件包" - dnf remove -y texlive-xnewcommand-doc - CHECK_RESULT $? 0 0 "卸载texlive-xnewcommand-doc失败" - fi - - LOG_INFO "测试完成:man page可用性检查通过" -} - -main "$@" \ No newline at end of file From 90dad386586c3034b433f61bbd7966558d9913f4 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 10:10:49 +0800 Subject: [PATCH 10/10] update testcase for testsuite qt6-qtserialbus-devel --- .../qt6-qtserialbus-devel.json | 35 ----- .../test_qt6-qtserialbus-devel_downgrade.sh | 95 ------------ ...st_qt6-qtserialbus-devel_function_check.sh | 75 ---------- ..._qt6-qtserialbus-devel_function_compile.sh | 137 ------------------ ..._qt6-qtserialbus-devel_function_install.sh | 90 ------------ ...est_qt6-qtserialbus-devel_function_link.sh | 114 --------------- ...6-qtserialbus-devel_function_serialport.sh | 67 --------- .../test_qt6-qtserialbus-devel_rollback.sh | 85 ----------- .../test_qt6-qtserialbus-devel_upgrade.sh | 74 ---------- 9 files changed, 772 deletions(-) delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_downgrade.sh delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_check.sh delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_compile.sh delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_install.sh delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_link.sh delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_serialport.sh delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_rollback.sh delete mode 100644 testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_upgrade.sh diff --git a/suite2cases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel.json b/suite2cases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel.json index 897fc6d1f6d..6adb17bf385 100644 --- a/suite2cases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel.json +++ b/suite2cases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel.json @@ -12,44 +12,9 @@ "desc": "测试软件包qt6-qtserialbus-devel的卸载功能,验证卸载过程是否成功。", "machine num": 1 }, - { - "name": "test_qt6-qtserialbus-devel_upgrade", - "desc": "测试软件包qt6-qtserialbus-devel的升级功能,验证升级过程是否成功。", - "machine num": 1 - }, - { - "name": "test_qt6-qtserialbus-devel_downgrade", - "desc": "测试软件包qt6-qtserialbus-devel的降级功能,验证降级过程是否成功。", - "machine num": 1 - }, - { - "name": "test_qt6-qtserialbus-devel_rollback", - "desc": "测试软件包qt6-qtserialbus-devel的回滚功能,验证回滚过程是否成功。", - "machine num": 1 - }, - { - "name": "test_qt6-qtserialbus-devel_function_serialport", - "desc": "测试软件包qt6-qtserialbus-devel的串口通信功能,验证串口通信是否正常。" - }, - { - "name": "test_qt6-qtserialbus-devel_function_install", - "desc": "测试软件包qt6-qtserialbus-devel的安装功能,验证是否能成功安装到系统中。" - }, { "name": "test_qt6-qtserialbus-devel_function_uninstall", "desc": "测试软件包qt6-qtserialbus-devel的卸载功能,验证是否能从系统中完全移除。" - }, - { - "name": "test_qt6-qtserialbus-devel_function_check", - "desc": "测试软件包qt6-qtserialbus-devel的检查功能,验证其头文件和库文件是否存在于标准路径中。" - }, - { - "name": "test_qt6-qtserialbus-devel_function_compile", - "desc": "测试软件包qt6-qtserialbus-devel的开发功能,验证能否使用其头文件和库成功编译一个简单的串口通信示例程序。" - }, - { - "name": "test_qt6-qtserialbus-devel_function_link", - "desc": "测试软件包qt6-qtserialbus-devel的链接功能,验证编译后的程序是否能正确链接并运行,不出现动态库缺失错误。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_downgrade.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_downgrade.sh deleted file mode 100644 index b83c2788497..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_downgrade.sh +++ /dev/null @@ -1,95 +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-06-20 -# @License : Mulan PSL v2 -# @Desc : 测试软件包qt6-qtserialbus-devel的降级功能,验证降级过程是否成功。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试软件包qt6-qtserialbus-devel的降级功能..." - - # 检查环境是否已安装qt6-qtserialbus-devel - LOG_INFO "检查环境中是否已安装qt6-qtserialbus-devel..." - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "环境中已安装qt6-qtserialbus-devel,脚本结束时将保持安装状态。" - INSTALLED=true - else - LOG_INFO "环境中未安装qt6-qtserialbus-devel,将在测试结束后卸载。" - INSTALLED=false - fi - - # 检查yum源中是否存在qt6-qtserialbus-devel软件包 - LOG_INFO "检查yum源中是否存在qt6-qtserialbus-devel软件包..." - dnf list available qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到qt6-qtserialbus-devel软件包,退出测试。" - exit 255 - fi - - # 获取当前安装的版本 - LOG_INFO "获取当前安装的qt6-qtserialbus-devel版本..." - CURRENT_VERSION=$(rpm -q --queryformat '%{VERSION}-%{RELEASE}' qt6-qtserialbus-devel 2>/dev/null) - if [ $? -ne 0 ] && [ "$INSTALLED" = true ]; then - LOG_ERROR "获取当前版本失败,退出测试。" - exit 255 - fi - - # 获取可用的旧版本列表 - LOG_INFO "获取可用的旧版本列表..." - OLD_VERSIONS=$(dnf list --showduplicates qt6-qtserialbus-devel | awk '{print $2}' | grep -v "$CURRENT_VERSION" | sort -V | head -n 1) - if [ -z "$OLD_VERSIONS" ]; then - LOG_ERROR "未找到可用的旧版本,退出测试。" - exit 255 - fi - - # 选择第一个旧版本进行降级测试 - TARGET_VERSION=$(echo "$OLD_VERSIONS" | head -n 1) - LOG_INFO "选择降级目标版本: $TARGET_VERSION" - - # 执行降级操作 - LOG_INFO "执行降级操作..." - dnf downgrade -y qt6-qtserialbus-devel-$TARGET_VERSION > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "降级操作失败。" - - # 验证降级后的版本 - LOG_INFO "验证降级后的版本..." - NEW_VERSION=$(rpm -q --queryformat '%{VERSION}-%{RELEASE}' qt6-qtserialbus-devel) - CHECK_RESULT $? 0 0 "获取新版本失败。" - - if [ "$NEW_VERSION" != "$TARGET_VERSION" ]; then - LOG_ERROR "降级失败,当前版本为$NEW_VERSION,预期版本为$TARGET_VERSION。" - exit 1 - else - LOG_INFO "降级成功,当前版本为$NEW_VERSION。" - fi - - # 恢复环境状态 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载qt6-qtserialbus-devel以恢复环境..." - dnf remove -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载软件包失败。" - else - LOG_INFO "恢复原始版本..." - dnf upgrade -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "恢复原始版本失败。" - fi - - LOG_INFO "测试完成。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_check.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_check.sh deleted file mode 100644 index 69022b65cd5..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_check.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 : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试软件包qt6-qtserialbus-devel的检查功能,验证其头文件和库文件是否存在于标准路径中。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:判断是否已安装qt6-qtserialbus-devel - LOG_INFO "检查是否已安装qt6-qtserialbus-devel软件包" - rpm -q qt6-qtserialbus-devel >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "qt6-qtserialbus-devel已安装,测试后保持安装状态" - INSTALLED="true" - else - LOG_INFO "qt6-qtserialbus-devel未安装,将在测试前安装" - INSTALLED="false" - fi - - # 检查yum源中是否存在qt6-qtserialbus-devel软件包 - LOG_INFO "检查yum源中是否存在qt6-qtserialbus-devel软件包" - dnf list available qt6-qtserialbus-devel >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到qt6-qtserialbus-devel软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到qt6-qtserialbus-devel软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装qt6-qtserialbus-devel软件包" - dnf install -y qt6-qtserialbus-devel >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装qt6-qtserialbus-devel软件包失败" - fi - - # 测试步骤1:检查头文件是否存在 - LOG_INFO "检查头文件是否存在于标准路径中" - find /usr/include -name "*qtserialbus*" -type f >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "头文件未在标准路径中找到" - - # 测试步骤2:检查库文件是否存在 - LOG_INFO "检查库文件是否存在于标准路径中" - find /usr/lib64 -name "*qtserialbus*" -type f >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "库文件未在标准路径中找到" - - # 测试步骤3:检查开发包提供的pkg-config文件 - LOG_INFO "检查pkg-config文件是否存在" - pkg-config --exists Qt6SerialBus - CHECK_RESULT $? 0 0 "pkg-config文件未找到或配置不正确" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载qt6-qtserialbus-devel软件包" - dnf remove -y qt6-qtserialbus-devel >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载qt6-qtserialbus-devel软件包失败" - fi - - LOG_INFO "qt6-qtserialbus-devel功能检查测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_compile.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_compile.sh deleted file mode 100644 index 2a39b5eeb39..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_compile.sh +++ /dev/null @@ -1,137 +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 : 测试软件包qt6-qtserialbus-devel的开发功能,验证能否使用其头文件和库成功编译一个简单的串口通信示例程序。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试qt6-qtserialbus-devel的开发功能" - - LOG_INFO "步骤1: 检查yum源中是否存在qt6-qtserialbus-devel软件包" - if ! dnf list --available qt6-qtserialbus-devel &>/dev/null; then - LOG_ERROR "yum源中未找到qt6-qtserialbus-devel软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查系统是否已安装qt6-qtserialbus-devel" - if rpm -q qt6-qtserialbus-devel &>/dev/null; then - LOG_INFO "qt6-qtserialbus-devel已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "qt6-qtserialbus-devel未安装,将进行安装测试" - already_installed=false - fi - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3: 安装qt6-qtserialbus-devel软件包" - dnf install -y qt6-qtserialbus-devel - CHECK_RESULT $? 0 0 "安装qt6-qtserialbus-devel失败" - fi - - LOG_INFO "步骤4: 创建测试用的简单串口通信示例程序" - TEST_DIR="/tmp/test_qt6_qtserialbus_$(date +%s)" - mkdir -p "$TEST_DIR" - cd "$TEST_DIR" - - cat > test_serial.cpp << "EOF" - #include - #include - #include - #include - - int main(int argc, char *argv[]) - { - QCoreApplication a(argc, argv); - - qDebug() << "Available serial ports:"; - foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) { - qDebug() << "Port:" << info.portName(); - qDebug() << "Description:" << info.description(); - qDebug() << "Manufacturer:" << info.manufacturer(); - qDebug() << "System location:" << info.systemLocation(); - qDebug() << "Vendor ID:" << info.vendorIdentifier(); - qDebug() << "Product ID:" << info.productIdentifier(); - qDebug() << "-----------------------------------"; - } - - return 0; - } - EOF - - CHECK_RESULT $? 0 0 "创建测试源代码文件失败" - - LOG_INFO "步骤5: 创建CMakeLists.txt文件" - cat > CMakeLists.txt << "EOF" - cmake_minimum_required(VERSION 3.16) - project(TestQtSerialBus) - - set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - - find_package(Qt6 REQUIRED COMPONENTS Core SerialPort) - - add_executable(test_serial test_serial.cpp) - - target_link_libraries(test_serial Qt6::Core Qt6::SerialPort) - EOF - - CHECK_RESULT $? 0 0 "创建CMakeLists.txt文件失败" - - LOG_INFO "步骤6: 使用CMake配置项目" - mkdir -p build - cd build - cmake .. - CHECK_RESULT $? 0 0 "CMake配置失败" - - LOG_INFO "步骤7: 编译测试程序" - make - CHECK_RESULT $? 0 0 "编译测试程序失败" - - LOG_INFO "步骤8: 验证编译生成的可执行文件" - if [ -f "test_serial" ]; then - LOG_INFO "成功编译生成可执行文件test_serial" - file test_serial - CHECK_RESULT $? 0 0 "检查可执行文件失败" - else - LOG_ERROR "未找到编译生成的可执行文件" - exit 1 - fi - - LOG_INFO "步骤9: 运行测试程序(仅列出可用串口,不进行实际通信)" - ./test_serial - CHECK_RESULT $? 0 0 "运行测试程序失败" - - LOG_INFO "步骤10: 清理测试目录" - cd / - rm -rf "$TEST_DIR" - CHECK_RESULT $? 0 0 "清理测试目录失败" - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤11: 卸载测试安装的qt6-qtserialbus-devel软件包" - dnf remove -y qt6-qtserialbus-devel - CHECK_RESULT $? 0 0 "卸载qt6-qtserialbus-devel失败" - else - LOG_INFO "步骤11: 保持系统原有的qt6-qtserialbus-devel安装状态" - fi - - LOG_INFO "qt6-qtserialbus-devel开发功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_install.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_install.sh deleted file mode 100644 index a9fc6a9bf0c..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_install.sh +++ /dev/null @@ -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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试软件包qt6-qtserialbus-devel的安装功能,验证是否能成功安装到系统中。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装qt6-qtserialbus-devel - LOG_INFO "检查qt6-qtserialbus-devel是否已安装" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "qt6-qtserialbus-devel已安装,测试完成后保持安装状态" - INSTALLED="true" - else - LOG_INFO "qt6-qtserialbus-devel未安装,将在测试中安装" - INSTALLED="false" - fi - - # 检查yum源中是否有qt6-qtserialbus-devel软件包 - LOG_INFO "检查yum源中是否有qt6-qtserialbus-devel软件包" - dnf list available qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有qt6-qtserialbus-devel软件包" - exit 255 - fi - - # 检查dnf工具是否支持install和remove参数 - LOG_INFO "检查dnf工具是否支持install和remove参数" - dnf --help | grep -q "install" && dnf --help | grep -q "remove" - if [ $? -ne 0 ]; then - LOG_ERROR "dnf工具不支持install或remove参数" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装qt6-qtserialbus-devel软件包" - dnf install -y qt6-qtserialbus-devel - CHECK_RESULT $? 0 0 "安装qt6-qtserialbus-devel失败" - LOG_INFO "qt6-qtserialbus-devel安装成功" - fi - - # 验证软件包是否成功安装 - LOG_INFO "验证qt6-qtserialbus-devel是否成功安装" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "qt6-qtserialbus-devel未正确安装" - - # 检查软件包文件是否存在 - LOG_INFO "检查qt6-qtserialbus-devel相关文件是否存在" - rpm -ql qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "qt6-qtserialbus-devel文件不存在" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始卸载qt6-qtserialbus-devel软件包" - dnf remove -y qt6-qtserialbus-devel - CHECK_RESULT $? 0 0 "卸载qt6-qtserialbus-devel失败" - LOG_INFO "qt6-qtserialbus-devel卸载成功" - - # 验证软件包是否已卸载 - LOG_INFO "验证qt6-qtserialbus-devel是否已卸载" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "qt6-qtserialbus-devel卸载后仍然存在" - exit 1 - fi - LOG_INFO "环境已恢复到测试前状态" - else - LOG_INFO "测试前已安装qt6-qtserialbus-devel,保持安装状态" - fi - - LOG_INFO "qt6-qtserialbus-devel安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_link.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_link.sh deleted file mode 100644 index 9cf17c28a51..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_link.sh +++ /dev/null @@ -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 : 测试软件包qt6-qtserialbus-devel的链接功能,验证编译后的程序是否能正确链接并运行,不出现动态库缺失错误。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试qt6-qtserialbus-devel的链接功能" - - LOG_INFO "检查软件包qt6-qtserialbus-devel是否在yum源中" - dnf list qt6-qtserialbus-devel 2>&1 | grep -q "qt6-qtserialbus-devel" - if [ $? -ne 0 ]; then - LOG_ERROR "软件包qt6-qtserialbus-devel不在yum源中" - exit 255 - fi - - LOG_INFO "检查系统是否已安装qt6-qtserialbus-devel" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "qt6-qtserialbus-devel已安装,测试后保持安装状态" - INSTALLED=true - else - LOG_INFO "qt6-qtserialbus-devel未安装,将安装并测试后卸载" - INSTALLED=false - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装qt6-qtserialbus-devel" - dnf install -y qt6-qtserialbus-devel - CHECK_RESULT $? 0 0 "安装qt6-qtserialbus-devel失败" - fi - - LOG_INFO "创建测试程序源码文件" - cat > test_link.c << "EOF" - #include - #include - #include - - int main(int argc, char *argv[]) { - QCoreApplication app(argc, argv); - QList ports = QSerialBusInfo::availablePorts(); - qDebug() << "Available serial ports:"; - for (const QSerialBusInfo &port : ports) { - qDebug() << port.portName(); - } - return 0; - } - EOF - - LOG_INFO "创建Qt项目文件" - cat > test_link.pro << "EOF" - QT += core serialbus - TARGET = test_link - CONFIG += console - CONFIG -= app_bundle - TEMPLATE = app - SOURCES += test_link.c - EOF - - LOG_INFO "使用qmake6生成Makefile" - qmake6 test_link.pro - CHECK_RESULT $? 0 0 "qmake6命令执行失败" - - LOG_INFO "编译测试程序" - make - CHECK_RESULT $? 0 0 "编译测试程序失败" - - LOG_INFO "检查编译生成的可执行文件是否存在" - [ -f test_link ] - CHECK_RESULT $? 0 0 "可执行文件test_link未生成" - - LOG_INFO "使用ldd检查动态库依赖" - ldd test_link 2>&1 | grep -q "not found" - if [ $? -eq 0 ]; then - LOG_ERROR "存在未找到的动态库" - ldd test_link | grep "not found" - CHECK_RESULT 1 0 0 "动态库检查失败" - else - LOG_INFO "所有动态库依赖正常" - fi - - LOG_INFO "运行测试程序检查是否能正常执行" - ./test_link - CHECK_RESULT $? 0 0 "测试程序运行失败" - - LOG_INFO "清理编译生成的文件" - rm -f test_link.c test_link.pro Makefile test_link .qmake.stash - rm -rf debug release - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载qt6-qtserialbus-devel" - dnf remove -y qt6-qtserialbus-devel - CHECK_RESULT $? 0 0 "卸载qt6-qtserialbus-devel失败" - fi - - LOG_INFO "qt6-qtserialbus-devel链接功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_serialport.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_serialport.sh deleted file mode 100644 index 576f637fc6e..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_function_serialport.sh +++ /dev/null @@ -1,67 +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-09 -# @License : Mulan PSL v2 -# @Desc : 测试软件包qt6-qtserialbus-devel的串口通信功能,验证串口通信是否正常。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装qt6-qtserialbus-devel软件包 - LOG_INFO "检查qt6-qtserialbus-devel软件包是否已安装" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "qt6-qtserialbus-devel软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "qt6-qtserialbus-devel软件包未安装,将在测试后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在qt6-qtserialbus-devel软件包 - LOG_INFO "检查yum源中是否存在qt6-qtserialbus-devel软件包" - dnf list available qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到qt6-qtserialbus-devel软件包" - exit 255 - fi - - # 安装qt6-qtserialbus-devel软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装qt6-qtserialbus-devel软件包" - dnf install -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装qt6-qtserialbus-devel软件包失败" - fi - - # 测试串口通信功能 - LOG_INFO "测试串口通信功能" - # 假设使用serialport命令进行测试,具体命令根据实际需求调整 - serialport --test > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "串口通信测试失败" - - # 清理环境(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载qt6-qtserialbus-devel软件包" - dnf remove -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载qt6-qtserialbus-devel软件包失败" - fi - - LOG_INFO "测试脚本执行完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_rollback.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_rollback.sh deleted file mode 100644 index 1eec53f220d..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_rollback.sh +++ /dev/null @@ -1,85 +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-06-20 -# @License : Mulan PSL v2 -# @Desc : 测试软件包qt6-qtserialbus-devel的回滚功能,验证回滚过程是否成功。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试软件包qt6-qtserialbus-devel的回滚功能" - - # 检查yum源中是否存在qt6-qtserialbus-devel软件包 - LOG_INFO "检查yum源中是否存在qt6-qtserialbus-devel软件包" - dnf list available qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到qt6-qtserialbus-devel软件包" - exit 255 - fi - - # 检查当前是否已安装qt6-qtserialbus-devel软件包 - LOG_INFO "检查当前是否已安装qt6-qtserialbus-devel软件包" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "当前环境已安装qt6-qtserialbus-devel软件包" - INSTALLED=true - else - LOG_INFO "当前环境未安装qt6-qtserialbus-devel软件包" - INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装qt6-qtserialbus-devel软件包" - dnf install -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装qt6-qtserialbus-devel软件包失败" - fi - - # 测试回滚功能 - LOG_INFO "测试回滚功能" - dnf history undo last -y > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "回滚操作失败" - - # 验证回滚是否成功 - LOG_INFO "验证回滚是否成功" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ "$INSTALLED" = false ]; then - if [ $? -eq 0 ]; then - LOG_ERROR "回滚失败,qt6-qtserialbus-devel软件包未被卸载" - exit 1 - else - LOG_INFO "回滚成功,qt6-qtserialbus-devel软件包已被卸载" - fi - else - if [ $? -ne 0 ]; then - LOG_ERROR "回滚失败,qt6-qtserialbus-devel软件包被错误卸载" - exit 1 - else - LOG_INFO "回滚成功,qt6-qtserialbus-devel软件包保持安装状态" - fi - fi - - # 清理环境:如果初始未安装,则卸载软件包;否则保持原状 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载qt6-qtserialbus-devel软件包" - dnf remove -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载qt6-qtserialbus-devel软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_upgrade.sh b/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_upgrade.sh deleted file mode 100644 index 58516ef9907..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialbus/qt6-qtserialbus-devel/test_qt6-qtserialbus-devel_upgrade.sh +++ /dev/null @@ -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-06-20 -# @License : Mulan PSL v2 -# @Desc : 测试软件包qt6-qtserialbus-devel的升级功能,验证升级过程是否成功。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试软件包qt6-qtserialbus-devel的升级功能" - - # 检查yum源中是否存在qt6-qtserialbus-devel软件包 - LOG_INFO "检查yum源中是否存在qt6-qtserialbus-devel软件包" - dnf list available qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到qt6-qtserialbus-devel软件包" - exit 255 - fi - - # 检查当前是否已安装qt6-qtserialbus-devel - LOG_INFO "检查当前是否已安装qt6-qtserialbus-devel" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "qt6-qtserialbus-devel已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "qt6-qtserialbus-devel未安装,开始安装" - dnf install -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装qt6-qtserialbus-devel失败" - INSTALLED=false - fi - - # 检查是否有可用的升级版本 - LOG_INFO "检查是否有可用的升级版本" - dnf check-update qt6-qtserialbus-devel > /dev/null 2>&1 - if [ $? -eq 100 ]; then - LOG_INFO "存在可用的升级版本,开始升级" - dnf upgrade -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "升级qt6-qtserialbus-devel失败" - else - LOG_INFO "没有可用的升级版本,跳过升级步骤" - fi - - # 验证升级后的软件包是否正常运行(示例验证命令) - LOG_INFO "验证升级后的软件包是否正常运行" - rpm -q qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证升级后的软件包失败" - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载qt6-qtserialbus-devel" - dnf remove -y qt6-qtserialbus-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载qt6-qtserialbus-devel失败" - else - LOG_INFO "保持环境不变,不卸载qt6-qtserialbus-devel" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file