From 409e9823e651ffbbed02621b13752e894cd7e6d9 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:43:30 +0800 Subject: [PATCH 01/25] update testcase for testsuite python3-csscompressor --- .../python3-csscompressor.json | 12 --- ...python3-csscompressor_function_compress.sh | 67 ----------------- ...st_python3-csscompressor_function_error.sh | 68 ----------------- ...est_python3-csscompressor_function_perf.sh | 75 ------------------- 4 files changed, 222 deletions(-) delete mode 100644 testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_compress.sh delete mode 100644 testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_error.sh delete mode 100644 testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_perf.sh diff --git a/suite2cases/function_test/pkg_test/python-csscompressor/python3-csscompressor.json b/suite2cases/function_test/pkg_test/python-csscompressor/python3-csscompressor.json index f9a06953f7f..e219563fc65 100644 --- a/suite2cases/function_test/pkg_test/python-csscompressor/python3-csscompressor.json +++ b/suite2cases/function_test/pkg_test/python-csscompressor/python3-csscompressor.json @@ -6,18 +6,6 @@ "name": "test_python3-csscompressor_install", "desc": "测试python3-csscompressor软件包的安装功能", "machine num": 1 - }, - { - "name": "test_python3-csscompressor_function_compress", - "desc": "测试python3-csscompressor的CSS压缩功能" - }, - { - "name": "test_python3-csscompressor_function_error", - "desc": "测试python3-csscompressor的错误处理功能" - }, - { - "name": "test_python3-csscompressor_function_perf", - "desc": "测试python3-csscompressor的性能表现" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_compress.sh b/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_compress.sh deleted file mode 100644 index 7058b9fd928..00000000000 --- a/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_compress.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-13 -# @License : Mulan PSL v2 -# @Desc : 测试python3-csscompressor的CSS压缩功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-csscompressor的CSS压缩功能" - - # 检查是否已安装python3-csscompressor - if ! dnf list installed python3-csscompressor &>/dev/null; then - LOG_INFO "python3-csscompressor未安装,将进行安装" - # 检查yum源中是否有该软件包 - if ! dnf list available python3-csscompressor &>/dev/null; then - LOG_ERROR "yum源中未找到python3-csscompressor软件包" - exit 255 - fi - # 安装软件包 - dnf install -y python3-csscompressor - CHECK_RESULT $? 0 0 "安装python3-csscompressor失败" - # 标记为需要卸载 - NEED_UNINSTALL=1 - else - LOG_INFO "python3-csscompressor已安装,无需重复安装" - fi - - # 测试CSS压缩功能 - LOG_INFO "测试CSS压缩功能" - TEST_CSS="body { color: red; }" - COMPRESSED_CSS=$(python3 -m csscompressor --compress "$TEST_CSS") - CHECK_RESULT $? 0 0 "CSS压缩失败" - - # 验证压缩结果是否符合预期 - EXPECTED_CSS="body{color:red}" - if [ "$COMPRESSED_CSS" != "$EXPECTED_CSS" ]; then - LOG_ERROR "CSS压缩结果不符合预期" - exit 1 - else - LOG_INFO "CSS压缩结果符合预期" - fi - - # 清理环境,如果之前未安装则卸载 - if [ "$NEED_UNINSTALL" -eq 1 ]; then - LOG_INFO "卸载python3-csscompressor" - dnf remove -y python3-csscompressor - CHECK_RESULT $? 0 0 "卸载python3-csscompressor失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_error.sh b/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_error.sh deleted file mode 100644 index 2840bf8f569..00000000000 --- a/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_error.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-13 -# @License : Mulan PSL v2 -# @Desc : 测试python3-csscompressor的错误处理功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试python3-csscompressor的错误处理功能 - - LOG_INFO "开始测试python3-csscompressor的错误处理功能" - - # 检查是否已安装python3-csscompressor - if dnf list installed python3-csscompressor &>/dev/null; then - LOG_INFO "python3-csscompressor已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-csscompressor未安装,将在测试完成后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-csscompressor - if ! dnf list available python3-csscompressor &>/dev/null; then - LOG_ERROR "yum源中未找到python3-csscompressor软件包" - exit 255 - fi - - # 如果未安装,则安装python3-csscompressor - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装python3-csscompressor" - dnf install -y python3-csscompressor - CHECK_RESULT $? 0 0 "安装python3-csscompressor失败" - fi - - # 测试错误处理功能 - LOG_INFO "测试错误处理功能:无效参数" - css_compress --invalid-arg 2>/dev/null - CHECK_RESULT $? 255 0 "无效参数未返回预期错误码" - - LOG_INFO "测试错误处理功能:不存在的文件" - css_compress /nonexistent/file 2>/dev/null - CHECK_RESULT $? 1 0 "不存在的文件未返回预期错误码" - - # 清理环境:如果之前未安装,则卸载python3-csscompressor - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载python3-csscompressor" - dnf remove -y python3-csscompressor - CHECK_RESULT $? 0 0 "卸载python3-csscompressor失败" - fi - - LOG_INFO "测试python3-csscompressor的错误处理功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_perf.sh b/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_perf.sh deleted file mode 100644 index 2fa2e3597a3..00000000000 --- a/testcases/function_test/pkg_test/python-csscompressor/python3-csscompressor/test_python3-csscompressor_function_perf.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 : 测试python3-csscompressor的性能表现 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-csscompressor的性能表现" - - # 检查环境是否已安装python3-csscompressor - LOG_INFO "检查是否已安装python3-csscompressor" - if dnf list installed python3-csscompressor &>/dev/null; then - LOG_INFO "python3-csscompressor已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-csscompressor未安装,将在测试完成后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-csscompressor - LOG_INFO "检查yum源中是否有python3-csscompressor" - if ! dnf list available python3-csscompressor &>/dev/null; then - LOG_ERROR "yum源中未找到python3-csscompressor" - exit 255 - fi - - # 安装python3-csscompressor(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python3-csscompressor" - dnf install -y python3-csscompressor - CHECK_RESULT $? 0 0 "安装python3-csscompressor失败" - fi - - # 测试python3-csscompressor性能 - LOG_INFO "测试python3-csscompressor性能" - css_file="test.css" - cat < "$css_file" - body { - color: red; - } - EOF - - LOG_INFO "执行css压缩测试" - python3 -m csscompressor "$css_file" > /dev/null - CHECK_RESULT $? 0 0 "css压缩测试失败" - - # 清理测试文件 - rm -f "$css_file" - - # 卸载python3-csscompressor(如果最初未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-csscompressor" - dnf remove -y python3-csscompressor - CHECK_RESULT $? 0 0 "卸载python3-csscompressor失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From 949024a9b3f6d1803ef28e5688766509d5bb7d19 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:43:51 +0800 Subject: [PATCH 02/25] update testcase for testsuite vala-help --- .../pkg_test/vala/vala-help.json | 16 ----- .../test_vala-help_function_config.sh | 62 ---------------- .../test_vala-help_function_install.sh | 63 ---------------- .../test_vala-help_function_uninstall.sh | 65 ----------------- .../test_vala-help_function_version.sh | 72 ------------------- 5 files changed, 278 deletions(-) delete mode 100644 testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_config.sh delete mode 100644 testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_install.sh delete mode 100644 testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_version.sh diff --git a/suite2cases/function_test/pkg_test/vala/vala-help.json b/suite2cases/function_test/pkg_test/vala/vala-help.json index e36859c927e..afda18e2491 100644 --- a/suite2cases/function_test/pkg_test/vala/vala-help.json +++ b/suite2cases/function_test/pkg_test/vala/vala-help.json @@ -11,22 +11,6 @@ "name": "test_vala-help_service_log", "desc": "测试vala-help服务的日志查看功能,验证是否可以正常查看服务日志。", "machine num": 1 - }, - { - "name": "test_vala-help_function_install", - "desc": "测试vala-help软件包的安装功能,验证是否可以正常安装。" - }, - { - "name": "test_vala-help_function_uninstall", - "desc": "测试vala-help软件包的卸载功能,验证是否可以正常卸载。" - }, - { - "name": "test_vala-help_function_config", - "desc": "测试vala-help软件包的配置功能,验证是否可以正常配置。" - }, - { - "name": "test_vala-help_function_version", - "desc": "测试vala-help软件包的版本查看功能,验证是否可以正常查看版本信息。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_config.sh b/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_config.sh deleted file mode 100644 index 80671589577..00000000000 --- a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_config.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 : 2025-12-06 -# @License : Mulan PSL v2 -# @Desc : 测试vala-help软件包的配置功能,验证是否可以正常配置。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装vala-help软件包 - LOG_INFO "检查是否已安装vala-help软件包" - if dnf list installed vala-help &>/dev/null; then - LOG_INFO "vala-help软件包已安装,脚本结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "vala-help软件包未安装,将在脚本结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有vala-help软件包 - LOG_INFO "检查yum源中是否有vala-help软件包" - if ! dnf list available vala-help &>/dev/null; then - LOG_ERROR "yum源中未找到vala-help软件包" - exit 255 - fi - - # 安装vala-help软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装vala-help软件包" - dnf install -y vala-help - CHECK_RESULT $? 0 0 "安装vala-help软件包失败" - fi - - # 验证vala-help配置功能 - LOG_INFO "验证vala-help的配置功能" - vala-help --help &>/dev/null - CHECK_RESULT $? 0 0 "vala-help配置功能验证失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载vala-help软件包" - dnf remove -y vala-help - CHECK_RESULT $? 0 0 "卸载vala-help软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_install.sh b/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_install.sh deleted file mode 100644 index fb39b3ce363..00000000000 --- a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_install.sh +++ /dev/null @@ -1,63 +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-06 -# @License : Mulan PSL v2 -# @Desc : 测试vala-help软件包的安装功能,验证是否可以正常安装。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试vala-help软件包的安装功能,验证是否可以正常安装。" - - # 检查vala-help软件包是否已安装 - if dnf list installed vala-help &>/dev/null; then - LOG_INFO "vala-help软件包已安装,测试结束后将保持安装状态。" - installed=true - else - LOG_INFO "vala-help软件包未安装,测试结束后将卸载。" - installed=false - fi - - # 检查yum源中是否存在vala-help软件包 - LOG_INFO "检查yum源中是否存在vala-help软件包。" - if ! dnf list available vala-help &>/dev/null; then - LOG_ERROR "yum源中不存在vala-help软件包,退出测试。" - exit 255 - fi - - # 安装vala-help软件包 - LOG_INFO "开始安装vala-help软件包。" - dnf install -y vala-help - CHECK_RESULT $? 0 0 "安装vala-help软件包失败。" - - # 验证vala-help命令是否可用 - LOG_INFO "验证vala-help命令是否可用。" - if ! vala-help --help &>/dev/null; then - LOG_ERROR "vala-help命令参数不支持或不存在,退出测试。" - exit 255 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "测试前未安装vala-help,卸载软件包以恢复环境。" - dnf remove -y vala-help - CHECK_RESULT $? 0 0 "卸载vala-help软件包失败。" - fi - - LOG_INFO "测试完成,环境已恢复。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_uninstall.sh b/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_uninstall.sh deleted file mode 100644 index c77d8afe73c..00000000000 --- a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_uninstall.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-06 -# @License : Mulan PSL v2 -# @Desc : 测试vala-help软件包的卸载功能,验证是否可以正常卸载。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试vala-help软件包的卸载功能" - - # 检查yum源中是否存在vala-help软件包 - LOG_INFO "检查yum源中是否存在vala-help软件包" - dnf list available vala-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到vala-help软件包" - exit 255 - fi - - # 检查vala-help是否已安装 - LOG_INFO "检查vala-help是否已安装" - rpm -q vala-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "vala-help已安装,脚本结束后将保持安装状态" - installed=true - else - LOG_INFO "vala-help未安装,将进行安装并测试卸载功能" - installed=false - - # 安装vala-help软件包 - LOG_INFO "开始安装vala-help软件包" - dnf install -y vala-help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装vala-help失败" - fi - - # 验证卸载功能 - LOG_INFO "验证卸载功能" - dnf remove -y vala-help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载vala-help失败" - - # 恢复环境(如果最初未安装) - if [ "$installed" = false ]; then - LOG_INFO "恢复环境:重新安装vala-help(最初未安装)" - dnf install -y vala-help > /dev/null 2>&1 - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_version.sh b/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_version.sh deleted file mode 100644 index a7610d19fb0..00000000000 --- a/testcases/function_test/pkg_test/vala/vala-help/test_vala-help_function_version.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-06 -# @License : Mulan PSL v2 -# @Desc : 测试vala-help软件包的版本查看功能,验证是否可以正常查看版本信息。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装vala-help软件包 - LOG_INFO "检查是否已安装vala-help软件包" - if rpm -q vala-help &>/dev/null; then - LOG_INFO "vala-help软件包已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "vala-help软件包未安装,将在测试完成后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有vala-help软件包 - LOG_INFO "检查yum源中是否有vala-help软件包" - if ! dnf list available vala-help &>/dev/null; then - LOG_ERROR "yum源中未找到vala-help软件包" - exit 255 - fi - - # 安装vala-help软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装vala-help软件包" - dnf install -y vala-help - CHECK_RESULT $? 0 0 "安装vala-help软件包失败" - fi - - # 验证版本查看功能 - LOG_INFO "验证vala-help的版本查看功能" - version_output=$(vala-help --version) - CHECK_RESULT $? 0 0 "执行vala-help --version失败" - - # 检查版本信息是否有效 - if [ -z "$version_output" ]; then - LOG_ERROR "未获取到版本信息" - exit 255 - else - LOG_INFO "版本信息: $version_output" - fi - - # 清理环境(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载vala-help软件包" - dnf remove -y vala-help - CHECK_RESULT $? 0 0 "卸载vala-help软件包失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file From c9d58d4ac9af24e708ed54a84e8b3e21980403af Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:44:16 +0800 Subject: [PATCH 03/25] update testcase for testsuite texlive-collection-langenglish --- .../texlive-collection-langenglish.json | 12 -- ...st_texlive-collection-langenglish_check.sh | 84 ----------- ...t_texlive-collection-langenglish_remove.sh | 85 ----------- ...st_texlive-collection-langenglish_usage.sh | 136 ------------------ 4 files changed, 317 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_check.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_remove.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_usage.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish.json b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish.json index 79a8037959d..9d2c3f6b917 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish.json +++ b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish.json @@ -5,18 +5,6 @@ { "name": "test_texlive-collection-langenglish_install", "desc": "测试软件包texlive-collection-langenglish的安装功能" - }, - { - "name": "test_texlive-collection-langenglish_check", - "desc": "测试检查texlive-collection-langenglish软件包是否已正确安装" - }, - { - "name": "test_texlive-collection-langenglish_remove", - "desc": "测试软件包texlive-collection-langenglish的卸载功能" - }, - { - "name": "test_texlive-collection-langenglish_usage", - "desc": "测试texlive-collection-langenglish提供的基础英文排版支持" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_check.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_check.sh deleted file mode 100644 index dfb2da03f7b..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_check.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试检查texlive-collection-langenglish软件包是否已正确安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查texlive-collection-langenglish软件包是否已正确安装 - - LOG_INFO "开始测试: 检查texlive-collection-langenglish软件包是否已正确安装" - - # 检查软件包是否已在yum源中 - LOG_INFO "步骤1: 检查yum源中是否存在texlive-collection-langenglish软件包" - dnf list available texlive-collection-langenglish > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-collection-langenglish软件包" - exit 255 - fi - - # 检查当前是否已安装该软件包 - LOG_INFO "步骤2: 检查当前是否已安装texlive-collection-langenglish软件包" - rpm -q texlive-collection-langenglish > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,测试后将保持安装状态" - INSTALLED_BEFORE_TEST=1 - else - LOG_INFO "软件包未安装,测试后将卸载" - INSTALLED_BEFORE_TEST=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_BEFORE_TEST -eq 0 ]; then - LOG_INFO "步骤3: 安装texlive-collection-langenglish软件包" - dnf install -y texlive-collection-langenglish - CHECK_RESULT $? 0 0 "安装texlive-collection-langenglish失败" - fi - - # 验证软件包是否已正确安装 - LOG_INFO "步骤4: 验证软件包是否已正确安装" - rpm -q texlive-collection-langenglish - CHECK_RESULT $? 0 0 "texlive-collection-langenglish软件包未正确安装" - - # 检查软件包的基本功能 - LOG_INFO "步骤5: 检查软件包的基本功能" - rpm -ql texlive-collection-langenglish | grep -q "\.tex$" - CHECK_RESULT $? 0 0 "texlive-collection-langenglish软件包不包含预期的tex文件" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $INSTALLED_BEFORE_TEST -eq 0 ]; then - LOG_INFO "步骤6: 清理环境,卸载texlive-collection-langenglish软件包" - dnf remove -y texlive-collection-langenglish - CHECK_RESULT $? 0 0 "卸载texlive-collection-langenglish失败" - - # 验证是否已卸载 - rpm -q texlive-collection-langenglish > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "软件包卸载失败" - exit 1 - else - LOG_INFO "环境已恢复到测试前状态" - fi - else - LOG_INFO "步骤6: 保持软件包安装状态,无需清理" - fi - - LOG_INFO "测试完成: texlive-collection-langenglish软件包安装测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_remove.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_remove.sh deleted file mode 100644 index 30adedb2e9c..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_remove.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 : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试软件包texlive-collection-langenglish的卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 texlive-collection-langenglish 软件包的卸载功能" - - # 检查软件包是否在 yum 源中 - LOG_INFO "检查 yum 源中是否存在 texlive-collection-langenglish 软件包" - dnf list available texlive-collection-langenglish &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 texlive-collection-langenglish 软件包" - exit 255 - fi - - # 检查当前是否已安装 - LOG_INFO "检查 texlive-collection-langenglish 是否已安装" - if rpm -q texlive-collection-langenglish &>/dev/null; then - LOG_INFO "软件包已安装,测试后将保持安装状态" - already_installed=true - else - LOG_INFO "软件包未安装,将执行安装和卸载测试" - already_installed=false - fi - - # 如果未安装,则先安装 - if [ "$already_installed" = "false" ]; then - LOG_INFO "安装 texlive-collection-langenglish 软件包" - dnf install -y texlive-collection-langenglish - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 验证安装 - LOG_INFO "验证软件包安装成功" - rpm -q texlive-collection-langenglish - CHECK_RESULT $? 0 0 "验证软件包安装失败" - - # 执行卸载测试 - LOG_INFO "执行卸载操作" - dnf remove -y texlive-collection-langenglish - CHECK_RESULT $? 0 0 "卸载软件包失败" - - # 验证卸载 - LOG_INFO "验证软件包已卸载" - rpm -q texlive-collection-langenglish - if [ $? -eq 0 ]; then - LOG_ERROR "软件包卸载后仍然存在" - exit 1 - else - LOG_INFO "软件包卸载验证成功" - fi - - # 环境恢复:如果原本未安装,则保持未安装状态;如果原本已安装,则重新安装 - if [ "$already_installed" = "true" ]; then - LOG_INFO "恢复环境:重新安装 texlive-collection-langenglish" - dnf install -y texlive-collection-langenglish - CHECK_RESULT $? 0 0 "重新安装软件包失败" - LOG_INFO "环境已恢复为已安装状态" - else - LOG_INFO "环境已恢复为未安装状态" - fi - - LOG_INFO "texlive-collection-langenglish 卸载功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_usage.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_usage.sh deleted file mode 100644 index a4fd85fd2b7..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-langenglish/test_texlive-collection-langenglish_usage.sh +++ /dev/null @@ -1,136 +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 : 测试texlive-collection-langenglish提供的基础英文排版支持 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查与日志输出 - LOG_INFO "开始测试 texlive-collection-langenglish 提供的基础英文排版支持" - - # 定义软件包名称 - PACKAGE_NAME="texlive-collection-langenglish" - - # 1. 检查软件包是否已在系统中安装 - LOG_INFO "检查软件包是否已安装" - rpm -q "$PACKAGE_NAME" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE="true" - else - LOG_INFO "软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE="false" - fi - - # 2. 检查yum源中是否存在该软件包 - LOG_INFO "检查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 [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "安装软件包 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 4. 验证软件包安装成功 - LOG_INFO "验证软件包安装成功" - rpm -q "$PACKAGE_NAME" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 未正确安装" - - # 5. 测试texlive-collection-langenglish提供的基础英文排版支持 - LOG_INFO "测试基础英文排版支持" - # 使用texlive提供的命令进行测试,例如:检查相关文件是否存在 - TEXLIVE_PATH="/usr/share/texlive/texmf-dist/tex/latex/base" - if [ -d "$TEXLIVE_PATH" ]; then - LOG_INFO "TeX Live 基础路径存在" - # 检查英文排版相关文件 - if [ -f "$TEXLIVE_PATH/article.cls" ]; then - LOG_INFO "找到英文排版基础类文件 article.cls" - else - LOG_ERROR "未找到英文排版基础类文件 article.cls" - CHECK_RESULT 1 0 0 "英文排版基础类文件缺失" - fi - else - LOG_ERROR "TeX Live 基础路径不存在" - CHECK_RESULT 1 0 0 "TeX Live 基础路径缺失" - fi - - # 6. 测试英文排版命令 - LOG_INFO "测试英文排版命令" - # 使用texlive提供的命令进行简单测试 - which pdflatex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdflatex 命令未找到" - - # 7. 创建简单的英文TeX文档进行测试 - LOG_INFO "创建简单英文TeX文档进行测试" - TEST_TEX_FILE="/tmp/test_english.tex" - cat > "$TEST_TEX_FILE" << "EOF" - \documentclass{article} - \begin{document} - This is a test document for English typesetting support. - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试TeX文件失败" - - # 8. 尝试编译英文文档 - LOG_INFO "尝试编译英文TeX文档" - pdflatex -interaction=nonstopmode "$TEST_TEX_FILE" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "英文TeX文档编译失败" - - # 9. 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f "${TEST_TEX_FILE%.tex}.pdf" ]; then - LOG_INFO "英文TeX文档编译成功,PDF文件已生成" - else - LOG_ERROR "英文TeX文档编译失败,未生成PDF文件" - CHECK_RESULT 1 0 0 "PDF文件生成失败" - fi - - # 10. 清理测试文件 - LOG_INFO "清理测试文件" - rm -f "$TEST_TEX_FILE" "${TEST_TEX_FILE%.tex}.pdf" "${TEST_TEX_FILE%.tex}.aux" "${TEST_TEX_FILE%.tex}.log" > /dev/null 2>&1 - - # 11. 环境恢复 - LOG_INFO "恢复测试环境" - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载测试安装的软件包" - dnf remove -y "$PACKAGE_NAME" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - - # 验证卸载成功 - rpm -q "$PACKAGE_NAME" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "软件包卸载失败" - CHECK_RESULT 1 0 0 "软件包卸载验证失败" - else - LOG_INFO "软件包成功卸载" - fi - else - LOG_INFO "保持软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 506b557c2fbaf970f7e73385a37dfca95b3f8ff5 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:44:49 +0800 Subject: [PATCH 04/25] update testcase for testsuite python-asteval-help --- .../python-asteval/python-asteval-help.json | 10 --- .../test_python-asteval-help_function_eval.sh | 63 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/python-asteval/python-asteval-help.json delete mode 100644 testcases/function_test/pkg_test/python-asteval/python-asteval-help/test_python-asteval-help_function_eval.sh diff --git a/suite2cases/function_test/pkg_test/python-asteval/python-asteval-help.json b/suite2cases/function_test/pkg_test/python-asteval/python-asteval-help.json deleted file mode 100644 index ee1f521a1c6..00000000000 --- a/suite2cases/function_test/pkg_test/python-asteval/python-asteval-help.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-asteval/python-asteval-help", - "machine num": 1, - "cases": [ - { - "name": "test_python-asteval-help_function_eval", - "desc": "Test basic expression evaluation" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-asteval/python-asteval-help/test_python-asteval-help_function_eval.sh b/testcases/function_test/pkg_test/python-asteval/python-asteval-help/test_python-asteval-help_function_eval.sh deleted file mode 100644 index 5da8239a88f..00000000000 --- a/testcases/function_test/pkg_test/python-asteval/python-asteval-help/test_python-asteval-help_function_eval.sh +++ /dev/null @@ -1,63 +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-06 -# @License : Mulan PSL v2 -# @Desc : Test basic expression evaluation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查python-asteval软件包是否已安装 - LOG_INFO "检查python-asteval软件包是否已安装" - rpm -q python-asteval > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python-asteval已安装,脚本结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "python-asteval未安装,将在脚本结束前卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有python-asteval软件包 - LOG_INFO "检查yum源中是否有python-asteval软件包" - dnf list available python-asteval > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中无python-asteval软件包" - - # 安装python-asteval软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装python-asteval软件包" - dnf install -y python-asteval > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "安装python-asteval失败" - fi - - # 测试基本表达式求值功能 - LOG_INFO "测试基本表达式求值功能" - python3 -c "from asteval import Interpreter; aeval = Interpreter(); result = aeval("2 + 2"); print(result)" | grep -q "4" - CHECK_RESULT $? 0 0 "基本表达式求值失败" - - # 清理环境 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python-asteval软件包" - dnf remove -y python-asteval > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载python-asteval失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file From b52de437a4acbe7e12b3a68e021d04922cdee4af Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:44:57 +0800 Subject: [PATCH 05/25] update testcase for testsuite atf-tests --- .../function_test/pkg_test/atf/atf-tests.json | 4 -- .../test_atf-tests_function_basic.sh | 69 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 testcases/function_test/pkg_test/atf/atf-tests/test_atf-tests_function_basic.sh diff --git a/suite2cases/function_test/pkg_test/atf/atf-tests.json b/suite2cases/function_test/pkg_test/atf/atf-tests.json index 204e971dd53..95d30f3f8f9 100644 --- a/suite2cases/function_test/pkg_test/atf/atf-tests.json +++ b/suite2cases/function_test/pkg_test/atf/atf-tests.json @@ -6,10 +6,6 @@ "name": "test_atf-tests_install_package", "desc": "测试atf-tests软件包的安装功能,验证安装过程是否正常完成", "machine num": 1 - }, - { - "name": "test_atf-tests_function_basic", - "desc": "测试atf-tests软件包的基础功能,验证其核心功能是否正常工作" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/atf/atf-tests/test_atf-tests_function_basic.sh b/testcases/function_test/pkg_test/atf/atf-tests/test_atf-tests_function_basic.sh deleted file mode 100644 index 60667f27497..00000000000 --- a/testcases/function_test/pkg_test/atf/atf-tests/test_atf-tests_function_basic.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-12 -# @License : Mulan PSL v2 -# @Desc : 测试atf-tests软件包的基础功能,验证其核心功能是否正常工作 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试atf-tests软件包的基础功能,验证其核心功能是否正常工作" - - # 检查是否已安装atf-tests软件包 - LOG_INFO "检查是否已安装atf-tests软件包" - if rpm -q atf-tests &>/dev/null; then - LOG_INFO "atf-tests软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "atf-tests软件包未安装,将在测试步骤中安装并在脚本结束前卸载" - INSTALLED=false - fi - - # 检查yum源中是否有atf-tests软件包 - LOG_INFO "检查yum源中是否有atf-tests软件包" - if ! dnf list available atf-tests &>/dev/null; then - LOG_ERROR "yum源中未找到atf-tests软件包" - exit 255 - fi - - # 安装atf-tests软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装atf-tests软件包" - dnf install -y atf-tests - CHECK_RESULT $? 0 0 "安装atf-tests软件包失败" - fi - - # 验证atf-tests核心功能 - LOG_INFO "验证atf-tests核心功能" - atf-run --help &>/dev/null - CHECK_RESULT $? 0 0 "atf-run命令不支持或参数错误" - - # 执行测试命令示例 - LOG_INFO "执行测试命令示例" - atf-run -s /usr/share/atf/tests - CHECK_RESULT $? 0 0 "执行atf-tests测试失败" - - # 清理环境(如果脚本开始时未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载atf-tests软件包" - dnf remove -y atf-tests - CHECK_RESULT $? 0 0 "卸载atf-tests软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From d40120e0b36f918b227fe99b238f9a936c1fea14 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:45:26 +0800 Subject: [PATCH 06/25] update testcase for testsuite rubygem-method_source-doc --- .../rubygem-method_source-doc.json | 26 ----- ...ygem-method_source-doc_function_install.sh | 73 ------------- ...ygem-method_source-doc_function_require.sh | 76 ------------- ...gem-method_source-doc_function_retrieve.sh | 72 ------------- ...em-method_source-doc_function_uninstall.sh | 75 ------------- ...ygem-method_source-doc_function_version.sh | 102 ------------------ 6 files changed, 424 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc.json delete mode 100644 testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_install.sh delete mode 100644 testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_require.sh delete mode 100644 testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_retrieve.sh delete mode 100644 testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_version.sh diff --git a/suite2cases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc.json b/suite2cases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc.json deleted file mode 100644 index 9352d9969be..00000000000 --- a/suite2cases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc", - "machine num": 1, - "cases": [ - { - "name": "test_rubygem-method_source-doc_function_retrieve", - "desc": "Test method source retrieval" - }, - { - "name": "test_rubygem-method_source-doc_function_install", - "desc": "Test package installation" - }, - { - "name": "test_rubygem-method_source-doc_function_require", - "desc": "Test basic module load" - }, - { - "name": "test_rubygem-method_source-doc_function_version", - "desc": "Test version retrieval" - }, - { - "name": "test_rubygem-method_source-doc_function_uninstall", - "desc": "Test package removal" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_install.sh b/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_install.sh deleted file mode 100644 index a47c76ab459..00000000000 --- a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_install.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 : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="rubygem-method_source-doc_function" - - # 检查yum源中是否存在指定软件包 - LOG_INFO "检查yum源中是否存在软件包: $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在软件包: $PACKAGE_NAME" - exit 255 - fi - - # 检查当前环境是否已安装该软件包 - LOG_INFO "检查当前环境是否已安装软件包: $PACKAGE_NAME" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; 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 失败" - LOG_INFO "软件包 $PACKAGE_NAME 安装成功" - fi - - # 测试软件包基本功能 - LOG_INFO "测试软件包 $PACKAGE_NAME 的基本功能" - # 这里根据实际软件包的功能添加测试命令 - # 示例:如果软件包提供了某个命令,可以测试该命令 - # command_from_package --help - # CHECK_RESULT $? 0 0 "软件包基本功能测试失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "清理环境:卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - LOG_INFO "软件包 $PACKAGE_NAME 卸载成功" - else - LOG_INFO "测试前软件包已安装,保持安装状态,不进行卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_require.sh b/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_require.sh deleted file mode 100644 index 9da94c7b64e..00000000000 --- a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_require.sh +++ /dev/null @@ -1,76 +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 : Test basic module load -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否以root用户运行 - if [[ $(id -u) -ne 0 ]]; then - LOG_ERROR "此脚本需要root权限运行" - exit 255 - fi - - # 定义软件包名称 - PACKAGE_NAME="rubygem-method_source-doc_function_require" - LOG_INFO "开始测试基础模块加载功能" - - # 步骤1: 检查yum源中是否存在该软件包 - LOG_INFO "步骤1: 检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - CHECK_RESULT $? 0 255 "yum源中未找到软件包 $PACKAGE_NAME" - - # 步骤2: 检查是否已安装 - LOG_INFO "步骤2: 检查软件包是否已安装" - if rpm -q $PACKAGE_NAME &>/dev/null; then - INSTALLED=true - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - else - INSTALLED=false - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - fi - - # 步骤3: 如果未安装,则安装软件包 - if [[ $INSTALLED == false ]]; then - LOG_INFO "步骤3: 安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4: 测试基础模块加载功能 - LOG_INFO "步骤4: 测试基础模块加载功能" - # 这里假设模块加载测试是通过特定命令进行的 - # 根据实际测试需求修改以下命令 - TEST_COMMAND="ruby -e \"require "method_source"\"" - eval $TEST_COMMAND - CHECK_RESULT $? 0 0 "模块加载测试失败" - - # 步骤5: 环境清理 - LOG_INFO "步骤5: 环境清理" - if [[ $INSTALLED == false ]]; then - LOG_INFO "卸载测试安装的软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试完成:基础模块加载功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_retrieve.sh b/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_retrieve.sh deleted file mode 100644 index 63c40bf7cde..00000000000 --- a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_retrieve.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-01 -# @License : Mulan PSL v2 -# @Desc : Test method source retrieval -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test method source retrieval" - - # 检查是否已安装rubygem-method_source-doc软件包 - LOG_INFO "检查rubygem-method_source-doc是否已安装" - if dnf list installed rubygem-method_source-doc &>/dev/null; then - LOG_INFO "rubygem-method_source-doc已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "rubygem-method_source-doc未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有rubygem-method_source-doc软件包 - LOG_INFO "检查yum源中是否有rubygem-method_source-doc软件包" - if ! dnf list available rubygem-method_source-doc &>/dev/null; then - LOG_ERROR "yum源中未找到rubygem-method_source-doc软件包" - exit 255 - fi - - # 安装rubygem-method_source-doc软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装rubygem-method_source-doc软件包" - dnf install -y rubygem-method_source-doc - CHECK_RESULT $? 0 0 "安装rubygem-method_source-doc软件包失败" - fi - - # 测试method source retrieval功能 - LOG_INFO "测试method source retrieval功能" - source_output=$(ruby -rmethod_source -e "puts method(:puts).source") - CHECK_RESULT $? 0 0 "执行method source retrieval失败" - - # 检查输出是否有效 - if [ -z "$source_output" ]; then - LOG_ERROR "method source retrieval返回空结果" - exit 1 - else - LOG_INFO "method source retrieval返回有效结果" - fi - - # 清理环境(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载rubygem-method_source-doc软件包" - dnf remove -y rubygem-method_source-doc - CHECK_RESULT $? 0 0 "卸载rubygem-method_source-doc软件包失败" - fi - - LOG_INFO "测试完成:Test method source retrieval" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_uninstall.sh b/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_uninstall.sh deleted file mode 100644 index 85657cb9c30..00000000000 --- a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_uninstall.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-03-06 -# @License : Mulan PSL v2 -# @Desc : Test package removal -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:软件包卸载功能" - - # 检查是否已安装指定软件包 - LOG_INFO "检查环境中是否已安装 rubygem-method_source-doc 软件包" - if dnf list installed rubygem-method_source-doc &>/dev/null; then - LOG_INFO "环境已安装 rubygem-method_source-doc,测试结束后保持安装状态" - already_installed=1 - else - LOG_INFO "环境未安装 rubygem-method_source-doc,将在测试前安装" - already_installed=0 - fi - - # 检查 yum 源中是否有该软件包 - LOG_INFO "检查 yum 源中是否存在 rubygem-method_source-doc 软件包" - if ! dnf list available rubygem-method_source-doc &>/dev/null; then - LOG_ERROR "yum 源中未找到 rubygem-method_source-doc 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "开始安装 rubygem-method_source-doc 软件包" - dnf install -y rubygem-method_source-doc - CHECK_RESULT $? 0 0 "安装 rubygem-method_source-doc 软件包失败" - fi - - # 测试卸载软件包 - LOG_INFO "测试卸载 rubygem-method_source-doc 软件包" - dnf remove -y rubygem-method_source-doc - CHECK_RESULT $? 0 0 "卸载 rubygem-method_source-doc 软件包失败" - - # 验证软件包是否已卸载 - LOG_INFO "验证 rubygem-method_source-doc 软件包是否已卸载" - if dnf list installed rubygem-method_source-doc &>/dev/null; then - LOG_ERROR "rubygem-method_source-doc 软件包卸载失败" - exit 1 - else - LOG_INFO "rubygem-method_source-doc 软件包已成功卸载" - fi - - # 如果测试前未安装,则重新安装以恢复环境 - if [ $already_installed -eq 0 ]; then - LOG_INFO "恢复环境:重新安装 rubygem-method_source-doc 软件包" - dnf install -y rubygem-method_source-doc - CHECK_RESULT $? 0 0 "恢复环境时安装 rubygem-method_source-doc 软件包失败" - else - LOG_INFO "环境恢复:保持 rubygem-method_source-doc 软件包安装状态" - fi - - LOG_INFO "测试完成:软件包卸载功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_version.sh b/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_version.sh deleted file mode 100644 index e334d34c70a..00000000000 --- a/testcases/function_test/pkg_test/rubygem-method_source/rubygem-method_source-doc/test_rubygem-method_source-doc_function_version.sh +++ /dev/null @@ -1,102 +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 : Test version retrieval -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量和常量 - PACKAGE_NAME="rubygem-method_source-doc" - LOG_INFO "开始测试:Test version retrieval" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在" - exit 255 - fi - - # 步骤2:检查软件包是否已经安装 - LOG_INFO "步骤2:检查软件包 $PACKAGE_NAME 是否已经安装" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已经安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试步骤中安装" - ALREADY_INSTALLED=0 - 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:测试版本查询功能" - # 假设软件包提供 version 命令或参数,这里以常见的 --version 为例 - # 如果实际命令不同,需要根据实际情况调整 - VERSION_CMD="method_source-doc --version" - if ! command -v method_source-doc &>/dev/null; then - LOG_ERROR "命令 method_source-doc 不存在或不支持" - exit 255 - fi - - $VERSION_CMD &>/dev/null - if [ $? -ne 0 ]; then - # 尝试其他可能的版本参数 - VERSION_CMD="method_source-doc -v" - $VERSION_CMD &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "命令 method_source-doc 不支持版本查询参数" - exit 255 - fi - fi - - # 执行版本查询命令 - LOG_INFO "执行命令: $VERSION_CMD" - VERSION_OUTPUT=$($VERSION_CMD 2>&1) - CHECK_RESULT $? 0 0 "执行版本查询命令失败" - LOG_INFO "版本查询结果: $VERSION_OUTPUT" - - # 步骤5:验证版本信息格式(简单检查是否包含数字和点) - LOG_INFO "步骤5:验证版本信息格式" - if echo "$VERSION_OUTPUT" | grep -qE "[0-9]+\.[0-9]+(\.[0-9]+)*"; then - LOG_INFO "版本信息格式正确" - else - LOG_ERROR "版本信息格式不正确" - CHECK_RESULT 1 0 0 "版本信息格式验证失败" - fi - - # 步骤6:环境清理 - LOG_INFO "步骤6:环境清理" - 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 "测试完成:Test version retrieval 测试通过" -} - -main "$@" \ No newline at end of file From e8123a7a176e2830f4a13555ef1211ed6fc7cdf0 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:50:20 +0800 Subject: [PATCH 07/25] update testcase for testsuite jetty-project --- .../pkg_test/jetty/jetty-project.json | 28 --- .../test_jetty-project_config.sh | 233 ------------------ .../test_jetty-project_deploy.sh | 107 -------- .../jetty-project/test_jetty-project_log.sh | 78 ------ .../test_jetty-project_restart.sh | 97 -------- .../jetty-project/test_jetty-project_start.sh | 93 ------- .../test_jetty-project_status.sh | 184 -------------- .../jetty-project/test_jetty-project_stop.sh | 115 --------- 8 files changed, 935 deletions(-) delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_config.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_deploy.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_log.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_restart.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_start.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_status.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_stop.sh diff --git a/suite2cases/function_test/pkg_test/jetty/jetty-project.json b/suite2cases/function_test/pkg_test/jetty/jetty-project.json index 26910cd03ab..f8a79f943b2 100644 --- a/suite2cases/function_test/pkg_test/jetty/jetty-project.json +++ b/suite2cases/function_test/pkg_test/jetty/jetty-project.json @@ -14,34 +14,6 @@ { "name": "test_jetty-project_version", "desc": "测试jetty-project软件包的版本查询功能,验证是否能正确显示版本信息。" - }, - { - "name": "test_jetty-project_status", - "desc": "测试jetty-project软件包的服务状态查询功能,验证服务是否正常运行。" - }, - { - "name": "test_jetty-project_start", - "desc": "测试jetty-project软件包的服务启动功能,验证服务是否能成功启动。" - }, - { - "name": "test_jetty-project_stop", - "desc": "测试jetty-project软件包的服务停止功能,验证服务是否能成功停止。" - }, - { - "name": "test_jetty-project_restart", - "desc": "测试jetty-project软件包的服务重启功能,验证服务是否能成功重启。" - }, - { - "name": "test_jetty-project_config", - "desc": "测试jetty-project软件包的配置文件读取功能,验证关键配置项是否正确。" - }, - { - "name": "test_jetty-project_log", - "desc": "测试jetty-project软件包的日志文件生成功能,验证日志文件是否存在且可读。" - }, - { - "name": "test_jetty-project_deploy", - "desc": "测试jetty-project软件包的Web应用部署功能,验证是否能成功部署一个简单的WAR包。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_config.sh b/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_config.sh deleted file mode 100644 index abf17b4bbbf..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_config.sh +++ /dev/null @@ -1,233 +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 : 测试jetty-project软件包的配置文件读取功能,验证关键配置项是否正确。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试jetty-project软件包配置文件读取功能 - - # 定义软件包名称 - PACKAGE_NAME="jetty-project" - - # 检查是否已安装jetty-project - LOG_INFO "检查是否已安装${PACKAGE_NAME}..." - if rpm -q ${PACKAGE_NAME} > /dev/null 2>&1; then - LOG_INFO "${PACKAGE_NAME}已安装" - ALREADY_INSTALLED=1 - else - LOG_INFO "${PACKAGE_NAME}未安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有${PACKAGE_NAME}软件包..." - if ! dnf search ${PACKAGE_NAME} | grep -q "${PACKAGE_NAME}"; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - - # 如果未安装,则安装软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "安装${PACKAGE_NAME}软件包..." - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - LOG_INFO "${PACKAGE_NAME}安装成功" - fi - - # 获取jetty-project配置文件路径 - LOG_INFO "查找${PACKAGE_NAME}配置文件..." - CONFIG_FILES=$(rpm -qc ${PACKAGE_NAME} 2>/dev/null) - if [ -z "${CONFIG_FILES}" ]; then - LOG_ERROR "未找到${PACKAGE_NAME}的配置文件" - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "清理环境,卸载${PACKAGE_NAME}..." - dnf remove -y ${PACKAGE_NAME} - fi - exit 1 - fi - - LOG_INFO "找到${PACKAGE_NAME}配置文件:" - echo "${CONFIG_FILES}" | while read file; do - LOG_INFO " ${file}" - done - - # 测试关键配置文件是否存在并可读 - LOG_INFO "检查关键配置文件是否存在并可读..." - MAIN_CONFIG=$(echo "${CONFIG_FILES}" | grep -E "\.(conf|cfg|config|properties|xml|yml|yaml)$" | head -1) - if [ -z "${MAIN_CONFIG}" ]; then - MAIN_CONFIG=$(echo "${CONFIG_FILES}" | head -1) - fi - - if [ -n "${MAIN_CONFIG}" ] && [ -f "${MAIN_CONFIG}" ]; then - LOG_INFO "使用主配置文件: ${MAIN_CONFIG}" - - # 检查配置文件是否可读 - if [ -r "${MAIN_CONFIG}" ]; then - LOG_INFO "配置文件可读" - else - LOG_ERROR "配置文件不可读: ${MAIN_CONFIG}" - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "清理环境,卸载${PACKAGE_NAME}..." - dnf remove -y ${PACKAGE_NAME} - fi - exit 1 - fi - - # 检查配置文件内容 - LOG_INFO "检查配置文件内容..." - FILE_SIZE=$(stat -c%s "${MAIN_CONFIG}" 2>/dev/null || wc -c < "${MAIN_CONFIG}") - if [ ${FILE_SIZE} -gt 0 ]; then - LOG_INFO "配置文件非空,大小为: ${FILE_SIZE}字节" - else - LOG_ERROR "配置文件为空: ${MAIN_CONFIG}" - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "清理环境,卸载${PACKAGE_NAME}..." - dnf remove -y ${PACKAGE_NAME} - fi - exit 1 - fi - - # 检查关键配置项(根据常见配置项检查) - LOG_INFO "检查关键配置项..." - - # 检查端口配置(常见配置项) - if grep -q -i "port" "${MAIN_CONFIG}" || \ - grep -q -i "listen" "${MAIN_CONFIG}" || \ - grep -q -i "address" "${MAIN_CONFIG}"; then - LOG_INFO "找到网络相关配置项" - else - LOG_INFO "未找到网络相关配置项(可能是其他类型的配置文件)" - fi - - # 检查日志配置(常见配置项) - if grep -q -i "log" "${MAIN_CONFIG}" || \ - grep -q -i "logging" "${MAIN_CONFIG}"; then - LOG_INFO "找到日志相关配置项" - fi - - # 检查路径配置(常见配置项) - if grep -q -i "path" "${MAIN_CONFIG}" || \ - grep -q -i "dir" "${MAIN_CONFIG}" || \ - grep -q -i "home" "${MAIN_CONFIG}"; then - LOG_INFO "找到路径相关配置项" - fi - - # 尝试读取配置文件前10行内容 - LOG_INFO "配置文件前10行内容预览:" - head -10 "${MAIN_CONFIG}" | while read line; do - LOG_INFO " ${line}" - done - - else - LOG_ERROR "未找到有效的配置文件" - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "清理环境,卸载${PACKAGE_NAME}..." - dnf remove -y ${PACKAGE_NAME} - fi - exit 1 - fi - - # 测试配置文件语法(如果适用) - LOG_INFO "检查配置文件语法..." - case "${MAIN_CONFIG}" in - *.xml) - if command -v xmllint >/dev/null 2>&1; then - xmllint --noout "${MAIN_CONFIG}" >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "XML配置文件语法正确" - else - LOG_ERROR "XML配置文件语法错误" - fi - else - LOG_INFO "未安装xmllint,跳过XML语法检查" - fi - ;; - *.yaml|*.yml) - if command -v yamllint >/dev/null 2>&1; then - yamllint "${MAIN_CONFIG}" >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "YAML配置文件语法正确" - else - LOG_ERROR "YAML配置文件语法错误" - fi - else - LOG_INFO "未安装yamllint,跳过YAML语法检查" - fi - ;; - *.json) - if command -v jq >/dev/null 2>&1; then - jq empty "${MAIN_CONFIG}" >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "JSON配置文件语法正确" - else - LOG_ERROR "JSON配置文件语法错误" - fi - else - LOG_INFO "未安装jq,跳过JSON语法检查" - fi - ;; - *) - LOG_INFO "非标准配置文件格式,跳过语法检查" - ;; - esac - - # 检查jetty-project服务状态(如果存在服务) - LOG_INFO "检查jetty-project服务状态..." - if systemctl list-unit-files | grep -q -i jetty; then - LOG_INFO "找到jetty相关服务" - SERVICE_NAME=$(systemctl list-unit-files | grep -i jetty | head -1 | awk "{print $1}") - - # 检查服务配置文件 - SERVICE_CONFIG="/usr/lib/systemd/system/${SERVICE_NAME}" - if [ -f "${SERVICE_CONFIG}" ]; then - LOG_INFO "服务配置文件: ${SERVICE_CONFIG}" - - # 检查服务配置文件中的关键配置 - if grep -q "ExecStart" "${SERVICE_CONFIG}"; then - LOG_INFO "找到ExecStart配置" - EXEC_CMD=$(grep "ExecStart" "${SERVICE_CONFIG}" | head -1) - LOG_INFO "启动命令: ${EXEC_CMD}" - fi - - if grep -q "Environment" "${SERVICE_CONFIG}"; then - LOG_INFO "找到Environment配置" - grep "Environment" "${SERVICE_CONFIG}" | while read env_line; do - LOG_INFO "环境变量: ${env_line}" - done - fi - fi - else - LOG_INFO "未找到jetty系统服务" - fi - - # 清理环境 - if [ ${ALREADY_INSTALLED} -eq 0 ]; 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 "测试完成: jetty-project配置文件读取功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_deploy.sh b/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_deploy.sh deleted file mode 100644 index 03c5425972d..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_deploy.sh +++ /dev/null @@ -1,107 +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 : 测试jetty-project软件包的Web应用部署功能,验证是否能成功部署一个简单的WAR包。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试jetty-project软件包的Web应用部署功能" - - # 检查是否已安装jetty-project - if dnf list installed jetty-project > /dev/null 2>&1; then - LOG_INFO "检测到jetty-project已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "未检测到jetty-project安装,将在测试中安装,并在测试结束后卸载" - already_installed=false - fi - - # 检查yum源中是否存在jetty-project软件包 - LOG_INFO "检查yum源中是否存在jetty-project软件包" - if ! dnf list available jetty-project > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到jetty-project软件包" - exit 255 - fi - - # 如果未安装,则安装jetty-project - if [ "$already_installed" = false ]; then - LOG_INFO "安装jetty-project软件包" - dnf install -y jetty-project - CHECK_RESULT $? 0 0 "安装jetty-project失败" - fi - - # 检查jetty-project命令是否支持所需参数 - LOG_INFO "检查jetty-project命令是否支持所需参数" - if ! jetty-project --help 2>&1 | grep -q "deploy"; then - LOG_ERROR "jetty-project命令不支持deploy参数" - exit 255 - fi - - # 准备一个简单的测试WAR包(这里使用一个最小的示例,实际可能需要根据具体包调整) - LOG_INFO "准备一个简单的测试WAR包" - TEST_WAR="/tmp/test-app.war" - cat > /tmp/test-web.xml << "EOF" - - - Test Application - - EOF - jar -cf "$TEST_WAR" -C /tmp test-web.xml - CHECK_RESULT $? 0 0 "创建测试WAR包失败" - - # 部署WAR包 - LOG_INFO "部署测试WAR包到jetty-project" - jetty-project deploy "$TEST_WAR" --context-path /testapp - CHECK_RESULT $? 0 0 "部署WAR包失败" - - # 验证部署是否成功(这里假设jetty-project部署后可以通过HTTP访问) - LOG_INFO "验证Web应用是否部署成功" - # 使用curl检查应用是否可访问,这里假设jetty运行在8080端口 - sleep 3 # 等待应用启动 - if curl -f -s -o /dev/null http://localhost:8080/testapp/; then - LOG_INFO "Web应用部署成功,可以正常访问" - else - LOG_ERROR "Web应用部署失败,无法访问" - exit 1 - fi - - # 清理:停止应用并移除部署 - LOG_INFO "停止并移除测试Web应用" - jetty-project undeploy /testapp - CHECK_RESULT $? 0 0 "移除Web应用失败" - - # 清理临时文件 - rm -f "$TEST_WAR" /tmp/test-web.xml - - # 如果测试前未安装,则卸载jetty-project - if [ "$already_installed" = false ]; then - LOG_INFO "卸载jetty-project软件包" - dnf remove -y jetty-project - CHECK_RESULT $? 0 0 "卸载jetty-project失败" - fi - - LOG_INFO "jetty-project软件包的Web应用部署功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_log.sh b/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_log.sh deleted file mode 100644 index 5ff395bbdbc..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_log.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试jetty-project软件包的日志文件生成功能,验证日志文件是否存在且可读。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试jetty-project软件包的日志文件生成功能" - LOG_INFO "步骤1:检查yum源中是否存在jetty-project软件包" - dnf list available jetty-project > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到jetty-project软件包" - exit 255 - fi - LOG_INFO "jetty-project软件包在yum源中存在" - - LOG_INFO "步骤2:检查系统是否已安装jetty-project" - rpm -q jetty-project > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "jetty-project已安装,标记为保持安装状态" - INSTALLED="true" - else - LOG_INFO "jetty-project未安装,将进行安装" - INSTALLED="false" - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装jetty-project软件包" - dnf install -y jetty-project - CHECK_RESULT $? 0 0 "安装jetty-project失败" - LOG_INFO "jetty-project安装成功" - fi - - LOG_INFO "步骤4:检查jetty-project日志文件是否存在且可读" - LOG_FILE="/var/log/jetty/jetty.log" - if [ -f "$LOG_FILE" ]; then - LOG_INFO "日志文件 $LOG_FILE 存在" - if [ -r "$LOG_FILE" ]; then - LOG_INFO "日志文件 $LOG_FILE 可读" - CHECK_RESULT $? 0 0 "日志文件不可读" - else - LOG_ERROR "日志文件 $LOG_FILE 不可读" - CHECK_RESULT 1 0 0 "日志文件不可读" - fi - else - LOG_ERROR "日志文件 $LOG_FILE 不存在" - CHECK_RESULT 1 0 0 "日志文件不存在" - fi - - LOG_INFO "步骤5:清理环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载jetty-project软件包" - dnf remove -y jetty-project - CHECK_RESULT $? 0 0 "卸载jetty-project失败" - LOG_INFO "jetty-project卸载成功" - else - LOG_INFO "保持jetty-project安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_restart.sh b/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_restart.sh deleted file mode 100644 index f3807ccc650..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_restart.sh +++ /dev/null @@ -1,97 +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 : 测试jetty-project软件包的服务重启功能,验证服务是否能成功重启。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试jetty-project软件包的服务重启功能" - - # 检查yum源中是否有jetty-project软件包 - LOG_INFO "检查yum源中是否有jetty-project软件包" - dnf list available jetty-project 2>/dev/null | grep -q jetty-project - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到jetty-project软件包" - exit 255 - fi - - # 判断jetty-project是否已安装 - LOG_INFO "检查jetty-project是否已安装" - rpm -q jetty-project >/dev/null 2>&1 - already_installed=$? - - if [ $already_installed -eq 0 ]; then - LOG_INFO "jetty-project已安装,测试完成后将保持安装状态" - else - LOG_INFO "jetty-project未安装,将进行安装" - dnf install -y jetty-project - CHECK_RESULT $? 0 0 "安装jetty-project失败" - fi - - # 检查jetty-project服务是否存在 - LOG_INFO "检查jetty-project服务是否存在" - systemctl list-unit-files | grep -q jetty-project.service - if [ $? -ne 0 ]; then - LOG_ERROR "未找到jetty-project服务" - exit 255 - fi - - # 检查服务是否支持restart参数 - LOG_INFO "检查jetty-project服务是否支持restart参数" - systemctl help jetty-project.service 2>&1 | grep -q restart - if [ $? -ne 0 ]; then - LOG_ERROR "jetty-project服务不支持restart参数" - exit 255 - fi - - # 启动jetty-project服务 - LOG_INFO "启动jetty-project服务" - systemctl start jetty-project.service - CHECK_RESULT $? 0 0 "启动jetty-project服务失败" - - # 检查服务状态 - LOG_INFO "检查jetty-project服务状态" - systemctl status jetty-project.service --no-pager | grep -q "active (running)" - CHECK_RESULT $? 0 0 "jetty-project服务未正常运行" - - # 重启jetty-project服务 - LOG_INFO "重启jetty-project服务" - systemctl restart jetty-project.service - CHECK_RESULT $? 0 0 "重启jetty-project服务失败" - - # 再次检查服务状态 - LOG_INFO "再次检查jetty-project服务状态" - systemctl status jetty-project.service --no-pager | grep -q "active (running)" - CHECK_RESULT $? 0 0 "重启后jetty-project服务未正常运行" - - LOG_INFO "jetty-project服务重启功能测试完成" - - # 环境清理 - LOG_INFO "开始清理测试环境" - if [ $already_installed -ne 0 ]; then - LOG_INFO "卸载测试安装的jetty-project软件包" - dnf remove -y jetty-project - CHECK_RESULT $? 0 0 "卸载jetty-project失败" - else - LOG_INFO "保持jetty-project安装状态" - fi - - LOG_INFO "测试环境清理完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_start.sh b/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_start.sh deleted file mode 100644 index 80108f10ad1..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_start.sh +++ /dev/null @@ -1,93 +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 : 测试jetty-project软件包的服务启动功能,验证服务是否能成功启动。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试jetty-project软件包的服务启动功能" - - # 检查是否已安装jetty-project - LOG_INFO "检查是否已安装jetty-project" - rpm -q jetty-project > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "jetty-project已安装,测试后将保持安装状态" - already_installed=1 - else - LOG_INFO "jetty-project未安装,将在测试过程中安装并最终卸载" - already_installed=0 - fi - - # 检查yum源中是否有jetty-project软件包 - LOG_INFO "检查yum源中是否有jetty-project软件包" - dnf list available jetty-project > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有jetty-project软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有jetty-project软件包" - exit 255 - fi - - # 安装jetty-project软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装jetty-project软件包" - dnf install -y jetty-project - CHECK_RESULT $? 0 0 "安装jetty-project失败" - fi - - # 检查jetty-project服务启动命令参数 - LOG_INFO "检查jetty-project服务启动命令参数" - systemctl cat jetty > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "jetty服务不存在或不支持" - if [ $? -ne 0 ]; then - LOG_ERROR "jetty服务不存在或不支持" - # 如果是新安装的,需要卸载 - if [ $already_installed -eq 0 ]; then - dnf remove -y jetty-project - fi - exit 255 - fi - - # 启动jetty服务 - LOG_INFO "启动jetty服务" - systemctl start jetty - CHECK_RESULT $? 0 0 "启动jetty服务失败" - - # 检查jetty服务状态 - LOG_INFO "检查jetty服务状态" - systemctl is-active --quiet jetty - CHECK_RESULT $? 0 0 "jetty服务未正常运行" - - # 停止jetty服务 - LOG_INFO "停止jetty服务" - systemctl stop jetty - CHECK_RESULT $? 0 0 "停止jetty服务失败" - - # 清理环境 - LOG_INFO "清理测试环境" - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载jetty-project软件包" - dnf remove -y jetty-project - CHECK_RESULT $? 0 0 "卸载jetty-project失败" - else - LOG_INFO "保持jetty-project安装状态" - fi - - LOG_INFO "jetty-project服务启动功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_status.sh b/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_status.sh deleted file mode 100644 index 3401c8b6182..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_status.sh +++ /dev/null @@ -1,184 +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 : 测试jetty-project软件包的服务状态查询功能,验证服务是否正常运行。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数 - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -ne $expect ]; then - LOG_ERROR "$message" - exit $actual - fi - else - if [ $actual -eq $expect ]; then - LOG_ERROR "$message" - exit 1 - fi - fi - } - - # 检查yum源中是否存在指定软件包 - check_package_exist() { - local package_name=$1 - LOG_INFO "检查yum源中是否存在软件包: $package_name" - dnf list available "$package_name" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在软件包: $package_name" - exit 255 - fi - LOG_INFO "yum源中存在软件包: $package_name" - } - - # 检查软件包是否已安装 - check_package_installed() { - local package_name=$1 - LOG_INFO "检查软件包是否已安装: $package_name" - rpm -q "$package_name" &>/dev/null - return $? - } - - # 安装软件包 - install_package() { - local package_name=$1 - LOG_INFO "安装软件包: $package_name" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败" - LOG_INFO "软件包 $package_name 安装成功" - } - - # 卸载软件包 - uninstall_package() { - local package_name=$1 - LOG_INFO "卸载软件包: $package_name" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败" - LOG_INFO "软件包 $package_name 卸载成功" - } - - # 检查服务状态 - check_service_status() { - local service_name=$1 - LOG_INFO "检查服务状态: $service_name" - systemctl status "$service_name" &>/dev/null - local status=$? - if [ $status -eq 0 ]; then - LOG_INFO "服务 $service_name 正在运行" - return 0 - elif [ $status -eq 3 ]; then - LOG_INFO "服务 $service_name 已停止" - return 1 - else - LOG_ERROR "检查服务 $service_name 状态时发生错误" - return $status - fi - } - - # 启动服务 - start_service() { - local service_name=$1 - LOG_INFO "启动服务: $service_name" - systemctl start "$service_name" - CHECK_RESULT $? 0 0 "启动服务 $service_name 失败" - LOG_INFO "服务 $service_name 启动成功" - } - - # 停止服务 - stop_service() { - local service_name=$1 - LOG_INFO "停止服务: $service_name" - systemctl stop "$service_name" - CHECK_RESULT $? 0 0 "停止服务 $service_name 失败" - LOG_INFO "服务 $service_name 停止成功" - } - - # 主测试函数 - main() { - local package_name="jetty-project" - local service_name="jetty" - local need_cleanup=0 - - LOG_INFO "开始测试jetty-project软件包的服务状态查询功能" - - # 检查yum源中是否存在jetty-project软件包 - check_package_exist "$package_name" - - # 检查是否已安装jetty-project - if check_package_installed "$package_name"; then - LOG_INFO "检测到jetty-project已安装,测试结束后将保持安装状态" - need_cleanup=0 - else - LOG_INFO "检测到jetty-project未安装,将在测试结束后卸载" - need_cleanup=1 - install_package "$package_name" - fi - - # 检查服务状态 - check_service_status "$service_name" - local service_status=$? - - # 如果服务未运行,尝试启动 - if [ $service_status -ne 0 ]; then - LOG_INFO "服务未运行,尝试启动服务" - start_service "$service_name" - check_service_status "$service_name" - CHECK_RESULT $? 0 0 "服务启动后状态检查失败" - fi - - # 验证服务是否正常运行 - LOG_INFO "验证服务是否正常运行" - systemctl is-active "$service_name" &>/dev/null - CHECK_RESULT $? 0 0 "服务未正常运行" - - LOG_INFO "服务状态查询功能测试完成" - - # 环境清理 - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "开始清理测试环境" - # 停止服务 - stop_service "$service_name" - # 卸载软件包 - uninstall_package "$package_name" - LOG_INFO "测试环境清理完成" - else - LOG_INFO "保持原有安装状态,无需清理" - fi - - LOG_INFO "测试脚本执行完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_stop.sh b/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_stop.sh deleted file mode 100644 index e39e14c8818..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-project/test_jetty-project_stop.sh +++ /dev/null @@ -1,115 +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 : 测试jetty-project软件包的服务停止功能,验证服务是否能成功停止。 -# ############################################ - -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="jetty-project" - - # 步骤1: 检查yum源中是否存在指定软件包 - LOG_INFO "步骤1: 检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available "${PACKAGE_NAME}" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - - # 步骤2: 检查软件包是否已安装 - LOG_INFO "步骤2: 检查${PACKAGE_NAME}是否已安装" - if rpm -q "${PACKAGE_NAME}" &>/dev/null; then - LOG_INFO "${PACKAGE_NAME}已安装,标记为已安装状态" - PACKAGE_INSTALLED=true - else - LOG_INFO "${PACKAGE_NAME}未安装,标记为未安装状态" - PACKAGE_INSTALLED=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "${PACKAGE_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: 检查${PACKAGE_NAME}服务是否存在" - SERVICE_NAME="jetty" - systemctl list-unit-files | grep -q "^${SERVICE_NAME}.service" - CHECK_RESULT $? 0 0 "${SERVICE_NAME}服务不存在" - - # 步骤5: 启动服务(如果未运行) - LOG_INFO "步骤5: 检查并启动${SERVICE_NAME}服务" - systemctl is-active "${SERVICE_NAME}" &>/dev/null - if [ $? -ne 0 ]; then - LOG_INFO "${SERVICE_NAME}服务未运行,正在启动" - systemctl start "${SERVICE_NAME}" - CHECK_RESULT $? 0 0 "启动${SERVICE_NAME}服务失败" - sleep 2 - systemctl is-active "${SERVICE_NAME}" - CHECK_RESULT $? 0 0 "${SERVICE_NAME}服务启动后未处于活动状态" - LOG_INFO "${SERVICE_NAME}服务已成功启动" - else - LOG_INFO "${SERVICE_NAME}服务已在运行中" - fi - - # 步骤6: 停止服务 - LOG_INFO "步骤6: 停止${SERVICE_NAME}服务" - systemctl stop "${SERVICE_NAME}" - CHECK_RESULT $? 0 0 "停止${SERVICE_NAME}服务失败" - sleep 2 - - # 步骤7: 验证服务是否已停止 - LOG_INFO "步骤7: 验证${SERVICE_NAME}服务是否已停止" - systemctl is-active "${SERVICE_NAME}" &>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "${SERVICE_NAME}服务停止失败" - exit 1 - else - LOG_INFO "${SERVICE_NAME}服务已成功停止" - fi - - # 步骤8: 清理环境 - LOG_INFO "步骤8: 清理环境" - if [ "${PACKAGE_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}为预安装软件包,保持安装状态" - # 重新启动服务以恢复环境 - systemctl start "${SERVICE_NAME}" &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "已重新启动${SERVICE_NAME}服务" - fi - fi - - LOG_INFO "测试完成:${PACKAGE_NAME}服务停止功能验证成功" -} - -main "$@" \ No newline at end of file From a3fdaf9a9d3a503b68dc9239b9fe5223372b01c3 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:51:28 +0800 Subject: [PATCH 08/25] update testcase for testsuite python3-lib389 --- .../pkg_test/389-ds-base/python3-lib389.json | 32 ---- .../test_python3_lib389_dir_create.sh | 85 -------- .../test_python3_lib389_dir_start_stop.sh | 83 -------- .../test_python3_lib389_entry_add.sh | 70 ------- .../test_python3_lib389_entry_delete.sh | 124 ------------ .../test_python3_lib389_entry_modify.sh | 181 ------------------ .../test_python3_lib389_entry_search.sh | 80 -------- .../test_python3_lib389_install.sh | 60 ------ .../test_python3_lib389_uninstall.sh | 84 -------- 9 files changed, 799 deletions(-) delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_create.sh delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_start_stop.sh delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_add.sh delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_delete.sh delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_modify.sh delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_search.sh delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_install.sh delete mode 100644 testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/389-ds-base/python3-lib389.json b/suite2cases/function_test/pkg_test/389-ds-base/python3-lib389.json index 566934113ab..fe8a9ab17c5 100644 --- a/suite2cases/function_test/pkg_test/389-ds-base/python3-lib389.json +++ b/suite2cases/function_test/pkg_test/389-ds-base/python3-lib389.json @@ -2,41 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/389-ds-base/python3-lib389", "machine num": 1, "cases": [ - { - "name": "test_python3_lib389_install", - "desc": "Test the installation of python3-lib389 package via system package manager." - }, { "name": "test_python3_lib389_import", "desc": "Test basic import of the lib389 module to verify availability." - }, - { - "name": "test_python3_lib389_dir_create", - "desc": "Test creating a Directory Server instance using lib389 APIs." - }, - { - "name": "test_python3_lib389_dir_start_stop", - "desc": "Test starting and stopping a Directory Server instance." - }, - { - "name": "test_python3_lib389_entry_add", - "desc": "Test adding a new LDAP entry to the directory server." - }, - { - "name": "test_python3_lib389_entry_search", - "desc": "Test searching for an LDAP entry in the directory server." - }, - { - "name": "test_python3_lib389_entry_modify", - "desc": "Test modifying attributes of an existing LDAP entry." - }, - { - "name": "test_python3_lib389_entry_delete", - "desc": "Test deleting an LDAP entry from the directory server." - }, - { - "name": "test_python3_lib389_uninstall", - "desc": "Test the removal of python3-lib389 package via system package manager." } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_create.sh b/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_create.sh deleted file mode 100644 index 371f068e9ec..00000000000 --- a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_create.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 : 2026-02-28 -# @License : Mulan PSL v2 -# @Desc : Test creating a Directory Server instance using lib389 APIs. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:使用lib389 API创建Directory Server实例" - - # 检查是否已安装python3-lib389 - LOG_INFO "步骤1:检查python3-lib389是否已安装" - if dnf list installed python3-lib389 &>/dev/null; then - LOG_INFO "python3-lib389已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "python3-lib389未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否有python3-lib389软件包 - LOG_INFO "步骤2:检查yum源中是否有python3-lib389软件包" - if ! dnf list available python3-lib389 &>/dev/null; then - LOG_ERROR "yum源中未找到python3-lib389软件包" - exit 255 - fi - - # 如果未安装,则安装python3-lib389 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-lib389" - dnf install -y python3-lib389 - CHECK_RESULT $? 0 0 "安装python3-lib389失败" - fi - - # 检查是否支持创建Directory Server实例的命令 - LOG_INFO "步骤4:检查创建Directory Server实例的命令参数" - if ! dscreate --help | grep -q "create"; then - LOG_ERROR "dscreate命令不支持创建实例参数" - exit 255 - fi - - # 创建Directory Server实例 - LOG_INFO "步骤5:创建Directory Server实例" - dscreate create /tmp/test_instance 2>/dev/null - CHECK_RESULT $? 0 0 "创建Directory Server实例失败" - - # 检查实例是否创建成功 - LOG_INFO "步骤6:验证Directory Server实例是否创建成功" - if [ -d "/tmp/test_instance" ]; then - LOG_INFO "Directory Server实例创建成功" - else - LOG_ERROR "Directory Server实例创建失败" - exit 1 - fi - - # 清理环境:删除测试实例 - LOG_INFO "步骤7:清理测试环境" - rm -rf /tmp/test_instance - CHECK_RESULT $? 0 0 "删除测试实例失败" - - # 如果测试前未安装python3-lib389,则在测试后卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤8:卸载python3-lib389" - dnf remove -y python3-lib389 - CHECK_RESULT $? 0 0 "卸载python3-lib389失败" - fi - - LOG_INFO "测试完成:使用lib389 API创建Directory Server实例" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_start_stop.sh b/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_start_stop.sh deleted file mode 100644 index 81256a46323..00000000000 --- a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_dir_start_stop.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-02-28 -# @License : Mulan PSL v2 -# @Desc : Test starting and stopping a Directory Server instance. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:启动和停止Directory Server实例" - - LOG_INFO "步骤1:检查系统中是否已安装lib389软件包" - if rpm -q lib389 > /dev/null 2>&1; then - LOG_INFO "lib389已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "lib389未安装,将在测试过程中安装并在测试结束后卸载" - already_installed=false - fi - - LOG_INFO "步骤2:检查yum源中是否有lib389软件包" - if ! dnf list available lib389 2>/dev/null | grep -q lib389; then - LOG_ERROR "yum源中未找到lib389软件包" - exit 255 - fi - - LOG_INFO "步骤3:安装lib389软件包" - if [ "$already_installed" = false ]; then - dnf install -y lib389 - CHECK_RESULT $? 0 0 "安装lib389失败" - fi - - LOG_INFO "步骤4:检查dsctl命令是否可用" - if ! command -v dsctl > /dev/null 2>&1; then - LOG_ERROR "dsctl命令不存在" - exit 255 - fi - - LOG_INFO "步骤5:创建Directory Server实例" - dscreate create-instance --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "dscreate命令不支持create-instance参数" - exit 255 - fi - - LOG_INFO "步骤6:启动Directory Server实例" - dsctl localhost start - CHECK_RESULT $? 0 0 "启动Directory Server实例失败" - - LOG_INFO "步骤7:检查Directory Server实例状态" - dsctl localhost status - CHECK_RESULT $? 0 0 "Directory Server实例未正常运行" - - LOG_INFO "步骤8:停止Directory Server实例" - dsctl localhost stop - CHECK_RESULT $? 0 0 "停止Directory Server实例失败" - - LOG_INFO "步骤9:清理环境" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载lib389软件包" - dnf remove -y lib389 - CHECK_RESULT $? 0 0 "卸载lib389失败" - else - LOG_INFO "保持lib389软件包安装状态" - fi - - LOG_INFO "测试完成:启动和停止Directory Server实例测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_add.sh b/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_add.sh deleted file mode 100644 index 9777670a82f..00000000000 --- a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_add.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-02-28 -# @License : Mulan PSL v2 -# @Desc : Test adding a new LDAP entry to the directory server. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:向目录服务器添加新的LDAP条目" - - # 检查是否已安装python3-lib389 - LOG_INFO "检查python3-lib389是否已安装" - if rpm -q python3-lib389 &>/dev/null; then - LOG_INFO "python3-lib389已安装" - INSTALLED=1 - else - LOG_INFO "python3-lib389未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有python3-lib389包 - LOG_INFO "检查yum源中是否有python3-lib389包" - if ! dnf list available python3-lib389 &>/dev/null; then - LOG_ERROR "yum源中未找到python3-lib389包" - exit 255 - fi - - # 如果未安装,则安装python3-lib389 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-lib389" - dnf install -y python3-lib389 - CHECK_RESULT $? 0 0 "安装python3-lib389失败" - fi - - # 测试添加新的LDAP条目到目录服务器 - LOG_INFO "测试添加新的LDAP条目到目录服务器" - # 这里假设有一个可用的目录服务器,实际使用时需要根据实际情况调整 - # 示例命令:dscreate -v example.com -p 389 -D "cn=Directory Manager" -w password -s "dc=example,dc=com" -e "cn=testuser,ou=people,dc=example,dc=com" -a "objectClass: inetOrgPerson" -a "cn: testuser" -a "sn: user" - # 由于实际环境可能没有配置目录服务器,这里使用一个模拟命令来演示 - # 实际使用时,请替换为实际的命令和参数 - - # 模拟添加LDAP条目的命令,实际使用时需要根据实际情况调整 - echo "模拟添加LDAP条目" - CHECK_RESULT $? 0 0 "添加LDAP条目失败" - - # 清理环境:如果脚本开始时未安装python3-lib389,则卸载它 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-lib389" - dnf remove -y python3-lib389 - CHECK_RESULT $? 0 0 "卸载python3-lib389失败" - fi - - LOG_INFO "测试完成:向目录服务器添加新的LDAP条目" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_delete.sh b/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_delete.sh deleted file mode 100644 index 47f2543988c..00000000000 --- a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_entry_delete.sh +++ /dev/null @@ -1,124 +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-28 -# @License : Mulan PSL v2 -# @Desc : Test deleting an LDAP entry from the directory server. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:从目录服务器中删除LDAP条目" - - # 检查是否已安装python3-lib389 - LOG_INFO "检查是否已安装python3-lib389" - if dnf list installed python3-lib389 &>/dev/null; then - LOG_INFO "python3-lib389已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "python3-lib389未安装,将在测试前安装" - INSTALLED=0 - fi - - # 检查yum源中是否有python3-lib389 - LOG_INFO "检查yum源中是否有python3-lib389" - if ! dnf list available python3-lib389 &>/dev/null; then - LOG_ERROR "yum源中未找到python3-lib389软件包" - exit 255 - fi - - # 如果未安装,则安装python3-lib389 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-lib389" - dnf install -y python3-lib389 - CHECK_RESULT $? 0 0 "安装python3-lib389失败" - fi - - # 创建LDAP目录服务器实例 - LOG_INFO "创建LDAP目录服务器实例" - dscreate from-file < /dev/null 2>&1; then - LOG_INFO "lib389已安装" - INSTALLED_BEFORE=true - else - LOG_INFO "lib389未安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有lib389软件包 - LOG_INFO "检查yum源中是否有lib389软件包" - if ! dnf list available lib389 2>&1 | grep -q "lib389"; then - LOG_ERROR "yum源中未找到lib389软件包" - exit 255 - fi - - # 如果未安装,则安装lib389 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装lib389软件包" - dnf install -y lib389 - CHECK_RESULT $? 0 0 "安装lib389失败" - fi - - # 检查是否已安装openldap-clients - LOG_INFO "检查openldap-clients是否已安装" - if rpm -q openldap-clients > /dev/null 2>&1; then - LOG_INFO "openldap-clients已安装" - CLIENT_INSTALLED_BEFORE=true - else - LOG_INFO "openldap-clients未安装" - CLIENT_INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有openldap-clients软件包 - LOG_INFO "检查yum源中是否有openldap-clients软件包" - if ! dnf list available openldap-clients 2>&1 | grep -q "openldap-clients"; then - LOG_ERROR "yum源中未找到openldap-clients软件包" - exit 255 - fi - - # 如果未安装,则安装openldap-clients - if [ "$CLIENT_INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装openldap-clients软件包" - dnf install -y openldap-clients - CHECK_RESULT $? 0 0 "安装openldap-clients失败" - fi - - # 启动LDAP服务器(如果未运行) - LOG_INFO "检查LDAP服务器是否运行" - if ! systemctl is-active dirsrv.target > /dev/null 2>&1; then - LOG_INFO "启动LDAP服务器" - systemctl start dirsrv.target - CHECK_RESULT $? 0 0 "启动LDAP服务器失败" - fi - - # 创建测试LDAP条目 - LOG_INFO "创建测试LDAP条目" - ldapadd -x -D "cn=Directory Manager" -w password -H ldap://localhost </dev/null; then - LOG_INFO "lib389软件包已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "lib389软件包未安装,将在测试过程中安装并在结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有lib389软件包 - LOG_INFO "检查yum源中是否有lib389软件包" - if ! dnf search lib389 &>/dev/null; then - LOG_ERROR "yum源中未找到lib389软件包" - exit 255 - fi - - # 如果未安装,则安装lib389 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装lib389软件包" - dnf install -y lib389 - CHECK_RESULT $? 0 0 "安装lib389失败" - fi - - # 检查dsctl命令是否存在 - LOG_INFO "检查dsctl命令是否存在" - if ! command -v dsctl &>/dev/null; then - LOG_ERROR "dsctl命令不存在或不支持" - exit 255 - fi - - # 启动目录服务器实例 - LOG_INFO "启动目录服务器实例" - dsctl localhost start - CHECK_RESULT $? 0 0 "启动目录服务器实例失败" - - # 搜索LDAP条目 - LOG_INFO "搜索LDAP条目" - ldapsearch -x -H ldap://localhost -b "dc=example,dc=com" "(objectclass=*)" - CHECK_RESULT $? 0 0 "搜索LDAP条目失败" - - # 停止目录服务器实例 - LOG_INFO "停止目录服务器实例" - dsctl localhost stop - CHECK_RESULT $? 0 0 "停止目录服务器实例失败" - - # 如果测试前未安装,则卸载lib389 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载lib389软件包" - dnf remove -y lib389 - CHECK_RESULT $? 0 0 "卸载lib389失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_install.sh b/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_install.sh deleted file mode 100644 index 2f23f02fbe0..00000000000 --- a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_install.sh +++ /dev/null @@ -1,60 +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-28 -# @License : Mulan PSL v2 -# @Desc : Test the installation of python3-lib389 package via system package manager. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="python3-lib389" - LOG_INFO "开始测试: 通过系统包管理器安装 $PACKAGE_NAME 软件包" - LOG_INFO "步骤1: 检查是否已安装 $PACKAGE_NAME" - if dnf list installed "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "$PACKAGE_NAME 已安装,测试将验证其功能,并在结束时保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "$PACKAGE_NAME 未安装,将在测试过程中安装并最终卸载" - ALREADY_INSTALLED=0 - fi - LOG_INFO "步骤2: 检查 yum 源中是否存在 $PACKAGE_NAME 软件包" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "yum 源中未找到 $PACKAGE_NAME 软件包" - exit 255 - fi - LOG_INFO "步骤3: 安装 $PACKAGE_NAME 软件包" - if [ $ALREADY_INSTALLED -eq 0 ]; then - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - LOG_INFO "$PACKAGE_NAME 安装成功" - fi - LOG_INFO "步骤4: 验证 $PACKAGE_NAME 基本功能" - python3 -c "import lib389; print(lib389.__version__)" &>/dev/null - CHECK_RESULT $? 0 0 "$PACKAGE_NAME 导入失败,可能安装有问题" - LOG_INFO "$PACKAGE_NAME 导入成功,基本功能正常" - LOG_INFO "步骤5: 清理测试环境" - if [ $ALREADY_INSTALLED -eq 0 ]; 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 "测试完成: $PACKAGE_NAME 软件包安装测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_uninstall.sh b/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_uninstall.sh deleted file mode 100644 index b73a0ac8e5e..00000000000 --- a/testcases/function_test/pkg_test/389-ds-base/python3-lib389/test_python3_lib389_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-02-28 -# @License : Mulan PSL v2 -# @Desc : Test the removal of python3-lib389 package via system package manager. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装python3-lib389 - LOG_INFO "检查python3-lib389是否已安装" - rpm -q python3-lib389 > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到python3-lib389已安装,测试后保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "检测到python3-lib389未安装,将在测试后卸载" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有python3-lib389软件包 - LOG_INFO "检查yum源中是否有python3-lib389软件包" - dnf list available python3-lib389 > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-lib389软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "开始安装python3-lib389软件包" - dnf install -y python3-lib389 - CHECK_RESULT $? 0 0 "安装python3-lib389失败" - LOG_INFO "python3-lib389安装成功" - fi - - # 验证安装 - LOG_INFO "验证python3-lib389安装" - rpm -q python3-lib389 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "python3-lib389未正确安装" - - # 测试卸载功能 - LOG_INFO "开始卸载python3-lib389软件包" - dnf remove -y python3-lib389 - CHECK_RESULT $? 0 0 "卸载python3-lib389失败" - LOG_INFO "python3-lib389卸载成功" - - # 验证卸载 - LOG_INFO "验证python3-lib389是否已卸载" - rpm -q python3-lib389 > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "python3-lib389卸载后仍然存在" - CHECK_RESULT 1 0 0 "卸载验证失败" - else - LOG_INFO "python3-lib389已成功卸载" - fi - - # 环境恢复:如果测试前已安装,则重新安装 - if [ $INSTALLED_BEFORE -eq 1 ]; then - LOG_INFO "恢复环境:重新安装python3-lib389" - dnf install -y python3-lib389 - CHECK_RESULT $? 0 0 "恢复安装python3-lib389失败" - LOG_INFO "环境恢复完成,python3-lib389已重新安装" - else - LOG_INFO "环境恢复:无需重新安装python3-lib389" - fi - - LOG_INFO "测试完成:验证通过系统包管理器卸载python3-lib389软件包" -} - -main "$@" \ No newline at end of file From a2d663e30a230d4f2efab9e7357a0af67331cb99 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:51:55 +0800 Subject: [PATCH 09/25] update testcase for testsuite rubygem-minitest-reporters-help --- .../rubygem-minitest-reporters-help.json | 8 -- ...rubygem-minitest-reporters-help_install.sh | 95 ------------------- ...rubygem-minitest-reporters-help_require.sh | 60 ------------ 3 files changed, 163 deletions(-) delete mode 100644 testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_install.sh delete mode 100644 testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_require.sh diff --git a/suite2cases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help.json b/suite2cases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help.json index db79b750ac8..13a0447a071 100644 --- a/suite2cases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help.json +++ b/suite2cases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help.json @@ -2,18 +2,10 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help", "machine num": 1, "cases": [ - { - "name": "test_rubygem-minitest-reporters-help_install", - "desc": "测试软件包能够通过包管理器(如gem)成功安装" - }, { "name": "test_rubygem-minitest-reporters-help_version", "desc": "测试安装后能够查询到正确的软件包版本" }, - { - "name": "test_rubygem-minitest-reporters-help_require", - "desc": "测试在Ruby环境中可以成功require该gem,无加载错误" - }, { "name": "test_rubygem-minitest-reporters-help_uninstall", "desc": "测试软件包能够通过包管理器被完整卸载" diff --git a/testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_install.sh b/testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_install.sh deleted file mode 100644 index ce005ca7f37..00000000000 --- a/testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_install.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 : 2026-03-26 -# @License : Mulan PSL v2 -# @Desc : 测试软件包能够通过包管理器(如gem)成功安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化日志函数(如果未定义) - type LOG_INFO &>/dev/null || LOG_INFO() { echo "[INFO] $*"; } - type LOG_ERROR &>/dev/null || LOG_ERROR() { echo "[ERROR] $*"; } - - # 检查dnf是否可用 - LOG_INFO "检查dnf工具是否可用" - command -v dnf &>/dev/null - CHECK_RESULT $? 0 0 "dnf工具不可用" - - # 定义软件包名称 - PACKAGE_NAME="rubygem-minitest-reporters-help" - - # 检查软件包是否已在yum源中 - LOG_INFO "检查软件包 ${PACKAGE_NAME} 是否在yum源中" - dnf list available ${PACKAGE_NAME} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中" - exit 255 - fi - - # 检查软件包是否已安装 - LOG_INFO "检查软件包 ${PACKAGE_NAME} 是否已安装" - rpm -q ${PACKAGE_NAME} &>/dev/null - PACKAGE_INSTALLED=$? - - # 如果未安装,则安装软件包 - if [ ${PACKAGE_INSTALLED} -ne 0 ]; then - LOG_INFO "软件包未安装,开始安装 ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - INSTALLED_BY_SCRIPT=1 - else - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,跳过安装步骤" - INSTALLED_BY_SCRIPT=0 - fi - - # 验证gem命令是否可用(如果软件包提供gem命令) - LOG_INFO "验证gem命令是否可用" - command -v gem &>/dev/null - GEM_AVAILABLE=$? - - # 如果gem命令可用,尝试使用gem安装一个测试gem包(例如minitest-reporters) - if [ ${GEM_AVAILABLE} -eq 0 ]; then - LOG_INFO "尝试使用gem安装minitest-reporters进行测试" - gem install minitest-reporters --no-document - CHECK_RESULT $? 0 0 "使用gem安装minitest-reporters失败" - - # 验证安装是否成功 - LOG_INFO "验证minitest-reporters是否安装成功" - gem list | grep -q minitest-reporters - CHECK_RESULT $? 0 0 "minitest-reporters未成功安装" - - # 清理:卸载测试安装的gem包 - LOG_INFO "清理测试安装的gem包minitest-reporters" - gem uninstall minitest-reporters -x - CHECK_RESULT $? 0 0 "卸载minitest-reporters失败" - else - LOG_INFO "gem命令不可用,跳过gem安装测试" - fi - - # 环境恢复:如果脚本安装了软件包,则卸载 - if [ ${INSTALLED_BY_SCRIPT} -eq 1 ]; then - LOG_INFO "脚本安装了软件包,开始卸载 ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - else - LOG_INFO "软件包由脚本之外安装,保持安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_require.sh b/testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_require.sh deleted file mode 100644 index 71f847fde0a..00000000000 --- a/testcases/function_test/pkg_test/rubygem-minitest-reporters/rubygem-minitest-reporters-help/test_rubygem-minitest-reporters-help_require.sh +++ /dev/null @@ -1,60 +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-26 -# @License : Mulan PSL v2 -# @Desc : 测试在Ruby环境中可以成功require该gem,无加载错误 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了rubygem-minitest-reporters软件包 - LOG_INFO "检查rubygem-minitest-reporters软件包是否已安装" - if dnf list installed rubygem-minitest-reporters &>/dev/null; then - LOG_INFO "rubygem-minitest-reporters软件包已安装,脚本结束将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "rubygem-minitest-reporters软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有rubygem-minitest-reporters软件包 - LOG_INFO "检查yum源中是否有rubygem-minitest-reporters软件包" - if ! dnf list available rubygem-minitest-reporters &>/dev/null; then - LOG_ERROR "yum源中没有rubygem-minitest-reporters软件包" - exit 255 - fi - - # 如果未安装,则安装rubygem-minitest-reporters软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装rubygem-minitest-reporters软件包" - dnf install -y rubygem-minitest-reporters - CHECK_RESULT $? 0 0 "安装rubygem-minitest-reporters软件包失败" - fi - - # 测试在Ruby环境中可以成功require该gem,无加载错误 - LOG_INFO "测试在Ruby环境中可以成功require该gem,无加载错误" - ruby -e "require "minitest/reporters"" - CHECK_RESULT $? 0 0 "在Ruby环境中require "minitest/reporters"失败" - - # 清理环境:如果之前未安装,则卸载rubygem-minitest-reporters软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载rubygem-minitest-reporters软件包" - dnf remove -y rubygem-minitest-reporters - CHECK_RESULT $? 0 0 "卸载rubygem-minitest-reporters软件包失败" - fi -} - -main "$@" \ No newline at end of file From 023d5a2eae1879637c6995696254af957882e0e8 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:52:40 +0800 Subject: [PATCH 10/25] update testcase for testsuite texlive-suppose --- .../texlive-split-x/texlive-suppose.json | 10 --- .../test_texlive-suppose_function_install.sh | 69 ------------------- 2 files changed, 79 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-x/texlive-suppose.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-suppose/test_texlive-suppose_function_install.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-suppose.json b/suite2cases/function_test/pkg_test/texlive-split-x/texlive-suppose.json deleted file mode 100644 index 85e583997d3..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-suppose.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-suppose", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-suppose_function_install", - "desc": "Test the installation of texlive-suppose package" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-suppose/test_texlive-suppose_function_install.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-suppose/test_texlive-suppose_function_install.sh deleted file mode 100644 index c21074e4ea1..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-suppose/test_texlive-suppose_function_install.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test the installation of texlive-suppose package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-suppose包 - LOG_INFO "检查texlive-suppose包是否已安装" - rpm -q texlive-suppose > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-suppose包已安装,脚本结束时保持安装状态" - installed=true - else - LOG_INFO "texlive-suppose包未安装,将在测试结束后卸载" - installed=false - fi - - # 检查yum源中是否有texlive-suppose包 - LOG_INFO "检查yum源中是否有texlive-suppose包" - dnf list available texlive-suppose > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-suppose包" - exit 255 - fi - - # 安装texlive-suppose包 - LOG_INFO "安装texlive-suppose包" - dnf install -y texlive-suppose - CHECK_RESULT $? 0 0 "安装texlive-suppose包失败" - - # 检查texlive-suppose命令是否可用 - LOG_INFO "检查texlive-suppose命令是否可用" - texlive-suppose --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-suppose命令不可用" - - # 测试texlive-suppose命令参数 - LOG_INFO "测试texlive-suppose命令参数" - texlive-suppose --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-suppose命令参数不支持" - - # 清理环境 - if [ "$installed" = "false" ]; then - LOG_INFO "卸载texlive-suppose包" - dnf remove -y texlive-suppose - CHECK_RESULT $? 0 0 "卸载texlive-suppose包失败" - fi - - LOG_INFO "测试脚本执行完毕" - -} - -main "$@" \ No newline at end of file From d6f4c515d6a2f2f3f35d89c0111869ea0972d601 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:53:49 +0800 Subject: [PATCH 11/25] update testcase for testsuite ant-commons-net --- .../pkg_test/ant/ant-commons-net.json | 28 ---- .../test_ant-commons-net_function_ftp.sh | 71 --------- ...est_ant-commons-net_function_ftp_client.sh | 100 ------------- .../test_ant-commons-net_function_http.sh | 63 -------- .../test_ant-commons-net_function_http_get.sh | 76 ---------- .../test_ant-commons-net_function_ntp_time.sh | 138 ------------------ ...test_ant-commons-net_function_smtp_send.sh | 111 -------------- .../test_ant-commons-net_function_telnet.sh | 70 --------- 8 files changed, 657 deletions(-) delete mode 100644 testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp.sh delete mode 100644 testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp_client.sh delete mode 100644 testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_http.sh delete mode 100644 testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_http_get.sh delete mode 100644 testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ntp_time.sh delete mode 100644 testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_smtp_send.sh delete mode 100644 testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_telnet.sh diff --git a/suite2cases/function_test/pkg_test/ant/ant-commons-net.json b/suite2cases/function_test/pkg_test/ant/ant-commons-net.json index c58f67a833a..a7edd1f8a9a 100644 --- a/suite2cases/function_test/pkg_test/ant/ant-commons-net.json +++ b/suite2cases/function_test/pkg_test/ant/ant-commons-net.json @@ -14,37 +14,9 @@ "name": "test_ant-commons-net_function_network", "desc": "Test network operations" }, - { - "name": "test_ant-commons-net_function_ftp", - "desc": "Test FTP operations" - }, { "name": "test_ant-commons-net_function_smtp", "desc": "Test SMTP operations" - }, - { - "name": "test_ant-commons-net_function_http", - "desc": "Test HTTP operations" - }, - { - "name": "test_ant-commons-net_function_ftp_client", - "desc": "Test basic FTP client operations (connect, list, upload)." - }, - { - "name": "test_ant-commons-net_function_smtp_send", - "desc": "Test sending a simple email via SMTP protocol." - }, - { - "name": "test_ant-commons-net_function_http_get", - "desc": "Test performing a basic HTTP GET request." - }, - { - "name": "test_ant-commons-net_function_telnet", - "desc": "Test establishing a Telnet connection and sending commands." - }, - { - "name": "test_ant-commons-net_function_ntp_time", - "desc": "Test retrieving time from an NTP server." } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp.sh b/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp.sh deleted file mode 100644 index 4d5a6b47446..00000000000 --- a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp.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-02 -# @License : Mulan PSL v2 -# @Desc : Test FTP operations -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在ant-commons-net软件包 - LOG_INFO "检查yum源中是否存在ant-commons-net软件包" - dnf list available ant-commons-net >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到ant-commons-net软件包" - exit 255 - fi - - # 检查是否已安装ant-commons-net - LOG_INFO "检查是否已安装ant-commons-net" - rpm -q ant-commons-net >/dev/null 2>&1 - if [ $? -eq 0 ]; then - installed=true - LOG_INFO "ant-commons-net已安装" - else - installed=false - LOG_INFO "ant-commons-net未安装,将进行安装" - fi - - # 若未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装ant-commons-net软件包" - dnf install -y ant-commons-net - CHECK_RESULT $? 0 0 "安装ant-commons-net失败" - fi - - # Test FTP operations - LOG_INFO "开始测试FTP操作" - ftp_command="ftp" # 假设ftp是测试命令,实际应根据需求替换为具体命令和参数 - $ftp_command >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "FTP命令执行失败或参数不支持" - exit 255 - fi - CHECK_RESULT $? 0 0 "FTP操作测试失败" - - # 恢复环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载ant-commons-net软件包" - dnf remove -y ant-commons-net - CHECK_RESULT $? 0 0 "卸载ant-commons-net失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp_client.sh b/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp_client.sh deleted file mode 100644 index 6e2f26222de..00000000000 --- a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ftp_client.sh +++ /dev/null @@ -1,100 +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 basic FTP client operations (connect, list, upload). -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试FTP客户端基本操作(连接、列表、上传)" - - # 检查是否已安装ant-commons-net软件包 - LOG_INFO "检查ant-commons-net软件包是否已安装" - rpm -q ant-commons-net > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "ant-commons-net软件包已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "ant-commons-net软件包未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有ant-commons-net软件包 - LOG_INFO "检查yum源中是否有ant-commons-net软件包" - dnf list available ant-commons-net > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到ant-commons-net软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装ant-commons-net软件包" - dnf install -y ant-commons-net - CHECK_RESULT $? 0 0 "安装ant-commons-net软件包失败" - fi - - # 测试FTP客户端连接 - LOG_INFO "测试FTP客户端连接" - # 这里假设使用一个FTP服务器进行测试,实际使用时需要替换为有效的FTP服务器地址、用户名和密码 - FTP_SERVER="ftp.example.com" - FTP_USER="user" - FTP_PASSWORD="password" - - # 使用ftp命令连接服务器 - ftp -n $FTP_SERVER < $TEST_FILE - - ftp -n $FTP_SERVER </dev/null; then - LOG_INFO "ant-commons-net已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "ant-commons-net未安装,准备安装" - INSTALLED=false - fi - - # 检查yum源中是否有ant-commons-net软件包 - LOG_INFO "检查yum源中是否有ant-commons-net软件包" - if ! dnf list available ant-commons-net &>/dev/null; then - LOG_ERROR "yum源中未找到ant-commons-net软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装ant-commons-net" - dnf install -y ant-commons-net - CHECK_RESULT $? 0 0 "安装ant-commons-net失败" - fi - - # 测试HTTP操作 - LOG_INFO "开始测试HTTP操作" - # 模拟HTTP操作测试 - curl -I http://example.com &>/dev/null - CHECK_RESULT $? 0 0 "HTTP操作测试失败" - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载ant-commons-net以恢复环境" - dnf remove -y ant-commons-net - CHECK_RESULT $? 0 0 "卸载ant-commons-net失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_http_get.sh b/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_http_get.sh deleted file mode 100644 index 6a7de4cc894..00000000000 --- a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_http_get.sh +++ /dev/null @@ -1,76 +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 performing a basic HTTP GET request. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:执行基本的HTTP GET请求" - - # 检查yum源中是否存在ant-commons-net软件包 - LOG_INFO "步骤1:检查yum源中是否存在ant-commons-net软件包" - if ! dnf list available ant-commons-net 2>/dev/null | grep -q ant-commons-net; then - LOG_ERROR "yum源中未找到ant-commons-net软件包" - exit 255 - fi - - # 检查是否已安装ant-commons-net - LOG_INFO "步骤2:检查ant-commons-net是否已安装" - if rpm -q ant-commons-net >/dev/null 2>&1; then - already_installed=true - LOG_INFO "ant-commons-net已安装,测试结束后将保持安装状态" - else - already_installed=false - LOG_INFO "ant-commons-net未安装,将在测试前安装并在测试后卸载" - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装ant-commons-net软件包" - dnf install -y ant-commons-net - CHECK_RESULT $? 0 0 "安装ant-commons-net失败" - fi - - # 检查HTTP GET命令是否可用 - LOG_INFO "步骤4:检查HTTP GET命令参数" - if ! command -v http-get >/dev/null 2>&1; then - LOG_ERROR "http-get命令不存在" - if [ "$already_installed" = false ]; then - dnf remove -y ant-commons-net - fi - exit 255 - fi - - # 执行基本的HTTP GET请求测试 - LOG_INFO "步骤5:执行基本的HTTP GET请求" - http-get http://example.com - CHECK_RESULT $? 0 0 "HTTP GET请求执行失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤6:卸载ant-commons-net软件包" - dnf remove -y ant-commons-net - CHECK_RESULT $? 0 0 "卸载ant-commons-net失败" - else - LOG_INFO "步骤6:保持ant-commons-net安装状态" - fi - - LOG_INFO "测试完成:基本的HTTP GET请求测试成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ntp_time.sh b/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ntp_time.sh deleted file mode 100644 index b32bae56f4f..00000000000 --- a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_ntp_time.sh +++ /dev/null @@ -1,138 +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 retrieving time from an NTP server. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否以root用户执行 - if [[ $EUID -ne 0 ]]; then - LOG_ERROR "此脚本需要root权限执行" - exit 1 - fi - - LOG_INFO "开始测试:从NTP服务器获取时间" - - # 检查是否已安装ant-commons-net软件包 - LOG_INFO "检查ant-commons-net软件包是否已安装" - if dnf list installed ant-commons-net > /dev/null 2>&1; then - LOG_INFO "ant-commons-net已安装,测试后保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "ant-commons-net未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否存在ant-commons-net软件包" - if ! dnf list available ant-commons-net > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到ant-commons-net软件包" - exit 255 - fi - - # 安装软件包(如果未安装) - if [[ $ALREADY_INSTALLED -eq 0 ]]; then - LOG_INFO "安装ant-commons-net软件包" - dnf install -y ant-commons-net - CHECK_RESULT $? 0 0 "安装ant-commons-net软件包失败" - fi - - # 检查ntpdate命令是否可用 - LOG_INFO "检查ntpdate命令是否可用" - if ! command -v ntpdate > /dev/null 2>&1; then - LOG_INFO "ntpdate命令未找到,尝试安装" - dnf install -y ntpdate - CHECK_RESULT $? 0 0 "安装ntpdate失败" - fi - - # 检查ntpdate命令是否支持参数 - LOG_INFO "检查ntpdate命令参数支持" - if ! ntpdate --help > /dev/null 2>&1; then - LOG_ERROR "ntpdate命令不支持--help参数" - exit 255 - fi - - # 测试从NTP服务器获取时间 - LOG_INFO "测试从NTP服务器获取时间" - # 使用一个公共NTP服务器进行测试 - NTP_SERVER="pool.ntp.org" - - # 检查网络连通性 - LOG_INFO "检查与NTP服务器的网络连通性" - ping -c 1 $NTP_SERVER > /dev/null 2>&1 - if [[ $? -ne 0 ]]; then - LOG_INFO "无法连接到NTP服务器,尝试使用备用服务器" - NTP_SERVER="time.google.com" - ping -c 1 $NTP_SERVER > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "无法连接到任何NTP服务器" - fi - - # 执行ntpdate命令获取时间 - LOG_INFO "执行ntpdate命令从${NTP_SERVER}获取时间" - ntpdate -q $NTP_SERVER - CHECK_RESULT $? 0 0 "从NTP服务器获取时间失败" - - # 测试ant-commons-net相关功能 - LOG_INFO "测试ant-commons-net的NTP功能" - # 这里假设ant-commons-net提供了某种NTP客户端功能 - # 实际测试可能需要调用具体的Java类或工具 - - # 检查ant-commons-net是否包含NTP相关类 - LOG_INFO "检查ant-commons-net是否包含NTP相关类" - if [[ -d /usr/share/java ]]; then - if find /usr/share/java -name "*ant-commons-net*" -type f | grep -i ntp > /dev/null 2>&1; then - LOG_INFO "找到ant-commons-net的NTP相关类" - else - LOG_INFO "未找到ant-commons-net的NTP相关类,可能版本不同" - fi - fi - - # 如果有第二个节点,测试跨节点NTP时间同步 - if [[ -n "$NODE2_IPV4" && -n "$NODE2_PASSWORD" && -n "$NODE2_USER" ]]; then - LOG_INFO "测试在第二个节点上获取NTP时间" - SSH_CMD "ntpdate -q $NTP_SERVER" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "在第二个节点上获取NTP时间失败" - fi - - # 清理环境 - LOG_INFO "清理测试环境" - - # 如果测试前未安装,则卸载软件包 - if [[ $ALREADY_INSTALLED -eq 0 ]]; then - LOG_INFO "卸载测试安装的软件包" - - # 卸载ant-commons-net - dnf remove -y ant-commons-net - CHECK_RESULT $? 0 0 "卸载ant-commons-net失败" - - # 检查是否还有其他测试安装的软件包需要卸载 - if dnf list installed ntpdate > /dev/null 2>&1; then - # 检查ntpdate是否是本次测试安装的 - # 这里简化处理,如果之前没有安装ntpdate,现在安装了就卸载 - LOG_INFO "卸载ntpdate软件包" - dnf remove -y ntpdate - CHECK_RESULT $? 0 0 "卸载ntpdate失败" - fi - else - LOG_INFO "测试前已安装软件包,保持安装状态" - fi - - LOG_INFO "测试完成:从NTP服务器获取时间测试成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_smtp_send.sh b/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_smtp_send.sh deleted file mode 100644 index 4b3d5dd5d7c..00000000000 --- a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_smtp_send.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-03-20 -# @License : Mulan PSL v2 -# @Desc : Test sending a simple email via SMTP protocol. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:通过SMTP协议发送简单邮件" - LOG_INFO "步骤1:检查ant-commons-net软件包是否在yum源中" - dnf list ant-commons-net 2>/dev/null | grep -q ant-commons-net - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到ant-commons-net软件包" - exit 255 - fi - LOG_INFO "ant-commons-net软件包存在于yum源中" - - LOG_INFO "步骤2:检查ant-commons-net是否已安装" - rpm -q ant-commons-net >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "ant-commons-net已安装,测试后保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "ant-commons-net未安装,将进行安装" - INSTALLED_BEFORE=0 - fi - - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤3:安装ant-commons-net软件包" - dnf install -y ant-commons-net - CHECK_RESULT $? 0 0 "安装ant-commons-net失败" - fi - - LOG_INFO "步骤4:检查ant-commons-net是否包含smtp发送功能" - if ! command -v java &>/dev/null; then - LOG_ERROR "java命令不存在,请确保已安装Java" - exit 255 - fi - - LOG_INFO "步骤5:编写简单的Java程序测试SMTP发送邮件" - cat > TestSMTP.java << "EOF" - import org.apache.commons.net.smtp.SMTPClient; - import org.apache.commons.net.smtp.SimpleSMTPHeader; - import java.io.IOException; - import java.net.SocketException; - - public class TestSMTP { - public static void main(String[] args) { - SMTPClient client = new SMTPClient(); - try { - client.connect("localhost", 25); - int reply = client.getReplyCode(); - if (!SMTPClient.isPositiveCompletion(reply)) { - System.err.println("SMTP服务器连接失败,回复码: " + reply); - System.exit(1); - } - System.out.println("SMTP服务器连接成功"); - client.disconnect(); - } catch (SocketException e) { - System.err.println("网络错误: " + e.getMessage()); - System.exit(1); - } catch (IOException e) { - System.err.println("IO错误: " + e.getMessage()); - System.exit(1); - } catch (Exception e) { - System.err.println("未知错误: " + e.getMessage()); - System.exit(1); - } - } - } - EOF - CHECK_RESULT $? 0 0 "创建Java测试文件失败" - - LOG_INFO "步骤6:编译Java程序" - javac -cp $(rpm -ql ant-commons-net | grep -E ".*\.jar$" | head -1) TestSMTP.java - CHECK_RESULT $? 0 0 "编译Java程序失败" - - LOG_INFO "步骤7:执行SMTP发送测试" - java -cp .:$(rpm -ql ant-commons-net | grep -E ".*\.jar$" | head -1) TestSMTP - CHECK_RESULT $? 0 0 "SMTP发送测试失败" - - LOG_INFO "步骤8:清理测试文件" - rm -f TestSMTP.java TestSMTP.class - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤9:卸载ant-commons-net软件包" - dnf remove -y ant-commons-net - CHECK_RESULT $? 0 0 "卸载ant-commons-net失败" - else - LOG_INFO "步骤9:保持ant-commons-net安装状态,不进行卸载" - fi - - LOG_INFO "测试完成:通过SMTP协议发送简单邮件测试成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_telnet.sh b/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_telnet.sh deleted file mode 100644 index d70e91b3e04..00000000000 --- a/testcases/function_test/pkg_test/ant/ant-commons-net/test_ant-commons-net_function_telnet.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-20 -# @License : Mulan PSL v2 -# @Desc : Test establishing a Telnet connection and sending commands. -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:建立Telnet连接并发送命令" - - # 检查ant-commons-net软件包是否在yum源中 - LOG_INFO "检查ant-commons-net软件包是否在yum源中" - dnf list available ant-commons-net &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到ant-commons-net软件包" - exit 255 - fi - - # 检查是否已安装ant-commons-net - LOG_INFO "检查是否已安装ant-commons-net软件包" - rpm -q ant-commons-net &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "ant-commons-net已安装,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "ant-commons-net未安装,将在测试前安装" - already_installed=false - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "安装ant-commons-net软件包" - dnf install -y ant-commons-net - CHECK_RESULT $? 0 0 "安装ant-commons-net失败" - fi - - # 测试建立Telnet连接并发送命令 - LOG_INFO "测试建立Telnet连接并发送命令" - # 假设使用telnet命令进行测试,这里使用一个示例命令 - # 实际测试可能需要根据具体需求调整 - telnet localhost 23 < Date: Thu, 23 Apr 2026 20:55:21 +0800 Subject: [PATCH 12/25] update testcase for testsuite libiec61883-devel --- .../libiec61883/libiec61883-devel.json | 26 ------- .../test_libiec61883-devel_function_close.sh | 67 ----------------- .../test_libiec61883-devel_function_init.sh | 63 ---------------- .../test_libiec61883-devel_function_open.sh | 65 ----------------- .../test_libiec61883-devel_function_recv.sh | 72 ------------------- .../test_libiec61883-devel_function_send.sh | 69 ------------------ 6 files changed, 362 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/libiec61883/libiec61883-devel.json delete mode 100644 testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_close.sh delete mode 100644 testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_init.sh delete mode 100644 testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_open.sh delete mode 100644 testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_recv.sh delete mode 100644 testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_send.sh diff --git a/suite2cases/function_test/pkg_test/libiec61883/libiec61883-devel.json b/suite2cases/function_test/pkg_test/libiec61883/libiec61883-devel.json deleted file mode 100644 index a7498b66426..00000000000 --- a/suite2cases/function_test/pkg_test/libiec61883/libiec61883-devel.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/libiec61883/libiec61883-devel", - "machine num": 1, - "cases": [ - { - "name": "test_libiec61883-devel_function_init", - "desc": "Test library initialization" - }, - { - "name": "test_libiec61883-devel_function_open", - "desc": "Test opening a connection" - }, - { - "name": "test_libiec61883-devel_function_close", - "desc": "Test closing a connection" - }, - { - "name": "test_libiec61883-devel_function_send", - "desc": "Test sending data" - }, - { - "name": "test_libiec61883-devel_function_recv", - "desc": "Test receiving data" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_close.sh b/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_close.sh deleted file mode 100644 index 3455dd84c2e..00000000000 --- a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_close.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-02 -# @License : Mulan PSL v2 -# @Desc : Test closing a connection -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test closing a connection" - - # 检查是否已安装libiec61883-devel - LOG_INFO "检查是否已安装libiec61883-devel" - dnf list installed libiec61883-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "libiec61883-devel已安装,脚本结束时将保持安装状态" - already_installed=true - else - LOG_INFO "libiec61883-devel未安装,将在测试步骤中安装并在结束时卸载" - already_installed=false - fi - - # 检查yum源中是否有libiec61883-devel - LOG_INFO "检查yum源中是否有libiec61883-devel" - dnf list available libiec61883-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到libiec61883-devel软件包" - exit 255 - fi - - # 安装libiec61883-devel(如果未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "正在安装libiec61883-devel" - dnf install -y libiec61883-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装libiec61883-devel失败" - fi - - # 测试关闭连接功能 - LOG_INFO "测试关闭连接功能" - command_to_test="some_command_to_close_connection" # 替换为实际命令 - $command_to_test > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "关闭连接失败" - - # 清理环境(如果之前未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "正在卸载libiec61883-devel" - dnf remove -y libiec61883-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载libiec61883-devel失败" - fi - - LOG_INFO "测试完成:Test closing a connection" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_init.sh b/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_init.sh deleted file mode 100644 index 498dcf64e6b..00000000000 --- a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_init.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-28 -# @License : Mulan PSL v2 -# @Desc : Test library initialization -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查libiec61883-devel是否已安装 - LOG_INFO "检查libiec61883-devel是否已安装" - rpm -q libiec61883-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "libiec61883-devel已安装" - installed=true - else - LOG_INFO "libiec61883-devel未安装" - installed=false - fi - - # 检查yum源中是否存在libiec61883-devel软件包 - LOG_INFO "检查yum源中是否存在libiec61883-devel软件包" - dnf list available libiec61883-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在libiec61883-devel软件包" - exit 255 - fi - - # 如果未安装,则安装libiec61883-devel - if [ "$installed" = false ]; then - LOG_INFO "开始安装libiec61883-devel" - dnf install -y libiec61883-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装libiec61883-devel失败" - LOG_INFO "libiec61883-devel安装成功" - fi - - # 测试库初始化 - LOG_INFO "测试库初始化功能" - libiec61883_init_test > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "库初始化失败" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载libiec61883-devel" - dnf remove -y libiec61883-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载libiec61883-devel失败" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_open.sh b/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_open.sh deleted file mode 100644 index f1f80c4be03..00000000000 --- a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_open.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-02 -# @License : Mulan PSL v2 -# @Desc : Test opening a connection -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test opening a connection" - - # 检查是否已安装libiec61883-devel - LOG_INFO "检查是否已安装libiec61883-devel" - if dnf list installed libiec61883-devel &>/dev/null; then - LOG_INFO "libiec61883-devel已安装" - installed=true - else - LOG_INFO "libiec61883-devel未安装" - installed=false - fi - - # 检查yum源中是否有libiec61883-devel - LOG_INFO "检查yum源中是否有libiec61883-devel" - if ! dnf list available libiec61883-devel &>/dev/null; then - LOG_ERROR "yum源中未找到libiec61883-devel" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装libiec61883-devel" - dnf install -y libiec61883-devel - CHECK_RESULT $? 0 0 "安装libiec61883-devel失败" - fi - - # 测试打开连接 - LOG_INFO "测试打开连接" - command_to_test="your_test_command_here" # 替换为实际的测试命令 - $command_to_test - CHECK_RESULT $? 0 0 "打开连接失败" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载libiec61883-devel" - dnf remove -y libiec61883-devel - CHECK_RESULT $? 0 0 "卸载libiec61883-devel失败" - fi - - LOG_INFO "测试完成:Test opening a connection" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_recv.sh b/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_recv.sh deleted file mode 100644 index 3d569d200ce..00000000000 --- a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_recv.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : Test receiving data -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装libiec61883-devel软件包 - LOG_INFO "检查是否已安装libiec61883-devel软件包" - if rpm -q libiec61883-devel >/dev/null 2>&1; then - LOG_INFO "libiec61883-devel已安装,脚本结束时将保持安装状态" - already_installed=true - else - LOG_INFO "libiec61883-devel未安装,将在测试完成后卸载" - already_installed=false - fi - - # 检查yum源中是否存在libiec61883-devel软件包 - LOG_INFO "检查yum源中是否存在libiec61883-devel软件包" - if ! dnf list available libiec61883-devel >/dev/null 2>&1; then - LOG_ERROR "yum源中不存在libiec61883-devel软件包" - exit 255 - fi - - # 安装libiec61883-devel软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "正在安装libiec61883-devel软件包" - dnf install -y libiec61883-devel - CHECK_RESULT $? 0 0 "安装libiec61883-devel失败" - fi - - # 测试接收数据功能 - LOG_INFO "测试接收数据功能" - command_to_test="iec61883-receive" # 假设这是测试命令 - if ! command -v "$command_to_test" >/dev/null 2>&1; then - LOG_ERROR "命令$command_to_test不存在或不支持" - exit 255 - fi - - # 执行测试命令 - LOG_INFO "执行测试命令:$command_to_test" - $command_to_test --test-param # 假设--test-param是测试参数,根据实际调整 - CHECK_RESULT $? 0 0 "接收数据测试失败" - - # 清理环境 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载libiec61883-devel软件包" - dnf remove -y libiec61883-devel - CHECK_RESULT $? 0 0 "卸载libiec61883-devel失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_send.sh b/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_send.sh deleted file mode 100644 index 843cca81698..00000000000 --- a/testcases/function_test/pkg_test/libiec61883/libiec61883-devel/test_libiec61883-devel_function_send.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : Test sending data -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装libiec61883-devel软件包 - LOG_INFO "检查是否已安装libiec61883-devel软件包" - if rpm -q libiec61883-devel >/dev/null 2>&1; then - LOG_INFO "libiec61883-devel已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "libiec61883-devel未安装,将在测试后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在libiec61883-devel软件包 - LOG_INFO "检查yum源中是否存在libiec61883-devel软件包" - if ! dnf list available libiec61883-devel >/dev/null 2>&1; then - LOG_ERROR "yum源中未找到libiec61883-devel软件包" - exit 255 - fi - - # 安装libiec61883-devel软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装libiec61883-devel软件包" - dnf install -y libiec61883-devel - CHECK_RESULT $? 0 0 "安装libiec61883-devel失败" - fi - - # 测试发送数据功能 - LOG_INFO "测试发送数据功能" - if ! command -v iec61883-send >/dev/null 2>&1; then - LOG_ERROR "命令iec61883-send不存在或不支持" - exit 255 - fi - - # 执行发送数据命令(示例命令,需根据实际需求调整) - LOG_INFO "执行发送数据命令" - iec61883-send --test-data >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "发送数据失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载libiec61883-devel软件包" - dnf remove -y libiec61883-devel >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载libiec61883-devel失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 8cd99dbbd339bbe548196950be22a4129a0e08c0 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:55:29 +0800 Subject: [PATCH 13/25] update testcase for testsuite python3-help --- .../pkg_test/python3/python3-help.json | 18 ----- .../test_python3-help_function_help.sh | 67 ----------------- .../test_python3-help_function_install.sh | 75 ------------------- .../test_python3-help_function_uninstall.sh | 69 ----------------- 4 files changed, 229 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/python3/python3-help.json delete mode 100644 testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_help.sh delete mode 100644 testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_install.sh delete mode 100644 testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/python3/python3-help.json b/suite2cases/function_test/pkg_test/python3/python3-help.json deleted file mode 100644 index d87be1e4d0c..00000000000 --- a/suite2cases/function_test/pkg_test/python3/python3-help.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python3/python3-help", - "machine num": 1, - "cases": [ - { - "name": "test_python3-help_function_install", - "desc": "测试安装python3-help软件包" - }, - { - "name": "test_python3-help_function_help", - "desc": "测试使用python3-help命令获取Python帮助" - }, - { - "name": "test_python3-help_function_uninstall", - "desc": "测试卸载python3-help软件包" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_help.sh b/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_help.sh deleted file mode 100644 index 5e1b63bab9b..00000000000 --- a/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_help.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-01-31 -# @License : Mulan PSL v2 -# @Desc : 测试使用python3-help命令获取Python帮助 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-help命令获取Python帮助功能" - LOG_INFO "步骤1:检查python3-help软件包是否已在yum源中" - if ! dnf list python3-help &>/dev/null; then - LOG_ERROR "python3-help软件包在yum源中不存在" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装python3-help" - if dnf list installed python3-help &>/dev/null; then - LOG_INFO "python3-help已安装,测试后保持安装状态" - already_installed=true - else - LOG_INFO "python3-help未安装,将进行安装测试" - already_installed=false - fi - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装python3-help软件包" - dnf install -y python3-help - CHECK_RESULT $? 0 0 "安装python3-help失败" - fi - - LOG_INFO "步骤4:执行python3-help命令获取帮助信息" - python3-help - CHECK_RESULT $? 0 0 "执行python3-help命令失败" - - LOG_INFO "步骤5:测试python3-help命令的无效参数" - if python3-help --invalid-param 2>/dev/null; then - LOG_ERROR "python3-help命令接受了无效参数" - exit 255 - fi - - LOG_INFO "步骤6:清理测试环境" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载测试安装的python3-help软件包" - dnf remove -y python3-help - CHECK_RESULT $? 0 0 "卸载python3-help失败" - else - LOG_INFO "保持python3-help的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_install.sh b/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_install.sh deleted file mode 100644 index e25db7af2d7..00000000000 --- a/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_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-01-31 -# @License : Mulan PSL v2 -# @Desc : 测试安装python3-help软件包 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试安装python3-help软件包" - - # 检查是否已安装python3-help - LOG_INFO "检查是否已安装python3-help" - dnf list installed python3-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-help已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "python3-help未安装,将在测试过程中安装并在脚本结束前卸载" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有python3-help软件包 - LOG_INFO "检查yum源中是否有python3-help软件包" - dnf list available python3-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-help软件包" - exit 255 - fi - - # 如果未安装,则安装python3-help - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装python3-help软件包" - dnf install -y python3-help - CHECK_RESULT $? 0 0 "安装python3-help失败" - fi - - # 验证python3-help命令是否可用 - LOG_INFO "验证python3-help命令是否可用" - python3-help --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "python3-help命令不可用" - - # 测试python3-help的特定参数(假设--help是支持的参数) - LOG_INFO "测试python3-help的--help参数" - python3-help --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "python3-help不支持--help参数" - exit 255 - fi - CHECK_RESULT $? 0 0 "python3-help --help执行失败" - - # 环境恢复:如果之前未安装,则卸载python3-help - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载python3-help软件包" - dnf remove -y python3-help - CHECK_RESULT $? 0 0 "卸载python3-help失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_uninstall.sh b/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_uninstall.sh deleted file mode 100644 index 3bae7dacf1b..00000000000 --- a/testcases/function_test/pkg_test/python3/python3-help/test_python3-help_function_uninstall.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-31 -# @License : Mulan PSL v2 -# @Desc : 测试卸载python3-help软件包 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试卸载python3-help软件包" - - # 步骤1:检查yum源中是否存在python3-help软件包 - LOG_INFO "步骤1:检查yum源中是否存在python3-help软件包" - dnf list available python3-help 2>/dev/null | grep -q python3-help - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-help软件包" - exit 255 - fi - - # 步骤2:检查当前环境中是否已安装python3-help软件包 - LOG_INFO "步骤2:检查当前环境中是否已安装python3-help软件包" - dnf list installed python3-help 2>/dev/null | grep -q python3-help - if [ $? -eq 0 ]; then - LOG_INFO "python3-help软件包已安装,测试结束后将保持安装状态" - installed=true - else - LOG_INFO "python3-help软件包未安装,将先安装再卸载" - installed=false - fi - - # 步骤3:如果未安装,则安装python3-help软件包 - if [ "$installed" = "false" ]; then - LOG_INFO "步骤3:安装python3-help软件包" - dnf install -y python3-help - CHECK_RESULT $? 0 0 "安装python3-help软件包失败" - fi - - # 步骤4:卸载python3-help软件包 - LOG_INFO "步骤4:卸载python3-help软件包" - dnf remove -y python3-help - CHECK_RESULT $? 0 0 "卸载python3-help软件包失败" - - # 步骤5:环境恢复 - LOG_INFO "步骤5:环境恢复" - if [ "$installed" = "false" ]; then - LOG_INFO "测试前未安装python3-help,无需恢复" - else - LOG_INFO "重新安装python3-help软件包以恢复环境" - dnf install -y python3-help - CHECK_RESULT $? 0 0 "重新安装python3-help软件包失败" - fi - - LOG_INFO "测试完成:测试卸载python3-help软件包" -} - -main "$@" \ No newline at end of file From 2b4643378ad2fcdc6d4453a061715ea8a899559f Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:55:58 +0800 Subject: [PATCH 14/25] update testcase for testsuite pcp-pmda-resctrl --- .../pkg_test/pcp/pcp-pmda-resctrl.json | 28 ----- .../test_pcp-pmda-resctrl_function_config.sh | 72 ----------- .../test_pcp-pmda-resctrl_function_enable.sh | 67 ---------- .../test_pcp-pmda-resctrl_function_install.sh | 119 ------------------ .../test_pcp-pmda-resctrl_function_metrics.sh | 81 ------------ ...t_pcp-pmda-resctrl_function_performance.sh | 111 ---------------- .../test_pcp-pmda-resctrl_function_remove.sh | 114 ----------------- .../test_pcp-pmda-resctrl_function_status.sh | 94 -------------- 8 files changed, 686 deletions(-) delete mode 100644 testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_config.sh delete mode 100644 testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_enable.sh delete mode 100644 testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_install.sh delete mode 100644 testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_metrics.sh delete mode 100644 testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_performance.sh delete mode 100644 testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_remove.sh delete mode 100644 testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_status.sh diff --git a/suite2cases/function_test/pkg_test/pcp/pcp-pmda-resctrl.json b/suite2cases/function_test/pkg_test/pcp/pcp-pmda-resctrl.json index aafe21a8f8e..20c95d99bc6 100644 --- a/suite2cases/function_test/pkg_test/pcp/pcp-pmda-resctrl.json +++ b/suite2cases/function_test/pkg_test/pcp/pcp-pmda-resctrl.json @@ -6,34 +6,6 @@ "name": "test_pcp-pmda-resctrl_install_upgrade", "desc": "测试软件包从低版本升级到高版本的安装过程", "machine num": 1 - }, - { - "name": "test_pcp-pmda-resctrl_function_install", - "desc": "测试软件包的基本安装功能" - }, - { - "name": "test_pcp-pmda-resctrl_function_remove", - "desc": "测试软件包的卸载功能" - }, - { - "name": "test_pcp-pmda-resctrl_function_status", - "desc": "测试PMDA代理服务状态检查功能" - }, - { - "name": "test_pcp-pmda-resctrl_function_enable", - "desc": "测试启用resctrl PMDA数据采集功能" - }, - { - "name": "test_pcp-pmda-resctrl_function_metrics", - "desc": "测试通过pminfo查询resctrl相关指标" - }, - { - "name": "test_pcp-pmda-resctrl_function_performance", - "desc": "测试通过pmval查看关键性能指标" - }, - { - "name": "test_pcp-pmda-resctrl_function_config", - "desc": "测试PMDA配置文件正确性检查" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_config.sh b/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_config.sh deleted file mode 100644 index 22d35a36cb4..00000000000 --- a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_config.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-04 -# @License : Mulan PSL v2 -# @Desc : 测试PMDA配置文件正确性检查 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试PMDA配置文件正确性检查" - - # 检查环境是否已安装pcp-pmda-resctrl - LOG_INFO "检查pcp-pmda-resctrl是否已安装" - if dnf list installed pcp-pmda-resctrl &>/dev/null; then - LOG_INFO "pcp-pmda-resctrl已安装,测试后保持安装状态" - INSTALLED=true - else - LOG_INFO "pcp-pmda-resctrl未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否有pcp-pmda-resctrl包 - LOG_INFO "检查yum源中是否有pcp-pmda-resctrl包" - if ! dnf list available pcp-pmda-resctrl &>/dev/null; then - LOG_ERROR "yum源中没有pcp-pmda-resctrl包" - exit 255 - fi - - # 如果未安装,则安装pcp-pmda-resctrl - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装pcp-pmda-resctrl" - dnf install -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "安装pcp-pmda-resctrl失败" - fi - - # 检查pmda-resctrl配置文件的正确性 - LOG_INFO "检查pmda-resctrl配置文件正确性" - if [ -f /var/lib/pcp/pmdas/resctrl/config ]; then - LOG_INFO "配置文件存在,检查配置内容" - # 这里可以根据实际配置文件内容进行检查 - # 例如:检查配置文件是否包含必要的配置项 - grep -q "必要的配置项" /var/lib/pcp/pmdas/resctrl/config - CHECK_RESULT $? 0 0 "配置文件缺少必要的配置项" - else - LOG_ERROR "配置文件不存在" - exit 1 - fi - - # 如果测试过程中安装了pcp-pmda-resctrl,则在测试结束后卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载pcp-pmda-resctrl" - dnf remove -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "卸载pcp-pmda-resctrl失败" - fi - - LOG_INFO "PMDA配置文件正确性检查测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_enable.sh b/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_enable.sh deleted file mode 100644 index 5cdcf07853e..00000000000 --- a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_enable.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-02-04 -# @License : Mulan PSL v2 -# @Desc : 测试启用resctrl PMDA数据采集功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试启用resctrl PMDA数据采集功能" - LOG_INFO "步骤1: 检查pcp-pmda-resctrl软件包是否已在yum源中" - if ! dnf list available pcp-pmda-resctrl &>/dev/null; then - LOG_ERROR "yum源中未找到pcp-pmda-resctrl软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查是否已安装pcp-pmda-resctrl" - if rpm -q pcp-pmda-resctrl &>/dev/null; then - LOG_INFO "pcp-pmda-resctrl已安装,标记为保持安装状态" - KEEP_INSTALLED=true - else - LOG_INFO "pcp-pmda-resctrl未安装,标记为需要卸载" - KEEP_INSTALLED=false - LOG_INFO "步骤3: 安装pcp-pmda-resctrl软件包" - dnf install -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "安装pcp-pmda-resctrl失败" - fi - - LOG_INFO "步骤4: 检查resctrl PMDA是否已启用" - if pmdaresctrl status | grep -q "enabled"; then - LOG_INFO "resctrl PMDA已启用" - else - LOG_INFO "步骤5: 启用resctrl PMDA" - pmdaresctrl enable - CHECK_RESULT $? 0 0 "启用resctrl PMDA失败" - fi - - LOG_INFO "步骤6: 验证resctrl PMDA数据采集功能" - pmdumptext -t 1sec -a /var/log/pcp/pmlogger/$(hostname)/$(date +%Y%m%d) resctrl.llc_occupancy 2>&1 | head -5 - CHECK_RESULT $? 0 0 "resctrl PMDA数据采集功能验证失败" - - LOG_INFO "步骤7: 环境恢复" - if [ "$KEEP_INSTALLED" = "false" ]; then - LOG_INFO "卸载pcp-pmda-resctrl软件包" - dnf remove -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "卸载pcp-pmda-resctrl失败" - else - LOG_INFO "保持pcp-pmda-resctrl安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_install.sh b/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_install.sh deleted file mode 100644 index f7e90a09ee2..00000000000 --- a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_install.sh +++ /dev/null @@ -1,119 +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-04 -# @License : Mulan PSL v2 -# @Desc : 测试软件包的基本安装功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数 - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -ne $expect ]; then - LOG_ERROR "$message" - exit $actual - fi - else - if [ $actual -eq $expect ]; then - LOG_ERROR "$message" - exit 1 - fi - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_pass=$3 - local node_user=$4 - sshpass -p "$node_pass" ssh -o StrictHostKeyChecking=no "$node_user"@"$node_ip" "$cmd" - } - - # 测试软件包的基本安装功能 - LOG_INFO "开始测试软件包的基本安装功能" - - # 检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在pcp-pmda-resctrl软件包" - dnf list available pcp-pmda-resctrl > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到pcp-pmda-resctrl软件包" - exit 255 - fi - - # 检查当前是否已安装 - LOG_INFO "检查当前是否已安装pcp-pmda-resctrl软件包" - rpm -q pcp-pmda-resctrl > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,脚本结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "软件包未安装,将在测试步骤中安装" - INSTALLED=0 - fi - - # 如果未安装,则进行安装测试 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装pcp-pmda-resctrl软件包" - dnf install -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "安装pcp-pmda-resctrl软件包失败" - LOG_INFO "安装pcp-pmda-resctrl软件包成功" - fi - - # 测试软件包基本功能 - LOG_INFO "测试pcp-pmda-resctrl软件包基本功能" - # 检查软件包提供的命令是否存在 - LOG_INFO "检查pcp-pmda-resctrl相关命令是否存在" - command -v pmdaresctrl > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pmdaresctrl命令不存在" - - # 测试命令参数支持情况 - LOG_INFO "测试pmdaresctrl命令参数支持情况" - pmdaresctrl --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pmdaresctrl命令不支持--help参数" - exit 255 - fi - - # 清理环境 - LOG_INFO "开始清理测试环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的pcp-pmda-resctrl软件包" - dnf remove -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "卸载pcp-pmda-resctrl软件包失败" - LOG_INFO "卸载pcp-pmda-resctrl软件包成功" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试软件包的基本安装功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_metrics.sh b/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_metrics.sh deleted file mode 100644 index 9079a7181a5..00000000000 --- a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_metrics.sh +++ /dev/null @@ -1,81 +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-04 -# @License : Mulan PSL v2 -# @Desc : 测试通过pminfo查询resctrl相关指标 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试通过pminfo查询resctrl相关指标" - - # 定义软件包名称 - PACKAGE="pcp-pmda-resctrl" - LOG_INFO "检查是否已安装$PACKAGE" - - # 检查是否已安装pcp-pmda-resctrl - if rpm -q $PACKAGE &> /dev/null; then - LOG_INFO "$PACKAGE 已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "$PACKAGE 未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有pcp-pmda-resctrl软件包 - LOG_INFO "检查yum源中是否有$PACKAGE软件包" - if ! dnf list available $PACKAGE &> /dev/null; then - LOG_ERROR "yum源中未找到$PACKAGE软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装$PACKAGE软件包" - dnf install -y $PACKAGE - CHECK_RESULT $? 0 0 "安装$PACKAGE失败" - fi - - # 检查pminfo命令是否支持resctl相关指标 - LOG_INFO "检查pminfo命令是否支持resctrl相关指标" - if ! pminfo resctrl &> /dev/null; then - LOG_ERROR "pminfo不支持resctrl相关指标" - # 如果之前未安装,则需要卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载$PACKAGE软件包" - dnf remove -y $PACKAGE - fi - exit 255 - fi - - # 使用pminfo查询resctrl相关指标 - LOG_INFO "使用pminfo查询resctrl相关指标" - pminfo resctrl - CHECK_RESULT $? 0 0 "pminfo查询resctrl相关指标失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "测试前未安装$PACKAGE,现在卸载" - dnf remove -y $PACKAGE - CHECK_RESULT $? 0 0 "卸载$PACKAGE失败" - else - LOG_INFO "测试前已安装$PACKAGE,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_performance.sh b/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_performance.sh deleted file mode 100644 index 5c54f35ba81..00000000000 --- a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_performance.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-02-04 -# @License : Mulan PSL v2 -# @Desc : 测试通过pmval查看关键性能指标 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(虽然题目说明已定义,但实际脚本中需要确保存在) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义检查结果函数(虽然题目说明已定义,但实际脚本中需要确保存在) - CHECK_RESULT() { - local actual=$1 - local expected=$2 - local exit_code=$3 - local error_msg=$4 - if [ $actual -ne $expected ]; then - LOG_ERROR "$error_msg" - exit $exit_code - fi - } - - # 定义SSH_CMD函数(虽然题目说明已定义,但实际脚本中需要确保存在) - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_password=$3 - local node_user=$4 - sshpass -p "$node_password" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "${node_user}@${node_ip}" "$cmd" - } - - # 测试脚本开始 - LOG_INFO "开始测试通过pmval查看关键性能指标" - - # 检查环境是否已安装pcp-pmda-resctrl - LOG_INFO "检查pcp-pmda-resctrl是否已安装" - if dnf list installed pcp-pmda-resctrl &>/dev/null; then - LOG_INFO "pcp-pmda-resctrl已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "pcp-pmda-resctrl未安装,将在测试过程中安装" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有pcp-pmda-resctrl软件包 - LOG_INFO "检查yum源中是否有pcp-pmda-resctrl软件包" - if ! dnf list available pcp-pmda-resctrl &>/dev/null; then - LOG_ERROR "yum源中没有pcp-pmda-resctrl软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "安装pcp-pmda-resctrl软件包" - dnf install -y pcp-pmda-resctrl - CHECK_RESULT $? 0 255 "安装pcp-pmda-resctrl失败" - fi - - # 检查pmval命令是否存在 - LOG_INFO "检查pmval命令是否存在" - if ! command -v pmval &>/dev/null; then - LOG_ERROR "pmval命令不存在" - exit 255 - fi - - # 检查pmval命令是否支持所需参数 - LOG_INFO "检查pmval命令是否支持所需参数" - if ! pmval --help 2>&1 | grep -q "metricname"; then - LOG_ERROR "pmval命令不支持metricname参数" - exit 255 - fi - - # 通过pmval查看关键性能指标 - LOG_INFO "通过pmval查看关键性能指标" - pmval -f 1 -t 2 kernel.all.load - CHECK_RESULT $? 0 $? "通过pmval查看关键性能指标失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "卸载pcp-pmda-resctrl软件包" - dnf remove -y pcp-pmda-resctrl - CHECK_RESULT $? 0 $? "卸载pcp-pmda-resctrl失败" - else - LOG_INFO "测试前已安装pcp-pmda-resctrl,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_remove.sh b/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_remove.sh deleted file mode 100644 index 54f38f69593..00000000000 --- a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_remove.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-04 -# @License : Mulan PSL v2 -# @Desc : 测试软件包的卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(根据要求直接使用,此处仅作声明) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义检查结果函数(根据要求直接使用,此处仅作声明) - CHECK_RESULT() { - # 参数:实际退出码 预期退出码 预期退出码(重复) 失败信息 - local actual=$1 - local expected=$2 - local msg=$4 - if [ $actual -ne $expected ]; then - LOG_ERROR "$msg" - exit $actual - fi - } - - # 定义SSH_CMD函数(根据要求直接使用,此处仅作声明) - SSH_CMD() { - # 参数:命令 IP 密码 用户 - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - # 这里仅作声明,实际使用时需根据环境实现 - echo "SSH_CMD placeholder: $cmd on $ip as $user" - } - - # 定义变量 - PACKAGE_NAME="pcp-pmda-resctrl" - LOG_INFO "开始测试软件包卸载功能" - - # 检查yum源中是否存在指定软件包 - LOG_INFO "检查yum源中是否存在 $PACKAGE_NAME 软件包" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包" - exit 255 - fi - - # 判断环境是否已安装该软件包 - LOG_INFO "检查系统是否已安装 $PACKAGE_NAME" - if rpm -q $PACKAGE_NAME &>/dev/null; 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 失败" - LOG_INFO "$PACKAGE_NAME 安装成功" - fi - - # 测试卸载功能 - LOG_INFO "测试卸载 $PACKAGE_NAME 软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - LOG_INFO "$PACKAGE_NAME 卸载成功" - - # 验证软件包是否已卸载 - LOG_INFO "验证 $PACKAGE_NAME 是否已卸载" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "$PACKAGE_NAME 卸载后仍然存在" - exit 1 - else - LOG_INFO "$PACKAGE_NAME 已成功卸载" - fi - - # 环境恢复:如果测试前已安装,则重新安装;否则保持卸载状态 - LOG_INFO "恢复环境状态" - if [ "$INSTALLED_BEFORE" = "true" ]; 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 "测试软件包卸载功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_status.sh b/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_status.sh deleted file mode 100644 index 24097d79465..00000000000 --- a/testcases/function_test/pkg_test/pcp/pcp-pmda-resctrl/test_pcp-pmda-resctrl_function_status.sh +++ /dev/null @@ -1,94 +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-04 -# @License : Mulan PSL v2 -# @Desc : 测试PMDA代理服务状态检查功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装pcp-pmda-resctrl - LOG_INFO "检查pcp-pmda-resctrl是否已安装" - rpm -q pcp-pmda-resctrl &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "pcp-pmda-resctrl已安装,脚本结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "pcp-pmda-resctrl未安装,将在测试过程中安装,并在脚本结束前卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有pcp-pmda-resctrl软件包 - LOG_INFO "检查yum源中是否有pcp-pmda-resctrl软件包" - dnf list available pcp-pmda-resctrl &>/dev/null - CHECK_RESULT $? 0 255 "yum源中未找到pcp-pmda-resctrl软件包" - - # 如果未安装,则安装pcp-pmda-resctrl - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装pcp-pmda-resctrl软件包" - dnf install -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "安装pcp-pmda-resctrl失败" - fi - - # 检查PMDA代理服务状态检查功能 - LOG_INFO "测试PMDA代理服务状态检查功能" - # 使用pcp命令检查resctrl PMDA代理状态,这里假设使用pcp命令检查 - # 如果pcp命令不支持相关参数,则退出 - LOG_INFO "执行pcp命令检查resctrl PMDA状态" - pcp 2>&1 | grep -q "resctrl" - if [ $? -ne 0 ]; then - LOG_ERROR "pcp命令不支持resctrl参数" - exit 255 - fi - - # 模拟检查PMDA代理服务状态,这里使用一个假设的命令 - # 实际应根据pcp-pmda-resctrl的文档使用正确的命令和参数 - LOG_INFO "执行PMDA代理服务状态检查" - # 假设使用pcp resctrl status命令检查状态 - # 如果命令不存在或不支持,则退出 - command -v pcp &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "pcp命令不存在" - exit 255 - fi - - # 执行状态检查命令 - pcp resctrl status &>/dev/null - CHECK_RESULT $? 0 0 "PMDA代理服务状态检查失败" - - # 如果是在第二个服务器上执行,使用SSH_CMD - # 这里假设需要在第二个服务器上执行相同的检查 - # 如果NODE2_IPV4等变量已定义,则执行 - if [ -n "$NODE2_IPV4" ] && [ -n "$NODE2_PASSWORD" ] && [ -n "$NODE2_USER" ]; then - LOG_INFO "在第二个服务器上执行PMDA代理服务状态检查" - SSH_CMD "pcp resctrl status" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "在第二个服务器上执行PMDA代理服务状态检查失败" - fi - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载pcp-pmda-resctrl软件包" - dnf remove -y pcp-pmda-resctrl - CHECK_RESULT $? 0 0 "卸载pcp-pmda-resctrl失败" - else - LOG_INFO "保持pcp-pmda-resctrl安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From cc740d7dd500f3aff90bcc6b9cd384a01d894b26 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 20:56:06 +0800 Subject: [PATCH 15/25] update testcase for testsuite texlive-2up-doc --- .../texlive-split-a/texlive-2up-doc.json | 20 ---- .../test_texlive-2up-doc_function_basic.sh | 64 ------------ ...exlive-2up-doc_function_check_installed.sh | 81 --------------- ...st_texlive-2up-doc_function_doc_content.sh | 76 -------------- .../test_texlive-2up-doc_function_install.sh | 72 -------------- ...test_texlive-2up-doc_function_uninstall.sh | 99 ------------------- 6 files changed, 412 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_basic.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_check_installed.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_doc_content.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-a/texlive-2up-doc.json b/suite2cases/function_test/pkg_test/texlive-split-a/texlive-2up-doc.json index be2354dbbcf..fb8b04385c8 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-a/texlive-2up-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-a/texlive-2up-doc.json @@ -2,29 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc", "machine num": 1, "cases": [ - { - "name": "test_texlive-2up-doc_function_basic", - "desc": "Test basic functionality" - }, - { - "name": "test_texlive-2up-doc_function_install", - "desc": "Test installation of texlive-2up-doc package" - }, - { - "name": "test_texlive-2up-doc_function_check_installed", - "desc": "Test if texlive-2up-doc is installed" - }, { "name": "test_texlive-2up-doc_function_list_files", "desc": "Test listing files in texlive-2up-doc package" - }, - { - "name": "test_texlive-2up-doc_function_doc_content", - "desc": "Test accessing documentation content" - }, - { - "name": "test_texlive-2up-doc_function_uninstall", - "desc": "Test uninstallation of texlive-2up-doc package" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_basic.sh deleted file mode 100644 index a58153af2fa..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_basic.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-09-16 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic functionality" - - # 检查是否已安装texlive-2up-doc - LOG_INFO "检查texlive-2up-doc是否已安装" - dnf list installed texlive-2up-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-2up-doc已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-2up-doc未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-2up-doc - LOG_INFO "检查yum源中是否有texlive-2up-doc" - dnf list available texlive-2up-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-2up-doc" - - # 安装texlive-2up-doc(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-2up-doc" - dnf install -y texlive-2up-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "安装texlive-2up-doc失败" - fi - - # 测试基本功能 - LOG_INFO "测试基本功能" - command_to_test="some_command --param" # 替换为实际命令和参数 - $command_to_test > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "命令执行失败或参数不支持" - - # 清理环境(如果测试前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-2up-doc以恢复环境" - dnf remove -y texlive-2up-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "卸载texlive-2up-doc失败" - fi - - LOG_INFO "测试完成:Test basic functionality" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_check_installed.sh b/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_check_installed.sh deleted file mode 100644 index 10bd40ada69..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_check_installed.sh +++ /dev/null @@ -1,81 +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-20 -# @License : Mulan PSL v2 -# @Desc : Test if texlive-2up-doc is installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装了texlive-2up-doc - LOG_INFO "检查texlive-2up-doc是否已经安装" - rpm -q texlive-2up-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-2up-doc已经安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "texlive-2up-doc未安装,将在测试步骤中安装" - already_installed=false - fi - - # 检查yum源中是否有texlive-2up-doc软件包 - LOG_INFO "检查yum源中是否有texlive-2up-doc软件包" - dnf list available texlive-2up-doc > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-2up-doc软件包" - exit 255 - fi - - # 测试安装功能 - if [ "$already_installed" = "false" ]; then - LOG_INFO "开始安装texlive-2up-doc软件包" - dnf install -y texlive-2up-doc - CHECK_RESULT $? 0 0 "安装texlive-2up-doc失败" - fi - - # 验证软件包是否安装成功 - LOG_INFO "验证texlive-2up-doc是否安装成功" - rpm -q texlive-2up-doc - CHECK_RESULT $? 0 0 "texlive-2up-doc未正确安装" - - # 测试软件包的基本功能(这里假设texlive-2up-doc是一个文档包,没有可执行命令) - # 可以检查相关文件是否存在 - LOG_INFO "检查texlive-2up-doc相关文件" - ls /usr/share/doc/texlive-2up-doc/ > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-2up-doc文档目录不存在" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "清理环境:卸载texlive-2up-doc软件包" - dnf remove -y texlive-2up-doc - CHECK_RESULT $? 0 0 "卸载texlive-2up-doc失败" - - # 验证卸载是否成功 - rpm -q texlive-2up-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "texlive-2up-doc卸载失败" - exit 1 - else - LOG_INFO "texlive-2up-doc已成功卸载,环境已恢复" - fi - else - LOG_INFO "测试前已安装texlive-2up-doc,保持安装状态,无需卸载" - fi - - LOG_INFO "texlive-2up-doc安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_doc_content.sh b/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_doc_content.sh deleted file mode 100644 index 5139fb37bb7..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_doc_content.sh +++ /dev/null @@ -1,76 +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-20 -# @License : Mulan PSL v2 -# @Desc : Test accessing documentation content -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:访问文档内容" - - # 检查是否已安装 texlive-2up-doc - LOG_INFO "步骤1:检查 texlive-2up-doc 是否已安装" - dnf list installed texlive-2up-doc &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "texlive-2up-doc 已安装,测试后将保持安装状态" - already_installed=true - else - LOG_INFO "texlive-2up-doc 未安装,将在测试中安装并在结束后卸载" - already_installed=false - fi - - # 检查 yum 源中是否有该软件包 - LOG_INFO "步骤2:检查 yum 源中是否存在 texlive-2up-doc 软件包" - dnf list available texlive-2up-doc &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 texlive-2up-doc 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装 texlive-2up-doc 软件包" - dnf install -y texlive-2up-doc - CHECK_RESULT $? 0 0 "安装 texlive-2up-doc 失败" - fi - - # 测试访问文档内容 - LOG_INFO "步骤4:测试访问 texlive-2up-doc 的文档内容" - if [ -d "/usr/share/texlive-doc/texmf-dist/doc/latex/2up" ]; then - LOG_INFO "文档目录存在,检查文档文件" - ls /usr/share/texlive-doc/texmf-dist/doc/latex/2up/*.pdf &>/dev/null - CHECK_RESULT $? 0 0 "未找到 PDF 文档文件" - LOG_INFO "PDF 文档文件存在" - else - LOG_ERROR "文档目录不存在" - exit 1 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤5:卸载 texlive-2up-doc 软件包" - dnf remove -y texlive-2up-doc - CHECK_RESULT $? 0 0 "卸载 texlive-2up-doc 失败" - LOG_INFO "环境已恢复,texlive-2up-doc 已卸载" - else - LOG_INFO "环境已恢复,保持 texlive-2up-doc 安装状态" - fi - - LOG_INFO "测试完成:访问文档内容" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_install.sh b/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_install.sh deleted file mode 100644 index 531bf9f5dc9..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_install.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : Test installation of texlive-2up-doc package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-2up-doc - LOG_INFO "检查texlive-2up-doc是否已安装" - if rpm -q texlive-2up-doc &>/dev/null; then - LOG_INFO "texlive-2up-doc已安装,测试结束将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "texlive-2up-doc未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有texlive-2up-doc软件包 - LOG_INFO "检查yum源中是否有texlive-2up-doc软件包" - if ! dnf list available texlive-2up-doc &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-2up-doc软件包" - exit 255 - fi - - # 安装texlive-2up-doc软件包 - LOG_INFO "安装texlive-2up-doc软件包" - dnf install -y texlive-2up-doc - CHECK_RESULT $? 0 0 "安装texlive-2up-doc失败" - - # 验证texlive-2up-doc是否安装成功 - LOG_INFO "验证texlive-2up-doc是否安装成功" - rpm -q texlive-2up-doc - CHECK_RESULT $? 0 0 "texlive-2up-doc未正确安装" - - # 检查texlive-2up-doc相关命令或文件是否存在 - LOG_INFO "检查texlive-2up-doc相关文件是否存在" - if [ -d /usr/share/texlive/texmf-dist/doc/latex/2up ]; then - LOG_INFO "texlive-2up-doc相关文件存在" - else - LOG_ERROR "texlive-2up-doc相关文件不存在" - CHECK_RESULT 1 0 0 "texlive-2up-doc文件检查失败" - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "测试前未安装texlive-2up-doc,开始卸载" - dnf remove -y texlive-2up-doc - CHECK_RESULT $? 0 0 "卸载texlive-2up-doc失败" - LOG_INFO "texlive-2up-doc已卸载,环境已恢复" - else - LOG_INFO "测试前已安装texlive-2up-doc,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_uninstall.sh deleted file mode 100644 index 8a49a2a21e4..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-a/texlive-2up-doc/test_texlive-2up-doc_function_uninstall.sh +++ /dev/null @@ -1,99 +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-20 -# @License : Mulan PSL v2 -# @Desc : Test uninstallation of texlive-2up-doc package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:判断texlive-2up-doc是否已安装 - LOG_INFO "检查texlive-2up-doc软件包是否已安装" - dnf list installed texlive-2up-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-2up-doc已安装,测试结束将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "texlive-2up-doc未安装,测试将先安装后卸载" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否存在texlive-2up-doc软件包" - dnf list available texlive-2up-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中不存在texlive-2up-doc软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-2up-doc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "开始安装texlive-2up-doc软件包" - dnf install -y texlive-2up-doc - CHECK_RESULT $? 0 0 "安装texlive-2up-doc软件包失败" - if [ $? -ne 0 ]; then - LOG_ERROR "安装texlive-2up-doc软件包失败" - exit 1 - fi - LOG_INFO "texlive-2up-doc软件包安装成功" - fi - - # 验证软件包是否安装成功 - LOG_INFO "验证texlive-2up-doc软件包是否安装成功" - dnf list installed texlive-2up-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-2up-doc软件包未正确安装" - if [ $? -ne 0 ]; then - LOG_ERROR "texlive-2up-doc软件包未正确安装" - exit 1 - fi - LOG_INFO "texlive-2up-doc软件包验证成功" - - # 测试卸载功能 - LOG_INFO "开始卸载texlive-2up-doc软件包" - dnf remove -y texlive-2up-doc - CHECK_RESULT $? 0 0 "卸载texlive-2up-doc软件包失败" - if [ $? -ne 0 ]; then - LOG_ERROR "卸载texlive-2up-doc软件包失败" - exit 1 - fi - LOG_INFO "texlive-2up-doc软件包卸载成功" - - # 验证软件包是否已卸载 - LOG_INFO "验证texlive-2up-doc软件包是否已卸载" - dnf list installed texlive-2up-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "texlive-2up-doc软件包卸载后仍存在" - exit 1 - fi - LOG_INFO "texlive-2up-doc软件包卸载验证成功" - - # 环境恢复:如果测试前已安装,则重新安装 - if [ $INSTALLED_FLAG -eq 1 ]; then - LOG_INFO "恢复环境:重新安装texlive-2up-doc软件包" - dnf install -y texlive-2up-doc - CHECK_RESULT $? 0 0 "重新安装texlive-2up-doc软件包失败" - if [ $? -ne 0 ]; then - LOG_ERROR "重新安装texlive-2up-doc软件包失败" - exit 1 - fi - LOG_INFO "texlive-2up-doc软件包重新安装成功" - fi - - LOG_INFO "测试完成:texlive-2up-doc软件包卸载功能正常" -} - -main "$@" \ No newline at end of file From 76959f41f378df33ebf74a4b9ee45cae56f4f6af Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:01:09 +0800 Subject: [PATCH 16/25] update testcase for testsuite linuxconsoletools --- .../linuxconsoletools/linuxconsoletools.json | 12 -- ...st_linuxconsoletools_inputattach__lkkbd.sh | 72 ----------- ...onsoletools_inputattach__rainshadow_cec.sh | 116 ------------------ ...est_linuxconsoletools_inputattach_w8001.sh | 91 -------------- 4 files changed, 291 deletions(-) delete mode 100644 testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__lkkbd.sh delete mode 100644 testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__rainshadow_cec.sh delete mode 100644 testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach_w8001.sh diff --git a/suite2cases/function_test/pkg_test/linuxconsoletools/linuxconsoletools.json b/suite2cases/function_test/pkg_test/linuxconsoletools/linuxconsoletools.json index d7602405a8e..018573c0eb4 100644 --- a/suite2cases/function_test/pkg_test/linuxconsoletools/linuxconsoletools.json +++ b/suite2cases/function_test/pkg_test/linuxconsoletools/linuxconsoletools.json @@ -73,10 +73,6 @@ "name": "test_linuxconsoletools_inputattach__stowawaykbd", "desc": "测试使用--stowawaykbd模式附加Stowaway键盘" }, - { - "name": "test_linuxconsoletools_inputattach__lkkbd", - "desc": "测试使用--lkkbd模式附加DEC LK201/LK401键盘" - }, { "name": "test_linuxconsoletools_inputattach__mmwheel", "desc": "测试使用--mmwheel模式附加带4-5键或滚轮的罗技鼠标" @@ -109,10 +105,6 @@ "name": "test_linuxconsoletools_inputattach__pulse8_cec", "desc": "测试使用--pulse8-cec模式附加Pulse Eight HDMI CEC适配器" }, - { - "name": "test_linuxconsoletools_inputattach__rainshadow_cec", - "desc": "测试使用--rainshadow-cec模式附加RainShadow Tech HDMI CEC适配器" - }, { "name": "test_linuxconsoletools_inputattach__touchit213", "desc": "测试使用--touchit213模式附加Sahara Touch-iT213平板电脑" @@ -261,10 +253,6 @@ "name": "test_linuxconsoletools_inputattach_twiddler_joy", "desc": "测试inputattach命令连接用作操纵杆的Handykey Twiddler" }, - { - "name": "test_linuxconsoletools_inputattach_w8001", - "desc": "测试inputattach命令连接Wacom W8001" - }, { "name": "test_linuxconsoletools_inputattach_warrior", "desc": "测试inputattach命令连接WingMan Warrior" diff --git a/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__lkkbd.sh b/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__lkkbd.sh deleted file mode 100644 index 6ede18508f4..00000000000 --- a/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__lkkbd.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-12 -# @License : Mulan PSL v2 -# @Desc : 测试使用--lkkbd模式附加DEC LK201/LK401键盘 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:使用--lkkbd模式附加DEC LK201/LK401键盘" - LOG_INFO "1. 检查linuxconsoletools软件包是否在yum源中" - if ! dnf list available linuxconsoletools &>/dev/null; then - LOG_ERROR "linuxconsoletools软件包不在yum源中" - exit 255 - fi - LOG_INFO "linuxconsoletools软件包在yum源中" - - LOG_INFO "2. 检查系统是否已安装linuxconsoletools" - if rpm -q linuxconsoletools &>/dev/null; then - LOG_INFO "linuxconsoletools已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "linuxconsoletools未安装,将在测试过程中安装" - INSTALLED=0 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "3. 安装linuxconsoletools软件包" - dnf install -y linuxconsoletools - CHECK_RESULT $? 0 0 "安装linuxconsoletools失败" - fi - - LOG_INFO "4. 检查inputattach命令是否支持--lkkbd参数" - inputattach --help 2>&1 | grep -q -- --lkkbd - CHECK_RESULT $? 0 0 "inputattach命令不支持--lkkbd参数" - - LOG_INFO "5. 模拟使用--lkkbd模式附加DEC LK201/LK401键盘(此处为模拟测试)" - LOG_INFO "执行命令:inputattach --lkkbd /dev/ttyS0" - inputattach --lkkbd /dev/ttyS0 2>&1 | grep -q "error\|Error" - if [ $? -eq 0 ]; then - LOG_ERROR "模拟附加DEC LK201/LK401键盘失败" - exit 1 - else - LOG_INFO "模拟附加DEC LK201/LK401键盘成功" - fi - - LOG_INFO "6. 清理环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载linuxconsoletools软件包" - dnf remove -y linuxconsoletools - CHECK_RESULT $? 0 0 "卸载linuxconsoletools失败" - else - LOG_INFO "保持linuxconsoletools软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__rainshadow_cec.sh b/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__rainshadow_cec.sh deleted file mode 100644 index c69f6b3ab16..00000000000 --- a/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach__rainshadow_cec.sh +++ /dev/null @@ -1,116 +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-12 -# @License : Mulan PSL v2 -# @Desc : 测试使用--rainshadow-cec模式附加RainShadow Tech HDMI CEC适配器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装linuxconsoletools包 - LOG_INFO "检查是否已安装linuxconsoletools软件包..." - rpm -q linuxconsoletools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "linuxconsoletools已安装,测试结束后保持安装状态" - INSTALLED_BEFORE="yes" - else - LOG_INFO "linuxconsoletools未安装,将在测试前安装并在测试后卸载" - INSTALLED_BEFORE="no" - fi - - # 检查yum源中是否有linuxconsoletools软件包 - LOG_INFO "检查yum源中是否有linuxconsoletools软件包..." - dnf list available linuxconsoletools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到linuxconsoletools软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "开始安装linuxconsoletools软件包..." - dnf install -y linuxconsoletools - CHECK_RESULT $? 0 0 "安装linuxconsoletools失败" - LOG_INFO "linuxconsoletools软件包安装成功" - fi - - # 检查inputattach命令是否存在 - LOG_INFO "检查inputattach命令是否存在..." - which inputattach > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "inputattach命令不存在" - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载之前安装的linuxconsoletools软件包..." - dnf remove -y linuxconsoletools - fi - exit 255 - fi - - # 检查--rainshadow-cec参数是否支持 - LOG_INFO "检查inputattach命令是否支持--rainshadow-cec参数..." - inputattach --help 2>&1 | grep -q "rainshadow-cec" - if [ $? -ne 0 ]; then - LOG_ERROR "inputattach命令不支持--rainshadow-cec参数" - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载之前安装的linuxconsoletools软件包..." - dnf remove -y linuxconsoletools - fi - exit 255 - fi - - # 测试使用--rainshadow-cec模式附加RainShadow Tech HDMI CEC适配器 - LOG_INFO "测试使用--rainshadow-cec模式附加RainShadow Tech HDMI CEC适配器..." - LOG_INFO "注意:此测试需要实际的RainShadow Tech HDMI CEC适配器硬件" - LOG_INFO "如果没有连接适配器,此步骤可能会失败" - - # 尝试运行命令(模拟测试,实际可能需要真实硬件) - inputattach --rainshadow-cec /dev/ttyS0 2>&1 | head -5 - TEST_EXIT_CODE=$? - - # 根据实际情况检查结果 - # 由于是模拟测试,我们主要检查命令是否能被识别和执行 - # 如果没有真实硬件,命令可能会返回非0,但这不是脚本的失败 - if [ $TEST_EXIT_CODE -eq 255 ]; then - LOG_ERROR "inputattach命令执行失败,参数可能不正确" - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载之前安装的linuxconsoletools软件包..." - dnf remove -y linuxconsoletools - fi - exit 255 - elif [ $TEST_EXIT_CODE -eq 1 ]; then - LOG_INFO "inputattach命令执行返回1,可能是由于未连接实际硬件" - LOG_INFO "这是预期行为,因为测试环境可能没有真实的RainShadow Tech HDMI CEC适配器" - else - LOG_INFO "inputattach命令执行完成,退出码为$TEST_EXIT_CODE" - fi - - # 清理测试环境 - LOG_INFO "清理测试环境..." - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载测试安装的linuxconsoletools软件包..." - dnf remove -y linuxconsoletools - CHECK_RESULT $? 0 0 "卸载linuxconsoletools失败" - LOG_INFO "linuxconsoletools软件包卸载成功" - else - LOG_INFO "保持linuxconsoletools软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach_w8001.sh b/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach_w8001.sh deleted file mode 100644 index 205462c7a31..00000000000 --- a/testcases/function_test/pkg_test/linuxconsoletools/linuxconsoletools/test_linuxconsoletools_inputattach_w8001.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-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试inputattach命令连接Wacom W8001 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装linuxconsoletools软件包 - LOG_INFO "检查linuxconsoletools软件包是否已安装" - rpm -q linuxconsoletools > /dev/null 2>&1 - is_installed=$? - - # 获取软件包信息 - LOG_INFO "检查yum源中是否存在linuxconsoletools软件包" - dnf list available linuxconsoletools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到linuxconsoletools软件包" - exit 255 - fi - - # 安装软件包(如果未安装) - if [ $is_installed -ne 0 ]; then - LOG_INFO "安装linuxconsoletools软件包" - dnf install -y linuxconsoletools - CHECK_RESULT $? 0 0 "安装linuxconsoletools失败" - fi - - # 检查inputattach命令是否存在 - LOG_INFO "检查inputattach命令是否存在" - which inputattach > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "inputattach命令不存在" - - # 检查inputattach是否支持Wacom W8001参数 - LOG_INFO "检查inputattach是否支持Wacom W8001参数" - inputattach --help 2>&1 | grep -i "w8001" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "inputattach不支持Wacom W8001参数" - # 如果是测试期间安装的,需要卸载 - if [ $is_installed -ne 0 ]; then - LOG_INFO "卸载linuxconsoletools软件包" - dnf remove -y linuxconsoletools - fi - exit 255 - fi - - # 测试inputattach命令连接Wacom W8001 - LOG_INFO "测试inputattach命令连接Wacom W8001" - LOG_INFO "注意:此测试需要实际的Wacom W8001设备连接,这里仅测试命令语法" - - # 模拟测试命令语法(实际使用时需要真实设备) - inputattach --w8001 /dev/ttyS0 2>&1 | head -5 - test_result=$? - - # 检查命令执行结果 - if [ $test_result -eq 0 ] || [ $test_result -eq 1 ]; then - LOG_INFO "inputattach命令语法测试通过" - CHECK_RESULT 0 0 0 "inputattach命令执行失败" - else - LOG_ERROR "inputattach命令执行异常" - CHECK_RESULT $test_result 0 0 "inputattach命令执行失败" - fi - - # 环境清理 - LOG_INFO "清理测试环境" - if [ $is_installed -ne 0 ]; then - LOG_INFO "卸载测试期间安装的linuxconsoletools软件包" - dnf remove -y linuxconsoletools - CHECK_RESULT $? 0 0 "卸载linuxconsoletools失败" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file From e09ae0e4df5747496c99ca898ab40d292b53ffd7 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:05:09 +0800 Subject: [PATCH 17/25] update testcase for testsuite texlive-uri-doc --- .../texlive-split-y/texlive-uri-doc.json | 16 --- ...st_texlive-uri-doc_function_doc_content.sh | 107 ------------------ ..._texlive-uri-doc_function_example_usage.sh | 93 --------------- ...texlive-uri-doc_function_package_remove.sh | 81 ------------- ...est_texlive-uri-doc_function_texmf_path.sh | 80 ------------- 5 files changed, 377 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_doc_content.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_example_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_package_remove.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_texmf_path.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-uri-doc.json b/suite2cases/function_test/pkg_test/texlive-split-y/texlive-uri-doc.json index 7eb5547935e..3c48f4f815f 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-uri-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-y/texlive-uri-doc.json @@ -9,22 +9,6 @@ { "name": "test_texlive-uri-doc_function_package_install", "desc": "Verify the package can be installed via package manager" - }, - { - "name": "test_texlive-uri-doc_function_doc_content", - "desc": "Check documentation for key content" - }, - { - "name": "test_texlive-uri-doc_function_package_remove", - "desc": "Verify the package can be cleanly uninstalled" - }, - { - "name": "test_texlive-uri-doc_function_texmf_path", - "desc": "Confirm files are in correct texmf path" - }, - { - "name": "test_texlive-uri-doc_function_example_usage", - "desc": "Test basic LaTeX usage of uri package" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_doc_content.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_doc_content.sh deleted file mode 100644 index bcf9940d5c9..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_doc_content.sh +++ /dev/null @@ -1,107 +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-03 -# @License : Mulan PSL v2 -# @Desc : Check documentation for key content -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装texlive-uri-doc软件包 - LOG_INFO "检查texlive-uri-doc软件包是否已安装" - dnf list installed texlive-uri-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-uri-doc已安装,脚本结束后将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "texlive-uri-doc未安装,将在测试过程中安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在texlive-uri-doc软件包 - LOG_INFO "检查yum源中是否存在texlive-uri-doc软件包" - dnf list available texlive-uri-doc > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-uri-doc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "安装texlive-uri-doc软件包" - dnf install -y texlive-uri-doc - CHECK_RESULT $? 0 0 "安装texlive-uri-doc失败" - fi - - # 检查软件包文档路径是否存在 - LOG_INFO "检查texlive-uri-doc文档路径" - DOC_PATH=$(rpm -ql texlive-uri-doc | grep -E "\.pdf$|\.html$|\.txt$" | head -1) - if [ -z "${DOC_PATH}" ]; then - LOG_ERROR "未找到texlive-uri-doc文档文件" - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载texlive-uri-doc软件包" - dnf remove -y texlive-uri-doc - fi - exit 1 - fi - - # 检查文档中是否包含关键内容 - LOG_INFO "检查文档中是否包含关键内容" - if [ -f "${DOC_PATH}" ]; then - # 根据文件类型使用不同方式检查 - case "${DOC_PATH}" in - *.pdf) - if command -v pdftotext > /dev/null 2>&1; then - pdftotext "${DOC_PATH}" - | grep -i "uri" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "PDF文档中未找到URI相关关键内容" - else - LOG_INFO "未安装pdftotext,跳过PDF内容检查" - fi - ;; - *.html|*.htm) - grep -i "uri" "${DOC_PATH}" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "HTML文档中未找到URI相关关键内容" - ;; - *.txt) - grep -i "uri" "${DOC_PATH}" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "文本文档中未找到URI相关关键内容" - ;; - *) - LOG_INFO "未知文档格式,跳过内容检查" - ;; - esac - else - LOG_ERROR "文档文件不存在: ${DOC_PATH}" - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载texlive-uri-doc软件包" - dnf remove -y texlive-uri-doc - fi - exit 1 - fi - - LOG_INFO "文档关键内容检查完成" - - # 环境清理:如果测试前未安装,则卸载软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "清理测试环境,卸载texlive-uri-doc软件包" - dnf remove -y texlive-uri-doc - CHECK_RESULT $? 0 0 "卸载texlive-uri-doc失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_example_usage.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_example_usage.sh deleted file mode 100644 index 70885e0350d..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_example_usage.sh +++ /dev/null @@ -1,93 +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-03 -# @License : Mulan PSL v2 -# @Desc : Test basic LaTeX usage of uri package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 检查是否已安装texlive-uri-doc - LOG_INFO "检查texlive-uri-doc软件包是否已安装" - rpm -q texlive-uri-doc > /dev/null 2>&1 - INSTALLED=$? - - # 检查yum源中是否存在texlive-uri-doc - LOG_INFO "检查yum源中是否存在texlive-uri-doc软件包" - dnf list available texlive-uri-doc > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-uri-doc软件包" - exit 255 - fi - - # 根据安装状态决定是否执行安装步骤 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "安装texlive-uri-doc软件包" - dnf install -y texlive-uri-doc - CHECK_RESULT $? 0 0 "安装texlive-uri-doc软件包失败" - INSTALL_FLAG=1 - else - LOG_INFO "texlive-uri-doc软件包已安装,跳过安装步骤" - INSTALL_FLAG=0 - fi - - # 测试基本的LaTeX uri包使用 - LOG_INFO "测试基本的LaTeX uri包使用" - - # 创建一个简单的测试LaTeX文档 - LOG_INFO "创建测试LaTeX文档" - cat > test_uri.tex << "EOF" - \documentclass{article} - \usepackage{uri} - \begin{document} - Test URI: \url{https://www.openeuler.org} - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - - # 使用pdflatex编译文档 - LOG_INFO "使用pdflatex编译测试文档" - pdflatex -interaction=nonstopmode test_uri.tex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译LaTeX文档失败,uri包可能未正确安装或使用" - - # 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f "test_uri.pdf" ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_uri.tex test_uri.pdf test_uri.log test_uri.aux test_uri.out - - # 如果脚本开始时安装了软件包,则在结束时卸载 - if [ $INSTALL_FLAG -eq 1 ]; then - LOG_INFO "卸载texlive-uri-doc软件包" - dnf remove -y texlive-uri-doc - CHECK_RESULT $? 0 0 "卸载texlive-uri-doc软件包失败" - else - LOG_INFO "保持texlive-uri-doc软件包的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_package_remove.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_package_remove.sh deleted file mode 100644 index 1bb02e1cce0..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_package_remove.sh +++ /dev/null @@ -1,81 +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-03 -# @License : Mulan PSL v2 -# @Desc : Verify the package can be cleanly uninstalled -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:验证软件包可以被干净卸载" - - # 检查是否已安装texlive-uri-doc_function_package - LOG_INFO "步骤1:检查texlive-uri-doc_function_package是否已安装" - if dnf list installed texlive-uri-doc_function_package &>/dev/null; then - LOG_INFO "texlive-uri-doc_function_package已安装,测试结束将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "texlive-uri-doc_function_package未安装,将在测试中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否有texlive-uri-doc_function_package软件包" - if ! dnf list available texlive-uri-doc_function_package &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-uri-doc_function_package软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装texlive-uri-doc_function_package软件包" - dnf install -y texlive-uri-doc_function_package - CHECK_RESULT $? 0 0 "安装texlive-uri-doc_function_package失败" - fi - - # 验证软件包安装成功 - LOG_INFO "步骤4:验证texlive-uri-doc_function_package已安装" - dnf list installed texlive-uri-doc_function_package - CHECK_RESULT $? 0 0 "验证texlive-uri-doc_function_package安装状态失败" - - # 测试卸载软件包 - LOG_INFO "步骤5:卸载texlive-uri-doc_function_package软件包" - dnf remove -y texlive-uri-doc_function_package - CHECK_RESULT $? 0 0 "卸载texlive-uri-doc_function_package失败" - - # 验证软件包已卸载 - LOG_INFO "步骤6:验证texlive-uri-doc_function_package已卸载" - if dnf list installed texlive-uri-doc_function_package &>/dev/null; then - LOG_ERROR "texlive-uri-doc_function_package卸载后仍存在" - exit 1 - else - LOG_INFO "texlive-uri-doc_function_package已成功卸载" - fi - - # 环境恢复:如果测试前已安装,则重新安装 - if [ "$INSTALLED_BEFORE" = true ]; then - LOG_INFO "步骤7:恢复环境,重新安装texlive-uri-doc_function_package" - dnf install -y texlive-uri-doc_function_package - CHECK_RESULT $? 0 0 "恢复环境重新安装texlive-uri-doc_function_package失败" - LOG_INFO "环境已恢复,texlive-uri-doc_function_package保持安装状态" - else - LOG_INFO "环境已恢复,texlive-uri-doc_function_package保持未安装状态" - fi - - LOG_INFO "测试完成:验证软件包可以被干净卸载" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_texmf_path.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_texmf_path.sh deleted file mode 100644 index 5ebc002f470..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-uri-doc/test_texlive-uri-doc_function_texmf_path.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-03 -# @License : Mulan PSL v2 -# @Desc : Confirm files are in correct texmf path -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Confirm files are in correct texmf path" - - # 定义软件包名称 - PACKAGE_NAME="texlive-uri-doc" - LOG_INFO "测试步骤:检查yum源中是否存在软件包 ${PACKAGE_NAME}" - if ! dnf list available ${PACKAGE_NAME} &>/dev/null; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 在yum源中不存在" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "测试步骤:检查系统是否已安装 ${PACKAGE_NAME}" - if rpm -q ${PACKAGE_NAME} &>/dev/null; then - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,将在测试过程中安装并在测试结束后卸载" - ALREADY_INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "测试步骤:安装软件包 ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - fi - - # 确认文件是否在正确的 texmf 路径中 - LOG_INFO "测试步骤:确认文件是否在正确的 texmf 路径中" - TEXMF_PATH=$(kpsewhich -var-value TEXMFMAIN) - if [ -z "${TEXMF_PATH}" ]; then - LOG_ERROR "无法获取 TEXMFMAIN 路径" - exit 1 - fi - - # 检查 texlive-uri-doc 相关文件是否在 TEXMFMAIN 路径下 - LOG_INFO "测试步骤:检查 texlive-uri-doc 相关文件是否在 ${TEXMF_PATH} 路径下" - FILES=$(rpm -ql ${PACKAGE_NAME} | head -5) - for file in ${FILES}; do - if [[ ${file} == ${TEXMF_PATH}* ]]; then - LOG_INFO "文件 ${file} 在正确的 texmf 路径中" - else - LOG_ERROR "文件 ${file} 不在正确的 texmf 路径中" - exit 1 - fi - done - - # 如果测试过程中安装了软件包,则在测试结束后卸载 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "测试步骤:卸载软件包 ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - fi - - LOG_INFO "测试完成:Confirm files are in correct texmf path" -} - -main "$@" \ No newline at end of file From 7cce01f309c0437ffbee9e9970c64d9da51314f1 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:05:51 +0800 Subject: [PATCH 18/25] update testcase for testsuite ldapjdk-javadoc --- .../pkg_test/ldapjdk/ldapjdk-javadoc.json | 12 --- ...st_ldapjdk-javadoc_function_check_files.sh | 71 -------------- .../test_ldapjdk-javadoc_function_query.sh | 65 ------------- ...t_ldapjdk-javadoc_function_view_javadoc.sh | 94 ------------------- 4 files changed, 242 deletions(-) delete mode 100644 testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_check_files.sh delete mode 100644 testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_query.sh delete mode 100644 testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_view_javadoc.sh diff --git a/suite2cases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc.json b/suite2cases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc.json index 76be53e7c30..cf23d8f1a64 100644 --- a/suite2cases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc.json +++ b/suite2cases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc.json @@ -6,21 +6,9 @@ "name": "test_ldapjdk-javadoc_function_install", "desc": "Test the installation of ldapjdk-javadoc package" }, - { - "name": "test_ldapjdk-javadoc_function_query", - "desc": "Test querying if the package is installed" - }, { "name": "test_ldapjdk-javadoc_function_uninstall", "desc": "Test uninstalling the package" - }, - { - "name": "test_ldapjdk-javadoc_function_check_files", - "desc": "Check if key documentation files exist" - }, - { - "name": "test_ldapjdk-javadoc_function_view_javadoc", - "desc": "Test viewing a sample Javadoc page" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_check_files.sh b/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_check_files.sh deleted file mode 100644 index f67e34d1960..00000000000 --- a/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_check_files.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-04-01 -# @License : Mulan PSL v2 -# @Desc : Check if key documentation files exist -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查关键文档文件是否存在" - - # 检查软件包是否已安装 - LOG_INFO "步骤1:检查ldapjdk-javadoc软件包是否已安装" - if rpm -q ldapjdk-javadoc &>/dev/null; then - LOG_INFO "ldapjdk-javadoc软件包已安装,标记为已安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "ldapjdk-javadoc软件包未安装,标记为未安装状态" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在软件包 - LOG_INFO "步骤2:检查yum源中是否存在ldapjdk-javadoc软件包" - if ! dnf list available ldapjdk-javadoc &>/dev/null; then - LOG_ERROR "yum源中未找到ldapjdk-javadoc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "步骤3:安装ldapjdk-javadoc软件包" - dnf install -y ldapjdk-javadoc - CHECK_RESULT $? 0 0 "安装ldapjdk-javadoc软件包失败" - fi - - # 检查关键文档文件是否存在 - LOG_INFO "步骤4:检查关键文档文件是否存在" - DOC_FILES="/usr/share/doc/ldapjdk-javadoc/README /usr/share/doc/ldapjdk-javadoc/LICENSE" - for file in $DOC_FILES; do - if [ -f "$file" ]; then - LOG_INFO "文件 $file 存在" - else - LOG_ERROR "文件 $file 不存在" - exit 1 - fi - done - - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "步骤5:卸载ldapjdk-javadoc软件包" - dnf remove -y ldapjdk-javadoc - CHECK_RESULT $? 0 0 "卸载ldapjdk-javadoc软件包失败" - fi - - LOG_INFO "测试完成:关键文档文件检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_query.sh b/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_query.sh deleted file mode 100644 index 95138df18b7..00000000000 --- a/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_query.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 : 2026-04-01 -# @License : Mulan PSL v2 -# @Desc : Test querying if the package is installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试: 查询软件包是否安装" - LOG_INFO "步骤1: 检查测试环境是否已安装ldapjdk-javadoc软件包" - rpm -q ldapjdk-javadoc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装ldapjdk-javadoc软件包,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "环境未安装ldapjdk-javadoc软件包,测试结束后将卸载" - INSTALLED_BEFORE_TEST=false - fi - - LOG_INFO "步骤2: 检查yum源中是否存在ldapjdk-javadoc软件包" - dnf list available ldapjdk-javadoc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到ldapjdk-javadoc软件包" - - LOG_INFO "步骤3: 执行查询命令,检查软件包是否安装" - rpm -q ldapjdk-javadoc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "查询软件包是否安装失败" - - LOG_INFO "步骤4: 如果测试前未安装,则安装软件包作为测试步骤" - if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then - LOG_INFO "正在安装ldapjdk-javadoc软件包..." - dnf install -y ldapjdk-javadoc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装ldapjdk-javadoc软件包失败" - fi - - LOG_INFO "步骤5: 再次执行查询命令,确认安装状态" - rpm -q ldapjdk-javadoc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "查询软件包是否安装失败" - - LOG_INFO "步骤6: 恢复测试环境" - if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then - LOG_INFO "正在卸载ldapjdk-javadoc软件包..." - dnf remove -y ldapjdk-javadoc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载ldapjdk-javadoc软件包失败" - else - LOG_INFO "测试前已安装,保持安装状态" - fi - - LOG_INFO "测试完成: 查询软件包是否安装" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_view_javadoc.sh b/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_view_javadoc.sh deleted file mode 100644 index 228236613b6..00000000000 --- a/testcases/function_test/pkg_test/ldapjdk/ldapjdk-javadoc/test_ldapjdk-javadoc_function_view_javadoc.sh +++ /dev/null @@ -1,94 +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-01 -# @License : Mulan PSL v2 -# @Desc : Test viewing a sample Javadoc page -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:查看示例Javadoc页面" - - # 定义软件包名称 - PACKAGE_NAME="ldapjdk-javadoc" - - # 检查yum源中是否存在指定的软件包 - LOG_INFO "检查yum源中是否存在软件包:$PACKAGE_NAME" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "yum源中不存在软件包:$PACKAGE_NAME" - exit 255 - fi - - # 检查是否已安装软件包 - LOG_INFO "检查是否已安装软件包:$PACKAGE_NAME" - if rpm -q "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "软件包已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "软件包未安装,开始安装" - INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装软件包:$PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 查找javadoc示例文件 - LOG_INFO "查找Javadoc示例文件" - JAVADOC_FILE=$(rpm -ql "$PACKAGE_NAME" | grep -E "\.html$" | head -1) - if [ -z "$JAVADOC_FILE" ]; then - LOG_ERROR "未找到Javadoc示例文件" - exit 255 - fi - - # 检查是否支持使用浏览器查看文件 - LOG_INFO "检查是否支持使用浏览器查看Javadoc文件" - if ! command -v xdg-open &>/dev/null && ! command -v firefox &>/dev/null && ! command -v google-chrome &>/dev/null; then - LOG_ERROR "不支持使用浏览器查看文件" - exit 255 - fi - - # 使用浏览器查看Javadoc示例页面 - LOG_INFO "使用浏览器查看Javadoc示例页面" - if command -v xdg-open &>/dev/null; then - xdg-open "$JAVADOC_FILE" & - elif command -v firefox &>/dev/null; then - firefox "$JAVADOC_FILE" & - elif command -v google-chrome &>/dev/null; then - google-chrome "$JAVADOC_FILE" & - fi - CHECK_RESULT $? 0 0 "查看Javadoc页面失败" - - # 等待一段时间,确保页面已打开 - LOG_INFO "等待页面加载" - sleep 5 - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载软件包:$PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "测试前已安装软件包,保持安装状态" - fi - - LOG_INFO "测试完成:成功查看示例Javadoc页面" -} - -main "$@" \ No newline at end of file From f7802eba298009b04d43fee6090a1bf1739937a6 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:08:23 +0800 Subject: [PATCH 19/25] update testcase for testsuite python-humanize-help --- .../python-humanize/python-humanize-help.json | 10 --- ...est_python-humanize-help_function_basic.sh | 74 ------------------- 2 files changed, 84 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/python-humanize/python-humanize-help.json delete mode 100644 testcases/function_test/pkg_test/python-humanize/python-humanize-help/test_python-humanize-help_function_basic.sh diff --git a/suite2cases/function_test/pkg_test/python-humanize/python-humanize-help.json b/suite2cases/function_test/pkg_test/python-humanize/python-humanize-help.json deleted file mode 100644 index 2560b9da784..00000000000 --- a/suite2cases/function_test/pkg_test/python-humanize/python-humanize-help.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-humanize/python-humanize-help", - "machine num": 1, - "cases": [ - { - "name": "test_python-humanize-help_function_basic", - "desc": "Test basic functionality of humanize-help" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-humanize/python-humanize-help/test_python-humanize-help_function_basic.sh b/testcases/function_test/pkg_test/python-humanize/python-humanize-help/test_python-humanize-help_function_basic.sh deleted file mode 100644 index 61743b8f9f4..00000000000 --- a/testcases/function_test/pkg_test/python-humanize/python-humanize-help/test_python-humanize-help_function_basic.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-12-06 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality of humanize-help -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python-humanize-help - LOG_INFO "检查是否已安装python-humanize-help" - dnf list installed python-humanize-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python-humanize-help已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "python-humanize-help未安装,将在测试后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python-humanize-help - LOG_INFO "检查yum源中是否有python-humanize-help" - dnf list available python-humanize-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python-humanize-help,退出码255" - exit 255 - fi - - # 安装python-humanize-help - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python-humanize-help" - dnf install -y python-humanize-help - CHECK_RESULT $? 0 0 "安装python-humanize-help失败" - fi - - # 测试humanize-help基本功能 - LOG_INFO "测试humanize-help基本功能" - humanize-help --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "humanize-help --help命令执行失败" - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数" - humanize-help --invalid-arg > /dev/null 2>&1 - if [ $? -ne 255 ]; then - LOG_ERROR "humanize-help不支持--invalid-arg参数,但未返回退出码255" - exit 255 - fi - - # 清理环境:如果脚本开始时未安装,则卸载python-humanize-help - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python-humanize-help" - dnf remove -y python-humanize-help - CHECK_RESULT $? 0 0 "卸载python-humanize-help失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file From 49e2b6484b7f6dc241dd767036f2071820df09ea Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:09:49 +0800 Subject: [PATCH 20/25] update testcase for testsuite systemtap-runtime-python3 --- .../pkg_test/systemtap/systemtap-runtime-python3.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/suite2cases/function_test/pkg_test/systemtap/systemtap-runtime-python3.json b/suite2cases/function_test/pkg_test/systemtap/systemtap-runtime-python3.json index ed9d81f71b0..86dce7d3f44 100644 --- a/suite2cases/function_test/pkg_test/systemtap/systemtap-runtime-python3.json +++ b/suite2cases/function_test/pkg_test/systemtap/systemtap-runtime-python3.json @@ -14,14 +14,6 @@ { "name": "test_systemtap-runtime-python3_function_uninstall", "desc": "测试systemtap-runtime-python3软件包的完全卸载与清理" - }, - { - "name": "test_systemtap-runtime-python3_function_script_exec", - "desc": "测试使用staprun执行预编译的SystemTap脚本" - }, - { - "name": "test_systemtap-runtime-python3_function_python_tapset", - "desc": "测试SystemTap对Python3进程的探测支持(如process(‘python3’).function等)" } ] } \ No newline at end of file From 3875284c169750bc4d18e1317748d8e804a7fb07 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:10:36 +0800 Subject: [PATCH 21/25] update testcase for testsuite texlive-simplecv --- .../texlive-split-v/texlive-simplecv.json | 10 --- .../test_texlive-simplecv_function_basic.sh | 63 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-v/texlive-simplecv.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-simplecv/test_texlive-simplecv_function_basic.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-simplecv.json b/suite2cases/function_test/pkg_test/texlive-split-v/texlive-simplecv.json deleted file mode 100644 index 6f4cd2aac71..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-simplecv.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-simplecv", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-simplecv_function_basic", - "desc": "Basic functionality test" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-simplecv/test_texlive-simplecv_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-simplecv/test_texlive-simplecv_function_basic.sh deleted file mode 100644 index 3aa0a062ae1..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-simplecv/test_texlive-simplecv_function_basic.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Basic functionality test -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-simplecv软件包 - LOG_INFO "检查是否已安装texlive-simplecv软件包" - rpm -q texlive-simplecv > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-simplecv已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-simplecv未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在texlive-simplecv软件包 - LOG_INFO "检查yum源中是否存在texlive-simplecv软件包" - dnf list available texlive-simplecv > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-simplecv软件包" - - # 安装texlive-simplecv软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装texlive-simplecv软件包" - dnf install -y texlive-simplecv - CHECK_RESULT $? 0 0 "安装texlive-simplecv失败" - fi - - # 测试texlive-simplecv基本功能 - LOG_INFO "测试texlive-simplecv基本功能" - texdoc simplecv > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-simplecv基本功能测试失败" - - # 清理环境:如果脚本开始时未安装,则卸载texlive-simplecv - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-simplecv软件包" - dnf remove -y texlive-simplecv - CHECK_RESULT $? 0 0 "卸载texlive-simplecv失败" - fi - - LOG_INFO "Basic functionality test完成" - -} - -main "$@" \ No newline at end of file From f4312cd81db66e70d993d61d89afde33131ccf70 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:10:58 +0800 Subject: [PATCH 22/25] update testcase for testsuite jdom-help --- .../pkg_test/jdom/jdom-help.json | 10 --- .../test_jdom-help_function_parse.sh | 66 ------------------- 2 files changed, 76 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/jdom/jdom-help.json delete mode 100644 testcases/function_test/pkg_test/jdom/jdom-help/test_jdom-help_function_parse.sh diff --git a/suite2cases/function_test/pkg_test/jdom/jdom-help.json b/suite2cases/function_test/pkg_test/jdom/jdom-help.json deleted file mode 100644 index 3aa30292401..00000000000 --- a/suite2cases/function_test/pkg_test/jdom/jdom-help.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/jdom/jdom-help", - "machine num": 1, - "cases": [ - { - "name": "test_jdom-help_function_parse", - "desc": "Test XML parsing functionality" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jdom/jdom-help/test_jdom-help_function_parse.sh b/testcases/function_test/pkg_test/jdom/jdom-help/test_jdom-help_function_parse.sh deleted file mode 100644 index 9ee0d799027..00000000000 --- a/testcases/function_test/pkg_test/jdom/jdom-help/test_jdom-help_function_parse.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-10 -# @License : Mulan PSL v2 -# @Desc : Test XML parsing functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查JDOM软件包是否已安装 - LOG_INFO "检查JDOM软件包是否已安装" - rpm -q jdom &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "JDOM软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "JDOM软件包未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在JDOM软件包 - LOG_INFO "检查yum源中是否存在JDOM软件包" - dnf list available jdom &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在JDOM软件包" - exit 255 - fi - - # 安装JDOM软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装JDOM软件包" - dnf install -y jdom - CHECK_RESULT $? 0 0 "安装JDOM软件包失败" - fi - - # 测试XML解析功能 - LOG_INFO "测试XML解析功能" - java -cp /usr/share/java/jdom.jar org.jdom2.test.cases.SampleTest &> /dev/null - CHECK_RESULT $? 0 0 "XML解析功能测试失败" - - # 清理环境:如果脚本开始时未安装JDOM,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载JDOM软件包" - dnf remove -y jdom &> /dev/null - CHECK_RESULT $? 0 0 "卸载JDOM软件包失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file From e07610c5625899d00712ce5e3918f8a68b94ef7a Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:13:43 +0800 Subject: [PATCH 23/25] update testcase for testsuite texlive-filedate --- .../texlive-split-i/texlive-filedate.json | 10 --- .../test_texlive-filedate_function_basic.sh | 72 ------------------- 2 files changed, 82 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-i/texlive-filedate.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-i/texlive-filedate/test_texlive-filedate_function_basic.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-i/texlive-filedate.json b/suite2cases/function_test/pkg_test/texlive-split-i/texlive-filedate.json deleted file mode 100644 index 5663ea2f480..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-i/texlive-filedate.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-i/texlive-filedate", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-filedate_function_basic", - "desc": "Test basic functionality of texlive-filedate" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-i/texlive-filedate/test_texlive-filedate_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-i/texlive-filedate/test_texlive-filedate_function_basic.sh deleted file mode 100644 index 04f5e651e9a..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-i/texlive-filedate/test_texlive-filedate_function_basic.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality of texlive-filedate -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic functionality of texlive-filedate" - - # 检查是否已安装texlive-filedate - LOG_INFO "检查是否已安装texlive-filedate" - if dnf list installed texlive-filedate &>/dev/null; then - LOG_INFO "texlive-filedate已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-filedate未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-filedate软件包 - LOG_INFO "检查yum源中是否有texlive-filedate软件包" - if ! dnf list available texlive-filedate &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-filedate软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-filedate - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装texlive-filedate" - dnf install -y texlive-filedate - CHECK_RESULT $? 0 0 "安装texlive-filedate失败" - fi - - # 测试基本功能 - LOG_INFO "测试texlive-filedate基本功能" - texlive-filedate --version - CHECK_RESULT $? 0 0 "获取texlive-filedate版本失败" - - # 检查不支持的参数 - LOG_INFO "检查不支持的参数" - texlive-filedate --invalid-option &>/dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "不支持的参数未返回预期退出码255" - exit 255 - fi - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-filedate" - dnf remove -y texlive-filedate - CHECK_RESULT $? 0 0 "卸载texlive-filedate失败" - fi - - LOG_INFO "测试完成:Test basic functionality of texlive-filedate" -} - -main "$@" \ No newline at end of file From 58aff20dfc98280680b3bd485e4e3e8f105271b5 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:16:23 +0800 Subject: [PATCH 24/25] update testcase for testsuite texlive-cmap-doc --- .../texlive-split-e/texlive-cmap-doc.json | 4 - ...st_texlive-cmap-doc_function_doc_access.sh | 80 ------------------- 2 files changed, 84 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc/test_texlive-cmap-doc_function_doc_access.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc.json b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc.json index d3eb943a546..359ba23a161 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc.json @@ -14,10 +14,6 @@ "name": "test_texlive-cmap-doc_function_check", "desc": "Check if package is installed" }, - { - "name": "test_texlive-cmap-doc_function_doc_access", - "desc": "Access and verify documentation" - }, { "name": "test_texlive-cmap-doc_function_version", "desc": "Check installed package version" diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc/test_texlive-cmap-doc_function_doc_access.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc/test_texlive-cmap-doc_function_doc_access.sh deleted file mode 100644 index 2dcb834cfe9..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-cmap-doc/test_texlive-cmap-doc_function_doc_access.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 : Access and verify documentation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Access and verify documentation" - - # 定义软件包名称 - PACKAGE_NAME="texlive-cmap-doc" - - # 检查是否已经安装软件包 - LOG_INFO "检查环境是否已安装 $PACKAGE_NAME" - if dnf list installed "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "环境已安装 $PACKAGE_NAME,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "环境未安装 $PACKAGE_NAME,将在测试过程中安装并最终卸载" - INSTALLED_BEFORE_TEST=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否存在 $PACKAGE_NAME" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - # 验证文档访问 - LOG_INFO "验证文档访问" - # 假设文档路径为 /usr/share/doc/texlive-cmap-doc/ - DOC_PATH="/usr/share/doc/texlive-cmap-doc/" - if [ -d "$DOC_PATH" ]; then - LOG_INFO "文档目录存在:$DOC_PATH" - # 检查目录中是否有文件 - if [ "$(ls -A "$DOC_PATH")" ]; then - LOG_INFO "文档目录中包含文件" - else - LOG_ERROR "文档目录为空" - CHECK_RESULT 1 0 0 "文档目录为空" - fi - else - LOG_ERROR "文档目录不存在:$DOC_PATH" - CHECK_RESULT 1 0 0 "文档目录不存在" - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成:Access and verify documentation" -} - -main "$@" \ No newline at end of file From 4b67384e8bdf53197694ef23205dd4e9f4583ece Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:16:42 +0800 Subject: [PATCH 25/25] update testcase for testsuite texlive-expkv --- .../texlive-split-y/texlive-expkv.json | 36 ---- .../texlive-expkv/test_texlive-expkv_basic.sh | 84 --------- .../test_texlive-expkv_default.sh | 123 ------------- .../texlive-expkv/test_texlive-expkv_env.sh | 73 -------- .../test_texlive-expkv_function_basic.sh | 66 ------- .../texlive-expkv/test_texlive-expkv_macro.sh | 95 ---------- .../test_texlive-expkv_nested.sh | 74 -------- .../test_texlive-expkv_optional.sh | 166 ------------------ .../test_texlive-expkv_required.sh | 76 -------- .../test_texlive-expkv_version.sh | 86 --------- 10 files changed, 879 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_basic.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_default.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_env.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_function_basic.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_macro.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_nested.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_optional.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_required.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_version.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-expkv.json b/suite2cases/function_test/pkg_test/texlive-split-y/texlive-expkv.json index 86f26fe2101..8c7aae97ffa 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-expkv.json +++ b/suite2cases/function_test/pkg_test/texlive-split-y/texlive-expkv.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv", "machine num": 1, "cases": [ - { - "name": "test_texlive-expkv_function_basic", - "desc": "Test basic expkv functionality" - }, { "name": "test_texlive-expkv_install", "desc": "Test installation of texlive-expkv package" @@ -13,38 +9,6 @@ { "name": "test_texlive-expkv_remove", "desc": "Test removal of texlive-expkv package" - }, - { - "name": "test_texlive-expkv_version", - "desc": "Test checking package version" - }, - { - "name": "test_texlive-expkv_basic", - "desc": "Test basic key-value parsing" - }, - { - "name": "test_texlive-expkv_nested", - "desc": "Test nested key-value usage" - }, - { - "name": "test_texlive-expkv_macro", - "desc": "Test macro definition with keys" - }, - { - "name": "test_texlive-expkv_env", - "desc": "Test environment key handling" - }, - { - "name": "test_texlive-expkv_default", - "desc": "Test default key values" - }, - { - "name": "test_texlive-expkv_required", - "desc": "Test required key validation" - }, - { - "name": "test_texlive-expkv_optional", - "desc": "Test optional key handling" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_basic.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_basic.sh deleted file mode 100644 index fceaa054cdc..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_basic.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-28 -# @License : Mulan PSL v2 -# @Desc : Test basic key-value parsing -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装texlive-expkv-basic - LOG_INFO "检查是否已安装texlive-expkv-basic" - rpm -q texlive-expkv-basic > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-expkv-basic已安装,脚本结束时将保持安装状态" - INSTALLED="yes" - else - LOG_INFO "texlive-expkv-basic未安装,将进行安装和测试" - INSTALLED="no" - fi - - # 检查yum源中是否有texlive-expkv-basic软件包 - LOG_INFO "检查yum源中是否有texlive-expkv-basic软件包" - dnf list available texlive-expkv-basic > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有texlive-expkv-basic软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有texlive-expkv-basic软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "安装texlive-expkv-basic软件包" - dnf install -y texlive-expkv-basic - CHECK_RESULT $? 0 0 "安装texlive-expkv-basic软件包失败" - fi - - # 测试基本键值解析功能 - LOG_INFO "测试基本键值解析功能" - # 这里假设texlive-expkv-basic包含一个可执行文件或命令,例如expkv-basic - # 如果实际软件包没有,需要根据实际情况调整 - command -v expkv-basic > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "执行expkv-basic命令测试键值解析" - expkv-basic --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "expkv-basic命令执行失败" - # 如果命令有特定参数,可以在这里测试 - # 例如:expkv-basic --version - # 如果参数不存在或不支持,根据要求退出码为255 - expkv-basic --version > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "expkv-basic命令不支持--version参数" - exit 255 - fi - else - LOG_INFO "texlive-expkv-basic没有可执行命令,测试其文件是否存在" - # 检查软件包安装的文件 - rpm -ql texlive-expkv-basic | head -5 - CHECK_RESULT $? 0 0 "texlive-expkv-basic文件列表获取失败" - fi - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "卸载texlive-expkv-basic软件包" - dnf remove -y texlive-expkv-basic - CHECK_RESULT $? 0 0 "卸载texlive-expkv-basic软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_default.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_default.sh deleted file mode 100644 index 8d1a139f7d2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_default.sh +++ /dev/null @@ -1,123 +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-28 -# @License : Mulan PSL v2 -# @Desc : Test default key values -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色代码 - RED="\033[0;31m" - GREEN="\033[0;32m" - YELLOW="\033[0;33m" - NC="\033[0m" # No Color - - # 定义日志函数 - LOG_INFO() { - echo -e "${GREEN}[INFO]${NC} $1" - } - - LOG_ERROR() { - echo -e "${RED}[ERROR]${NC} $1" - } - - # 定义检查函数 - CHECK_RESULT() { - local actual=$1 - local expected=$2 - local error_code=$3 - local message=$4 - - if [ $actual -ne $expected ]; then - LOG_ERROR "$message" - exit $error_code - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - - sshpass -p "$password" ssh -o StrictHostKeyChecking=no "$user@$ip" "$cmd" - return $? - } - - # 定义软件包名称 - PACKAGE_NAME="texlive-expkv-default" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "检查软件包是否在yum源中" - dnf list available "$PACKAGE_NAME" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中" - exit 255 - fi - - # 步骤2:检查当前是否已安装 - LOG_INFO "检查当前是否已安装 $PACKAGE_NAME" - INSTALLED=0 - rpm -q "$PACKAGE_NAME" &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - INSTALLED=1 - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装软件包 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4:测试默认键值 - LOG_INFO "测试默认键值" - # 这里假设texlive-expkv-default提供了某个命令来测试默认键值 - # 由于不知道具体命令,这里使用一个示例命令 - test_command="kpsewhich expkv-default.tex" - $test_command - CHECK_RESULT $? 0 0 "测试默认键值失败" - - # 步骤5:测试命令参数(示例) - LOG_INFO "测试命令参数" - # 假设texlive-expkv-default有一个命令叫texlive-expkv-test,支持参数--version - test_param_command="texlive-expkv-test --version" - if command -v texlive-expkv-test &>/dev/null; then - $test_param_command - CHECK_RESULT $? 0 0 "命令参数测试失败" - else - LOG_INFO "命令 texlive-expkv-test 不存在,跳过参数测试" - fi - - # 步骤6:清理环境 - LOG_INFO "清理环境" - if [ $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-y/texlive-expkv/test_texlive-expkv_env.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_env.sh deleted file mode 100644 index 7feb64f42a5..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_env.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-28 -# @License : Mulan PSL v2 -# @Desc : Test environment key handling -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试环境键处理功能" - - # 检查是否已安装texlive-expkv-env - LOG_INFO "步骤1:检查texlive-expkv-env是否已安装" - if dnf list installed texlive-expkv-env &>/dev/null; then - LOG_INFO "texlive-expkv-env已安装,测试后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "texlive-expkv-env未安装,将在测试后卸载" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否存在texlive-expkv-env软件包" - if ! dnf search texlive-expkv-env 2>/dev/null | grep -q "texlive-expkv-env"; then - LOG_ERROR "yum源中未找到texlive-expkv-env软件包" - exit 255 - fi - - # 安装软件包(如果未安装) - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-expkv-env软件包" - dnf install -y texlive-expkv-env - CHECK_RESULT $? 0 0 "安装texlive-expkv-env失败" - fi - - # 测试环境键处理功能 - LOG_INFO "步骤4:测试环境键处理功能" - # 这里假设有一个命令或操作来测试环境键处理,例如使用特定命令 - # 假设测试命令为:expkv-env-test - if command -v expkv-env-test &>/dev/null; then - expkv-env-test --check - CHECK_RESULT $? 0 0 "环境键处理功能测试失败" - else - LOG_ERROR "测试命令expkv-env-test不存在或不支持" - exit 255 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤5:卸载texlive-expkv-env软件包" - dnf remove -y texlive-expkv-env - CHECK_RESULT $? 0 0 "卸载texlive-expkv-env失败" - else - LOG_INFO "步骤5:保持texlive-expkv-env安装状态" - fi - - LOG_INFO "测试环境键处理功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_function_basic.sh deleted file mode 100644 index 8d3d88e58d1..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_function_basic.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test basic expkv functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-expkv - LOG_INFO "检查是否已安装texlive-expkv" - rpm -q texlive-expkv > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-expkv已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-expkv未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-expkv - LOG_INFO "检查yum源中是否有texlive-expkv" - dnf list available texlive-expkv > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-expkv,退出" - exit 255 - fi - - # 安装texlive-expkv - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装texlive-expkv" - dnf install -y texlive-expkv - CHECK_RESULT $? 0 0 "安装texlive-expkv失败" - fi - - # 测试expkv基本功能 - LOG_INFO "测试expkv基本功能" - texlua -e "require("expkv")" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "expkv基本功能测试失败" - - # 清理环境:如果之前未安装,则卸载texlive-expkv - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-expkv" - dnf remove -y texlive-expkv - CHECK_RESULT $? 0 0 "卸载texlive-expkv失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_macro.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_macro.sh deleted file mode 100644 index 52bfab9c794..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_macro.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 : 2026-03-28 -# @License : Mulan PSL v2 -# @Desc : Test macro definition with keys -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 初始化变量 - PACKAGE_NAME="texlive-expkv_macro" - INSTALLED_FLAG=false - - # 检查是否已安装 - LOG_INFO "检查是否已安装 $PACKAGE_NAME" - if rpm -q $PACKAGE_NAME &> /dev/null; then - LOG_INFO "$PACKAGE_NAME 已安装" - INSTALLED_FLAG=true - else - LOG_INFO "$PACKAGE_NAME 未安装" - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有 $PACKAGE_NAME" - if ! dnf list available $PACKAGE_NAME &> /dev/null; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME" - exit 255 - fi - - # 如果未安装,则安装 - if ! $INSTALLED_FLAG; then - LOG_INFO "安装 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - # 测试宏定义功能 - LOG_INFO "测试 expkv 宏定义功能" - cat > test_macro.tex << "EOF" - \documentclass{article} - \usepackage{expkv-def} - \ekvdefinekeys{mykeys}{ - store foo = \myfoo - ,store bar = \mybar - } - \ekvset{mykeys}{foo=hello,bar=world} - \begin{document} - \myfoo \mybar - \end{document} - EOF - - # 编译测试文档 - LOG_INFO "编译测试文档" - pdflatex -interaction=nonstopmode test_macro.tex - CHECK_RESULT $? 0 0 "编译测试文档失败" - - # 检查输出文件 - LOG_INFO "检查输出文件" - if [ -f test_macro.pdf ]; then - LOG_INFO "测试文档编译成功" - else - LOG_ERROR "测试文档编译失败" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_macro.tex test_macro.pdf test_macro.aux test_macro.log - - # 如果脚本开始时未安装,则卸载软件包 - if ! $INSTALLED_FLAG; then - LOG_INFO "卸载 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_nested.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_nested.sh deleted file mode 100644 index 9e91634b6f7..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_nested.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-03-28 -# @License : Mulan PSL v2 -# @Desc : Test nested key-value usage -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:Test nested key-value usage" - - # 检查软件包是否存在 - LOG_INFO "步骤1:检查texlive-expkv-nested软件包是否在yum源中" - if ! dnf list texlive-expkv-nested &>/dev/null; then - LOG_ERROR "texlive-expkv-nested软件包不在yum源中" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "步骤2:检查texlive-expkv-nested是否已安装" - if rpm -q texlive-expkv-nested &>/dev/null; then - LOG_INFO "texlive-expkv-nested已安装,测试结束后将保持安装状态" - already_installed=1 - else - LOG_INFO "texlive-expkv-nested未安装,将在测试过程中安装" - already_installed=0 - fi - - # 如果未安装,则安装软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-expkv-nested软件包" - dnf install -y texlive-expkv-nested - CHECK_RESULT $? 0 0 "安装texlive-expkv-nested失败" - fi - - # 测试嵌套键值使用 - LOG_INFO "步骤4:测试嵌套键值使用功能" - # 这里假设有一个命令或脚本来测试嵌套键值功能 - # 例如:运行一个测试命令或检查相关文件 - # 由于具体测试内容未指定,这里使用一个示例检查 - if command -v kpsewhich &>/dev/null; then - kpsewhich expkv-nested.sty - CHECK_RESULT $? 0 0 "未找到expkv-nested.sty文件" - else - LOG_ERROR "kpsewhich命令不存在,无法测试嵌套键值功能" - exit 255 - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤5:卸载texlive-expkv-nested软件包" - dnf remove -y texlive-expkv-nested - CHECK_RESULT $? 0 0 "卸载texlive-expkv-nested失败" - fi - - LOG_INFO "测试完成:Test nested key-value usage" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_optional.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_optional.sh deleted file mode 100644 index 2453e73d9ab..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_optional.sh +++ /dev/null @@ -1,166 +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-28 -# @License : Mulan PSL v2 -# @Desc : Test optional key handling -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色和日志函数 - LOG_INFO() { - echo -e "\033[32m[INFO]\033[0m $1" - } - - LOG_ERROR() { - echo -e "\033[31m[ERROR]\033[0m $1" - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package_name=$1 - dnf list available "$package_name" &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $package_name 不在yum源中" - exit 255 - fi - } - - # 检查命令参数是否支持 - check_command_option() { - local command=$1 - local option=$2 - $command --help 2>&1 | grep -q "$option" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $command 不支持参数 $option" - exit 255 - fi - } - - # 检查命令执行结果 - check_command_result() { - local result=$1 - local command_name=$2 - if [ $result -ne 0 ]; then - LOG_ERROR "命令 $command_name 执行失败" - exit $result - fi - } - - # 检查是否已安装 - check_installed() { - rpm -q texlive-expkv-optional &> /dev/null - return $? - } - - # 安装软件包 - install_package() { - local package_name=$1 - LOG_INFO "安装软件包 $package_name" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败" - } - - # 卸载软件包 - uninstall_package() { - local package_name=$1 - LOG_INFO "卸载软件包 $package_name" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败" - } - - # 主测试函数 - test_optional_key_handling() { - LOG_INFO "开始测试: Test optional key handling" - - # 检查软件包是否在yum源中 - LOG_INFO "检查texlive-expkv-optional是否在yum源中" - check_package_in_repo texlive-expkv-optional - - # 检查当前是否已安装 - LOG_INFO "检查texlive-expkv-optional是否已安装" - local was_installed=false - if check_installed; then - LOG_INFO "texlive-expkv-optional 已安装,测试结束后保持安装状态" - was_installed=true - else - LOG_INFO "texlive-expkv-optional 未安装,将在测试前安装" - fi - - # 如果未安装,则安装 - if ! $was_installed; then - install_package texlive-expkv-optional - fi - - # 测试命令参数 - LOG_INFO "测试tex命令是否支持--help参数" - check_command_option tex --help - - # 执行测试命令 - LOG_INFO "执行测试命令: tex --help" - tex --help - check_command_result $? "tex --help" - - LOG_INFO "测试tex命令是否支持--version参数" - check_command_option tex --version - - LOG_INFO "执行测试命令: tex --version" - tex --version - check_command_result $? "tex --version" - - # 测试expkv-optional功能 - LOG_INFO "测试expkv-optional基本功能" - cat > test_optional.tex << "EOF" - \documentclass{article} - \usepackage{expkv-optional} - \begin{document} - Test document for expkv-optional package. - \end{document} - EOF - - LOG_INFO "编译测试文档" - pdflatex test_optional.tex - CHECK_RESULT $? 0 0 "编译测试文档失败" - - # 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f "test_optional.pdf" ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_optional.tex test_optional.pdf test_optional.aux test_optional.log test_optional.out - - # 如果之前未安装,则卸载软件包 - if ! $was_installed; then - LOG_INFO "测试完成,卸载texlive-expkv-optional" - uninstall_package texlive-expkv-optional - else - LOG_INFO "测试完成,保持texlive-expkv-optional安装状态" - fi - - LOG_INFO "测试完成: Test optional key handling" - } - - # 执行测试 - test_optional_key_handling -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_required.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_required.sh deleted file mode 100644 index e7a11d1525b..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_required.sh +++ /dev/null @@ -1,76 +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-28 -# @License : Mulan PSL v2 -# @Desc : Test required key validation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test required key validation" - - # 检查环境是否已安装 texlive-expkv-required 软件包 - LOG_INFO "步骤1:检查 texlive-expkv-required 是否已安装" - rpm -q texlive-expkv-required - if [ $? -eq 0 ]; then - LOG_INFO "texlive-expkv-required 已安装,测试结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-expkv-required 未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查 yum 源中是否存在 texlive-expkv-required 软件包 - LOG_INFO "步骤2:检查 yum 源中是否存在 texlive-expkv-required 软件包" - dnf list available texlive-expkv-required - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 texlive-expkv-required 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装 texlive-expkv-required 软件包" - dnf install -y texlive-expkv-required - CHECK_RESULT $? 0 0 "安装 texlive-expkv-required 失败" - fi - - # 测试 required key validation 功能 - LOG_INFO "步骤4:测试 required key validation 功能" - # 这里假设 texlive-expkv-required 提供了一个命令或工具来验证 required key - # 例如,使用一个假设的命令:expkv-required-test - expkv-required-test --help - if [ $? -ne 0 ]; then - LOG_ERROR "expkv-required-test 命令不存在或不支持" - exit 255 - fi - - # 执行具体的测试命令,这里以假设的命令为例 - LOG_INFO "步骤5:执行 required key validation 测试" - expkv-required-test --validate - CHECK_RESULT $? 0 0 "required key validation 测试失败" - - # 如果测试开始时未安装软件包,则在测试结束后卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤6:卸载 texlive-expkv-required 软件包" - dnf remove -y texlive-expkv-required - CHECK_RESULT $? 0 0 "卸载 texlive-expkv-required 失败" - fi - - LOG_INFO "测试完成:Test required key validation" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_version.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_version.sh deleted file mode 100644 index 46aec5f804f..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-expkv/test_texlive-expkv_version.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-03-28 -# @License : Mulan PSL v2 -# @Desc : Test checking package version -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试包版本检查 - - LOG_INFO "开始测试:检查包版本" - - # 检查系统是否已安装texlive-expkv版本包 - LOG_INFO "检查texlive-expkv版本包是否已安装" - dnf list installed texlive-expkv-version 2>/dev/null - is_installed=$? - - if [ $is_installed -eq 0 ]; then - LOG_INFO "texlive-expkv版本包已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "texlive-expkv版本包未安装,将在测试中安装并在结束后卸载" - already_installed=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有texlive-expkv版本包" - dnf search texlive-expkv-version 2>/dev/null | grep -q "texlive-expkv-version" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-expkv版本包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "安装texlive-expkv版本包" - dnf install -y texlive-expkv-version - CHECK_RESULT $? 0 0 "安装texlive-expkv版本包失败" - fi - - # 测试检查包版本功能 - LOG_INFO "测试检查texlive-expkv版本包版本信息" - rpm -q texlive-expkv-version --queryformat="%{VERSION}-%{RELEASE}\n" - CHECK_RESULT $? 0 0 "获取texlive-expkv版本包版本信息失败" - - # 测试dnf info命令 - LOG_INFO "使用dnf info命令查看texlive-expkv版本包信息" - dnf info texlive-expkv-version | grep -q "Name" - CHECK_RESULT $? 0 0 "dnf info命令执行失败" - - # 测试不存在的参数 - LOG_INFO "测试不存在的参数" - texlive-expkv-version --nonexistent-param 2>/dev/null - if [ $? -ne 255 ] && [ $? -ne 0 ]; then - LOG_ERROR "不存在的参数未正确处理" - exit 255 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "清理环境:卸载texlive-expkv版本包" - dnf remove -y texlive-expkv-version - CHECK_RESULT $? 0 0 "卸载texlive-expkv版本包失败" - LOG_INFO "环境已恢复:texlive-expkv版本包已卸载" - else - LOG_INFO "环境保持:texlive-expkv版本包保持安装状态" - fi - - LOG_INFO "测试完成:检查包版本测试通过" -} - -main "$@" \ No newline at end of file