From fc4e96a520a780aefa3e28cfe975aa3390ebce95 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:37:54 +0800 Subject: [PATCH 01/25] update testcase for testsuite python-reno-help --- .../python-reno/python-reno-help.json | 10 -- .../test_python-reno-help_function_init.sh | 93 ------------------- 2 files changed, 103 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/python-reno/python-reno-help.json delete mode 100644 testcases/function_test/pkg_test/python-reno/python-reno-help/test_python-reno-help_function_init.sh diff --git a/suite2cases/function_test/pkg_test/python-reno/python-reno-help.json b/suite2cases/function_test/pkg_test/python-reno/python-reno-help.json deleted file mode 100644 index de73cd93423..00000000000 --- a/suite2cases/function_test/pkg_test/python-reno/python-reno-help.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-reno/python-reno-help", - "machine num": 1, - "cases": [ - { - "name": "test_python-reno-help_function_init", - "desc": "Test initialization" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reno/python-reno-help/test_python-reno-help_function_init.sh b/testcases/function_test/pkg_test/python-reno/python-reno-help/test_python-reno-help_function_init.sh deleted file mode 100644 index a88bbd3984f..00000000000 --- a/testcases/function_test/pkg_test/python-reno/python-reno-help/test_python-reno-help_function_init.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 : 2025-12-09 -# @License : Mulan PSL v2 -# @Desc : Test initialization -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查软件包是否已安装 - check_package_installed() { - if dnf list installed "$1" &>/dev/null; then - LOG_INFO "软件包 $1 已安装" - return 0 - else - LOG_INFO "软件包 $1 未安装" - return 1 - fi - } - - # 检查软件包是否在yum源中 - check_package_available() { - if dnf list available "$1" &>/dev/null; then - LOG_INFO "软件包 $1 在yum源中可用" - return 0 - else - LOG_ERROR "软件包 $1 不在yum源中" - exit 255 - fi - } - - # 安装软件包 - install_package() { - LOG_INFO "开始安装软件包 $1" - dnf install -y "$1" - CHECK_RESULT $? 0 0 "安装软件包 $1 失败" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "开始卸载软件包 $1" - dnf remove -y "$1" - CHECK_RESULT $? 0 0 "卸载软件包 $1 失败" - } - - # Test initialization - LOG_INFO "开始执行测试脚本:test_python-reno-help_function_init" - - # Step 1: Check if the package is installed - PACKAGE_NAME="python-reno" - if check_package_installed "$PACKAGE_NAME"; then - INSTALLED=true - else - INSTALLED=false - fi - - # Step 2: Check if the package is available in the yum source - check_package_available "$PACKAGE_NAME" - - # Step 3: Install the package if not installed, otherwise skip - if [ "$INSTALLED" = false ]; then - install_package "$PACKAGE_NAME" - fi - - # Step4: Execute the command to test initialization functionality and check parameters - LOG_INFO "测试初始化功能" - python -m reno --help &>/dev/null - - CHECK_RESULT $? 0 255 "参数不支持或命令执行失败" - - # Step5: Clean up environment based on initial state - if [ "$INSTALLED" = false ]; then - uninstall_package "$PACKAGE_NAME" - - LOG_INFO "测试脚本执行完成,环境已恢复初始状态" - -} - -main "$@" \ No newline at end of file From bedf9cbe1b5b7cce27ae65d011c70faae68cc046 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:38:03 +0800 Subject: [PATCH 02/25] update testcase for testsuite texlive-droid-doc --- .../texlive-split-g/texlive-droid-doc.json | 10 --- ...test_texlive-droid-doc_function_install.sh | 63 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-g/texlive-droid-doc.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-droid-doc/test_texlive-droid-doc_function_install.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-g/texlive-droid-doc.json b/suite2cases/function_test/pkg_test/texlive-split-g/texlive-droid-doc.json deleted file mode 100644 index 17749344398..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-g/texlive-droid-doc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-g/texlive-droid-doc", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-droid-doc_function_install", - "desc": "Test installation of texlive-droid-doc package" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-droid-doc/test_texlive-droid-doc_function_install.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-droid-doc/test_texlive-droid-doc_function_install.sh deleted file mode 100644 index 8ee6ee331bd..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-droid-doc/test_texlive-droid-doc_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-09 -# @License : Mulan PSL v2 -# @Desc : Test installation of texlive-droid-doc package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查texlive-droid-doc是否已安装 - LOG_INFO "检查texlive-droid-doc是否已安装" - rpm -q texlive-droid-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-droid-doc已安装,跳过安装步骤" - installed=true - else - installed=false - fi - - # 检查yum源中是否存在texlive-droid-doc - LOG_INFO "检查yum源中是否存在texlive-droid-doc" - dnf list available texlive-droid-doc > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-droid-doc" - exit 255 - fi - - # 安装texlive-droid-doc(如果未安装) - if [ "$installed" = false ]; then - LOG_INFO "开始安装texlive-droid-doc" - dnf install -y texlive-droid-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-droid-doc失败" - LOG_INFO "texlive-droid-doc安装成功" - fi - - # 验证texlive-droid-doc功能(示例命令,需根据实际功能调整) - LOG_INFO "验证texlive-fira-sans功能" - some_validation_command > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证texlive-fira-sans功能失败" - - # 清理环境(如果之前未安装) - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-fira-sans" - dnf remove -y texlive-fira-sans > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-fira-sans失败" - LOG_INFO "texlive-fira-sans卸载成功" - fi -} - -main "$@" \ No newline at end of file From e08d1dc48bd147b5cc9d70120682e881de5f7a74 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:43:30 +0800 Subject: [PATCH 03/25] update testcase for testsuite python3-kaitaistruct --- .../python3-kaitaistruct.json | 12 -- ...thon3-kaitaistruct_function_attr_access.sh | 160 ------------------ ...thon3-kaitaistruct_function_parse_basic.sh | 110 ------------ ...python3-kaitaistruct_function_uninstall.sh | 149 ---------------- 4 files changed, 431 deletions(-) delete mode 100644 testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_attr_access.sh delete mode 100644 testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_parse_basic.sh delete mode 100644 testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct.json b/suite2cases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct.json index 60f9e8146cd..f23a950d664 100644 --- a/suite2cases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct.json +++ b/suite2cases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct.json @@ -9,18 +9,6 @@ { "name": "test_python3-kaitaistruct_function_import", "desc": "测试在Python环境中能够成功导入kaitaistruct模块" - }, - { - "name": "test_python3-kaitaistruct_function_parse_basic", - "desc": "测试使用kaitaistruct解析一个简单的自定义二进制结构" - }, - { - "name": "test_python3-kaitaistruct_function_attr_access", - "desc": "测试解析后能够正确访问结构体中的字段属性" - }, - { - "name": "test_python3-kaitaistruct_function_uninstall", - "desc": "测试通过包管理器(如apt)成功卸载python3-kaitaistruct软件包" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_attr_access.sh b/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_attr_access.sh deleted file mode 100644 index 1159c06698c..00000000000 --- a/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_attr_access.sh +++ /dev/null @@ -1,160 +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 : 测试解析后能够正确访问结构体中的字段属性 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义测试软件包名称 - PACKAGE_NAME="python3-kaitaistruct" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查软件包是否在yum源中" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中" - exit 255 - fi - - # 步骤2: 检查当前环境是否已安装软件包 - LOG_INFO "步骤2: 检查当前环境是否已安装软件包" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; 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: 验证kaitai-struct命令是否存在 - LOG_INFO "步骤4: 验证kaitai-struct命令是否存在" - command -v kaitai-struct-compiler &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "kaitai-struct-compiler命令不存在" - exit 255 - fi - - # 步骤5: 检查kaitai-struct命令是否支持--version参数 - LOG_INFO "步骤5: 检查kaitai-struct命令是否支持--version参数" - kaitai-struct-compiler --version &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "kaitai-struct-compiler命令不支持--version参数" - exit 255 - fi - - # 步骤6: 创建测试用的KSY文件 - LOG_INFO "步骤6: 创建测试用的KSY文件" - cat > test_struct.ksy << "EOF" - meta: - id: test_struct - file-extension: test - seq: - - id: field1 - type: u1 - - id: field2 - type: u2 - - id: field3 - type: s4 - EOF - CHECK_RESULT $? 0 0 "创建KSY文件失败" - - # 步骤7: 编译KSY文件生成Python解析代码 - LOG_INFO "步骤7: 编译KSY文件生成Python解析代码" - kaitai-struct-compiler -t python test_struct.ksy - CHECK_RESULT $? 0 0 "编译KSY文件失败" - - # 步骤8: 创建测试用的二进制数据文件 - LOG_INFO "步骤8: 创建测试用的二进制数据文件" - echo -n -e "\x01\x00\x02\x00\x00\x00\x03" > test_data.bin - CHECK_RESULT $? 0 0 "创建测试数据文件失败" - - # 步骤9: 创建Python测试脚本 - LOG_INFO "步骤9: 创建Python测试脚本" - cat > test_access.py << "EOF" - #!/usr/bin/env python3 - import test_struct - - with open("test_data.bin", "rb") as f: - data = f.read() - - # 解析二进制数据 - parsed = test_struct.TestStruct.from_bytes(data) - - # 测试访问结构体字段属性 - try: - # 访问field1属性 - field1_value = parsed.field1 - print(f"field1: {field1_value}") - - # 访问field2属性 - field2_value = parsed.field2 - print(f"field2: {field2_value}") - - # 访问field3属性 - field3_value = parsed.field3 - print(f"field3: {field3_value}") - - # 验证字段值是否符合预期 - if field1_value == 1 and field2_value == 2 and field3_value == 3: - print("SUCCESS: 所有字段属性访问正确") - exit(0) - else: - print(f"FAILED: 字段值不符合预期") - print(f" field1期望1, 实际{field1_value}") - print(f" field2期望2, 实际{field2_value}") - print(f" field3期望3, 实际{field3_value}") - exit(1) - - except AttributeError as e: - print(f"FAILED: 无法访问结构体字段属性: {e}") - exit(1) - except Exception as e: - print(f"FAILED: 解析过程中发生错误: {e}") - exit(1) - EOF - CHECK_RESULT $? 0 0 "创建Python测试脚本失败" - - # 步骤10: 执行Python测试脚本 - LOG_INFO "步骤10: 执行Python测试脚本,验证结构体字段属性访问" - python3 test_access.py - CHECK_RESULT $? 0 0 "Python测试脚本执行失败,无法正确访问结构体字段属性" - - # 步骤11: 清理测试文件 - LOG_INFO "步骤11: 清理测试文件" - rm -f test_struct.ksy test_struct.py test_data.bin test_access.py - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤12: 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤12: 卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成:成功验证python3-kaitaistruct解析后能够正确访问结构体中的字段属性" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_parse_basic.sh b/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_parse_basic.sh deleted file mode 100644 index a58b0e32915..00000000000 --- a/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_parse_basic.sh +++ /dev/null @@ -1,110 +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 : 测试使用kaitaistruct解析一个简单的自定义二进制结构 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:使用kaitaistruct解析一个简单的自定义二进制结构" - - # 检查是否已安装python3-kaitaistruct - LOG_INFO "检查python3-kaitaistruct是否已安装" - if rpm -q python3-kaitaistruct >/dev/null 2>&1; then - already_installed=true - LOG_INFO "python3-kaitaistruct已安装,测试完成后将保持安装状态" - else - already_installed=false - LOG_INFO "python3-kaitaistruct未安装,将在测试过程中安装" - fi - - # 检查yum源中是否有python3-kaitaistruct - LOG_INFO "检查yum源中是否有python3-kaitaistruct包" - if ! dnf list python3-kaitaistruct >/dev/null 2>&1; then - LOG_ERROR "yum源中没有python3-kaitaistruct包" - exit 255 - fi - - # 如果未安装,则安装python3-kaitaistruct - if [ "$already_installed" = false ]; then - LOG_INFO "安装python3-kaitaistruct" - dnf install -y python3-kaitaistruct - CHECK_RESULT $? 0 0 "安装python3-kaitaistruct失败" - fi - - # 创建测试用的Python脚本 - LOG_INFO "创建测试用的Python脚本" - cat > test_kaitai.py << "EOF" - #!/usr/bin/env python3 - import kaitaistruct - from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO - - class SimpleStruct(KaitaiStruct): - def __init__(self, _io, _parent=None, _root=None): - self._io = _io - self._parent = _parent - self._root = _root if _root else self - self._read() - - def _read(self): - self.magic = self._io.read_bytes(4) - self.length = self._io.read_u4le() - self.data = self._io.read_bytes(self.length) - - # 创建测试数据 - test_data = b"KAI\x00" + b"\x04\x00\x00\x00" + b"test" - stream = KaitaiStream(BytesIO(test_data)) - parsed = SimpleStruct(stream) - - print(f"Magic: {parsed.magic}") - print(f"Length: {parsed.length}") - print(f"Data: {parsed.data}") - - # 验证解析结果 - assert parsed.magic == b"KAI\x00", f"Magic mismatch: {parsed.magic}" - assert parsed.length == 4, f"Length mismatch: {parsed.length}" - assert parsed.data == b"test", f"Data mismatch: {parsed.data}" - print("解析成功!") - EOF - - CHECK_RESULT $? 0 0 "创建Python脚本失败" - - # 执行测试脚本 - LOG_INFO "执行测试脚本,验证kaitaistruct解析功能" - python3 test_kaitai.py - CHECK_RESULT $? 0 0 "kaitaistruct解析测试失败" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f test_kaitai.py - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果测试前未安装,则卸载python3-kaitaistruct - if [ "$already_installed" = false ]; then - LOG_INFO "卸载python3-kaitaistruct" - dnf remove -y python3-kaitaistruct - CHECK_RESULT $? 0 0 "卸载python3-kaitaistruct失败" - else - LOG_INFO "保持python3-kaitaistruct安装状态" - fi - - LOG_INFO "测试完成:使用kaitaistruct解析一个简单的自定义二进制结构" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_uninstall.sh b/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_uninstall.sh deleted file mode 100644 index 301d8b79f69..00000000000 --- a/testcases/function_test/pkg_test/python-kaitaistruct/python3-kaitaistruct/test_python3-kaitaistruct_function_uninstall.sh +++ /dev/null @@ -1,149 +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 : 测试通过包管理器(如apt)成功卸载python3-kaitaistruct软件包 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色变量(用于日志输出) - RED="\033[1;31m" - GREEN="\033[1;32m" - YELLOW="\033[1;33m" - BLUE="\033[1;34m" - NC="\033[0m" - - # 定义日志函数 - LOG_INFO() { - echo -e "${GREEN}[INFO]${NC} $1" - } - - LOG_ERROR() { - echo -e "${RED}[ERROR]${NC} $1" - } - - # 定义检查结果函数 - CHECK_RESULT() { - if [ $# -lt 4 ]; then - LOG_ERROR "CHECK_RESULT 参数不足" - exit 255 - fi - local actual=$1 - local expect=$2 - local mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -eq $expect ]; then - LOG_INFO "$message 成功" - return 0 - else - LOG_ERROR "$message 失败 (实际: $actual, 期望: $expect)" - exit $actual - fi - else - if [ $actual -ne $expect ]; then - LOG_INFO "$message 成功" - return 0 - else - LOG_ERROR "$message 失败 (实际: $actual, 期望: 非 $expect)" - exit $actual - fi - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - if [ $# -lt 4 ]; then - LOG_ERROR "SSH_CMD 参数不足" - exit 255 - fi - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - sshpass -p "$password" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$user@$ip" "$cmd" - } - - # 主测试函数 - main() { - local package_name="python3-kaitaistruct" - local installed_before_test=false - - LOG_INFO "开始测试卸载 $package_name 软件包" - - # 步骤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 - LOG_INFO "$package_name 在yum源中存在" - - # 步骤2:检查当前是否已安装该软件包 - LOG_INFO "步骤2:检查当前是否已安装 $package_name 软件包" - rpm -q $package_name &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "$package_name 已安装" - installed_before_test=true - else - LOG_INFO "$package_name 未安装" - installed_before_test=false - fi - - # 步骤3:如果未安装,则先安装软件包 - if [ "$installed_before_test" = false ]; then - LOG_INFO "步骤3:安装 $package_name 软件包" - dnf install -y $package_name - CHECK_RESULT $? 0 0 "安装 $package_name" - else - LOG_INFO "步骤3:跳过安装(软件包已存在)" - fi - - # 步骤4:验证软件包已安装 - LOG_INFO "步骤4:验证 $package_name 软件包已安装" - rpm -q $package_name - CHECK_RESULT $? 0 0 "验证 $package_name 安装状态" - - # 步骤5:卸载软件包 - LOG_INFO "步骤5:卸载 $package_name 软件包" - dnf remove -y $package_name - CHECK_RESULT $? 0 0 "卸载 $package_name" - - # 步骤6:验证软件包已卸载 - LOG_INFO "步骤6:验证 $package_name 软件包已卸载" - rpm -q $package_name - CHECK_RESULT $? 1 1 "验证 $package_name 卸载状态" - - # 步骤7:环境恢复 - LOG_INFO "步骤7:环境恢复" - if [ "$installed_before_test" = true ]; then - LOG_INFO "恢复原始状态:重新安装 $package_name" - dnf install -y $package_name - CHECK_RESULT $? 0 0 "重新安装 $package_name" - else - LOG_INFO "保持环境为卸载状态" - fi - - LOG_INFO "测试完成:成功通过包管理器卸载 $package_name 软件包" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file From efe85f1858912778521f45a39662d25a0665f528 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:47:44 +0800 Subject: [PATCH 04/25] update testcase for testsuite texlive-xskak --- .../texlive-split-z/texlive-xskak.json | 12 -- ...test_texlive-xskak_function_basic_usage.sh | 85 -------------- .../test_texlive-xskak_function_chessboard.sh | 105 ------------------ .../test_texlive-xskak_function_install.sh | 59 ---------- 4 files changed, 261 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_basic_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_chessboard.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_install.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xskak.json b/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xskak.json index 3fd14b0f55f..ccb603161fd 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xskak.json +++ b/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xskak.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak", "machine num": 1, "cases": [ - { - "name": "test_texlive-xskak_function_install", - "desc": "Test installation of texlive-xskak package" - }, { "name": "test_texlive-xskak_function_uninstall", "desc": "Test removal of texlive-xskak package" @@ -13,14 +9,6 @@ { "name": "test_texlive-xskak_function_check", "desc": "Test if texlive-xskak package is present" - }, - { - "name": "test_texlive-xskak_function_basic_usage", - "desc": "Test basic LaTeX document with xskak" - }, - { - "name": "test_texlive-xskak_function_chessboard", - "desc": "Test generating a chessboard diagram" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_basic_usage.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_basic_usage.sh deleted file mode 100644 index 8215a6c4da4..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_basic_usage.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-27 -# @License : Mulan PSL v2 -# @Desc : Test basic LaTeX document with xskak -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic LaTeX document with xskak" - - LOG_INFO "步骤1:检查texlive-xskak软件包是否在yum源中" - dnf list available texlive-xskak > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-xskak软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已安装texlive-xskak" - rpm -q texlive-xskak > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-xskak已安装,标记为已存在" - INSTALLED=1 - else - LOG_INFO "texlive-xskak未安装,标记为未安装" - INSTALLED=0 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-xskak软件包" - dnf install -y texlive-xskak - CHECK_RESULT $? 0 0 "安装texlive-xskak失败" - fi - - LOG_INFO "步骤4:创建测试LaTeX文档" - cat > test_xskak.tex << "EOF" - \documentclass{article} - \usepackage{xskak} - \begin{document} - \newchessgame - \mainline{1.e4 e5 2.Nf3 Nc6 3.Bb5} - \chessboard - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建LaTeX测试文件失败" - - LOG_INFO "步骤5:使用pdflatex编译LaTeX文档" - pdflatex -interaction=nonstopmode test_xskak.tex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdflatex编译失败" - - LOG_INFO "步骤6:检查生成的PDF文件" - if [ -f "test_xskak.pdf" ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - CHECK_RESULT 1 0 0 "PDF文件未生成" - fi - - LOG_INFO "步骤7:清理测试文件" - rm -f test_xskak.tex test_xskak.aux test_xskak.log test_xskak.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤8:卸载texlive-xskak软件包" - dnf remove -y texlive-xskak - CHECK_RESULT $? 0 0 "卸载texlive-xskak失败" - fi - - LOG_INFO "测试完成:Test basic LaTeX document with xskak" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_chessboard.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_chessboard.sh deleted file mode 100644 index 7f95e21943b..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_chessboard.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-27 -# @License : Mulan PSL v2 -# @Desc : Test generating a chessboard diagram -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试生成棋盘图 - LOG_INFO "开始测试:生成棋盘图" - - # 检查yum源中是否存在texlive-xskak包 - LOG_INFO "检查yum源中是否存在texlive-xskak包" - dnf list available texlive-xskak > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-xskak包" - exit 255 - fi - - # 检查是否已安装texlive-xskak - LOG_INFO "检查系统是否已安装texlive-xskak" - rpm -q texlive-xskak > /dev/null 2>&1 - INSTALLED=$? - - # 记录初始安装状态 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "texlive-xskak已安装" - ORIGINAL_STATE="installed" - else - LOG_INFO "texlive-xskak未安装" - ORIGINAL_STATE="not_installed" - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "安装texlive-xskak软件包" - dnf install -y texlive-xskak - CHECK_RESULT $? 0 0 "安装texlive-xskak失败" - fi - - # 验证xskak包是否提供chessboard命令 - LOG_INFO "验证xskak包是否提供chessboard命令" - rpm -ql texlive-xskak | grep -q "xskak.sty" - CHECK_RESULT $? 0 0 "texlive-xskak未提供xskak.sty文件" - - # 创建测试LaTeX文档 - LOG_INFO "创建测试LaTeX文档" - cat > test_chessboard.tex << "EOF" - \documentclass{article} - \usepackage{xskak} - \begin{document} - \newchessgame - \chessboard - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - - # 尝试生成棋盘图 - LOG_INFO "尝试使用pdflatex生成棋盘图" - pdflatex -interaction=nonstopmode test_chessboard.tex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "生成棋盘图失败" - - # 检查是否生成了PDF文件 - LOG_INFO "检查是否生成了PDF文件" - [ -f test_chessboard.pdf ] - CHECK_RESULT $? 0 0 "未生成PDF文件" - - # 检查PDF文件是否包含棋盘内容 - LOG_INFO "检查PDF文件是否包含棋盘内容" - file test_chessboard.pdf | grep -q "PDF document" - CHECK_RESULT $? 0 0 "生成的PDF文件格式不正确" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_chessboard.tex test_chessboard.log test_chessboard.aux test_chessboard.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 根据原始状态恢复环境 - LOG_INFO "根据原始状态恢复环境" - if [ "$ORIGINAL_STATE" = "not_installed" ]; then - LOG_INFO "卸载texlive-xskak软件包" - dnf remove -y texlive-xskak - CHECK_RESULT $? 0 0 "卸载texlive-xskak失败" - else - LOG_INFO "保持texlive-xskak安装状态" - fi - - LOG_INFO "测试完成:生成棋盘图" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_install.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_install.sh deleted file mode 100644 index 85125472fd4..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xskak/test_texlive-xskak_function_install.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-10-05 -# @License : Mulan PSL v2 -# @Desc : Test installation of texlive-xskak package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查texlive-xskak软件包是否已安装 - LOG_INFO "检查texlive-xskak软件包是否已安装" - rpm -q texlive-xskak > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-xskak软件包已安装,脚本结束时保持安装状态" - installed=true - else - LOG_INFO "texlive-xskak软件包未安装,将在脚本结束时卸载" - installed=false - fi - - # 检查yum源中是否有texlive-xskak软件包 - LOG_INFO "检查yum源中是否有texlive-xskak软件包" - dnf list available texlive-xskak > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-xskak软件包" - - # 安装texlive-xskak软件包 - LOG_INFO "安装texlive-xskak软件包" - dnf install -y texlive-xskak - CHECK_RESULT $? 0 0 "安装texlive-xskak软件包失败" - - # 验证texlive-xskak软件包是否成功安装 - LOG_INFO "验证texlive-xskak软件包是否成功安装" - rpm -q texlive-xskak > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-xskak软件包未成功安装" - - # 清理环境:如果脚本开始时未安装,则卸载texlive-xskak软件包 - if [ "$installed" = false ]; then - LOG_INFO "清理环境:卸载texlive-xskak软件包" - dnf remove -y texlive-xskak - CHECK_RESULT $? 0 0 "卸载texlive-xskak软件包失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file From 12d15ca2d5e6448051369ce2faf76d716bccf2fd Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:47:55 +0800 Subject: [PATCH 05/25] update testcase for testsuite OpenIPMI-perl --- .../pkg_test/OpenIPMI/OpenIPMI-perl.json | 20 ---- .../test_OpenIPMI-perl_connect.sh | 108 ------------------ .../OpenIPMI-perl/test_OpenIPMI-perl_info.sh | 78 ------------- .../test_OpenIPMI-perl_install.sh | 80 ------------- .../test_OpenIPMI-perl_modules.sh | 66 ----------- .../test_OpenIPMI-perl_version.sh | 70 ------------ 6 files changed, 422 deletions(-) delete mode 100644 testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_connect.sh delete mode 100644 testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_info.sh delete mode 100644 testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_install.sh delete mode 100644 testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_modules.sh delete mode 100644 testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_version.sh diff --git a/suite2cases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl.json b/suite2cases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl.json index 08a4b02271a..b1a3a568395 100644 --- a/suite2cases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl.json +++ b/suite2cases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl.json @@ -5,26 +5,6 @@ { "name": "test_OpenIPMI-perl_uninstall", "desc": "测试软件包OpenIPMI-perl能否被正确卸载。" - }, - { - "name": "test_OpenIPMI-perl_install", - "desc": "测试软件包OpenIPMI-perl能否被正确安装。" - }, - { - "name": "test_OpenIPMI-perl_version", - "desc": "测试能否正确查询软件包OpenIPMI-perl的版本信息。" - }, - { - "name": "test_OpenIPMI-perl_modules", - "desc": "测试OpenIPMI-perl的关键Perl模块(如IPMI.pm)是否可被正常加载。" - }, - { - "name": "test_OpenIPMI-perl_connect", - "desc": "测试使用OpenIPMI-perl模块能否建立基本的IPMI连接(如连接到localhost)。" - }, - { - "name": "test_OpenIPMI-perl_info", - "desc": "测试能否通过OpenIPMI-perl模块获取基础的IPMI设备信息(如设备ID)。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_connect.sh b/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_connect.sh deleted file mode 100644 index c41b263c090..00000000000 --- a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_connect.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-06 -# @License : Mulan PSL v2 -# @Desc : 测试使用OpenIPMI-perl模块能否建立基本的IPMI连接(如连接到localhost)。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否以root用户运行 - if [[ $EUID -ne 0 ]]; then - LOG_ERROR "此脚本需要以root权限运行" - exit 1 - fi - - # 定义软件包名称 - PACKAGE_NAME="OpenIPMI-perl" - - # 检查软件包是否已在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}" - INSTALLED=0 - if rpm -q ${PACKAGE_NAME} &>/dev/null; then - LOG_INFO "${PACKAGE_NAME}已安装" - INSTALLED=1 - else - LOG_INFO "${PACKAGE_NAME}未安装" - fi - - # 如果未安装,则安装软件包 - if [[ ${INSTALLED} -eq 0 ]]; then - LOG_INFO "安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 检查ipmitool命令是否可用 - LOG_INFO "检查ipmitool命令是否可用" - which ipmitool &>/dev/null - if [[ $? -ne 0 ]]; then - LOG_INFO "ipmitool未安装,尝试安装" - dnf install -y ipmitool - CHECK_RESULT $? 0 0 "安装ipmitool失败" - fi - - # 检查IPMI服务是否运行 - LOG_INFO "检查IPMI服务状态" - systemctl status ipmi &>/dev/null - if [[ $? -ne 0 ]]; then - LOG_INFO "启动IPMI服务" - systemctl start ipmi - CHECK_RESULT $? 0 0 "启动IPMI服务失败" - fi - - # 测试使用OpenIPMI-perl模块连接到localhost - LOG_INFO "测试使用OpenIPMI-perl模块连接到localhost" - # 使用perl单行命令测试OpenIPMI-perl模块 - perl -e "use IPMI::Connection; my $conn = IPMI::Connection->new(host => "localhost"); if ($conn) { print "连接成功\n"; } else { die "连接失败\n"; }" 2>&1 - CHECK_RESULT $? 0 0 "OpenIPMI-perl模块连接localhost失败" - - # 使用ipmitool进行基本连接测试 - LOG_INFO "使用ipmitool进行基本IPMI连接测试" - ipmitool -I lanplus -H localhost -U admin -P password chassis status 2>&1 | grep -q "Chassis Power" - # 注意:上面的命令可能会因为认证失败而返回非0,但我们主要测试连接是否建立 - # 所以这里检查命令是否执行(而不是是否成功认证) - CHECK_RESULT $? 0 1 "ipmitool连接测试失败" - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [[ ${INSTALLED} -eq 0 ]]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - - # 如果之前安装了ipmitool,也卸载 - LOG_INFO "检查是否需要卸载ipmitool" - if ! which ipmitool &>/dev/null && rpm -q ipmitool &>/dev/null; then - dnf remove -y ipmitool - CHECK_RESULT $? 0 0 "卸载ipmitool失败" - fi - else - LOG_INFO "保持${PACKAGE_NAME}安装状态" - fi - - LOG_INFO "测试完成" - exit 0 -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_info.sh b/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_info.sh deleted file mode 100644 index 53675ccb3dd..00000000000 --- a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_info.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-04-06 -# @License : Mulan PSL v2 -# @Desc : 测试能否通过OpenIPMI-perl模块获取基础的IPMI设备信息(如设备ID)。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试能否通过OpenIPMI-perl模块获取基础的IPMI设备信息(如设备ID)。" - - # 检查是否已安装OpenIPMI-perl包 - LOG_INFO "检查是否已安装OpenIPMI-perl包..." - if rpm -q OpenIPMI-perl > /dev/null 2>&1; then - LOG_INFO "OpenIPMI-perl包已安装,将保持安装状态。" - INSTALLED=true - else - LOG_INFO "OpenIPMI-perl包未安装,将在测试过程中安装。" - INSTALLED=false - fi - - # 检查yum源中是否有OpenIPMI-perl包 - LOG_INFO "检查yum源中是否有OpenIPMI-perl包..." - if ! dnf list available OpenIPMI-perl > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到OpenIPMI-perl包,退出测试。" - exit 255 - fi - - # 如果未安装,则安装OpenIPMI-perl包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装OpenIPMI-perl包..." - dnf install -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "安装OpenIPMI-perl包失败" - fi - - # 检查ipmitool命令是否可用 - LOG_INFO "检查ipmitool命令是否可用..." - if ! command -v ipmitool > /dev/null 2>&1; then - LOG_ERROR "ipmitool命令未找到,退出测试。" - exit 255 - fi - - # 检查ipmitool命令是否支持mc info参数 - LOG_INFO "检查ipmitool命令是否支持mc info参数..." - if ! ipmitool mc info --help > /dev/null 2>&1; then - LOG_ERROR "ipmitool命令不支持mc info参数,退出测试。" - exit 255 - fi - - # 执行ipmitool mc info命令获取IPMI设备信息 - LOG_INFO "执行ipmitool mc info命令获取IPMI设备信息..." - ipmitool mc info - CHECK_RESULT $? 0 0 "执行ipmitool mc info命令失败" - - # 清理环境:如果测试前未安装,则卸载OpenIPMI-perl包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载OpenIPMI-perl包..." - dnf remove -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "卸载OpenIPMI-perl包失败" - fi - - LOG_INFO "测试完成,环境已恢复。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_install.sh b/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_install.sh deleted file mode 100644 index 3b2eac43395..00000000000 --- a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_install.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-04-06 -# @License : Mulan PSL v2 -# @Desc : 测试软件包OpenIPMI-perl能否被正确安装。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试OpenIPMI-perl软件包安装功能" - - # 检查环境是否已安装OpenIPMI-perl - LOG_INFO "检查是否已安装OpenIPMI-perl" - if rpm -q OpenIPMI-perl > /dev/null 2>&1; then - LOG_INFO "OpenIPMI-perl已安装,测试结束将保持安装状态" - installed_before_test=true - else - LOG_INFO "OpenIPMI-perl未安装,将在测试中安装" - installed_before_test=false - fi - - # 检查yum源中是否有OpenIPMI-perl软件包 - LOG_INFO "检查yum源中是否存在OpenIPMI-perl软件包" - dnf list available OpenIPMI-perl > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到OpenIPMI-perl软件包" - LOG_INFO "yum源中存在OpenIPMI-perl软件包" - - # 如果未安装,则执行安装 - if [ "$installed_before_test" = false ]; then - LOG_INFO "开始安装OpenIPMI-perl软件包" - dnf install -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "安装OpenIPMI-perl失败" - LOG_INFO "OpenIPMI-perl软件包安装成功" - fi - - # 验证安装 - LOG_INFO "验证OpenIPMI-perl是否安装成功" - rpm -q OpenIPMI-perl > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "OpenIPMI-perl未正确安装" - - LOG_INFO "测试OpenIPMI-perl基本功能" - # 测试一个OpenIPMI-perl相关的命令,例如检查是否有ipmi模块 - perl -e "use IPMI;" 2>&1 - CHECK_RESULT $? 0 0 "OpenIPMI-perl的Perl模块加载失败" - - # 如果需要测试多服务器场景,可以在此处添加 - # LOG_INFO "在第二台服务器上测试" - # SSH_CMD "rpm -q OpenIPMI-perl" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - # CHECK_RESULT $? 0 0 "第二台服务器上OpenIPMI-perl检查失败" - - # 环境清理 - LOG_INFO "开始环境清理" - if [ "$installed_before_test" = false ]; then - LOG_INFO "卸载测试安装的OpenIPMI-perl软件包" - dnf remove -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "卸载OpenIPMI-perl失败" - LOG_INFO "OpenIPMI-perl软件包卸载成功" - else - LOG_INFO "测试前已安装OpenIPMI-perl,保持安装状态" - fi - - LOG_INFO "OpenIPMI-perl安装测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_modules.sh b/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_modules.sh deleted file mode 100644 index 75d17c0a3ec..00000000000 --- a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_modules.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 : 2026-04-06 -# @License : Mulan PSL v2 -# @Desc : 测试OpenIPMI-perl的关键Perl模块(如IPMI.pm)是否可被正常加载。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装OpenIPMI-perl软件包 - LOG_INFO "检查OpenIPMI-perl软件包是否已安装" - rpm -q OpenIPMI-perl > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "OpenIPMI-perl软件包已安装,记录状态以便恢复" - ALREADY_INSTALLED=1 - else - LOG_INFO "OpenIPMI-perl软件包未安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有OpenIPMI-perl软件包 - LOG_INFO "检查yum源中是否有OpenIPMI-perl软件包" - dnf list available OpenIPMI-perl > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有OpenIPMI-perl软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装OpenIPMI-perl软件包" - dnf install -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "安装OpenIPMI-perl软件包失败" - fi - - # 测试Perl模块IPMI.pm是否可被正常加载 - LOG_INFO "测试Perl模块IPMI.pm是否可被正常加载" - perl -e "use IPMI;" - CHECK_RESULT $? 0 0 "Perl模块IPMI.pm加载失败" - - # 环境恢复:如果之前未安装,则卸载软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载OpenIPMI-perl软件包" - dnf remove -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "卸载OpenIPMI-perl软件包失败" - else - LOG_INFO "保持OpenIPMI-perl软件包安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_version.sh b/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_version.sh deleted file mode 100644 index d911c78d937..00000000000 --- a/testcases/function_test/pkg_test/OpenIPMI/OpenIPMI-perl/test_OpenIPMI-perl_version.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-04-06 -# @License : Mulan PSL v2 -# @Desc : 测试能否正确查询软件包OpenIPMI-perl的版本信息。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试能否正确查询软件包OpenIPMI-perl的版本信息" - - LOG_INFO "步骤1:检查yum源中是否存在OpenIPMI-perl软件包" - dnf list available OpenIPMI-perl &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到OpenIPMI-perl软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已经安装了OpenIPMI-perl软件包" - rpm -q OpenIPMI-perl &>/dev/null - if [ $? -eq 0 ]; then - already_installed=true - LOG_INFO "OpenIPMI-perl软件包已经安装" - else - already_installed=false - LOG_INFO "OpenIPMI-perl软件包未安装,将进行安装" - fi - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装OpenIPMI-perl软件包" - dnf install -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "安装OpenIPMI-perl软件包失败" - fi - - LOG_INFO "步骤4:查询OpenIPMI-perl软件包的版本信息" - rpm_version=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}" OpenIPMI-perl 2>/dev/null) - if [ $? -ne 0 ]; then - LOG_ERROR "查询OpenIPMI-perl软件包版本信息失败,命令可能不支持或参数错误" - exit 255 - fi - LOG_INFO "OpenIPMI-perl软件包版本信息为:$rpm_version" - - CHECK_RESULT $? 0 0 "查询OpenIPMI-perl软件包版本信息失败" - - LOG_INFO "步骤5:清理环境,恢复原状" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载测试安装的OpenIPMI-perl软件包" - dnf remove -y OpenIPMI-perl - CHECK_RESULT $? 0 0 "卸载OpenIPMI-perl软件包失败" - else - LOG_INFO "系统原本已安装OpenIPMI-perl,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From dc968765f4b0d9e1b30e4b470c770e08d28dbc1b Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:48:13 +0800 Subject: [PATCH 06/25] update testcase for testsuite texlive-context-mathsets-doc --- .../texlive-split-e/texlive-context-mathsets-doc.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-mathsets-doc.json b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-mathsets-doc.json index 2e1b82754d7..204c1bc0350 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-mathsets-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-mathsets-doc.json @@ -6,10 +6,6 @@ "name": "test_texlive-context-mathsets-doc_function_install", "desc": "Test package installation" }, - { - "name": "test_texlive-context-mathsets-doc_function_uninstall", - "desc": "Test package removal" - }, { "name": "test_texlive-context-mathsets-doc_function_version", "desc": "Check package version info" From 2d71935911f8e1878774cef32a68e39c72933d7e Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:48:31 +0800 Subject: [PATCH 07/25] update testcase for testsuite uwsgi-plugin-dummy --- .../pkg_test/uwsgi/uwsgi-plugin-dummy.json | 51 ----- .../test_uwsgi-plugin-dummy_downgrade.sh | 84 -------- ...test_uwsgi-plugin-dummy_function_config.sh | 70 ------- ...test_uwsgi-plugin-dummy_function_depend.sh | 80 -------- ...t_uwsgi-plugin-dummy_function_downgrade.sh | 136 ------------- ...est_uwsgi-plugin-dummy_function_install.sh | 88 --------- ...st_uwsgi-plugin-dummy_function_rollback.sh | 181 ------------------ ...t_uwsgi-plugin-dummy_function_uninstall.sh | 96 ---------- ...est_uwsgi-plugin-dummy_function_upgrade.sh | 70 ------- .../test_uwsgi-plugin-dummy_function_usage.sh | 67 ------- ...est_uwsgi-plugin-dummy_function_version.sh | 64 ------- .../test_uwsgi-plugin-dummy_rollback.sh | 62 ------ .../test_uwsgi-plugin-dummy_upgrade.sh | 84 -------- 13 files changed, 1133 deletions(-) delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_downgrade.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_config.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_depend.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_downgrade.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_install.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_rollback.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_upgrade.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_usage.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_version.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_rollback.sh delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_upgrade.sh diff --git a/suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy.json b/suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy.json index c28b764796a..c196612a0f5 100644 --- a/suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy.json +++ b/suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy.json @@ -12,65 +12,14 @@ "desc": "测试uwsgi-plugin-dummy软件包的卸载功能,验证是否可以正常卸载。", "machine num": 1 }, - { - "name": "test_uwsgi-plugin-dummy_upgrade", - "desc": "测试uwsgi-plugin-dummy软件包的升级功能,验证是否可以正常升级到最新版本。", - "machine num": 1 - }, - { - "name": "test_uwsgi-plugin-dummy_downgrade", - "desc": "测试uwsgi-plugin-dummy软件包的降级功能,验证是否可以正常降级到指定版本。", - "machine num": 1 - }, - { - "name": "test_uwsgi-plugin-dummy_rollback", - "desc": "测试uwsgi-plugin-dummy软件包的回滚功能,验证是否可以正常回滚到上一个版本。", - "machine num": 1 - }, { "name": "test_uwsgi-plugin-dummy_service_start", "desc": "测试uwsgi-plugin-dummy服务的启动功能,验证服务是否可以正常启动。", "machine num": 1 }, - { - "name": "test_uwsgi-plugin-dummy_function_config", - "desc": "测试uwsgi-plugin-dummy软件包的配置功能,验证配置文件是否可以正常加载和应用。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_install", - "desc": "验证uwsgi-plugin-dummy软件包能够通过包管理器成功安装。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_uninstall", - "desc": "验证uwsgi-plugin-dummy软件包能够通过包管理器被完全卸载。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_upgrade", - "desc": "验证uwsgi-plugin-dummy软件包能够升级到可用的最新版本。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_downgrade", - "desc": "验证uwsgi-plugin-dummy软件包能够降级到指定的旧版本。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_rollback", - "desc": "验证uwsgi-plugin-dummy软件包在升级失败后能够回滚到上一个稳定版本。" - }, { "name": "test_uwsgi-plugin-dummy_function_service", "desc": "验证uwsgi-plugin-dummy相关的服务(如存在)能够正常启动、停止和重启。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_usage", - "desc": "验证uwsgi-plugin-dummy作为插件能够被uWSGI主程序成功加载并执行基本功能。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_version", - "desc": "验证能够正确查询uwsgi-plugin-dummy软件包的版本信息。" - }, - { - "name": "test_uwsgi-plugin-dummy_function_depend", - "desc": "验证uwsgi-plugin-dummy软件包的依赖关系是否正确且已满足。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_downgrade.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_downgrade.sh deleted file mode 100644 index f51ac2a5eee..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_downgrade.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 : 2025-06-19 -# @License : Mulan PSL v2 -# @Desc : 测试uwsgi-plugin-dummy软件包的降级功能,验证是否可以正常降级到指定版本。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试uwsgi-plugin-dummy软件包的降级功能" - - # 检查是否已安装uwsgi-plugin-dummy - LOG_INFO "检查uwsgi-plugin-dummy是否已安装" - if rpm -q uwsgi-plugin-dummy &>/dev/null; then - LOG_INFO "uwsgi-plugin-dummy已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "uwsgi-plugin-dummy未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在uwsgi-plugin-dummy软件包 - LOG_INFO "检查yum源中是否存在uwsgi-plugin-dummy软件包" - if ! dnf list available uwsgi-plugin-dummy &>/dev/null; then - LOG_ERROR "yum源中未找到uwsgi-plugin-dummy软件包" - exit 255 - fi - - # 获取当前安装的版本 - CURRENT_VERSION=$(rpm -q --queryformat '%{VERSION}' uwsgi-plugin-dummy 2>/dev/null) - if [ $? -ne 0 ]; then - CURRENT_VERSION="未安装" - fi - LOG_INFO "当前uwsgi-plugin-dummy版本: $CURRENT_VERSION" - - # 指定降级的目标版本(假设为1.0.0) - TARGET_VERSION="1.0.0" - LOG_INFO "目标降级版本: $TARGET_VERSION" - - # 检查目标版本是否存在于yum源中 - LOG_INFO "检查目标版本是否存在于yum源中" - if ! dnf list available uwsgi-plugin-dummy-$TARGET_VERSION &>/dev/null; then - LOG_ERROR "yum源中未找到目标版本uwsgi-plugin-dummy-$TARGET_VERSION" - exit 255 - fi - - # 执行降级操作 - LOG_INFO "执行降级操作到版本$TARGET_VERSION" - dnf downgrade -y uwsgi-plugin-dummy-$TARGET_VERSION - CHECK_RESULT $? 0 0 "降级操作失败" - - # 验证降级后的版本 - LOG_INFO "验证降级后的版本" - NEW_VERSION=$(rpm -q --queryformat '%{VERSION}' uwsgi-plugin-dummy) - CHECK_RESULT $? 0 0 "获取新版本失败" - if [ "$NEW_VERSION" != "$TARGET_VERSION" ]; then - LOG_ERROR "降级后版本不符,当前版本: $NEW_VERSION, 预期版本: $TARGET_VERSION" - exit 1 - fi - - # 清理环境:如果最初未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载uwsgi-plugin-dummy" - dnf remove -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_config.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_config.sh deleted file mode 100644 index 26ded39ab70..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_config.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 : 2025-12-06 -# @License : Mulan PSL v2 -# @Desc : 测试uwsgi-plugin-dummy软件包的配置功能,验证配置文件是否可以正常加载和应用。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试uwsgi-plugin-dummy软件包的配置功能,验证配置文件是否可以正常加载和应用。" - - # 检查软件包是否已安装 - LOG_INFO "检查uwsgi-plugin-dummy软件包是否已安装" - if dnf list installed uwsgi-plugin-dummy &>/dev/null; then - LOG_INFO "uwsgi-plugin-dummy软件包已安装,脚本结束时将保持安装状态" - already_installed=true - else - LOG_INFO "uwsgi-plugin-dummy软件包未安装,将在测试步骤中安装并在脚本结束前卸载" - already_installed=false - fi - - # 检查yum源中是否存在该软件包 - LOG_INFO "检查yum源中是否存在uwsgi-plugin-dummy软件包" - if ! dnf list available uwsgi-plugin-dummy &>/dev/null; then - LOG_ERROR "yum源中未找到uwsgi-plugin-dummy软件包" - exit 255 - fi - - # 安装软件包(如果未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "正在安装uwsgi-plugin-dummy软件包" - dnf install -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "安装uwsgi-plugin-dummy软件包失败" - fi - - # 验证配置文件加载功能 - LOG_INFO "验证uwsgi-plugin-dummy配置文件是否可以正常加载" - if [ -f /etc/uwsgi/uwsgi-plugin-dummy.conf ]; then - LOG_INFO "配置文件存在,尝试加载" - uwsgi --plugin dummy --config /etc/uwsgi/uwsgi-plugin-dummy.conf --dry-run - CHECK_RESULT $? 0 0 "加载uwsgi-plugin-dummy配置文件失败" - else - LOG_ERROR "未找到uwsgi-plugin-dummy配置文件" - exit 255 - fi - - # 清理环境(如果脚本开始时未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "卸载uwsgi-plugin-dummy软件包以恢复环境" - dnf remove -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-dummy软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_depend.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_depend.sh deleted file mode 100644 index 46988658ccc..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_depend.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-01 -# @License : Mulan PSL v2 -# @Desc : 验证uwsgi-plugin-dummy软件包的依赖关系是否正确且已满足。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:验证uwsgi-plugin-dummy软件包的依赖关系是否正确且已满足。" - - # 检查是否已安装uwsgi-plugin-dummy软件包 - LOG_INFO "步骤1:检查uwsgi-plugin-dummy软件包是否已安装。" - rpm -q uwsgi-plugin-dummy > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "uwsgi-plugin-dummy软件包已安装。" - INSTALLED=1 - else - LOG_INFO "uwsgi-plugin-dummy软件包未安装。" - INSTALLED=0 - fi - - # 检查yum源中是否有uwsgi-plugin-dummy软件包 - LOG_INFO "步骤2:检查yum源中是否有uwsgi-plugin-dummy软件包。" - dnf list available uwsgi-plugin-dummy > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有uwsgi-plugin-dummy软件包。" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装uwsgi-plugin-dummy软件包。" - dnf install -y uwsgi-plugin-dummy > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装uwsgi-plugin-dummy软件包失败。" - fi - - # 验证软件包的依赖关系 - LOG_INFO "步骤4:验证uwsgi-plugin-dummy软件包的依赖关系。" - rpm -qR uwsgi-plugin-dummy > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "获取uwsgi-plugin-dummy软件包依赖关系失败。" - - # 检查依赖是否已满足 - LOG_INFO "步骤5:检查uwsgi-plugin-dummy软件包的依赖是否已满足。" - rpm -qR uwsgi-plugin-dummy | while read dep; do - rpm -q "$dep" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "依赖 $dep 未满足。" - exit 255 - fi - done - - LOG_INFO "步骤6:所有依赖关系已满足。" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤7:卸载uwsgi-plugin-dummy软件包。" - dnf remove -y uwsgi-plugin-dummy > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-dummy软件包失败。" - else - LOG_INFO "步骤7:测试前已安装uwsgi-plugin-dummy软件包,保持安装状态。" - fi - - LOG_INFO "测试完成:uwsgi-plugin-dummy软件包的依赖关系正确且已满足。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_downgrade.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_downgrade.sh deleted file mode 100644 index 7c07d8ea312..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_downgrade.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-03-01 -# @License : Mulan PSL v2 -# @Desc : 验证uwsgi-plugin-dummy软件包能够降级到指定的旧版本。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置日志函数(直接使用) - LOG_INFO() { - echo "[INFO] $1" - } - - LOG_ERROR() { - echo "[ERROR] $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 - } - - # 主测试函数 - test_downgrade() { - local package_name="uwsgi-plugin-dummy" - local old_version="1.0.0" # 假设的旧版本号,实际应根据需求调整 - - LOG_INFO "开始测试:验证uwsgi-plugin-dummy软件包能够降级到指定的旧版本" - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤1:检查yum源中是否有 $package_name 软件包" - check_package_in_repo "$package_name" - CHECK_RESULT $? 0 0 "检查软件包在yum源中存在失败" - - # 检查当前是否已安装 - LOG_INFO "步骤2:检查当前是否已安装 $package_name" - rpm -q "$package_name" &>/dev/null - local installed=$? - if [ $installed -eq 0 ]; then - LOG_INFO "软件包已安装,记录当前版本" - current_version=$(rpm -q --queryformat "%{VERSION}" "$package_name") - else - LOG_INFO "软件包未安装,将进行安装测试" - fi - - # 检查降级命令参数是否支持 - LOG_INFO "步骤3:检查dnf命令是否支持降级参数" - check_command_option "dnf" "downgrade" - CHECK_RESULT $? 0 0 "dnf命令不支持downgrade参数" - - # 如果未安装,先安装最新版本 - if [ $installed -ne 0 ]; then - LOG_INFO "步骤4:安装最新版本的 $package_name" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装最新版本失败" - fi - - # 检查旧版本是否在yum源中 - LOG_INFO "步骤5:检查旧版本 $old_version 是否在yum源中" - dnf list available "$package_name-$old_version" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "旧版本 $old_version 不在yum源中" - # 如果是最初未安装的情况,需要卸载已安装的软件包 - if [ $installed -ne 0 ]; then - dnf remove -y "$package_name" - fi - exit 255 - fi - - # 执行降级操作 - LOG_INFO "步骤6:执行降级到版本 $old_version" - dnf downgrade -y "$package_name-$old_version" - CHECK_RESULT $? 0 0 "降级到旧版本失败" - - # 验证降级后的版本 - LOG_INFO "步骤7:验证降级后的版本" - downgraded_version=$(rpm -q --queryformat "%{VERSION}" "$package_name") - if [ "$downgraded_version" = "$old_version" ]; then - LOG_INFO "降级成功,当前版本为 $downgraded_version" - else - LOG_ERROR "降级失败,当前版本为 $downgraded_version,期望版本为 $old_version" - CHECK_RESULT 1 0 0 "版本验证失败" - fi - - # 环境恢复 - LOG_INFO "步骤8:恢复环境到测试前状态" - if [ $installed -eq 0 ]; then - # 原本已安装,恢复到原始版本 - LOG_INFO "恢复到原始版本 $current_version" - dnf upgrade -y "$package_name-$current_version" - CHECK_RESULT $? 0 0 "恢复到原始版本失败" - else - # 原本未安装,卸载软件包 - LOG_INFO "卸载测试安装的软件包" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成:uwsgi-plugin-dummy软件包能够成功降级到指定旧版本" - } - - # 执行测试 - test_downgrade -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_install.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_install.sh deleted file mode 100644 index 97b4c72452a..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_install.sh +++ /dev/null @@ -1,88 +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-01 -# @License : Mulan PSL v2 -# @Desc : 验证uwsgi-plugin-dummy软件包能够通过包管理器成功安装。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="uwsgi-plugin-dummy" - - LOG_INFO "步骤1: 检查yum源中是否存在$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在$PACKAGE_NAME软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查$PACKAGE_NAME软件包是否已安装" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - IS_INSTALLED=$? - - if [ $IS_INSTALLED -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME软件包已安装,测试后保持安装状态" - NEED_CLEANUP=0 - else - LOG_INFO "$PACKAGE_NAME软件包未安装,将进行安装测试" - NEED_CLEANUP=1 - fi - - if [ $NEED_CLEANUP -eq 1 ]; then - LOG_INFO "步骤3: 安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME软件包失败" - - LOG_INFO "步骤4: 验证$PACKAGE_NAME软件包是否安装成功" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "$PACKAGE_NAME软件包未正确安装" - fi - - LOG_INFO "步骤5: 验证$PACKAGE_NAME软件包的基本功能" - rpm -qi $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "查询$PACKAGE_NAME软件包信息失败" - - LOG_INFO "步骤6: 验证uwsgi-plugin-dummy相关文件是否已安装" - if [ -f /usr/lib64/uwsgi/dummy_plugin.so ] || [ -f /usr/lib/uwsgi/dummy_plugin.so ]; then - LOG_INFO "uwsgi-plugin-dummy插件文件存在" - CHECK_RESULT 0 0 0 "uwsgi-plugin-dummy插件文件不存在" - else - LOG_INFO "检查其他可能的插件文件位置" - find /usr -name "*dummy*" -type f 2>/dev/null | grep -q . - CHECK_RESULT $? 0 0 "未找到uwsgi-plugin-dummy相关文件" - fi - - if [ $NEED_CLEANUP -eq 1 ]; then - LOG_INFO "步骤7: 清理环境,卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME软件包失败" - - LOG_INFO "步骤8: 验证$PACKAGE_NAME软件包已成功卸载" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "$PACKAGE_NAME软件包卸载失败" - exit 1 - else - LOG_INFO "$PACKAGE_NAME软件包已成功卸载" - fi - else - LOG_INFO "步骤7: 测试完成,保持$PACKAGE_NAME软件包安装状态" - fi - - LOG_INFO "测试完成:验证uwsgi-plugin-dummy软件包能够通过包管理器成功安装" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_rollback.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_rollback.sh deleted file mode 100644 index ad1f676c31d..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_rollback.sh +++ /dev/null @@ -1,181 +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-01 -# @License : Mulan PSL v2 -# @Desc : 验证uwsgi-plugin-dummy软件包在升级失败后能够回滚到上一个稳定版本。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查软件包是否在yum源中 - check_package_in_repo() { - dnf list available "$1" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $1 不在yum源中" - exit 255 - fi - } - - # 检查命令参数是否支持 - check_command_param() { - local cmd=$1 - local param=$2 - $cmd --help 2>&1 | grep -q "$param" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $cmd 不支持参数 $param" - exit 255 - fi - } - - # 检查命令执行结果 - check_command_result() { - if [ $1 -ne 0 ]; then - LOG_ERROR "命令执行失败,退出码: $1" - exit $1 - fi - } - - # 检查软件包是否已安装 - check_package_installed() { - rpm -q "$1" &>/dev/null - return $? - } - - # 主测试函数 - run_test() { - local package_name="uwsgi-plugin-dummy" - local original_version="" - local is_installed=false - - LOG_INFO "=== 开始测试: 验证uwsgi-plugin-dummy软件包在升级失败后能够回滚到上一个稳定版本 ===" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查软件包是否在yum源中" - check_package_in_repo "$package_name" - CHECK_RESULT $? 0 0 "检查软件包在yum源中失败" - - # 步骤2: 检查当前是否已安装 - LOG_INFO "步骤2: 检查当前是否已安装" - if check_package_installed "$package_name"; then - is_installed=true - original_version=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}" "$package_name") - LOG_INFO "软件包已安装,当前版本: $original_version" - else - LOG_INFO "软件包未安装,将在测试过程中安装" - fi - - # 步骤3: 如果未安装,先安装软件包 - if [ "$is_installed" = false ]; then - LOG_INFO "步骤3: 安装软件包" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装软件包失败" - original_version=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}" "$package_name") - LOG_INFO "安装成功,版本: $original_version" - fi - - # 步骤4: 模拟升级失败场景 - LOG_INFO "步骤4: 模拟升级失败场景" - - # 步骤4.1: 尝试升级到不存在的版本 - LOG_INFO "步骤4.1: 尝试升级到不存在的版本" - dnf update -y "${package_name}-999.999.999" 2>&1 | tee /tmp/upgrade_fail.log - local upgrade_result=$? - - # 步骤4.2: 检查升级是否失败 - LOG_INFO "步骤4.2: 检查升级是否失败" - if [ $upgrade_result -eq 0 ]; then - LOG_ERROR "升级到不存在的版本竟然成功了,这不符合预期" - exit 1 - fi - LOG_INFO "升级失败,符合预期" - - # 步骤5: 验证软件包是否回滚到原版本 - LOG_INFO "步骤5: 验证软件包是否回滚到原版本" - local current_version=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}" "$package_name" 2>/dev/null) - - if [ -z "$current_version" ]; then - LOG_ERROR "软件包查询失败" - exit 1 - fi - - LOG_INFO "当前版本: $current_version" - LOG_INFO "原始版本: $original_version" - - if [ "$current_version" = "$original_version" ]; then - LOG_INFO "软件包成功回滚到原始版本" - CHECK_RESULT 0 0 0 "版本回滚验证成功" - else - LOG_ERROR "软件包版本未回滚" - LOG_ERROR "当前版本: $current_version" - LOG_ERROR "原始版本: $original_version" - exit 1 - fi - - # 步骤6: 验证软件包功能是否正常 - LOG_INFO "步骤6: 验证软件包功能是否正常" - if [ -f /usr/lib64/uwsgi/plugins/dummy_plugin.so ]; then - LOG_INFO "找到dummy插件文件,功能正常" - CHECK_RESULT 0 0 0 "插件文件存在验证" - else - # 尝试在其他可能的位置查找 - find /usr -name "*dummy*" -type f 2>/dev/null | head -5 | while read file; do - LOG_INFO "找到相关文件: $file" - done - CHECK_RESULT 0 0 0 "查找相关文件" - fi - - # 步骤7: 清理环境 - LOG_INFO "步骤7: 清理环境" - - # 如果测试前未安装,测试后需要卸载 - if [ "$is_installed" = false ]; then - LOG_INFO "测试前未安装,现在卸载软件包" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包失败" - - # 验证是否成功卸载 - check_package_installed "$package_name" - if [ $? -eq 0 ]; then - LOG_ERROR "软件包卸载失败" - exit 1 - else - LOG_INFO "软件包成功卸载" - fi - else - LOG_INFO "测试前已安装,保持安装状态" - LOG_INFO "当前安装版本: $(rpm -q --queryformat="%{VERSION}-%{RELEASE}" "$package_name" 2>/dev/null)" - fi - - # 步骤8: 最终验证 - LOG_INFO "步骤8: 最终验证系统状态" - - # 检查dnf事务历史 - LOG_INFO "检查dnf事务历史" - dnf history list "$package_name" | head -5 - CHECK_RESULT $? 0 0 "检查dnf历史" - - # 检查系统日志中是否有相关错误 - LOG_INFO "检查系统日志" - journalctl --since="1 hour ago" | grep -i "$package_name" | tail -3 || true - - LOG_INFO "=== 测试完成: uwsgi-plugin-dummy软件包升级失败后成功回滚到稳定版本 ===" - } - - # 执行测试 - run_test -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_uninstall.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_uninstall.sh deleted file mode 100644 index 842fdb4a8b3..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_uninstall.sh +++ /dev/null @@ -1,96 +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-01 -# @License : Mulan PSL v2 -# @Desc : 验证uwsgi-plugin-dummy软件包能够通过包管理器被完全卸载。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(如果未定义) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义软件包名称 - PACKAGE_NAME="uwsgi-plugin-dummy" - - # 步骤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" - if rpm -q "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - INSTALLED_BEFORE=false - fi - - # 步骤3:如果未安装,则安装软件包 - 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 - - # 步骤4:验证软件包安装成功 - LOG_INFO "验证软件包 $PACKAGE_NAME 安装成功" - rpm -q "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "验证软件包 $PACKAGE_NAME 安装失败" - - # 步骤5:卸载软件包 - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - LOG_INFO "软件包 $PACKAGE_NAME 卸载成功" - - # 步骤6:验证软件包已完全卸载 - 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 - - # 步骤7:环境恢复 - LOG_INFO "环境恢复" - if [ "$INSTALLED_BEFORE" = true ]; then - LOG_INFO "重新安装软件包 $PACKAGE_NAME 以恢复环境" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "重新安装软件包 $PACKAGE_NAME 失败" - LOG_INFO "环境恢复完成" - else - LOG_INFO "环境无需恢复,脚本执行前未安装软件包" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_upgrade.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_upgrade.sh deleted file mode 100644 index 506165a2580..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_upgrade.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-01 -# @License : Mulan PSL v2 -# @Desc : 验证uwsgi-plugin-dummy软件包能够升级到可用的最新版本。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:验证uwsgi-plugin-dummy软件包能够升级到可用的最新版本。" - - LOG_INFO "步骤1:检查yum源中是否存在uwsgi-plugin-dummy软件包。" - dnf list available uwsgi-plugin-dummy > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到uwsgi-plugin-dummy软件包。" - exit 255 - fi - - LOG_INFO "步骤2:检查当前是否已安装uwsgi-plugin-dummy软件包。" - rpm -q uwsgi-plugin-dummy > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到uwsgi-plugin-dummy软件包已安装,标记为需要保留。" - INSTALLED="true" - else - LOG_INFO "未检测到uwsgi-plugin-dummy软件包,标记为需要安装。" - INSTALLED="false" - fi - - LOG_INFO "步骤3:执行软件包升级操作。" - if [ "$INSTALLED" = "true" ]; then - LOG_INFO "当前已安装,执行升级操作。" - dnf upgrade -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "升级uwsgi-plugin-dummy软件包失败。" - else - LOG_INFO "当前未安装,执行安装操作作为测试步骤。" - dnf install -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "安装uwsgi-plugin-dummy软件包失败。" - fi - - LOG_INFO "步骤4:验证升级后的软件包功能。" - LOG_INFO "检查uwsgi-plugin-dummy软件包是否提供了预期的插件文件。" - find /usr/lib64/uwsgi/ -name "*dummy*" -type f | head -1 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "升级后未找到uwsgi-plugin-dummy相关插件文件。" - - LOG_INFO "步骤5:环境恢复。" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "测试前未安装,执行卸载操作以恢复环境。" - dnf remove -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-dummy软件包失败。" - else - LOG_INFO "测试前已安装,保持安装状态。" - fi - - LOG_INFO "测试完成。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_usage.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_usage.sh deleted file mode 100644 index 034c35718d4..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_usage.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-03-01 -# @License : Mulan PSL v2 -# @Desc : 验证uwsgi-plugin-dummy作为插件能够被uWSGI主程序成功加载并执行基本功能。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:验证uwsgi-plugin-dummy作为插件能够被uWSGI主程序成功加载并执行基本功能。" - - LOG_INFO "步骤1:检查系统中是否已经安装了uwsgi-plugin-dummy软件包。" - if dnf list installed uwsgi-plugin-dummy &>/dev/null; then - LOG_INFO "uwsgi-plugin-dummy已经安装,脚本结束后将保持安装状态。" - already_installed=1 - else - LOG_INFO "uwsgi-plugin-dummy未安装,将在测试过程中进行安装。" - already_installed=0 - fi - - LOG_INFO "步骤2:检查yum源中是否存在uwsgi-plugin-dummy软件包。" - if ! dnf list available uwsgi-plugin-dummy &>/dev/null; then - LOG_ERROR "yum源中未找到uwsgi-plugin-dummy软件包。" - exit 255 - fi - - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤3:安装uwsgi-plugin-dummy软件包。" - dnf install -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "安装uwsgi-plugin-dummy软件包失败。" - fi - - LOG_INFO "步骤4:验证uWSGI主程序是否支持--plugins参数。" - uwsgi --help | grep -q -- "--plugins" - CHECK_RESULT $? 0 0 "uWSGI主程序不支持--plugins参数。" - - LOG_INFO "步骤5:使用uWSGI加载dummy插件并执行基本功能测试。" - test_output=$(uwsgi --plugins dummy --dummy "print("Hello from dummy plugin")" 2>&1) - echo "$test_output" | grep -q "Hello from dummy plugin" - CHECK_RESULT $? 0 0 "uWSGI未能成功加载dummy插件或插件未执行基本功能。" - - LOG_INFO "步骤6:清理测试环境。" - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载测试过程中安装的uwsgi-plugin-dummy软件包。" - dnf remove -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-dummy软件包失败。" - else - LOG_INFO "测试前已安装uwsgi-plugin-dummy,保持安装状态,无需卸载。" - fi - - LOG_INFO "测试完成:uwsgi-plugin-dummy插件能够被uWSGI主程序成功加载并执行基本功能。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_version.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_version.sh deleted file mode 100644 index 8ffaffc939f..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_function_version.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 : 2026-03-01 -# @License : Mulan PSL v2 -# @Desc : 验证能够正确查询uwsgi-plugin-dummy软件包的版本信息。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:验证能够正确查询uwsgi-plugin-dummy软件包的版本信息。" - - LOG_INFO "步骤1:检查yum源中是否存在uwsgi-plugin-dummy软件包" - dnf list available uwsgi-plugin-dummy &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到uwsgi-plugin-dummy软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境中是否已安装uwsgi-plugin-dummy软件包" - rpm -q uwsgi-plugin-dummy &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "检测到uwsgi-plugin-dummy软件包已安装,标记为已安装状态" - installed=true - else - LOG_INFO "未检测到uwsgi-plugin-dummy软件包,标记为未安装状态" - installed=false - fi - - LOG_INFO "步骤3:如果未安装,则安装uwsgi-plugin-dummy软件包" - if [ "$installed" = false ]; then - dnf install -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "安装uwsgi-plugin-dummy软件包失败" - fi - - LOG_INFO "步骤4:验证uwsgi-plugin-dummy软件包的版本信息查询功能" - rpm -q --queryformat "%{VERSION}-%{RELEASE}\n" uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "查询uwsgi-plugin-dummy软件包版本信息失败" - - LOG_INFO "步骤5:环境清理与恢复" - if [ "$installed" = false ]; then - LOG_INFO "卸载测试安装的uwsgi-plugin-dummy软件包" - dnf remove -y uwsgi-plugin-dummy - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-dummy软件包失败" - else - LOG_INFO "保持原有的uwsgi-plugin-dummy软件包安装状态" - fi - - LOG_INFO "测试完成:成功验证uwsgi-plugin-dummy软件包的版本信息查询功能。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_rollback.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_rollback.sh deleted file mode 100644 index ef9d1db4f84..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_rollback.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-06-19 -# @License : Mulan PSL v2 -# @Desc : 测试uwsgi-plugin-dummy软件包的回滚功能,验证是否可以正常回滚到上一个版本。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试uwsgi-plugin-dummy软件包的回滚功能" - - # 检查软件包是否已安装 - LOG_INFO "检查uwsgi-plugin-dummy软件包是否已安装" - if dnf list installed uwsgi-plugin-dummy &> /dev/null; then - LOG_INFO "uwsgi-plugin-dummy软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "uwsgi-plugin-dummy软件包未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在uwsgi-plugin-dummy软件包 - LOG_INFO "检查yum源中是否存在uwsgi-plugin-dummy软件包" - if ! dnf list available uwsgi-plugin-dummy &> /dev/null; then - LOG_ERROR "yum源中不存在uwsgi-plugin-dummy软件包" - exit 255 - fi - - # 安装旧版本软件包 - LOG_INFO "安装旧版本uwsgi-plugin-dummy软件包" - dnf install -y uwsgi-plugin-dummy-1.0.0 &> /dev/null - CHECK_RESULT $? 0 0 "安装旧版本uwsgi-plugin-dummy失败" - - # 验证回滚功能 - LOG_INFO "验证回滚功能" - dnf downgrade -y uwsgi-plugin-dummy &> /dev/null - CHECK_RESULT $? 0 0 "回滚uwsgi-plugin-dummy失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载uwsgi-plugin-dummy软件包" - dnf remove -y uwsgi-plugin-dummy &> /dev/null - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-dummy失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_upgrade.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_upgrade.sh deleted file mode 100644 index bc6b67f3020..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-dummy/test_uwsgi-plugin-dummy_upgrade.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 : 2025-06-19 -# @License : Mulan PSL v2 -# @Desc : 测试uwsgi-plugin-dummy软件包的升级功能,验证是否可以正常升级到最新版本。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在uwsgi-plugin-dummy软件包 - LOG_INFO "检查yum源中是否存在uwsgi-plugin-dummy软件包" - dnf list available uwsgi-plugin-dummy > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到uwsgi-plugin-dummy软件包" - exit 255 - fi - - # 检查当前是否已安装uwsgi-plugin-dummy软件包 - LOG_INFO "检查当前是否已安装uwsgi-plugin-dummy软件包" - rpm -q uwsgi-plugin-dummy > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "uwsgi-plugin-dummy软件包已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "uwsgi-plugin-dummy软件包未安装,将在测试完成后卸载" - INSTALLED=false - fi - - # 安装uwsgi-plugin-dummy软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装uwsgi-plugin-dummy软件包" - dnf install -y uwsgi-plugin-dummy > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装uwsgi-plugin-dummy软件包失败" - fi - - # 获取当前安装的版本信息 - LOG_INFO "获取当前uwsgi-plugin-dummy软件包的版本信息" - CURRENT_VERSION=$(rpm -q --queryformat '%{VERSION}-%{RELEASE}' uwsgi-plugin-dummy) - LOG_INFO "当前版本: $CURRENT_VERSION" - - # 升级到最新版本 - LOG_INFO "开始升级uwsgi-plugin-dummy软件包到最新版本" - dnf upgrade -y uwsgi-plugin-dummy > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "升级uwsgi-plugin-dummy软件包失败" - - # 获取升级后的版本信息 - LOG_INFO "获取升级后的uwsgi-plugin-dummy软件包的版本信息" - UPGRADED_VERSION=$(rpm -q --queryformat '%{VERSION}-%{RELEASE}' uwsgi-plugin-dummy) - LOG_INFO "升级后版本: $UPGRADED_VERSION" - - # 验证版本是否发生变化 - if [ "$CURRENT_VERSION" != "$UPGRADED_VERSION" ]; then - LOG_INFO "版本已成功从 $CURRENT_VERSION 升级到 $UPGRADED_VERSION" - else - LOG_ERROR "版本未发生变化,升级功能可能存在问题" - exit 1 - fi - - # 清理环境(如果脚本开始时未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载uwsgi-plugin-dummy软件包以恢复环境" - dnf remove -y uwsgi-plugin-dummy > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-dummy软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" - exit 0 -} - -main "$@" \ No newline at end of file From a3baed58bf06d30af973ebe03f323a8eb8112ada Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:48:40 +0800 Subject: [PATCH 08/25] update testcase for testsuite texlive-skaknew --- .../texlive-split-v/texlive-skaknew.json | 10 --- .../test_texlive-skaknew_function_chess.sh | 77 ------------------- 2 files changed, 87 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-v/texlive-skaknew.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-skaknew/test_texlive-skaknew_function_chess.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-skaknew.json b/suite2cases/function_test/pkg_test/texlive-split-v/texlive-skaknew.json deleted file mode 100644 index e4ecda92bcb..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-skaknew.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-skaknew", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-skaknew_function_chess", - "desc": "Test chess notation rendering" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-skaknew/test_texlive-skaknew_function_chess.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-skaknew/test_texlive-skaknew_function_chess.sh deleted file mode 100644 index 425ce0363af..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-skaknew/test_texlive-skaknew_function_chess.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test chess notation rendering -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-skaknew_function_chess - if dnf list installed texlive-skaknew_function_chess &>/dev/null; then - LOG_INFO "texlive-skaknew_function_chess已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-skaknew_function_chess未安装,将在测试后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-skaknew_function_chess - LOG_INFO "检查yum源中是否存在texlive-skaknew_function_chess软件包" - if ! dnf list available texlive-skaknew_function_chess &>/dev/null; then - LOG_ERROR "yum源中不存在texlive-skaknew_function_chess软件包" - exit 255 - fi - - # 安装texlive-skaknew_function_chess - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-skaknew_function_chess" - dnf install -y texlive-skaknew_function_chess - CHECK_RESULT $? 0 0 "安装texlive-skaknew_function_chess失败" - fi - - # 测试chess notation rendering - LOG_INFO "测试chess notation rendering功能" - if ! command -v chess-notate &>/dev/null; then - LOG_ERROR "chess-notate命令不存在或不支持" - exit 255 - fi - - # 执行测试命令 - LOG_INFO "执行测试命令" - output=$(chess-notate --test) - CHECK_RESULT $? 0 0 "执行测试命令失败" - - # 验证输出结果是否符合预期(假设预期输出包含"success") - if [[ "$output" != *"success"* ]]; then - LOG_ERROR "测试输出不符合预期: $output" - exit 1 - else - LOG_INFO "测试输出符合预期: $output" - fi - - # 清理环境:如果之前未安装,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-skaknew_function_chess" - dnf remove -y texlive-skaknew_function_chess - CHECK_RESULT $? 0 0 "卸载texlive-skaknew_function_chess失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" -} - -main "$@" \ No newline at end of file From 4f24f2e97bdc0bdf23cbf5e7b407e4b4ebf1bd94 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:49:08 +0800 Subject: [PATCH 09/25] update testcase for testsuite python3-bracex --- .../python-bracex/python3-bracex.json | 32 ----- ...st_python3-bracex_function_basic_expand.sh | 71 ---------- .../test_python3-bracex_function_escape.sh | 71 ---------- .../test_python3-bracex_function_expand.sh | 64 --------- .../test_python3-bracex_function_import.sh | 65 --------- .../test_python3-bracex_function_install.sh | 82 ------------ ...t_python3-bracex_function_nested_expand.sh | 72 ---------- ...test_python3-bracex_function_seq_expand.sh | 126 ------------------ .../test_python3-bracex_function_uninstall.sh | 71 ---------- 9 files changed, 654 deletions(-) delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_basic_expand.sh delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_escape.sh delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_expand.sh delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_import.sh delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_install.sh delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_nested_expand.sh delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_seq_expand.sh delete mode 100644 testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/python-bracex/python3-bracex.json b/suite2cases/function_test/pkg_test/python-bracex/python3-bracex.json index 56bbcbb165b..b30ecbfc3f1 100644 --- a/suite2cases/function_test/pkg_test/python-bracex/python3-bracex.json +++ b/suite2cases/function_test/pkg_test/python-bracex/python3-bracex.json @@ -6,38 +6,6 @@ "name": "test_python3-bracex_install", "desc": "测试python3-bracex软件包的安装功能", "machine num": 1 - }, - { - "name": "test_python3-bracex_function_expand", - "desc": "测试python3-bracex的字符串扩展功能" - }, - { - "name": "test_python3-bracex_function_install", - "desc": "测试python3-bracex软件包的安装功能" - }, - { - "name": "test_python3-bracex_function_uninstall", - "desc": "测试python3-bracex软件包的卸载功能" - }, - { - "name": "test_python3-bracex_function_basic_expand", - "desc": "测试bracex的基本字符串扩展功能" - }, - { - "name": "test_python3-bracex_function_nested_expand", - "desc": "测试bracex的嵌套括号扩展功能" - }, - { - "name": "test_python3-bracex_function_seq_expand", - "desc": "测试bracex的数字序列扩展功能" - }, - { - "name": "test_python3-bracex_function_escape", - "desc": "测试bracex的转义字符处理功能" - }, - { - "name": "test_python3-bracex_function_import", - "desc": "测试导入bracex模块的功能" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_basic_expand.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_basic_expand.sh deleted file mode 100644 index 962d5d5740c..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_basic_expand.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-02-27 -# @License : Mulan PSL v2 -# @Desc : 测试bracex的基本字符串扩展功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试bracex的基本字符串扩展功能" - - # 检查是否已安装python3-bracex - LOG_INFO "检查python3-bracex是否已安装" - if dnf list installed python3-bracex &>/dev/null; then - LOG_INFO "python3-bracex已安装,测试结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "python3-bracex未安装,将在测试中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有python3-bracex软件包 - LOG_INFO "检查yum源中是否有python3-bracex软件包" - if ! dnf list available python3-bracex &>/dev/null; then - LOG_ERROR "yum源中未找到python3-bracex软件包" - exit 255 - fi - - # 如果未安装,则安装python3-bracex - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装python3-bracex软件包" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装python3-bracex失败" - fi - - # 测试bracex的基本字符串扩展功能 - LOG_INFO "测试bracex的基本字符串扩展功能" - # 使用bracex扩展字符串 - result=$(python3 -c "import bracex; print(bracex.expand("a{1,2,3}b"))") - expected="a1b a2b a3b" - if [ "$result" = "$expected" ]; then - LOG_INFO "bracex基本字符串扩展功能测试成功" - else - LOG_ERROR "bracex基本字符串扩展功能测试失败,预期:$expected,实际:$result" - exit 1 - fi - - # 清理环境:如果之前未安装,则卸载python3-bracex - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载python3-bracex软件包" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载python3-bracex失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_escape.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_escape.sh deleted file mode 100644 index 8da3387cf51..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_escape.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-02-27 -# @License : Mulan PSL v2 -# @Desc : 测试bracex的转义字符处理功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试bracex的转义字符处理功能" - LOG_INFO "检查环境中是否已安装python3-bracex软件包" - if dnf list installed python3-bracex > /dev/null 2>&1; then - LOG_INFO "python3-bracex已安装,保持安装状态" - already_installed=true - else - LOG_INFO "python3-bracex未安装,将在测试步骤中安装" - already_installed=false - fi - LOG_INFO "检查yum源中是否存在python3-bracex软件包" - if ! dnf list available python3-bracex > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-bracex软件包" - exit 255 - fi - if [ "$already_installed" = false ]; then - LOG_INFO "安装python3-bracex软件包" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装python3-bracex失败" - fi - LOG_INFO "测试bracex的转义字符处理功能" - LOG_INFO "执行测试命令:python3 -c \"import bracex; print(bracex.expand("{a,b,c}"))\"" - python3 -c "import bracex; print(bracex.expand("{a,b,c}"))" - CHECK_RESULT $? 0 0 "bracex扩展基本模式失败" - LOG_INFO "测试转义字符功能:python3 -c \"import bracex; print(bracex.expand("{a\\,b,c}"))\"" - python3 -c "import bracex; print(bracex.expand("{a\\,b,c}"))" - CHECK_RESULT $? 0 0 "bracex转义逗号失败" - LOG_INFO "测试转义大括号功能:python3 -c \"import bracex; print(bracex.expand("{a\\{b,c}"))\"" - python3 -c "import bracex; print(bracex.expand("{a\\{b,c}"))" - CHECK_RESULT $? 0 0 "bracex转义大括号失败" - LOG_INFO "测试不支持参数的情况" - LOG_INFO "尝试使用不存在的参数运行bracex命令" - if python3 -c "import bracex; bracex.nonexistent_function()" > /dev/null 2>&1; then - LOG_ERROR "不存在的参数未触发错误" - exit 255 - else - LOG_INFO "不存在的参数正确触发错误" - fi - if [ "$already_installed" = false ]; then - LOG_INFO "测试完成,卸载python3-bracex软件包" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载python3-bracex失败" - else - LOG_INFO "测试完成,保持python3-bracex安装状态" - fi - LOG_INFO "清理测试环境" - LOG_INFO "测试脚本执行完毕" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_expand.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_expand.sh deleted file mode 100644 index 640a9fab700..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_expand.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-12-04 -# @License : Mulan PSL v2 -# @Desc : 测试python3-bracex的字符串扩展功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-bracex的字符串扩展功能" - - # 检查是否已安装python3-bracex - if dnf list installed python3-bracex &>/dev/null; then - LOG_INFO "python3-bracex已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-bracex未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-bracex - if ! dnf list available python3-bracex &>/dev/null; then - LOG_ERROR "yum源中未找到python3-bracex软件包" - exit 255 - fi - - # 如果未安装,则安装python3-bracex - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装python3-bracex" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装python3-bracex失败" - fi - - # 测试python3-bracex的字符串扩展功能 - LOG_INFO "测试python3-bracex的字符串扩展功能" - result=$(python3 -c "import bracex; print(bracex.expand("a{b,c}d"))") - expected="abd acd" - CHECK_RESULT $? 0 0 "执行python3-bracex命令失败" - [ "$result" = "$expected" ] || { LOG_ERROR "字符串扩展功能测试失败"; exit 1; } - - # 如果最初未安装,则在测试结束后卸载python3-bracex - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载python3-bracex" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载python3-bracex失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_import.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_import.sh deleted file mode 100644 index ce0ab890f2a..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_import.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-02-27 -# @License : Mulan PSL v2 -# @Desc : 测试导入bracex模块的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试导入bracex模块的功能" - LOG_INFO "步骤1:检查bracex模块是否已安装" - if python3 -c "import bracex" 2>/dev/null; then - LOG_INFO "bracex模块已安装,无需安装" - INSTALLED=0 - else - LOG_INFO "bracex模块未安装,准备安装" - INSTALLED=1 - fi - - if [ $INSTALLED -eq 1 ]; then - LOG_INFO "步骤2:检查yum源中是否有python3-bracex软件包" - if ! dnf list available python3-bracex 2>/dev/null | grep -q python3-bracex; then - LOG_ERROR "yum源中没有python3-bracex软件包" - exit 255 - fi - - LOG_INFO "步骤3:安装python3-bracex软件包" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装python3-bracex失败" - fi - - LOG_INFO "步骤4:测试导入bracex模块" - python3 -c "import bracex" - CHECK_RESULT $? 0 0 "导入bracex模块失败" - - LOG_INFO "步骤5:测试bracex模块基本功能" - python3 -c "import bracex; print(bracex.expand("test{1..3}"))" - CHECK_RESULT $? 0 0 "bracex模块功能异常" - - if [ $INSTALLED -eq 1 ]; then - LOG_INFO "步骤6:清理环境,卸载python3-bracex软件包" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载python3-bracex失败" - LOG_INFO "环境已恢复" - else - LOG_INFO "环境保持已安装状态" - fi - - LOG_INFO "测试导入bracex模块的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_install.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_install.sh deleted file mode 100644 index 4a86d50e675..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_install.sh +++ /dev/null @@ -1,82 +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-27 -# @License : Mulan PSL v2 -# @Desc : 测试python3-bracex软件包的安装功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试python3-bracex软件包的安装功能" - - LOG_INFO "步骤1: 检查当前环境是否已安装python3-bracex" - if rpm -q python3-bracex &>/dev/null; then - LOG_INFO "检测到python3-bracex已安装,测试完成后将保持安装状态" - already_installed=1 - else - LOG_INFO "当前环境未安装python3-bracex" - already_installed=0 - fi - - LOG_INFO "步骤2: 检查yum源中是否存在python3-bracex软件包" - if ! dnf list available python3-bracex &>/dev/null; then - LOG_ERROR "yum源中未找到python3-bracex软件包" - exit 255 - fi - LOG_INFO "yum源中存在python3-bracex软件包" - - if [ ${already_installed} -eq 0 ]; then - LOG_INFO "步骤3: 安装python3-bracex软件包" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装python3-bracex失败" - LOG_INFO "python3-bracex安装成功" - fi - - LOG_INFO "步骤4: 验证python3-bracex基本功能" - python3 -c "import bracex; print(bracex.__version__)" &>/dev/null - CHECK_RESULT $? 0 0 "导入bracex模块失败" - LOG_INFO "python3-bracex基本功能验证通过" - - LOG_INFO "步骤5: 测试bracex.expand命令" - if ! command -v bracex &>/dev/null; then - LOG_ERROR "bracex命令不存在" - exit 255 - fi - - result=$(bracex -e "{a,b,c}{1,2}" 2>/dev/null) - expected="a1 a2 b1 b2 c1 c2" - if [ "$result" != "$expected" ]; then - LOG_ERROR "bracex.expand命令输出不符合预期" - exit 1 - fi - LOG_INFO "bracex.expand命令测试通过" - - LOG_INFO "步骤6: 清理测试环境" - if [ ${already_installed} -eq 0 ]; then - LOG_INFO "卸载测试安装的python3-bracex软件包" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载python3-bracex失败" - LOG_INFO "python3-bracex卸载成功" - else - LOG_INFO "保持python3-bracex原有安装状态" - fi - - LOG_INFO "python3-bracex安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_nested_expand.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_nested_expand.sh deleted file mode 100644 index 8fda83f1f59..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_nested_expand.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-27 -# @License : Mulan PSL v2 -# @Desc : 测试bracex的嵌套括号扩展功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 bracex 的嵌套括号扩展功能" - - LOG_INFO "步骤1: 检查系统是否已安装 python3-bracex 软件包" - if dnf list installed python3-bracex &>/dev/null; then - LOG_INFO "python3-bracex 已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-bracex 未安装,将在测试结束后卸载" - INSTALLED=false - fi - - LOG_INFO "步骤2: 检查 yum 源中是否有 python3-bracex 软件包" - if ! dnf list available python3-bracex &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-bracex 软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装 python3-bracex 软件包" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装 python3-bracex 失败" - fi - - LOG_INFO "步骤4: 测试 bracex 的嵌套括号扩展功能" - python3 -c "import bracex; result = bracex.expand("a{b,c{d,e}f}g"); print(result)" - CHECK_RESULT $? 0 0 "执行 bracex 嵌套括号扩展失败" - - LOG_INFO "步骤5: 验证扩展结果是否符合预期" - EXPECTED="abg acdfg acefg" - ACTUAL=$(python3 -c "import bracex; result = bracex.expand("a{b,c{d,e}f}g"); print(result)") - if [ "$ACTUAL" = "$EXPECTED" ]; then - LOG_INFO "扩展结果符合预期: $ACTUAL" - else - LOG_ERROR "扩展结果不符合预期: 期望 "$EXPECTED", 实际 "$ACTUAL"" - exit 1 - fi - - LOG_INFO "步骤6: 清理测试环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载 python3-bracex 软件包" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载 python3-bracex 失败" - else - LOG_INFO "保持 python3-bracex 软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_seq_expand.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_seq_expand.sh deleted file mode 100644 index aae3498b5e4..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_seq_expand.sh +++ /dev/null @@ -1,126 +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-27 -# @License : Mulan PSL v2 -# @Desc : 测试bracex的数字序列扩展功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试bracex的数字序列扩展功能" - - # 检查是否已安装python3-bracex - LOG_INFO "检查python3-bracex是否已安装" - if rpm -q python3-bracex > /dev/null 2>&1; then - LOG_INFO "python3-bracex已安装,测试结束后保持安装状态" - already_installed=1 - else - LOG_INFO "python3-bracex未安装,将在测试前安装" - already_installed=0 - fi - - # 检查yum源中是否有python3-bracex软件包 - LOG_INFO "检查yum源中是否有python3-bracex软件包" - if ! dnf list available python3-bracex > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-bracex软件包" - exit 255 - fi - - # 如果未安装,则安装python3-bracex - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装python3-bracex" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装python3-bracex失败" - fi - - # 测试bracex的数字序列扩展功能 - LOG_INFO "测试bracex的数字序列扩展功能" - - # 测试基本数字序列扩展 - LOG_INFO "测试基本数字序列扩展:{1..5}" - result=$(python3 -c "import bracex; print(bracex.expand("{1..5}"))") - expected="["1", "2", "3", "4", "5"]" - if [ "$result" == "$expected" ]; then - LOG_INFO "基本数字序列扩展测试通过" - else - LOG_ERROR "基本数字序列扩展测试失败" - LOG_ERROR "期望: $expected" - LOG_ERROR "实际: $result" - exit 1 - fi - - # 测试带步长的数字序列扩展 - LOG_INFO "测试带步长的数字序列扩展:{1..10..2}" - result=$(python3 -c "import bracex; print(bracex.expand("{1..10..2}"))") - expected="["1", "3", "5", "7", "9"]" - if [ "$result" == "$expected" ]; then - LOG_INFO "带步长的数字序列扩展测试通过" - else - LOG_ERROR "带步长的数字序列扩展测试失败" - LOG_ERROR "期望: $expected" - LOG_ERROR "实际: $result" - exit 1 - fi - - # 测试降序数字序列扩展 - LOG_INFO "测试降序数字序列扩展:{10..1..-2}" - result=$(python3 -c "import bracex; print(bracex.expand("{10..1..-2}"))") - expected="["10", "8", "6", "4", "2"]" - if [ "$result" == "$expected" ]; then - LOG_INFO "降序数字序列扩展测试通过" - else - LOG_ERROR "降序数字序列扩展测试失败" - LOG_ERROR "期望: $expected" - LOG_ERROR "实际: $result" - exit 1 - fi - - # 测试带前导零的数字序列扩展 - LOG_INFO "测试带前导零的数字序列扩展:{01..05}" - result=$(python3 -c "import bracex; print(bracex.expand("{01..05}"))") - expected="["01", "02", "03", "04", "05"]" - if [ "$result" == "$expected" ]; then - LOG_INFO "带前导零的数字序列扩展测试通过" - else - LOG_ERROR "带前导零的数字序列扩展测试失败" - LOG_ERROR "期望: $expected" - LOG_ERROR "实际: $result" - exit 1 - fi - - # 测试无效参数(不支持的格式) - LOG_INFO "测试无效参数:{a..z}" - if python3 -c "import bracex; bracex.expand("{a..z}")" > /dev/null 2>&1; then - LOG_ERROR "无效参数测试失败,应检测到不支持格式" - exit 255 - else - LOG_INFO "无效参数测试通过,正确检测到不支持格式" - fi - - # 清理环境 - LOG_INFO "清理测试环境" - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载python3-bracex" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载python3-bracex失败" - else - LOG_INFO "保持python3-bracex安装状态" - fi - - LOG_INFO "bracex数字序列扩展功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_uninstall.sh b/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_uninstall.sh deleted file mode 100644 index c6e182be3c1..00000000000 --- a/testcases/function_test/pkg_test/python-bracex/python3-bracex/test_python3-bracex_function_uninstall.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-02-27 -# @License : Mulan PSL v2 -# @Desc : 测试python3-bracex软件包的卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-bracex软件包的卸载功能" - - LOG_INFO "检查系统中是否已安装python3-bracex软件包" - if rpm -q python3-bracex > /dev/null 2>&1; then - LOG_INFO "检测到python3-bracex已安装,记录当前状态" - INSTALLED="true" - else - LOG_INFO "未检测到python3-bracex安装" - INSTALLED="false" - fi - - LOG_INFO "检查yum源中是否存在python3-bracex软件包" - if ! dnf list available python3-bracex > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-bracex软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "执行安装python3-bracex软件包" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "安装python3-bracex软件包失败" - fi - - LOG_INFO "测试卸载python3-bracex软件包" - dnf remove -y python3-bracex - CHECK_RESULT $? 0 0 "卸载python3-bracex软件包失败" - - LOG_INFO "验证软件包是否已成功卸载" - if rpm -q python3-bracex > /dev/null 2>&1; then - LOG_ERROR "软件包卸载后仍存在" - CHECK_RESULT 1 0 0 "卸载验证失败" - else - LOG_INFO "软件包已成功卸载" - fi - - LOG_INFO "环境恢复:根据初始状态决定是否重新安装" - if [ "$INSTALLED" = "true" ]; then - LOG_INFO "重新安装python3-bracex以恢复原始状态" - dnf install -y python3-bracex - CHECK_RESULT $? 0 0 "恢复安装python3-bracex失败" - LOG_INFO "环境已恢复到初始安装状态" - else - LOG_INFO "初始状态未安装,无需额外恢复" - fi - - LOG_INFO "python3-bracex软件包卸载功能测试完成" -} - -main "$@" \ No newline at end of file From 1265a238cc73ecc5bae44c57fd06c6c542ac8def Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:49:47 +0800 Subject: [PATCH 10/25] update testcase for testsuite maven-enforcer-rules --- .../maven-enforcer/maven-enforcer-rules.json | 50 ------- ...ven-enforcer-rules_function_banned_deps.sh | 72 ---------- ...ven-enforcer-rules_function_basic_usage.sh | 132 ------------------ ...ven-enforcer-rules_function_custom_rule.sh | 68 --------- ...enforcer-rules_function_dep_convergence.sh | 76 ---------- ...aven-enforcer-rules_function_dependency.sh | 64 --------- .../test_maven-enforcer-rules_function_env.sh | 103 -------------- ...t_maven-enforcer-rules_function_install.sh | 114 --------------- ...st_maven-enforcer-rules_function_plugin.sh | 108 -------------- ...enforcer-rules_function_require_release.sh | 114 --------------- ...test_maven-enforcer-rules_function_skip.sh | 126 ----------------- ...t_maven-enforcer-rules_function_version.sh | 66 --------- 12 files changed, 1093 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules.json delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_banned_deps.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_basic_usage.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_custom_rule.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dep_convergence.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dependency.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_env.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_install.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_plugin.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_require_release.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_skip.sh delete mode 100644 testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_version.sh diff --git a/suite2cases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules.json b/suite2cases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules.json deleted file mode 100644 index 6d164e77584..00000000000 --- a/suite2cases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules", - "machine num": 1, - "cases": [ - { - "name": "test_maven-enforcer-rules_function_dependency", - "desc": "Test dependency enforcement rules" - }, - { - "name": "test_maven-enforcer-rules_function_version", - "desc": "Test version enforcement rules" - }, - { - "name": "test_maven-enforcer-rules_function_plugin", - "desc": "Test plugin enforcement rules" - }, - { - "name": "test_maven-enforcer-rules_function_env", - "desc": "Test environment enforcement rules" - }, - { - "name": "test_maven-enforcer-rules_function_install", - "desc": "Test installation of maven-enforcer-plugin via Maven" - }, - { - "name": "test_maven-enforcer-rules_function_basic_usage", - "desc": "Test basic rule execution in Maven build" - }, - { - "name": "test_maven-enforcer-rules_function_dep_convergence", - "desc": "Test dependency convergence rule" - }, - { - "name": "test_maven-enforcer-rules_function_banned_deps", - "desc": "Test banned dependencies rule" - }, - { - "name": "test_maven-enforcer-rules_function_require_release", - "desc": "Test require release version rule" - }, - { - "name": "test_maven-enforcer-rules_function_custom_rule", - "desc": "Test execution of a custom user rule" - }, - { - "name": "test_maven-enforcer-rules_function_skip", - "desc": "Test ability to skip enforcer execution" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_banned_deps.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_banned_deps.sh deleted file mode 100644 index 5bbc0a8fc4f..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_banned_deps.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-03-16 -# @License : Mulan PSL v2 -# @Desc : Test banned dependencies rule -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test banned dependencies rule" - - LOG_INFO "步骤1: 检查环境中是否已安装maven-enforcer-rules软件包" - rpm -q maven-enforcer-rules > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "maven-enforcer-rules已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "maven-enforcer-rules未安装,将在测试过程中安装并在测试后卸载" - INSTALLED_BEFORE_TEST=false - fi - - LOG_INFO "步骤2: 检查yum源中是否有maven-enforcer-rules软件包" - dnf list available maven-enforcer-rules > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到maven-enforcer-rules软件包" - - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤3: 安装maven-enforcer-rules软件包" - dnf install -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "安装maven-enforcer-rules软件包失败" - fi - - LOG_INFO "步骤4: 执行banned dependencies规则测试" - mvn enforcer:enforce -Drules=bannedDependencies > /tmp/enforcer_output.txt 2>&1 - ENFORCER_EXIT_CODE=$? - - if [ $ENFORCER_EXIT_CODE -eq 0 ]; then - LOG_INFO "banned dependencies规则检查通过,未发现禁止的依赖" - elif [ $ENFORCER_EXIT_CODE -eq 1 ]; then - LOG_ERROR "banned dependencies规则检查失败,发现禁止的依赖" - grep -q "bannedDependencies" /tmp/enforcer_output.txt - CHECK_RESULT $? 0 0 "未在输出中找到bannedDependencies相关信息" - else - LOG_ERROR "执行maven enforcer命令失败,退出码: $ENFORCER_EXIT_CODE" - exit $ENFORCER_EXIT_CODE - fi - - LOG_INFO "步骤5: 清理临时文件" - rm -f /tmp/enforcer_output.txt - - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤6: 卸载测试过程中安装的maven-enforcer-rules软件包" - dnf remove -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "卸载maven-enforcer-rules软件包失败" - fi - - LOG_INFO "测试完成:Test banned dependencies rule" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_basic_usage.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_basic_usage.sh deleted file mode 100644 index e68f3c57511..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_basic_usage.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-16 -# @License : Mulan PSL v2 -# @Desc : Test basic rule execution in Maven build -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装maven-enforcer-plugin - LOG_INFO "检查是否已安装maven-enforcer-plugin" - if dnf list installed | grep -q "maven-enforcer-plugin"; then - LOG_INFO "maven-enforcer-plugin已安装,测试结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "maven-enforcer-plugin未安装,将在测试前安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有maven-enforcer-plugin软件包 - LOG_INFO "检查yum源中是否有maven-enforcer-plugin软件包" - if ! dnf search maven-enforcer-plugin | grep -q "maven-enforcer-plugin"; then - LOG_ERROR "yum源中未找到maven-enforcer-plugin软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装maven-enforcer-plugin软件包" - dnf install -y maven-enforcer-plugin - CHECK_RESULT $? 0 0 "安装maven-enforcer-plugin失败" - fi - - # 创建测试用的Maven项目目录 - LOG_INFO "创建测试用的Maven项目目录" - TEST_DIR="/tmp/test_maven_enforcer" - rm -rf "$TEST_DIR" - mkdir -p "$TEST_DIR" - cd "$TEST_DIR" || exit 1 - - # 创建pom.xml文件 - LOG_INFO "创建pom.xml文件" - cat > pom.xml << EOF - - - 4.0.0 - - com.test - test-enforcer - 1.0 - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0 - - - enforce - - enforce - - - - - 1.8 - - - - - - - - - - EOF - - # 测试基本的Maven构建 - LOG_INFO "执行Maven构建测试" - mvn clean compile - CHECK_RESULT $? 0 0 "Maven构建失败" - - # 测试maven-enforcer-plugin执行 - LOG_INFO "执行maven-enforcer-plugin测试" - mvn enforcer:enforce - CHECK_RESULT $? 0 0 "maven-enforcer-plugin执行失败" - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数" - if mvn enforcer:enforce --nonexistent-param 2>&1 | grep -q "Unrecognized option"; then - LOG_INFO "参数检查正常:不支持的参数被正确拒绝" - else - LOG_ERROR "不支持的参数未被正确识别" - exit 255 - fi - - # 清理测试目录 - LOG_INFO "清理测试目录" - cd /tmp || exit 1 - rm -rf "$TEST_DIR" - - # 如果测试前未安装,则在测试后卸载 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载maven-enforcer-plugin软件包" - dnf remove -y maven-enforcer-plugin - CHECK_RESULT $? 0 0 "卸载maven-enforcer-plugin失败" - LOG_INFO "环境已恢复到测试前状态" - else - LOG_INFO "保持maven-enforcer-plugin安装状态" - fi - - LOG_INFO "测试完成:Maven构建中基本规则执行测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_custom_rule.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_custom_rule.sh deleted file mode 100644 index df88dbd8be6..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_custom_rule.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 : 2026-03-16 -# @License : Mulan PSL v2 -# @Desc : Test execution of a custom user rule -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:测试自定义用户规则的执行" - LOG_INFO "步骤1:检查环境是否已安装maven-enforcer-rules软件包" - if dnf list installed | grep -q "maven-enforcer-rules"; then - LOG_INFO "maven-enforcer-rules已安装,脚本结束将保持安装状态" - INSTALLED=true - else - LOG_INFO "maven-enforcer-rules未安装,将在测试步骤中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有maven-enforcer-rules软件包" - if ! dnf list available | grep -q "maven-enforcer-rules"; then - LOG_ERROR "yum源中没有找到maven-enforcer-rules软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装maven-enforcer-rules软件包" - dnf install -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "安装maven-enforcer-rules失败" - fi - - LOG_INFO "步骤4:执行自定义用户规则测试" - LOG_INFO "步骤4.1:检查自定义规则命令是否存在" - if ! command -v custom-rule-command &> /dev/null; then - LOG_ERROR "自定义规则命令不存在或不支持" - exit 255 - fi - - LOG_INFO "步骤4.2:执行自定义规则命令" - custom-rule-command --test-param - CHECK_RESULT $? 0 0 "执行自定义规则命令失败" - - LOG_INFO "步骤5:清理环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤5.1:卸载maven-enforcer-rules软件包" - dnf remove -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "卸载maven-enforcer-rules失败" - else - LOG_INFO "步骤5.1:保持maven-enforcer-rules安装状态,无需卸载" - fi - - LOG_INFO "测试结束:自定义用户规则的执行测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dep_convergence.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dep_convergence.sh deleted file mode 100644 index 094d1a89770..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dep_convergence.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-16 -# @License : Mulan PSL v2 -# @Desc : Test dependency convergence rule -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试依赖收敛规则功能" - - # 检查maven-enforcer-plugin是否已安装 - LOG_INFO "检查maven-enforcer-plugin是否已安装" - if dnf list installed maven-enforcer-plugin &> /dev/null; then - LOG_INFO "maven-enforcer-plugin已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "maven-enforcer-plugin未安装,将进行安装" - INSTALLED=false - fi - - # 检查yum源中是否有maven-enforcer-plugin软件包 - LOG_INFO "检查yum源中是否有maven-enforcer-plugin软件包" - if ! dnf list available maven-enforcer-plugin &> /dev/null; then - LOG_ERROR "yum源中没有找到maven-enforcer-plugin软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装maven-enforcer-plugin软件包" - dnf install -y maven-enforcer-plugin - CHECK_RESULT $? 0 0 "安装maven-enforcer-plugin失败" - fi - - # 测试依赖收敛规则功能 - LOG_INFO "测试依赖收敛规则功能" - # 这里假设有一个测试命令,例如检查依赖收敛规则是否正常工作 - # 由于实际命令未知,使用一个示例命令,实际应根据测试用例调整 - SAMPLE_COMMAND="mvn enforcer:enforce -Drules=dependencyConvergence" - if ! command -v mvn &> /dev/null; then - LOG_ERROR "mvn命令不存在或不支持" - exit 255 - fi - - # 执行测试命令 - LOG_INFO "执行测试命令: $SAMPLE_COMMAND" - $SAMPLE_COMMAND - CHECK_RESULT $? 0 0 "依赖收敛规则测试失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载maven-enforcer-plugin软件包" - dnf remove -y maven-enforcer-plugin - CHECK_RESULT $? 0 0 "卸载maven-enforcer-plugin失败" - else - LOG_INFO "测试前已安装maven-enforcer-plugin,保持安装状态" - fi - - LOG_INFO "依赖收敛规则功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dependency.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dependency.sh deleted file mode 100644 index 28ec858880f..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_dependency.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-11-29 -# @License : Mulan PSL v2 -# @Desc : Test dependency enforcement rules -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:test_maven-enforcer-rules_function_dependency - - # 检查环境是否已安装 - LOG_INFO "检查环境是否已安装" - if dnf list installed maven-enforcer-rules &>/dev/null; then - LOG_INFO "环境已安装,脚本结束时保持安装状态" - INSTALLED=true - else - LOG_INFO "环境未安装,测试步骤中将安装软件包" - INSTALLED=false - fi - - # 检查yum源中是否有maven-enforcer-rules软件包 - LOG_INFO "检查yum源中是否有maven-enforcer-rules软件包" - if ! dnf list available maven-enforcer-rules &>/dev/null; then - LOG_ERROR "yum源中未找到maven-enforcer-rules软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装maven-enforcer-rules软件包" - dnf install -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "安装maven-enforcer-rules软件包失败" - fi - - # 测试dependency enforcement rules功能 - LOG_INFO "测试dependency enforcement rules功能" - mvn enforcer:enforce -Drules=dependency - CHECK_RESULT $? 0 0 "dependency enforcement rules功能测试失败" - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载maven-enforcer-rules软件包" - dnf remove -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "卸载maven-enforcer-rules软件包失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_env.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_env.sh deleted file mode 100644 index 0fdc5099ef8..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_env.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-13 -# @License : Mulan PSL v2 -# @Desc : Test environment enforcement rules -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装指定软件包 - check_package_installed() { - dnf list installed "$1" &>/dev/null - return $? - } - - # 检查yum源中是否有指定软件包 - check_package_available() { - dnf list available "$1" &>/dev/null - return $? - } - - # 安装软件包 - install_package() { - LOG_INFO "开始安装软件包: $1" - dnf install -y "$1" - CHECK_RESULT $? 0 0 "安装软件包 $1 失败" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "开始卸载软件包: $1" - dnf remove -y "$1" - CHECK_RESULT $? 0 0 "卸载软件包 $1 失败" - } - - # 检查命令参数是否支持 - check_command_param() { - local cmd=$1 - local param=$2 - $cmd --help | grep -q "$param" - return $? - } - - # 主测试函数 - test_maven_enforcer_rules_function_env() { - local package_name="maven-enforcer-rules" - - # 检查环境是否已安装 - LOG_INFO "检查环境是否已安装 $package_name" - if check_package_installed "$package_name"; then - LOG_INFO "环境已安装 $package_name,测试完成后保持安装状态" - local need_uninstall=false - else - LOG_INFO "环境未安装 $package_name,测试完成后将卸载" - local need_uninstall=true - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有 $package_name" - if ! check_package_available "$package_name"; then - LOG_ERROR "yum源中没有找到 $package_name,退出测试" - exit 255 - fi - - # 安装软件包 - install_package "$package_name" - fi - - # 测试命令参数是否支持 - LOG_INFO "测试命令参数是否支持" - if ! check_command_param "mvn" "-DskipTests"; then - LOG_ERROR "命令参数不支持,退出测试" - exit 255 - fi - - # 执行测试命令 - LOG_INFO "执行测试命令" - - - - # 清理环境(如果需要) - - } - - # 调用主测试函数 - test_maven_enforcer_rules_function_env - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_install.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_install.sh deleted file mode 100644 index 608b646bdbf..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_install.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-03-16 -# @License : Mulan PSL v2 -# @Desc : Test installation of maven-enforcer-plugin via Maven -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装Maven - LOG_INFO "检查Maven是否已安装" - if command -v mvn &> /dev/null; then - LOG_INFO "Maven已安装,跳过安装步骤" - maven_installed=true - else - LOG_INFO "Maven未安装,将进行安装和卸载测试" - maven_installed=false - fi - - # 检查yum源中是否有maven软件包 - LOG_INFO "检查yum源中是否有maven软件包" - dnf list available maven &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有maven软件包" - exit 255 - fi - - # 如果Maven未安装,则安装Maven - if [ "$maven_installed" = false ]; then - LOG_INFO "安装Maven" - dnf install -y maven - CHECK_RESULT $? 0 0 "Maven安装失败" - fi - - # 创建测试项目目录 - LOG_INFO "创建Maven测试项目目录" - test_dir="/tmp/test_maven_project" - rm -rf "$test_dir" - mkdir -p "$test_dir" - cd "$test_dir" || exit 1 - - # 创建简单的pom.xml文件 - LOG_INFO "创建测试项目的pom.xml文件" - cat > pom.xml << EOF - - 4.0.0 - - com.test - test-project - 1.0.0 - jar - - - 1.8 - 1.8 - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0 - - - enforce - - enforce - - - - - - - - EOF - - # 测试maven-enforcer-plugin的安装 - LOG_INFO "测试maven-enforcer-plugin的安装" - mvn enforcer:enforce -DskipTests - CHECK_RESULT $? 0 0 "maven-enforcer-plugin安装或执行失败" - - # 清理测试目录 - LOG_INFO "清理测试目录" - cd /tmp || exit 1 - rm -rf "$test_dir" - - # 如果测试前未安装Maven,则卸载Maven - if [ "$maven_installed" = false ]; then - LOG_INFO "卸载Maven" - dnf remove -y maven - CHECK_RESULT $? 0 0 "Maven卸载失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_plugin.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_plugin.sh deleted file mode 100644 index 093ccf678f3..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_plugin.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-13 -# @License : Mulan PSL v2 -# @Desc : Test plugin enforcement rules -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查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 | grep -q "$option" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $command 不支持参数 $option" - exit 255 - fi - } - - # 检查环境是否已安装指定软件包 - check_installed() { - local package_name=$1 - 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 失败" - } - - # 卸载软件包 - uninstall_package() { - local package_name=$1 - LOG_INFO "正在卸载软件包 $package_name" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败" - } - - # 主测试函数 - test_maven_enforcer_rules_plugin() { - local package_name="maven-enforcer-rules" - - # 步骤1:检查yum源中是否存在maven-enforcer-rules插件 - LOG_INFO "步骤1:检查yum源中是否存在maven-enforcer-rules插件" - check_package_in_repo "$package_name" - - # 步骤2:检查环境是否已安装maven-enforcer-rules插件 - LOG_INFO "步骤2:检查环境是否已安装maven-enforcer-rules插件" - - local need_uninstall=0 - if ! check_installed "$package_name"; then - need_uninstall=1 - LOG_INFO "环境未安装 $package_name,将进行安装测试" - install_package "$package_name" - else - LOG_INFO "环境已安装 $package_name,跳过安装步骤" - fi - - # 步骤3:测试enforcer插件的命令参数 - LOG_INFO "步骤3:测试enforcer插件的命令参数" - check_command_option "mvn" "--enforce" - - #执行具体测试逻辑 - LOG_INFO "执行具体的测试逻辑..." - mvn --enforce - CHECK_RESULT $? "具体预期结果" "实际结果" "失败原因" - - # 恢复环境 - if [ $need_uninstall -eq 1 ]; then - uninstall_package "$package-name" - fi - } - - #执行主测试函数 - test_maven_enforcer_rules_plugin - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_require_release.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_require_release.sh deleted file mode 100644 index 0b6e2087b70..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_require_release.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-03-16 -# @License : Mulan PSL v2 -# @Desc : Test require release version rule -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本开始 - # 测试用例:Test require release version rule - - # 步骤1:检查环境是否已安装maven-enforcer-rules软件包 - LOG_INFO "步骤1:检查maven-enforcer-rules软件包是否已安装" - if rpm -q maven-enforcer-rules > /dev/null 2>&1; then - LOG_INFO "maven-enforcer-rules已安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "maven-enforcer-rules未安装,将在测试步骤中安装" - ALREADY_INSTALLED=0 - fi - - # 步骤2:检查yum源中是否有maven-enforcer-rules软件包 - LOG_INFO "步骤2:检查yum源中是否有maven-enforcer-rules软件包" - dnf list available maven-enforcer-rules > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到maven-enforcer-rules软件包" - exit 255 - fi - - # 步骤3:安装maven-enforcer-rules软件包(如果未安装) - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装maven-enforcer-rules软件包" - dnf install -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "安装maven-enforcer-rules软件包失败" - fi - - # 步骤4:检查maven-enforcer-rules命令是否可用 - LOG_INFO "步骤4:检查maven-enforcer-rules命令是否可用" - if ! command -v mvn > /dev/null 2>&1; then - LOG_ERROR "mvn命令不存在" - if [ $ALREADY_INSTALLED -eq 0 ]; then - dnf remove -y maven-enforcer-rules - fi - exit 255 - fi - - # 步骤5:测试require release version rule功能 - LOG_INFO "步骤5:测试require release version rule功能" - # 这里假设测试命令是检查某个项目的发布版本规则 - # 示例:mvn enforcer:enforce -Drules=requireReleaseVersion - # 如果参数不支持,则退出码为255 - mvn enforcer:enforce -Drules=requireReleaseVersion --help > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "requireReleaseVersion参数不存在或不支持" - if [ $ALREADY_INSTALLED -eq 0 ]; then - dnf remove -y maven-enforcer-rules - fi - exit 255 - fi - - # 步骤6:执行实际的测试命令 - LOG_INFO "步骤6:执行require release version rule测试" - # 示例测试:在一个示例项目上执行规则检查 - TEST_PROJECT_DIR="/tmp/test_maven_project" - mkdir -p $TEST_PROJECT_DIR - cd $TEST_PROJECT_DIR - - # 创建最简单的pom.xml文件用于测试 - cat > pom.xml << EOF - - 4.0.0 - com.example - test-project - 1.0-SNAPSHOT - - EOF - - # 执行maven enforcer规则检查 - mvn enforcer:enforce -Drules=requireReleaseVersion - CHECK_RESULT $? 0 1 "require release version rule测试失败(预期失败,因为版本是SNAPSHOT)" - - # 步骤7:清理测试项目 - LOG_INFO "步骤7:清理测试项目" - cd / - rm -rf $TEST_PROJECT_DIR - - # 步骤8:恢复环境 - LOG_INFO "步骤8:恢复测试环境" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的maven-enforcer-rules软件包" - dnf remove -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "卸载maven-enforcer-rules软件包失败" - else - LOG_INFO "保持maven-enforcer-rules软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_skip.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_skip.sh deleted file mode 100644 index 81ee7076a27..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_skip.sh +++ /dev/null @@ -1,126 +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-16 -# @License : Mulan PSL v2 -# @Desc : Test ability to skip enforcer execution -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:Test ability to skip enforcer execution" - - LOG_INFO "步骤1:检查环境中是否已安装maven-enforcer-plugin相关包" - if dnf list installed | grep -q maven-enforcer-plugin; then - INSTALLED=true - LOG_INFO "环境中已安装maven-enforcer-plugin,测试结束后将保持安装状态" - else - INSTALLED=false - LOG_INFO "环境中未安装maven-enforcer-plugin,将作为测试步骤进行安装" - fi - - LOG_INFO "步骤2:检查yum源中是否存在maven-enforcer-plugin软件包" - if ! dnf list available maven-enforcer-plugin &>/dev/null; then - LOG_ERROR "yum源中未找到maven-enforcer-plugin软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装maven-enforcer-plugin软件包" - dnf install -y maven-enforcer-plugin - CHECK_RESULT $? 0 0 "安装maven-enforcer-plugin失败" - fi - - LOG_INFO "步骤4:验证maven-enforcer-plugin基本命令可用性" - mvn enforcer:help &>/dev/null - CHECK_RESULT $? 0 0 "maven-enforcer-plugin基本命令执行失败" - - LOG_INFO "步骤5:测试跳过enforcer执行的参数支持情况" - if ! mvn enforcer:enforce --help 2>&1 | grep -q "\-\-skip"; then - LOG_ERROR "maven-enforcer-plugin不支持skip参数" - exit 255 - fi - - LOG_INFO "步骤6:创建测试用的简单Maven项目" - TEST_DIR="/tmp/test_maven_project_$$" - mkdir -p "$TEST_DIR" - cd "$TEST_DIR" - cat > pom.xml << "EOF" - - 4.0.0 - test - test-project - 1.0 - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0 - - - enforce - - enforce - - - - - 1.8 - - - - - - - - - - EOF - - LOG_INFO "步骤7:正常执行enforcer规则(预期失败,因为Java版本可能不符合)" - mvn enforcer:enforce -e 2>&1 | grep -q "BUILD SUCCESS" - NORMAL_EXIT=$? - - LOG_INFO "步骤8:使用--skip参数跳过enforcer执行" - mvn enforcer:enforce -Dskip=true -e 2>&1 | grep -q "BUILD SUCCESS" - CHECK_RESULT $? 0 0 "使用skip参数执行enforcer失败" - - if [ "$NORMAL_EXIT" -ne 0 ]; then - LOG_INFO "步骤9:验证skip参数确实跳过了规则检查" - LOG_INFO "正常执行失败但skip执行成功,验证通过" - else - LOG_INFO "步骤9:正常执行也成功,skip功能验证通过" - fi - - LOG_INFO "步骤10:清理测试项目" - cd / - rm -rf "$TEST_DIR" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤11:卸载测试安装的maven-enforcer-plugin软件包" - dnf remove -y maven-enforcer-plugin - CHECK_RESULT $? 0 0 "卸载maven-enforcer-plugin失败" - LOG_INFO "环境已恢复至测试前状态" - else - LOG_INFO "步骤11:保持原有maven-enforcer-plugin安装状态" - fi - - LOG_INFO "测试完成:Test ability to skip enforcer execution" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_version.sh b/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_version.sh deleted file mode 100644 index bf2698f8ee2..00000000000 --- a/testcases/function_test/pkg_test/maven-enforcer/maven-enforcer-rules/test_maven-enforcer-rules_function_version.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-13 -# @License : Mulan PSL v2 -# @Desc : Test version enforcement rules -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已经安装maven-enforcer-rules - LOG_INFO "检查是否已经安装maven-enforcer-rules" - dnf list installed maven-enforcer-rules > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "maven-enforcer-rules已经安装" - installed=true - else - LOG_INFO "maven-enforcer-rules未安装" - installed=false - fi - - # 检查yum源中是否有maven-enforcer-rules软件包 - LOG_INFO "检查yum源中是否有maven-enforcer-rules软件包" - dnf list available maven-enforcer-rules > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到maven-enforcer-rules软件包" - exit 255 - fi - - # 安装maven-enforcer-rules(如果未安装) - if [ "$installed" = false ]; then - LOG_INFO "开始安装maven-enforcer-rules" - dnf install -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "安装maven-enforcer-rules失败" - fi - - # 测试version enforcement rules功能 - LOG_INFO "测试version enforcement rules功能" - mvn enforcer:enforce -Drules=version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "执行version enforcement rules失败" - - # 卸载maven-enforcer-rules(如果之前未安装) - if [ "$installed" = false ]; then - LOG_INFO "卸载maven-enforcer-rules" - dnf remove -y maven-enforcer-rules - CHECK_RESULT $? 0 0 "卸载maven-enforcer-rules失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file From 27441ac8359e549430160c5f9ad84ded117c370b Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:50:23 +0800 Subject: [PATCH 11/25] update testcase for testsuite python-jaraco-collections-help --- .../python-jaraco-collections-help.json | 22 ----- ...n-jaraco-collections-help_function_join.sh | 73 ---------------- ...on-jaraco-collections-help_function_map.sh | 81 ------------------ ...t_python-jaraco-collections-help_import.sh | 64 -------------- ..._python-jaraco-collections-help_install.sh | 83 ------------------- 5 files changed, 323 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help.json delete mode 100644 testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_join.sh delete mode 100644 testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_map.sh delete mode 100644 testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_import.sh delete mode 100644 testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_install.sh diff --git a/suite2cases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help.json b/suite2cases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help.json deleted file mode 100644 index 5a2eabeda35..00000000000 --- a/suite2cases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help", - "machine num": 1, - "cases": [ - { - "name": "test_python-jaraco-collections-help_install", - "desc": "测试软件包可以通过pip正常安装" - }, - { - "name": "test_python-jaraco-collections-help_import", - "desc": "测试成功导入软件包的主要模块或函数" - }, - { - "name": "test_python-jaraco-collections-help_function_map", - "desc": "测试collections模块的map函数功能" - }, - { - "name": "test_python-jaraco-collections-help_function_join", - "desc": "测试collections模块的join函数功能" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_join.sh b/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_join.sh deleted file mode 100644 index 0ff6cf6ebbc..00000000000 --- a/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_join.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 : 测试collections模块的join函数功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试collections模块的join函数功能" - - # 检查环境是否已安装python3-jaraco-collections包 - LOG_INFO "检查是否已安装python3-jaraco-collections包" - if dnf list installed python3-jaraco-collections &>/dev/null; then - LOG_INFO "python3-jaraco-collections包已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "python3-jaraco-collections包未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有python3-jaraco-collections包 - LOG_INFO "检查yum源中是否有python3-jaraco-collections包" - if ! dnf list available python3-jaraco-collections &>/dev/null; then - LOG_ERROR "yum源中未找到python3-jaraco-collections包" - exit 255 - fi - - # 如果环境未安装,则安装软件包作为测试步骤 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装python3-jaraco-collections包" - dnf install -y python3-jaraco-collections - CHECK_RESULT $? 0 0 "安装python3-jaraco-collections包失败" - fi - - # 测试collections模块的join函数功能 - LOG_INFO "测试collections模块的join函数功能" - python3 -c " - from jaraco.collections import Projection - data = [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}] - proj = Projection("name") - result = proj.join(data, ", ") - print(result) - expected = "Alice, Bob" - assert result == expected, f"Expected: {expected}, Got: {result}" - print("join函数功能测试通过") - " - CHECK_RESULT $? 0 0 "collections模块的join函数功能测试失败" - - # 环境恢复:如果之前未安装,则在脚本结束前卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载python3-jaraco-collections包" - dnf remove -y python3-jaraco-collections - CHECK_RESULT $? 0 0 "卸载python3-jaraco-collections包失败" - fi - - LOG_INFO "测试collections模块的join函数功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_map.sh b/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_map.sh deleted file mode 100644 index 07a2db88547..00000000000 --- a/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_function_map.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-28 -# @License : Mulan PSL v2 -# @Desc : 测试collections模块的map函数功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试collections模块的map函数功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查python3-jaraco-collections软件包是否在yum源中" - dnf list available python3-jaraco-collections > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-jaraco-collections软件包" - exit 255 - fi - - # 检查是否已安装python3-jaraco-collections - LOG_INFO "检查python3-jaraco-collections是否已安装" - rpm -q python3-jaraco-collections > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-jaraco-collections已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "python3-jaraco-collections未安装,将在测试前安装" - INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-jaraco-collections" - dnf install -y python3-jaraco-collections - CHECK_RESULT $? 0 0 "安装python3-jaraco-collections失败" - fi - - # 测试map函数功能 - LOG_INFO "测试collections模块的map函数功能" - python3 -c " - from jaraco.collections import Projection - data = {"a": 1, "b": 2, "c": 3} - keys = ["a", "c"] - result = Projection(keys, data) - print("原始数据:", data) - print("映射键:", keys) - print("映射结果:", dict(result)) - expected = {"a": 1, "c": 3} - if dict(result) == expected: - print("测试通过") - exit(0) - else: - print("测试失败") - exit(1) - " - CHECK_RESULT $? 0 0 "collections模块的map函数功能测试失败" - - # 如果测试前未安装,则在测试后卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-jaraco-collections" - dnf remove -y python3-jaraco-collections - CHECK_RESULT $? 0 0 "卸载python3-jaraco-collections失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_import.sh b/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_import.sh deleted file mode 100644 index 2142e769e35..00000000000 --- a/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_import.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 : 2026-03-28 -# @License : Mulan PSL v2 -# @Desc : 测试成功导入软件包的主要模块或函数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="python3-jaraco-collections-help" - MODULE_NAME="jaraco.collections" - - LOG_INFO "开始测试:测试成功导入软件包的主要模块或函数" - LOG_INFO "步骤1:检查软件包在yum源中是否存在" - dnf list available ${PACKAGE_NAME} &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 在yum源中不存在" - exit 255 - fi - CHECK_RESULT $? 0 0 "检查软件包 ${PACKAGE_NAME} 在yum源中是否存在失败" - - LOG_INFO "步骤2:检查当前环境中是否已安装该软件包" - rpm -q ${PACKAGE_NAME} &> /dev/null - INSTALLED=$? - - if [ ${INSTALLED} -ne 0 ]; then - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,将进行安装" - LOG_INFO "步骤3:安装软件包 ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - else - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装" - fi - - LOG_INFO "步骤4:测试导入软件包的主要模块或函数" - python3 -c "import ${MODULE_NAME}" 2>&1 - CHECK_RESULT $? 0 0 "导入模块 ${MODULE_NAME} 失败" - - LOG_INFO "步骤5:环境恢复" - if [ ${INSTALLED} -ne 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/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_install.sh b/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_install.sh deleted file mode 100644 index 9f75742516e..00000000000 --- a/testcases/function_test/pkg_test/python-jaraco-collections/python-jaraco-collections-help/test_python-jaraco-collections-help_install.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-28 -# @License : Mulan PSL v2 -# @Desc : 测试软件包可以通过pip正常安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装python3-pip - if dnf list installed python3-pip &>/dev/null; then - LOG_INFO "python3-pip 已安装,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "python3-pip 未安装,将在测试中安装" - already_installed=false - fi - - # 检查yum源中是否有python-jaraco-collections软件包 - LOG_INFO "检查yum源中是否有python-jaraco-collections软件包" - dnf list available python-jaraco-collections &>/dev/null - CHECK_RESULT $? 0 0 "yum源中未找到python-jaraco-collections软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python-jaraco-collections软件包" - exit 255 - fi - - # 检查pip命令是否支持install参数 - LOG_INFO "检查pip3命令是否支持install参数" - pip3 install --help | grep -q "\-\-no-index" - CHECK_RESULT $? 0 0 "pip3命令不支持install参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pip3命令不支持install参数" - exit 255 - fi - - # 如果未安装python3-pip,则安装 - if [ "$already_installed" = false ]; then - LOG_INFO "安装python3-pip软件包" - dnf install -y python3-pip - CHECK_RESULT $? 0 0 "安装python3-pip失败" - fi - - # 测试通过pip安装python-jaraco-collections - LOG_INFO "通过pip3安装python-jaraco-collections" - pip3 install python-jaraco-collections - CHECK_RESULT $? 0 0 "通过pip安装python-jaraco-collections失败" - - # 验证安装是否成功 - LOG_INFO "验证python-jaraco-collections是否安装成功" - pip3 list | grep -q python-jaraco-collections - CHECK_RESULT $? 0 0 "python-jaraco-collections未安装成功" - - # 清理环境:如果测试前未安装python3-pip,则卸载安装的软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载python-jaraco-collections" - pip3 uninstall -y python-jaraco-collections - CHECK_RESULT $? 0 0 "卸载python-jaraco-collections失败" - - LOG_INFO "卸载python3-pip" - dnf remove -y python3-pip - CHECK_RESULT $? 0 0 "卸载python3-pip失败" - else - LOG_INFO "测试前已安装python3-pip,保持安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From 1650e701051d7db91715d64aedf44835dc8700cb Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:50:47 +0800 Subject: [PATCH 12/25] update testcase for testsuite nasm-help --- .../pkg_test/nasm/nasm-help.json | 8 -- .../nasm-help/test_nasm-help_function_help.sh | 72 ------------------ .../nasm-help/test_nasm-help_function_list.sh | 73 ------------------- 3 files changed, 153 deletions(-) delete mode 100644 testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_help.sh delete mode 100644 testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_list.sh diff --git a/suite2cases/function_test/pkg_test/nasm/nasm-help.json b/suite2cases/function_test/pkg_test/nasm/nasm-help.json index e4943042d19..0cd7dfd0219 100644 --- a/suite2cases/function_test/pkg_test/nasm/nasm-help.json +++ b/suite2cases/function_test/pkg_test/nasm/nasm-help.json @@ -17,14 +17,6 @@ { "name": "test_nasm-help_function_version", "desc": "Test version command usage" - }, - { - "name": "test_nasm-help_function_help", - "desc": "Test help command usage" - }, - { - "name": "test_nasm-help_function_list", - "desc": "Test list command usage" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_help.sh b/testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_help.sh deleted file mode 100644 index 922f51e492b..00000000000 --- a/testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_help.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 : Test help command usage -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查nasm是否已安装 - LOG_INFO "检查nasm是否已安装" - if rpm -q nasm &>/dev/null; then - LOG_INFO "nasm已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "nasm未安装,将在测试后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有nasm软件包 - LOG_INFO "检查yum源中是否有nasm软件包" - if ! dnf list available nasm &>/dev/null; then - LOG_ERROR "yum源中未找到nasm软件包" - exit 255 - fi - - # 安装nasm软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装nasm软件包" - dnf install -y nasm - CHECK_RESULT $? 0 0 "安装nasm失败" - fi - - # 测试help命令 - LOG_INFO "测试help命令" - nasm --help &>/dev/null - CHECK_RESULT $? 0 0 "nasm --help命令执行失败" - - # 测试无效参数(假设--invalid是不支持的参数) - LOG_INFO "测试无效参数" - nasm --invalid &>/dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "--invalid参数未被正确处理" - exit 255 - fi - - # 清理环境(如果最初未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载nasm软件包" - dnf remove -y nasm - CHECK_RESULT $? 0 0 "卸载nasm失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_list.sh b/testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_list.sh deleted file mode 100644 index cf7e866e699..00000000000 --- a/testcases/function_test/pkg_test/nasm/nasm-help/test_nasm-help_function_list.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 : 2025-12-06 -# @License : Mulan PSL v2 -# @Desc : Test list command usage -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试:Test list command usage" - - # 检查是否已安装nasm - LOG_INFO "检查是否已安装nasm" - if ! dnf list installed nasm &>/dev/null; then - LOG_INFO "nasm未安装,将进行安装" - INSTALLED=false - else - LOG_INFO "nasm已安装" - INSTALLED=true - fi - - # 检查yum源中是否有nasm软件包 - LOG_INFO "检查yum源中是否有nasm软件包" - if ! dnf list available nasm &>/dev/null; then - LOG_ERROR "yum源中未找到nasm软件包" - exit 255 - fi - - # 如果未安装,则安装nasm - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装nasm" - dnf install -y nasm - CHECK_RESULT $? 0 0 "安装nasm失败" - fi - - # 测试list命令 - LOG_INFO "测试nasm的list命令" - if ! nasm --help | grep -q "list"; then - LOG_ERROR "nasm不支持list参数" - exit 255 - fi - - # 执行list命令 - LOG_INFO "执行nasm --list" - nasm --list > /dev/null - CHECK_RESULT $? 0 0 "执行nasm --list失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载nasm" - dnf remove -y nasm - CHECK_RESULT $? 0 0 "卸载nasm失败" - fi - - LOG_INFO "测试完成:Test list command usage" - -} - -main "$@" \ No newline at end of file From 3f99fd46305dfc7bd1bdd6be94634c07d6ee84b5 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:52:05 +0800 Subject: [PATCH 13/25] update testcase for testsuite python3-trove-classifiers --- .../python3-trove-classifiers.json | 12 --- ...python3-trove-classifiers_function_find.sh | 73 ---------------- ...on3-trove-classifiers_function_list_all.sh | 67 --------------- ...on3-trove-classifiers_function_validate.sh | 86 ------------------- 4 files changed, 238 deletions(-) delete mode 100644 testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_find.sh delete mode 100644 testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_list_all.sh delete mode 100644 testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_validate.sh diff --git a/suite2cases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers.json b/suite2cases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers.json index 27dcb5a4a2d..ae4cfe01371 100644 --- a/suite2cases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers.json +++ b/suite2cases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers.json @@ -5,18 +5,6 @@ { "name": "test_python3-trove-classifiers_function_import", "desc": "测试能否成功导入 trove_classifiers 模块" - }, - { - "name": "test_python3-trove-classifiers_function_list_all", - "desc": "测试能否获取并验证所有分类器的列表" - }, - { - "name": "test_python3-trove-classifiers_function_find", - "desc": "测试能否根据关键字查找特定的分类器" - }, - { - "name": "test_python3-trove-classifiers_function_validate", - "desc": "测试能否验证一个给定的分类器字符串是否有效" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_find.sh b/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_find.sh deleted file mode 100644 index 7c7d5467cb4..00000000000 --- a/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_find.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-04-04 -# @License : Mulan PSL v2 -# @Desc : 测试能否根据关键字查找特定的分类器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "1. 检查系统中是否已安装python3-trove-classifiers软件包" - rpm -q python3-trove-classifiers > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到python3-trove-classifiers已安装,脚本结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "未检测到python3-trove-classifiers安装,将在测试中安装,并在脚本结束前卸载" - INSTALLED="false" - fi - - LOG_INFO "2. 检查yum源中是否存在python3-trove-classifiers软件包" - dnf list available python3-trove-classifiers > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到python3-trove-classifiers软件包" - - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "3. 安装python3-trove-classifiers软件包" - dnf install -y python3-trove-classifiers > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装python3-trove-classifiers失败" - fi - - LOG_INFO "4. 检查trove-classifiers命令是否存在" - which trove-classifiers > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未找到trove-classifiers命令" - - LOG_INFO "5. 测试trove-classifiers find命令是否支持" - trove-classifiers find --help > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "trove-classifiers命令不支持find参数" - - LOG_INFO "6. 测试能否根据关键字查找特定的分类器" - trove-classifiers find "Framework" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "根据关键字"Framework"查找分类器失败" - - LOG_INFO "7. 验证查找结果" - result=$(trove-classifiers find "Framework" | head -1) - if [[ "$result" == *"Framework"* ]]; then - LOG_INFO "查找结果包含关键字"Framework",测试成功" - else - LOG_ERROR "查找结果不包含关键字"Framework"" - exit 1 - fi - - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "8. 清理环境:卸载python3-trove-classifiers软件包" - dnf remove -y python3-trove-classifiers > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载python3-trove-classifiers失败" - fi - - LOG_INFO "9. 测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_list_all.sh b/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_list_all.sh deleted file mode 100644 index ba915eb9663..00000000000 --- a/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_list_all.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-04 -# @License : Mulan PSL v2 -# @Desc : 测试能否获取并验证所有分类器的列表 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试能否获取并验证所有分类器的列表" - LOG_INFO "步骤1:检查环境是否已安装python3-trove-classifiers" - if dnf list installed python3-trove-classifiers &> /dev/null; then - LOG_INFO "python3-trove-classifiers 已安装,测试后保持安装状态" - installed=true - else - LOG_INFO "python3-trove-classifiers 未安装,将在测试后卸载" - installed=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在python3-trove-classifiers软件包" - if ! dnf list available python3-trove-classifiers &> /dev/null; then - LOG_ERROR "yum源中未找到python3-trove-classifiers软件包" - exit 255 - fi - - if [ "$installed" = false ]; then - LOG_INFO "步骤3:安装python3-trove-classifiers软件包" - dnf install -y python3-trove-classifiers - CHECK_RESULT $? 0 0 "安装python3-trove-classifiers失败" - fi - - LOG_INFO "步骤4:执行命令获取所有分类器列表" - trove-classifiers list-all - CHECK_RESULT $? 0 0 "获取分类器列表失败" - - LOG_INFO "步骤5:验证分类器列表输出不为空" - output=$(trove-classifiers list-all) - if [ -z "$output" ]; then - LOG_ERROR "分类器列表输出为空" - exit 1 - else - LOG_INFO "分类器列表输出非空,验证成功" - fi - - if [ "$installed" = false ]; then - LOG_INFO "步骤6:卸载python3-trove-classifiers软件包" - dnf remove -y python3-trove-classifiers - CHECK_RESULT $? 0 0 "卸载python3-trove-classifiers失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_validate.sh b/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_validate.sh deleted file mode 100644 index 4858ae222cc..00000000000 --- a/testcases/function_test/pkg_test/python-trove-classifiers/python3-trove-classifiers/test_python3-trove-classifiers_function_validate.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-04-04 -# @License : Mulan PSL v2 -# @Desc : 测试能否验证一个给定的分类器字符串是否有效 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试环境初始化 - LOG_INFO "开始测试python3-trove-classifiers的validate功能" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查python3-trove-classifiers软件包是否在yum源中" - dnf list available python3-trove-classifiers 2>/dev/null | grep -q python3-trove-classifiers - if [ $? -ne 0 ]; then - LOG_ERROR "python3-trove-classifiers软件包不在yum源中" - exit 255 - fi - - # 步骤2:检查软件包是否已安装 - LOG_INFO "步骤2:检查python3-trove-classifiers是否已安装" - rpm -q python3-trove-classifiers >/dev/null 2>&1 - installed=$? - - # 步骤3:如果未安装则安装软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "步骤3:安装python3-trove-classifiers软件包" - dnf install -y python3-trove-classifiers - CHECK_RESULT $? 0 0 "安装python3-trove-classifiers失败" - LOG_INFO "软件包安装成功" - else - LOG_INFO "python3-trove-classifiers已安装,跳过安装步骤" - fi - - # 步骤4:验证validate命令是否存在 - LOG_INFO "步骤4:验证trove-classifiers validate命令是否存在" - trove-classifiers validate --help >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "trove-classifiers validate命令不存在或不支持" - exit 255 - fi - - # 步骤5:测试有效的分类器字符串 - LOG_INFO "步骤5:测试有效的分类器字符串" - trove-classifiers validate "Programming Language :: Python :: 3" - CHECK_RESULT $? 0 0 "有效的分类器字符串验证失败" - - # 步骤6:测试无效的分类器字符串 - LOG_INFO "步骤6:测试无效的分类器字符串" - trove-classifiers validate "Invalid :: Classifier :: String" 2>/dev/null - CHECK_RESULT $? 1 0 "无效的分类器字符串验证应该失败但未失败" - - # 步骤7:测试带参数的validate命令 - LOG_INFO "步骤7:测试带--help参数的validate命令" - trove-classifiers validate --help | grep -q "usage:" - CHECK_RESULT $? 0 0 "validate命令--help参数测试失败" - - # 步骤8:清理测试环境 - LOG_INFO "步骤8:清理测试环境" - if [ $installed -ne 0 ]; then - LOG_INFO "卸载测试安装的python3-trove-classifiers软件包" - dnf remove -y python3-trove-classifiers - CHECK_RESULT $? 0 0 "卸载python3-trove-classifiers失败" - LOG_INFO "软件包卸载成功" - else - LOG_INFO "保持原有的python3-trove-classifiers安装状态" - fi - - LOG_INFO "python3-trove-classifiers validate功能测试完成" -} - -main "$@" \ No newline at end of file From bc4a09ee1b711a723fe8a5c8ad0736f0d6cd47b1 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:52:28 +0800 Subject: [PATCH 14/25] update testcase for testsuite qt5-qtbase-postgresql --- .../qt5-qtbase/qt5-qtbase-postgresql.json | 16 -- .../test_qt5-qtbase-postgresql_connect.sh | 152 ------------------ .../test_qt5-qtbase-postgresql_files.sh | 101 ------------ .../test_qt5-qtbase-postgresql_pkgconfig.sh | 91 ----------- .../test_qt5-qtbase-postgresql_plugin.sh | 68 -------- 5 files changed, 428 deletions(-) delete mode 100644 testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_connect.sh delete mode 100644 testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_files.sh delete mode 100644 testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_pkgconfig.sh delete mode 100644 testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_plugin.sh diff --git a/suite2cases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql.json b/suite2cases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql.json index 6a578d54932..012334a976d 100644 --- a/suite2cases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql.json +++ b/suite2cases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql.json @@ -9,22 +9,6 @@ { "name": "test_qt5-qtbase-postgresql_remove", "desc": "测试软件包是否能够被干净地卸载" - }, - { - "name": "test_qt5-qtbase-postgresql_files", - "desc": "验证安装后关键的头文件和库文件是否存在" - }, - { - "name": "test_qt5-qtbase-postgresql_pkgconfig", - "desc": "检查pkg-config是否能正确提供Qt PostgreSQL插件的编译和链接信息" - }, - { - "name": "test_qt5-qtbase-postgresql_plugin", - "desc": "验证Qt能成功加载并列出PostgreSQL数据库驱动插件" - }, - { - "name": "test_qt5-qtbase-postgresql_connect", - "desc": "测试通过Qt的QSqlDatabase接口建立到PostgreSQL数据库的基本连接" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_connect.sh b/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_connect.sh deleted file mode 100644 index 92102a59d4b..00000000000 --- a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_connect.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-12 -# @License : Mulan PSL v2 -# @Desc : 测试通过Qt的QSqlDatabase接口建立到PostgreSQL数据库的基本连接 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="qt5-qtbase-postgresql" - TEST_APP="qt5-qtbase-postgresql-test" - TEST_SOURCE="/tmp/${TEST_APP}.cpp" - TEST_BINARY="/tmp/${TEST_APP}" - - # 检查软件包是否存在于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} -eq 0 ]; then - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装" - INITIAL_INSTALL_STATE="installed" - else - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装" - INITIAL_INSTALL_STATE="not_installed" - fi - - # 如果未安装,则安装软件包 - if [ ${PACKAGE_INSTALL_STATE} -ne 0 ]; then - LOG_INFO "安装软件包 ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - fi - - # 创建测试程序源代码 - LOG_INFO "创建Qt PostgreSQL连接测试程序" - cat > ${TEST_SOURCE} << "EOF" - #include - #include - #include - #include - #include - - int main(int argc, char *argv[]) { - QCoreApplication app(argc, argv); - - // 尝试添加PostgreSQL数据库驱动 - if (!QSqlDatabase::isDriverAvailable("QPSQL")) { - qDebug() << "PostgreSQL driver (QPSQL) is not available"; - return 1; - } - - // 创建数据库连接 - QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL", "test_connection"); - - // 设置连接参数(这里使用默认参数,不实际连接) - db.setHostName("localhost"); - db.setDatabaseName("testdb"); - db.setUserName("testuser"); - db.setPassword("testpass"); - - // 检查连接参数设置是否正确 - if (db.isValid()) { - qDebug() << "QSqlDatabase connection parameters are valid"; - qDebug() << "Available drivers:" << QSqlDatabase::drivers(); - return 0; - } else { - qDebug() << "QSqlDatabase connection parameters are invalid"; - qDebug() << "Last error:" << db.lastError().text(); - return 1; - } - } - EOF - - # 检查是否成功创建测试源文件 - CHECK_RESULT $? 0 0 "创建测试源文件失败" - - # 编译测试程序 - LOG_INFO "编译Qt PostgreSQL连接测试程序" - # 检查qmake命令是否存在 - which qmake-qt5 &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "qmake-qt5命令不存在" - exit 255 - fi - - # 检查g++命令是否存在 - which g++ &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "g++命令不存在" - exit 255 - fi - - # 创建临时目录并编译 - cd /tmp - qmake-qt5 -project -o ${TEST_APP}.pro - echo "QT += core sql" >> ${TEST_APP}.pro - echo "SOURCES += ${TEST_SOURCE}" >> ${TEST_APP}.pro - echo "CONFIG += console" >> ${TEST_APP}.pro - echo "CONFIG -= app_bundle" >> ${TEST_APP}.pro - - qmake-qt5 ${TEST_APP}.pro - make - CHECK_RESULT $? 0 0 "编译测试程序失败" - - # 运行测试程序 - LOG_INFO "运行Qt PostgreSQL连接测试程序" - ./${TEST_APP} - CHECK_RESULT $? 0 0 "Qt PostgreSQL连接测试失败" - - # 清理测试程序 - LOG_INFO "清理测试程序" - rm -f ${TEST_SOURCE} ${TEST_BINARY} ${TEST_APP}.pro ${TEST_APP}.o Makefile - rm -rf /tmp/.qmake.stash - - # 根据初始安装状态恢复环境 - LOG_INFO "恢复软件包安装状态" - if [ "${INITIAL_INSTALL_STATE}" = "not_installed" ]; then - LOG_INFO "卸载软件包 ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - else - LOG_INFO "保持软件包 ${PACKAGE_NAME} 的安装状态" - fi - - LOG_INFO "Qt PostgreSQL连接测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_files.sh b/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_files.sh deleted file mode 100644 index 571b0dc778b..00000000000 --- a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_files.sh +++ /dev/null @@ -1,101 +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-12 -# @License : Mulan PSL v2 -# @Desc : 验证安装后关键的头文件和库文件是否存在 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:验证安装后关键的头文件和库文件是否存在" - - # 检查是否已安装qt5-qtbase-postgresql - if rpm -q qt5-qtbase-postgresql > /dev/null 2>&1; then - LOG_INFO "检测到qt5-qtbase-postgresql已安装,测试后将保持安装状态" - already_installed=true - else - LOG_INFO "qt5-qtbase-postgresql未安装,将在测试过程中安装" - already_installed=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否存在qt5-qtbase-postgresql软件包" - dnf list available qt5-qtbase-postgresql > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到qt5-qtbase-postgresql软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到qt5-qtbase-postgresql软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "正在安装qt5-qtbase-postgresql软件包" - dnf install -y qt5-qtbase-postgresql - CHECK_RESULT $? 0 0 "安装qt5-qtbase-postgresql失败" - fi - - # 验证关键头文件是否存在 - LOG_INFO "验证关键头文件是否存在" - expected_headers=( - "/usr/include/qt5/QtSql/QPSQLDriver" - "/usr/include/qt5/QtSql/QPSQLResult" - ) - for header in "${expected_headers[@]}"; do - if [ -f "$header" ]; then - LOG_INFO "头文件 $header 存在" - else - LOG_ERROR "头文件 $header 不存在" - exit 1 - fi - done - - # 验证关键库文件是否存在 - LOG_INFO "验证关键库文件是否存在" - expected_libs=( - "/usr/lib64/libQt5Sql.so" - "/usr/lib64/libQt5Sql.so.5" - "/usr/lib64/libQt5Sql.so.5.*" - ) - for lib in "${expected_libs[@]}"; do - if ls $lib > /dev/null 2>&1; then - LOG_INFO "库文件 $lib 存在" - else - LOG_ERROR "库文件 $lib 不存在" - exit 1 - fi - done - - # 验证pkg-config文件是否存在 - LOG_INFO "验证pkg-config文件是否存在" - pkg_config_file="/usr/lib64/pkgconfig/Qt5Sql.pc" - if [ -f "$pkg_config_file" ]; then - LOG_INFO "pkg-config文件 $pkg_config_file 存在" - else - LOG_ERROR "pkg-config文件 $pkg_config_file 不存在" - exit 1 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "清理环境:卸载qt5-qtbase-postgresql软件包" - dnf remove -y qt5-qtbase-postgresql - CHECK_RESULT $? 0 0 "卸载qt5-qtbase-postgresql失败" - fi - - LOG_INFO "测试完成:所有关键的头文件和库文件均存在" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_pkgconfig.sh b/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_pkgconfig.sh deleted file mode 100644 index a48efb2ea8c..00000000000 --- a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_pkgconfig.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-12 -# @License : Mulan PSL v2 -# @Desc : 检查pkg-config是否能正确提供Qt PostgreSQL插件的编译和链接信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查环境是否已安装qt5-qtbase-postgresql - LOG_INFO "检查qt5-qtbase-postgresql是否已安装" - rpm -q qt5-qtbase-postgresql > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "qt5-qtbase-postgresql已安装,脚本结束后将保持安装状态" - INSTALLED="yes" - else - LOG_INFO "qt5-qtbase-postgresql未安装,将在测试中安装并在结束后卸载" - INSTALLED="no" - fi - - # 检查yum源中是否有qt5-qtbase-postgresql软件包 - LOG_INFO "检查yum源中是否有qt5-qtbase-postgresql软件包" - dnf list available qt5-qtbase-postgresql > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到qt5-qtbase-postgresql软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "安装qt5-qtbase-postgresql软件包" - dnf install -y qt5-qtbase-postgresql - CHECK_RESULT $? 0 0 "安装qt5-qtbase-postgresql失败" - fi - - # 检查pkg-config是否能正确提供Qt PostgreSQL插件的编译和链接信息 - LOG_INFO "检查pkg-config是否能正确提供Qt PostgreSQL插件的编译和链接信息" - pkg-config --exists Qt5Sql - CHECK_RESULT $? 0 0 "pkg-config未找到Qt5Sql模块" - - LOG_INFO "检查Qt5Sql模块是否包含PostgreSQL驱动" - pkg-config --variable=sql_drivers Qt5Sql | grep -q postgresql - CHECK_RESULT $? 0 0 "Qt5Sql模块未包含PostgreSQL驱动" - - LOG_INFO "获取Qt5Sql的编译标志" - CFLAGS=$(pkg-config --cflags Qt5Sql) - if [ -z "$CFLAGS" ]; then - LOG_ERROR "无法获取Qt5Sql的编译标志" - exit 1 - fi - LOG_INFO "Qt5Sql编译标志: $CFLAGS" - - LOG_INFO "获取Qt5Sql的链接标志" - LIBS=$(pkg-config --libs Qt5Sql) - if [ -z "$LIBS" ]; then - LOG_ERROR "无法获取Qt5Sql的链接标志" - exit 1 - fi - LOG_INFO "Qt5Sql链接标志: $LIBS" - - LOG_INFO "检查Qt5Sql PostgreSQL插件的具体信息" - pkg-config --variable=qt_config Qt5Sql | grep -q "sql-psql" - CHECK_RESULT $? 0 0 "Qt5Sql未配置PostgreSQL支持" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "卸载qt5-qtbase-postgresql软件包" - dnf remove -y qt5-qtbase-postgresql - CHECK_RESULT $? 0 0 "卸载qt5-qtbase-postgresql失败" - LOG_INFO "环境已恢复到测试前的状态" - else - LOG_INFO "保持qt5-qtbase-postgresql安装状态" - fi - - LOG_INFO "测试完成:pkg-config能正确提供Qt PostgreSQL插件的编译和链接信息" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_plugin.sh b/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_plugin.sh deleted file mode 100644 index da54464661f..00000000000 --- a/testcases/function_test/pkg_test/qt5-qtbase/qt5-qtbase-postgresql/test_qt5-qtbase-postgresql_plugin.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 : 2026-03-12 -# @License : Mulan PSL v2 -# @Desc : 验证Qt能成功加载并列出PostgreSQL数据库驱动插件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装qt5-qtbase-postgresql软件包 - LOG_INFO "检查qt5-qtbase-postgresql软件包是否已安装" - rpm -q qt5-qtbase-postgresql >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "qt5-qtbase-postgresql软件包已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE="yes" - else - LOG_INFO "qt5-qtbase-postgresql软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE="no" - fi - - # 检查yum源中是否有qt5-qtbase-postgresql软件包 - LOG_INFO "检查yum源中是否有qt5-qtbase-postgresql软件包" - dnf list available qt5-qtbase-postgresql >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有qt5-qtbase-postgresql软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有qt5-qtbase-postgresql软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "安装qt5-qtbase-postgresql软件包" - dnf install -y qt5-qtbase-postgresql - CHECK_RESULT $? 0 0 "安装qt5-qtbase-postgresql软件包失败" - fi - - # 验证Qt能成功加载并列出PostgreSQL数据库驱动插件 - LOG_INFO "验证Qt能成功加载并列出PostgreSQL数据库驱动插件" - # 使用qtdiag工具检查PostgreSQL驱动插件 - qtdiag 2>&1 | grep -i "postgresql" >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "Qt未能成功加载PostgreSQL数据库驱动插件" - - # 清理环境,如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载qt5-qtbase-postgresql软件包" - dnf remove -y qt5-qtbase-postgresql - CHECK_RESULT $? 0 0 "卸载qt5-qtbase-postgresql软件包失败" - else - LOG_INFO "保持qt5-qtbase-postgresql软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 4cf22991ef5935fe754b4ac1635050a1cdaa1cb4 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:54:00 +0800 Subject: [PATCH 15/25] update testcase for testsuite luajit-devel --- .../pkg_test/luajit/luajit-devel.json | 4 -- .../test_luajit-devel_function_jiton.sh | 70 ------------------- 2 files changed, 74 deletions(-) delete mode 100644 testcases/function_test/pkg_test/luajit/luajit-devel/test_luajit-devel_function_jiton.sh diff --git a/suite2cases/function_test/pkg_test/luajit/luajit-devel.json b/suite2cases/function_test/pkg_test/luajit/luajit-devel.json index fb5d3d4b677..50defa73519 100644 --- a/suite2cases/function_test/pkg_test/luajit/luajit-devel.json +++ b/suite2cases/function_test/pkg_test/luajit/luajit-devel.json @@ -21,10 +21,6 @@ "name": "test_luajit-devel_command_luajit-014", "desc": "测试luajit命令的-joff参数,验证其是否能正常关闭jit编译功能。", "machine num": 1 - }, - { - "name": "test_luajit-devel_function_jiton", - "desc": "测试luajit的JIT编译功能是否正常开启和运行。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/luajit/luajit-devel/test_luajit-devel_function_jiton.sh b/testcases/function_test/pkg_test/luajit/luajit-devel/test_luajit-devel_function_jiton.sh deleted file mode 100644 index 27ff19597c2..00000000000 --- a/testcases/function_test/pkg_test/luajit/luajit-devel/test_luajit-devel_function_jiton.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 : 2025-12-05 -# @License : Mulan PSL v2 -# @Desc : 测试luajit的JIT编译功能是否正常开启和运行。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试luajit的JIT编译功能是否正常开启和运行。" - - # 检查是否已安装luajit-devel - LOG_INFO "检查是否已安装luajit-devel" - dnf list installed luajit-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "luajit-devel已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "luajit-devel未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有luajit-devel - LOG_INFO "检查yum源中是否有luajit-devel" - dnf list available luajit-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到luajit-devel软件包" - exit 255 - fi - - # 安装luajit-devel - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装luajit-devel" - dnf install -y luajit-devel - CHECK_RESULT $? 0 0 "安装luajit-devel失败" - fi - - # 测试JIT编译功能 - LOG_INFO "测试JIT编译功能是否正常开启" - lua -e "print(jit.status())" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "JIT编译功能未正常开启" - - LOG_INFO "测试JIT编译功能是否正常运行" - lua -e "local sum = 0; for i=1,1000000 do sum = sum + i end; print(sum)" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "JIT编译功能运行异常" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载luajit-devel" - dnf remove -y luajit-devel - CHECK_RESULT $? 0 0 "卸载luajit-devel失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From c9cd1cefababef3bfdf4fe9f7d097c5cc0bf737c Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:54:57 +0800 Subject: [PATCH 16/25] update testcase for testsuite ldaptive-parent --- .../pkg_test/ldaptive/ldaptive-parent.json | 10 --- .../test_ldaptive-parent_function_auth.sh | 71 ------------------- 2 files changed, 81 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/ldaptive/ldaptive-parent.json delete mode 100644 testcases/function_test/pkg_test/ldaptive/ldaptive-parent/test_ldaptive-parent_function_auth.sh diff --git a/suite2cases/function_test/pkg_test/ldaptive/ldaptive-parent.json b/suite2cases/function_test/pkg_test/ldaptive/ldaptive-parent.json deleted file mode 100644 index ce57667a78f..00000000000 --- a/suite2cases/function_test/pkg_test/ldaptive/ldaptive-parent.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/ldaptive/ldaptive-parent", - "machine num": 1, - "cases": [ - { - "name": "test_ldaptive-parent_function_auth", - "desc": "Test LDAP authentication functionality" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/ldaptive/ldaptive-parent/test_ldaptive-parent_function_auth.sh b/testcases/function_test/pkg_test/ldaptive/ldaptive-parent/test_ldaptive-parent_function_auth.sh deleted file mode 100644 index 57974c37e54..00000000000 --- a/testcases/function_test/pkg_test/ldaptive/ldaptive-parent/test_ldaptive-parent_function_auth.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-09 -# @License : Mulan PSL v2 -# @Desc : Test LDAP authentication functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试LDAP认证功能" - - # 检查软件包是否已安装 - LOG_INFO "检查ldaptive-parent-function-auth软件包是否已安装" - if rpm -q ldaptive-parent-function-auth &>/dev/null; then - LOG_INFO "软件包已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "软件包未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在软件包 - LOG_INFO "检查yum源中是否存在ldaptive-parent-function-auth软件包" - if ! dnf list available ldaptive-parent-function-auth &>/dev/null; then - LOG_ERROR "yum源中不存在ldaptive-parent-function-auth软件包" - exit 255 - fi - - # 安装软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装ldaptive-parent-function-auth软件包" - dnf install -y ldaptive-parent-function-auth - CHECK_RESULT $? 0 0 "安装ldaptive-parent-function-auth软件包失败" - fi - - # 测试LDAP认证功能 - LOG_INFO "测试LDAP认证功能" - ldap_command_output=$(ldaptive-parent-function-auth --test-ldap) - CHECK_RESULT $? 0 0 "LDAP认证功能测试失败" - - # 检查命令参数支持情况 - LOG_INFO "检查命令参数是否支持" - if ! ldaptive-parent-function-auth --invalid-param &>/dev/null; then - LOG_ERROR "命令参数不支持或不存在" - exit 255 - fi - - # 清理环境(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载ldaptive-parent-function-auth软件包" - dnf remove -y ldaptive-parent-function-auth - CHECK_RESULT $? 0 0 "卸载ldaptive-parent-function-auth软件包失败" - fi - - LOG_INFO "LDAP认证功能测试完成" -} - -main "$@" \ No newline at end of file From d2d8133110a94f6eef5bf5d946ef3cdbb982593f Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 11:56:27 +0800 Subject: [PATCH 17/25] update testcase for testsuite jackson-modules-base-javadoc --- .../jackson-modules-base-javadoc.json | 4 - ...son-modules-base-javadoc_function_parse.sh | 74 ------------------- 2 files changed, 78 deletions(-) delete mode 100644 testcases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc/test_jackson-modules-base-javadoc_function_parse.sh diff --git a/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc.json b/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc.json index ccc7ca6d246..386317df838 100644 --- a/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc.json +++ b/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc.json @@ -6,10 +6,6 @@ "name": "test_jackson-modules-base-javadoc_install", "desc": "测试软件包 jackson-modules-base-javadoc 的安装功能,验证是否能够成功安装。", "machine num": 1 - }, - { - "name": "test_jackson-modules-base-javadoc_function_parse", - "desc": "测试软件包 jackson-modules-base-javadoc 的解析功能,验证是否能够正确解析 JSON 数据。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc/test_jackson-modules-base-javadoc_function_parse.sh b/testcases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc/test_jackson-modules-base-javadoc_function_parse.sh deleted file mode 100644 index 90feffac83a..00000000000 --- a/testcases/function_test/pkg_test/jackson-modules-base/jackson-modules-base-javadoc/test_jackson-modules-base-javadoc_function_parse.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-10 -# @License : Mulan PSL v2 -# @Desc : 测试软件包 jackson-modules-base-javadoc 的解析功能,验证是否能够正确解析 JSON 数据。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试软件包 jackson-modules-base-javadoc 的解析功能,验证是否能够正确解析 JSON 数据。" - - # 检查软件包是否已安装 - LOG_INFO "检查软件包 jackson-modules-base-javadoc 是否已安装..." - if dnf list installed jackson-modules-base-javadoc &>/dev/null; then - LOG_INFO "软件包 jackson-modules-base-javadoc 已安装,测试结束后将保持安装状态。" - already_installed=true - else - LOG_INFO "软件包 jackson-modules-base-javadoc 未安装,将在测试结束后卸载。" - already_installed=false - fi - - # 检查 yum 源中是否存在该软件包 - LOG_INFO "检查 yum 源中是否存在软件包 jackson-modules-base-javadoc..." - if ! dnf list available jackson-modules-base-javadoc &>/dev/null; then - LOG_ERROR "yum 源中不存在软件包 jackson-modules-base-javadoc,退出测试。" - exit 255 - fi - - # 安装软件包(如果未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "正在安装软件包 jackson-modules-base-javadoc..." - dnf install -y jackson-modules-base-javadoc - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 测试解析功能 - LOG_INFO "测试 jackson-modules-base-javadoc 的 JSON 解析功能..." - test_json="{"name":"test","value":123}" - parsed_output=$(java -cp /usr/share/java/jackson-modules-base.jar com.fasterxml.jackson.module.javadoc.JavadocModuleTest "$test_json" 2>&1) - CHECK_RESULT $? 0 0 "JSON 解析失败" - - # 验证解析结果是否符合预期 - expected_output="name=test, value=123" - if [[ "$parsed_output" == *"$expected_output"* ]]; then - LOG_INFO "JSON 数据解析成功,结果符合预期。" - else - LOG_ERROR "JSON 数据解析结果不符合预期。实际输出: $parsed_output" - exit 1 - fi - - # 清理环境(如果之前未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "正在卸载软件包 jackson-modules-base-javadoc..." - dnf remove -y jackson-modules-base-javadoc - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复。" -} - -main "$@" \ No newline at end of file From 4139ba0a898cfa50cf48ec5fdfab47479c1d7707 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:00:45 +0800 Subject: [PATCH 18/25] update testcase for testsuite python-termcolor-help --- .../python-termcolor-help.json | 24 ------ ...hon-termcolor-help_function_basic_usage.sh | 68 --------------- ...st_python-termcolor-help_function_color.sh | 62 -------------- ...t_python-termcolor-help_function_import.sh | 67 --------------- ..._python-termcolor-help_function_install.sh | 83 ------------------- ...ython-termcolor-help_function_uninstall.sh | 78 ----------------- ..._python-termcolor-help_function_version.sh | 81 ------------------ 7 files changed, 463 deletions(-) delete mode 100644 testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_basic_usage.sh delete mode 100644 testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_color.sh delete mode 100644 testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_import.sh delete mode 100644 testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_install.sh delete mode 100644 testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_version.sh diff --git a/suite2cases/function_test/pkg_test/python-termcolor/python-termcolor-help.json b/suite2cases/function_test/pkg_test/python-termcolor/python-termcolor-help.json index 4919e192e4b..063497fa5c0 100644 --- a/suite2cases/function_test/pkg_test/python-termcolor/python-termcolor-help.json +++ b/suite2cases/function_test/pkg_test/python-termcolor/python-termcolor-help.json @@ -6,30 +6,6 @@ "name": "test_python-termcolor-help_install", "desc": "测试python-termcolor-help软件包的安装功能", "machine num": 1 - }, - { - "name": "test_python-termcolor-help_function_color", - "desc": "测试python-termcolor-help软件包的颜色输出功能" - }, - { - "name": "test_python-termcolor-help_function_install", - "desc": "测试python-termcolor-help软件包的正确安装" - }, - { - "name": "test_python-termcolor-help_function_uninstall", - "desc": "测试python-termcolor-help软件包的完整卸载" - }, - { - "name": "test_python-termcolor-help_function_import", - "desc": "测试python-termcolor-help模块的正确导入" - }, - { - "name": "test_python-termcolor-help_function_basic_usage", - "desc": "测试python-termcolor-help基本功能与帮助信息" - }, - { - "name": "test_python-termcolor-help_function_version", - "desc": "测试python-termcolor-help软件包的版本查询" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_basic_usage.sh b/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_basic_usage.sh deleted file mode 100644 index 61b5e095067..00000000000 --- a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_basic_usage.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 : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试python-termcolor-help基本功能与帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python-termcolor-help基本功能与帮助信息" - - # 检查python3-termcolor软件包是否已安装 - LOG_INFO "检查python3-termcolor软件包是否已安装" - rpm -q python3-termcolor > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-termcolor已安装,测试完成后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "python3-termcolor未安装,将在测试前安装,测试后卸载" - INSTALLED_BEFORE_TEST=false - fi - - # 检查yum源中是否有python3-termcolor软件包 - LOG_INFO "检查yum源中是否有python3-termcolor软件包" - dnf list available python3-termcolor > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到python3-termcolor软件包" - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装python3-termcolor软件包" - dnf install -y python3-termcolor > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装python3-termcolor软件包失败" - fi - - # 测试termcolor模块的基本功能 - LOG_INFO "测试termcolor模块的基本功能" - python3 -c "import termcolor; print(termcolor.colored("Hello, World!", "red"))" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "termcolor模块基本功能测试失败" - - # 测试termcolor模块的帮助信息 - LOG_INFO "测试termcolor模块的帮助信息" - python3 -c "import termcolor; help(termcolor)" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "termcolor模块帮助信息测试失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载python3-termcolor软件包" - dnf remove -y python3-termcolor > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载python3-termcolor软件包失败" - fi - - LOG_INFO "测试python-termcolor-help基本功能与帮助信息完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_color.sh b/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_color.sh deleted file mode 100644 index 71175931640..00000000000 --- a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_color.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 : 测试python-termcolor-help软件包的颜色输出功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python-termcolor-help软件包的颜色输出功能" - - # 检查是否已安装python-termcolor-help - if dnf list installed python-termcolor-help &>/dev/null; then - LOG_INFO "python-termcolor-help已安装,跳过安装步骤" - installed=true - else - LOG_INFO "python-termcolor-help未安装,准备安装" - installed=false - fi - - # 检查yum源中是否有python-termcolor-help - if ! dnf list available python-termcolor-help &>/dev/null; then - LOG_ERROR "yum源中未找到python-termcolor-help软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "正在安装python-termcolor-help" - dnf install -y python-termcolor-help - CHECK_RESULT $? 0 0 "安装python-termcolor-help失败" - fi - - # 测试颜色输出功能 - LOG_INFO "测试python-termcolor-help的颜色输出功能" - python3 -c "from termcolor import colored; print(colored("测试文本", "red"))" >/dev/null - CHECK_RESULT $? 0 0 "颜色输出功能测试失败" - - # 恢复环境:如果脚本开始时未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python-termcolor-help" - dnf remove -y python-termcolor-help - CHECK_RESULT $? 0 0 "卸载python-termcolor-help失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_import.sh b/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_import.sh deleted file mode 100644 index 3a5130f30ab..00000000000 --- a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_import.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-26 -# @License : Mulan PSL v2 -# @Desc : 测试python-termcolor-help模块的正确导入 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装python3-termcolor-help模块 - LOG_INFO "检查python3-termcolor-help模块是否已安装" - rpm -q python3-termcolor-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-termcolor-help模块已安装,测试结束后将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "python3-termcolor-help模块未安装,将在测试前安装,测试后卸载" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在python3-termcolor-help软件包 - LOG_INFO "检查yum源中是否存在python3-termcolor-help软件包" - dnf list available python3-termcolor-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-termcolor-help软件包" - exit 255 - fi - - # 如果未安装,则安装python3-termcolor-help模块 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "安装python3-termcolor-help模块" - dnf install -y python3-termcolor-help - CHECK_RESULT $? 0 0 "安装python3-termcolor-help模块失败" - fi - - # 测试python-termcolor-help模块的正确导入 - LOG_INFO "测试python-termcolor-help模块的正确导入" - python3 -c "import termcolor; help(termcolor)" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "导入python-termcolor-help模块失败" - - LOG_INFO "python-termcolor-help模块导入测试成功" - - # 环境清理:如果测试前未安装,则卸载python3-termcolor-help模块 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载python3-termcolor-help模块" - dnf remove -y python3-termcolor-help - CHECK_RESULT $? 0 0 "卸载python3-termcolor-help模块失败" - LOG_INFO "环境已恢复,python3-termcolor-help模块已卸载" - else - LOG_INFO "环境已恢复,保持python3-termcolor-help模块安装状态" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_install.sh b/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_install.sh deleted file mode 100644 index 556c7ecf825..00000000000 --- a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_install.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-26 -# @License : Mulan PSL v2 -# @Desc : 测试python-termcolor-help软件包的正确安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python-termcolor-help软件包的正确安装" - - # 检查yum源中是否存在python-termcolor-help软件包 - LOG_INFO "检查yum源中是否存在python-termcolor-help软件包" - dnf list available python-termcolor-help &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python-termcolor-help软件包" - exit 255 - fi - - # 检查当前环境中是否已经安装了python-termcolor-help - LOG_INFO "检查当前环境中是否已经安装了python-termcolor-help" - rpm -q python-termcolor-help &>/dev/null - if [ $? -eq 0 ]; then - already_installed=true - LOG_INFO "python-termcolor-help软件包已安装" - else - already_installed=false - LOG_INFO "python-termcolor-help软件包未安装" - fi - - # 如果未安装,则进行安装 - if [ "$already_installed" = "false" ]; then - LOG_INFO "安装python-termcolor-help软件包" - dnf install -y python-termcolor-help - CHECK_RESULT $? 0 0 "安装python-termcolor-help软件包失败" - fi - - # 验证软件包是否安装成功 - LOG_INFO "验证python-termcolor-help软件包是否安装成功" - rpm -q python-termcolor-help - CHECK_RESULT $? 0 0 "python-termcolor-help软件包未正确安装" - - # 测试软件包的基本功能(例如,检查是否有帮助文档) - LOG_INFO "测试python-termcolor-help软件包的基本功能" - rpm -ql python-termcolor-help | grep -E "\.py$|README|help" &>/dev/null - CHECK_RESULT $? 0 0 "python-termcolor-help软件包功能异常" - - # 如果测试开始时未安装,则在测试结束后卸载软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "卸载python-termcolor-help软件包" - dnf remove -y python-termcolor-help - CHECK_RESULT $? 0 0 "卸载python-termcolor-help软件包失败" - - # 验证软件包是否已卸载 - LOG_INFO "验证python-termcolor-help软件包是否已卸载" - rpm -q python-termcolor-help &>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "python-termcolor-help软件包卸载失败" - exit 1 - else - LOG_INFO "python-termcolor-help软件包已成功卸载" - fi - else - LOG_INFO "测试开始时软件包已安装,保持安装状态" - fi - - LOG_INFO "测试python-termcolor-help软件包的正确安装完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_uninstall.sh b/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_uninstall.sh deleted file mode 100644 index ecca368f1d4..00000000000 --- a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_uninstall.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-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试python-termcolor-help软件包的完整卸载 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python-termcolor-help软件包的完整卸载" - LOG_INFO "步骤1: 检查yum源中是否存在python-termcolor-help软件包" - dnf list available python-termcolor-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python-termcolor-help软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查当前环境是否已安装python-termcolor-help软件包" - rpm -q python-termcolor-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到python-termcolor-help已安装,标记为已安装状态" - INSTALLED=true - else - LOG_INFO "未检测到python-termcolor-help安装,标记为未安装状态" - INSTALLED=false - fi - - LOG_INFO "步骤3: 如果未安装,则安装python-termcolor-help软件包" - if [ "$INSTALLED" = "false" ]; then - dnf install -y python-termcolor-help - CHECK_RESULT $? 0 0 "安装python-termcolor-help失败" - LOG_INFO "安装python-termcolor-help成功" - fi - - LOG_INFO "步骤4: 验证python-termcolor-help软件包功能" - python -m termcolor --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "python-termcolor-help功能验证失败" - - LOG_INFO "步骤5: 卸载python-termcolor-help软件包" - dnf remove -y python-termcolor-help - CHECK_RESULT $? 0 0 "卸载python-termcolor-help失败" - LOG_INFO "卸载python-termcolor-help成功" - - LOG_INFO "步骤6: 验证软件包是否已完全卸载" - rpm -q python-termcolor-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "python-termcolor-help卸载后仍存在" - exit 1 - fi - LOG_INFO "验证通过,python-termcolor-help已完全卸载" - - LOG_INFO "步骤7: 恢复环境状态" - if [ "$INSTALLED" = "true" ]; then - LOG_INFO "环境原已安装python-termcolor-help,重新安装" - dnf install -y python-termcolor-help - CHECK_RESULT $? 0 0 "重新安装python-termcolor-help失败" - LOG_INFO "环境恢复完成" - else - LOG_INFO "环境原未安装python-termcolor-help,无需恢复" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_version.sh b/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_version.sh deleted file mode 100644 index 1889722ad6e..00000000000 --- a/testcases/function_test/pkg_test/python-termcolor/python-termcolor-help/test_python-termcolor-help_function_version.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-26 -# @License : Mulan PSL v2 -# @Desc : 测试python-termcolor-help软件包的版本查询 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="python3-termcolor-help" - LOG_INFO "开始测试$PACKAGE_NAME软件包的版本查询功能" - - LOG_INFO "步骤1: 检查系统中是否已安装$PACKAGE_NAME" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - INSTALLED=$? - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME已安装,测试完成后将保持安装状态" - WAS_INSTALLED=true - else - LOG_INFO "$PACKAGE_NAME未安装,将在测试前安装,测试后卸载" - WAS_INSTALLED=false - fi - - LOG_INFO "步骤2: 检查yum源中是否存在$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到软件包$PACKAGE_NAME,测试终止" - - if [ "$WAS_INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME软件包失败" - fi - - LOG_INFO "步骤4: 测试查询$PACKAGE_NAME软件包版本" - rpm -q $PACKAGE_NAME --queryformat "%{VERSION}-%{RELEASE}\n" - CHECK_RESULT $? 0 0 "查询$PACKAGE_NAME软件包版本失败" - - LOG_INFO "步骤5: 测试python-termcolor-help命令的--help参数" - python-termcolor-help --help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "--help参数支持" - else - LOG_ERROR "--help参数不支持或命令执行失败" - exit 255 - fi - - LOG_INFO "步骤6: 测试python-termcolor-help命令的--version参数" - python-termcolor-help --version > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "--version参数支持" - else - LOG_ERROR "--version参数不支持或命令执行失败" - exit 255 - fi - - LOG_INFO "步骤7: 清理测试环境" - if [ "$WAS_INSTALLED" = false ]; then - LOG_INFO "卸载测试安装的$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME软件包失败" - else - LOG_INFO "保持$PACKAGE_NAME软件包的安装状态" - fi - - LOG_INFO "$PACKAGE_NAME版本查询功能测试完成" -} - -main "$@" \ No newline at end of file From 5b1a15d467de84207277b3bfc65076547789d4ac Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:01:19 +0800 Subject: [PATCH 19/25] update testcase for testsuite texlive-substances --- .../texlive-split-v/texlive-substances.json | 26 ------ ...xlive-substances_function_check_install.sh | 62 -------------- ...est_texlive-substances_function_install.sh | 76 ----------------- ...t_texlive-substances_function_uninstall.sh | 63 --------------- ...xlive-substances_function_usage_example.sh | 79 ------------------ ...exlive-substances_function_verify_files.sh | 81 ------------------- 6 files changed, 387 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-v/texlive-substances.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_check_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_usage_example.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_verify_files.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-substances.json b/suite2cases/function_test/pkg_test/texlive-split-v/texlive-substances.json deleted file mode 100644 index 3944411fcaa..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-substances.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-substances", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-substances_function_uninstall", - "desc": "Test package uninstallation" - }, - { - "name": "test_texlive-substances_function_check_install", - "desc": "Test if the texlive-substances package is installed" - }, - { - "name": "test_texlive-substances_function_install", - "desc": "Test installation of the texlive-substances package" - }, - { - "name": "test_texlive-substances_function_verify_files", - "desc": "Test the presence of key substance style files" - }, - { - "name": "test_texlive-substances_function_usage_example", - "desc": "Test compilation of a simple LaTeX document using substances package" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_check_install.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_check_install.sh deleted file mode 100644 index 6e2bca792b9..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_check_install.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : Test if the texlive-substances package is installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="texlive-substances" - LOG_INFO "开始测试 texlive-substances 包的安装功能" - LOG_INFO "步骤1: 检查当前环境是否已安装 ${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 - 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 [ "${INSTALLED_BEFORE_TEST}" = "false" ]; then - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装 ${PACKAGE_NAME} 失败" - LOG_INFO "安装 ${PACKAGE_NAME} 成功" - else - LOG_INFO "环境已安装,跳过安装操作" - fi - LOG_INFO "步骤4: 验证 ${PACKAGE_NAME} 包是否成功安装" - dnf list installed ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "验证 ${PACKAGE_NAME} 安装状态失败" - LOG_INFO "验证 ${PACKAGE_NAME} 安装状态成功" - LOG_INFO "步骤5: 清理测试环境,恢复到初始状态" - if [ "${INSTALLED_BEFORE_TEST}" = "false" ]; then - LOG_INFO "执行卸载 ${PACKAGE_NAME} 包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载 ${PACKAGE_NAME} 失败" - LOG_INFO "卸载 ${PACKAGE_NAME} 成功,环境已恢复" - else - LOG_INFO "测试前环境已安装 ${PACKAGE_NAME},保持安装状态,无需卸载" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_install.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_install.sh deleted file mode 100644 index 6af79823b04..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_install.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 installation of the texlive-substances package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="texlive-substances" - LOG_INFO "开始测试 texlive-substances 软件包安装功能" - LOG_INFO "步骤1: 检查当前环境中是否已安装 $PACKAGE_NAME" - rpm -q $PACKAGE_NAME - if [ $? -eq 0 ]; then - LOG_INFO "环境中已安装 $PACKAGE_NAME,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "环境中未安装 $PACKAGE_NAME,将在测试中安装并在测试结束后卸载" - INSTALLED_BEFORE=false - fi - LOG_INFO "步骤2: 检查 yum 源中是否存在 $PACKAGE_NAME 软件包" - dnf list available $PACKAGE_NAME - CHECK_RESULT $? 0 0 "yum 源中未找到 $PACKAGE_NAME 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 $PACKAGE_NAME 软件包,退出测试" - exit 255 - fi - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3: 安装 $PACKAGE_NAME 软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 软件包失败" - LOG_INFO "步骤4: 验证 $PACKAGE_NAME 软件包是否安装成功" - rpm -q $PACKAGE_NAME - CHECK_RESULT $? 0 0 "$PACKAGE_NAME 软件包未成功安装" - fi - LOG_INFO "步骤5: 测试 $PACKAGE_NAME 软件包的基本功能" - LOG_INFO "检查 texlive-substances 相关文件是否被正确安装" - TEXMFDIST=$(kpsewhich -var-value TEXMFDIST) - if [ -n "$TEXMFDIST" ]; then - ls ${TEXMFDIST}/tex/latex/substances/substances.sty - CHECK_RESULT $? 0 0 "未找到 substances.sty 文件,软件包可能未正确安装" - else - LOG_INFO "未找到 TEXMFDIST 变量,跳过文件检查" - fi - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤6: 清理环境 - 卸载 $PACKAGE_NAME 软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 软件包失败" - LOG_INFO "验证 $PACKAGE_NAME 软件包是否已卸载" - rpm -q $PACKAGE_NAME - if [ $? -eq 0 ]; then - LOG_ERROR "$PACKAGE_NAME 软件包卸载失败" - exit 1 - else - LOG_INFO "$PACKAGE_NAME 软件包已成功卸载" - fi - else - LOG_INFO "步骤6: 测试前已安装 $PACKAGE_NAME,保持安装状态,不进行卸载" - fi - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_uninstall.sh deleted file mode 100644 index 02079ee0f21..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_uninstall.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-10-03 -# @License : Mulan PSL v2 -# @Desc : Test package uninstallation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-substances - LOG_INFO "检查是否已安装texlive-substances" - rpm -q texlive-substances > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-substances已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-substances未安装,将在测试后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-substances包 - LOG_INFO "检查yum源中是否有texlive-substances包" - dnf list available texlive-substances > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-substances包" - - # 安装texlive-substances包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装texlive-substances包" - dnf install -y texlive-substances - CHECK_RESULT $? 0 0 "安装texlive-substances包失败" - fi - - # 测试卸载功能 - LOG_INFO "测试卸载texlive-substances包" - dnf remove -y texlive-substances - CHECK_RESULT $? 0 0 "卸载texlive-substances包失败" - - # 环境恢复 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "环境恢复:重新安装texlive-substances包" - dnf install -y texlive-substances - CHECK_RESULT $? 0 0 "重新安装texlive-substances包失败" - else - LOG_INFO "环境恢复:保持原有状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_usage_example.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_usage_example.sh deleted file mode 100644 index 961a4b2f01a..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_usage_example.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : Test compilation of a simple LaTeX document using substances package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:使用substances包编译简单LaTeX文档" - LOG_INFO "步骤1:检查是否已安装texlive-substances软件包" - if dnf list installed texlive-substances &>/dev/null; then - LOG_INFO "texlive-substances已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "texlive-substances未安装,将在测试步骤中安装" - already_installed=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在texlive-substances软件包" - if ! dnf list available texlive-substances &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-substances软件包" - exit 255 - fi - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装texlive-substances软件包" - dnf install -y texlive-substances - CHECK_RESULT $? 0 0 "安装texlive-substances失败" - fi - - LOG_INFO "步骤4:创建测试LaTeX文档" - cat > test_substances.tex << "EOF" - \documentclass{article} - \usepackage{substances} - \begin{document} - Test document using substances package. - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - - LOG_INFO "步骤5:使用pdflatex编译LaTeX文档" - pdflatex -interaction=nonstopmode test_substances.tex - CHECK_RESULT $? 0 0 "编译LaTeX文档失败" - - LOG_INFO "步骤6:检查生成的PDF文件" - if [ -f test_substances.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - LOG_INFO "步骤7:清理测试文件" - rm -f test_substances.tex test_substances.aux test_substances.log test_substances.pdf - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤8:卸载texlive-substances软件包" - dnf remove -y texlive-substances - CHECK_RESULT $? 0 0 "卸载texlive-substances失败" - fi - - LOG_INFO "测试完成:使用substances包编译简单LaTeX文档成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_verify_files.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_verify_files.sh deleted file mode 100644 index 5e9e0630990..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-substances/test_texlive-substances_function_verify_files.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 the presence of key substance style files -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查关键 substance 样式文件的存在性" - - # 检查是否已安装 texlive-substances - LOG_INFO "步骤1:检查 texlive-substances 是否已安装" - if rpm -q texlive-substances &> /dev/null; then - LOG_INFO "texlive-substances 已安装,测试后保持安装状态" - already_installed=1 - else - LOG_INFO "texlive-substances 未安装,将在测试后卸载" - already_installed=0 - fi - - # 检查 yum 源中是否有 texlive-substances 软件包 - LOG_INFO "步骤2:检查 yum 源中是否存在 texlive-substances 软件包" - if ! dnf list available texlive-substances &> /dev/null; then - LOG_ERROR "yum 源中未找到 texlive-substances 软件包" - exit 255 - fi - - # 如果未安装,则安装 texlive-substances - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤3:安装 texlive-substances" - dnf install -y texlive-substances - CHECK_RESULT $? 0 0 "安装 texlive-substances 失败" - fi - - # 检查关键 substance 样式文件是否存在 - LOG_INFO "步骤4:检查关键 substance 样式文件是否存在" - key_files=( - "/usr/share/texlive/texmf-dist/tex/latex/substances/substances.sty" - "/usr/share/texlive/texmf-dist/doc/latex/substances/substances.pdf" - "/usr/share/texlive/texmf-dist/source/latex/substances/substances.dtx" - ) - - for file in "${key_files[@]}"; do - if [ -f "$file" ]; then - LOG_INFO "文件存在: $file" - else - LOG_ERROR "文件不存在: $file" - exit 1 - fi - done - - LOG_INFO "所有关键 substance 样式文件均存在" - - # 环境恢复 - LOG_INFO "步骤5:环境恢复" - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载 texlive-substances" - dnf remove -y texlive-substances - CHECK_RESULT $? 0 0 "卸载 texlive-substances 失败" - else - LOG_INFO "保持 texlive-substances 安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From b0b79590a72a24543df38e902a3e332c5d6ecdd2 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:02:29 +0800 Subject: [PATCH 20/25] update testcase for testsuite texlive-autoarea --- .../texlive-split-b/texlive-autoarea.json | 20 --- .../test_texlive-autoarea_function_check.sh | 80 ----------- .../test_texlive-autoarea_function_doc.sh | 83 ----------- .../test_texlive-autoarea_function_help.sh | 82 ----------- ...est_texlive-autoarea_function_listfiles.sh | 133 ------------------ .../test_texlive-autoarea_function_usage.sh | 80 ----------- 6 files changed, 478 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_check.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_doc.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_help.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_listfiles.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_usage.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-b/texlive-autoarea.json b/suite2cases/function_test/pkg_test/texlive-split-b/texlive-autoarea.json index 7f5368f960d..4763ee2bd85 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-b/texlive-autoarea.json +++ b/suite2cases/function_test/pkg_test/texlive-split-b/texlive-autoarea.json @@ -10,29 +10,9 @@ "name": "test_texlive-autoarea_function_uninstall", "desc": "Test uninstallation of texlive-autoarea package" }, - { - "name": "test_texlive-autoarea_function_check", - "desc": "Check if texlive-autoarea package is installed" - }, - { - "name": "test_texlive-autoarea_function_help", - "desc": "Test display of package help or man page" - }, { "name": "test_texlive-autoarea_function_version", "desc": "Test display of package version info" - }, - { - "name": "test_texlive-autoarea_function_listfiles", - "desc": "Test listing files provided by package" - }, - { - "name": "test_texlive-autoarea_function_doc", - "desc": "Test presence of package documentation" - }, - { - "name": "test_texlive-autoarea_function_usage", - "desc": "Test basic usage of autoarea in LaTeX" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_check.sh b/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_check.sh deleted file mode 100644 index 7ab33b360b0..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_check.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-28 -# @License : Mulan PSL v2 -# @Desc : Check if texlive-autoarea package is installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:检查 texlive-autoarea 包是否安装" - - # 检查是否已安装 texlive-autoarea - LOG_INFO "步骤1:检查 texlive-autoarea 是否已安装" - if rpm -q texlive-autoarea &> /dev/null; then - LOG_INFO "texlive-autoarea 已安装" - INSTALLED=true - else - LOG_INFO "texlive-autoarea 未安装" - INSTALLED=false - fi - - # 检查 yum 源中是否有 texlive-autoarea 包 - LOG_INFO "步骤2:检查 yum 源中是否有 texlive-autoarea 包" - if ! dnf list available texlive-autoarea &> /dev/null; then - LOG_ERROR "yum 源中未找到 texlive-autoarea 包" - exit 255 - fi - LOG_INFO "yum 源中有 texlive-autoarea 包" - - # 如果未安装,则安装 texlive-autoarea - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装 texlive-autoarea" - dnf install -y texlive-autoarea - CHECK_RESULT $? 0 0 "安装 texlive-autoarea 失败" - LOG_INFO "安装 texlive-autoarea 成功" - fi - - # 检查 texlive-autoarea 命令是否可用 - LOG_INFO "步骤4:检查 texlive-autoarea 命令是否可用" - if ! command -v autoarea &> /dev/null; then - LOG_ERROR "autoarea 命令不存在" - exit 255 - fi - LOG_INFO "autoarea 命令可用" - - # 测试 autoarea 命令的基本功能 - LOG_INFO "步骤5:测试 autoarea 命令基本功能" - autoarea --help &> /dev/null - CHECK_RESULT $? 0 0 "autoarea --help 执行失败" - LOG_INFO "autoarea --help 执行成功" - - # 如果测试前未安装,则在测试后卸载 texlive-autoarea - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤6:卸载 texlive-autoarea" - dnf remove -y texlive-autoarea - CHECK_RESULT $? 0 0 "卸载 texlive-autoarea 失败" - LOG_INFO "卸载 texlive-autoarea 成功" - else - LOG_INFO "测试前已安装 texlive-autoarea,保持安装状态" - fi - - LOG_INFO "测试完成:texlive-autoarea 包功能检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_doc.sh b/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_doc.sh deleted file mode 100644 index 7661fcf1ffc..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_doc.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-28 -# @License : Mulan PSL v2 -# @Desc : Test presence of package documentation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test presence of package documentation" - - # 定义要测试的软件包名称 - PACKAGE_NAME="texlive-autoarea" - - # 检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在" - exit 255 - fi - - # 检查是否已经安装软件包 - LOG_INFO "步骤2:检查系统是否已经安装软件包 $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 - - # 如果未安装,则安装软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 测试软件包文档的存在性 - LOG_INFO "步骤4:检查软件包 $PACKAGE_NAME 的文档文件" - rpm -ql $PACKAGE_NAME | grep -E "\.(pdf|txt|html|md)$" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 没有找到文档文件" - - # 测试软件包文档的可读性 - LOG_INFO "步骤5:测试软件包 $PACKAGE_NAME 文档的可读性" - DOC_FILE=$(rpm -ql $PACKAGE_NAME | grep -E "\.(pdf|txt|html|md)$" | head -1) - if [ -n "$DOC_FILE" ]; then - if [ -r "$DOC_FILE" ]; then - LOG_INFO "文档文件 $DOC_FILE 可读" - else - LOG_ERROR "文档文件 $DOC_FILE 不可读" - exit 1 - fi - else - LOG_ERROR "未找到软件包 $PACKAGE_NAME 的文档文件" - exit 1 - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤6:卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成:软件包 $PACKAGE_NAME 文档存在性测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_help.sh b/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_help.sh deleted file mode 100644 index ac258b133ef..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_help.sh +++ /dev/null @@ -1,82 +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 display of package help or man page -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="texlive-autoarea" - - # 步骤1:检查yum源中是否存在指定的软件包 - LOG_INFO "步骤1:检查yum源中是否存在指定的软件包" - dnf list available "$PACKAGE_NAME" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包:$PACKAGE_NAME" - exit 255 - fi - - # 步骤2:检查是否已安装软件包 - LOG_INFO "步骤2:检查是否已安装软件包" - rpm -q "$PACKAGE_NAME" &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将进行安装" - INSTALLED_BEFORE=0 - fi - - # 步骤3:如果未安装,则安装软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4:测试显示软件包帮助或手册页 - LOG_INFO "步骤4:测试显示软件包帮助或手册页" - # 尝试使用--help参数 - autoarea --help &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "autoarea 命令支持 --help 参数" - else - # 尝试使用man手册 - man autoarea &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "autoarea 命令有man手册页" - else - LOG_ERROR "autoarea 命令既不支持 --help 参数,也没有man手册页" - exit 255 - fi - fi - - # 步骤5:清理环境 - LOG_INFO "步骤5:清理环境" - if [ $INSTALLED_BEFORE -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-b/texlive-autoarea/test_texlive-autoarea_function_listfiles.sh b/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_listfiles.sh deleted file mode 100644 index feb650ceb98..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_listfiles.sh +++ /dev/null @@ -1,133 +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 listing files provided by package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量和常量 - PACKAGE_NAME="texlive-autoarea" - COMMAND="rpm" - COMMAND_ARGS="-ql" - TEST_FILE_PATTERN="/usr/share/texlive/texmf-dist/tex/latex/autoarea" - - # 日志函数(直接使用,无需定义) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - 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 存在于yum源中" - } - - # 检查命令参数是否支持 - check_command_args() { - LOG_INFO "检查命令 $COMMAND 是否支持参数 $COMMAND_ARGS" - $COMMAND --help 2>&1 | grep -q "\-ql" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $COMMAND 不支持参数 $COMMAND_ARGS" - exit 255 - fi - LOG_INFO "命令 $COMMAND 支持参数 $COMMAND_ARGS" - } - - # 检查软件包是否已安装 - check_package_installed() { - LOG_INFO "检查软件包 $PACKAGE_NAME 是否已安装" - rpm -q "$PACKAGE_NAME" &>/dev/null - return $? - } - - # 安装软件包 - install_package() { - LOG_INFO "开始安装软件包: $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - LOG_INFO "软件包 $PACKAGE_NAME 安装成功" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "开始卸载软件包: $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - LOG_INFO "软件包 $PACKAGE_NAME 卸载成功" - } - - # 测试列出软件包提供的文件 - test_list_files() { - LOG_INFO "测试列出软件包 $PACKAGE_NAME 提供的文件" - $COMMAND $COMMAND_ARGS "$PACKAGE_NAME" | grep -q "$TEST_FILE_PATTERN" - CHECK_RESULT $? 0 0 "列出软件包 $PACKAGE_NAME 提供的文件失败或文件不匹配" - LOG_INFO "成功列出软件包 $PACKAGE_NAME 提供的文件" - } - - # 主测试流程 - main() { - LOG_INFO "开始测试: Test listing files provided by package" - - # 检查yum源中是否存在软件包 - check_package_in_repo - - # 检查命令参数是否支持 - check_command_args - - # 检查软件包是否已安装 - local was_installed=0 - if check_package_installed; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - was_installed=1 - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - fi - - # 如果未安装,则安装 - if [ $was_installed -eq 0 ]; then - install_package - fi - - # 执行测试 - test_list_files - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ $was_installed -eq 0 ]; then - # 测试前未安装,测试后卸载 - uninstall_package - else - LOG_INFO "保持软件包 $PACKAGE_NAME 的安装状态" - fi - - LOG_INFO "测试完成: Test listing files provided by package" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_usage.sh b/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_usage.sh deleted file mode 100644 index 45543f4133f..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-b/texlive-autoarea/test_texlive-autoarea_function_usage.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-28 -# @License : Mulan PSL v2 -# @Desc : Test basic usage of autoarea in LaTeX -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic usage of autoarea in LaTeX" - LOG_INFO "步骤1:检查是否已安装texlive-autoarea软件包" - if dnf list installed texlive-autoarea &>/dev/null; then - LOG_INFO "texlive-autoarea已安装,测试后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-autoarea未安装,将在测试前安装,并在测试后卸载" - INSTALLED=0 - fi - - LOG_INFO "步骤2:检查yum源中是否有texlive-autoarea软件包" - if ! dnf list available texlive-autoarea &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-autoarea软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-autoarea软件包" - dnf install -y texlive-autoarea - CHECK_RESULT $? 0 0 "安装texlive-autoarea失败" - fi - - LOG_INFO "步骤4:检查autoarea命令是否支持所需参数" - autoarea --help 2>&1 | grep -q -- "--version" - CHECK_RESULT $? 0 0 "autoarea命令不支持--version参数" - if [ $? -ne 0 ]; then - LOG_ERROR "autoarea命令不支持--version参数" - exit 255 - fi - - LOG_INFO "步骤5:执行autoarea --version命令" - autoarea --version - CHECK_RESULT $? 0 0 "执行autoarea --version失败" - - LOG_INFO "步骤6:创建一个简单的LaTeX文件测试autoarea功能" - cat > test_autoarea.tex << "EOF" - \documentclass{article} - \usepackage{autoarea} - \begin{document} - Test autoarea package. - \end{document} - EOF - pdflatex -interaction=nonstopmode test_autoarea.tex - CHECK_RESULT $? 0 0 "使用autoarea包编译LaTeX文件失败" - - LOG_INFO "步骤7:清理测试文件" - rm -f test_autoarea.tex test_autoarea.log test_autoarea.aux test_autoarea.pdf - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤8:卸载texlive-autoarea软件包" - dnf remove -y texlive-autoarea - CHECK_RESULT $? 0 0 "卸载texlive-autoarea失败" - fi - - LOG_INFO "测试完成:Test basic usage of autoarea in LaTeX" -} - -main "$@" \ No newline at end of file From 6b651dab175ca6d7a93a30386b44117cab2688ab Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:04:26 +0800 Subject: [PATCH 21/25] update testcase for testsuite texlive-matapli --- .../texlive-split-x/texlive-matapli.json | 10 --- .../test_texlive-matapli_function_compile.sh | 79 ------------------- 2 files changed, 89 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-x/texlive-matapli.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-matapli/test_texlive-matapli_function_compile.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-matapli.json b/suite2cases/function_test/pkg_test/texlive-split-x/texlive-matapli.json deleted file mode 100644 index 541195318a5..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-matapli.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-matapli", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-matapli_function_compile", - "desc": "Test compilation of matapli documents" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-matapli/test_texlive-matapli_function_compile.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-matapli/test_texlive-matapli_function_compile.sh deleted file mode 100644 index f197a4b8ffe..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-matapli/test_texlive-matapli_function_compile.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test compilation of matapli documents -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试: Test compilation of matapli documents" - - # 检查是否已安装texlive-matapli - LOG_INFO "检查texlive-matapli是否已安装" - dnf list installed texlive-matapli > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-matapli已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-matapli未安装,测试结束后将卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-matapli - LOG_INFO "检查yum源中是否存在texlive-matapli" - dnf list available texlive-matapli > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-matapli,退出测试" - exit 255 - fi - - # 如果未安装,则安装texlive-matapli - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装texlive-matapli" - dnf install -y texlive-matapli > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-matapli失败" - fi - - # 测试编译matapli文档功能 - LOG_INFO "测试编译matapli文档功能" - cat < test.tex - \documentclass{article} - \begin{document} - Hello, matapli! - \end{document} - EOF - - pdflatex test.tex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译matapli文档失败" - - # 清理生成的临时文件 - LOG_INFO "清理临时文件" - rm -f test.tex test.aux test.log test.pdf - - # 如果测试前未安装,则卸载texlive-matapli - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-matapli" - dnf remove -y texlive-matapli > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-matapli失败" - fi - - LOG_INFO "测试完成: Test compilation of matapli documents" - -} - -main "$@" \ No newline at end of file From 8463b917fb11575547a15a088fc2a2e6c328fe55 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:07:00 +0800 Subject: [PATCH 22/25] update testcase for testsuite texlive-lgreek-doc --- .../texlive-split-n/texlive-lgreek-doc.json | 4 - ...texlive-lgreek-doc_function_check_files.sh | 93 ------------------- 2 files changed, 97 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc/test_texlive-lgreek-doc_function_check_files.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc.json b/suite2cases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc.json index 6bbdbfdc40b..e97fcaee6a1 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc.json @@ -11,10 +11,6 @@ "name": "test_texlive-lgreek-doc_function_install", "desc": "测试 texlive-lgreek-doc 软件包的安装功能,验证是否能够成功安装。" }, - { - "name": "test_texlive-lgreek-doc_function_check_files", - "desc": "测试 texlive-lgreek-doc 软件包安装后关键文档文件的存在性,验证安装内容的完整性。" - }, { "name": "test_texlive-lgreek-doc_function_usage_info", "desc": "测试 texlive-lgreek-doc 软件包文档的可访问性,验证用户能否找到并阅读相关使用信息。" diff --git a/testcases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc/test_texlive-lgreek-doc_function_check_files.sh b/testcases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc/test_texlive-lgreek-doc_function_check_files.sh deleted file mode 100644 index 81634a59742..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-n/texlive-lgreek-doc/test_texlive-lgreek-doc_function_check_files.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-04-03 -# @License : Mulan PSL v2 -# @Desc : 测试 texlive-lgreek-doc 软件包安装后关键文档文件的存在性,验证安装内容的完整性。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-lgreek-doc软件包 - LOG_INFO "检查texlive-lgreek-doc软件包是否已安装" - rpm -q texlive-lgreek-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-lgreek-doc已安装,脚本结束后将保持安装状态" - already_installed=1 - else - LOG_INFO "texlive-lgreek-doc未安装,将在测试步骤中安装" - already_installed=0 - fi - - # 检查yum源中是否存在texlive-lgreek-doc软件包 - LOG_INFO "检查yum源中是否存在texlive-lgreek-doc软件包" - dnf list available texlive-lgreek-doc > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-lgreek-doc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装texlive-lgreek-doc软件包" - dnf install -y texlive-lgreek-doc - CHECK_RESULT $? 0 0 "安装texlive-lgreek-doc软件包失败" - fi - - # 验证安装内容的完整性 - LOG_INFO "验证texlive-lgreek-doc软件包安装后关键文档文件的存在性" - - # 检查texlive-lgreek-doc软件包安装的文件列表 - LOG_INFO "获取texlive-lgreek-doc软件包安装的文件列表" - rpm -ql texlive-lgreek-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "获取texlive-lgreek-doc软件包文件列表失败" - - # 检查关键文档文件是否存在 - LOG_INFO "检查关键文档文件是否存在" - # 这里检查几个预期的关键文档文件,可以根据实际软件包内容调整 - expected_files=( - "/usr/share/texlive/texmf-dist/doc/latex/lgreek/README" - "/usr/share/texlive/texmf-dist/doc/latex/lgreek/lgreek.pdf" - ) - - for file in "${expected_files[@]}"; do - if [ -f "$file" ]; then - LOG_INFO "文件 $file 存在" - else - LOG_ERROR "关键文档文件 $file 不存在" - # 如果未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - dnf remove -y texlive-lgreek-doc - fi - exit 1 - fi - done - - LOG_INFO "所有关键文档文件检查通过" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "清理环境:卸载texlive-lgreek-doc软件包" - dnf remove -y texlive-lgreek-doc - CHECK_RESULT $? 0 0 "卸载texlive-lgreek-doc软件包失败" - LOG_INFO "环境已恢复到测试前状态" - else - LOG_INFO "测试前已安装texlive-lgreek-doc,保持安装状态" - fi - - LOG_INFO "texlive-lgreek-doc软件包关键文档文件存在性测试完成" -} - -main "$@" \ No newline at end of file From ac2574eb0a35ef1a5a9e6acc846ab55bf779f434 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:07:12 +0800 Subject: [PATCH 23/25] update testcase for testsuite python3-brotli --- .../pkg_test/brotli/python3-brotli.json | 36 ------ ..._python3-brotli_function_basic_compress.sh | 90 --------------- ...ython3-brotli_function_basic_decompress.sh | 105 ------------------ ...t_python3-brotli_function_file_compress.sh | 101 ----------------- ...python3-brotli_function_file_decompress.sh | 80 ------------- ...t_python3-brotli_function_quality_param.sh | 100 ----------------- ...python3-brotli_function_stream_compress.sh | 79 ------------- ...thon3-brotli_function_stream_decompress.sh | 96 ---------------- .../test_python3-brotli_function_uninstall.sh | 81 -------------- ...t_python3-brotli_function_version_check.sh | 64 ----------- 10 files changed, 832 deletions(-) delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_compress.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_decompress.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_compress.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_decompress.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_quality_param.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_compress.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_decompress.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_version_check.sh diff --git a/suite2cases/function_test/pkg_test/brotli/python3-brotli.json b/suite2cases/function_test/pkg_test/brotli/python3-brotli.json index 8229bf18dd3..4f8ae30ca7f 100644 --- a/suite2cases/function_test/pkg_test/brotli/python3-brotli.json +++ b/suite2cases/function_test/pkg_test/brotli/python3-brotli.json @@ -9,42 +9,6 @@ { "name": "test_python3-brotli_function_install_check", "desc": "Check if python3-brotli package is installed on the system" - }, - { - "name": "test_python3-brotli_function_basic_compress", - "desc": "Test basic compression functionality of brotli module" - }, - { - "name": "test_python3-brotli_function_basic_decompress", - "desc": "Test basic decompression functionality of brotli module" - }, - { - "name": "test_python3-brotli_function_file_compress", - "desc": "Test compressing a file using brotli module" - }, - { - "name": "test_python3-brotli_function_file_decompress", - "desc": "Test decompressing a file using brotli module" - }, - { - "name": "test_python3-brotli_function_uninstall", - "desc": "Test uninstalling the python3-brotli package" - }, - { - "name": "test_python3-brotli_function_stream_compress", - "desc": "Test streaming compression with brotli" - }, - { - "name": "test_python3-brotli_function_stream_decompress", - "desc": "Test streaming decompression with brotli" - }, - { - "name": "test_python3-brotli_function_quality_param", - "desc": "Test compression with quality parameter" - }, - { - "name": "test_python3-brotli_function_version_check", - "desc": "Check brotli module version" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_compress.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_compress.sh deleted file mode 100644 index 76343fffcd2..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_compress.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-28 -# @License : Mulan PSL v2 -# @Desc : Test basic compression functionality of brotli module -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断Python3-brotli软件包是否已安装 - LOG_INFO "检查Python3-brotli软件包是否已安装" - if rpm -q python3-brotli > /dev/null 2>&1; then - LOG_INFO "Python3-brotli软件包已安装" - INSTALLED="true" - else - LOG_INFO "Python3-brotli软件包未安装" - INSTALLED="false" - fi - - # 检查yum源中是否有python3-brotli软件包 - LOG_INFO "检查yum源中是否有python3-brotli软件包" - if ! dnf list available python3-brotli > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-brotli软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装python3-brotli软件包" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli软件包失败" - fi - - # 测试brotli模块的基本压缩功能 - LOG_INFO "测试brotli模块的基本压缩功能" - cat > test_brotli.py << "EOF" - import brotli - - # 测试数据 - test_data = b"This is a test string for brotli compression." - - # 压缩数据 - compressed = brotli.compress(test_data) - print(f"Compressed size: {len(compressed)}") - - # 解压数据 - decompressed = brotli.decompress(compressed) - print(f"Decompressed size: {len(decompressed)}") - - # 验证数据是否一致 - if test_data == decompressed: - print("SUCCESS: Data matches after compression and decompression") - exit(0) - else: - print("FAILURE: Data does not match after compression and decompression") - exit(1) - EOF - - # 执行Python测试脚本 - python3 test_brotli.py - CHECK_RESULT $? 0 0 "brotli模块基本压缩功能测试失败" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f test_brotli.py - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-brotli软件包" - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_decompress.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_decompress.sh deleted file mode 100644 index 7d457b134f5..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_basic_decompress.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-28 -# @License : Mulan PSL v2 -# @Desc : Test basic decompression functionality of brotli module -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:Test basic decompression functionality of brotli module" - - LOG_INFO "步骤1:检查系统中是否已安装python3-brotli软件包" - if rpm -q python3-brotli &>/dev/null; then - LOG_INFO "python3-brotli已安装,将在测试结束后保持安装状态" - INSTALLED="yes" - else - LOG_INFO "python3-brotli未安装,将在测试过程中安装" - INSTALLED="no" - fi - - LOG_INFO "步骤2:检查yum源中是否有python3-brotli软件包" - if ! dnf list available python3-brotli &>/dev/null; then - LOG_ERROR "yum源中未找到python3-brotli软件包" - exit 255 - fi - - if [[ "$INSTALLED" == "no" ]]; then - LOG_INFO "步骤3:安装python3-brotli软件包" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli失败" - fi - - LOG_INFO "步骤4:测试brotli模块的基本解压功能" - cat > test_brotli.py << "EOF" - import brotli - import sys - - test_data = b"Hello, this is a test string for brotli compression!" - compressed = brotli.compress(test_data) - decompressed = brotli.decompress(compressed) - - if decompressed == test_data: - print("SUCCESS: Brotli decompression test passed") - sys.exit(0) - else: - print("FAILED: Brotli decompression test failed") - sys.exit(1) - EOF - - python3 test_brotli.py - CHECK_RESULT $? 0 0 "brotli模块基本解压功能测试失败" - - rm -f test_brotli.py - - LOG_INFO "步骤5:测试brotli命令行工具的解压功能" - echo "Test data for brotli command line" > test_file.txt - brotli -k test_file.txt - CHECK_RESULT $? 0 0 "brotli压缩失败" - - brotli -d -o test_file_decompressed.txt test_file.txt.br - CHECK_RESULT $? 0 0 "brotli解压失败" - - if cmp -s test_file.txt test_file_decompressed.txt; then - LOG_INFO "brotli命令行工具解压测试通过" - else - LOG_ERROR "brotli命令行工具解压测试失败" - exit 1 - fi - - rm -f test_file.txt test_file.txt.br test_file_decompressed.txt - - LOG_INFO "步骤6:测试无效参数处理" - if brotli --invalid-param &>/dev/null; then - LOG_ERROR "brotli命令应该拒绝无效参数" - exit 255 - fi - - LOG_INFO "步骤7:清理测试环境" - if [[ "$INSTALLED" == "no" ]]; then - LOG_INFO "卸载python3-brotli软件包" - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli失败" - else - LOG_INFO "保持python3-brotli安装状态" - fi - - LOG_INFO "测试完成:Test basic decompression functionality of brotli module" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_compress.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_compress.sh deleted file mode 100644 index 10fdb73a353..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_compress.sh +++ /dev/null @@ -1,101 +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-28 -# @License : Mulan PSL v2 -# @Desc : Test compressing a file using brotli module -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:使用brotli模块压缩文件" - - # 检查yum源中是否存在python3-brotli包 - LOG_INFO "检查yum源中是否存在python3-brotli包" - dnf list available python3-brotli &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-brotli包" - exit 255 - fi - - # 检查python3-brotli是否已安装 - LOG_INFO "检查python3-brotli是否已安装" - rpm -q python3-brotli &> /dev/null - installed=$? - - # 如果未安装,则安装软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "安装python3-brotli包" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli失败" - fi - - # 创建测试文件 - LOG_INFO "创建测试文件" - echo "This is a test file for brotli compression." > /tmp/test_brotli.txt - CHECK_RESULT $? 0 0 "创建测试文件失败" - - # 检查brotli命令是否存在 - LOG_INFO "检查brotli命令是否存在" - which brotli &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "brotli命令不存在" - # 如果之前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "卸载python3-brotli包" - dnf remove -y python3-brotli - fi - exit 255 - fi - - # 检查brotli命令是否支持压缩参数 - LOG_INFO "检查brotli命令是否支持压缩参数" - brotli --help | grep -q "\-o" - if [ $? -ne 0 ]; then - LOG_ERROR "brotli命令不支持-o参数" - # 如果之前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "卸载python3-brotli包" - dnf remove -y python3-brotli - fi - exit 255 - fi - - # 使用brotli压缩文件 - LOG_INFO "使用brotli压缩文件" - brotli -o /tmp/test_brotli.txt.br /tmp/test_brotli.txt - CHECK_RESULT $? 0 0 "brotli压缩文件失败" - - # 检查压缩文件是否存在 - LOG_INFO "检查压缩文件是否存在" - [ -f /tmp/test_brotli.txt.br ] - CHECK_RESULT $? 0 0 "压缩文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test_brotli.txt /tmp/test_brotli.txt.br - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "卸载python3-brotli包" - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli失败" - fi - - LOG_INFO "测试完成:使用brotli模块压缩文件" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_decompress.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_decompress.sh deleted file mode 100644 index 4e01b82f227..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_file_decompress.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-01-28 -# @License : Mulan PSL v2 -# @Desc : Test decompressing a file using brotli module -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:使用brotli模块解压缩文件" - LOG_INFO "步骤1: 检查是否已安装python3-brotli软件包" - rpm -q python3-brotli > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到python3-brotli已安装,测试结束后将保持安装状态" - installed=true - else - LOG_INFO "python3-brotli未安装,将在测试过程中安装" - installed=false - fi - LOG_INFO "步骤2: 检查yum源中是否存在python3-brotli软件包" - dnf list available python3-brotli > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到python3-brotli软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在python3-brotli,无法进行测试" - exit 255 - fi - if [ "$installed" = false ]; then - LOG_INFO "步骤3: 安装python3-brotli软件包" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli失败" - fi - LOG_INFO "步骤4: 创建测试用的压缩文件" - echo "This is a test file for brotli decompression." > test_input.txt - brotli -9 -f test_input.txt -o test_input.txt.br - CHECK_RESULT $? 0 0 "使用brotli命令压缩测试文件失败" - LOG_INFO "步骤5: 使用Python brotli模块解压缩文件" - python3 -c " - import brotli - import sys - try: - with open("test_input.txt.br", "rb") as f: - compressed_data = f.read() - decompressed_data = brotli.decompress(compressed_data) - with open("test_decompressed.txt", "wb") as f: - f.write(decompressed_data) - print("解压缩成功") - except Exception as e: - print(f"解压缩失败: {e}") - sys.exit(1) - " - CHECK_RESULT $? 0 0 "使用Python brotli模块解压缩文件失败" - LOG_INFO "步骤6: 验证解压缩后的文件内容" - diff test_input.txt test_decompressed.txt > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "解压缩后的文件内容与原始文件不一致" - LOG_INFO "步骤7: 清理测试过程中创建的临时文件" - rm -f test_input.txt test_input.txt.br test_decompressed.txt - if [ "$installed" = false ]; then - LOG_INFO "步骤8: 卸载测试过程中安装的python3-brotli软件包" - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli失败" - else - LOG_INFO "步骤8: 测试前已安装python3-brotli,保持安装状态,不进行卸载" - fi - LOG_INFO "测试结束:使用brotli模块解压缩文件测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_quality_param.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_quality_param.sh deleted file mode 100644 index a10f791dc7e..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_quality_param.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-01-30 -# @License : Mulan PSL v2 -# @Desc : Test compression with quality parameter -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test compression with quality parameter" - - LOG_INFO "步骤1:检查yum源中是否存在python3-brotli软件包" - dnf list available python3-brotli 2>/dev/null | grep -q python3-brotli - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-brotli软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查环境是否已安装python3-brotli" - rpm -q python3-brotli > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装python3-brotli,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "环境未安装python3-brotli,将进行安装" - INSTALLED=false - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-brotli软件包" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli失败" - fi - - LOG_INFO "步骤4:测试brotli压缩命令,使用quality参数" - python3 -c "import brotli; print("Brotli module imported successfully")" 2>&1 - CHECK_RESULT $? 0 0 "导入brotli模块失败" - - LOG_INFO "步骤5:测试压缩功能,使用quality参数为4" - echo "test data for compression" > test_input.txt - python3 -c " - import brotli - with open("test_input.txt", "rb") as f: - data = f.read() - compressed = brotli.compress(data, quality=4) - print("Compression successful") - " 2>&1 - CHECK_RESULT $? 0 0 "使用quality参数压缩失败" - - LOG_INFO "步骤6:测试压缩功能,使用quality参数为11(最大质量)" - python3 -c " - import brotli - with open("test_input.txt", "rb") as f: - data = f.read() - compressed = brotli.compress(data, quality=11) - print("Compression with max quality successful") - " 2>&1 - CHECK_RESULT $? 0 0 "使用最大quality参数压缩失败" - - LOG_INFO "步骤7:测试不支持的quality参数(如-1)" - python3 -c " - import brotli - with open("test_input.txt", "rb") as f: - data = f.read() - try: - compressed = brotli.compress(data, quality=-1) - print("Unexpected success with invalid quality") - except Exception as e: - print("Invalid quality parameter handled correctly:", str(e)) - " 2>&1 | grep -q "Invalid quality parameter handled correctly" - CHECK_RESULT $? 0 0 "无效quality参数未正确处理" - - LOG_INFO "步骤8:清理测试文件" - rm -f test_input.txt - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载python3-brotli软件包" - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli失败" - else - LOG_INFO "步骤9:保持python3-brotli安装状态,不进行卸载" - fi - - LOG_INFO "测试完成:Test compression with quality parameter" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_compress.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_compress.sh deleted file mode 100644 index 8f3e9f2170e..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_compress.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-30 -# @License : Mulan PSL v2 -# @Desc : Test streaming compression with brotli -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:Test streaming compression with brotli" - LOG_INFO "步骤1:检查环境中是否已安装python3-brotli软件包" - if rpm -q python3-brotli &>/dev/null; then - LOG_INFO "python3-brotli已安装,脚本结束前将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-brotli未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有python3-brotli软件包" - if ! dnf list available python3-brotli &>/dev/null; then - LOG_ERROR "yum源中未找到python3-brotli软件包,退出测试" - exit 255 - fi - - LOG_INFO "步骤3:安装python3-brotli软件包" - if [ "$INSTALLED" = false ]; then - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli失败" - fi - - LOG_INFO "步骤4:检查brotli命令是否存在" - if ! command -v brotli &>/dev/null; then - LOG_ERROR "brotli命令不存在,退出测试" - exit 255 - fi - - LOG_INFO "步骤5:测试流式压缩功能" - echo "Hello, OpenEuler!" > test_input.txt - cat test_input.txt | brotli --compress > test_output.br - CHECK_RESULT $? 0 0 "流式压缩失败" - - LOG_INFO "步骤6:验证压缩文件" - brotli --decompress test_output.br -o test_decompressed.txt - CHECK_RESULT $? 0 0 "解压缩失败" - - LOG_INFO "步骤7:比较原始文件与解压后文件" - cmp test_input.txt test_decompressed.txt - CHECK_RESULT $? 0 0 "原始文件与解压后文件内容不一致" - - LOG_INFO "步骤8:清理测试文件" - rm -f test_input.txt test_output.br test_decompressed.txt - - LOG_INFO "步骤9:恢复环境" - if [ "$INSTALLED" = false ]; then - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli失败" - LOG_INFO "已卸载python3-brotli软件包" - else - LOG_INFO "保持python3-brotli软件包安装状态" - fi - - LOG_INFO "测试结束:Test streaming compression with brotli" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_decompress.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_decompress.sh deleted file mode 100644 index d0bb2f9da8e..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_stream_decompress.sh +++ /dev/null @@ -1,96 +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-30 -# @License : Mulan PSL v2 -# @Desc : Test streaming decompression with brotli -# ############################################ - -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="python3-brotli" - - # 检查软件包是否已在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 "检查软件包是否已安装" - 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 "安装软件包失败" - fi - - # 检查brotli命令是否存在 - LOG_INFO "检查brotli命令是否存在" - which brotli &>/dev/null - CHECK_RESULT $? 0 0 "brotli命令不存在" - - # 测试流式解压缩功能 - LOG_INFO "测试流式解压缩功能" - - # 创建测试文件 - TEST_FILE="/tmp/test_brotli_stream.txt" - echo "这是一个用于测试brotli流式解压缩的文件内容" > ${TEST_FILE} - - # 压缩文件 - COMPRESSED_FILE="/tmp/test_brotli_stream.br" - LOG_INFO "压缩测试文件" - brotli -f -o ${COMPRESSED_FILE} ${TEST_FILE} - CHECK_RESULT $? 0 0 "压缩文件失败" - - # 测试流式解压缩 - DECOMPRESSED_FILE="/tmp/test_brotli_stream_decompressed.txt" - LOG_INFO "执行流式解压缩" - cat ${COMPRESSED_FILE} | brotli -d > ${DECOMPRESSED_FILE} - CHECK_RESULT $? 0 0 "流式解压缩失败" - - # 验证解压缩后的内容 - LOG_INFO "验证解压缩后的内容" - diff ${TEST_FILE} ${DECOMPRESSED_FILE} - CHECK_RESULT $? 0 0 "解压缩后的文件内容不一致" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f ${TEST_FILE} ${COMPRESSED_FILE} ${DECOMPRESSED_FILE} - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装软件包,则在结束时卸载 - if [ ${PACKAGE_INSTALLED} -ne 0 ]; then - LOG_INFO "卸载软件包: ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成: Test streaming decompression with brotli" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_uninstall.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_uninstall.sh deleted file mode 100644 index e9c800cf86e..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_uninstall.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-01-28 -# @License : Mulan PSL v2 -# @Desc : Test uninstalling the python3-brotli package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 步骤1: 检查yum源中是否存在python3-brotli软件包 - LOG_INFO "检查yum源中是否存在python3-brotli软件包" - if ! dnf list available python3-brotli &> /dev/null; then - LOG_ERROR "yum源中未找到python3-brotli软件包" - exit 255 - fi - - # 步骤2: 检查当前环境是否已安装python3-brotli - LOG_INFO "检查当前环境是否已安装python3-brotli" - if rpm -q python3-brotli &> /dev/null; then - LOG_INFO "环境已安装python3-brotli,标记为保持安装状态" - KEEP_INSTALLED=1 - else - LOG_INFO "环境未安装python3-brotli,标记为测试安装" - KEEP_INSTALLED=0 - fi - - # 步骤3: 如果未安装,则安装python3-brotli - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-brotli软件包" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli失败" - fi - - # 步骤4: 验证python3-brotli功能 - LOG_INFO "验证python3-brotli基本功能" - python3 -c "import brotli; print("brotli module imported successfully")" &> /dev/null - CHECK_RESULT $? 0 0 "python3-brotli功能验证失败" - - # 步骤5: 卸载python3-brotli软件包 - LOG_INFO "卸载python3-brotli软件包" - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli失败" - - # 步骤6: 验证卸载后软件包不存在 - LOG_INFO "验证python3-brotli已卸载" - if rpm -q python3-brotli &> /dev/null; then - LOG_ERROR "python3-brotli卸载后仍然存在" - exit 1 - else - LOG_INFO "python3-brotli已成功卸载" - fi - - # 步骤7: 环境恢复 - LOG_INFO "环境恢复" - if [ $KEEP_INSTALLED -eq 1 ]; then - LOG_INFO "重新安装python3-brotli以恢复原始状态" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "重新安装python3-brotli失败" - else - LOG_INFO "原始环境未安装python3-brotli,无需恢复" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_version_check.sh b/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_version_check.sh deleted file mode 100644 index 8d496bb297c..00000000000 --- a/testcases/function_test/pkg_test/brotli/python3-brotli/test_python3-brotli_function_version_check.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 : 2026-01-30 -# @License : Mulan PSL v2 -# @Desc : Check brotli module version -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查brotli模块版本" - - # 检查是否已安装python3-brotli - LOG_INFO "步骤1:检查python3-brotli是否已安装" - if dnf list installed python3-brotli &>/dev/null; then - LOG_INFO "python3-brotli已安装,标记为需要保持安装状态" - INSTALLED_ALREADY=1 - else - LOG_INFO "python3-brotli未安装,标记为需要测试后卸载" - INSTALLED_ALREADY=0 - fi - - # 检查yum源中是否有python3-brotli软件包 - LOG_INFO "步骤2:检查yum源中是否有python3-brotli软件包" - if ! dnf list available python3-brotli &>/dev/null; then - LOG_ERROR "yum源中未找到python3-brotli软件包" - exit 255 - fi - - # 如果未安装,则安装python3-brotli - if [ $INSTALLED_ALREADY -eq 0 ]; then - LOG_INFO "步骤3:安装python3-brotli软件包" - dnf install -y python3-brotli - CHECK_RESULT $? 0 0 "安装python3-brotli失败" - fi - - # 检查brotli模块版本 - LOG_INFO "步骤4:检查brotli模块版本" - python3 -c "import brotli; print(brotli.__version__)" 2>/dev/null - CHECK_RESULT $? 0 0 "获取brotli模块版本失败" - - # 清理环境:如果测试前未安装,则卸载python3-brotli - if [ $INSTALLED_ALREADY -eq 0 ]; then - LOG_INFO "步骤5:卸载python3-brotli软件包" - dnf remove -y python3-brotli - CHECK_RESULT $? 0 0 "卸载python3-brotli失败" - fi - - LOG_INFO "测试完成:brotli模块版本检查成功" -} - -main "$@" \ No newline at end of file From 603256def6e0289452393919625755b833dc78b8 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:08:38 +0800 Subject: [PATCH 24/25] update testcase for testsuite texlive-context-fancybreak-doc --- .../texlive-context-fancybreak-doc.json | 10 --- ...ive-context-fancybreak-doc_function_doc.sh | 72 ------------------- 2 files changed, 82 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc/test_texlive-context-fancybreak-doc_function_doc.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc.json b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc.json deleted file mode 100644 index ad55fe30321..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-context-fancybreak-doc_function_doc", - "desc": "Verify the documentation files are correctly installed" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc/test_texlive-context-fancybreak-doc_function_doc.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc/test_texlive-context-fancybreak-doc_function_doc.sh deleted file mode 100644 index c28834384cf..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-context-fancybreak-doc/test_texlive-context-fancybreak-doc_function_doc.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-27 -# @License : Mulan PSL v2 -# @Desc : Verify the documentation files are correctly installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试:验证文档文件是否正确安装" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在texlive-context-fancybreak-doc软件包" - dnf list available texlive-context-fancybreak-doc > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-context-fancybreak-doc软件包" - exit 255 - fi - - # 检查是否已安装软件包 - LOG_INFO "检查是否已安装texlive-context-fancybreak-doc软件包" - rpm -q texlive-context-fancybreak-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - installed=true - LOG_INFO "texlive-context-fancybreak-doc软件包已安装,测试完成后将保持安装状态" - else - installed=false - LOG_INFO "texlive-context-fancybreak-doc软件包未安装,测试完成后将卸载" - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装texlive-context-fancybreak-doc软件包" - dnf install -y texlive-context-fancybreak-doc - CHECK_RESULT $? 0 0 "安装texlive-context-fancybreak-doc软件包失败" - fi - - # 验证文档文件是否正确安装 - LOG_INFO "验证文档文件是否正确安装" - ls /usr/share/doc/texlive-context-fancybreak-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "文档文件未正确安装" - - # 如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-context-fancybreak-doc软件包" - dnf remove -y texlive-context-fancybreak-doc - CHECK_RESULT $? 0 0 "卸载texlive-context-fancybreak-doc软件包失败" - - # 再次检查是否卸载成功 - rpm -q texlive-context-fancybreak-doc > /dev/null 2>&1 - CHECK_RESULT $? 1 0 "卸载后仍检测到texlive-context-fancybreak-doc软件包" - fi - - LOG_INFO "测试完成:文档文件验证通过" - -} - -main "$@" \ No newline at end of file From cc4886d08f7865989cf498db0010110e7ad810f3 Mon Sep 17 00:00:00 2001 From: honghua Date: Sun, 19 Apr 2026 12:09:20 +0800 Subject: [PATCH 25/25] update testcase for testsuite jackson-module-guice --- .../jackson-module-guice.json | 12 --- ...n-module-guice_function_deserialization.sh | 60 ----------- ...jackson-module-guice_function_injection.sh | 100 ------------------ ...son-module-guice_function_serialization.sh | 65 ------------ 4 files changed, 237 deletions(-) delete mode 100644 testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_deserialization.sh delete mode 100644 testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_injection.sh delete mode 100644 testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_serialization.sh diff --git a/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-module-guice.json b/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-module-guice.json index d87921f7eb0..c3619d0c704 100644 --- a/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-module-guice.json +++ b/suite2cases/function_test/pkg_test/jackson-modules-base/jackson-module-guice.json @@ -5,18 +5,6 @@ { "name": "test_jackson-module-guice_function_binding", "desc": "Test Guice binding with Jackson module" - }, - { - "name": "test_jackson-module-guice_function_serialization", - "desc": "Test serialization with Guice module" - }, - { - "name": "test_jackson-module-guice_function_deserialization", - "desc": "Test deserialization with Guice module" - }, - { - "name": "test_jackson-module-guice_function_injection", - "desc": "Test dependency injection" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_deserialization.sh b/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_deserialization.sh deleted file mode 100644 index fafa5c79a58..00000000000 --- a/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_deserialization.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 : 2025-12-04 -# @License : Mulan PSL v2 -# @Desc : Test deserialization with Guice module -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在jackson-module-guice软件包 - LOG_INFO "检查yum源中是否存在jackson-module-guice软件包" - dnf list available jackson-module-guice > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到jackson-module-guice软件包" - exit 255 - fi - - # 检查是否已安装jackson-module-guice - LOG_INFO "检查是否已安装jackson-module-guice" - rpm -q jackson-module-guice > /dev/null 2>&1 - installed=$? - - # 如果未安装,则安装软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "安装jackson-module-guice软件包" - dnf install -y jackson-module-guice - CHECK_RESULT $? 0 0 "安装jackson-module-guice失败" - fi - - # 测试反序列化功能 - LOG_INFO "测试反序列化功能" - echo "{"key":"value"}" | java -cp /usr/share/java/jackson-module-guice.jar com.fasterxml.jackson.databind.ObjectMapper - CHECK_RESULT $? 0 0 "反序列化测试失败" - - # 如果最初未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "卸载jackson-module-guice软件包" - dnf remove -y jackson-module-guice - CHECK_RESULT $? 0 0 "卸载jackson-module-guice失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_injection.sh b/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_injection.sh deleted file mode 100644 index ef719d7aff8..00000000000 --- a/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_injection.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 : 2025-12-04 -# @License : Mulan PSL v2 -# @Desc : Test dependency injection -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在指定软件包 - check_package_existence() { - LOG_INFO "检查yum源中是否存在软件包: $1" - if ! dnf list available "$1" &>/dev/null; then - LOG_ERROR "yum源中不存在软件包: $1" - exit 255 - fi - } - - # 安装软件包 - install_package() { - LOG_INFO "安装软件包: $1" - dnf install -y "$1" - CHECK_RESULT $? 0 0 "安装软件包失败" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "卸载软件包: $1" - dnf remove -y "$1" - CHECK_RESULT $? 0 0 "卸载软件包失败" - } - - # 检查软件包是否已安装 - is_package_installed() { - rpm -q "$1" &>/dev/null - return $? - } - - # 主测试函数 - test_dependency_injection() { - local package_name="jackson-module-guice" - local is_installed=false - - # 检查软件包是否已安装 - if is_package_installed "$package_name"; then - LOG_INFO "软件包 $package_name 已安装" - is_installed=true - else - LOG_INFO "软件包 $package_name 未安装" - fi - - # 检查yum源中是否存在该软件包 - check_package_existence "$package_name" - - # 如果未安装,则安装 - if ! $is_installed; then - install_package "$package_name" - fi - - # 测试依赖注入功能 - LOG_INFO "测试依赖注入功能" - # 这里可以添加具体的测试命令 - # 例如:运行一个使用依赖注入的示例程序 - # 假设有一个测试命令 test_guice_injection - if ! command -v test_guice_injection &>/dev/null; then - LOG_ERROR "测试命令 test_guice_injection 不存在或不支持" - exit 255 - fi - - test_guice_injection - CHECK_RESULT $? 0 0 "依赖注入测试失败" - - #如果最初未安装,则卸载 - if ! $is_installed; then - uninstall_package "$package_name" - fi - - LOG_INFO "测试完成,环境已恢复" - } - - #执行主测试函数 - test_dependency_injection - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_serialization.sh b/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_serialization.sh deleted file mode 100644 index 22ecf285463..00000000000 --- a/testcases/function_test/pkg_test/jackson-modules-base/jackson-module-guice/test_jackson-module-guice_function_serialization.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-04 -# @License : Mulan PSL v2 -# @Desc : Test serialization with Guice module -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test serialization with Guice module" - - # 检查软件包是否已安装 - LOG_INFO "检查软件包是否已安装" - if dnf list installed jackson-module-guice &>/dev/null; then - LOG_INFO "软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "软件包未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有jackson-module-guice软件包" - if ! dnf list available jackson-module-guice &>/dev/null; then - LOG_ERROR "yum源中未找到jackson-module-guice软件包" - exit 255 - fi - - # 安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装jackson-module-guice软件包" - dnf install -y jackson-module-guice - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 测试序列化功能 - LOG_INFO "测试序列化功能" - TEST_CMD="java -cp /usr/share/java/jackson-module-guice.jar com.example.SerializeTest" - eval "$TEST_CMD" - CHECK_RESULT $? 0 0 "序列化测试失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载jackson-module-guice软件包" - dnf remove -y jackson-module-guice - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成:Test serialization with Guice module" -} - -main "$@" \ No newline at end of file