From b3802136a76f380bf1f2ddd3f2ef8efe54ccb469 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:19:01 +0800 Subject: [PATCH 01/18] update testcase for testsuite texlive-nature-doc --- .../texlive-split-p/texlive-nature-doc.json | 4 - .../test_texlive-nature-doc_function_doc.sh | 74 ------------------- 2 files changed, 78 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-nature-doc/test_texlive-nature-doc_function_doc.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-p/texlive-nature-doc.json b/suite2cases/function_test/pkg_test/texlive-split-p/texlive-nature-doc.json index 138dc9714d0..19c85ab8174 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-p/texlive-nature-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-p/texlive-nature-doc.json @@ -14,10 +14,6 @@ "name": "test_texlive-nature-doc_function_check", "desc": "Test if package is installed" }, - { - "name": "test_texlive-nature-doc_function_doc", - "desc": "Test documentation access" - }, { "name": "test_texlive-nature-doc_function_version", "desc": "Test package version info" diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-nature-doc/test_texlive-nature-doc_function_doc.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-nature-doc/test_texlive-nature-doc_function_doc.sh deleted file mode 100644 index ff0fcbe900e..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-nature-doc/test_texlive-nature-doc_function_doc.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-06 -# @License : Mulan PSL v2 -# @Desc : Test documentation access -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试文档访问功能" - - # 检查是否已安装texlive-nature-doc软件包 - LOG_INFO "检查texlive-nature-doc是否已安装" - if rpm -q texlive-nature-doc &>/dev/null; then - LOG_INFO "texlive-nature-doc已安装,脚本结束后保持安装状态" - already_installed=true - else - LOG_INFO "texlive-nature-doc未安装" - already_installed=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有texlive-nature-doc软件包" - if ! dnf list available texlive-nature-doc &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-nature-doc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装texlive-nature-doc软件包" - dnf install -y texlive-nature-doc - CHECK_RESULT $? 0 0 "安装texlive-nature-doc失败" - fi - - # 测试文档访问功能 - LOG_INFO "测试文档访问功能" - if [ -d "/usr/share/texlive/texmf-dist/doc/latex/nature" ]; then - LOG_INFO "找到nature文档目录" - if [ -f "/usr/share/texlive/texmf-dist/doc/latex/nature/nature.pdf" ]; then - LOG_INFO "成功访问nature.pdf文档" - else - LOG_ERROR "未找到nature.pdf文档" - CHECK_RESULT 1 0 0 "文档访问测试失败" - fi - else - LOG_ERROR "未找到nature文档目录" - CHECK_RESULT 1 0 0 "文档访问测试失败" - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载texlive-nature-doc软件包" - dnf remove -y texlive-nature-doc - CHECK_RESULT $? 0 0 "卸载texlive-nature-doc失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From f26a0526832c3ca2edc14fffbe439e5c50abf222 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:19:43 +0800 Subject: [PATCH 02/18] update testcase for testsuite texlive-dnaseq --- .../texlive-split-g/texlive-dnaseq.json | 30 ----- ...t_texlive-dnaseq_function_check_version.sh | 79 -------------- ...est_texlive-dnaseq_function_compile_doc.sh | 103 ------------------ .../test_texlive-dnaseq_function_install.sh | 72 ------------ ...test_texlive-dnaseq_function_list_files.sh | 67 ------------ .../test_texlive-dnaseq_function_remove.sh | 83 -------------- .../test_texlive-dnaseq_function_use_macro.sh | 68 ------------ 7 files changed, 502 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-g/texlive-dnaseq.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_check_version.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_compile_doc.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_list_files.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_remove.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_use_macro.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-g/texlive-dnaseq.json b/suite2cases/function_test/pkg_test/texlive-split-g/texlive-dnaseq.json deleted file mode 100644 index 9fb45e31a75..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-g/texlive-dnaseq.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-dnaseq_function_install", - "desc": "Verify package installation" - }, - { - "name": "test_texlive-dnaseq_function_check_version", - "desc": "Check installed package version" - }, - { - "name": "test_texlive-dnaseq_function_list_files", - "desc": "List files provided by the package" - }, - { - "name": "test_texlive-dnaseq_function_use_macro", - "desc": "Test basic macro functionality" - }, - { - "name": "test_texlive-dnaseq_function_compile_doc", - "desc": "Compile a sample document" - }, - { - "name": "test_texlive-dnaseq_function_remove", - "desc": "Verify package removal" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_check_version.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_check_version.sh deleted file mode 100644 index 68284059416..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_check_version.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 : Check installed package version -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查已安装的软件包版本" - LOG_INFO "步骤1:检查当前环境是否已安装texlive-dnaseq软件包" - rpm -q texlive-dnaseq > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-dnaseq软件包已安装,记录当前状态以便后续恢复" - INSTALLED=true - else - LOG_INFO "texlive-dnaseq软件包未安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在texlive-dnaseq软件包" - dnf list available texlive-dnaseq > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-dnaseq软件包" - exit 255 - fi - - LOG_INFO "步骤3:如果软件包未安装,则进行安装" - if [ "$INSTALLED" = "false" ]; then - dnf install -y texlive-dnaseq - CHECK_RESULT $? 0 0 "安装texlive-dnaseq软件包失败" - LOG_INFO "成功安装texlive-dnaseq软件包" - else - LOG_INFO "软件包已安装,跳过安装步骤" - fi - - LOG_INFO "步骤4:检查texlive-dnaseq软件包的版本" - rpm -q --queryformat="%{VERSION}-%{RELEASE}\n" texlive-dnaseq > /tmp/texlive_version.txt - CHECK_RESULT $? 0 0 "查询texlive-dnaseq软件包版本失败" - LOG_INFO "texlive-dnaseq软件包版本信息:" - cat /tmp/texlive_version.txt - - LOG_INFO "步骤5:验证版本信息是否符合预期(此处假设预期版本格式为数字-字母,可根据实际需求调整)" - VERSION=$(cat /tmp/texlive_version.txt) - if echo "$VERSION" | grep -qE "^[0-9]+\.[0-9]+-[0-9]+"; then - LOG_INFO "版本格式正确:$VERSION" - else - LOG_ERROR "版本格式不正确:$VERSION" - exit 1 - fi - - LOG_INFO "步骤6:环境恢复" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载测试安装的texlive-dnaseq软件包" - dnf remove -y texlive-dnaseq - CHECK_RESULT $? 0 0 "卸载texlive-dnaseq软件包失败" - LOG_INFO "成功卸载texlive-dnaseq软件包" - else - LOG_INFO "测试前已安装texlive-dnaseq,保持安装状态" - fi - - rm -f /tmp/texlive_version.txt - LOG_INFO "测试完成:检查已安装的软件包版本" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_compile_doc.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_compile_doc.sh deleted file mode 100644 index bdaf0bb6be2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_compile_doc.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 : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : Compile a sample document -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:判断是否已安装texlive-dnaseq软件包 - LOG_INFO "检查是否已安装texlive-dnaseq软件包" - rpm -q texlive-dnaseq > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-dnaseq已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-dnaseq未安装,将在测试过程中安装并在测试结束后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否存在texlive-dnaseq软件包 - LOG_INFO "检查yum源中是否存在texlive-dnaseq软件包" - dnf list available texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到texlive-dnaseq软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-dnaseq软件包" - exit 255 - fi - - # 安装texlive-dnaseq软件包(如果未安装) - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装texlive-dnaseq软件包" - dnf install -y texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-dnaseq软件包失败" - fi - - # 验证texlive-dnaseq软件包是否安装成功 - LOG_INFO "验证texlive-dnaseq软件包是否安装成功" - rpm -q texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-dnaseq软件包未正确安装" - - # 检查texlive-dnaseq命令是否可用 - LOG_INFO "检查texlive-dnaseq命令是否可用" - which texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-dnaseq命令不可用" - - # 检查texlive-dnaseq命令是否支持编译文档的参数 - LOG_INFO "检查texlive-dnaseq命令是否支持编译文档的参数" - texlive-dnaseq --help 2>&1 | grep -q "compile" - if [ $? -ne 0 ]; then - LOG_ERROR "texlive-dnaseq命令不支持编译文档的参数" - exit 255 - fi - - # 创建一个简单的示例文档 - LOG_INFO "创建一个简单的示例文档用于编译测试" - SAMPLE_DOC="sample_document.tex" - cat > $SAMPLE_DOC << "EOF" - \documentclass{article} - \begin{document} - Hello, this is a sample document for testing texlive-dnaseq. - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建示例文档失败" - - # 使用texlive-dnaseq编译示例文档 - LOG_INFO "使用texlive-dnaseq编译示例文档" - texlive-dnaseq compile $SAMPLE_DOC > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译示例文档失败" - - # 验证编译后的文档是否存在 - LOG_INFO "验证编译后的文档是否存在" - ls sample_document.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译后的文档未生成" - - # 清理测试过程中生成的文件 - LOG_INFO "清理测试过程中生成的文件" - rm -f $SAMPLE_DOC sample_document.pdf sample_document.aux sample_document.log sample_document.out - - # 卸载texlive-dnaseq软件包(如果测试前未安装) - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-dnaseq软件包" - dnf remove -y texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-dnaseq软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_install.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_install.sh deleted file mode 100644 index c8916165c02..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_install.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : Verify package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查环境是否已经安装texlive-dnaseq - LOG_INFO "检查是否已安装texlive-dnaseq" - rpm -q texlive-dnaseq > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-dnaseq已安装,脚本结束后保持安装状态" - installed=true - else - LOG_INFO "texlive-dnaseq未安装,将在脚本结束后卸载" - installed=false - fi - - # 检查yum源中是否有texlive-dnaseq软件包 - LOG_INFO "检查yum源中是否存在texlive-dnaseq软件包" - dnf list available texlive-dnaseq > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-dnaseq软件包" - exit 255 - fi - - # 安装texlive-dnaseq软件包 - LOG_INFO "开始安装texlive-dnaseq软件包" - dnf install -y texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-dnaseq失败" - - # 验证安装是否成功 - LOG_INFO "验证texlive-dnaseq是否安装成功" - rpm -q texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证texlive-dnaseq安装失败" - - # 执行texlive-dnaseq相关命令测试功能(假设命令为dnaseq-test) - LOG_INFO "测试texlive-dnaseq功能" - dnaseq-test --version > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "dnaseq-test命令不存在或不支持" - exit 255 - fi - - # 清理环境:如果脚本开始时未安装,则卸载 - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-dnaseq软件包" - dnf remove -y texlive-dnaseq > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-dnaseq失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_list_files.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_list_files.sh deleted file mode 100644 index 90b149b1cc0..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_list_files.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-20 -# @License : Mulan PSL v2 -# @Desc : List files provided by the package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="texlive-dnaseq" - - # 检查yum源中是否存在指定软件包 - LOG_INFO "检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 在yum源中不存在" - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在" - exit 255 - fi - - # 检查是否已经安装 - LOG_INFO "检查软件包 $PACKAGE_NAME 是否已经安装" - if rpm -q $PACKAGE_NAME > /dev/null 2>&1; then - LOG_INFO "软件包 $PACKAGE_NAME 已经安装" - INSTALLED=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 测试列出软件包提供的文件 - LOG_INFO "列出软件包 $PACKAGE_NAME 提供的文件" - rpm -ql $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "列出软件包 $PACKAGE_NAME 提供的文件失败" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_remove.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_remove.sh deleted file mode 100644 index cd34686d080..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_remove.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-20 -# @License : Mulan PSL v2 -# @Desc : Verify package removal -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:验证包移除功能" - - LOG_INFO "步骤1:检查是否已安装texlive-dnaseq包" - if dnf list installed texlive-dnaseq &>/dev/null; then - LOG_INFO "texlive-dnaseq已安装,标记为需要保持安装状态" - INSTALLED_BEFORE="true" - else - LOG_INFO "texlive-dnaseq未安装,标记为需要测试安装和卸载" - INSTALLED_BEFORE="false" - fi - - LOG_INFO "步骤2:检查yum源中是否存在texlive-dnaseq包" - if ! dnf list available texlive-dnaseq &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-dnaseq包" - exit 255 - fi - - LOG_INFO "步骤3:如果未安装,则安装texlive-dnaseq包" - if [ "$INSTALLED_BEFORE" = "false" ]; then - dnf install -y texlive-dnaseq - CHECK_RESULT $? 0 0 "安装texlive-dnaseq包失败" - LOG_INFO "成功安装texlive-dnaseq包" - else - LOG_INFO "texlive-dnaseq包已存在,跳过安装步骤" - fi - - LOG_INFO "步骤4:验证移除包的命令参数" - if ! dnf remove --help | grep -q "remove"; then - LOG_ERROR "dnf remove命令不支持或参数不存在" - exit 255 - fi - - LOG_INFO "步骤5:执行移除包操作" - dnf remove -y texlive-dnaseq - CHECK_RESULT $? 0 0 "移除texlive-dnaseq包失败" - LOG_INFO "成功移除texlive-dnaseq包" - - LOG_INFO "步骤6:验证包是否已移除" - if dnf list installed texlive-dnaseq &>/dev/null; then - LOG_ERROR "移除后texlive-dnaseq包仍存在" - exit 1 - else - LOG_INFO "验证通过:texlive-dnaseq包已成功移除" - fi - - LOG_INFO "步骤7:环境恢复" - if [ "$INSTALLED_BEFORE" = "true" ]; then - LOG_INFO "恢复原始安装状态:重新安装texlive-dnaseq包" - dnf install -y texlive-dnaseq - CHECK_RESULT $? 0 0 "重新安装texlive-dnaseq包失败" - LOG_INFO "成功恢复texlive-dnaseq包安装状态" - else - LOG_INFO "原始环境未安装texlive-dnaseq包,无需恢复" - fi - - LOG_INFO "测试完成:包移除功能验证成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_use_macro.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_use_macro.sh deleted file mode 100644 index a5d01634cce..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-dnaseq/test_texlive-dnaseq_function_use_macro.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-20 -# @License : Mulan PSL v2 -# @Desc : Test basic macro functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic macro functionality" - - LOG_INFO "步骤1:检查是否已安装texlive-dnaseq软件包" - if rpm -q texlive-dnaseq &> /dev/null; then - LOG_INFO "texlive-dnaseq已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "texlive-dnaseq未安装,将进行安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在texlive-dnaseq软件包" - if ! dnf list available texlive-dnaseq &> /dev/null; then - LOG_ERROR "yum源中未找到texlive-dnaseq软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装texlive-dnaseq软件包" - dnf install -y texlive-dnaseq - CHECK_RESULT $? 0 0 "安装texlive-dnaseq失败" - fi - - LOG_INFO "步骤4:测试basic macro功能 - 检查命令参数" - if ! command -v texlive-dnaseq-command &> /dev/null; then - LOG_ERROR "texlive-dnaseq-command命令不存在" - exit 255 - fi - - LOG_INFO "步骤5:执行测试命令" - texlive-dnaseq-command --test-macro - CHECK_RESULT $? 0 0 "执行basic macro功能测试失败" - - LOG_INFO "步骤6:清理环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载texlive-dnaseq软件包" - dnf remove -y texlive-dnaseq - CHECK_RESULT $? 0 0 "卸载texlive-dnaseq失败" - else - LOG_INFO "保持texlive-dnaseq安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 0b065bb9fbae429f943ceee15a3d82ad5c6bbb57 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:20:35 +0800 Subject: [PATCH 03/18] update testcase for testsuite texlive-scalerel --- .../texlive-split-u/texlive-scalerel.json | 24 ---- ...xlive-scalerel_function_check_installed.sh | 118 ----------------- ...est_texlive-scalerel_function_math_mode.sh | 87 ------------- .../test_texlive-scalerel_function_scale.sh | 64 --------- ...est_texlive-scalerel_function_scale_cmd.sh | 87 ------------- ...test_texlive-scalerel_function_scale_to.sh | 108 ---------------- ...t_texlive-scalerel_function_stretch_cmd.sh | 122 ------------------ 7 files changed, 610 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_check_installed.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_math_mode.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_cmd.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_to.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_stretch_cmd.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scalerel.json b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scalerel.json index 07c7377be4f..b14bda3310b 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scalerel.json +++ b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scalerel.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel", "machine num": 1, "cases": [ - { - "name": "test_texlive-scalerel_function_scale", - "desc": "Test scaling functionality" - }, { "name": "test_texlive-scalerel_function_install", "desc": "Test if the texlive-scalerel package can be successfully installed via package manager" @@ -13,26 +9,6 @@ { "name": "test_texlive-scalerel_function_remove", "desc": "Test if the texlive-scalerel package can be successfully uninstalled" - }, - { - "name": "test_texlive-scalerel_function_check_installed", - "desc": "Test if the texlive-scalerel package is installed and available in the system" - }, - { - "name": "test_texlive-scalerel_function_scale_cmd", - "desc": "Test the basic \\scaleobj command for scaling objects" - }, - { - "name": "test_texlive-scalerel_function_stretch_cmd", - "desc": "Test the \\stretchrel command for stretching objects" - }, - { - "name": "test_texlive-scalerel_function_scale_to", - "desc": "Test scaling one object to match another with \\scalerel*" - }, - { - "name": "test_texlive-scalerel_function_math_mode", - "desc": "Test scaling functionality within mathematical mode" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_check_installed.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_check_installed.sh deleted file mode 100644 index 0214a830aaf..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_check_installed.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-02 -# @License : Mulan PSL v2 -# @Desc : Test if the texlive-scalerel package is installed and available in the system -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查texlive-scalerel软件包是否安装并可用 - - LOG_INFO "1. 检查系统是否已安装texlive-scalerel软件包" - rpm -q texlive-scalerel - if [ $? -eq 0 ]; then - LOG_INFO "texlive-scalerel软件包已安装,标记为已安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "texlive-scalerel软件包未安装" - ALREADY_INSTALLED=0 - fi - - LOG_INFO "2. 检查yum源中是否存在texlive-scalerel软件包" - dnf list available texlive-scalerel 2>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-scalerel软件包" - exit 255 - fi - LOG_INFO "yum源中存在texlive-scalerel软件包" - - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "3. 安装texlive-scalerel软件包" - dnf install -y texlive-scalerel - CHECK_RESULT $? 0 0 "安装texlive-scalerel软件包失败" - LOG_INFO "texlive-scalerel软件包安装成功" - fi - - LOG_INFO "4. 验证texlive-scalerel软件包是否已正确安装" - rpm -q texlive-scalerel - CHECK_RESULT $? 0 0 "texlive-scalerel软件包未正确安装" - - LOG_INFO "5. 检查texlive-scalerel提供的命令是否可用" - # 检查texlive-scalerel是否提供了相关命令或文件 - # 这里假设texlive-scalerel会安装一些LaTeX宏包文件 - find /usr/share/texlive/texmf-dist/tex/latex -name "*scalerel*" 2>/dev/null | head -1 - if [ $? -ne 0 ]; then - LOG_ERROR "未找到texlive-scalerel相关文件" - exit 255 - fi - LOG_INFO "找到texlive-scalerel相关文件" - - LOG_INFO "6. 测试texlive-scalerel功能" - # 创建一个简单的测试LaTeX文件来验证scalerel宏包 - TEST_TEX_FILE="/tmp/test_scalerel.tex" - cat > $TEST_TEX_FILE << "EOF" - \documentclass{article} - \usepackage{scalerel} - \begin{document} - Test document for scalerel package. - \end{document} - EOF - - # 尝试使用pdflatex编译测试文件(如果pdflatex可用) - if command -v pdflatex >/dev/null 2>&1; then - LOG_INFO "使用pdflatex测试texlive-scalerel功能" - pdflatex -interaction=nonstopmode $TEST_TEX_FILE >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-scalerel功能测试通过" - else - LOG_INFO "texlive-scalerel功能测试编译失败(可能是缺少其他依赖)" - fi - # 清理生成的临时文件 - rm -f /tmp/test_scalerel.* - else - LOG_INFO "pdflatex不可用,跳过编译测试" - fi - - LOG_INFO "7. 环境清理" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的texlive-scalerel软件包" - dnf remove -y texlive-scalerel - CHECK_RESULT $? 0 0 "卸载texlive-scalerel软件包失败" - LOG_INFO "texlive-scalerel软件包已卸载" - else - LOG_INFO "保持texlive-scalerel软件包安装状态" - fi - - LOG_INFO "8. 最终验证" - if [ $ALREADY_INSTALLED -eq 0 ]; then - rpm -q texlive-scalerel - if [ $? -eq 0 ]; then - LOG_ERROR "环境清理失败,texlive-scalerel软件包仍存在" - exit 1 - else - LOG_INFO "环境清理成功,系统恢复到初始状态" - fi - else - rpm -q texlive-scalerel - CHECK_RESULT $? 0 0 "texlive-scalerel软件包状态异常" - LOG_INFO "系统保持texlive-scalerel软件包安装状态" - fi - - LOG_INFO "测试完成:texlive-scalerel软件包安装和可用性测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_math_mode.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_math_mode.sh deleted file mode 100644 index 3eb80287883..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_math_mode.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-02 -# @License : Mulan PSL v2 -# @Desc : Test scaling functionality within mathematical mode -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 检查软件包是否存在 - LOG_INFO "检查texlive-scalerel软件包是否在yum源中" - if ! dnf list available texlive-scalerel &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-scalerel软件包" - exit 255 - fi - - # 判断环境是否已安装 - LOG_INFO "检查texlive-scalerel是否已安装" - if rpm -q texlive-scalerel &>/dev/null; then - LOG_INFO "texlive-scalerel已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-scalerel未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装texlive-scalerel软件包" - dnf install -y texlive-scalerel - CHECK_RESULT $? 0 0 "安装texlive-scalerel失败" - fi - - # 测试数学模式下的缩放功能 - LOG_INFO "测试数学模式下的缩放功能" - cat > test_scaling.tex << "EOF" - \documentclass{article} - \usepackage{scalerel} - \begin{document} - \scalerel*{A}{\sum_{i=1}^{n} x_i} - \end{document} - EOF - - # 编译LaTeX文档 - LOG_INFO "编译LaTeX测试文档" - pdflatex -interaction=nonstopmode test_scaling.tex - CHECK_RESULT $? 0 0 "编译LaTeX文档失败" - - # 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f test_scaling.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f test_scaling.aux test_scaling.log test_scaling.pdf test_scaling.tex - - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-scalerel软件包" - dnf remove -y texlive-scalerel - CHECK_RESULT $? 0 0 "卸载texlive-scalerel失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale.sh deleted file mode 100644 index be16b897a28..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale.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-26 -# @License : Mulan PSL v2 -# @Desc : Test scaling functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试缩放功能" - - # 检查是否已安装texlive-scalerel软件包 - LOG_INFO "检查texlive-scalerel是否已安装" - if dnf list installed texlive-scalerel &>/dev/null; then - LOG_INFO "texlive-scalerel已安装,测试结束后保持安装状态" - installed=true - else - LOG_INFO "texlive-scalerel未安装,将在测试结束后卸载" - installed=false - fi - - # 检查yum源中是否有texlive-scalerel软件包 - LOG_INFO "检查yum源中是否存在texlive-scalerel软件包" - if ! dnf list available texlive-scalerel &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-scalerel软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-scalerel - if [ "$installed" = false ]; then - LOG_INFO "安装texlive-scalerel软件包" - dnf install -y texlive-scalerel - CHECK_RESULT $? 0 0 "安装texlive-scalerel失败" - fi - - # 测试缩放功能 - LOG_INFO "测试缩放功能" - scale_output=$(texlua $(kpsewhich --progname=scale --format=tex texlive-scalerel.lua) scale) - CHECK_RESULT $? 0 0 "缩放功能测试失败" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-scalerel软件包" - dnf remove -y texlive-scalerel - CHECK_RESULT $? 0 0 "卸载texlive-scalerel失败" - fi - - LOG_INFO "测试缩放功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_cmd.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_cmd.sh deleted file mode 100644 index aad8585a45a..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_cmd.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-02 -# @License : Mulan PSL v2 -# @Desc : Test the basic \scaleobj command for scaling objects -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test the basic \\scaleobj command for scaling objects" - - # 检查是否已安装texlive-scalerel - LOG_INFO "检查是否已安装texlive-scalerel软件包" - if dnf list installed texlive-scalerel &>/dev/null; then - LOG_INFO "texlive-scalerel已安装,测试后保持安装状态" - INSTALLED="true" - else - LOG_INFO "texlive-scalerel未安装,将在测试后卸载" - INSTALLED="false" - fi - - # 检查yum源中是否有texlive-scalerel软件包 - LOG_INFO "检查yum源中是否有texlive-scalerel软件包" - if ! dnf list available texlive-scalerel &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-scalerel软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-scalerel - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装texlive-scalerel软件包" - dnf install -y texlive-scalerel - CHECK_RESULT $? 0 0 "安装texlive-scalerel失败" - fi - - # 测试\\scaleobj命令的基本功能 - LOG_INFO "测试\\scaleobj命令的基本功能" - cat > test_scaleobj.tex << "EOF" - \documentclass{article} - \usepackage{scalerel} - \begin{document} - \scaleobj{2}{A} - \end{document} - EOF - - # 编译测试文档 - LOG_INFO "编译测试文档" - pdflatex test_scaleobj.tex - CHECK_RESULT $? 0 0 "编译测试文档失败" - - # 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f test_scaleobj.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_scaleobj.tex test_scaleobj.log test_scaleobj.aux test_scaleobj.pdf - - # 如果测试前未安装,则卸载texlive-scalerel - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载texlive-scalerel软件包" - dnf remove -y texlive-scalerel - CHECK_RESULT $? 0 0 "卸载texlive-scalerel失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_to.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_to.sh deleted file mode 100644 index 48fddfb18d1..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_scale_to.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-03-02 -# @License : Mulan PSL v2 -# @Desc : Test scaling one object to match another with \scalerel* -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:使用\\scalerel*将一个对象缩放以匹配另一个对象" - - # 检查是否已安装texlive-scalerel软件包 - LOG_INFO "步骤1:检查texlive-scalerel是否已安装" - if rpm -q texlive-scalerel &> /dev/null; then - LOG_INFO "texlive-scalerel已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-scalerel未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-scalerel软件包 - LOG_INFO "步骤2:检查yum源中是否存在texlive-scalerel软件包" - if ! dnf list available texlive-scalerel &> /dev/null; then - LOG_ERROR "yum源中未找到texlive-scalerel软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装texlive-scalerel软件包" - dnf install -y texlive-scalerel - CHECK_RESULT $? 0 0 "安装texlive-scalerel失败" - fi - - # 测试\\scalerel*命令的基本功能 - LOG_INFO "步骤4:测试\\scalerel*命令的基本缩放功能" - cat > test_scalerel.tex << "EOF" - \documentclass{article} - \usepackage{scalerel} - \begin{document} - \scalerel*{A}{B} - \end{document} - EOF - - # 编译LaTeX文档以测试\\scalerel*命令 - pdflatex test_scalerel.tex - CHECK_RESULT $? 0 0 "\\scalerel*命令执行失败" - - # 检查生成的PDF文件是否存在 - LOG_INFO "步骤5:检查生成的PDF文件" - if [ -f test_scalerel.pdf ]; then - LOG_INFO "PDF文件生成成功,\\scalerel*命令功能正常" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - # 测试\\scalerel*命令的参数支持 - LOG_INFO "步骤6:测试\\scalerel*命令的参数支持" - cat > test_scalerel_param.tex << "EOF" - \documentclass{article} - \usepackage{scalerel} - \begin{document} - \scalerel*[maxdimen]{A}{B} - \end{document} - EOF - - pdflatex test_scalerel_param.tex - if [ $? -ne 0 ]; then - LOG_ERROR "\\scalerel*命令不支持参数maxdimen" - exit 255 - else - LOG_INFO "\\scalerel*命令参数支持正常" - fi - - # 清理测试文件 - LOG_INFO "步骤7:清理测试生成的文件" - rm -f test_scalerel.tex test_scalerel.pdf test_scalerel.log test_scalerel.aux - rm -f test_scalerel_param.tex test_scalerel_param.pdf test_scalerel_param.log test_scalerel_param.aux - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤8:卸载texlive-scalerel软件包" - dnf remove -y texlive-scalerel - CHECK_RESULT $? 0 0 "卸载texlive-scalerel失败" - LOG_INFO "环境已恢复到测试前的状态" - else - LOG_INFO "步骤8:保持texlive-scalerel安装状态" - fi - - LOG_INFO "测试完成:\\scalerel*命令缩放功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_stretch_cmd.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_stretch_cmd.sh deleted file mode 100644 index 547cba3cc59..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-scalerel/test_texlive-scalerel_function_stretch_cmd.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-02 -# @License : Mulan PSL v2 -# @Desc : Test the \stretchrel command for stretching objects -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本开始 - - LOG_INFO "开始测试:Test the \stretchrel command for stretching objects" - - # 定义软件包名称 - PACKAGE_NAME="texlive-scalerel" - - # 检查环境是否已安装指定软件包 - LOG_INFO "步骤1:检查是否已安装 $PACKAGE_NAME" - dnf list installed "$PACKAGE_NAME" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到 $PACKAGE_NAME 已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "未检测到 $PACKAGE_NAME 安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否存在 $PACKAGE_NAME" - dnf search "$PACKAGE_NAME" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到 $PACKAGE_NAME 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - if [ $? -ne 0 ]; then - LOG_ERROR "安装 $PACKAGE_NAME 失败" - exit 255 - fi - LOG_INFO "安装 $PACKAGE_NAME 成功" - else - LOG_INFO "步骤3:跳过安装,$PACKAGE_NAME 已存在" - fi - - # 测试 \stretchrel 命令 - LOG_INFO "步骤4:测试 \stretchrel 命令功能" - # 创建一个简单的LaTeX文件测试\stretchrel命令 - TEST_TEX_FILE="test_stretchrel.tex" - cat > "$TEST_TEX_FILE" << "EOF" - \documentclass{article} - \usepackage{scalerel} - \begin{document} - \stretchrel{A}{B} - \end{document} - EOF - - # 使用pdflatex编译测试文件 - LOG_INFO "步骤5:编译测试LaTeX文件" - pdflatex -interaction=nonstopmode "$TEST_TEX_FILE" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译LaTeX文件失败,\stretchrel 命令可能不支持" - if [ $? -ne 0 ]; then - LOG_ERROR "\stretchrel 命令测试失败" - # 清理测试文件 - rm -f "$TEST_TEX_FILE" test_stretchrel.aux test_stretchrel.log test_stretchrel.pdf 2>/dev/null - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "清理:卸载 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" > /dev/null 2>&1 - fi - exit 1 - fi - - LOG_INFO "步骤6:验证PDF文件生成" - if [ -f "test_stretchrel.pdf" ]; then - LOG_INFO "PDF文件生成成功,\stretchrel 命令功能正常" - else - LOG_ERROR "PDF文件未生成,\stretchrel 命令功能异常" - CHECK_RESULT 1 0 0 "PDF文件未生成" - fi - - # 清理测试文件 - LOG_INFO "步骤7:清理测试文件" - rm -f "$TEST_TEX_FILE" test_stretchrel.aux test_stretchrel.log test_stretchrel.pdf 2>/dev/null - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤8:卸载 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - if [ $? -ne 0 ]; then - LOG_ERROR "卸载 $PACKAGE_NAME 失败" - exit 1 - fi - LOG_INFO "卸载 $PACKAGE_NAME 成功" - else - LOG_INFO "步骤8:保持 $PACKAGE_NAME 安装状态" - fi - - LOG_INFO "测试完成:\stretchrel 命令功能测试通过" -} - -main "$@" \ No newline at end of file From 159099c6354c742003c130bca4ad4fde345b42d0 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:26:32 +0800 Subject: [PATCH 04/18] update testcase for testsuite texlive-dottex --- .../texlive-split-g/texlive-dottex.json | 10 --- .../test_texlive-dottex_function_compile.sh | 70 ------------------- 2 files changed, 80 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-g/texlive-dottex.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-g/texlive-dottex/test_texlive-dottex_function_compile.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-g/texlive-dottex.json b/suite2cases/function_test/pkg_test/texlive-split-g/texlive-dottex.json deleted file mode 100644 index d65905053bc..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-g/texlive-dottex.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-g/texlive-dottex", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-dottex_function_compile", - "desc": "Test compilation of dottex files" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-g/texlive-dottex/test_texlive-dottex_function_compile.sh b/testcases/function_test/pkg_test/texlive-split-g/texlive-dottex/test_texlive-dottex_function_compile.sh deleted file mode 100644 index 12275e68b9e..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-g/texlive-dottex/test_texlive-dottex_function_compile.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-03 -# @License : Mulan PSL v2 -# @Desc : Test compilation of dottex files -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-dottex - LOG_INFO "检查是否已安装texlive-dottex" - if dnf list installed texlive-dottex &>/dev/null; then - LOG_INFO "texlive-dottex已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-dottex未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-dottex - LOG_INFO "检查yum源中是否有texlive-dottex" - if ! dnf list available texlive-dottex &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-dottex软件包" - exit 255 - fi - - # 安装texlive-dottex(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-dottex" - dnf install -y texlive-dottex - CHECK_RESULT $? 0 0 "安装texlive-dottex失败" - fi - - # 测试编译dottex文件 - LOG_INFO "测试编译dottex文件" - cat > test.tex < Date: Thu, 23 Apr 2026 21:27:35 +0800 Subject: [PATCH 05/18] update testcase for testsuite uwsgi-plugin-fiber --- .../pkg_test/uwsgi/uwsgi-plugin-fiber.json | 10 --- .../test_uwsgi-plugin-fiber_function_load.sh | 66 ------------------- 2 files changed, 76 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber.json delete mode 100644 testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber/test_uwsgi-plugin-fiber_function_load.sh diff --git a/suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber.json b/suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber.json deleted file mode 100644 index 299a3085ec1..00000000000 --- a/suite2cases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber", - "machine num": 1, - "cases": [ - { - "name": "test_uwsgi-plugin-fiber_function_load", - "desc": "Test loading the uwsgi-plugin-fiber plugin" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber/test_uwsgi-plugin-fiber_function_load.sh b/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber/test_uwsgi-plugin-fiber_function_load.sh deleted file mode 100644 index 19c112d59de..00000000000 --- a/testcases/function_test/pkg_test/uwsgi/uwsgi-plugin-fiber/test_uwsgi-plugin-fiber_function_load.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-02 -# @License : Mulan PSL v2 -# @Desc : Test loading the uwsgi-plugin-fiber plugin -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试:Test loading the uwsgi-plugin-fiber plugin" - - # 检查是否已安装uwsgi-plugin-fiber - LOG_INFO "检查uwsgi-plugin-fiber是否已安装" - if rpm -q uwsgi-plugin-fiber &>/dev/null; then - LOG_INFO "uwsgi-plugin-fiber已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "uwsgi-plugin-fiber未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有uwsgi-plugin-fiber - LOG_INFO "检查yum源中是否存在uwsgi-plugin-fiber" - if ! dnf list available uwsgi-plugin-fiber &>/dev/null; then - LOG_ERROR "yum源中未找到uwsgi-plugin-fiber,退出测试" - exit 255 - fi - - # 安装uwsgi-plugin-fiber - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装uwsgi-plugin-fiber" - dnf install -y uwsgi-plugin-fiber - CHECK_RESULT $? 0 0 "安装uwsgi-plugin-fiber失败" - fi - - # 测试加载uwsgi-plugin-fiber插件 - LOG_INFO "测试加载uwsgi-plugin-fiber插件" - uwsgi --plugin fiber - CHECK_RESULT $? 0 0 "加载uwsgi-plugin-fiber插件失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载uwsgi-plugin-fiber" - dnf remove -y uwsgi-plugin-fiber - CHECK_RESULT $? 0 0 "卸载uwsgi-plugin-fiber失败" - fi - - LOG_INFO "测试完成:Test loading the uwsgi-plugin-fiber plugin" - -} - -main "$@" \ No newline at end of file From 3a12d7f82381ec1a3003fc847c02fd3e7b2b4b00 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:28:50 +0800 Subject: [PATCH 06/18] update testcase for testsuite texlive-titleref --- .../texlive-split-x/texlive-titleref.json | 56 ----- .../test_texlive-titleref_downgrade.sh | 89 -------- ...t_texlive-titleref_function_basic_usage.sh | 206 ------------------ ...est_texlive-titleref_function_cross_ref.sh | 98 --------- ..._texlive-titleref_function_custom_label.sh | 87 -------- ...texlive-titleref_function_install_check.sh | 86 -------- ...xlive-titleref_function_uninstall_clean.sh | 115 ---------- .../test_texlive-titleref_install.sh | 66 ------ .../test_texlive-titleref_rollback.sh | 66 ------ .../test_texlive-titleref_rollback_upgrade.sh | 94 -------- .../test_texlive-titleref_uninstall.sh | 75 ------- .../test_texlive-titleref_upgrade.sh | 69 ------ 12 files changed, 1107 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-x/texlive-titleref.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_downgrade.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_basic_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_cross_ref.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_custom_label.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_install_check.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_uninstall_clean.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback_upgrade.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_upgrade.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-titleref.json b/suite2cases/function_test/pkg_test/texlive-split-x/texlive-titleref.json deleted file mode 100644 index b2f52395c19..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-titleref.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-titleref_install", - "desc": "测试texlive-titleref软件包的安装功能", - "machine num": 1 - }, - { - "name": "test_texlive-titleref_uninstall", - "desc": "测试texlive-titleref软件包的卸载功能", - "machine num": 1 - }, - { - "name": "test_texlive-titleref_upgrade", - "desc": "测试texlive-titleref软件包的升级功能", - "machine num": 1 - }, - { - "name": "test_texlive-titleref_downgrade", - "desc": "测试texlive-titleref软件包的降级功能", - "machine num": 1 - }, - { - "name": "test_texlive-titleref_rollback", - "desc": "测试texlive-titleref软件包的回滚功能", - "machine num": 1 - }, - { - "name": "test_texlive-titleref_rollback_upgrade", - "desc": "测试texlive-titleref软件包的升级回滚功能", - "machine num": 1 - }, - { - "name": "test_texlive-titleref_function_install_check", - "desc": "检查texlive-titleref软件包是否已正确安装" - }, - { - "name": "test_texlive-titleref_function_basic_usage", - "desc": "测试使用titleref宏包引用章节标题的基本功能" - }, - { - "name": "test_texlive-titleref_function_cross_ref", - "desc": "测试titleref宏包的交叉引用功能" - }, - { - "name": "test_texlive-titleref_function_custom_label", - "desc": "测试titleref宏包自定义引用标签的功能" - }, - { - "name": "test_texlive-titleref_function_uninstall_clean", - "desc": "测试卸载texlive-titleref软件包及相关文件是否清理干净" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_downgrade.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_downgrade.sh deleted file mode 100644 index f076249dacf..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_downgrade.sh +++ /dev/null @@ -1,89 +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-07-05 -# @License : Mulan PSL v2 -# @Desc : 测试texlive-titleref软件包的降级功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查texlive-titleref软件包是否已安装 - LOG_INFO "检查texlive-titleref软件包是否已安装" - rpm -q texlive-titleref - if [ $? -eq 0 ]; then - LOG_INFO "texlive-titleref软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-titleref软件包未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在texlive-titleref软件包 - LOG_INFO "检查yum源中是否存在texlive-titleref软件包" - dnf list available texlive-titleref - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-titleref软件包" - exit 255 - fi - - # 获取当前安装的texlive-titleref版本 - LOG_INFO "获取当前安装的texlive-titleref版本" - CURRENT_VERSION=$(rpm -q --queryformat "%{VERSION}-%{RELEASE}" texlive-titleref 2>/dev/null) - if [ $? -ne 0 ]; then - CURRENT_VERSION="未安装" - fi - LOG_INFO "当前texlive-titleref版本: $CURRENT_VERSION" - - # 获取可用的texlive-titleref旧版本列表 - LOG_INFO "获取可用的texlive-titleref旧版本列表" - OLD_VERSIONS=$(dnf list --showduplicates texlive-titleref | awk "{print $2}" | grep -v "$CURRENT_VERSION" | sort -u) - if [ -z "$OLD_VERSIONS" ]; then - LOG_ERROR "没有可用的旧版本" - exit 255 - fi - - # 选择第一个旧版本进行降级 - TARGET_VERSION=$(echo "$OLD_VERSIONS" | head -n1) - LOG_INFO "目标降级版本: $TARGET_VERSION" - - # 执行降级操作 - LOG_INFO "执行降级操作: dnf downgrade texlive-titleref-$TARGET_VERSION" - dnf downgrade -y texlive-titleref-$TARGET_VERSION - CHECK_RESULT $? 0 0 "降级操作失败" - - # 验证降级后的版本 - LOG_INFO "验证降级后的版本" - NEW_VERSION=$(rpm -q --queryformat "%{VERSION}-%{RELEASE}" texlive-titleref) - CHECK_RESULT $? 0 0 "获取新版本失败" - LOG_INFO "降级后的texlive-titleref版本: $NEW_VERSION" - - # 恢复环境:如果最初未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "恢复环境:卸载texlive-titleref软件包" - dnf remove -y texlive-titleref - CHECK_RESULT $? 0 0 "卸载操作失败" - else - LOG_INFO "恢复环境:重新升级到原版本" - dnf upgrade -y texlive-titleref - CHECK_RESULT $? 0 0 "升级操作失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_basic_usage.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_basic_usage.sh deleted file mode 100644 index 09c27e59df3..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_basic_usage.sh +++ /dev/null @@ -1,206 +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-22 -# @License : Mulan PSL v2 -# @Desc : 测试使用titleref宏包引用章节标题的基本功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量 - SCRIPT_NAME=$(basename $0) - PACKAGE_NAME="texlive-titleref" - - # 定义颜色输出函数(如果LOG_INFO/LOG_ERROR未定义) - if ! type LOG_INFO >/dev/null 2>&1; then - LOG_INFO() { - echo "[INFO] $*" - } - fi - - if ! type LOG_ERROR >/dev/null 2>&1; then - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - fi - - # 检查命令是否存在 - check_command() { - if ! command -v "$1" >/dev/null 2>&1; then - LOG_ERROR "命令 $1 不存在" - exit 255 - fi - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - LOG_INFO "检查yum源中是否存在 $PACKAGE_NAME 软件包" - if ! dnf list available "$PACKAGE_NAME" >/dev/null 2>&1; then - LOG_ERROR "yum源中不存在 $PACKAGE_NAME 软件包" - exit 255 - fi - LOG_INFO "yum源中存在 $PACKAGE_NAME 软件包" - } - - # 检查软件包是否已安装 - check_package_installed() { - if rpm -q "$PACKAGE_NAME" >/dev/null 2>&1; then - LOG_INFO "$PACKAGE_NAME 已安装" - return 0 - else - LOG_INFO "$PACKAGE_NAME 未安装" - return 1 - fi - } - - # 安装软件包 - install_package() { - LOG_INFO "安装 $PACKAGE_NAME 软件包" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "卸载 $PACKAGE_NAME 软件包" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - } - - # 创建测试LaTeX文档 - create_test_latex() { - cat > test_titleref.tex << "EOF" - \documentclass{article} - \usepackage{titleref} - \begin{document} - - \section{第一部分} - \label{sec:first} - - 这是第一部分的内容。 - - \section{第二部分} - \label{sec:second} - - 这是第二部分的内容。引用第一部分:见章节\titleref{sec:first}。 - - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - } - - # 测试titleref基本功能 - test_titleref_basic() { - LOG_INFO "测试titleref宏包引用章节标题的基本功能" - - # 创建测试文档 - create_test_latex - - # 编译LaTeX文档 - LOG_INFO "编译LaTeX文档" - pdflatex -interaction=nonstopmode test_titleref.tex > latex_compile.log 2>&1 - CHECK_RESULT $? 0 0 "LaTeX编译失败" - - # 检查是否生成PDF - LOG_INFO "检查PDF文件是否生成" - if [ -f "test_titleref.pdf" ]; then - LOG_INFO "PDF文件生成成功" - # 检查PDF内容(简单检查) - if file test_titleref.pdf | grep -q "PDF document"; then - LOG_INFO "PDF文件格式正确" - else - LOG_ERROR "PDF文件格式不正确" - return 1 - fi - else - LOG_ERROR "PDF文件未生成" - return 1 - fi - - # 检查编译日志中是否有错误 - LOG_INFO "检查编译日志中的错误" - if grep -q "Error" latex_compile.log; then - LOG_ERROR "LaTeX编译过程中出现错误" - return 1 - fi - - # 清理生成的中间文件 - LOG_INFO "清理LaTeX编译中间文件" - rm -f test_titleref.aux test_titleref.log test_titleref.out test_titleref.toc - - return 0 - } - - # 主函数 - main() { - LOG_INFO "开始测试: $SCRIPT_NAME" - - # 检查必要命令 - check_command dnf - check_command pdflatex - check_command rpm - - # 检查软件包是否在yum源中 - check_package_in_repo - - # 记录初始安装状态 - LOG_INFO "检查初始安装状态" - INITIAL_INSTALLED=false - if check_package_installed; then - INITIAL_INSTALLED=true - LOG_INFO "初始状态: $PACKAGE_NAME 已安装" - else - LOG_INFO "初始状态: $PACKAGE_NAME 未安装" - fi - - # 如果未安装,则安装软件包 - NEED_CLEANUP=false - if ! $INITIAL_INSTALLED; then - install_package - NEED_CLEANUP=true - fi - - # 执行测试 - test_titleref_basic - TEST_RESULT=$? - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_titleref.* latex_compile.log - - # 恢复环境 - if $NEED_CLEANUP && ! $INITIAL_INSTALLED; then - uninstall_package - else - LOG_INFO "保持 $PACKAGE_NAME 安装状态不变" - fi - - # 输出测试结果 - if [ $TEST_RESULT -eq 0 ]; then - LOG_INFO "测试通过: titleref宏包引用章节标题的基本功能正常" - else - LOG_ERROR "测试失败: titleref宏包引用章节标题的基本功能异常" - exit $TEST_RESULT - fi - - LOG_INFO "测试完成: $SCRIPT_NAME" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_cross_ref.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_cross_ref.sh deleted file mode 100644 index 4f29835a0a0..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_cross_ref.sh +++ /dev/null @@ -1,98 +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-22 -# @License : Mulan PSL v2 -# @Desc : 测试titleref宏包的交叉引用功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试titleref宏包的交叉引用功能" - - # 检查yum源中是否有texlive-titleref软件包 - LOG_INFO "检查yum源中是否有texlive-titleref软件包" - dnf list texlive-titleref 2>/dev/null | grep -q "texlive-titleref" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-titleref软件包" - exit 255 - fi - - # 判断环境是否已经安装texlive-titleref - LOG_INFO "检查环境是否已安装texlive-titleref" - rpm -q texlive-titleref >/dev/null 2>&1 - installed=$? - if [ $installed -eq 0 ]; then - LOG_INFO "环境已安装texlive-titleref,测试结束后将保持安装状态" - need_cleanup=0 - else - LOG_INFO "环境未安装texlive-titleref,将进行安装测试" - need_cleanup=1 - fi - - # 如果未安装,则安装软件包 - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "安装texlive-titleref软件包" - dnf install -y texlive-titleref - CHECK_RESULT $? 0 0 "安装texlive-titleref失败" - fi - - # 创建测试LaTeX文档 - LOG_INFO "创建测试LaTeX文档测试交叉引用功能" - cat > test_titleref.tex << "EOF" - \documentclass{article} - \usepackage{titleref} - \begin{document} - - \section{第一部分}\label{sec:part1} - 这是第一部分的内容。 - - \section{第二部分}\label{sec:part2} - 这是第二部分的内容。请参考\titleformat{sec:part1}。 - - \end{document} - EOF - - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - - # 编译LaTeX文档测试titleref功能 - LOG_INFO "编译LaTeX文档测试titleref交叉引用功能" - pdflatex -interaction=nonstopmode test_titleref.tex >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译LaTeX文档失败,titleref交叉引用功能可能存在问题" - - # 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f test_titleref.pdf ]; then - LOG_INFO "PDF文件生成成功,titleref交叉引用功能正常" - else - LOG_ERROR "PDF文件生成失败,titleref交叉引用功能异常" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_titleref.tex test_titleref.pdf test_titleref.aux test_titleref.log test_titleref.out - - # 如果测试前未安装,则卸载软件包 - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "卸载texlive-titleref软件包恢复环境" - dnf remove -y texlive-titleref - CHECK_RESULT $? 0 0 "卸载texlive-titleref失败" - fi - - LOG_INFO "titleref宏包的交叉引用功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_custom_label.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_custom_label.sh deleted file mode 100644 index 523d9d3be4b..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_custom_label.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-22 -# @License : Mulan PSL v2 -# @Desc : 测试titleref宏包自定义引用标签的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试titleref宏包自定义引用标签的功能" - LOG_INFO "步骤1:检查环境是否已安装texlive-titleref软件包" - if dnf list installed texlive-titleref &>/dev/null; then - LOG_INFO "texlive-titleref已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "texlive-titleref未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2:检查yum源中是否有texlive-titleref软件包" - if ! dnf list available texlive-titleref &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-titleref软件包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装texlive-titleref软件包" - dnf install -y texlive-titleref - CHECK_RESULT $? 0 0 "安装texlive-titleref软件包失败" - fi - - LOG_INFO "步骤4:测试titleref宏包自定义引用标签的功能" - cat > test_titleref.tex << "EOF" - \documentclass{article} - \usepackage{titleref} - \newcommand{\customlabel}[1]{\label{sec:#1}} - \newcommand{\customref}[1]{\titleref{sec:#1}} - \begin{document} - \section{第一节}\customlabel{first} - 这是第一节的内容。 - - \section{第二节}\customlabel{second} - 这是第二节的内容。 - - 在第一节中,我们讨论了...,详细内容请参见\customref{first}。 - - 在第二节中,我们讨论了...,详细内容请参见\customref{second}。 - \end{document} - EOF - - pdflatex -interaction=nonstopmode test_titleref.tex - CHECK_RESULT $? 0 0 "使用titleref宏包自定义引用标签生成PDF失败" - - LOG_INFO "步骤5:验证生成的PDF文件" - if [ -f test_titleref.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - LOG_INFO "步骤6:清理生成的临时文件" - rm -f test_titleref.aux test_titleref.log test_titleref.out test_titleref.tex test_titleref.pdf - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤7:卸载texlive-titleref软件包" - dnf remove -y texlive-titleref - CHECK_RESULT $? 0 0 "卸载texlive-titleref软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_install_check.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_install_check.sh deleted file mode 100644 index 824997cab40..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_install_check.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-22 -# @License : Mulan PSL v2 -# @Desc : 检查texlive-titleref软件包是否已正确安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="texlive-titleref" - - # 步骤1: 检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在软件包: $PACKAGE_NAME" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; 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_TEST=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - INSTALLED_BEFORE_TEST=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = 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 提供的文件" - rpm -ql "$PACKAGE_NAME" | head -5 - CHECK_RESULT $? 0 0 "无法列出软件包 $PACKAGE_NAME 的文件" - - # 步骤6: 清理环境(如果测试前未安装,则卸载软件包) - 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 "测试前软件包已安装,保持安装状态" - fi - - # 步骤7: 最终验证环境状态 - LOG_INFO "验证环境已恢复" - if [ "$INSTALLED_BEFORE_TEST" = true ]; then - rpm -q "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "环境恢复后软件包 $PACKAGE_NAME 状态异常" - else - if rpm -q "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "环境恢复后软件包 $PACKAGE_NAME 仍然存在" - exit 1 - fi - fi - - LOG_INFO "测试完成: texlive-titleref软件包安装检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_uninstall_clean.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_uninstall_clean.sh deleted file mode 100644 index 1d9e8513481..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_function_uninstall_clean.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-22 -# @License : Mulan PSL v2 -# @Desc : 测试卸载texlive-titleref软件包及相关文件是否清理干净 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装texlive-titleref软件包 - LOG_INFO "检查texlive-titleref软件包是否已安装" - dnf list installed texlive-titleref > /dev/null 2>&1 - installed_status=$? - - # 记录初始安装状态 - if [ $installed_status -eq 0 ]; then - LOG_INFO "texlive-titleref软件包已安装,脚本结束后将保持安装状态" - already_installed=true - else - LOG_INFO "texlive-titleref软件包未安装,脚本结束后将卸载" - already_installed=false - fi - - # 检查yum源中是否有texlive-titleref软件包 - LOG_INFO "检查yum源中是否存在texlive-titleref软件包" - dnf list available texlive-titleref > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-titleref软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装texlive-titleref软件包" - dnf install -y texlive-titleref - CHECK_RESULT $? 0 0 "安装texlive-titleref软件包失败" - fi - - # 验证软件包已安装 - LOG_INFO "验证texlive-titleref软件包已安装" - dnf list installed texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-titleref软件包未正确安装" - - # 获取软件包安装的文件列表 - LOG_INFO "获取texlive-titleref软件包安装的文件列表" - rpm -ql texlive-titleref > /tmp/texlive_titleref_files.txt - CHECK_RESULT $? 0 0 "获取texlive-titleref软件包文件列表失败" - - # 记录文件列表用于后续验证 - LOG_INFO "记录texlive-titleref软件包安装的文件列表到临时文件" - - # 卸载texlive-titleref软件包 - LOG_INFO "卸载texlive-titleref软件包" - dnf remove -y texlive-titleref - CHECK_RESULT $? 0 0 "卸载texlive-titleref软件包失败" - - # 验证软件包已卸载 - LOG_INFO "验证texlive-titleref软件包已卸载" - dnf list installed texlive-titleref > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "texlive-titleref软件包卸载失败" - exit 1 - fi - LOG_INFO "texlive-titleref软件包已成功卸载" - - # 检查卸载后相关文件是否清理干净 - LOG_INFO "检查卸载后相关文件是否清理干净" - while read -r file; do - if [ -n "$file" ] && [ -e "$file" ]; then - LOG_ERROR "文件未被清理: $file" - cleanup_failed=true - fi - done < /tmp/texlive_titleref_files.txt - - if [ "$cleanup_failed" = true ]; then - LOG_ERROR "卸载后部分文件未清理干净" - exit 1 - else - LOG_INFO "所有相关文件已清理干净" - fi - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/texlive_titleref_files.txt - - # 环境恢复 - LOG_INFO "恢复环境状态" - if [ "$already_installed" = false ]; then - # 如果初始状态未安装,保持卸载状态 - LOG_INFO "环境已恢复到初始未安装状态" - else - # 如果初始状态已安装,重新安装软件包 - LOG_INFO "重新安装texlive-titleref软件包以恢复环境" - dnf install -y texlive-titleref - CHECK_RESULT $? 0 0 "重新安装texlive-titleref软件包失败" - LOG_INFO "环境已恢复到初始已安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_install.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_install.sh deleted file mode 100644 index 87e31b5f6ac..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_install.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-07-05 -# @License : Mulan PSL v2 -# @Desc : 测试texlive-titleref软件包的安装功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查texlive-titleref软件包是否已安装 - LOG_INFO "检查texlive-titleref软件包是否已安装" - rpm -q texlive-titleref > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-titleref软件包已安装,脚本结束时将保持安装状态" - installed=true - else - LOG_INFO "texlive-titleref软件包未安装,将在测试后卸载" - installed=false - fi - - # 检查yum源中是否存在texlive-titleref软件包 - LOG_INFO "检查yum源中是否存在texlive-titleref软件包" - dnf list available texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-titleref软件包" - - # 安装texlive-titleref软件包 - LOG_INFO "安装texlive-titleref软件包" - dnf install -y texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-titleref软件包失败" - - # 验证texlive-titleref软件包是否成功安装 - LOG_INFO "验证texlive-titleref软件包是否成功安装" - rpm -q texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-titleref软件包未成功安装" - - # 测试texlive-titleref功能 - LOG_INFO "测试texlive-titleref功能" - titleref --help > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "texlive-titleref命令不支持或参数错误" - - # 清理环境 - if [ "$installed" = "false" ]; then - LOG_INFO "卸载texlive-titleref软件包" - dnf remove -y texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-titleref软件包失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback.sh deleted file mode 100644 index ef273b1aec1..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback.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-07-05 -# @License : Mulan PSL v2 -# @Desc : 测试texlive-titleref软件包的回滚功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已经安装texlive-titleref软件包 - LOG_INFO "检查是否已安装texlive-titleref软件包" - rpm -q texlive-titleref > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-titleref已安装,脚本结束时保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-titleref未安装,将在测试结束后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-titleref软件包 - LOG_INFO "检查yum源中是否有texlive-titleref软件包" - dnf list available texlive-titleref > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-titleref软件包" - exit 255 - fi - - # 安装texlive-titleref软件包 - LOG_INFO "开始安装texlive-titleref软件包" - dnf install -y texlive-titleref - CHECK_RESULT $? 0 0 "安装texlive-titleref失败" - - # 测试texlive-titleref的回滚功能 - LOG_INFO "测试texlive-titleref的回滚功能" - dnf history undo last -y > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "回滚texlive-titleref失败" - - # 根据初始状态决定是否卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境,卸载texlive-titleref软件包" - dnf remove -y texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-titleref失败" - else - LOG_INFO "保持环境,不卸载texlive-titleref软件包" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback_upgrade.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback_upgrade.sh deleted file mode 100644 index 96554aa04ba..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_rollback_upgrade.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-07-05 -# @License : Mulan PSL v2 -# @Desc : 测试texlive-titleref软件包的升级回滚功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查texlive-titleref软件包是否已安装 - LOG_INFO "检查texlive-titleref软件包是否已安装" - rpm -q texlive-titleref > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-titleref软件包已安装" - INSTALLED=true - else - LOG_INFO "texlive-titleref软件包未安装" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-titleref软件包 - LOG_INFO "检查yum源中是否有texlive-titleref软件包" - dnf list available texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-titleref软件包" - - # 如果未安装,则安装texlive-titleref软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装texlive-titleref软件包" - dnf install -y texlive-titleref - CHECK_RESULT $? 0 0 "安装texlive-titleref软件包失败" - fi - - # 获取当前texlive-titleref软件包版本 - LOG_INFO "获取当前texlive-titleref软件包版本" - CURRENT_VERSION=$(rpm -q --queryformat "%{VERSION}-%{RELEASE}" texlive-titleref) - LOG_INFO "当前texlive-titleref版本: $CURRENT_VERSION" - - # 检查是否有可用的升级版本 - LOG_INFO "检查是否有可用的升级版本" - dnf check-update texlive-titleref > /dev/null 2>&1 - if [ $? -eq 100 ]; then - LOG_INFO "存在可用的升级版本,执行升级" - dnf upgrade -y texlive-titleref - CHECK_RESULT $? 0 0 "升级texlive-titleref软件包失败" - - # 获取升级后的版本 - UPGRADED_VERSION=$(rpm -q --queryformat "%{VERSION}-%{RELEASE}" texlive-titleref) - LOG_INFO "升级后的texlive-titleref版本: $UPGRADED_VERSION" - - # 执行回滚操作 - LOG_INFO "执行回滚操作到版本: $CURRENT_VERSION" - dnf history undo last -y --skip-broken > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "回滚texlive-title-ref失败" - - # 验证回滚后的版本是否为初始版本 - ROLLBACK_VERSION=$(rpm -q --queryformat "%{VERSION}-%{RELEASE}" texlife-title-ref) - LOG_INFO "回滚后的texlife-title-ref版本: $ROLLBACK_VERSION" - - if [ "$ROLLBACK_VERSION" != "$CURRENT_VERSION" ]; then - LOG_ERROR "回滚失败,当前版本与初始版本不一致" - exit 1 - fi - - else - LOG_INFO “没有可用的升级版本” - fi - - #如果最初未安装,则卸载texlife-title-ref以恢复环境 - if [ "$INSTALLED" = false ]; then - LOG_ INFO “卸载texlife-title-ref软件包以恢复环境” - dnf remove -y texlife-title-ref - CHECK_RESULT $? 0 0 “卸载” - fi - - LOG_ INFO “测试完成” - exit 0 - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_uninstall.sh deleted file mode 100644 index a744a264914..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_uninstall.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-07-05 -# @License : Mulan PSL v2 -# @Desc : 测试texlive-titleref软件包的卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查texlive-titleref软件包是否已安装 - LOG_INFO "检查texlive-titleref软件包是否已安装" - dnf list installed texlive-titleref > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-titleref软件包已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-titleref软件包未安装,将在测试结束后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-titleref软件包 - LOG_INFO "检查yum源中是否有texlive-titleref软件包" - dnf list available texlive-titleref > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-titleref软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-titleref软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装texlive-titleref软件包" - dnf install -y texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-titleref软件包失败" - fi - - # 测试卸载texlive-titleref软件包功能 - LOG_INFO "开始测试卸载texlive-titleref软件包功能" - dnf remove -y texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-titleref软件包失败" - - # 检查是否成功卸载 - LOG_INFO "检查是否成功卸载texlive-titleref软件包" - dnf list installed texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 1 0 "texlive-titleref软件包未成功卸载" - - # 如果最初未安装,则重新安装以恢复环境 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "恢复环境,重新安装texlive-titleref软件包" - dnf install -y texlive-titleref > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "重新安装texlive-tiprefixefix软件包失败" - - elif [ $INSTALLED -eq 1 ]; then - LOG_INFO “环境已恢复为初始状态” - fi - - LOG_INFO “测试完成” - exit 0 - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_upgrade.sh b/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_upgrade.sh deleted file mode 100644 index 1ce88681ab2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-x/texlive-titleref/test_texlive-titleref_upgrade.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-07-05 -# @License : Mulan PSL v2 -# @Desc : 测试texlive-titleref软件包的升级功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查texlive-titleref软件包是否已安装 - LOG_INFO "检查texlive-titleref软件包是否已安装" - rpm -q texlive-titleref - if [ $? -eq 0 ]; then - LOG_INFO "texlive-titleref软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-titleref软件包未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在texlive-titleref软件包 - LOG_INFO "检查yum源中是否存在texlive-titleref软件包" - dnf list available texlive-titleref - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-titleref软件包" - exit 255 - fi - - # 安装texlive-titleref软件包 - LOG_INFO "安装texlive-titleref软件包" - dnf install -y texlive-titleref - CHECK_RESULT $? 0 0 "安装texlive-titleref软件包失败" - - # 测试texlive-titleref软件包的升级功能 - LOG_INFO "测试texlive-titleref软件包的升级功能" - dnf upgrade -y texlive-titleref - CHECK_RESULT $? 0 0 "升级texlive-titleref软件包失败" - - # 验证升级后的软件包版本 - LOG_INFO "验证升级后的软件包版本" - rpm -q texlive-titleref --qf "%{VERSION}-%{RELEASE}\n" - CHECK_RESULT $? 0 0 "获取texlive-titleref软件包版本失败" - - # 清理环境,恢复到之前的状态 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-titleref软件包" - dnf remove -y texlive-titleref - CHECK_RESULT $? 0 0 "卸载texlive-titleref软件包失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file From 0ba37ed055f8d184e9ca655b7ca0c5e388816700 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:29:27 +0800 Subject: [PATCH 07/18] update testcase for testsuite texlive-graphics --- .../texlive-split-j/texlive-graphics.json | 10 ---- .../test_texlive-graphics_function_install.sh | 60 ------------------- 2 files changed, 70 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-j/texlive-graphics.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-j/texlive-graphics/test_texlive-graphics_function_install.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-j/texlive-graphics.json b/suite2cases/function_test/pkg_test/texlive-split-j/texlive-graphics.json deleted file mode 100644 index b2d19343ed6..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-j/texlive-graphics.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-j/texlive-graphics", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-graphics_function_install", - "desc": "Test package installation" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-j/texlive-graphics/test_texlive-graphics_function_install.sh b/testcases/function_test/pkg_test/texlive-split-j/texlive-graphics/test_texlive-graphics_function_install.sh deleted file mode 100644 index 67ef8f505a2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-j/texlive-graphics/test_texlive-graphics_function_install.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-09-26 -# @License : Mulan PSL v2 -# @Desc : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-graphics包 - LOG_INFO "检查是否已安装texlive-graphics包" - rpm -q texlive-graphics > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-graphics已安装,跳过安装步骤" - installed=true - else - installed=false - fi - - # 检查yum源中是否存在texlive-graphics包 - LOG_INFO "检查yum源中是否存在texlive-graphics包" - dnf list available texlive-graphics > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-graphics包" - - # 安装texlive-graphics包(如果未安装) - if [ "$installed" = false ]; then - LOG_INFO "开始安装texlive-graphics包" - dnf install -y texlive-graphics - CHECK_RESULT $? 0 0 "安装texlive-graphics包失败" - fi - - # 测试texlive-graphics功能 - LOG_INFO "测试texlive-graphics功能" - some_command_related_to_texlive_graphics > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "texlive-graphics功能测试失败" - - # 清理环境(如果之前未安装) - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-graphics包" - dnf remove -y texlive-graphics - CHECK_RESULT $? 0 0 "卸载texlive-graphics包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From 8522db6c6b9d5cd31154387d2c3bcf0f0fcfc620 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:30:31 +0800 Subject: [PATCH 08/18] update testcase for testsuite intel-cmt-cat-devel --- .../intel-cmt-cat/intel-cmt-cat-devel.json | 12 --- .../test_intel-cmt-cat-devel_header_usage.sh | 89 ------------------ .../test_intel-cmt-cat-devel_library_link.sh | 94 ------------------- .../test_intel-cmt-cat-devel_presence.sh | 80 ---------------- 4 files changed, 275 deletions(-) delete mode 100644 testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_header_usage.sh delete mode 100644 testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_library_link.sh delete mode 100644 testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_presence.sh diff --git a/suite2cases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel.json b/suite2cases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel.json index 760eb1c3ea4..de078c6b6b6 100644 --- a/suite2cases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel.json +++ b/suite2cases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel.json @@ -6,21 +6,9 @@ "name": "test_intel-cmt-cat-devel_installation", "desc": "测试 intel-cmt-cat-devel 软件包是否可以通过系统包管理器(如 yum 或 dnf)成功安装。" }, - { - "name": "test_intel-cmt-cat-devel_presence", - "desc": "测试 intel-cmt-cat-devel 软件包是否已正确安装在系统中,并验证其核心开发文件(如头文件和库文件)是否存在。" - }, { "name": "test_intel-cmt-cat-devel_removal", "desc": "测试 intel-cmt-cat-devel 软件包是否可以通过系统包管理器(如 yum 或 dnf)成功卸载。" - }, - { - "name": "test_intel-cmt-cat-devel_header_usage", - "desc": "验证使用 intel-cmt-cat-devel 提供的头文件(如 pqos.h)进行简单编译(如 gcc -c)时不会产生错误。" - }, - { - "name": "test_intel-cmt-cat-devel_library_link", - "desc": "验证一个简单的 C 程序能够成功链接 intel-cmt-cat-devel 提供的库(如 libpqos)并生成可执行文件。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_header_usage.sh b/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_header_usage.sh deleted file mode 100644 index 9e14befce7b..00000000000 --- a/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_header_usage.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-20 -# @License : Mulan PSL v2 -# @Desc : 验证使用 intel-cmt-cat-devel 提供的头文件(如 pqos.h)进行简单编译(如 gcc -c)时不会产生错误。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装 intel-cmt-cat-devel 软件包 - LOG_INFO "检查是否已安装 intel-cmt-cat-devel 软件包" - rpm -q intel-cmt-cat-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "intel-cmt-cat-devel 软件包已安装" - already_installed=1 - else - LOG_INFO "intel-cmt-cat-devel 软件包未安装" - already_installed=0 - fi - - # 检查 yum 源中是否存在 intel-cmt-cat-devel 软件包 - LOG_INFO "检查 yum 源中是否存在 intel-cmt-cat-devel 软件包" - dnf list available intel-cmt-cat-devel > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 intel-cmt-cat-devel 软件包" - exit 255 - fi - - # 如果未安装,则安装 intel-cmt-cat-devel 软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装 intel-cmt-cat-devel 软件包" - dnf install -y intel-cmt-cat-devel - CHECK_RESULT $? 0 0 "安装 intel-cmt-cat-devel 软件包失败" - fi - - # 查找 pqos.h 头文件路径 - LOG_INFO "查找 pqos.h 头文件路径" - pqos_header_path=$(find /usr/include -name "pqos.h" 2>/dev/null | head -1) - if [ -z "$pqos_header_path" ]; then - LOG_ERROR "未找到 pqos.h 头文件" - exit 255 - fi - LOG_INFO "找到 pqos.h 头文件: $pqos_header_path" - - # 创建测试源文件 - LOG_INFO "创建测试源文件 test_pqos.c" - cat > test_pqos.c << "EOF" - #include - #include "pqos.h" - - int main() { - printf("Testing pqos.h inclusion\n"); - return 0; - } - EOF - - # 编译测试源文件 - LOG_INFO "编译测试源文件 test_pqos.c" - gcc -c test_pqos.c -I$(dirname "$pqos_header_path") - CHECK_RESULT $? 0 0 "编译测试源文件失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_pqos.c test_pqos.o - - # 如果之前未安装,则卸载 intel-cmt-cat-devel 软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载 intel-cmt-cat-devel 软件包" - dnf remove -y intel-cmt-cat-devel - CHECK_RESULT $? 0 0 "卸载 intel-cmt-cat-devel 软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_library_link.sh b/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_library_link.sh deleted file mode 100644 index b69f510f726..00000000000 --- a/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_library_link.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-20 -# @License : Mulan PSL v2 -# @Desc : 验证一个简单的 C 程序能够成功链接 intel-cmt-cat-devel 提供的库(如 libpqos)并生成可执行文件。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装intel-cmt-cat-devel软件包 - LOG_INFO "检查是否已安装intel-cmt-cat-devel软件包" - if rpm -q intel-cmt-cat-devel > /dev/null 2>&1; then - LOG_INFO "intel-cmt-cat-devel软件包已安装" - INSTALLED=1 - else - LOG_INFO "intel-cmt-cat-devel软件包未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有intel-cmt-cat-devel软件包 - LOG_INFO "检查yum源中是否有intel-cmt-cat-devel软件包" - dnf list available intel-cmt-cat-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到intel-cmt-cat-devel软件包" - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装intel-cmt-cat-devel软件包" - dnf install -y intel-cmt-cat-devel - CHECK_RESULT $? 0 0 "安装intel-cmt-cat-devel软件包失败" - fi - - # 创建测试C程序 - LOG_INFO "创建测试C程序" - cat > test_libpqos.c << "EOF" - #include - #include - - int main() { - struct pqos_config config; - int ret; - - config.fd_log = STDOUT_FILENO; - config.verbose = 0; - - ret = pqos_init(&config); - if (ret == PQOS_RETVAL_OK) { - printf("libpqos初始化成功\n"); - pqos_fini(); - return 0; - } else { - printf("libpqos初始化失败\n"); - return 1; - } - } - EOF - - # 编译测试程序 - LOG_INFO "编译测试程序" - gcc -o test_libpqos test_libpqos.c -lpqos - CHECK_RESULT $? 0 0 "编译测试程序失败,无法链接libpqos库" - - # 运行测试程序 - LOG_INFO "运行测试程序" - ./test_libpqos - CHECK_RESULT $? 0 0 "运行测试程序失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_libpqos.c test_libpqos - - # 如果脚本开始前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载intel-cmt-cat-devel软件包" - dnf remove -y intel-cmt-cat-devel - CHECK_RESULT $? 0 0 "卸载intel-cmt-cat-devel软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_presence.sh b/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_presence.sh deleted file mode 100644 index bd0ab43955d..00000000000 --- a/testcases/function_test/pkg_test/intel-cmt-cat/intel-cmt-cat-devel/test_intel-cmt-cat-devel_presence.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-20 -# @License : Mulan PSL v2 -# @Desc : 测试 intel-cmt-cat-devel 软件包是否已正确安装在系统中,并验证其核心开发文件(如头文件和库文件)是否存在。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装 intel-cmt-cat-devel 软件包 - LOG_INFO "检查 intel-cmt-cat-devel 软件包是否已安装" - if rpm -q intel-cmt-cat-devel &>/dev/null; then - LOG_INFO "软件包 intel-cmt-cat-devel 已安装" - already_installed=true - else - LOG_INFO "软件包 intel-cmt-cat-devel 未安装" - already_installed=false - fi - - # 检查 yum 源中是否存在该软件包 - LOG_INFO "检查 yum 源中是否存在 intel-cmt-cat-devel 软件包" - if dnf list available intel-cmt-cat-devel &>/dev/null; then - LOG_INFO "yum 源中存在 intel-cmt-cat-devel 软件包" - else - LOG_ERROR "yum 源中不存在 intel-cmt-cat-devel 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装 intel-cmt-cat-devel 软件包" - dnf install -y intel-cmt-cat-devel - CHECK_RESULT $? 0 0 "安装 intel-cmt-cat-devel 软件包失败" - fi - - # 验证核心开发文件是否存在 - LOG_INFO "验证 intel-cmt-cat-devel 核心开发文件是否存在" - - # 检查头文件是否存在 - LOG_INFO "检查头文件是否存在" - if [ -d /usr/include/intel-cmt-cat ]; then - LOG_INFO "头文件目录 /usr/include/intel-cmt-cat 存在" - else - LOG_ERROR "头文件目录 /usr/include/intel-cmt-cat 不存在" - CHECK_RESULT 1 0 0 "头文件目录不存在" - fi - - # 检查库文件是否存在 - LOG_INFO "检查库文件是否存在" - if ls /usr/lib*/libpqos* &>/dev/null; then - LOG_INFO "库文件 libpqos 存在" - else - LOG_ERROR "库文件 libpqos 不存在" - CHECK_RESULT 1 0 0 "库文件不存在" - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载 intel-cmt-cat-devel 软件包" - dnf remove -y intel-cmt-cat-devel - CHECK_RESULT $? 0 0 "卸载 intel-cmt-cat-devel 软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 2926d61b940f171854fb7a8a1d24b2802fd5b31f Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:34:57 +0800 Subject: [PATCH 09/18] update testcase for testsuite jetty-servlets --- .../pkg_test/jetty/jetty-servlets.json | 28 --- ...st_jetty-servlets_function_continuation.sh | 112 --------- ...est_jetty-servlets_function_crossfilter.sh | 217 ------------------ .../test_jetty-servlets_function_dosfilter.sh | 98 -------- .../test_jetty-servlets_function_install.sh | 79 ------- .../test_jetty-servlets_function_status.sh | 82 ------- .../test_jetty-servlets_function_uninstall.sh | 126 ---------- .../test_jetty-servlets_function_version.sh | 131 ----------- 8 files changed, 873 deletions(-) delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_continuation.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_crossfilter.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_dosfilter.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_install.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_status.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_version.sh diff --git a/suite2cases/function_test/pkg_test/jetty/jetty-servlets.json b/suite2cases/function_test/pkg_test/jetty/jetty-servlets.json index e680ce49c59..544af743de4 100644 --- a/suite2cases/function_test/pkg_test/jetty/jetty-servlets.json +++ b/suite2cases/function_test/pkg_test/jetty/jetty-servlets.json @@ -6,34 +6,6 @@ "name": "test_jetty-servlets_install", "desc": "测试jetty-servlets软件包的安装功能", "machine num": 1 - }, - { - "name": "test_jetty-servlets_function_install", - "desc": "测试jetty-servlets软件包的安装功能" - }, - { - "name": "test_jetty-servlets_function_uninstall", - "desc": "测试jetty-servlets软件包的卸载功能" - }, - { - "name": "test_jetty-servlets_function_version", - "desc": "测试检查jetty-servlets软件包版本信息" - }, - { - "name": "test_jetty-servlets_function_status", - "desc": "测试检查jetty-servlets软件包状态" - }, - { - "name": "test_jetty-servlets_function_crossfilter", - "desc": "测试CrossOriginFilter跨域过滤功能" - }, - { - "name": "test_jetty-servlets_function_dosfilter", - "desc": "测试DoSFilter防拒绝服务功能" - }, - { - "name": "test_jetty-servlets_function_continuation", - "desc": "测试Continuation支持异步处理" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_continuation.sh b/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_continuation.sh deleted file mode 100644 index 5e394ede1ca..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_continuation.sh +++ /dev/null @@ -1,112 +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 : 测试Continuation支持异步处理 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试Continuation支持异步处理 - LOG_INFO "开始测试Continuation支持异步处理功能" - - # 定义软件包名称 - PACKAGE_NAME="jetty-servlets" - - # 步骤1:检查是否已安装jetty-servlets - LOG_INFO "步骤1:检查系统中是否已安装${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 - - # 步骤2:检查yum源中是否存在该软件包 - LOG_INFO "步骤2:检查yum源中是否存在${PACKAGE_NAME}软件包" - if ! dnf list available ${PACKAGE_NAME} > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - - # 如果未安装,则安装软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - LOG_INFO "${PACKAGE_NAME}安装成功" - fi - - # 步骤4:检查Continuation相关命令是否支持 - LOG_INFO "步骤4:检查Continuation相关命令参数" - # 假设Continuation功能通过某个命令或参数测试,这里以示例命令为例 - TEST_COMMAND="java -jar /usr/share/java/jetty-servlets.jar --help" - if ! ${TEST_COMMAND} 2>&1 | grep -q "continuation" && ! ${TEST_COMMAND} 2>&1 | grep -q "async"; then - LOG_ERROR "Continuation相关参数不支持" - # 清理环境 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - dnf remove -y ${PACKAGE_NAME} - LOG_INFO "已卸载${PACKAGE_NAME}软件包" - fi - exit 255 - fi - LOG_INFO "Continuation相关参数支持正常" - - # 步骤5:测试Continuation异步处理功能 - LOG_INFO "步骤5:测试Continuation异步处理功能" - # 这里模拟一个简单的异步处理测试,实际应根据jetty-servlets的具体功能编写 - # 示例:启动一个简单的HTTP服务测试异步处理 - TEST_SERVER_CMD="java -cp /usr/share/java/jetty-servlets.jar org.eclipse.jetty.servlets.AsyncTestServer" - # 注意:这是一个示例命令,实际命令可能需要调整 - if ! command -v java > /dev/null 2>&1; then - LOG_ERROR "Java未安装,无法执行Continuation测试" - CHECK_RESULT 1 0 0 "Java环境检查失败" - fi - - # 模拟测试执行,这里只是示例 - LOG_INFO "执行Continuation异步处理测试..." - # 实际测试代码应根据jetty-servlets的具体API编写 - SLEEP_TIME=2 - LOG_INFO "模拟异步处理等待${SLEEP_TIME}秒..." - sleep ${SLEEP_TIME} - - # 检查测试结果 - TEST_RESULT=$? - if [ ${TEST_RESULT} -eq 0 ]; then - LOG_INFO "Continuation异步处理测试成功" - else - LOG_ERROR "Continuation异步处理测试失败" - CHECK_RESULT ${TEST_RESULT} 0 0 "Continuation异步处理测试失败" - fi - - # 步骤6:清理测试环境 - LOG_INFO "步骤6:清理测试环境" - # 如果测试前未安装,则卸载软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - LOG_INFO "${PACKAGE_NAME}卸载成功" - else - LOG_INFO "测试前已安装${PACKAGE_NAME},保持安装状态" - fi - - LOG_INFO "Continuation支持异步处理测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_crossfilter.sh b/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_crossfilter.sh deleted file mode 100644 index 1d05364fef2..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_crossfilter.sh +++ /dev/null @@ -1,217 +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 : 测试CrossOriginFilter跨域过滤功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(虽然题目说不需要定义,但实际脚本需要这些函数才能运行) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package_name=$1 - LOG_INFO "检查yum源中是否存在软件包: $package_name" - dnf list available "$package_name" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $package_name 不在yum源中" - exit 255 - fi - } - - # 检查命令参数是否支持 - check_command_param() { - local cmd=$1 - local param=$2 - LOG_INFO "检查命令 $cmd 是否支持参数: $param" - $cmd --help 2>&1 | grep -q "$param" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $cmd 不支持参数 $param" - exit 255 - fi - } - - # 安装软件包 - 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 失败" - } - - # 检查软件包是否已安装 - is_package_installed() { - local package_name=$1 - rpm -q "$package_name" &>/dev/null - return $? - } - - # 主测试函数 - test_cross_origin_filter() { - LOG_INFO "开始测试CrossOriginFilter跨域过滤功能" - - # 定义需要测试的软件包 - local test_package="jetty-servlets" - - # 检查软件包是否在yum源中 - check_package_in_repo "$test_package" - - # 记录初始安装状态 - local was_installed=false - if is_package_installed "$test_package"; then - LOG_INFO "软件包 $test_package 已经安装" - was_installed=true - else - LOG_INFO "软件包 $test_package 未安装,将作为测试步骤安装" - fi - - # 如果未安装,则安装软件包 - if [ "$was_installed" = false ]; then - install_package "$test_package" - fi - - # 检查jetty命令是否可用 - LOG_INFO "检查jetty相关命令是否可用" - which jetty &>/dev/null - CHECK_RESULT $? 0 0 "jetty命令不可用" - - # 测试CrossOriginFilter相关功能 - LOG_INFO "测试CrossOriginFilter基本功能" - - # 检查jetty是否支持CrossOriginFilter参数 - check_command_param "jetty" "cross-origin" - - # 模拟测试CrossOriginFilter配置 - LOG_INFO "创建测试配置文件" - local test_config="/tmp/test-crossorigin-config.xml" - cat > "$test_config" << EOF - - - - - * - GET,POST,PUT,DELETE,OPTIONS - * - - - - - EOF - - CHECK_RESULT $? 0 0 "创建测试配置文件失败" - - # 验证配置文件格式 - LOG_INFO "验证CrossOriginFilter配置文件格式" - if [ -f "$test_config" ]; then - grep -q "CrossOriginFilter" "$test_config" - CHECK_RESULT $? 0 0 "配置文件中未找到CrossOriginFilter配置" - - grep -q "allowedOrigins" "$test_config" - CHECK_RESULT $? 0 0 "配置文件中缺少allowedOrigins设置" - - LOG_INFO "CrossOriginFilter配置文件验证通过" - fi - - # 清理测试配置文件 - LOG_INFO "清理测试配置文件" - rm -f "$test_config" - CHECK_RESULT $? 0 0 "清理测试配置文件失败" - - # 如果测试过程中安装了软件包,则在测试结束后卸载 - if [ "$was_installed" = false ]; then - LOG_INFO "测试完成,卸载测试安装的软件包" - uninstall_package "$test_package" - else - LOG_INFO "测试完成,保持原有安装状态" - fi - - LOG_INFO "CrossOriginFilter跨域过滤功能测试完成" - } - - # 环境清理函数 - cleanup_environment() { - LOG_INFO "开始清理测试环境" - - # 清理临时文件 - local temp_files=( - "/tmp/test-crossorigin-config.xml" - "/tmp/jetty-test-*.log" - ) - - for file in "${temp_files[@]}"; do - if [ -f "$file" ] || [ -d "$file" ]; then - rm -rf "$file" - LOG_INFO "已清理: $file" - fi - done - - # 检查并停止可能由测试启动的jetty服务 - local jetty_pid=$(pgrep -f "jetty") - if [ -n "$jetty_pid" ]; then - LOG_INFO "发现测试残留的jetty进程,正在停止" - pkill -f "jetty" - sleep 2 - fi - - LOG_INFO "环境清理完成" - } - - # 异常处理 - handle_error() { - LOG_ERROR "测试执行失败: $1" - cleanup_environment - exit 1 - } - - # 设置异常捕获 - trap "handle_error "脚本执行被中断"" INT TERM - trap "handle_error "脚本执行错误" $?" ERR - - # 执行测试 - main() { - LOG_INFO "开始执行CrossOriginFilter跨域过滤功能测试脚本" - - # 执行测试 - test_cross_origin_filter - - # 清理环境 - cleanup_environment - - LOG_INFO "测试脚本执行完成" - exit 0 - } - - # 运行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_dosfilter.sh b/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_dosfilter.sh deleted file mode 100644 index abbb7034a0a..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_dosfilter.sh +++ /dev/null @@ -1,98 +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 : 测试DoSFilter防拒绝服务功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试DoSFilter防拒绝服务功能 - - LOG_INFO "开始测试DoSFilter防拒绝服务功能" - - # 检查是否已安装jetty-servlets软件包 - LOG_INFO "检查是否已安装jetty-servlets软件包" - if rpm -q jetty-servlets > /dev/null 2>&1; then - LOG_INFO "jetty-servlets软件包已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "jetty-servlets软件包未安装" - INSTALLED=false - fi - - # 检查yum源中是否有jetty-servlets软件包 - LOG_INFO "检查yum源中是否有jetty-servlets软件包" - if ! dnf list available jetty-servlets > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到jetty-servlets软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装jetty-servlets软件包" - dnf install -y jetty-servlets - CHECK_RESULT $? 0 0 "安装jetty-servlets软件包失败" - fi - - # 检查DoSFilter参数支持情况 - LOG_INFO "检查DoSFilter参数支持情况" - if ! java -cp /usr/share/java/jetty-servlets.jar org.eclipse.jetty.servlets.DoSFilter --help > /dev/null 2>&1; then - LOG_ERROR "DoSFilter不支持--help参数或命令执行失败" - # 如果是未安装的情况,需要清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载jetty-servlets软件包" - dnf remove -y jetty-servlets - fi - exit 255 - fi - - # 测试DoSFilter基本功能 - LOG_INFO "测试DoSFilter基本功能" - java -cp /usr/share/java/jetty-servlets.jar org.eclipse.jetty.servlets.DoSFilter --help 2>&1 | grep -q "DoSFilter" - CHECK_RESULT $? 0 0 "DoSFilter基本功能测试失败" - - # 测试DoSFilter参数验证 - LOG_INFO "测试DoSFilter参数验证" - if java -cp /usr/share/java/jetty-servlets.jar org.eclipse.jetty.servlets.DoSFilter --invalid-param > /dev/null 2>&1; then - LOG_ERROR "DoSFilter接受了无效参数" - # 如果是未安装的情况,需要清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载jetty-servlets软件包" - dnf remove -y jetty-servlets - fi - exit 255 - fi - - # 测试DoSFilter防拒绝服务功能 - LOG_INFO "测试DoSFilter防拒绝服务功能" - # 这里可以添加具体的DoSFilter功能测试 - # 例如:测试连接限制、请求频率限制等功能 - LOG_INFO "DoSFilter防拒绝服务功能测试完成" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载jetty-servlets软件包" - dnf remove -y jetty-servlets - CHECK_RESULT $? 0 0 "卸载jetty-servlets软件包失败" - else - LOG_INFO "保持jetty-servlets软件包安装状态" - fi - - LOG_INFO "DoSFilter防拒绝服务功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_install.sh b/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_install.sh deleted file mode 100644 index 2b2ff14a031..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_install.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 : 测试jetty-servlets软件包的安装功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试jetty-servlets软件包的安装功能" - - LOG_INFO "步骤1:检查当前环境中是否已安装jetty-servlets软件包" - if rpm -q jetty-servlets &>/dev/null; then - LOG_INFO "当前环境已安装jetty-servlets软件包,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "当前环境未安装jetty-servlets软件包,将在测试过程中安装并在结束后卸载" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在jetty-servlets软件包" - if ! dnf list available jetty-servlets &>/dev/null; then - LOG_ERROR "yum源中未找到jetty-servlets软件包" - exit 255 - fi - - LOG_INFO "步骤3:安装jetty-servlets软件包" - dnf install -y jetty-servlets - CHECK_RESULT $? 0 0 "安装jetty-servlets软件包失败" - - LOG_INFO "步骤4:验证软件包安装成功" - rpm -q jetty-servlets - CHECK_RESULT $? 0 0 "验证jetty-servlets软件包安装状态失败" - - LOG_INFO "步骤5:执行一个基本的jetty-servlets命令以验证功能" - if command -v jetty-servlets &>/dev/null; then - jetty-servlets --help &>/dev/null - CHECK_RESULT $? 0 0 "执行jetty-servlets命令失败" - else - LOG_INFO "未找到jetty-servlets命令,尝试使用jar文件验证" - JAR_PATH=$(rpm -ql jetty-servlets | grep -E "\.jar$" | head -1) - if [[ -n "$JAR_PATH" ]]; then - java -jar "$JAR_PATH" --help &>/dev/null - CHECK_RESULT $? 0 255 "执行jetty-servlets jar文件失败,参数可能不支持" - else - LOG_ERROR "未找到jetty-servlets的jar文件" - exit 255 - fi - fi - - LOG_INFO "步骤6:环境清理" - if [[ "$INSTALLED_BEFORE" == "false" ]]; then - LOG_INFO "卸载测试过程中安装的jetty-servlets软件包" - dnf remove -y jetty-servlets - CHECK_RESULT $? 0 0 "卸载jetty-servlets软件包失败" - LOG_INFO "已成功卸载jetty-servlets软件包,环境已恢复" - else - LOG_INFO "测试前已安装jetty-servlets软件包,保持安装状态" - fi - - LOG_INFO "jetty-servlets软件包安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_status.sh b/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_status.sh deleted file mode 100644 index 138cf64dd6d..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_status.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-20 -# @License : Mulan PSL v2 -# @Desc : 测试检查jetty-servlets软件包状态 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试jetty-servlets软件包状态" - LOG_INFO "步骤1:检查yum源中是否存在jetty-servlets软件包" - dnf list available jetty-servlets &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到jetty-servlets软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已安装jetty-servlets" - rpm -q jetty-servlets &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "jetty-servlets已安装,标记为已安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "jetty-servlets未安装,标记为未安装状态" - ALREADY_INSTALLED=0 - fi - - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装jetty-servlets软件包" - dnf install -y jetty-servlets &> /dev/null - CHECK_RESULT $? 0 0 "安装jetty-servlets失败" - fi - - LOG_INFO "步骤4:检查jetty-servlets软件包状态" - rpm -qi jetty-servlets &> /dev/null - CHECK_RESULT $? 0 0 "检查jetty-servlets软件包状态失败" - - LOG_INFO "步骤5:验证jetty-servlets相关命令参数" - # 假设jetty-servlets有一个名为jetty-servlets-status的命令用于检查状态 - # 检查该命令是否存在 - command -v jetty-servlets-status &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "jetty-servlets-status命令不存在" - exit 255 - fi - # 检查命令是否支持--version参数(示例) - jetty-servlets-status --version &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "jetty-servlets-status命令不支持--version参数" - exit 255 - fi - - LOG_INFO "步骤6:执行jetty-servlets-status命令检查服务状态" - jetty-servlets-status - CHECK_RESULT $? 0 0 "执行jetty-servlets-status命令失败" - - LOG_INFO "步骤7:环境清理与恢复" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的jetty-servlets软件包" - dnf remove -y jetty-servlets &> /dev/null - CHECK_RESULT $? 0 0 "卸载jetty-servlets失败" - else - LOG_INFO "系统原本已安装jetty-servlets,保持安装状态" - fi - - LOG_INFO "jetty-servlets软件包状态测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_uninstall.sh b/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_uninstall.sh deleted file mode 100644 index 8651db5d1bc..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_uninstall.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-20 -# @License : Mulan PSL v2 -# @Desc : 测试jetty-servlets软件包的卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数 - CHECK_RESULT() { - if [ $# -lt 4 ]; then - LOG_ERROR "CHECK_RESULT 参数不足" - exit 255 - fi - local actual=$1 - local expect=$2 - local mode=$3 - local msg=$4 - if [ $mode -eq 0 ]; then - if [ $actual -eq $expect ]; then - LOG_INFO "$msg 成功" - else - LOG_ERROR "$msg 失败" - exit $actual - fi - else - if [ $actual -ne $expect ]; then - LOG_INFO "$msg 成功" - else - LOG_ERROR "$msg 失败" - exit $actual - fi - fi - } - - # 定义软件包名称 - PACKAGE_NAME="jetty-servlets" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在软件包 $PACKAGE_NAME" - exit 255 - fi - LOG_INFO "yum源中存在软件包 $PACKAGE_NAME" - - # 步骤2:检查当前是否已安装软件包 - LOG_INFO "步骤2:检查当前是否已安装软件包 $PACKAGE_NAME" - if rpm -q $PACKAGE_NAME &>/dev/null; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - INSTALLED=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - INSTALLED=false - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME" - else - LOG_INFO "步骤3:软件包 $PACKAGE_NAME 已安装,跳过安装步骤" - 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 - if [ $? -eq 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 卸载失败" - exit 1 - else - LOG_INFO "软件包 $PACKAGE_NAME 卸载成功" - fi - - # 步骤7:如果之前未安装,则重新安装以恢复环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤7:恢复环境,重新安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "重新安装软件包 $PACKAGE_NAME" - else - LOG_INFO "步骤7:环境恢复,软件包 $PACKAGE_NAME 保持安装状态" - fi - - # 步骤8:最终验证环境状态 - LOG_INFO "步骤8:最终验证环境状态" - rpm -q $PACKAGE_NAME - CHECK_RESULT $? 0 0 "最终验证软件包 $PACKAGE_NAME 状态" - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_version.sh b/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_version.sh deleted file mode 100644 index b4fbc7fdd68..00000000000 --- a/testcases/function_test/pkg_test/jetty/jetty-servlets/test_jetty-servlets_function_version.sh +++ /dev/null @@ -1,131 +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 : 测试检查jetty-servlets软件包版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色和日志函数 - LOG_INFO() { - echo -e "\033[1;32m[INFO]\033[0m $1" - } - - LOG_ERROR() { - echo -e "\033[1;31m[ERROR]\033[0m $1" - } - - # 检查yum源中是否存在指定软件包 - check_package_in_repo() { - local pkg_name=$1 - LOG_INFO "检查yum源中是否存在软件包: $pkg_name" - dnf list available "$pkg_name" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在软件包: $pkg_name" - exit 255 - fi - LOG_INFO "yum源中存在软件包: $pkg_name" - } - - # 检查命令参数是否支持 - check_command_param() { - local cmd=$1 - local param=$2 - LOG_INFO "检查命令 $cmd 是否支持参数 $param" - $cmd --help 2>&1 | grep -q "$param" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $cmd 不支持参数 $param" - exit 255 - fi - LOG_INFO "命令 $cmd 支持参数 $param" - } - - # 安装软件包 - install_package() { - local pkg_name=$1 - LOG_INFO "开始安装软件包: $pkg_name" - dnf install -y "$pkg_name" - CHECK_RESULT $? 0 0 "安装软件包 $pkg_name 失败" - LOG_INFO "软件包 $pkg_name 安装成功" - } - - # 卸载软件包 - uninstall_package() { - local pkg_name=$1 - LOG_INFO "开始卸载软件包: $pkg_name" - dnf remove -y "$pkg_name" - CHECK_RESULT $? 0 0 "卸载软件包 $pkg_name 失败" - LOG_INFO "软件包 $pkg_name 卸载成功" - } - - # 检查软件包是否已安装 - is_package_installed() { - local pkg_name=$1 - rpm -q "$pkg_name" &>/dev/null - return $? - } - - # 主测试函数 - test_jetty_servlets_version() { - local pkg_name="jetty-servlets" - local need_uninstall=false - - # 检查yum源中是否存在jetty-servlets软件包 - check_package_in_repo "$pkg_name" - - # 检查环境是否已安装jetty-servlets - if is_package_installed "$pkg_name"; then - LOG_INFO "检测到 $pkg_name 已安装,脚本结束后将保持安装状态" - else - LOG_INFO "检测到 $pkg_name 未安装,将在测试后卸载" - need_uninstall=true - install_package "$pkg_name" - fi - - # 测试检查jetty-servlets软件包版本信息 - LOG_INFO "开始测试:检查jetty-servlets软件包版本信息" - - # 检查rpm命令是否支持-q参数 - check_command_param "rpm" "-q" - - # 执行版本检查 - LOG_INFO "执行命令: rpm -q $pkg_name" - rpm -q "$pkg_name" - CHECK_RESULT $? 0 0 "获取jetty-servlets版本信息失败" - - # 获取详细版本信息 - LOG_INFO "执行命令: rpm -qi $pkg_name" - rpm -qi "$pkg_name" | head -10 - CHECK_RESULT $? 0 0 "获取jetty-servlets详细信息失败" - - LOG_INFO "jetty-servlets版本信息检查完成" - - # 环境恢复 - if [ "$need_uninstall" = true ]; then - uninstall_package "$pkg_name" - else - LOG_INFO "保持 $pkg_name 安装状态,无需卸载" - fi - } - - # 执行主测试 - test_jetty_servlets_version - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file From 5fd33abac7cf6318643c8b5fe5dca8c09aa2f222 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:37:09 +0800 Subject: [PATCH 10/18] update testcase for testsuite fcoe-utils-help --- .../pkg_test/fcoe-utils/fcoe-utils-help.json | 8 -- .../test_fcoe-utils-help_display_help.sh | 71 ----------------- .../test_fcoe-utils-help_install_pkg.sh | 78 ------------------- 3 files changed, 157 deletions(-) delete mode 100644 testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_display_help.sh delete mode 100644 testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_install_pkg.sh diff --git a/suite2cases/function_test/pkg_test/fcoe-utils/fcoe-utils-help.json b/suite2cases/function_test/pkg_test/fcoe-utils/fcoe-utils-help.json index 9523f72f3b4..e7eb05e4554 100644 --- a/suite2cases/function_test/pkg_test/fcoe-utils/fcoe-utils-help.json +++ b/suite2cases/function_test/pkg_test/fcoe-utils/fcoe-utils-help.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help", "machine num": 1, "cases": [ - { - "name": "test_fcoe-utils-help_install_pkg", - "desc": "测试软件包安装功能,验证是否能通过系统包管理器成功安装。" - }, { "name": "test_fcoe-utils-help_uninstall_pkg", "desc": "测试软件包卸载功能,验证是否能通过系统包管理器成功卸载且清理干净。" @@ -13,10 +9,6 @@ { "name": "test_fcoe-utils-help_verify_installed", "desc": "测试验证软件包是否已正确安装,检查其文件、版本等信息。" - }, - { - "name": "test_fcoe-utils-help_display_help", - "desc": "测试软件包帮助文档查看功能,验证能否正确显示其使用说明或手册页。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_display_help.sh b/testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_display_help.sh deleted file mode 100644 index d98da92ab05..00000000000 --- a/testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_display_help.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-23 -# @License : Mulan PSL v2 -# @Desc : 测试软件包帮助文档查看功能,验证能否正确显示其使用说明或手册页。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 fcoe-utils 帮助文档查看功能" - LOG_INFO "步骤1:检查 yum 源中是否存在 fcoe-utils 软件包" - if ! dnf list available fcoe-utils &>/dev/null; then - LOG_ERROR "yum 源中不存在 fcoe-utils 软件包" - exit 255 - fi - LOG_INFO "fcoe-utils 软件包在 yum 源中存在" - - LOG_INFO "步骤2:检查当前环境是否已安装 fcoe-utils" - if rpm -q fcoe-utils &>/dev/null; then - LOG_INFO "fcoe-utils 已安装,测试结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "fcoe-utils 未安装,将在测试前安装" - INSTALLED="false" - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装 fcoe-utils 软件包" - dnf install -y fcoe-utils - CHECK_RESULT $? 0 0 "安装 fcoe-utils 失败" - LOG_INFO "fcoe-utils 安装成功" - fi - - LOG_INFO "步骤4:验证 fcoe-utils 命令的帮助参数" - if ! fcoe-utils --help &>/dev/null; then - LOG_ERROR "fcoe-utils 命令不支持 --help 参数" - exit 255 - fi - LOG_INFO "fcoe-utils 命令支持 --help 参数" - - LOG_INFO "步骤5:执行 fcoe-utils --help 命令并检查输出" - fcoe-utils --help - CHECK_RESULT $? 0 0 "执行 fcoe-utils --help 命令失败" - LOG_INFO "fcoe-utils --help 命令执行成功,帮助文档显示正常" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤6:卸载 fcoe-utils 软件包以恢复环境" - dnf remove -y fcoe-utils - CHECK_RESULT $? 0 0 "卸载 fcoe-utils 失败" - LOG_INFO "fcoe-utils 卸载成功,环境已恢复" - else - LOG_INFO "步骤6:测试前已安装 fcoe-utils,保持安装状态,无需卸载" - fi - - LOG_INFO "测试完成,fcoe-utils 帮助文档查看功能验证通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_install_pkg.sh b/testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_install_pkg.sh deleted file mode 100644 index 2b7fd6df743..00000000000 --- a/testcases/function_test/pkg_test/fcoe-utils/fcoe-utils-help/test_fcoe-utils-help_install_pkg.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-23 -# @License : Mulan PSL v2 -# @Desc : 测试软件包安装功能,验证是否能通过系统包管理器成功安装。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装fcoe-utils-help软件包 - LOG_INFO "检查fcoe-utils-help软件包是否已安装" - rpm -q fcoe-utils-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "fcoe-utils-help软件包已安装,脚本结束将保持安装状态" - INSTALLED=true - else - LOG_INFO "fcoe-utils-help软件包未安装" - INSTALLED=false - fi - - # 检查yum源中是否有fcoe-utils-help软件包 - LOG_INFO "检查yum源中是否存在fcoe-utils-help软件包" - dnf list available fcoe-utils-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在fcoe-utils-help软件包" - exit 255 - fi - - # 如果未安装,则执行安装步骤 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装fcoe-utils-help软件包" - dnf install -y fcoe-utils-help - CHECK_RESULT $? 0 0 "安装fcoe-utils-help软件包失败" - LOG_INFO "fcoe-utils-help软件包安装成功" - fi - - # 验证软件包安装功能 - LOG_INFO "验证软件包安装功能" - rpm -q fcoe-utils-help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证fcoe-utils-help软件包安装失败" - - # 测试软件包基本命令 - LOG_INFO "测试fcoe-utils-help软件包命令" - fcoe-utils-help --help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "fcoe-utils-help命令执行成功" - else - LOG_ERROR "fcoe-utils-help命令不存在或不支持" - exit 255 - fi - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载fcoe-utils-help软件包" - dnf remove -y fcoe-utils-help - CHECK_RESULT $? 0 0 "卸载fcoe-utils-help软件包失败" - LOG_INFO "fcoe-utils-help软件包卸载成功" - else - LOG_INFO "保持fcoe-utils-help软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From f7e65e8e7cb224dabd92af9007f9b2d2245c42f7 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:38:21 +0800 Subject: [PATCH 11/18] update testcase for testsuite fence-agents-rsb --- .../fence-agents/fence-agents-rsb.json | 20 --- .../test_fence-agents-rsb_function_install.sh | 124 ---------------- ...t_fence-agents-rsb_function_list_agents.sh | 134 ------------------ ...est_fence-agents-rsb_function_rsb_usage.sh | 83 ----------- ...est_fence-agents-rsb_function_uninstall.sh | 77 ---------- .../test_fence-agents-rsb_function_verify.sh | 131 ----------------- 6 files changed, 569 deletions(-) delete mode 100644 testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_install.sh delete mode 100644 testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_list_agents.sh delete mode 100644 testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_rsb_usage.sh delete mode 100644 testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_verify.sh diff --git a/suite2cases/function_test/pkg_test/fence-agents/fence-agents-rsb.json b/suite2cases/function_test/pkg_test/fence-agents/fence-agents-rsb.json index 19d2fa63b81..69b59b8338b 100644 --- a/suite2cases/function_test/pkg_test/fence-agents/fence-agents-rsb.json +++ b/suite2cases/function_test/pkg_test/fence-agents/fence-agents-rsb.json @@ -5,26 +5,6 @@ { "name": "test_fence-agents-rsb_function_init", "desc": "Test initialization of fence-agents-rsb" - }, - { - "name": "test_fence-agents-rsb_function_install", - "desc": "Test installation of fence-agents-rsb package" - }, - { - "name": "test_fence-agents-rsb_function_uninstall", - "desc": "Test uninstallation of fence-agents-rsb package" - }, - { - "name": "test_fence-agents-rsb_function_verify", - "desc": "Test verification of fence-agents-rsb installation" - }, - { - "name": "test_fence-agents-rsb_function_list_agents", - "desc": "Test listing available fence agents" - }, - { - "name": "test_fence-agents-rsb_function_rsb_usage", - "desc": "Test basic usage of the rsb fence agent" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_install.sh b/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_install.sh deleted file mode 100644 index a74b508b9e2..00000000000 --- a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_install.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-03 -# @License : Mulan PSL v2 -# @Desc : Test installation of fence-agents-rsb package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义检查函数 - CHECK_RESULT() { - local actual=$1 - local expected=$2 - local exit_code=$3 - local message=$4 - - if [ $actual -ne $expected ]; then - LOG_ERROR "$message" - exit $exit_code - fi - } - - # 定义软件包名称 - PACKAGE_NAME="fence-agents-rsb" - - # 步骤1:检查软件包是否已在YUM源中 - LOG_INFO "步骤1:检查YUM源中是否存在$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "YUM源中未找到$PACKAGE_NAME软件包" - exit 255 - fi - LOG_INFO "YUM源中存在$PACKAGE_NAME软件包" - - # 步骤2:检查当前是否已安装软件包 - LOG_INFO "步骤2:检查$PACKAGE_NAME是否已安装" - rpm -q $PACKAGE_NAME &>/dev/null - INSTALLED=$? - - # 记录初始安装状态 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME已安装,测试后将保持安装状态" - NEED_CLEANUP=0 - else - LOG_INFO "$PACKAGE_NAME未安装,测试后将卸载" - NEED_CLEANUP=1 - fi - - # 步骤3:安装软件包(如果未安装) - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "步骤3:安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败" - LOG_INFO "成功安装$PACKAGE_NAME" - fi - - # 步骤4:验证软件包安装 - LOG_INFO "步骤4:验证$PACKAGE_NAME安装" - rpm -q $PACKAGE_NAME - CHECK_RESULT $? 0 0 "$PACKAGE_NAME安装验证失败" - - # 步骤5:检查软件包提供的命令 - LOG_INFO "步骤5:检查fence_rsb命令是否存在" - which fence_rsb &>/dev/null - CHECK_RESULT $? 0 0 "fence_rsb命令不存在" - - # 步骤6:测试基本命令参数 - LOG_INFO "步骤6:测试fence_rsb命令的基本参数" - fence_rsb --help &>/dev/null - CHECK_RESULT $? 0 0 "fence_rsb --help执行失败" - - # 步骤7:测试无效参数(应失败) - LOG_INFO "步骤7:测试无效参数处理" - fence_rsb --invalid-parameter &>/dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "无效参数处理不符合预期" - exit 255 - fi - LOG_INFO "无效参数处理正确" - - # 步骤8:清理环境(如果需要) - if [ $NEED_CLEANUP -eq 1 ]; then - LOG_INFO "步骤8:卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME失败" - LOG_INFO "成功卸载$PACKAGE_NAME" - - # 验证卸载 - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "$PACKAGE_NAME卸载验证失败" - exit 1 - fi - LOG_INFO "$PACKAGE_NAME卸载验证成功" - else - LOG_INFO "步骤8:保持$PACKAGE_NAME安装状态,无需清理" - fi - - LOG_INFO "测试完成:$PACKAGE_NAME安装功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_list_agents.sh b/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_list_agents.sh deleted file mode 100644 index 965f88385d4..00000000000 --- a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_list_agents.sh +++ /dev/null @@ -1,134 +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 : Test listing available fence agents -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境变量设置 - SCRIPT_NAME=$(basename "$0" .sh) - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local pkg=$1 - dnf list available "$pkg" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $pkg 不在yum源中" - exit 255 - fi - LOG_INFO "软件包 $pkg 在yum源中" - } - - # 检查命令参数是否存在 - 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 - LOG_INFO "命令 $cmd 支持参数 $param" - } - - # 检查软件包是否已安装 - check_package_installed() { - local pkg=$1 - rpm -q "$pkg" &>/dev/null - return $? - } - - # 主测试函数 - test_list_agents() { - local pkg="fence-agents-rsb" - local test_installed=false - - LOG_INFO "开始测试: 列出可用的fence agents" - - # 步骤1: 检查软件包是否已安装 - LOG_INFO "步骤1: 检查软件包是否已安装" - if check_package_installed "$pkg"; then - LOG_INFO "软件包 $pkg 已安装" - test_installed=true - else - LOG_INFO "软件包 $pkg 未安装" - test_installed=false - fi - - # 步骤2: 检查yum源中是否有该软件包 - LOG_INFO "步骤2: 检查yum源中是否有软件包 $pkg" - check_package_in_repo "$pkg" - - # 步骤3: 如果未安装,则安装软件包 - if [ "$test_installed" = false ]; then - LOG_INFO "步骤3: 安装软件包 $pkg" - dnf install -y "$pkg" - CHECK_RESULT $? 0 0 "安装软件包 $pkg 失败" - LOG_INFO "软件包 $pkg 安装成功" - else - LOG_INFO "步骤3: 软件包已安装,跳过安装步骤" - fi - - # 步骤4: 检查fence_rsb命令的--list参数 - LOG_INFO "步骤4: 检查fence_rsb命令是否支持--list参数" - check_command_param "fence_rsb" "--list" - - # 步骤5: 执行fence_rsb --list命令 - LOG_INFO "步骤5: 执行fence_rsb --list命令" - fence_rsb --list - CHECK_RESULT $? 0 0 "执行fence_rsb --list命令失败" - LOG_INFO "fence_rsb --list命令执行成功" - - # 步骤6: 验证输出结果 - LOG_INFO "步骤6: 验证fence_rsb --list命令输出" - local output - output=$(fence_rsb --list 2>&1) - if [ -z "$output" ]; then - LOG_ERROR "fence_rsb --list命令没有输出" - exit 1 - fi - - # 检查输出中是否包含至少一个fence agent - if echo "$output" | grep -q -E "^[a-zA-Z_-]+$"; then - LOG_INFO "fence_rsb --list命令输出了有效的fence agents列表" - echo "可用的fence agents:" - echo "$output" - else - LOG_ERROR "fence_rsb --list命令输出格式不正确" - exit 1 - fi - - # 步骤7: 清理环境 - LOG_INFO "步骤7: 清理测试环境" - if [ "$test_installed" = false ]; then - LOG_INFO "卸载测试安装的软件包 $pkg" - dnf remove -y "$pkg" - CHECK_RESULT $? 0 0 "卸载软件包 $pkg 失败" - LOG_INFO "软件包 $pkg 卸载成功" - else - LOG_INFO "测试前软件包已安装,保持安装状态" - fi - - LOG_INFO "测试完成: 成功列出可用的fence agents" - } - - # 执行测试 - test_list_agents -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_rsb_usage.sh b/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_rsb_usage.sh deleted file mode 100644 index 76a77ceeb82..00000000000 --- a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_rsb_usage.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-04-03 -# @License : Mulan PSL v2 -# @Desc : Test basic usage of the rsb fence agent -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试rsb隔离代理的基本使用" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在fence-agents-rsb软件包" - if ! dnf list available fence-agents-rsb &>/dev/null; then - LOG_ERROR "yum源中不存在fence-agents-rsb软件包" - exit 255 - fi - - # 检查当前是否已安装 - LOG_INFO "检查是否已安装fence-agents-rsb软件包" - if rpm -q fence-agents-rsb &>/dev/null; then - already_installed=true - LOG_INFO "软件包已安装,测试结束后将保持安装状态" - else - already_installed=false - LOG_INFO "软件包未安装,将进行安装测试" - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "安装fence-agents-rsb软件包" - dnf install -y fence-agents-rsb - CHECK_RESULT $? 0 0 "安装fence-agents-rsb软件包失败" - fi - - # 检查fence_rsb命令是否存在 - LOG_INFO "检查fence_rsb命令是否存在" - if ! command -v fence_rsb &>/dev/null; then - LOG_ERROR "fence_rsb命令不存在" - if [ "$already_installed" = "false" ]; then - dnf remove -y fence-agents-rsb - fi - exit 255 - fi - - # 测试fence_rsb命令的基本参数 - LOG_INFO "测试fence_rsb命令的--help参数" - fence_rsb --help - CHECK_RESULT $? 0 0 "fence_rsb --help命令执行失败" - - LOG_INFO "测试fence_rsb命令的--version参数" - fence_rsb --version - CHECK_RESULT $? 0 0 "fence_rsb --version命令执行失败" - - # 测试不支持的参数 - LOG_INFO "测试fence_rsb命令的不支持参数" - fence_rsb --nonexistent-param 2>&1 | grep -q "unrecognized option" - CHECK_RESULT $? 0 0 "fence_rsb未正确检测到不支持参数" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "卸载fence-agents-rsb软件包" - dnf remove -y fence-agents-rsb - CHECK_RESULT $? 0 0 "卸载fence-agents-rsb软件包失败" - fi - - LOG_INFO "rsb隔离代理基本使用测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_uninstall.sh b/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_uninstall.sh deleted file mode 100644 index aa8cfeddfc5..00000000000 --- a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_uninstall.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-03 -# @License : Mulan PSL v2 -# @Desc : Test uninstallation of fence-agents-rsb package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 fence-agents-rsb 软件包的卸载功能" - - LOG_INFO "步骤1: 检查 fence-agents-rsb 软件包是否已在系统中安装" - if rpm -q fence-agents-rsb &>/dev/null; then - LOG_INFO "fence-agents-rsb 软件包已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "fence-agents-rsb 软件包未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2: 检查 yum 源中是否存在 fence-agents-rsb 软件包" - if ! dnf list available fence-agents-rsb &>/dev/null; then - LOG_ERROR "yum 源中未找到 fence-agents-rsb 软件包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3: 安装 fence-agents-rsb 软件包" - dnf install -y fence-agents-rsb - CHECK_RESULT $? 0 0 "安装 fence-agents-rsb 软件包失败" - fi - - LOG_INFO "步骤4: 验证 fence-agents-rsb 软件包已正确安装" - rpm -q fence-agents-rsb - CHECK_RESULT $? 0 0 "fence-agents-rsb 软件包未正确安装" - - LOG_INFO "步骤5: 执行 fence-agents-rsb 软件包的卸载" - dnf remove -y fence-agents-rsb - CHECK_RESULT $? 0 0 "卸载 fence-agents-rsb 软件包失败" - - LOG_INFO "步骤6: 验证 fence-agents-rsb 软件包已成功卸载" - if rpm -q fence-agents-rsb &>/dev/null; then - LOG_ERROR "fence-agents-rsb 软件包卸载后仍然存在" - exit 1 - else - LOG_INFO "fence-agents-rsb 软件包已成功卸载" - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤7: 恢复环境,重新安装 fence-agents-rsb 软件包" - dnf install -y fence-agents-rsb - CHECK_RESULT $? 0 0 "重新安装 fence-agents-rsb 软件包失败" - LOG_INFO "环境已恢复,fence-agents-rsb 软件包已安装" - else - LOG_INFO "步骤7: 恢复环境,重新安装 fence-agents-rsb 软件包" - dnf install -y fence-agents-rsb - CHECK_RESULT $? 0 0 "重新安装 fence-agents-rsb 软件包失败" - LOG_INFO "环境已恢复,fence-agents-rsb 软件包保持安装状态" - fi - - LOG_INFO "测试 fence-agents-rsb 软件包的卸载功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_verify.sh b/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_verify.sh deleted file mode 100644 index e10a46cb73f..00000000000 --- a/testcases/function_test/pkg_test/fence-agents/fence-agents-rsb/test_fence-agents-rsb_function_verify.sh +++ /dev/null @@ -1,131 +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 : Test verification of fence-agents-rsb installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:fence-agents-rsb功能验证测试 - - LOG_INFO "开始测试 fence-agents-rsb 安装验证" - - # 检查是否已安装 fence-agents-rsb - LOG_INFO "步骤1: 检查 fence-agents-rsb 是否已安装" - rpm -q fence-agents-rsb - installed_status=$? - - # 记录初始安装状态 - if [ $installed_status -eq 0 ]; then - LOG_INFO "fence-agents-rsb 已安装" - was_installed=true - else - LOG_INFO "fence-agents-rsb 未安装" - was_installed=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤2: 检查yum源中是否有 fence-agents-rsb 软件包" - dnf list available fence-agents-rsb 2>/dev/null | grep -q "fence-agents-rsb" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有 fence-agents-rsb 软件包" - exit 255 - fi - LOG_INFO "yum源中存在 fence-agents-rsb 软件包" - - # 如果未安装,则安装软件包 - if [ "$was_installed" = "false" ]; then - LOG_INFO "步骤3: 安装 fence-agents-rsb 软件包" - dnf install -y fence-agents-rsb - CHECK_RESULT $? 0 0 "安装 fence-agents-rsb 失败" - LOG_INFO "fence-agents-rsb 安装成功" - fi - - # 验证软件包已正确安装 - LOG_INFO "步骤4: 验证 fence-agents-rsb 已正确安装" - rpm -q fence-agents-rsb - CHECK_RESULT $? 0 0 "fence-agents-rsb 未正确安装" - - # 检查 fence_rsb 命令是否存在 - LOG_INFO "步骤5: 检查 fence_rsb 命令是否存在" - which fence_rsb - CHECK_RESULT $? 0 0 "fence_rsb 命令不存在" - - # 测试 fence_rsb 命令的帮助参数 - LOG_INFO "步骤6: 测试 fence_rsb 命令的帮助参数" - fence_rsb --help 2>&1 | grep -q "Usage" - CHECK_RESULT $? 0 0 "fence_rsb 命令帮助参数测试失败" - - # 测试 fence_rsb 命令的版本参数 - LOG_INFO "步骤7: 测试 fence_rsb 命令的版本参数" - fence_rsb --version 2>&1 | grep -q "fence_rsb" - CHECK_RESULT $? 0 0 "fence_rsb 命令版本参数测试失败" - - # 测试 fence_rsb 命令的不支持参数(预期失败) - LOG_INFO "步骤8: 测试 fence_rsb 命令的不支持参数(预期失败)" - fence_rsb --nonexistent-param 2>&1 | grep -q "unrecognized option" - if [ $? -ne 0 ]; then - LOG_ERROR "fence_rsb 命令参数检查失败" - exit 255 - fi - LOG_INFO "fence_rsb 命令参数检查正确" - - # 测试 fence_rsb 命令的基本功能 - LOG_INFO "步骤9: 测试 fence_rsb 命令基本功能" - fence_rsb -o list 2>&1 | grep -q "Method.*list" - CHECK_RESULT $? 0 0 "fence_rsb 命令基本功能测试失败" - - # 如果需要多服务器测试,测试与第二个节点的通信 - LOG_INFO "步骤10: 测试与第二个节点的通信(如果配置了多服务器环境)" - if [ -n "$NODE2_IPV4" ] && [ -n "$NODE2_PASSWORD" ] && [ -n "$NODE2_USER" ]; then - SSH_CMD "rpm -q fence-agents-rsb 2>/dev/null || echo "not installed"" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "与第二个节点通信测试失败" - LOG_INFO "与第二个节点通信测试成功" - else - LOG_INFO "未配置多服务器环境,跳过第二个节点测试" - fi - - # 环境清理:如果测试前未安装,则卸载软件包 - LOG_INFO "步骤11: 环境清理" - if [ "$was_installed" = "false" ]; then - LOG_INFO "卸载 fence-agents-rsb 软件包" - dnf remove -y fence-agents-rsb - CHECK_RESULT $? 0 0 "卸载 fence-agents-rsb 失败" - LOG_INFO "fence-agents-rsb 卸载成功" - else - LOG_INFO "保持 fence-agents-rsb 安装状态" - fi - - # 最终验证环境状态 - LOG_INFO "步骤12: 验证环境状态" - if [ "$was_installed" = "false" ]; then - rpm -q fence-agents-rsb - if [ $? -eq 0 ]; then - LOG_ERROR "环境清理失败:fence-agents-rsb 仍然安装" - exit 1 - fi - LOG_INFO "环境已恢复到未安装状态" - else - rpm -q fence-agents-rsb - CHECK_RESULT $? 0 0 "环境状态异常:fence-agents-rsb 未保持安装" - LOG_INFO "环境保持安装状态" - fi - - LOG_INFO "fence-agents-rsb 安装验证测试完成" -} - -main "$@" \ No newline at end of file From 72fe16e034d7bc9ea8e2343045bbfe47c25f9264 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:39:30 +0800 Subject: [PATCH 12/18] update testcase for testsuite python3-reportlab --- .../python-reportlab/python3-reportlab.json | 54 ----- .../test_python3-reportlab_function_canvas.sh | 77 ------- .../test_python3-reportlab_function_colors.sh | 78 ------- .../test_python3-reportlab_function_docgen.sh | 64 ------ .../test_python3-reportlab_function_fonts.sh | 69 ------- ...t_python3-reportlab_function_helloworld.sh | 102 ---------- .../test_python3-reportlab_function_images.sh | 87 -------- ...test_python3-reportlab_function_install.sh | 63 ------ ...st_python3-reportlab_function_paragraph.sh | 191 ------------------ .../test_python3-reportlab_function_pdfgen.sh | 86 -------- .../test_python3-reportlab_function_table.sh | 120 ----------- .../test_python3-reportlab_function_text.sh | 103 ---------- ...st_python3-reportlab_function_uninstall.sh | 82 -------- 13 files changed, 1176 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/python-reportlab/python3-reportlab.json delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_canvas.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_colors.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_docgen.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_fonts.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_helloworld.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_images.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_install.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_paragraph.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_pdfgen.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_table.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_text.sh delete mode 100644 testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/python-reportlab/python3-reportlab.json b/suite2cases/function_test/pkg_test/python-reportlab/python3-reportlab.json deleted file mode 100644 index ec70e017aec..00000000000 --- a/suite2cases/function_test/pkg_test/python-reportlab/python3-reportlab.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-reportlab/python3-reportlab", - "machine num": 1, - "cases": [ - { - "name": "test_python3-reportlab_function_docgen", - "desc": "Test document generation functionality" - }, - { - "name": "test_python3-reportlab_function_canvas", - "desc": "Test canvas drawing functionality" - }, - { - "name": "test_python3-reportlab_function_pdfgen", - "desc": "Test PDF generation functionality" - }, - { - "name": "test_python3-reportlab_function_fonts", - "desc": "Test font handling functionality" - }, - { - "name": "test_python3-reportlab_function_colors", - "desc": "Test color handling functionality" - }, - { - "name": "test_python3-reportlab_function_images", - "desc": "Test image handling functionality" - }, - { - "name": "test_python3-reportlab_function_install", - "desc": "Test package installation and verification" - }, - { - "name": "test_python3-reportlab_function_helloworld", - "desc": "Test basic PDF creation" - }, - { - "name": "test_python3-reportlab_function_text", - "desc": "Test text drawing and formatting" - }, - { - "name": "test_python3-reportlab_function_table", - "desc": "Test table creation and styling" - }, - { - "name": "test_python3-reportlab_function_paragraph", - "desc": "Test paragraph flow and styles" - }, - { - "name": "test_python3-reportlab_function_uninstall", - "desc": "Test package removal" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_canvas.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_canvas.sh deleted file mode 100644 index 5e312877d72..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_canvas.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-12-03 -# @License : Mulan PSL v2 -# @Desc : Test canvas drawing functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - if rpm -q python3-reportlab &>/dev/null; then - LOG_INFO "python3-reportlab已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "python3-reportlab未安装,准备安装" - INSTALLED=false - fi - - # 检查yum源中是否有python3-reportlab软件包 - LOG_INFO "检查yum源中是否有python3-reportlab软件包" - if ! dnf list available python3-reportlab &>/dev/null; then - LOG_ERROR "yum源中未找到python3-reportlab软件包" - exit 255 - fi - - # 安装python3-reportlab(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装python3-reportlab" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 测试canvas绘图功能 - LOG_INFO "测试canvas绘图功能" - cat < test_canvas.py - from reportlab.pdfgen import canvas - def test_canvas(): - c = canvas.Canvas("test.pdf") - c.drawString(100, 100, "Hello, ReportLab!") - c.save() - test_canvas() - EOF - - python3 test_canvas.py - CHECK_RESULT $? 0 0 "canvas绘图功能测试失败" - - # 清理生成的测试文件 - LOG_INFO "清理测试文件" - rm -f test_canvas.py test.pdf - - # 如果脚本开始时未安装python3-reportlab,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-reportlab" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_colors.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_colors.sh deleted file mode 100644 index e780674fec3..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_colors.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 : 2025-12-03 -# @License : Mulan PSL v2 -# @Desc : Test color handling functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - if dnf list installed python3-reportlab &>/dev/null; then - LOG_INFO "python3-reportlab已安装,脚本结束时将保持安装状态" - installed=true - else - LOG_INFO "python3-reportlab未安装,将在测试结束后卸载" - installed=false - fi - - # 检查yum源中是否有python3-reportlab - LOG_INFO "检查yum源中是否有python3-reportlab" - if ! dnf list available python3-reportlab &>/dev/null; then - LOG_ERROR "yum源中未找到python3-reportlab" - exit 255 - fi - - # 安装python3-reportlab(如果未安装) - if [ "$installed" = false ]; then - LOG_INFO "安装python3-reportlab" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 测试color handling功能 - LOG_INFO "测试color handling功能" - python3 -c " - from reportlab.lib import colors - try: - assert colors.red == colors.Color(1, 0, 0, 1), "颜色定义不正确" - print("颜色处理功能正常") - except Exception as e: - print(f"颜色处理功能异常: {e}") - exit(1) - " > /tmp/color_test.log - CHECK_RESULT $? 0 0 "颜色处理功能测试失败" - - # 检查测试结果 - LOG_INFO "检查测试结果" - grep -q "颜色处理功能正常" /tmp/color_test.log - CHECK_RESULT $? 0 0 "颜色处理功能未通过测试" - - # 清理临时文件 - rm -f /tmp/color_test.log - - # 卸载python3-reportlab(如果脚本开始时未安装) - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-reportlab" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_docgen.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_docgen.sh deleted file mode 100644 index 09b1b7542c2..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_docgen.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-30 -# @License : Mulan PSL v2 -# @Desc : Test document generation functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - if rpm -q python3-reportlab &>/dev/null; then - LOG_INFO "python3-reportlab已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-reportlab未安装,将在测试完成后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在python3-reportlab包 - LOG_INFO "检查yum源中是否存在python3-reportlab包" - if ! dnf list available python3-reportlab &>/dev/null; then - LOG_ERROR "yum源中不存在python3-reportlab包" - exit 255 - fi - - # 安装python3-reportlab(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装python3-reportlab" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 测试文档生成功能 - LOG_INFO "测试文档生成功能" - python3 -c "from reportlab.lib.pagesizes import letter; from reportlab.pdfgen import canvas; c = canvas.Canvas("test_docgen.pdf", pagesize=letter); c.drawString(100, 750, "Test Document Generation"); c.save()" - CHECK_RESULT $? 0 0 "文档生成功能测试失败" - - # 清理环境(如果最初未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载python3-reportlab" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_fonts.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_fonts.sh deleted file mode 100644 index f46ab73e2d9..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_fonts.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-03 -# @License : Mulan PSL v2 -# @Desc : Test font handling functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在python3-reportlab软件包 - LOG_INFO "检查yum源中是否存在python3-reportlab软件包" - dnf list available python3-reportlab > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在python3-reportlab软件包" - exit 255 - fi - - # 检查是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - rpm -q python3-reportlab > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-reportlab已安装,脚本结束时将保持安装状态" - installed=true - else - installed=false - fi - - # 若未安装则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装python3-reportlab软件包" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 测试font handling functionality - LOG_INFO "测试font handling functionality" - python3 -c "from reportlab.pdfbase import pdfmetrics; from reportlab.pdfbase.ttfonts import TTFont; pdfmetrics.registerFont(TTFont("Arial", "Arial.ttf"))" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "测试font handling functionality失败" - - # 若脚本开始时未安装则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-reportlab软件包" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - - # 验证是否卸载成功 - rpm -q python3-reportlab > /dev/null 2>&1 - CHECK_RESULT $? 1 0 "卸载后仍存在python3-reportlab软件包" - fi - - LOG_INFO "测试脚本执行完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_helloworld.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_helloworld.sh deleted file mode 100644 index dfb061a9f4d..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_helloworld.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-08 -# @License : Mulan PSL v2 -# @Desc : Test basic PDF creation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境初始化 - LOG_INFO "开始执行测试:Test basic PDF creation" - - # 检查是否已安装python3-reportlab - LOG_INFO "检查python3-reportlab是否已安装" - if dnf list installed python3-reportlab &>/dev/null; then - LOG_INFO "python3-reportlab已安装" - INSTALLED="true" - else - LOG_INFO "python3-reportlab未安装" - INSTALLED="false" - fi - - # 检查yum源中是否有python3-reportlab包 - LOG_INFO "检查yum源中是否有python3-reportlab包" - if ! dnf list available python3-reportlab &>/dev/null; then - LOG_ERROR "yum源中未找到python3-reportlab包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装python3-reportlab" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 创建测试Python脚本 - LOG_INFO "创建测试Python脚本" - cat > /tmp/test_pdf.py << "EOF" - #!/usr/bin/env python3 - from reportlab.pdfgen import canvas - - def create_hello_world_pdf(): - c = canvas.Canvas("/tmp/hello_world.pdf") - c.drawString(100, 750, "Hello World") - c.save() - print("PDF created successfully") - - if __name__ == "__main__": - create_hello_world_pdf() - EOF - - # 执行Python脚本创建PDF - LOG_INFO "执行Python脚本创建PDF" - python3 /tmp/test_pdf.py - CHECK_RESULT $? 0 0 "执行Python脚本失败" - - # 检查PDF文件是否创建成功 - LOG_INFO "检查PDF文件是否创建成功" - if [ -f "/tmp/hello_world.pdf" ]; then - LOG_INFO "PDF文件创建成功" - # 检查文件大小 - FILE_SIZE=$(stat -c%s "/tmp/hello_world.pdf") - if [ "$FILE_SIZE" -gt 0 ]; then - LOG_INFO "PDF文件大小正常: ${FILE_SIZE}字节" - else - LOG_ERROR "PDF文件大小为0" - CHECK_RESULT 1 0 0 "PDF文件大小为0" - fi - else - LOG_ERROR "PDF文件未创建" - CHECK_RESULT 1 0 0 "PDF文件未创建" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test_pdf.py /tmp/hello_world.pdf - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-reportlab" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试完成:Test basic PDF creation" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_images.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_images.sh deleted file mode 100644 index 303d867683d..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_images.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-03 -# @License : Mulan PSL v2 -# @Desc : Test image handling functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test image handling functionality" - - # 检查是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - if dnf list installed python3-reportlab &>/dev/null; then - LOG_INFO "python3-reportlab已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-reportlab未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-reportlab - LOG_INFO "检查yum源中是否有python3-reportlab" - if ! dnf list available python3-reportlab &>/dev/null; then - LOG_ERROR "yum源中未找到python3-reportlab" - exit 255 - fi - - # 安装python3-reportlab(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python3-reportlab" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 测试image handling功能 - LOG_INFO "测试image handling功能" - TEST_SCRIPT=" - from reportlab.lib.pagesizes import letter - from reportlab.pdfgen import canvas - def create_image_pdf(): - c = canvas.Canvas("test_image.pdf", pagesize=letter) - c.drawImage("/usr/share/backgrounds/default.png", 100, 100, width=100, height=100) - c.save() - create_image_pdf() - " - echo "$TEST_SCRIPT" > test_script.py - python3 test_script.py - CHECK_RESULT $? 0 0 "生成PDF失败" - - # 验证生成的PDF文件是否存在 - LOG_INFO "验证生成的PDF文件是否存在" - if [ -f "test_image.pdf" ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f test_script.py test_image.pdf - - # 卸载python3-reportlab(如果测试前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-reportlab" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试完成:Test image handling functionality" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_install.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_install.sh deleted file mode 100644 index b3919041a74..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_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 : 2026-03-08 -# @License : Mulan PSL v2 -# @Desc : Test package installation and verification -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:软件包安装与验证" - LOG_INFO "步骤1:检查环境中是否已安装python3-reportlab软件包" - rpm -q python3-reportlab > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "环境中已安装python3-reportlab软件包" - INSTALLED="true" - else - LOG_INFO "环境中未安装python3-reportlab软件包" - INSTALLED="false" - fi - - LOG_INFO "步骤2:检查yum源中是否存在python3-reportlab软件包" - dnf list available python3-reportlab > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-reportlab软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装python3-reportlab软件包" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab软件包失败" - fi - - LOG_INFO "步骤4:验证python3-reportlab功能" - python3 -c "import reportlab; print("reportlab version:", reportlab.__version__)" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证python3-reportlab功能失败" - - LOG_INFO "步骤5:清理环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-reportlab软件包" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab软件包失败" - else - LOG_INFO "环境中已安装python3-reportlab软件包,保持安装状态" - fi - - LOG_INFO "测试完成:软件包安装与验证" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_paragraph.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_paragraph.sh deleted file mode 100644 index 16a5b6c6ae5..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_paragraph.sh +++ /dev/null @@ -1,191 +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-08 -# @License : Mulan PSL v2 -# @Desc : Test paragraph flow and styles -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量 - SCRIPT_NAME="test_python3-reportlab_function_paragraph" - PYTHON_PACKAGE="python3-reportlab" - LOG_FILE="/tmp/${SCRIPT_NAME}.log" - - # 初始化日志文件 - > "${LOG_FILE}" - - # 检查是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - if rpm -q ${PYTHON_PACKAGE} > /dev/null 2>&1; then - LOG_INFO "检测到python3-reportlab已安装" - INSTALLED_BEFORE="true" - else - LOG_INFO "检测到python3-reportlab未安装" - INSTALLED_BEFORE="false" - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-reportlab软件包" - if ! dnf list available ${PYTHON_PACKAGE} > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-reportlab软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "安装python3-reportlab软件包" - dnf install -y ${PYTHON_PACKAGE} - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 创建测试Python脚本 - LOG_INFO "创建测试Python脚本" - cat > /tmp/test_paragraph.py << "EOF" - #!/usr/bin/env python3 - from reportlab.lib.pagesizes import letter - from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer - from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle - from reportlab.lib.enums import TA_JUSTIFY, TA_CENTER, TA_LEFT, TA_RIGHT - from reportlab.lib.units import inch - import sys - - def test_paragraph_flow_and_styles(): - # 创建PDF文档 - doc = SimpleDocTemplate("/tmp/test_paragraph.pdf", pagesize=letter) - story = [] - styles = getSampleStyleSheet() - - # 测试不同的段落样式 - LOG_INFO "测试不同段落样式" - - # 1. 测试普通段落 - normal_text = "这是一个普通段落,测试文本流和基本样式。ReportLab是一个强大的PDF生成库。" - p1 = Paragraph(normal_text, styles["Normal"]) - story.append(p1) - story.append(Spacer(1, 12)) - - # 2. 测试标题样式 - title_text = "段落样式测试报告" - p2 = Paragraph(title_text, styles["Title"]) - story.append(p2) - story.append(Spacer(1, 12)) - - # 3. 测试居中对齐 - center_style = ParagraphStyle( - "CenterStyle", - parent=styles["Normal"], - alignment=TA_CENTER, - fontSize=12, - spaceAfter=12 - ) - center_text = "这是一个居中对齐的段落" - p3 = Paragraph(center_text, center_style) - story.append(p3) - story.append(Spacer(1, 12)) - - # 4. 测试右对齐 - right_style = ParagraphStyle( - "RightStyle", - parent=styles["Normal"], - alignment=TA_RIGHT, - fontSize=12, - spaceAfter=12 - ) - right_text = "这是一个右对齐的段落" - p4 = Paragraph(right_text, right_style) - story.append(p4) - story.append(Spacer(1, 12)) - - # 5. 测试两端对齐 - justify_style = ParagraphStyle( - "JustifyStyle", - parent=styles["Normal"], - alignment=TA_JUSTIFY, - fontSize=10, - firstLineIndent=20, - spaceAfter=12 - ) - justify_text = """这是一个两端对齐的段落,测试文本流和排版效果。 - ReportLab的Paragraph组件支持复杂的文本格式化,包括字体、颜色、对齐方式等。 - 这个段落应该显示为两端对齐,并且有首行缩进。""" - p5 = Paragraph(justify_text, justify_style) - story.append(p5) - story.append(Spacer(1, 12)) - - # 6. 测试带格式的文本 - formatted_text = """ - 粗体文本 斜体文本 下划线文本 - 红色文本 大号文本 -
- 这是一个包含多种格式的段落。 - """ - p6 = Paragraph(formatted_text, styles["Normal"]) - story.append(p6) - - # 构建PDF文档 - try: - doc.build(story) - print("SUCCESS: PDF文件生成成功") - return 0 - except Exception as e: - print(f"ERROR: PDF文件生成失败 - {str(e)}") - return 1 - - if __name__ == "__main__": - sys.exit(test_paragraph_flow_and_styles()) - EOF - - # 设置Python脚本执行权限 - chmod +x /tmp/test_paragraph.py - - # 执行测试脚本 - LOG_INFO "执行段落流和样式测试" - python3 /tmp/test_paragraph.py - CHECK_RESULT $? 0 0 "段落流和样式测试失败" - - # 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f "/tmp/test_paragraph.pdf" ]; then - LOG_INFO "PDF文件生成成功" - # 检查PDF文件大小 - PDF_SIZE=$(stat -c%s "/tmp/test_paragraph.pdf" 2>/dev/null || echo "0") - if [ "${PDF_SIZE}" -gt 1000 ]; then - LOG_INFO "PDF文件大小正常: ${PDF_SIZE} 字节" - else - LOG_ERROR "PDF文件大小异常: ${PDF_SIZE} 字节" - CHECK_RESULT 1 0 0 "PDF文件大小异常" - fi - else - LOG_ERROR "PDF文件未生成" - CHECK_RESULT 1 0 0 "PDF文件未生成" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test_paragraph.py /tmp/test_paragraph.pdf - - # 如果之前未安装,则卸载软件包 - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "卸载python3-reportlab软件包" - dnf remove -y ${PYTHON_PACKAGE} - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试完成:段落流和样式测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_pdfgen.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_pdfgen.sh deleted file mode 100644 index f80dcab00be..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_pdfgen.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 : 2025-12-03 -# @License : Mulan PSL v2 -# @Desc : Test PDF generation functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test PDF generation functionality" - - # 检查是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - dnf list installed python3-reportlab > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-reportlab已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-reportlab未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-reportlab - LOG_INFO "检查yum源中是否有python3-reportlab" - dnf list available python3-reportlab > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-reportlab,退出测试" - exit 255 - fi - - # 安装python3-reportlab - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python3-reportlab" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 测试PDF生成功能 - LOG_INFO "测试PDF生成功能" - python3 -c " - from reportlab.pdfgen import canvas - def create_pdf(): - c = canvas.Canvas("test.pdf") - c.drawString(100, 750, "Test PDF generation functionality") - c.save() - create_pdf() - " - CHECK_RESULT $? 0 0 "PDF生成功能测试失败" - - # 验证生成的PDF文件 - LOG_INFO "验证生成的PDF文件" - if [ -f "test.pdf" ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - # 清理生成的PDF文件 - LOG_INFO "清理生成的PDF文件" - rm -f test.pdf - - # 卸载python3-reportlab(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-reportlab" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试完成:Test PDF generation functionality" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_table.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_table.sh deleted file mode 100644 index 9a162f5c4e3..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_table.sh +++ /dev/null @@ -1,120 +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-08 -# @License : Mulan PSL v2 -# @Desc : Test table creation and styling -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:判断是否已安装python3-reportlab - LOG_INFO "检查是否已安装python3-reportlab" - if rpm -q python3-reportlab > /dev/null 2>&1; then - LOG_INFO "python3-reportlab已安装" - INSTALLED="true" - else - LOG_INFO "python3-reportlab未安装" - INSTALLED="false" - fi - - # 检查yum源中是否存在python3-reportlab软件包 - LOG_INFO "检查yum源中是否存在python3-reportlab软件包" - if ! dnf list available python3-reportlab > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-reportlab软件包" - exit 255 - fi - - # 如果未安装,则安装python3-reportlab - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装python3-reportlab" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - # 创建测试用的Python脚本 - LOG_INFO "创建测试用的Python脚本" - cat > test_table.py << "EOF" - from reportlab.lib import colors - from reportlab.lib.pagesizes import letter - from reportlab.platypus import SimpleDocTemplate, Table, TableStyle - from reportlab.lib.units import inch - - # 创建PDF文档 - doc = SimpleDocTemplate("test_table.pdf", pagesize=letter) - elements = [] - - # 定义表格数据 - data = [ - ["Header1", "Header2", "Header3"], - ["Row1 Col1", "Row1 Col2", "Row1 Col3"], - ["Row2 Col1", "Row2 Col2", "Row2 Col3"], - ["Row3 Col1", "Row3 Col2", "Row3 Col3"] - ] - - # 创建表格 - table = Table(data) - - # 设置表格样式 - style = TableStyle([ - ("BACKGROUND", (0, 0), (-1, 0), colors.grey), - ("TEXTCOLOR", (0, 0), (-1, 0), colors.whitesmoke), - ("ALIGN", (0, 0), (-1, -1), "CENTER"), - ("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"), - ("FONTSIZE", (0, 0), (-1, 0), 14), - ("BOTTOMPADDING", (0, 0), (-1, 0), 12), - ("BACKGROUND", (0, 1), (-1, -1), colors.beige), - ("GRID", (0, 0), (-1, -1), 1, colors.black) - ]) - table.setStyle(style) - - # 将表格添加到文档元素中 - elements.append(table) - - # 构建PDF文档 - doc.build(elements) - print("PDF生成成功:test_table.pdf") - EOF - - # 执行Python脚本生成PDF - LOG_INFO "执行Python脚本生成PDF" - python3 test_table.py - CHECK_RESULT $? 0 0 "执行Python脚本生成PDF失败" - - # 检查生成的PDF文件是否存在 - LOG_INFO "检查生成的PDF文件是否存在" - if [ -f "test_table.pdf" ]; then - LOG_INFO "PDF文件生成成功:test_table.pdf" - else - LOG_ERROR "PDF文件生成失败" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_table.py test_table.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装python3-reportlab,则卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-reportlab" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_text.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_text.sh deleted file mode 100644 index 0d3fc1951e3..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_text.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 : 2026-03-08 -# @License : Mulan PSL v2 -# @Desc : Test text drawing and formatting -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test text drawing and formatting" - - LOG_INFO "步骤1:检查环境是否已安装python3-reportlab软件包" - if rpm -q python3-reportlab &>/dev/null; then - LOG_INFO "python3-reportlab已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-reportlab未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有python3-reportlab软件包" - if ! dnf list available python3-reportlab &>/dev/null; then - LOG_ERROR "yum源中未找到python3-reportlab软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-reportlab软件包" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - fi - - LOG_INFO "步骤4:创建测试Python脚本,测试文本绘制和格式化功能" - cat > /tmp/test_text_drawing.py << "EOF" - from reportlab.lib.pagesizes import letter - from reportlab.pdfgen import canvas - from reportlab.lib.styles import getSampleStyleSheet - from reportlab.platypus import Paragraph - - def test_text_drawing(): - c = canvas.Canvas("/tmp/test_text_drawing.pdf", pagesize=letter) - width, height = letter - - # 测试简单文本绘制 - c.drawString(100, height - 100, "Hello, ReportLab!") - - # 测试格式化文本 - styles = getSampleStyleSheet() - style = styles["Normal"] - p = Paragraph("This is a formatted paragraph with different styles.", style) - p.wrapOn(c, 400, 100) - p.drawOn(c, 100, height - 200) - - c.save() - print("Text drawing and formatting test completed successfully") - - if __name__ == "__main__": - test_text_drawing() - EOF - - CHECK_RESULT $? 0 0 "创建测试Python脚本失败" - - LOG_INFO "步骤5:执行测试Python脚本" - python3 /tmp/test_text_drawing.py - CHECK_RESULT $? 0 0 "执行文本绘制和格式化测试失败" - - LOG_INFO "步骤6:验证生成的PDF文件" - if [ -f "/tmp/test_text_drawing.pdf" ]; then - LOG_INFO "PDF文件生成成功" - file /tmp/test_text_drawing.pdf | grep -q "PDF document" - CHECK_RESULT $? 0 0 "生成的PDF文件格式不正确" - else - LOG_ERROR "未找到生成的PDF文件" - exit 1 - fi - - LOG_INFO "步骤7:清理临时文件" - rm -f /tmp/test_text_drawing.py /tmp/test_text_drawing.pdf - CHECK_RESULT $? 0 0 "清理临时文件失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤8:卸载python3-reportlab软件包" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - LOG_INFO "测试完成:文本绘制和格式化功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_uninstall.sh b/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_uninstall.sh deleted file mode 100644 index e4d1f6ae17d..00000000000 --- a/testcases/function_test/pkg_test/python-reportlab/python3-reportlab/test_python3-reportlab_function_uninstall.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-08 -# @License : Mulan PSL v2 -# @Desc : Test package removal -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试环境初始化检查 - LOG_INFO "开始测试:Test package removal" - LOG_INFO "步骤1:检查python3-reportlab软件包在yum源中是否存在" - dnf list available python3-reportlab 2>/dev/null | grep -q python3-reportlab - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-reportlab软件包" - exit 255 - fi - - # 检查当前是否已安装python3-reportlab - LOG_INFO "步骤2:检查当前环境是否已安装python3-reportlab" - rpm -q python3-reportlab >/dev/null 2>&1 - is_installed=$? - - # 记录初始状态 - initial_state=$is_installed - - # 执行测试 - if [ $is_installed -eq 0 ]; then - LOG_INFO "步骤3:环境已安装python3-reportlab,执行卸载测试" - LOG_INFO "步骤4:卸载python3-reportlab软件包" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - - LOG_INFO "步骤5:验证软件包已卸载" - rpm -q python3-reportlab >/dev/null 2>&1 - CHECK_RESULT $? 1 0 "软件包卸载后仍可查询到" - - LOG_INFO "步骤6:重新安装python3-reportlab以恢复环境" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "重新安装python3-reportlab失败" - else - LOG_INFO "步骤3:环境未安装python3-reportlab,执行安装测试" - LOG_INFO "步骤4:安装python3-reportlab软件包" - dnf install -y python3-reportlab - CHECK_RESULT $? 0 0 "安装python3-reportlab失败" - - LOG_INFO "步骤5:验证软件包已安装" - rpm -q python3-reportlab >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "软件包安装后无法查询到" - - LOG_INFO "步骤6:卸载python3-reportlab软件包以恢复环境" - dnf remove -y python3-reportlab - CHECK_RESULT $? 0 0 "卸载python3-reportlab失败" - fi - - # 最终环境验证 - LOG_INFO "步骤7:验证环境已恢复到初始状态" - if [ $initial_state -eq 0 ]; then - rpm -q python3-reportlab >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "环境未恢复到已安装状态" - else - rpm -q python3-reportlab >/dev/null 2>&1 - CHECK_RESULT $? 1 0 "环境未恢复到未安装状态" - fi - - LOG_INFO "测试完成:Test package removal" -} - -main "$@" \ No newline at end of file From 1b255a7da8003fd75abe7a2b0df767f68929ee6e Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:41:26 +0800 Subject: [PATCH 13/18] update testcase for testsuite texlive-svg --- .../pkg_test/texlive-split-v/texlive-svg.json | 10 --- .../test_texlive-svg_function_render.sh | 74 ------------------- 2 files changed, 84 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-v/texlive-svg.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-svg/test_texlive-svg_function_render.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-svg.json b/suite2cases/function_test/pkg_test/texlive-split-v/texlive-svg.json deleted file mode 100644 index cd26f381700..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-svg.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-svg", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-svg_function_render", - "desc": "Test SVG rendering functionality" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-svg/test_texlive-svg_function_render.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-svg/test_texlive-svg_function_render.sh deleted file mode 100644 index 33603a801b3..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-svg/test_texlive-svg_function_render.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-11-26 -# @License : Mulan PSL v2 -# @Desc : Test SVG rendering functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:test_texlive-svg_function_render - # 测试用例描述:Test SVG rendering functionality - - LOG_INFO "开始测试SVG渲染功能" - - # 检查是否已安装texlive-svg - if dnf list installed texlive-svg &>/dev/null; then - LOG_INFO "texlive-svg已安装,测试后将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-svg未安装,将在测试后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-svg软件包 - LOG_INFO "检查yum源中是否存在texlive-svg软件包" - if ! dnf list available texlive-svg &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-svg软件包" - exit 255 - fi - - # 安装texlive-svg(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装texlive-svg" - dnf install -y texlive-svg - CHECK_RESULT $? 0 0 "安装texlive-svg失败" - fi - - # 测试SVG渲染功能 - LOG_INFO "测试SVG渲染功能" - svg_render_cmd="some_svg_render_command" # 替换为实际的SVG渲染命令 - if ! command -v "$svg_render_cmd" &>/dev/null; then - LOG_ERROR "命令$svg_render_cmd不存在或不支持" - exit 255 - fi - - # 执行SVG渲染命令并检查结果(示例) - LOG_INFO "执行SVG渲染命令" - $svg_render_cmd --test-param # 替换为实际参数 - CHECK_RESULT $? 0 0 "SVG渲染功能测试失败" - - # 清理环境(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-svg以恢复环境" - dnf remove -y texlive-svg - CHECK_RESULT $? 0 0 "卸载texlive-svg失败" - fi - - LOG_INFO "SVG渲染功能测试完成" -} - -main "$@" \ No newline at end of file From b059c103d4d54c26508d08fac2023ecf241d6e06 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:42:26 +0800 Subject: [PATCH 14/18] update testcase for testsuite texlive-epsf --- .../texlive-split-h/texlive-epsf.json | 20 --- .../test_texlive-epsf_function_basic.sh | 91 -------------- .../test_texlive-epsf_function_check.sh | 115 ------------------ .../test_texlive-epsf_function_rotation.sh | 106 ---------------- .../test_texlive-epsf_function_scaling.sh | 103 ---------------- .../test_texlive-epsf_function_uninstall.sh | 90 -------------- 6 files changed, 525 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_basic.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_check.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_rotation.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_scaling.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-h/texlive-epsf.json b/suite2cases/function_test/pkg_test/texlive-split-h/texlive-epsf.json index c287c29a160..9fdfce363c9 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-h/texlive-epsf.json +++ b/suite2cases/function_test/pkg_test/texlive-split-h/texlive-epsf.json @@ -5,26 +5,6 @@ { "name": "test_texlive-epsf_function_install", "desc": "Test the installation of texlive-epsf package" - }, - { - "name": "test_texlive-epsf_function_uninstall", - "desc": "Test the uninstallation of texlive-epsf package" - }, - { - "name": "test_texlive-epsf_function_check", - "desc": "Test checking if texlive-epsf is installed" - }, - { - "name": "test_texlive-epsf_function_basic", - "desc": "Test basic EPS file inclusion in LaTeX" - }, - { - "name": "test_texlive-epsf_function_scaling", - "desc": "Test scaling an EPS figure" - }, - { - "name": "test_texlive-epsf_function_rotation", - "desc": "Test rotating an EPS figure" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_basic.sh deleted file mode 100644 index e467edb2e17..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_basic.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-29 -# @License : Mulan PSL v2 -# @Desc : Test basic EPS file inclusion in LaTeX -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic EPS file inclusion in LaTeX" - LOG_INFO "步骤1:检查是否已安装 texlive-epsf 软件包" - if rpm -q texlive-epsf &> /dev/null; then - LOG_INFO "texlive-epsf 已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-epsf 未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有 texlive-epsf 软件包" - if ! dnf list texlive-epsf &> /dev/null; then - LOG_ERROR "yum源中未找到 texlive-epsf 软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装 texlive-epsf 软件包" - dnf install -y texlive-epsf - CHECK_RESULT $? 0 0 "安装 texlive-epsf 失败" - fi - - LOG_INFO "步骤4:创建一个测试EPS文件" - cat > test.eps << "EOF" - %!PS-Adobe-3.0 EPSF-3.0 - %%BoundingBox: 0 0 100 100 - newpath - 50 50 20 0 360 arc - stroke - showpage - EOF - CHECK_RESULT $? 0 0 "创建EPS文件失败" - - LOG_INFO "步骤5:创建一个测试LaTeX文件" - cat > test.tex << "EOF" - \documentclass{article} - \usepackage{epsf} - \begin{document} - \epsfbox{test.eps} - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建LaTeX文件失败" - - LOG_INFO "步骤6:使用latex命令编译LaTeX文件" - latex test.tex - CHECK_RESULT $? 0 0 "latex命令执行失败" - - LOG_INFO "步骤7:检查生成的DVI文件是否包含EPS图像" - if grep -q "test.eps" test.dvi; then - LOG_INFO "DVI文件成功包含EPS图像" - else - LOG_ERROR "DVI文件中未找到EPS图像" - exit 1 - fi - - LOG_INFO "步骤8:清理生成的测试文件" - rm -f test.eps test.tex test.dvi test.log test.aux - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载 texlive-epsf 软件包" - dnf remove -y texlive-epsf - CHECK_RESULT $? 0 0 "卸载 texlive-epsf 失败" - fi - - LOG_INFO "测试完成:Test basic EPS file inclusion in LaTeX" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_check.sh b/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_check.sh deleted file mode 100644 index 77a45e11847..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_check.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-29 -# @License : Mulan PSL v2 -# @Desc : Test checking if texlive-epsf is installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试texlive-epsf软件包功能检查 - LOG_INFO "开始测试texlive-epsf软件包功能检查" - - # 定义软件包名称 - PACKAGE_NAME="texlive-epsf" - - # 步骤1:检查yum源中是否存在该软件包 - LOG_INFO "步骤1:检查yum源中是否存在${PACKAGE_NAME}软件包" - if ! dnf list available ${PACKAGE_NAME} &>/dev/null; then - LOG_ERROR "yum源中不存在${PACKAGE_NAME}软件包" - exit 255 - fi - - # 步骤2:检查当前是否已安装该软件包 - LOG_INFO "步骤2:检查当前是否已安装${PACKAGE_NAME}软件包" - if rpm -q ${PACKAGE_NAME} &>/dev/null; then - INSTALLED_BEFORE="true" - LOG_INFO "检测到${PACKAGE_NAME}在测试前已安装" - else - INSTALLED_BEFORE="false" - LOG_INFO "检测到${PACKAGE_NAME}在测试前未安装" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 步骤4:验证软件包是否成功安装 - LOG_INFO "步骤4:验证${PACKAGE_NAME}软件包是否成功安装" - rpm -q ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "验证${PACKAGE_NAME}安装状态失败" - - # 步骤5:检查texlive-epsf相关命令是否存在 - LOG_INFO "步骤5:检查texlive-epsf相关命令" - # 查找texlive-epsf提供的文件 - EPSF_FILES=$(rpm -ql ${PACKAGE_NAME} 2>/dev/null | head -5) - if [ -z "${EPSF_FILES}" ]; then - LOG_ERROR "未找到${PACKAGE_NAME}提供的文件" - exit 255 - fi - LOG_INFO "找到${PACKAGE_NAME}提供的文件示例:$(echo ${EPSF_FILES} | tr "\n" " ")" - - # 步骤6:测试texlive-epsf基本功能 - LOG_INFO "步骤6:测试texlive-epsf基本功能" - # 检查是否有epsf.sty文件 - EPSF_STY_FILE=$(rpm -ql ${PACKAGE_NAME} | grep -E "epsf\.sty$" | head -1) - if [ -z "${EPSF_STY_FILE}" ]; then - LOG_ERROR "未找到epsf.sty文件" - exit 255 - fi - - LOG_INFO "找到epsf.sty文件:${EPSF_STY_FILE}" - - # 步骤7:验证epsf.sty文件内容 - LOG_INFO "步骤7:验证epsf.sty文件内容" - if [ -f "${EPSF_STY_FILE}" ]; then - # 检查文件是否包含EPSF相关定义 - if grep -q "epsf\|EPSF" "${EPSF_STY_FILE}" 2>/dev/null; then - LOG_INFO "epsf.sty文件内容正常" - else - LOG_ERROR "epsf.sty文件内容异常" - exit 255 - fi - else - LOG_ERROR "epsf.sty文件不存在" - exit 255 - fi - - # 步骤8:清理测试环境 - LOG_INFO "步骤8:清理测试环境" - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "卸载测试安装的${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - - # 验证是否成功卸载 - if rpm -q ${PACKAGE_NAME} &>/dev/null; then - LOG_ERROR "卸载${PACKAGE_NAME}失败,软件包仍存在" - exit 1 - else - LOG_INFO "成功卸载${PACKAGE_NAME}软件包" - fi - else - LOG_INFO "保持${PACKAGE_NAME}软件包的安装状态" - fi - - LOG_INFO "测试完成:texlive-epsf软件包功能检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_rotation.sh b/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_rotation.sh deleted file mode 100644 index 69c0168e4fe..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_rotation.sh +++ /dev/null @@ -1,106 +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-29 -# @License : Mulan PSL v2 -# @Desc : Test rotating an EPS figure -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:旋转EPS图形功能" - - # 检查是否已安装texlive-epsf - LOG_INFO "检查texlive-epsf是否已安装" - if dnf list installed texlive-epsf &>/dev/null; then - LOG_INFO "texlive-epsf已安装,测试完成后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-epsf未安装,将在测试前安装并在测试后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-epsf软件包 - LOG_INFO "检查yum源中是否有texlive-epsf软件包" - if ! dnf list available texlive-epsf &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-epsf软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-epsf - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装texlive-epsf" - dnf install -y texlive-epsf - CHECK_RESULT $? 0 0 "安装texlive-epsf失败" - fi - - # 创建测试EPS文件 - LOG_INFO "创建测试EPS文件" - cat > test_rotation.eps << "EOF" - %!PS-Adobe-3.0 EPSF-3.0 - %%BoundingBox: 0 0 100 100 - %%EndComments - newpath - 50 50 moveto - 30 0 rlineto - 0 30 rlineto - -30 0 rlineto - closepath - fill - showpage - EOF - CHECK_RESULT $? 0 0 "创建测试EPS文件失败" - - # 测试旋转EPS图形功能 - LOG_INFO "测试旋转EPS图形功能" - if ! epsffit -r 45 test_rotation.eps test_rotated.eps 2>/dev/null; then - LOG_ERROR "epsffit命令不支持旋转参数或参数错误" - # 清理测试文件 - rm -f test_rotation.eps test_rotated.eps - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-epsf" - dnf remove -y texlive-epsf - CHECK_RESULT $? 0 0 "卸载texlive-epsf失败" - fi - exit 255 - fi - CHECK_RESULT $? 0 0 "旋转EPS图形失败" - - # 验证旋转后的文件是否存在 - LOG_INFO "验证旋转后的EPS文件是否生成" - if [ -f test_rotated.eps ]; then - LOG_INFO "旋转后的EPS文件已成功生成" - else - LOG_ERROR "旋转后的EPS文件未生成" - CHECK_RESULT 1 0 0 "旋转后的EPS文件未生成" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_rotation.eps test_rotated.eps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-epsf" - dnf remove -y texlive-epsf - CHECK_RESULT $? 0 0 "卸载texlive-epsf失败" - fi - - LOG_INFO "测试完成:旋转EPS图形功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_scaling.sh b/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_scaling.sh deleted file mode 100644 index e0d1d278437..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_scaling.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 : 2026-03-29 -# @License : Mulan PSL v2 -# @Desc : Test scaling an EPS figure -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:缩放EPS图形功能" - - LOG_INFO "步骤1:检查texlive-epsf软件包是否已在yum源中" - if ! dnf list available texlive-epsf &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-epsf软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装texlive-epsf" - if rpm -q texlive-epsf &>/dev/null; then - INSTALLED=true - LOG_INFO "texlive-epsf已安装,测试结束后将保持安装状态" - else - INSTALLED=false - LOG_INFO "texlive-epsf未安装,将在测试过程中安装" - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装texlive-epsf软件包" - dnf install -y texlive-epsf - CHECK_RESULT $? 0 0 "安装texlive-epsf失败" - fi - - LOG_INFO "步骤4:创建测试EPS文件" - cat > test_figure.eps << "EOF" - %!PS-Adobe-2.0 EPSF-2.0 - %%BoundingBox: 0 0 100 100 - %%EndComments - 100 100 scale - 0 0 moveto - 100 0 lineto - 100 100 lineto - 0 100 lineto - closepath - stroke - showpage - EOF - CHECK_RESULT $? 0 0 "创建测试EPS文件失败" - - LOG_INFO "步骤5:创建测试LaTeX文档" - cat > test_scaling.tex << "EOF" - \documentclass{article} - \usepackage{epsf} - \begin{document} - Test scaling an EPS figure. - - \epsfbox{test_figure.eps} - \epsfbox[scale=0.5]{test_figure.eps} - \epsfbox[scale=2.0]{test_figure.eps} - - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - - LOG_INFO "步骤6:使用pdflatex处理LaTeX文档" - pdflatex -interaction=nonstopmode test_scaling.tex - CHECK_RESULT $? 0 0 "pdflatex处理失败" - - LOG_INFO "步骤7:检查生成的PDF文件" - if [ -f test_scaling.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - LOG_INFO "步骤8:清理测试文件" - rm -f test_figure.eps test_scaling.tex test_scaling.aux test_scaling.log test_scaling.pdf - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤9:卸载texlive-epsf软件包" - dnf remove -y texlive-epsf - CHECK_RESULT $? 0 0 "卸载texlive-epsf失败" - fi - - LOG_INFO "测试完成:缩放EPS图形功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_uninstall.sh deleted file mode 100644 index bc3bee8c5a1..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-h/texlive-epsf/test_texlive-epsf_function_uninstall.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-03-29 -# @License : Mulan PSL v2 -# @Desc : Test the uninstallation of texlive-epsf package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-epsf包 - LOG_INFO "检查texlive-epsf包是否已安装" - rpm -q texlive-epsf >/dev/null 2>&1 - INSTALLED=$? - - # 记录初始安装状态 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "检测到texlive-epsf已安装,测试结束后将保持安装状态" - INITIAL_INSTALLED=true - else - LOG_INFO "检测到texlive-epsf未安装,测试结束后将卸载该包" - INITIAL_INSTALLED=false - fi - - # 检查yum源中是否有texlive-epsf包 - LOG_INFO "检查yum源中是否有texlive-epsf包" - dnf list available texlive-epsf >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-epsf包" - exit 255 - fi - - # 如果未安装,则先安装 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "安装texlive-epsf包" - dnf install -y texlive-epsf - CHECK_RESULT $? 0 0 "安装texlive-epsf失败" - - # 验证安装 - LOG_INFO "验证texlive-epsf安装" - rpm -q texlive-epsf >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装后验证失败" - fi - - # 测试卸载功能 - LOG_INFO "测试卸载texlive-epsf包" - dnf remove -y texlive-epsf - CHECK_RESULT $? 0 0 "卸载texlive-epsf失败" - - # 验证卸载 - LOG_INFO "验证texlive-epsf已卸载" - rpm -q texlive-epsf >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "卸载后验证失败,包仍然存在" - exit 1 - fi - LOG_INFO "卸载验证成功" - - # 环境恢复 - LOG_INFO "恢复环境到初始状态" - if [ "$INITIAL_INSTALLED" = "true" ]; then - LOG_INFO "重新安装texlive-epsf包以恢复环境" - dnf install -y texlive-epsf - CHECK_RESULT $? 0 0 "环境恢复安装失败" - - # 验证恢复 - LOG_INFO "验证环境恢复" - rpm -q texlive-epsf >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "环境恢复验证失败" - LOG_INFO "环境恢复完成,texlive-epsf已重新安装" - else - LOG_INFO "初始状态未安装,无需恢复安装" - fi - - LOG_INFO "texlive-epsf卸载功能测试完成" -} - -main "$@" \ No newline at end of file From 8844ee62fce024b113a3d02535c55ddeebe58378 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:44:35 +0800 Subject: [PATCH 15/18] update testcase for testsuite nodejs-lodash-create --- .../pkg_test/lodash/nodejs-lodash-create.json | 16 --- ...est_nodejs-lodash-create_function_basic.sh | 114 ------------------ ...t_nodejs-lodash-create_function_require.sh | 71 ----------- ...nodejs-lodash-create_function_uninstall.sh | 86 ------------- ...t_nodejs-lodash-create_function_version.sh | 91 -------------- 5 files changed, 378 deletions(-) delete mode 100644 testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_basic.sh delete mode 100644 testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_require.sh delete mode 100644 testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_uninstall.sh delete mode 100644 testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_version.sh diff --git a/suite2cases/function_test/pkg_test/lodash/nodejs-lodash-create.json b/suite2cases/function_test/pkg_test/lodash/nodejs-lodash-create.json index 383aa77627f..7e5e6283b85 100644 --- a/suite2cases/function_test/pkg_test/lodash/nodejs-lodash-create.json +++ b/suite2cases/function_test/pkg_test/lodash/nodejs-lodash-create.json @@ -5,22 +5,6 @@ { "name": "test_nodejs-lodash-create_function_install", "desc": "测试 nodejs-lodash-create 软件包能否通过系统包管理器成功安装" - }, - { - "name": "test_nodejs-lodash-create_function_version", - "desc": "测试 nodejs-lodash-create 软件包安装后能查询到正确的版本信息" - }, - { - "name": "test_nodejs-lodash-create_function_require", - "desc": "测试在Node.js环境中能够成功require lodash.create模块" - }, - { - "name": "test_nodejs-lodash-create_function_basic", - "desc": "测试 lodash.create 函数的基本功能,即使用指定原型创建对象" - }, - { - "name": "test_nodejs-lodash-create_function_uninstall", - "desc": "测试 nodejs-lodash-create 软件包能够通过系统包管理器成功卸载" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_basic.sh b/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_basic.sh deleted file mode 100644 index f65fcd3e654..00000000000 --- a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_basic.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : 测试 lodash.create 函数的基本功能,即使用指定原型创建对象 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="nodejs-lodash" - TEST_FUNCTION="lodash.create" - - # 步骤1:检查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 - - # 步骤2:检查当前环境是否已安装软件包 - LOG_INFO "检查 $PACKAGE_NAME 是否已安装" - IS_INSTALLED=0 - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME 已安装" - IS_INSTALLED=1 - else - LOG_INFO "$PACKAGE_NAME 未安装" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ $IS_INSTALLED -eq 0 ]; then - LOG_INFO "安装 $PACKAGE_NAME 软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - # 步骤4:验证 lodash.create 函数基本功能 - LOG_INFO "测试 lodash.create 函数的基本功能:使用指定原型创建对象" - - # 创建测试Node.js脚本 - cat > test_lodash_create.js << "EOF" - const _ = require("lodash"); - - // 定义原型对象 - function Person(name) { - this.name = name; - } - Person.prototype.greet = function() { - return "Hello, " + this.name; - }; - - // 使用 lodash.create 创建对象 - const personPrototype = new Person("Prototype"); - const newPerson = _.create(personPrototype, { - "name": "Alice" - }); - - // 验证新对象是否继承了原型的方法 - const hasGreet = typeof newPerson.greet === "function"; - const greetResult = newPerson.greet(); - const nameValue = newPerson.name; - - console.log("hasGreet:" + hasGreet); - console.log("greetResult:" + greetResult); - console.log("nameValue:" + nameValue); - - // 验证结果 - if (hasGreet && greetResult === "Hello, Alice" && nameValue === "Alice") { - console.log("TEST_PASS"); - process.exit(0); - } else { - console.log("TEST_FAIL"); - process.exit(1); - } - EOF - - # 执行测试脚本 - LOG_INFO "执行Node.js测试脚本" - node test_lodash_create.js - CHECK_RESULT $? 0 0 "lodash.create 函数基本功能测试失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_lodash_create.js - - # 步骤5:环境恢复 - if [ $IS_INSTALLED -eq 0 ]; then - LOG_INFO "卸载 $PACKAGE_NAME 软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - else - LOG_INFO "保持 $PACKAGE_NAME 已安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_require.sh b/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_require.sh deleted file mode 100644 index eb54c2fd57a..00000000000 --- a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_require.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-20 -# @License : Mulan PSL v2 -# @Desc : 测试在Node.js环境中能够成功require lodash.create模块 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试Node.js环境中require lodash.create模块" - LOG_INFO "检查yum源中是否存在nodejs-lodash-create包" - if ! dnf list available nodejs-lodash-create &>/dev/null; then - LOG_ERROR "yum源中未找到nodejs-lodash-create包" - exit 255 - fi - - LOG_INFO "检查当前是否已安装nodejs-lodash-create" - if rpm -q nodejs-lodash-create &>/dev/null; then - LOG_INFO "nodejs-lodash-create已安装,脚本结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "nodejs-lodash-create未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装nodejs-lodash-create包" - dnf install -y nodejs-lodash-create - CHECK_RESULT $? 0 0 "安装nodejs-lodash-create失败" - fi - - LOG_INFO "测试Node.js环境中require lodash.create模块" - cat > test_lodash_create.js << "EOF" - const create = require("lodash.create"); - if (typeof create === "function") { - console.log("SUCCESS: lodash.create模块加载成功"); - } else { - console.error("FAIL: lodash.create模块加载失败"); - process.exit(1); - } - EOF - - node test_lodash_create.js - CHECK_RESULT $? 0 0 "Node.js环境中require lodash.create模块失败" - - LOG_INFO "清理临时测试文件" - rm -f test_lodash_create.js - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载nodejs-lodash-create包" - dnf remove -y nodejs-lodash-create - CHECK_RESULT $? 0 0 "卸载nodejs-lodash-create失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_uninstall.sh b/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_uninstall.sh deleted file mode 100644 index f542a1633ef..00000000000 --- a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_uninstall.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : 测试 nodejs-lodash-create 软件包能够通过系统包管理器成功卸载 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:测试 nodejs-lodash-create 软件包能够通过系统包管理器成功卸载 - - LOG_INFO "开始测试:测试 nodejs-lodash-create 软件包能够通过系统包管理器成功卸载" - - # 定义软件包名称 - PACKAGE_NAME="nodejs-lodash-create" - - # 步骤1:检查yum源中是否存在该软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &> /dev/null - CHECK_RESULT $? 0 0 "yum源中未找到软件包 $PACKAGE_NAME" - - # 步骤2:检查当前环境是否已安装该软件包 - LOG_INFO "步骤2:检查当前环境是否已安装软件包 $PACKAGE_NAME" - rpm -q $PACKAGE_NAME &> /dev/null - INSTALLED=$? - - # 根据安装状态决定测试逻辑 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,将直接测试卸载功能" - INSTALL_BEFORE_TEST=0 - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将先安装再测试卸载功能" - INSTALL_BEFORE_TEST=1 - fi - - # 步骤3:如果未安装,则先安装软件包 - if [ $INSTALL_BEFORE_TEST -eq 1 ]; then - LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - 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 &> /dev/null - CHECK_RESULT $? 1 0 "软件包 $PACKAGE_NAME 卸载后仍然存在" - - # 步骤7:环境恢复 - LOG_INFO "步骤7:环境恢复" - if [ $INSTALL_BEFORE_TEST -eq 1 ]; then - # 测试前未安装,测试后保持未安装状态 - LOG_INFO "测试前未安装,测试后保持未安装状态" - else - # 测试前已安装,重新安装以恢复环境 - LOG_INFO "测试前已安装,重新安装以恢复环境" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "重新安装软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成:nodejs-lodash-create 软件包能够通过系统包管理器成功卸载" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_version.sh b/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_version.sh deleted file mode 100644 index 8cbba50bb4b..00000000000 --- a/testcases/function_test/pkg_test/lodash/nodejs-lodash-create/test_nodejs-lodash-create_function_version.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : 测试 nodejs-lodash-create 软件包安装后能查询到正确的版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装nodejs-lodash-create - LOG_INFO "检查nodejs-lodash-create是否已安装" - rpm -q nodejs-lodash-create > /dev/null 2>&1 - INSTALLED=$? - - # 记录初始状态 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "nodejs-lodash-create已安装,测试完成后保持安装状态" - KEEP_INSTALLED=true - else - LOG_INFO "nodejs-lodash-create未安装,测试完成后将卸载" - KEEP_INSTALLED=false - fi - - # 检查yum源中是否存在该软件包 - LOG_INFO "检查yum源中是否存在nodejs-lodash-create软件包" - dnf list available nodejs-lodash-create > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中不存在nodejs-lodash-create软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在nodejs-lodash-create软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "安装nodejs-lodash-create软件包" - dnf install -y nodejs-lodash-create - CHECK_RESULT $? 0 0 "安装nodejs-lodash-create失败" - fi - - # 检查nodejs-lodash-create命令是否可用 - LOG_INFO "检查nodejs-lodash-create命令是否可用" - which nodejs-lodash-create > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "nodejs-lodash-create命令不可用" - - # 测试查询版本信息 - LOG_INFO "测试查询nodejs-lodash-create版本信息" - nodejs-lodash-create --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "查询版本信息失败" - - # 获取版本信息并验证格式 - LOG_INFO "验证版本信息格式" - VERSION=$(nodejs-lodash-create --version 2>/dev/null) - if [ -z "$VERSION" ]; then - LOG_ERROR "获取的版本信息为空" - exit 1 - fi - - # 版本号应该符合语义化版本格式(如x.y.z) - if echo "$VERSION" | grep -qE "^[0-9]+\.[0-9]+\.[0-9]+"; then - LOG_INFO "版本信息格式正确: $VERSION" - else - LOG_ERROR "版本信息格式不正确: $VERSION" - exit 1 - fi - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$KEEP_INSTALLED" = "false" ]; then - LOG_INFO "卸载nodejs-lodash-create软件包" - dnf remove -y nodejs-lodash-create - CHECK_RESULT $? 0 0 "卸载nodejs-lodash-create失败" - else - LOG_INFO "保持nodejs-lodash-create安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 26efee7e1856453d22d549be411f63a879d26796 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:48:37 +0800 Subject: [PATCH 16/18] update testcase for testsuite texlive-scrjrnl-doc --- .../texlive-split-u/texlive-scrjrnl-doc.json | 4 - ..._texlive-scrjrnl-doc_function_use_guide.sh | 79 ------------------- 2 files changed, 83 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc/test_texlive-scrjrnl-doc_function_use_guide.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc.json b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc.json index b72b3892708..079a7187518 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc.json @@ -13,10 +13,6 @@ { "name": "test_texlive-scrjrnl-doc_function_verify_files", "desc": "Verify essential documentation files exist" - }, - { - "name": "test_texlive-scrjrnl-doc_function_use_guide", - "desc": "Test accessing the package user guide" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc/test_texlive-scrjrnl-doc_function_use_guide.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc/test_texlive-scrjrnl-doc_function_use_guide.sh deleted file mode 100644 index f9801187acd..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-scrjrnl-doc/test_texlive-scrjrnl-doc_function_use_guide.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-03 -# @License : Mulan PSL v2 -# @Desc : Test accessing the package user guide -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:访问texlive-scrjrnl-doc软件包的用户指南" - - LOG_INFO "步骤1:检查texlive-scrjrnl-doc软件包是否已在系统中安装" - if dnf list installed texlive-scrjrnl-doc &>/dev/null; then - LOG_INFO "texlive-scrjrnl-doc已安装,将在测试后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "texlive-scrjrnl-doc未安装,将在测试后卸载" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在texlive-scrjrnl-doc软件包" - if ! dnf list available texlive-scrjrnl-doc &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-scrjrnl-doc软件包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装texlive-scrjrnl-doc软件包" - dnf install -y texlive-scrjrnl-doc - CHECK_RESULT $? 0 0 "安装texlive-scrjrnl-doc软件包失败" - fi - - LOG_INFO "步骤4:检查texlive-scrjrnl-doc软件包是否包含用户指南文档" - GUIDE_PATH=$(rpm -ql texlive-scrjrnl-doc | grep -i guide | head -1) - if [ -z "$GUIDE_PATH" ]; then - LOG_ERROR "未找到texlive-scrjrnl-doc的用户指南文档" - exit 255 - fi - - LOG_INFO "步骤5:验证用户指南文档可访问" - if [ ! -f "$GUIDE_PATH" ]; then - LOG_ERROR "用户指南文档文件不存在:$GUIDE_PATH" - exit 255 - fi - - LOG_INFO "步骤6:尝试读取用户指南文档" - head -20 "$GUIDE_PATH" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "读取用户指南文档失败" - - LOG_INFO "步骤7:测试使用相关命令访问文档" - if command -v texdoc &>/dev/null; then - LOG_INFO "使用texdoc命令访问文档" - texdoc scrjrnl 2>&1 | head -5 - CHECK_RESULT $? 0 0 "texdoc命令执行失败" - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤8:卸载texlive-scrjrnl-doc软件包" - dnf remove -y texlive-scrjrnl-doc - CHECK_RESULT $? 0 0 "卸载texlive-scrjrnl-doc软件包失败" - fi - - LOG_INFO "测试完成:成功访问texlive-scrjrnl-doc软件包的用户指南" -} - -main "$@" \ No newline at end of file From 2e321ad0cf23808c0d20b861459fd7a95b5cdf2c Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:48:59 +0800 Subject: [PATCH 17/18] update testcase for testsuite clevis-dracut --- .../pkg_test/clevis/clevis-dracut.json | 16 --- ...test_clevis-dracut_function_boot_unlock.sh | 116 ----------------- .../test_clevis-dracut_function_install.sh | 79 ------------ ...est_clevis-dracut_function_manual_regen.sh | 82 ------------ .../test_clevis-dracut_function_presence.sh | 117 ------------------ 5 files changed, 410 deletions(-) delete mode 100644 testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_boot_unlock.sh delete mode 100644 testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_install.sh delete mode 100644 testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_manual_regen.sh delete mode 100644 testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_presence.sh diff --git a/suite2cases/function_test/pkg_test/clevis/clevis-dracut.json b/suite2cases/function_test/pkg_test/clevis/clevis-dracut.json index b532a5da99d..f9842c8a26c 100644 --- a/suite2cases/function_test/pkg_test/clevis/clevis-dracut.json +++ b/suite2cases/function_test/pkg_test/clevis/clevis-dracut.json @@ -9,22 +9,6 @@ { "name": "test_clevis-dracut_function_config", "desc": "Test configuration" - }, - { - "name": "test_clevis-dracut_function_install", - "desc": "Test package installation" - }, - { - "name": "test_clevis-dracut_function_presence", - "desc": "Test if package is present in dracut" - }, - { - "name": "test_clevis-dracut_function_manual_regen", - "desc": "Test manual dracut regeneration with clevis" - }, - { - "name": "test_clevis-dracut_function_boot_unlock", - "desc": "Test boot-time unlocking simulation" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_boot_unlock.sh b/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_boot_unlock.sh deleted file mode 100644 index d7b377f22e9..00000000000 --- a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_boot_unlock.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-27 -# @License : Mulan PSL v2 -# @Desc : Test boot-time unlocking simulation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色和日志函数 - LOG_INFO() { - echo "[INFO] $1" - } - - LOG_ERROR() { - echo "[ERROR] $1" - } - - # 定义检查软件包是否存在的函数 - check_package_exist() { - local package_name=$1 - if ! dnf list installed "$package_name" &>/dev/null; then - if ! dnf list available "$package_name" &>/dev/null; then - LOG_ERROR "软件包 $package_name 在yum源中不存在" - exit 255 - fi - fi - } - - # 定义检查命令参数是否支持的函数 - check_command_option() { - local cmd=$1 - local option=$2 - if ! $cmd --help 2>&1 | grep -q "$option"; then - LOG_ERROR "命令 $cmd 不支持参数 $option" - exit 255 - fi - } - - # 定义环境清理函数 - cleanup() { - LOG_INFO "开始清理环境" - if [ "$originally_installed" = "false" ]; then - LOG_INFO "卸载在测试中安装的软件包" - dnf remove -y clevis-dracut &>/dev/null - CHECK_RESULT $? 0 0 "卸载 clevis-dracut 失败" - LOG_INFO "清理完成" - else - LOG_INFO "环境已安装,无需清理" - fi - } - - # 设置退出时自动清理 - trap cleanup EXIT - - # 记录环境初始状态 - LOG_INFO "检查环境是否已安装 clevis-dracut" - if dnf list installed clevis-dracut &>/dev/null; then - originally_installed=true - LOG_INFO "环境已安装 clevis-dracut" - else - originally_installed=false - LOG_INFO "环境未安装 clevis-dracut" - fi - - # 检查软件包是否存在 - LOG_INFO "检查 yum 源中是否有 clevis-dracut 软件包" - check_package_exist "clevis-dracut" - - # 如果环境未安装,则安装软件包 - if [ "$originally_installed" = "false" ]; then - LOG_INFO "安装 clevis-dracut 软件包" - dnf install -y clevis-dracut &>/dev/null - CHECK_RESULT $? 0 0 "安装 clevis-dracut 失败" - LOG_INFO "clevis-dracut 安装成功" - fi - - # 检查 dracut 命令是否支持 --add 参数 - LOG_INFO "检查 dracut 命令是否支持 --add 参数" - check_command_option "dracut" "--add" - - # 模拟启动时解锁测试 - LOG_INFO "开始模拟启动时解锁测试" - LOG_INFO "使用 dracut 添加 clevis 模块" - dracut --add clevis --force &>/dev/null - CHECK_RESULT $? 0 0 "dracut 添加 clevis 模块失败" - LOG_INFO "dracut 添加 clevis 模块成功" - - LOG_INFO "检查生成的 initramfs 是否包含 clevis 模块" - lsinitrd /boot/initramfs-$(uname -r).img | grep -q clevis - CHECK_RESULT $? 0 0 "initramfs 中未找到 clevis 模块" - LOG_INFO "initramfs 中包含 clevis 模块" - - LOG_INFO "模拟启动时解锁测试完成" - - # 清理临时生成的文件 - LOG_INFO "清理临时生成的文件" - rm -f /boot/initramfs-*.img.old &>/dev/null - CHECK_RESULT $? 0 0 "清理临时文件失败" - LOG_INFO "临时文件清理完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_install.sh b/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_install.sh deleted file mode 100644 index c1e555b4536..00000000000 --- a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_install.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-27 -# @License : Mulan PSL v2 -# @Desc : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test package installation" - LOG_INFO "步骤1: 检查环境是否已安装clevis-dracut软件包" - if rpm -q clevis-dracut &> /dev/null; then - LOG_INFO "clevis-dracut已安装,保持安装状态" - INSTALLED=1 - else - LOG_INFO "clevis-dracut未安装,将在测试步骤中安装" - INSTALLED=0 - fi - - LOG_INFO "步骤2: 检查yum源中是否有clevis-dracut软件包" - dnf list available clevis-dracut &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到clevis-dracut软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装clevis-dracut软件包" - dnf install -y clevis-dracut - CHECK_RESULT $? 0 0 "安装clevis-dracut失败" - fi - - LOG_INFO "步骤4: 验证clevis-dracut命令基本功能" - clevis --help &> /dev/null - CHECK_RESULT $? 0 0 "clevis命令执行失败" - - LOG_INFO "步骤5: 测试clevis encrypt命令参数检查" - clevis encrypt &> /dev/null - if [ $? -eq 255 ]; then - LOG_INFO "参数检查正常:缺少必要参数时返回255" - else - LOG_ERROR "参数检查异常:缺少参数时未返回255" - exit 255 - fi - - LOG_INFO "步骤6: 测试clevis decrypt命令参数检查" - clevis decrypt &> /dev/null - if [ $? -eq 255 ]; then - LOG_INFO "参数检查正常:缺少必要参数时返回255" - else - LOG_ERROR "参数检查异常:缺少参数时未返回255" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤7: 清理环境 - 卸载测试安装的软件包" - dnf remove -y clevis-dracut - CHECK_RESULT $? 0 0 "卸载clevis-dracut失败" - else - LOG_INFO "步骤7: 保持原有安装状态,无需卸载" - fi - - LOG_INFO "测试完成:Test package installation" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_manual_regen.sh b/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_manual_regen.sh deleted file mode 100644 index 2d8038673aa..00000000000 --- a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_manual_regen.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 : Test manual dracut regeneration with clevis -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test manual dracut regeneration with clevis" - LOG_INFO "步骤1:检查环境是否已安装 clevis-dracut 软件包" - if dnf list installed clevis-dracut &>/dev/null; then - LOG_INFO "clevis-dracut 已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "clevis-dracut 未安装,将在测试步骤中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有 clevis-dracut 软件包" - if ! dnf list available clevis-dracut &>/dev/null; then - LOG_ERROR "yum源中未找到 clevis-dracut 软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装 clevis-dracut 软件包" - dnf install -y clevis-dracut - CHECK_RESULT $? 0 0 "安装 clevis-dracut 失败" - fi - - LOG_INFO "步骤4:检查 dracut 命令是否支持 --regenerate-all 参数" - if ! dracut --help 2>&1 | grep -q "\-\-regenerate-all"; then - LOG_ERROR "dracut 命令不支持 --regenerate-all 参数" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载 clevis-dracut 软件包" - dnf remove -y clevis-dracut - fi - exit 255 - fi - - LOG_INFO "步骤5:执行手动 dracut 重新生成" - dracut --regenerate-all -f - CHECK_RESULT $? 0 0 "手动 dracut 重新生成失败" - - LOG_INFO "步骤6:检查 dracut 生成的新 initramfs 文件" - if ls /boot/initramfs-*.img &>/dev/null; then - LOG_INFO "initramfs 文件存在" - else - LOG_ERROR "未找到 initramfs 文件" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载 clevis-dracut 软件包" - dnf remove -y clevis-dracut - fi - exit 1 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤7:清理环境,卸载 clevis-dracut 软件包" - dnf remove -y clevis-dracut - CHECK_RESULT $? 0 0 "卸载 clevis-dracut 失败" - else - LOG_INFO "步骤7:环境已安装 clevis-dracut,保持安装状态" - fi - - LOG_INFO "测试完成:Test manual dracut regeneration with clevis" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_presence.sh b/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_presence.sh deleted file mode 100644 index 8e99b4b2ad6..00000000000 --- a/testcases/function_test/pkg_test/clevis/clevis-dracut/test_clevis-dracut_function_presence.sh +++ /dev/null @@ -1,117 +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 if package is present in dracut -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试环境初始化 - LOG_INFO "开始测试:检查clevis-dracut软件包是否在dracut中" - - # 定义软件包名称 - PACKAGE_NAME="clevis-dracut" - - # 步骤1:检查yum源中是否存在该软件包 - LOG_INFO "步骤1:检查yum源中是否存在$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在$PACKAGE_NAME软件包" - exit 255 - fi - - # 步骤2:检查当前环境是否已安装该软件包 - LOG_INFO "步骤2:检查当前环境是否已安装$PACKAGE_NAME软件包" - rpm -q $PACKAGE_NAME &>/dev/null - INSTALLED=$? - - # 记录初始安装状态 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "检测到$PACKAGE_NAME已安装,测试完成后将保持安装状态" - INITIAL_INSTALLED=true - else - LOG_INFO "检测到$PACKAGE_NAME未安装,测试完成后将卸载软件包" - INITIAL_INSTALLED=false - fi - - # 步骤3:安装软件包(如果未安装) - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "步骤3:安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败" - fi - - # 步骤4:检查dracut命令是否支持--list-modules参数 - LOG_INFO "步骤4:检查dracut命令是否支持--list-modules参数" - dracut --help 2>&1 | grep -q "\-\-list-modules" - if [ $? -ne 0 ]; then - LOG_ERROR "dracut命令不支持--list-modules参数" - # 如果之前未安装,需要卸载软件包 - if [ "$INITIAL_INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME &>/dev/null - fi - exit 255 - fi - - # 步骤5:检查软件包是否在dracut模块列表中 - LOG_INFO "步骤5:检查$PACKAGE_NAME是否在dracut模块列表中" - dracut --list-modules 2>/dev/null | grep -q "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "$PACKAGE_NAME不在dracut模块列表中" - - # 步骤6:验证模块文件是否存在 - LOG_INFO "步骤6:验证$PACKAGE_NAME模块文件是否存在" - MODULE_PATH="/usr/lib/dracut/modules.d/90$PACKAGE_NAME" - if [ -d "$MODULE_PATH" ]; then - LOG_INFO "找到$PACKAGE_NAME模块目录:$MODULE_PATH" - CHECK_RESULT 0 0 0 "$PACKAGE_NAME模块目录不存在" - else - LOG_ERROR "$PACKAGE_NAME模块目录不存在:$MODULE_PATH" - CHECK_RESULT 1 0 0 "$PACKAGE_NAME模块目录不存在" - fi - - # 步骤7:检查模块是否包含必要的脚本文件 - LOG_INFO "步骤7:检查$PACKAGE_NAME模块是否包含必要的脚本文件" - REQUIRED_FILES=("module-setup.sh" "parse-$PACKAGE_NAME.sh") - for file in "${REQUIRED_FILES[@]}"; do - if [ -f "$MODULE_PATH/$file" ]; then - LOG_INFO "找到$PACKAGE_NAME模块文件:$file" - else - LOG_ERROR "$PACKAGE_NAME模块缺少必要文件:$file" - CHECK_RESULT 1 0 0 "$PACKAGE_NAME模块文件不完整" - fi - done - - # 步骤8:测试dracut重新生成initramfs(不实际执行,只检查命令) - LOG_INFO "步骤8:测试dracut重新生成initramfs(检查模式)" - dracut --no-hostonly --force --dry-run 2>&1 | grep -q "90$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "dracut生成initramfs时未包含$PACKAGE_NAME模块" - - # 步骤9:环境清理 - LOG_INFO "步骤9:清理测试环境" - if [ "$INITIAL_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软件包在dracut中正常存在" -} - -main "$@" \ No newline at end of file From 701d2ef2f003e9ec25bd4241428d0177d9ee3906 Mon Sep 17 00:00:00 2001 From: honghua Date: Thu, 23 Apr 2026 21:50:36 +0800 Subject: [PATCH 18/18] update testcase for testsuite texlive-smartunits --- .../texlive-split-v/texlive-smartunits.json | 10 --- ...t_texlive-smartunits_function_uninstall.sh | 63 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-v/texlive-smartunits.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-v/texlive-smartunits/test_texlive-smartunits_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-smartunits.json b/suite2cases/function_test/pkg_test/texlive-split-v/texlive-smartunits.json deleted file mode 100644 index da58b5f56b4..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-smartunits.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-smartunits", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-smartunits_function_uninstall", - "desc": "Test package uninstallation" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-smartunits/test_texlive-smartunits_function_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-smartunits/test_texlive-smartunits_function_uninstall.sh deleted file mode 100644 index 6d1b3c7a85f..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-smartunits/test_texlive-smartunits_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() { - LOG_INFO "开始测试软件包卸载功能" - - # 检查是否已安装texlive-smartunits - LOG_INFO "检查是否已安装texlive-smartunits" - dnf list installed texlive-smartunits > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-smartunits已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-smartunits未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-smartunits - LOG_INFO "检查yum源中是否有texlive-smartunits" - dnf list available texlive-smartunits > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-smartunits软件包" - - # 安装texlive-smartunits - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装texlive-smartunits" - dnf install -y texlive-smartunits - CHECK_RESULT $? 0 0 "安装texlive-smartunits失败" - fi - - # 测试卸载功能 - LOG_INFO "测试卸载texlive-smartunits" - dnf remove -y texlive-smartunits - CHECK_RESULT $? 0 0 "卸载texlive-smartunits失败" - - # 恢复环境:如果测试前未安装,则重新安装 - if [ "$INSTALLED" = false ]; then - LOG_INFO "恢复环境:重新安装texlive-smartunits" - dnf install -y texlive-smartunits - CHECK_RESULT $? 0 0 "恢复安装texlive-smartunits失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file