From 4754bdd132bbf062ac0f24417e592d4e61832b81 Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 14:44:48 +0800 Subject: [PATCH 1/9] update testcase for testsuite texlive-bidipagegrid --- .../texlive-split-c/texlive-bidipagegrid.json | 16 --- ...est_texlive-bidipagegrid_function_check.sh | 103 ------------------ ...t_texlive-bidipagegrid_function_install.sh | 57 ---------- ...est_texlive-bidipagegrid_function_usage.sh | 80 -------------- ...t_texlive-bidipagegrid_function_version.sh | 82 -------------- 5 files changed, 338 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_check.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_version.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid.json b/suite2cases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid.json index 06ab30c0c2f..54e091d72d7 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid.json +++ b/suite2cases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid.json @@ -2,25 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid", "machine num": 1, "cases": [ - { - "name": "test_texlive-bidipagegrid_function_install", - "desc": "Test package installation" - }, { "name": "test_texlive-bidipagegrid_function_remove", "desc": "Test package removal" - }, - { - "name": "test_texlive-bidipagegrid_function_check", - "desc": "Check if package is installed" - }, - { - "name": "test_texlive-bidipagegrid_function_usage", - "desc": "Test basic LaTeX document compilation with the package" - }, - { - "name": "test_texlive-bidipagegrid_function_version", - "desc": "Check package version information" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_check.sh b/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_check.sh deleted file mode 100644 index e5bb8ce10e6..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_check.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-18 -# @License : Mulan PSL v2 -# @Desc : Check if package is installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查软件包是否安装的测试脚本 - - # 定义全局变量 - PACKAGE_NAME="texlive-bidipagegrid" - LOG_INFO "开始测试: 检查 $PACKAGE_NAME 软件包是否安装" - - # 步骤1: 检查yum源中是否存在该软件包 - LOG_INFO "步骤1: 检查yum源中是否存在 $PACKAGE_NAME 软件包" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在 $PACKAGE_NAME 软件包" - exit 255 - fi - LOG_INFO "yum源中存在 $PACKAGE_NAME 软件包" - - # 步骤2: 检查当前是否已安装该软件包 - LOG_INFO "步骤2: 检查当前是否已安装 $PACKAGE_NAME 软件包" - IS_INSTALLED=0 - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME 软件包已安装" - IS_INSTALLED=1 - else - LOG_INFO "$PACKAGE_NAME 软件包未安装" - IS_INSTALLED=0 - fi - - # 步骤3: 如果未安装,则安装软件包作为测试步骤 - if [ $IS_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: 验证软件包已正确安装 - LOG_INFO "步骤4: 验证 $PACKAGE_NAME 软件包已正确安装" - rpm -q $PACKAGE_NAME - CHECK_RESULT $? 0 0 "$PACKAGE_NAME 软件包未正确安装" - - # 步骤5: 检查软件包的基本信息 - LOG_INFO "步骤5: 检查 $PACKAGE_NAME 软件包的基本信息" - rpm -qi $PACKAGE_NAME | grep -q "Name" - CHECK_RESULT $? 0 0 "获取 $PACKAGE_NAME 软件包信息失败" - - # 步骤6: 检查软件包包含的文件 - LOG_INFO "步骤6: 检查 $PACKAGE_NAME 软件包包含的文件" - rpm -ql $PACKAGE_NAME | head -5 > /dev/null - CHECK_RESULT $? 0 0 "获取 $PACKAGE_NAME 软件包文件列表失败" - - # 步骤7: 清理环境 - LOG_INFO "步骤7: 清理测试环境" - if [ $IS_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 "最终验证: 检查环境状态" - if [ $IS_INSTALLED -eq 0 ]; then - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "$PACKAGE_NAME 软件包未正确卸载" - exit 1 - else - LOG_INFO "环境已恢复到测试前的状态" - fi - else - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "$PACKAGE_NAME 软件包安装状态异常" - LOG_INFO "环境保持原有的 $PACKAGE_NAME 软件包安装状态" - fi - - LOG_INFO "测试完成: $PACKAGE_NAME 软件包安装检查测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_install.sh b/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_install.sh deleted file mode 100644 index 805de65f15d..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_install.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 texlive-bidipagegrid 功能安装包" - - # 检查软件包是否在yum源中 - LOG_INFO "检查 texlive-bidipagegrid 是否在yum源中" - dnf list available texlive-bidipagegrid > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "texlive-bidipagegrid 不在yum源中" - - # 检查是否已安装 - LOG_INFO "检查 texlive-bidipagegrid 是否已安装" - if rpm -q texlive-bidipagegrid > /dev/null 2>&1; then - LOG_INFO "texlive-bidipagegrid 已安装,跳过安装步骤" - installed=true - else - LOG_INFO "texlive-bidipagegrid 未安装,开始安装" - dnf install -y texlive-bidipagegrid - CHECK_RESULT $? 0 0 "安装 texlive-bidipagegrid 失败" - installed=false - fi - - # 测试功能 - LOG_INFO "测试 texlive-bidipagegrid 功能" - texlive-bidipagegrid --version > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "texlive-bidipagegrid 功能测试失败" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载 texlive-bidipagegrid" - dnf remove -y texlive-bidipagegrid - CHECK_RESULT $? 0 0 "卸载 texlive-bidipagegrid 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_usage.sh b/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_usage.sh deleted file mode 100644 index 08e6995e2e3..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_usage.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : Test basic LaTeX document compilation with the package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试基本LaTeX文档编译功能" - LOG_INFO "步骤1:检查环境中是否已安装texlive-bidipagegrid软件包" - if rpm -q texlive-bidipagegrid &> /dev/null; then - LOG_INFO "texlive-bidipagegrid已安装,测试结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "texlive-bidipagegrid未安装,将在测试中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在texlive-bidipagegrid软件包" - if ! dnf list available texlive-bidipagegrid &> /dev/null; then - LOG_ERROR "yum源中未找到texlive-bidipagegrid软件包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装texlive-bidipagegrid软件包" - dnf install -y texlive-bidipagegrid - CHECK_RESULT $? 0 0 "安装texlive-bidipagegrid失败" - fi - - LOG_INFO "步骤4:创建测试LaTeX文档" - cat > test_bidipagegrid.tex << "EOF" - \documentclass{article} - \usepackage{bidipagegrid} - \begin{document} - Hello, LaTeX with bidipagegrid! - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - - LOG_INFO "步骤5:编译LaTeX文档" - pdflatex test_bidipagegrid.tex - CHECK_RESULT $? 0 0 "编译LaTeX文档失败" - - LOG_INFO "步骤6:检查生成的PDF文件" - if [ -f test_bidipagegrid.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - LOG_INFO "步骤7:清理测试文件" - rm -f test_bidipagegrid.tex test_bidipagegrid.pdf test_bidipagegrid.log test_bidipagegrid.aux test_bidipagegrid.out - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤8:卸载texlive-bidipagegrid软件包" - dnf remove -y texlive-bidipagegrid - CHECK_RESULT $? 0 0 "卸载texlive-bidipagegrid失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_version.sh b/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_version.sh deleted file mode 100644 index ba9e7c8ecdf..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-c/texlive-bidipagegrid/test_texlive-bidipagegrid_function_version.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-18 -# @License : Mulan PSL v2 -# @Desc : Check package version information -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试texlive-bidipagegrid软件包版本信息 - LOG_INFO "开始测试texlive-bidipagegrid软件包版本信息" - - # 定义软件包名称 - PACKAGE_NAME="texlive-bidipagegrid" - - # 步骤1:检查软件包是否已在yum源中 - LOG_INFO "步骤1:检查软件包是否在yum源中" - dnf list available ${PACKAGE_NAME} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中" - exit 255 - fi - - # 步骤2:检查软件包是否已安装 - LOG_INFO "步骤2:检查软件包是否已安装" - rpm -q ${PACKAGE_NAME} &>/dev/null - PACKAGE_INSTALLED=$? - - # 步骤3:如果未安装,则安装软件包 - if [ ${PACKAGE_INSTALLED} -ne 0 ]; then - LOG_INFO "步骤3:安装软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包失败" - # 标记为本次测试安装 - INSTALLED_BY_TEST=1 - else - LOG_INFO "软件包已安装,跳过安装步骤" - INSTALLED_BY_TEST=0 - fi - - # 步骤4:检查软件包版本信息 - LOG_INFO "步骤4:检查软件包版本信息" - rpm -qi ${PACKAGE_NAME} | grep -E "Version|Release" &>/dev/null - CHECK_RESULT $? 0 0 "获取软件包版本信息失败" - - # 步骤5:检查软件包文件列表 - LOG_INFO "步骤5:检查软件包文件列表" - rpm -ql ${PACKAGE_NAME} | head -5 &>/dev/null - CHECK_RESULT $? 0 0 "获取软件包文件列表失败" - - # 步骤6:检查软件包依赖关系 - LOG_INFO "步骤6:检查软件包依赖关系" - rpm -qR ${PACKAGE_NAME} | head -5 &>/dev/null - CHECK_RESULT $? 0 0 "获取软件包依赖关系失败" - - # 步骤7:清理环境 - LOG_INFO "步骤7:清理环境" - if [ ${INSTALLED_BY_TEST} -eq 1 ]; then - LOG_INFO "卸载测试安装的软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "软件包为预安装状态,保持原状" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 792b9d920c5c34834d0878994f0d9028e77cbfa9 Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 14:45:26 +0800 Subject: [PATCH 2/9] update testcase for testsuite texlive-vocaltract --- .../texlive-split-y/texlive-vocaltract.json | 8 -- ...est_texlive-vocaltract_function_install.sh | 76 ------------------ ...xlive-vocaltract_function_usage_example.sh | 80 ------------------- 3 files changed, 164 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_usage_example.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-vocaltract.json b/suite2cases/function_test/pkg_test/texlive-split-y/texlive-vocaltract.json index dfe375f2b03..89f35db2301 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-vocaltract.json +++ b/suite2cases/function_test/pkg_test/texlive-split-y/texlive-vocaltract.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract", "machine num": 1, "cases": [ - { - "name": "test_texlive-vocaltract_function_install", - "desc": "Verify package installation" - }, { "name": "test_texlive-vocaltract_function_check_installed", "desc": "Check if package is installed" @@ -13,10 +9,6 @@ { "name": "test_texlive-vocaltract_function_uninstall", "desc": "Verify package removal" - }, - { - "name": "test_texlive-vocaltract_function_usage_example", - "desc": "Test LaTeX document compilation" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_install.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_install.sh deleted file mode 100644 index a3c1ce856df..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_install.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Verify package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在texlive-vocaltract软件包 - LOG_INFO "检查yum源中是否存在texlive-vocaltract软件包" - dnf list available texlive-vocaltract &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-vocaltract软件包" - exit 255 - fi - - # 检查是否已安装texlive-vocaltract - LOG_INFO "检查是否已安装texlive-vocaltract" - rpm -q texlive-vocaltract &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "texlive-vocaltract已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "texlive-vocaltract未安装,开始安装" - INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-vocaltract" - dnf install -y texlive-vocaltract - CHECK_RESULT $? 0 0 "安装texlive-vocaltract失败" - fi - - # 验证软件包是否成功安装 - LOG_INFO "验证texlive-vocaltract是否成功安装" - rpm -q texlive-vocaltract &>/dev/null - CHECK_RESULT $? 0 0 "texlive-vocaltract未正确安装" - - # 测试软件包功能(假设有一个测试命令) - LOG_INFO "测试texlive-vocaltract功能" - texlive-vocaltract --version &>/dev/null - CHECK_RESULT $? 0 0 "texlive-vocaltract功能测试失败" - - # 如果脚本开始时未安装,则在结束时卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-vocaltract" - dnf remove -y texlive-vocaltract - CHECK_RESULT $? 0 0 "卸载texlive-vocaltract失败" - - # 验证软件包是否成功卸载 - LOG_INFO "验证texlive-vocaltract是否成功卸载" - rpm -q texlive-vocaltract &>/dev/null - CHECK_RESULT $? 1 0 "texlive-vocaltraft未正确卸载" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_usage_example.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_usage_example.sh deleted file mode 100644 index a1e4833dec7..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-vocaltract/test_texlive-vocaltract_function_usage_example.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-02-22 -# @License : Mulan PSL v2 -# @Desc : Test LaTeX document compilation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test LaTeX document compilation" - - LOG_INFO "步骤1:检查是否已安装texlive-vocaltract软件包" - if rpm -q texlive-vocaltract &>/dev/null; then - LOG_INFO "texlive-vocaltract已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-vocaltract未安装,将在测试步骤中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在texlive-vocaltract软件包" - if ! dnf list available texlive-vocaltract &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-vocaltract软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装texlive-vocaltract软件包" - dnf install -y texlive-vocaltract - CHECK_RESULT $? 0 0 "安装texlive-vocaltract失败" - fi - - LOG_INFO "步骤4:创建一个简单的LaTeX测试文档" - cat > test_document.tex << "EOF" - \documentclass{article} - \usepackage{vocaltract} - \begin{document} - Test document for vocaltract package. - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试文档失败" - - LOG_INFO "步骤5:使用pdflatex编译LaTeX文档" - pdflatex -interaction=nonstopmode test_document.tex - CHECK_RESULT $? 0 0 "编译LaTeX文档失败" - - LOG_INFO "步骤6:检查生成的PDF文件" - if [ -f test_document.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - LOG_INFO "步骤7:清理测试文件" - rm -f test_document.tex test_document.pdf test_document.log test_document.aux test_document.out - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤8:卸载texlive-vocaltract软件包" - dnf remove -y texlive-vocaltract - CHECK_RESULT $? 0 0 "卸载texlive-vocaltract失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 8f13cb94e3c8d59cf4931a5dc17ada8585a87605 Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 14:46:27 +0800 Subject: [PATCH 3/9] update testcase for testsuite texlive-bpchem --- .../texlive-split-d/texlive-bpchem.json | 10 --- .../test_texlive-bpchem_uninstall.sh | 63 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/texlive-split-d/texlive-bpchem.json delete mode 100644 testcases/function_test/pkg_test/texlive-split-d/texlive-bpchem/test_texlive-bpchem_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-d/texlive-bpchem.json b/suite2cases/function_test/pkg_test/texlive-split-d/texlive-bpchem.json deleted file mode 100644 index 68750810af0..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-d/texlive-bpchem.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-d/texlive-bpchem", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-bpchem_uninstall", - "desc": "Test package removal" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-d/texlive-bpchem/test_texlive-bpchem_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-d/texlive-bpchem/test_texlive-bpchem_uninstall.sh deleted file mode 100644 index 59b28dadfe2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-d/texlive-bpchem/test_texlive-bpchem_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-09-17 -# @License : Mulan PSL v2 -# @Desc : Test package removal -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查texlive-bpchem是否已安装 - LOG_INFO "检查texlive-bpchem是否已安装" - dnf list installed texlive-bpchem > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-bpchem已安装,脚本结束时保持安装状态" - installed=true - else - LOG_INFO "texlive-bpchem未安装,将在测试结束后卸载" - installed=false - fi - - # 检查yum源中是否有texlive-bpchem软件包 - LOG_INFO "检查yum源中是否有texlive-bpchem软件包" - dnf list available texlive-bpchem > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-bpchem软件包" - - # 安装texlive-bpchem - if [ "$installed" = false ]; then - LOG_INFO "开始安装texlive-bpchem" - dnf install -y texlive-bpchem > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-bpchem失败" - fi - - # 测试卸载功能 - LOG_INFO "测试卸载功能" - dnf remove -y texlive-bpchem > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-bpchem失败" - - # 重新安装以恢复环境 - if [ "$installed" = true ]; then - LOG_INFO "重新安装texlive-bpchem以恢复环境" - dnf install -y texlive-bpchem > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "重新安装texlive-bpchem失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file From 1836cba2a467773242c04ce57f603c5e843c5bf0 Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 14:54:15 +0800 Subject: [PATCH 4/9] update testcase for testsuite texlive-modiagram --- .../texlive-split-p/texlive-modiagram.json | 28 ---- ...xlive-modiagram_function_atomic_orbital.sh | 94 -------------- .../test_texlive-modiagram_function_basic.sh | 64 --------- ...exlive-modiagram_function_basic_compile.sh | 70 ---------- ...exlive-modiagram_function_custom_levels.sh | 98 -------------- ...test_texlive-modiagram_function_install.sh | 77 ----------- ...t_texlive-modiagram_function_mo_diagram.sh | 105 --------------- ...exlive-modiagram_function_style_options.sh | 121 ------------------ 8 files changed, 657 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_atomic_orbital.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic_compile.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_custom_levels.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_install.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_mo_diagram.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_style_options.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-p/texlive-modiagram.json b/suite2cases/function_test/pkg_test/texlive-split-p/texlive-modiagram.json index 1211fbe1551..0bcb8cd8291 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-p/texlive-modiagram.json +++ b/suite2cases/function_test/pkg_test/texlive-split-p/texlive-modiagram.json @@ -2,37 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram", "machine num": 1, "cases": [ - { - "name": "test_texlive-modiagram_function_basic", - "desc": "Test basic diagram generation" - }, - { - "name": "test_texlive-modiagram_function_install", - "desc": "Test if the package can be installed successfully via package manager" - }, { "name": "test_texlive-modiagram_function_remove", "desc": "Test if the package can be cleanly removed via package manager" - }, - { - "name": "test_texlive-modiagram_function_basic_compile", - "desc": "Test basic LaTeX document compilation with modiagram package loaded" - }, - { - "name": "test_texlive-modiagram_function_mo_diagram", - "desc": "Test generation of a basic molecular orbital diagram" - }, - { - "name": "test_texlive-modiagram_function_atomic_orbital", - "desc": "Test generation of atomic orbital diagrams" - }, - { - "name": "test_texlive-modiagram_function_custom_levels", - "desc": "Test setting custom energy levels and labels in diagrams" - }, - { - "name": "test_texlive-modiagram_function_style_options", - "desc": "Test applying different styles and colors to diagram elements" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_atomic_orbital.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_atomic_orbital.sh deleted file mode 100644 index 78cb5f632e9..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_atomic_orbital.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : Test generation of atomic orbital diagrams -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:生成原子轨道图" - - # 检查环境是否已安装texlive-modiagram软件包 - LOG_INFO "检查texlive-modiagram是否已安装" - if dnf list installed texlive-modiagram &>/dev/null; then - LOG_INFO "texlive-modiagram已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-modiagram未安装,将在测试中安装并在结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-modiagram软件包 - LOG_INFO "检查yum源中是否有texlive-modiagram" - if ! dnf list available texlive-modiagram &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-modiagram软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装texlive-modiagram" - dnf install -y texlive-modiagram - CHECK_RESULT $? 0 0 "安装texlive-modiagram失败" - fi - - # 检查modiagram命令是否可用 - LOG_INFO "检查modiagram命令是否可用" - if ! command -v modiagram &>/dev/null; then - LOG_ERROR "modiagram命令不存在" - exit 255 - fi - - # 测试生成原子轨道图的基本功能 - LOG_INFO "测试生成原子轨道图的基本功能" - modiagram --help - CHECK_RESULT $? 0 0 "modiagram命令执行失败" - - # 测试生成氢原子轨道图 - LOG_INFO "测试生成氢原子轨道图" - modiagram "H" - CHECK_RESULT $? 0 0 "生成氢原子轨道图失败" - - # 测试生成氧原子轨道图 - LOG_INFO "测试生成氧原子轨道图" - modiagram "O" - CHECK_RESULT $? 0 0 "生成氧原子轨道图失败" - - # 测试生成铁原子轨道图 - LOG_INFO "测试生成铁原子轨道图" - modiagram "Fe" - CHECK_RESULT $? 0 0 "生成铁原子轨道图失败" - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数" - modiagram --invalid-option 2>/dev/null - if [ $? -ne 255 ] && [ $? -ne 0 ]; then - LOG_ERROR "modiagram命令不支持--invalid-option参数" - exit 255 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-modiagram" - dnf remove -y texlive-modiagram - CHECK_RESULT $? 0 0 "卸载texlive-modiagram失败" - fi - - LOG_INFO "测试完成:生成原子轨道图" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic.sh deleted file mode 100644 index ab0ef18b3a7..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test basic diagram generation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-modiagram - LOG_INFO "检查是否已安装texlive-modiagram" - if dnf list installed texlive-modiagram &>/dev/null; then - LOG_INFO "texlive-modiagram已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-modiagram未安装,脚本结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-modiagram - LOG_INFO "检查yum源中是否有texlive-modiagram" - if ! dnf list available texlive-modiagram &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-modiagram" - exit 255 - fi - - # 安装texlive-modiagram - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-modiagram" - dnf install -y texlive-modiagram - CHECK_RESULT $? 0 0 "安装texlive-modiagram失败" - fi - - # 测试基本图表生成功能 - LOG_INFO "测试基本图表生成功能" - texdiagram --test-diagram basic-diagram.tex - CHECK_RESULT $? 0 0 "生成基本图表失败" - - # 清理环境:如果脚本开始时未安装,则卸载texlive-modiagram - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-modiagram" - dnf remove -y texlive-modiagram - CHECK_RESULT $? 0 0 "卸载texlive-modiagram失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic_compile.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic_compile.sh deleted file mode 100644 index fc842c35494..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_basic_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 : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : Test basic LaTeX document compilation with modiagram package loaded -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:基本LaTeX文档编译,加载modiagram包" - LOG_INFO "步骤1:检查yum源中是否存在texlive-modiagram软件包" - dnf list available texlive-modiagram > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到texlive-modiagram软件包" - LOG_INFO "步骤2:检查系统是否已安装texlive-modiagram" - if dnf list installed texlive-modiagram > /dev/null 2>&1; then - LOG_INFO "texlive-modiagram已安装,测试结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-modiagram未安装,将在测试过程中安装" - INSTALLED=0 - fi - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-modiagram软件包" - dnf install -y texlive-modiagram - CHECK_RESULT $? 0 0 "安装texlive-modiagram失败" - fi - LOG_INFO "步骤4:创建测试LaTeX文档" - cat > test_modiagram.tex << "EOF" - \documentclass{article} - \usepackage{modiagram} - \begin{document} - Test document with modiagram package. - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文档失败" - LOG_INFO "步骤5:使用pdflatex编译LaTeX文档" - pdflatex -interaction=nonstopmode test_modiagram.tex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译LaTeX文档失败" - LOG_INFO "步骤6:检查是否生成PDF文件" - if [ -f test_modiagram.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - LOG_INFO "步骤7:清理测试生成的文件" - rm -f test_modiagram.tex test_modiagram.aux test_modiagram.log test_modiagram.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤8:卸载texlive-modiagram软件包" - dnf remove -y texlive-modiagram - CHECK_RESULT $? 0 0 "卸载texlive-modiagram失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_custom_levels.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_custom_levels.sh deleted file mode 100644 index 894f59f09b0..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_custom_levels.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 : Test setting custom energy levels and labels in diagrams -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境初始化 - LOG_INFO "开始测试自定义能级标签功能" - - # 检查是否已安装texlive-modiagram - LOG_INFO "检查texlive-modiagram是否已安装" - rpm -q texlive-modiagram > /dev/null 2>&1 - installed=$? - - # 如果未安装,则安装 - if [ $installed -ne 0 ]; then - LOG_INFO "texlive-modiagram未安装,准备安装" - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有texlive-modiagram" - dnf list available texlive-modiagram > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有texlive-modiagram软件包" - - # 安装软件包 - LOG_INFO "安装texlive-modiagram" - dnf install -y texlive-modiagram - CHECK_RESULT $? 0 0 "安装texlive-modiagram失败" - else - LOG_INFO "texlive-modiagram已安装,跳过安装步骤" - fi - - # 测试自定义能级标签功能 - LOG_INFO "测试自定义能级标签功能" - # 创建一个简单的LaTeX文件来测试modiagram的自定义能级标签 - cat > test_custom_levels.tex << "EOF" - \documentclass{article} - \usepackage{modiagram} - \begin{document} - \begin{MOdiagram} - \atom{left}{ 1s = {0;up} } - \atom{right}{ 1s = {0;up} } - \molecule{ - 1sMO = {1;pair}, - } - \EnergyAxis[title={Energy}] - \draw (left-1s) -- (1sMO); - \draw (right-1s) -- (1sMO); - \end{MOdiagram} - \end{document} - EOF - - # 使用modiagram编译LaTeX文件 - LOG_INFO "使用modiagram编译测试文件" - pdflatex -interaction=nonstopmode test_custom_levels.tex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "编译包含自定义能级标签的LaTeX文件失败" - - # 检查生成的PDF文件 - LOG_INFO "检查生成的PDF文件" - if [ -f test_custom_levels.pdf ]; then - LOG_INFO "成功生成包含自定义能级标签的PDF文件" - else - LOG_ERROR "未生成包含自定义能级标签的PDF文件" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_custom_levels.tex test_custom_levels.aux test_custom_levels.log test_custom_levels.pdf - - # 环境恢复 - LOG_INFO "恢复测试环境" - if [ $installed -ne 0 ]; then - LOG_INFO "卸载texlive-modiagram" - dnf remove -y texlive-modiagram - CHECK_RESULT $? 0 0 "卸载texlive-modiagram失败" - else - LOG_INFO "保持texlive-modiagram安装状态" - fi - - LOG_INFO "测试自定义能级标签功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_install.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_install.sh deleted file mode 100644 index 074c08210c7..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_install.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-02-20 -# @License : Mulan PSL v2 -# @Desc : Test if the package can be installed successfully via package manager -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-modiagram - LOG_INFO "检查texlive-modiagram是否已安装..." - dnf list installed texlive-modiagram &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "texlive-modiagram已安装,测试结束后将保持安装状态。" - INSTALLED=1 - else - LOG_INFO "texlive-modiagram未安装。" - INSTALLED=0 - fi - - # 检查yum源中是否存在texlive-modiagram软件包 - LOG_INFO "检查yum源中是否存在texlive-modiagram软件包..." - dnf list available texlive-modiagram &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-modiagram软件包。" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装texlive-modiagram软件包..." - dnf install -y texlive-modiagram - CHECK_RESULT $? 0 0 "安装texlive-modiagram失败。" - LOG_INFO "texlive-modiagram安装成功。" - fi - - # 测试软件包功能:检查modiagram命令是否存在 - LOG_INFO "测试modiagram命令是否可用..." - which modiagram &>/dev/null - CHECK_RESULT $? 0 0 "modiagram命令未找到,软件包可能未正确安装。" - - # 测试软件包功能:尝试运行modiagram命令的help选项 - LOG_INFO "测试modiagram命令的help选项..." - modiagram --help &>/dev/null - if [ $? -eq 255 ]; then - LOG_ERROR "modiagram命令不支持--help参数。" - exit 255 - fi - CHECK_RESULT $? 0 0 "modiagram命令执行失败。" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-modiagram软件包..." - dnf remove -y texlive-modiagram - CHECK_RESULT $? 0 0 "卸载texlive-modiagram失败。" - LOG_INFO "texlive-modiagram卸载成功,环境已恢复。" - else - LOG_INFO "测试完成,保持texlive-modiagram安装状态。" - fi - - LOG_INFO "测试完成:软件包可以通过包管理器成功安装。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_mo_diagram.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_mo_diagram.sh deleted file mode 100644 index 8797337594f..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_mo_diagram.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-20 -# @License : Mulan PSL v2 -# @Desc : Test generation of a basic molecular orbital diagram -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:生成基本分子轨道图" - - # 检查系统是否已安装texlive-modiagram软件包 - LOG_INFO "步骤1: 检查系统是否已安装texlive-modiagram" - if rpm -q texlive-modiagram &> /dev/null; then - LOG_INFO "texlive-modiagram已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "texlive-modiagram未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 检查yum源中是否存在texlive-modiagram软件包 - LOG_INFO "步骤2: 检查yum源中是否存在texlive-modiagram软件包" - if ! dnf list available texlive-modiagram &> /dev/null; then - LOG_ERROR "yum源中未找到texlive-modiagram软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3: 安装texlive-modiagram软件包" - dnf install -y texlive-modiagram - CHECK_RESULT $? 0 0 "安装texlive-modiagram失败" - fi - - # 验证mo-diagram命令是否存在 - LOG_INFO "步骤4: 验证mo-diagram命令是否存在" - command -v mo-diagram &> /dev/null - CHECK_RESULT $? 0 0 "mo-diagram命令不存在" - - # 测试mo-diagram命令的基本参数 - LOG_INFO "步骤5: 测试mo-diagram命令的基本参数" - mo-diagram --help &> /dev/null - CHECK_RESULT $? 0 0 "mo-diagram命令不支持--help参数" - - # 生成一个基本的分子轨道图 - LOG_INFO "步骤6: 生成一个基本的分子轨道图" - cat > test_mo.tex << "EOF" - \documentclass{article} - \usepackage{modiagram} - \begin{document} - \begin{MOdiagram} - \atom{left}{1s,2s,2p} - \atom{right}{1s,2s,2p} - \molecule{ - 1sMO = 1s + 1s, - 2sMO = 2s + 2s, - 2pMO = 2p + 2p - } - \end{MOdiagram} - \end{document} - EOF - - # 使用mo-diagram生成PDF - LOG_INFO "步骤7: 使用mo-diagram生成PDF" - mo-diagram test_mo.tex - CHECK_RESULT $? 0 0 "生成分子轨道图失败" - - # 检查生成的PDF文件是否存在 - LOG_INFO "步骤8: 检查生成的PDF文件是否存在" - if [ -f test_mo.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - # 清理生成的文件 - LOG_INFO "步骤9: 清理生成的文件" - rm -f test_mo.tex test_mo.pdf test_mo.aux test_mo.log - - # 如果测试开始时未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤10: 卸载texlive-modiagram软件包" - dnf remove -y texlive-modiagram - CHECK_RESULT $? 0 0 "卸载texlive-modiagram失败" - fi - - LOG_INFO "测试完成:生成基本分子轨道图" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_style_options.sh b/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_style_options.sh deleted file mode 100644 index b5df0ec18bc..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-p/texlive-modiagram/test_texlive-modiagram_function_style_options.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 applying different styles and colors to diagram elements -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="texlive-modiagram" - TEST_COMMAND="modiagram" - TEST_FILE="test_diagram.tex" - - # 步骤1: 检查yum源中是否存在指定的软件包 - LOG_INFO "步骤1: 检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在" - exit 255 - fi - - # 步骤2: 检查环境是否已经安装软件包 - LOG_INFO "步骤2: 检查环境是否已经安装软件包 $PACKAGE_NAME" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已经安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - 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: 创建测试用的LaTeX文件 - LOG_INFO "步骤4: 创建测试用的LaTeX文件 $TEST_FILE" - cat > $TEST_FILE << "EOF" - \documentclass{article} - \usepackage{modiagram} - \begin{document} - \begin{MOdiagram} - \atom{left}{1s, 2s, 2p}{} - \atom{right}{1s, 2s, 2p}{} - \molecule{ - 1sMO = {1s, 0, pair}, - 2sMO = {2s, 0, pair}, - 2pMO = {2p, 0, pair} - } - \end{MOdiagram} - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试文件 $TEST_FILE 失败" - - # 步骤5: 测试应用不同样式和颜色到图表元素 - LOG_INFO "步骤5: 测试应用不同样式和颜色到图表元素" - - # 测试样式参数 - LOG_INFO "测试样式参数:style=square" - pdflatex -interaction=nonstopmode "\PassOptionsToPackage{style=square}{modiagram}\input{$TEST_FILE}" &>/dev/null - CHECK_RESULT $? 0 0 "应用样式 style=square 失败" - - LOG_INFO "测试样式参数:style=rounded" - pdflatex -interaction=nonstopmode "\PassOptionsToPackage{style=rounded}{modiagram}\input{$TEST_FILE}" &>/dev/null - CHECK_RESULT $? 0 0 "应用样式 style=rounded 失败" - - # 测试颜色参数 - LOG_INFO "测试颜色参数:color=blue" - pdflatex -interaction=nonstopmode "\PassOptionsToPackage{color=blue}{modiagram}\input{$TEST_FILE}" &>/dev/null - CHECK_RESULT $? 0 0 "应用颜色 color=blue 失败" - - LOG_INFO "测试颜色参数:color=red" - pdflatex -interaction=nonstopmode "\PassOptionsToPackage{color=red}{modiagram}\input{$TEST_FILE}" &>/dev/null - CHECK_RESULT $? 0 0 "应用颜色 color=red 失败" - - # 测试不支持的参数 - LOG_INFO "测试不支持的参数:unsupported=option" - pdflatex -interaction=nonstopmode "\PassOptionsToPackage{unsupported=option}{modiagram}\input{$TEST_FILE}" &>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "不支持的参数 unsupported=option 应该导致失败" - exit 255 - else - LOG_INFO "不支持的参数 unsupported=option 正确导致失败" - fi - - # 步骤6: 清理测试生成的文件 - LOG_INFO "步骤6: 清理测试生成的文件" - rm -f $TEST_FILE *.aux *.log *.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤7: 如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤7: 卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - else - LOG_INFO "步骤7: 保持软件包 $PACKAGE_NAME 的安装状态" - fi - - LOG_INFO "测试完成,所有步骤均成功执行" -} - -main "$@" \ No newline at end of file From a8e38f9aed8d36715fe3293a8320a6d5f52e49e2 Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 14:55:54 +0800 Subject: [PATCH 5/9] update testcase for testsuite texlive-sciposter --- .../texlive-split-u/texlive-sciposter.json | 16 -- .../test_texlive-sciposter_function_basic.sh | 68 --------- ..._texlive-sciposter_function_basic_usage.sh | 140 ------------------ ...live-sciposter_function_compile_example.sh | 113 -------------- ...test_texlive-sciposter_function_install.sh | 121 --------------- 5 files changed, 458 deletions(-) delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic_usage.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_compile_example.sh delete mode 100644 testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_install.sh diff --git a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sciposter.json b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sciposter.json index ca65b8eaf5c..702a2d7ff85 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sciposter.json +++ b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sciposter.json @@ -2,26 +2,10 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter", "machine num": 1, "cases": [ - { - "name": "test_texlive-sciposter_function_basic", - "desc": "Basic functionality test" - }, - { - "name": "test_texlive-sciposter_function_install", - "desc": "Test installation of texlive-sciposter package" - }, { "name": "test_texlive-sciposter_function_check_installed", "desc": "Check if texlive-sciposter is installed on the system" }, - { - "name": "test_texlive-sciposter_function_basic_usage", - "desc": "Test basic usage of sciposter document class" - }, - { - "name": "test_texlive-sciposter_function_compile_example", - "desc": "Compile a simple example poster with pdflatex" - }, { "name": "test_texlive-sciposter_function_uninstall", "desc": "Test removal of texlive-sciposter package" diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic.sh deleted file mode 100644 index 2878fe1d95a..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Basic functionality test -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已经安装texlive-sciposter软件包 - LOG_INFO "检查texlive-sciposter是否已安装" - rpm -q texlive-sciposter > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-sciposter已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-sciposter未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-sciposter软件包 - LOG_INFO "检查yum源中是否存在texlive-sciposter软件包" - dnf list available texlive-sciposter > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-sciposter软件包" - - # 安装texlive-sciposter软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-sciposter软件包" - dnf install -y texlive-sciposter > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-sciposter失败" - fi - - # 测试texlive-sciposter基本功能 - LOG_INFO "测试texlive-sciposter基本功能" - texdoc sciposter > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texdoc sciposter命令执行失败" - - # 检查不支持的命令参数(示例) - LOG_INFO "检查不支持的参数" - texdoc sciposter --invalid-arg > /dev/null 2>&1 - CHECK_RESULT $? 255 255 "不支持的命令参数" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-sciposter软件包" - dnf remove -y texlive-sciposter > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-sciposter失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic_usage.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic_usage.sh deleted file mode 100644 index 6c2d87b61fd..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_basic_usage.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test basic usage of sciposter document class -# ############################################ - -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 expect=$2 - local mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -ne $expect ]; then - LOG_ERROR "$message" - exit 1 - fi - else - if [ $actual -eq $expect ]; then - LOG_ERROR "$message" - exit 1 - fi - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - sshpass -p "$password" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$user@$ip" "$cmd" - } - - # 定义软件包名称 - PACKAGE_NAME="texlive-sciposter" - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有 $PACKAGE_NAME 软件包" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有 $PACKAGE_NAME 软件包" - exit 255 - fi - - # 检查环境是否已经安装该软件包 - LOG_INFO "检查环境是否已经安装 $PACKAGE_NAME" - dnf list installed $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; 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 - - # 测试sciposter文档类的基本用法 - LOG_INFO "测试sciposter文档类的基本用法" - - # 创建一个测试的LaTeX文档 - TEST_FILE="test_sciposter.tex" - cat > $TEST_FILE << "EOF" - \documentclass{sciposter} - \begin{document} - \title{测试标题} - \author{测试作者} - \date{\today} - \maketitle - \begin{abstract} - 这是一个测试摘要。 - \end{abstract} - \section{测试章节} - 这是一个测试章节。 - \end{document} - EOF - - # 检查是否成功创建测试文件 - CHECK_RESULT $? 0 0 "创建测试文件失败" - - # 使用pdflatex编译LaTeX文档 - LOG_INFO "使用pdflatex编译LaTeX文档" - pdflatex $TEST_FILE - CHECK_RESULT $? 0 0 "编译LaTeX文档失败" - - # 检查是否生成了PDF文件 - LOG_INFO "检查是否生成了PDF文件" - if [ -f "${TEST_FILE%.tex}.pdf" ]; then - LOG_INFO "成功生成了PDF文件" - else - LOG_ERROR "未生成PDF文件" - exit 1 - fi - - # 清理生成的中间文件 - LOG_INFO "清理生成的中间文件" - rm -f ${TEST_FILE%.tex}.aux ${TEST_FILE%.tex}.log ${TEST_FILE%.tex}.out ${TEST_FILE%.tex}.pdf $TEST_FILE - - # 如果之前未安装,则在脚本结束前卸载软件包 - 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-u/texlive-sciposter/test_texlive-sciposter_function_compile_example.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_compile_example.sh deleted file mode 100644 index 44febddb8bf..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_compile_example.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Compile a simple example poster with pdflatex -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:Compile a simple example poster with pdflatex" - - # 检查是否已安装texlive-sciposter - LOG_INFO "步骤1:检查texlive-sciposter是否已安装" - if dnf list installed texlive-sciposter &>/dev/null; then - LOG_INFO "texlive-sciposter已安装,测试结束后保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "texlive-sciposter未安装,将在测试中安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有texlive-sciposter - LOG_INFO "步骤2:检查yum源中是否有texlive-sciposter软件包" - if ! dnf list available texlive-sciposter &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-sciposter软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-sciposter - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-sciposter" - dnf install -y texlive-sciposter - CHECK_RESULT $? 0 0 "安装texlive-sciposter失败" - fi - - # 检查pdflatex命令是否存在 - LOG_INFO "步骤4:检查pdflatex命令是否存在" - if ! command -v pdflatex &>/dev/null; then - LOG_ERROR "pdflatex命令不存在或不支持" - exit 255 - fi - - # 创建一个简单的LaTeX海报示例文件 - LOG_INFO "步骤5:创建简单的LaTeX海报示例文件" - cat > example_poster.tex << "EOF" - \documentclass[25pt, a0paper, portrait]{sciposter} - \usepackage{graphicx} - \usepackage{multicol} - \usepackage{color} - - \title{Test Poster Title} - \author{Test Author} - \institute{Test Institute} - \email{test@example.com} - - \begin{document} - \maketitle - - \begin{multicols}{2} - \section{Introduction} - This is a test poster to verify pdflatex compilation with sciposter class. - - \section{Conclusion} - The compilation should succeed without errors. - \end{multicols} - - \end{document} - EOF - - CHECK_RESULT $? 0 0 "创建示例LaTeX文件失败" - - # 使用pdflatex编译示例海报 - LOG_INFO "步骤6:使用pdflatex编译示例海报" - pdflatex -interaction=nonstopmode example_poster.tex - CHECK_RESULT $? 0 0 "pdflatex编译失败" - - # 检查生成的PDF文件是否存在 - LOG_INFO "步骤7:检查生成的PDF文件是否存在" - if [ -f example_poster.pdf ]; then - LOG_INFO "PDF文件生成成功:example_poster.pdf" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - # 清理临时文件 - LOG_INFO "步骤8:清理临时文件" - rm -f example_poster.tex example_poster.aux example_poster.log example_poster.out example_poster.pdf - - # 如果测试开始时未安装,则卸载texlive-sciposter - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤9:卸载texlive-sciposter" - dnf remove -y texlive-sciposter - CHECK_RESULT $? 0 0 "卸载texlive-sciposter失败" - fi - - LOG_INFO "测试完成:Compile a simple example poster with pdflatex" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_install.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_install.sh deleted file mode 100644 index 27f66c2afa2..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-sciposter/test_texlive-sciposter_function_install.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test installation of texlive-sciposter package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试安装texlive-sciposter软件包 - - LOG_INFO "开始测试texlive-sciposter软件包的安装功能" - - # 检查环境是否已安装texlive-sciposter - LOG_INFO "步骤1: 检查texlive-sciposter是否已安装" - dnf list installed texlive-sciposter > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-sciposter已安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "texlive-sciposter未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤2: 检查yum源中是否有texlive-sciposter软件包" - dnf list available texlive-sciposter > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-sciposter软件包" - exit 255 - fi - - # 如果环境未安装,则安装软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装texlive-sciposter软件包" - dnf install -y texlive-sciposter - CHECK_RESULT $? 0 0 "安装texlive-sciposter失败" - - LOG_INFO "步骤4: 验证texlive-sciposter安装成功" - dnf list installed texlive-sciposter > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证texlive-sciposter安装失败" - fi - - # 测试软件包的基本功能 - LOG_INFO "步骤5: 测试texlive-sciposter基本功能" - # 检查texlive-sciposter是否提供了必要的文件 - rpm -ql texlive-sciposter | head -5 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-sciposter未提供必要的文件" - - # 测试sciposter相关命令是否存在 - LOG_INFO "步骤6: 检查sciposter相关命令" - which latex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未找到latex命令" - - # 测试创建简单的sciposter文档 - LOG_INFO "步骤7: 测试创建简单的sciposter文档" - cat > test_sciposter.tex << "EOF" - \documentclass{sciposter} - \title{Test SciPoster} - \author{Test Author} - \institute{Test Institute} - \begin{document} - \maketitle - \begin{abstract} - This is a test abstract for SciPoster. - \end{abstract} - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试文档失败" - - # 尝试编译测试文档(不要求成功,只检查命令是否存在) - LOG_INFO "步骤8: 测试latex编译命令" - pdflatex --version > /dev/null 2>&1 - if [ $? -eq 0 ]; then - pdflatex -interaction=nonstopmode test_sciposter.tex > /dev/null 2>&1 - # 不检查编译结果,因为可能缺少其他依赖 - LOG_INFO "latex编译命令测试完成" - else - LOG_INFO "未找到pdflatex命令,跳过编译测试" - fi - - # 清理测试文件 - LOG_INFO "步骤9: 清理测试文件" - rm -f test_sciposter.tex test_sciposter.aux test_sciposter.log test_sciposter.out test_sciposter.pdf 2>/dev/null - - # 环境恢复 - LOG_INFO "步骤10: 恢复测试环境" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的texlive-sciposter软件包" - dnf remove -y texlive-sciposter - CHECK_RESULT $? 0 0 "卸载texlive-sciposter失败" - - # 验证卸载成功 - dnf list installed texlive-sciposter > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "texlive-sciposter卸载失败" - exit 1 - else - LOG_INFO "texlive-sciposter成功卸载" - fi - else - LOG_INFO "保持texlive-sciposter的安装状态" - fi - - LOG_INFO "测试完成:texlive-sciposter软件包安装功能测试通过" -} - -main "$@" \ No newline at end of file From 998a72427814cdb92df99e5c9bdf8f7a2c16ed4d Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 14:58:54 +0800 Subject: [PATCH 6/9] update testcase for testsuite python3-scikit-build-core --- .../python3-scikit-build-core.json | 10 --- ...ython3-scikit-build-core_function_build.sh | 61 ------------------- 2 files changed, 71 deletions(-) delete mode 100644 suite2cases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core.json delete mode 100644 testcases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core/test_python3-scikit-build-core_function_build.sh diff --git a/suite2cases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core.json b/suite2cases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core.json deleted file mode 100644 index 876bba6bbbd..00000000000 --- a/suite2cases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core", - "machine num": 1, - "cases": [ - { - "name": "test_python3-scikit-build-core_function_build", - "desc": "Test the build functionality of the package" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core/test_python3-scikit-build-core_function_build.sh b/testcases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core/test_python3-scikit-build-core_function_build.sh deleted file mode 100644 index 3da4b7f36b0..00000000000 --- a/testcases/function_test/pkg_test/python-scikit-build-core/python3-scikit-build-core/test_python3-scikit-build-core_function_build.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-09 -# @License : Mulan PSL v2 -# @Desc : Test the build functionality of the package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-scikit-build-core的构建功能" - - # 检查yum源中是否存在python3-scikit-build-core包 - LOG_INFO "检查yum源中是否存在python3-scikit-build-core包" - dnf list available python3-scikit-build-core > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-scikit-build-core包" - exit 255 - fi - - # 检查是否已安装python3-scikit-build-core - LOG_INFO "检查是否已安装python3-scikit-build-core" - rpm -q python3-scikit-build-core > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-scikit-build-core已安装,跳过安装步骤" - installed=true - else - LOG_INFO "python3-scikit-build-core未安装,开始安装" - dnf install -y python3-scikit-build-core - CHECK_RESULT $? 0 0 "安装python3-scikit-build-core失败" - installed=false - fi - - # 测试构建功能 - LOG_INFO "测试python3-scikit-build-core的构建功能" - python3 -m scikit_build_core build - CHECK_RESULT $? 0 0 "构建功能测试失败" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-scikit-build-core" - dnf remove -y python3-scikit-build-core - CHECK_RESULT $? 0 0 "卸载python3-scikit-build-core失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file From 3083b8c70fb080814a7a95a77e16ec2f475045c0 Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 15:01:01 +0800 Subject: [PATCH 7/9] update testcase for testsuite liblsan --- .../function_test/pkg_test/gcc/liblsan.json | 44 ----- .../test_liblsan_function_basic_linking.sh | 92 ---------- .../test_liblsan_function_check_installed.sh | 114 ------------ .../test_liblsan_function_check_version.sh | 80 -------- .../test_liblsan_function_compile_link.sh | 100 ---------- .../test_liblsan_function_env_options.sh | 81 --------- .../test_liblsan_function_install_package.sh | 68 ------- .../test_liblsan_function_leak_report.sh | 172 ------------------ .../test_liblsan_function_remove_package.sh | 104 ----------- ...test_liblsan_function_runtime_detection.sh | 127 ------------- .../test_liblsan_function_suppression.sh | 115 ------------ .../test_liblsan_function_uninstall.sh | 69 ------- 12 files changed, 1166 deletions(-) delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_basic_linking.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_installed.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_version.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_compile_link.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_env_options.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_install_package.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_leak_report.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_remove_package.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_runtime_detection.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_suppression.sh delete mode 100644 testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_uninstall.sh diff --git a/suite2cases/function_test/pkg_test/gcc/liblsan.json b/suite2cases/function_test/pkg_test/gcc/liblsan.json index 53b7c958033..814d3d5401e 100644 --- a/suite2cases/function_test/pkg_test/gcc/liblsan.json +++ b/suite2cases/function_test/pkg_test/gcc/liblsan.json @@ -2,53 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/gcc/liblsan", "machine num": 1, "cases": [ - { - "name": "test_liblsan_function_install_package", - "desc": "测试通过包管理器(如apt, yum, dnf)安装liblsan软件包的功能,验证安装过程是否成功且无错误。" - }, - { - "name": "test_liblsan_function_check_installed", - "desc": "测试检查liblsan软件包是否已正确安装到系统中的功能,验证其文件(如库文件、头文件)是否存在于标准路径。" - }, - { - "name": "test_liblsan_function_remove_package", - "desc": "测试通过包管理器安全卸载liblsan软件包的功能,验证卸载过程是否干净且不影响系统其他组件。" - }, - { - "name": "test_liblsan_function_basic_linking", - "desc": "测试一个简单的C程序能否成功链接liblsan库(使用-lsan标志)并进行编译,验证其作为链接时库的基本可用性。" - }, - { - "name": "test_liblsan_function_runtime_detection", - "desc": "测试一个包含内存泄漏的示例程序在启用LSan(通过环境变量如ASAN_OPTIONS)运行时,是否能被liblsan检测并报告泄漏信息。" - }, { "name": "test_liblsan_function_install", "desc": "验证通过系统包管理器(apt/yum/dnf)能够成功安装liblsan软件包,无错误且文件就位。" - }, - { - "name": "test_liblsan_function_check_version", - "desc": "测试检查已安装liblsan软件包的版本信息,验证版本号可正常查询。" - }, - { - "name": "test_liblsan_function_uninstall", - "desc": "验证通过包管理器安全卸载liblsan软件包,确保卸载后相关文件被移除且不影响核心系统。" - }, - { - "name": "test_liblsan_function_compile_link", - "desc": "测试一个简单的C程序能否使用-lsan标志成功编译和链接liblsan库,验证其作为开发库的基本功能。" - }, - { - "name": "test_liblsan_function_leak_report", - "desc": "测试一个包含内存泄漏的程序在启用LSan运行时,是否能被正确检测并生成详细的泄漏报告。" - }, - { - "name": "test_liblsan_function_env_options", - "desc": "测试通过环境变量(如LSAN_OPTIONS)配置LSan运行行为(如设置退出码、过滤规则)是否生效。" - }, - { - "name": "test_liblsan_function_suppression", - "desc": "测试使用LSan抑制文件(suppression file)来忽略特定泄漏报告的功能是否正常工作。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_basic_linking.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_basic_linking.sh deleted file mode 100644 index e56e5729a85..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_basic_linking.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-28 -# @License : Mulan PSL v2 -# @Desc : 测试一个简单的C程序能否成功链接liblsan库(使用-lsan标志)并进行编译,验证其作为链接时库的基本可用性。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - TEST_PKG="gcc" - TEST_FILE="test_lsan.c" - TEST_BINARY="test_lsan" - TEST_SOURCE=" - #include - int main() { - int *p = malloc(10 * sizeof(int)); - free(p); - return 0; - } - " - - # 检查软件包是否存在于yum源中 - LOG_INFO "检查yum源中是否存在$TEST_PKG软件包" - dnf list available $TEST_PKG &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在$TEST_PKG软件包" - exit 255 - fi - - # 判断环境是否已安装gcc - LOG_INFO "检查环境是否已安装$TEST_PKG" - rpm -q $TEST_PKG &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "$TEST_PKG已安装,测试结束后保持安装状态" - PKG_INSTALLED=1 - else - LOG_INFO "$TEST_PKG未安装,将在测试过程中安装" - PKG_INSTALLED=0 - fi - - # 如果未安装,则安装gcc - if [ $PKG_INSTALLED -eq 0 ]; then - LOG_INFO "安装$TEST_PKG软件包" - dnf install -y $TEST_PKG - CHECK_RESULT $? 0 0 "安装$TEST_PKG失败" - fi - - # 创建测试C程序 - LOG_INFO "创建测试C程序文件" - echo "$TEST_SOURCE" > $TEST_FILE - CHECK_RESULT $? 0 0 "创建测试文件失败" - - # 测试编译链接liblsan库 - LOG_INFO "测试编译链接liblsan库" - gcc -o $TEST_BINARY $TEST_FILE -fsanitize=address -lsan - CHECK_RESULT $? 0 0 "编译链接liblsan库失败" - - # 运行测试程序 - LOG_INFO "运行测试程序" - ./$TEST_BINARY - CHECK_RESULT $? 0 0 "运行测试程序失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f $TEST_FILE $TEST_BINARY - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装gcc,则卸载 - if [ $PKG_INSTALLED -eq 0 ]; then - LOG_INFO "卸载$TEST_PKG软件包" - dnf remove -y $TEST_PKG - CHECK_RESULT $? 0 0 "卸载$TEST_PKG失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_installed.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_installed.sh deleted file mode 100644 index d4ac64fd378..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_installed.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-01-28 -# @License : Mulan PSL v2 -# @Desc : 测试检查liblsan软件包是否已正确安装到系统中的功能,验证其文件(如库文件、头文件)是否存在于标准路径。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PKG_NAME="liblsan" - LOG_INFO "开始测试${PKG_NAME}软件包安装检查功能" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在${PKG_NAME}软件包" - dnf list available ${PKG_NAME} > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PKG_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PKG_NAME}软件包" - - # 步骤2:检查系统是否已安装该软件包 - LOG_INFO "步骤2:检查系统是否已安装${PKG_NAME}软件包" - rpm -q ${PKG_NAME} > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "${PKG_NAME}软件包已安装,标记为保持安装状态" - INSTALLED_BEFORE="true" - else - LOG_INFO "${PKG_NAME}软件包未安装,标记为需要清理" - INSTALLED_BEFORE="false" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "步骤3:安装${PKG_NAME}软件包" - dnf install -y ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装${PKG_NAME}软件包失败" - LOG_INFO "${PKG_NAME}软件包安装成功" - fi - - # 步骤4:验证库文件是否存在 - LOG_INFO "步骤4:验证${PKG_NAME}库文件是否存在" - LIB_FILES=$(rpm -ql ${PKG_NAME} | grep -E "\.so(\.|$)") - if [ -z "${LIB_FILES}" ]; then - LOG_ERROR "未找到${PKG_NAME}库文件" - CHECK_RESULT 1 0 0 "库文件检查失败" - else - LOG_INFO "找到${PKG_NAME}库文件:" - echo "${LIB_FILES}" - # 检查第一个库文件是否存在 - FIRST_LIB=$(echo "${LIB_FILES}" | head -1) - if [ -f "${FIRST_LIB}" ]; then - LOG_INFO "库文件${FIRST_LIB}存在" - CHECK_RESULT $? 0 0 "库文件存在性检查失败" - else - LOG_ERROR "库文件${FIRST_LIB}不存在" - CHECK_RESULT 1 0 0 "库文件存在性检查失败" - fi - fi - - # 步骤5:验证头文件是否存在(如果软件包包含头文件) - LOG_INFO "步骤5:验证${PKG_NAME}头文件是否存在" - HEADER_FILES=$(rpm -ql ${PKG_NAME} | grep -E "\.h$") - if [ -n "${HEADER_FILES}" ]; then - LOG_INFO "找到${PKG_NAME}头文件:" - echo "${HEADER_FILES}" - # 检查第一个头文件是否存在 - FIRST_HEADER=$(echo "${HEADER_FILES}" | head -1) - if [ -f "${FIRST_HEADER}" ]; then - LOG_INFO "头文件${FIRST_HEADER}存在" - CHECK_RESULT $? 0 0 "头文件存在性检查失败" - else - LOG_ERROR "头文件${FIRST_HEADER}不存在" - CHECK_RESULT 1 0 0 "头文件存在性检查失败" - fi - else - LOG_INFO "${PKG_NAME}软件包不包含头文件,跳过头文件检查" - fi - - # 步骤6:验证软件包文件完整性 - LOG_INFO "步骤6:验证${PKG_NAME}软件包文件完整性" - rpm -V ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "${PKG_NAME}软件包文件完整性检查失败" - LOG_INFO "${PKG_NAME}软件包文件完整性验证通过" - - # 步骤7:清理环境 - LOG_INFO "步骤7:清理测试环境" - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "卸载测试安装的${PKG_NAME}软件包" - dnf remove -y ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载${PKG_NAME}软件包失败" - LOG_INFO "${PKG_NAME}软件包卸载成功" - else - LOG_INFO "测试前${PKG_NAME}已安装,保持安装状态" - fi - - LOG_INFO "测试完成:${PKG_NAME}软件包安装检查功能验证通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_version.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_version.sh deleted file mode 100644 index afb16e74fef..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_check_version.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-29 -# @License : Mulan PSL v2 -# @Desc : 测试检查已安装liblsan软件包的版本信息,验证版本号可正常查询。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查已安装liblsan软件包的版本信息,验证版本号可正常查询。" - - # 步骤1:检查yum源中是否存在liblsan软件包 - LOG_INFO "检查yum源中是否存在liblsan软件包" - dnf list available liblsan --quiet - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到liblsan软件包" - exit 255 - fi - - # 步骤2:检查系统是否已安装liblsan软件包 - LOG_INFO "检查系统是否已安装liblsan软件包" - rpm -q liblsan - if [ $? -eq 0 ]; then - LOG_INFO "liblsan软件包已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "liblsan软件包未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 步骤3:如果未安装,则安装liblsan软件包 - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "开始安装liblsan软件包" - dnf install -y liblsan --quiet - CHECK_RESULT $? 0 0 "安装liblsan软件包失败" - LOG_INFO "liblsan软件包安装成功" - fi - - # 步骤4:检查liblsan软件包版本信息 - LOG_INFO "检查liblsan软件包版本信息" - rpm -q --queryformat "%{VERSION}-%{RELEASE}\n" liblsan - CHECK_RESULT $? 0 0 "查询liblsan软件包版本信息失败" - - # 步骤5:验证版本号格式 - LOG_INFO "验证版本号格式" - VERSION=$(rpm -q --queryformat "%{VERSION}-%{RELEASE}\n" liblsan) - if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?-[0-9]+(\.[0-9]+)?(\.[0-9]+)?$ ]]; then - LOG_INFO "版本号格式正确:$VERSION" - else - LOG_ERROR "版本号格式不正确:$VERSION" - exit 1 - fi - - # 步骤6:清理环境,如果测试前未安装则卸载软件包 - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "清理环境:卸载liblsan软件包" - dnf remove -y liblsan --quiet - CHECK_RESULT $? 0 0 "卸载liblsan软件包失败" - LOG_INFO "liblsan软件包卸载成功" - else - LOG_INFO "测试前已安装liblsan软件包,保持安装状态" - fi - - LOG_INFO "测试完成:liblsan软件包版本信息检查成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_compile_link.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_compile_link.sh deleted file mode 100644 index d4c7398b15b..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_compile_link.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-29 -# @License : Mulan PSL v2 -# @Desc : 测试一个简单的C程序能否使用-lsan标志成功编译和链接liblsan库,验证其作为开发库的基本功能。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试liblsan库编译链接功能" - - # 检查是否已安装gcc和liblsan开发包 - LOG_INFO "检查gcc和libasan开发包是否已安装" - if rpm -q gcc libasan &> /dev/null; then - LOG_INFO "gcc和libasan已安装,标记为已安装状态" - INSTALLED=1 - else - LOG_INFO "gcc和libasan未安装,标记为未安装状态" - INSTALLED=0 - fi - - # 如果未安装,则尝试安装 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "尝试安装gcc和libasan开发包" - # 检查yum源中是否有gcc和libasan包 - LOG_INFO "检查yum源中是否有gcc包" - if ! dnf list available gcc &> /dev/null; then - LOG_ERROR "yum源中未找到gcc包" - exit 255 - fi - LOG_INFO "检查yum源中是否有libasan包" - if ! dnf list available libasan &> /dev/null; then - LOG_ERROR "yum源中未找到libasan包" - exit 255 - fi - - LOG_INFO "开始安装gcc和libasan" - dnf install -y gcc libasan - CHECK_RESULT $? 0 0 "安装gcc和libasan失败" - LOG_INFO "gcc和libasan安装成功" - fi - - # 创建测试C程序 - LOG_INFO "创建测试C程序test_liblsan.c" - cat > test_liblsan.c << "EOF" - #include - #include - - int main() { - int *p = (int*)malloc(sizeof(int)); - *p = 42; - printf("Value: %d\n", *p); - free(p); - return 0; - } - EOF - - # 编译测试程序,使用-lsan标志链接liblsan库 - LOG_INFO "编译测试程序,使用-lsan标志链接liblsan库" - gcc -fsanitize=address -o test_liblsan test_liblsan.c -lsan - CHECK_RESULT $? 0 0 "使用-lsan标志编译链接失败" - - # 运行测试程序 - LOG_INFO "运行编译后的测试程序" - ./test_liblsan - CHECK_RESULT $? 0 0 "运行测试程序失败" - - LOG_INFO "测试程序运行成功,输出符合预期" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_liblsan test_liblsan.c - - # 如果之前未安装,则卸载安装的软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载之前安装的gcc和libasan开发包" - dnf remove -y gcc libasan - CHECK_RESULT $? 0 0 "卸载gcc和libasan失败" - LOG_INFO "gcc和libasan卸载成功" - else - LOG_INFO "保持gcc和libasan的安装状态" - fi - - LOG_INFO "liblsan库编译链接功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_env_options.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_env_options.sh deleted file mode 100644 index ff4447838ae..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_env_options.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-29 -# @License : Mulan PSL v2 -# @Desc : 测试通过环境变量(如LSAN_OPTIONS)配置LSan运行行为(如设置退出码、过滤规则)是否生效。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试LSan环境变量配置功能" - LOG_INFO "步骤1: 检查lsan软件包是否在yum源中可用" - dnf list available lsan > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到lsan软件包" - LOG_INFO "步骤2: 检查系统是否已安装lsan" - rpm -q lsan > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "lsan已安装,测试完成后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "lsan未安装,将进行安装" - INSTALLED=0 - fi - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装lsan软件包" - dnf install -y lsan > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装lsan软件包失败" - fi - LOG_INFO "步骤4: 设置LSAN_OPTIONS环境变量并验证退出码配置" - export LSAN_OPTIONS="exitcode=42" - cat > test_lsan.c << "EOF" - #include - int main() { - char *x = malloc(10); - return 0; - } - EOF - gcc -fsanitize=leak -o test_lsan test_lsan.c 2>/dev/null - CHECK_RESULT $? 0 0 "编译测试程序失败" - ./test_lsan > /dev/null 2>&1 - CHECK_RESULT $? 42 0 "LSAN_OPTIONS设置的退出码未生效" - LOG_INFO "步骤5: 设置LSAN_OPTIONS环境变量并验证过滤规则" - export LSAN_OPTIONS="suppressions=./suppress.txt" - cat > suppress.txt << "EOF" - leak:main - EOF - cat > test_lsan2.c << "EOF" - #include - int main() { - char *x = malloc(10); - return 0; - } - EOF - gcc -fsanitize=leak -o test_lsan2 test_lsan2.c 2>/dev/null - CHECK_RESULT $? 0 0 "编译第二个测试程序失败" - ./test_lsan2 > output.txt 2>&1 - grep -q "LeakSanitizer" output.txt - CHECK_RESULT $? 1 0 "过滤规则未生效,内存泄漏未被抑制" - LOG_INFO "步骤6: 清理临时文件" - rm -f test_lsan test_lsan.c test_lsan2 test_lsan2.c output.txt suppress.txt - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤7: 卸载lsan软件包" - dnf remove -y lsan > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载lsan软件包失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_install_package.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_install_package.sh deleted file mode 100644 index 56dd2d0bd03..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_install_package.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-01-28 -# @License : Mulan PSL v2 -# @Desc : 测试通过包管理器(如apt, yum, dnf)安装liblsan软件包的功能,验证安装过程是否成功且无错误。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试liblsan软件包安装功能" - LOG_INFO "检查是否已安装liblsan软件包" - rpm -q liblsan > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "liblsan软件包已安装,测试将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "liblsan软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE=0 - fi - - LOG_INFO "检查yum源中是否存在liblsan软件包" - dnf list available liblsan > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到liblsan软件包" - - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "安装liblsan软件包" - dnf install -y liblsan - CHECK_RESULT $? 0 0 "安装liblsan软件包失败" - fi - - LOG_INFO "验证liblsan软件包安装是否成功" - rpm -q liblsan > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "liblsan软件包未正确安装" - - LOG_INFO "测试liblsan相关命令是否可用" - lsan-cmd --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "liblsan相关命令不可用或参数不支持" - exit 255 - fi - - LOG_INFO "清理测试环境" - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "卸载测试安装的liblsan软件包" - dnf remove -y liblsan - CHECK_RESULT $? 0 0 "卸载liblsan软件包失败" - LOG_INFO "已恢复环境到测试前状态" - else - LOG_INFO "保持liblsan软件包安装状态" - fi - - LOG_INFO "liblsan软件包安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_leak_report.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_leak_report.sh deleted file mode 100644 index 4917e94c563..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_leak_report.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-29 -# @License : Mulan PSL v2 -# @Desc : 测试一个包含内存泄漏的程序在启用LSan运行时,是否能被正确检测并生成详细的泄漏报告。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出函数 - LOG_INFO() { - echo -e "\033[32m[INFO]\033[0m $1" - } - LOG_ERROR() { - echo -e "\033[31m[ERROR]\033[0m $1" - } - - # 检查软件包是否存在 - check_package_exist() { - local package_name=$1 - dnf list installed "$package_name" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $package_name 已安装" - return 0 - fi - dnf search "$package_name" | grep -q "^$package_name\." - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $package_name 不存在于yum源中" - exit 255 - fi - LOG_INFO "软件包 $package_name 存在于yum源中" - return 1 - } - - # 安装软件包 - install_package() { - local package_name=$1 - LOG_INFO "开始安装软件包 $package_name" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败" - LOG_INFO "软件包 $package_name 安装成功" - } - - # 卸载软件包 - uninstall_package() { - local package_name=$1 - LOG_INFO "开始卸载软件包 $package_name" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败" - LOG_INFO "软件包 $package_name 卸载成功" - } - - # 检查命令参数是否支持 - check_command_option() { - local command=$1 - local option=$2 - $command --help 2>&1 | grep -q "$option" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $command 不支持参数 $option" - exit 255 - fi - LOG_INFO "命令 $command 支持参数 $option" - } - - # 清理函数,用于恢复环境 - cleanup() { - LOG_INFO "开始清理环境" - if [ "$originally_installed" = false ]; then - uninstall_package "gcc" - uninstall_package "liblsan" - fi - if [ -f "leak_program.c" ]; then - rm -f leak_program.c - LOG_INFO "已删除测试程序源文件" - fi - if [ -f "leak_program" ]; then - rm -f leak_program - LOG_INFO "已删除测试程序可执行文件" - fi - LOG_INFO "环境清理完成" - } - - # 主函数 - main() { - # 设置环境变量 - export LD_PRELOAD=/usr/lib64/liblsan.so.0 - export ASAN_OPTIONS=detect_leaks=1 - - # 检查软件包是否已安装 - local originally_installed=true - check_package_exist "gcc" - local gcc_installed=$? - check_package_exist "liblsan" - local liblsan_installed=$? - if [ $gcc_installed -ne 0 ] || [ $liblsan_installed -ne 0 ]; then - originally_installed=false - fi - - # 如果未安装,则安装软件包 - if [ "$originally_installed" = false ]; then - install_package "gcc" - install_package "liblsan" - fi - - # 检查gcc是否支持-fsanitize=leak参数 - LOG_INFO "检查gcc是否支持-fsanitize=leak参数" - check_command_option "gcc" "-fsanitize=leak" - - # 创建内存泄漏测试程序 - LOG_INFO "创建内存泄漏测试程序" - cat > leak_program.c << "EOF" - #include - #include - - void leak_memory() { - int *ptr = malloc(sizeof(int) * 100); - if (ptr == NULL) { - printf("Memory allocation failed\n"); - return; - } - // 故意不释放内存,造成内存泄漏 - printf("Memory allocated but not freed\n"); - } - - int main() { - leak_memory(); - return 0; - } - EOF - - # 编译测试程序,启用LSan检测 - LOG_INFO "编译测试程序,启用LSan检测" - gcc -fsanitize=leak -o leak_program leak_program.c - CHECK_RESULT $? 0 0 "编译测试程序失败" - - # 运行测试程序,检查是否生成泄漏报告 - LOG_INFO "运行测试程序,检查是否生成泄漏报告" - ./leak_program 2>&1 | grep -q "detected memory leaks" - CHECK_RESULT $? 0 0 "未检测到内存泄漏" - - # 检查泄漏报告是否详细 - LOG_INFO "检查泄漏报告是否详细" - ./leak_program 2>&1 | grep -q "leak_program.c" - CHECK_RESULT $? 0 0 "泄漏报告不详细,未显示源代码位置" - - LOG_INFO "测试通过:LSan成功检测到内存泄漏并生成了详细的泄漏报告" - - # 清理环境 - cleanup - } - - # 设置trap,确保脚本退出时清理环境 - trap cleanup EXIT - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_remove_package.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_remove_package.sh deleted file mode 100644 index 4575d7bd94b..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_remove_package.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-28 -# @License : Mulan PSL v2 -# @Desc : 测试通过包管理器安全卸载liblsan软件包的功能,验证卸载过程是否干净且不影响系统其他组件。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="liblsan" - LOG_INFO "步骤1:检查系统中是否已安装${PACKAGE_NAME}软件包" - rpm -q "$PACKAGE_NAME" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "系统中已安装${PACKAGE_NAME}软件包,记录当前状态。结束后将保持安装状态。" - ORIGINAL_STATE="INSTALLED" - else - LOG_INFO "系统中未安装${PACKAGE_NAME}软件包,将在测试前安装它。" - ORIGINAL_STATE="NOT_INSTALLED" - fi - - LOG_INFO "步骤2:检查YUM/DNF源中是否存在${PACKAGE_NAME}软件包" - dnf search "$PACKAGE_NAME" --quiet 2>&1 | grep "^${PACKAGE_NAME}\." > /dev/null - CHECK_RESULT $? 0 0 "YUM/DNF源中未找到${PACKAGE_NAME}软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "指定的软件包 ${PACKAGE_NAME} 在YUM源中不存在。" - exit 255 - fi - - LOG_INFO "步骤3:如果当前未安装,则安装${PACKAGE_NAME}软件包作为测试前提" - if [ "$ORIGINAL_STATE" == "NOT_INSTALLED" ]; then - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - LOG_INFO "成功安装${PACKAGE_NAME}软件包。" - fi - - LOG_INFO "步骤4:验证${PACKAGE_NAME}软件包能否正常卸载(模拟安全卸载)" - rpm -q "$PACKAGE_NAME" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "运行卸载前检查软件包状态失败" - if [ $? -eq 0 ]; then - LOG_INFO "执行dnf remove命令卸载${PACKAGE_NAME}..." - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包过程失败" - LOG_INFO "卸载命令执行完成。" - fi - - LOG_INFO "步骤5:检查卸载后系统是否残留关键文件或目录" - LOG_INFO "检查卸载后${PACKAGE_NAME}软件包状态..." - rpm -q "$PACKAGE_NAME" > /dev/null 2>&1 - if [ $? -eq 1 ]; then - LOG_INFO "软件包卸载成功,rpm查询确认已移除。" - else - LOG_ERROR "软件包卸载后,rpm查询仍然能找到该包,卸载不彻底。" - exit 255 - fi - - LOG_INFO "检查系统是否残留该软件包相关的关键共享库文件..." - find /usr/lib* /lib* -name "*lsan*" 2>/dev/null | head -5 - CHECK_RESULT $? 1 0 "卸载后系统中仍存在liblsan相关的关键库文件残留" - RESIDUAL_FILES=$(find /usr/lib* /lib* -name "*lsan*" 2>/dev/null | wc -l) - if [ "$RESIDUAL_FILES" -ne 0 ]; then - LOG_ERROR "发现${RESIDUAL_FILES}个疑似残留文件,卸载不干净。" - exit 255 - fi - LOG_INFO "未发现明显的软件包关键文件残留。" - - LOG_INFO "步骤6:检查卸载是否影响了系统其他核心组件(如gcc, glibc)" - LOG_INFO "检查gcc是否依然可以正常工作..." - gcc --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}后,gcc命令无法正常执行" - LOG_INFO "检查glibc是否依然可以正常工作..." - ldd --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}后,glibc相关工具(ldd)无法正常执行" - LOG_INFO "系统核心组件gcc和glibc功能正常。" - - LOG_INFO "步骤7:恢复测试环境至初始状态" - if [ "$ORIGINAL_STATE" == "NOT_INSTALLED" ]; then - LOG_INFO "初始状态未安装${PACKAGE_NAME},确认当前已卸载,无需操作。" - else - LOG_INFO "初始状态已安装${PACKAGE_NAME},重新安装以恢复到初始状态。" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "重新安装${PACKAGE_NAME}软件包以恢复环境失败" - LOG_INFO "已成功将${PACKAGE_NAME}软件包恢复到初始安装状态。" - fi - - LOG_INFO "步骤8:最终验证系统状态正常" - dnf check-update --quiet > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "环境恢复后DNF包管理器状态异常" - LOG_INFO "环境清理和恢复完成,系统状态正常。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_runtime_detection.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_runtime_detection.sh deleted file mode 100644 index 8f365bd0bdc..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_runtime_detection.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-28 -# @License : Mulan PSL v2 -# @Desc : 测试一个包含内存泄漏的示例程序在启用LSan(通过环境变量如ASAN_OPTIONS)运行时,是否能被liblsan检测并报告泄漏信息。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试liblsan运行时内存泄漏检测功能" - - LOG_INFO "步骤1: 检查liblsan相关软件包是否已安装" - if rpm -q gcc libasan 2>/dev/null; then - LOG_INFO "liblsan相关软件包已安装,测试后保持安装状态" - INSTALLED=1 - else - LOG_INFO "liblsan相关软件包未安装,将在测试过程中安装" - INSTALLED=0 - fi - - LOG_INFO "步骤2: 检查yum源中是否有需要的软件包" - if ! dnf list available gcc libasan 2>/dev/null | grep -q gcc; then - LOG_ERROR "yum源中缺少gcc软件包" - exit 255 - fi - if ! dnf list available gcc libasan 2>/dev/null | grep -q libasan; then - LOG_ERROR "yum源中缺少libasan软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装liblsan相关软件包" - dnf install -y gcc libasan - CHECK_RESULT $? 0 0 "安装liblsan相关软件包失败" - fi - - LOG_INFO "步骤4: 创建包含内存泄漏的测试程序" - cat > memory_leak.c << "EOF" - #include - #include - - void leak_memory() { - int *ptr = (int*)malloc(100 * sizeof(int)); - if (ptr == NULL) { - printf("内存分配失败\n"); - return; - } - for (int i = 0; i < 100; i++) { - ptr[i] = i; - } - printf("内存已分配但未释放\n"); - } - - int main() { - printf("开始内存泄漏测试程序\n"); - leak_memory(); - printf("程序执行完成\n"); - return 0; - } - EOF - CHECK_RESULT $? 0 0 "创建测试程序失败" - - LOG_INFO "步骤5: 编译测试程序并启用LSan检测" - gcc -fsanitize=address -o memory_leak memory_leak.c - CHECK_RESULT $? 0 0 "编译测试程序失败" - - LOG_INFO "步骤6: 设置LSan环境变量并运行测试程序" - export ASAN_OPTIONS="detect_leaks=1" - LOG_INFO "ASAN_OPTIONS设置为: $ASAN_OPTIONS" - - LOG_INFO "运行测试程序..." - ./memory_leak 2>&1 | tee test_output.log - RUN_RESULT=$? - - LOG_INFO "步骤7: 检查LSan是否检测到内存泄漏" - if grep -q "detected memory leaks" test_output.log; then - LOG_INFO "LSan成功检测到内存泄漏" - LEAK_DETECTED=1 - else - LOG_ERROR "LSan未检测到内存泄漏" - LEAK_DETECTED=0 - fi - - LOG_INFO "步骤8: 验证测试程序执行结果" - if [ $RUN_RESULT -eq 0 ]; then - LOG_INFO "测试程序执行完成" - if [ $LEAK_DETECTED -eq 1 ]; then - LOG_INFO "测试通过:LSan正确检测到内存泄漏" - else - LOG_ERROR "测试失败:程序有内存泄漏但LSan未检测到" - exit 1 - fi - else - LOG_ERROR "测试程序执行失败,退出码: $RUN_RESULT" - exit $RUN_RESULT - fi - - LOG_INFO "步骤9: 清理测试文件" - rm -f memory_leak.c memory_leak test_output.log - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤10: 卸载测试安装的软件包" - dnf remove -y gcc libasan - CHECK_RESULT $? 0 0 "卸载软件包失败" - LOG_INFO "已恢复原始环境状态" - else - LOG_INFO "保持liblsan软件包安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_suppression.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_suppression.sh deleted file mode 100644 index 83be958e578..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_suppression.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-01-29 -# @License : Mulan PSL v2 -# @Desc : 测试使用LSan抑制文件(suppression file)来忽略特定泄漏报告的功能是否正常工作。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试LSan抑制文件功能" - - # 检查yum源中是否存在需要的软件包 - LOG_INFO "检查yum源中是否存在liblsan0软件包" - if ! dnf list available liblsan0 2>/dev/null | grep -q liblsan0; then - LOG_ERROR "yum源中不存在liblsan0软件包" - exit 255 - fi - - # 检查是否已安装liblsan0 - LOG_INFO "检查系统是否已安装liblsan0" - if rpm -q liblsan0 >/dev/null 2>&1; then - already_installed=true - LOG_INFO "liblsan0已安装,测试完成后将保持安装状态" - else - already_installed=false - LOG_INFO "liblsan0未安装,将在测试完成后卸载" - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "安装liblsan0软件包" - dnf install -y liblsan0 - CHECK_RESULT $? 0 0 "安装liblsan0失败" - fi - - # 创建测试程序 - LOG_INFO "创建测试程序" - cat > test_leak.c << "EOF" - #include - #include - - void intentional_leak() { - void *p = malloc(100); - printf("故意泄漏内存: %p\n", p); - } - - void suppressed_leak() { - void *p = malloc(200); - printf("应该被抑制的泄漏: %p\n", p); - } - - int main() { - intentional_leak(); - suppressed_leak(); - return 0; - } - EOF - - # 创建抑制文件 - LOG_INFO "创建LSan抑制文件" - cat > suppression.txt << "EOF" - leak:suppressed_leak - EOF - - # 编译测试程序 - LOG_INFO "编译测试程序" - gcc -fsanitize=address -fno-omit-frame-pointer -o test_leak test_leak.c - CHECK_RESULT $? 0 0 "编译测试程序失败" - - # 测试不带抑制文件的运行 - LOG_INFO "测试不带抑制文件的运行" - output=$(ASAN_OPTIONS=detect_leaks=1 ./test_leak 2>&1) - echo "$output" | grep -q "故意泄漏内存" - CHECK_RESULT $? 0 0 "未检测到故意泄漏" - echo "$output" | grep -q "应该被抑制的泄漏" - CHECK_RESULT $? 0 0 "未检测到应该被抑制的泄漏" - - # 测试带抑制文件的运行 - LOG_INFO "测试带抑制文件的运行" - output=$(ASAN_OPTIONS="detect_leaks=1:suppressions=suppression.txt" ./test_leak 2>&1) - echo "$output" | grep -q "故意泄漏内存" - CHECK_RESULT $? 0 0 "抑制文件运行未检测到故意泄漏" - echo "$output" | grep -q "应该被抑制的泄漏" && { LOG_ERROR "抑制文件未生效"; exit 1; } - CHECK_RESULT $? 1 0 "抑制文件未正确工作" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_leak.c test_leak suppression.txt - - # 如果测试前未安装,则卸载软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "卸载liblsan0软件包" - dnf remove -y liblsan0 - CHECK_RESULT $? 0 0 "卸载liblsan0失败" - fi - - LOG_INFO "LSan抑制文件功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_uninstall.sh b/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_uninstall.sh deleted file mode 100644 index 4c07c45bad9..00000000000 --- a/testcases/function_test/pkg_test/gcc/liblsan/test_liblsan_function_uninstall.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-01-29 -# @License : Mulan PSL v2 -# @Desc : 验证通过包管理器安全卸载liblsan软件包,确保卸载后相关文件被移除且不影响核心系统。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="liblsan" - LOG_INFO "开始测试:验证通过包管理器安全卸载liblsan软件包,确保卸载后相关文件被移除且不影响核心系统。" - LOG_INFO "步骤1:检查yum源中是否存在$PACKAGE_NAME软件包。" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到$PACKAGE_NAME软件包。" - exit 255 - fi - LOG_INFO "步骤2:检查当前环境中$PACKAGE_NAME软件包是否已安装。" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - IS_INSTALLED=$? - if [ $IS_INSTALLED -eq 0 ]; then - LOG_INFO "环境中$PACKAGE_NAME已安装,测试将执行卸载操作,并在结束后重新安装。" - NEED_REINSTALL=1 - else - LOG_INFO "环境中$PACKAGE_NAME未安装,测试将执行安装和卸载操作,并在结束后保持未安装状态。" - NEED_REINSTALL=0 - fi - if [ $NEED_REINSTALL -eq 0 ]; then - LOG_INFO "步骤3:安装$PACKAGE_NAME软件包。" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME软件包失败。" - fi - LOG_INFO "步骤4:验证$PACKAGE_NAME软件包安装成功,相关文件存在。" - rpm -ql $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装后,$PACKAGE_NAME软件包文件列表获取失败。" - LOG_INFO "步骤5:卸载$PACKAGE_NAME软件包。" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME软件包失败。" - LOG_INFO "步骤6:验证$PACKAGE_NAME软件包已被卸载,相关文件已移除。" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 1 0 "卸载后,$PACKAGE_NAME软件包查询仍成功(应失败)。" - LOG_INFO "步骤7:验证核心系统功能未受影响(示例:检查ls命令是否正常)。" - ls / > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载后,核心系统命令ls执行异常。" - if [ $NEED_REINSTALL -eq 1 ]; then - LOG_INFO "步骤8:恢复环境,重新安装$PACKAGE_NAME软件包。" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "重新安装$PACKAGE_NAME软件包失败。" - LOG_INFO "环境已恢复至初始安装状态。" - else - LOG_INFO "步骤8:环境已恢复至初始未安装状态。" - fi - LOG_INFO "测试完成:$PACKAGE_NAME软件包安全卸载验证通过。" -} - -main "$@" \ No newline at end of file From 67e6a049b69bea50ebb3dc988b24836a524243ed Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 15:03:13 +0800 Subject: [PATCH 8/9] update testcase for testsuite python3-versioneer --- .../python-versioneer/python3-versioneer.json | 40 ----- ..._python3-versioneer_function_basic_help.sh | 76 ---------- ...python3-versioneer_function_cmd_version.sh | 83 ---------- ...on3-versioneer_function_package_install.sh | 72 --------- ...hon3-versioneer_function_package_remove.sh | 82 ---------- ...st_python3-versioneer_function_setup_py.sh | 123 --------------- ...thon3-versioneer_function_version_check.sh | 70 --------- ...t_python3-versioneer_versioneer_install.sh | 60 -------- ...n3-versioneer_versioneer_install_vendor.sh | 143 ------------------ 9 files changed, 749 deletions(-) delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_basic_help.sh delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_cmd_version.sh delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_install.sh delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_remove.sh delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_setup_py.sh delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_version_check.sh delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_install.sh delete mode 100644 testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_install_vendor.sh diff --git a/suite2cases/function_test/pkg_test/python-versioneer/python3-versioneer.json b/suite2cases/function_test/pkg_test/python-versioneer/python3-versioneer.json index 9ede54b78e7..61e037fe294 100644 --- a/suite2cases/function_test/pkg_test/python-versioneer/python3-versioneer.json +++ b/suite2cases/function_test/pkg_test/python-versioneer/python3-versioneer.json @@ -2,49 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/python-versioneer/python3-versioneer", "machine num": 1, "cases": [ - { - "name": "test_python3-versioneer_versioneer_install", - "desc": "测试 versioneer install 命令" - }, { "name": "test_python3-versioneer_versioneer_install__vendor", "desc": "测试 versioneer install --vendor 参数" - }, - { - "name": "test_python3-versioneer_versioneer_install__no_vendor", - "desc": "测试 versioneer install --no-vendor 参数" - }, - { - "name": "test_python3-versioneer_function_version_check", - "desc": "测试 versioneer 版本检查功能" - }, - { - "name": "test_python3-versioneer_versioneer_install_vendor", - "desc": "执行 versioneer install --vendor 命令" - }, - { - "name": "test_python3-versioneer_versioneer_install_no_vendor", - "desc": "执行 versioneer install --no-vendor 命令" - }, - { - "name": "test_python3-versioneer_function_package_install", - "desc": "测试python3-versioneer软件包的安装" - }, - { - "name": "test_python3-versioneer_function_package_remove", - "desc": "测试python3-versioneer软件包的卸载" - }, - { - "name": "test_python3-versioneer_function_basic_help", - "desc": "测试versioneer命令基本帮助信息" - }, - { - "name": "test_python3-versioneer_function_cmd_version", - "desc": "测试versioneer命令的版本输出" - }, - { - "name": "test_python3-versioneer_function_setup_py", - "desc": "测试versioneer在setup.py中的集成与版本生成" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_basic_help.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_basic_help.sh deleted file mode 100644 index 3941feaf049..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_basic_help.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-27 -# @License : Mulan PSL v2 -# @Desc : 测试versioneer命令基本帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色变量 - LOG_INFO="echo -e \\033[1;32m[INFO]\\033[0m" - LOG_ERROR="echo -e \\033[1;31m[ERROR]\\033[0m" - - # 定义软件包名称 - PACKAGE_NAME="python3-versioneer" - - # 检查软件包是否已安装 - $LOG_INFO "检查 $PACKAGE_NAME 是否已安装" - if rpm -q $PACKAGE_NAME &>/dev/null; then - $LOG_INFO "$PACKAGE_NAME 已安装" - INSTALLED=true - else - $LOG_INFO "$PACKAGE_NAME 未安装" - INSTALLED=false - fi - - # 检查yum源中是否存在该软件包 - $LOG_INFO "检查yum源中是否存在 $PACKAGE_NAME" - if ! dnf list available $PACKAGE_NAME &>/dev/null; then - $LOG_ERROR "yum源中不存在 $PACKAGE_NAME" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - $LOG_INFO "安装 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - # 测试versioneer命令基本帮助信息 - $LOG_INFO "测试versioneer命令基本帮助信息" - versioneer --help - CHECK_RESULT $? 0 0 "versioneer --help 执行失败" - - # 检查--help参数是否被支持 - $LOG_INFO "检查--help参数是否被支持" - if ! versioneer --help 2>&1 | grep -q "usage"; then - $LOG_ERROR "versioneer命令不支持--help参数" - exit 255 - fi - - # 清理环境:如果之前未安装,则卸载软件包 - 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/python-versioneer/python3-versioneer/test_python3-versioneer_function_cmd_version.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_cmd_version.sh deleted file mode 100644 index 455caf84c93..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_cmd_version.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-27 -# @License : Mulan PSL v2 -# @Desc : 测试versioneer命令的版本输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试versioneer命令的版本输出功能" - LOG_INFO "步骤1: 检查是否已安装python3-versioneer软件包" - rpm -q python3-versioneer > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-versioneer已安装,记录安装状态以便后续恢复" - PYTHON3_VERSIONEER_INSTALLED=true - else - LOG_INFO "python3-versioneer未安装" - PYTHON3_VERSIONEER_INSTALLED=false - fi - - LOG_INFO "步骤2: 检查yum源中是否存在python3-versioneer软件包" - dnf list available python3-versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-versioneer软件包" - exit 255 - fi - - if [ "$PYTHON3_VERSIONEER_INSTALLED" = "false" ]; then - LOG_INFO "步骤3: 安装python3-versioneer软件包" - dnf install -y python3-versioneer - CHECK_RESULT $? 0 0 "安装python3-versioneer失败" - fi - - LOG_INFO "步骤4: 检查versioneer命令是否存在" - which versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "versioneer命令未找到" - if [ "$PYTHON3_VERSIONEER_INSTALLED" = "false" ]; then - dnf remove -y python3-versioneer - fi - exit 1 - fi - - LOG_INFO "步骤5: 检查versioneer命令是否支持version参数" - versioneer --help 2>&1 | grep -q "\-\-version" - if [ $? -ne 0 ]; then - LOG_ERROR "versioneer命令不支持--version参数" - if [ "$PYTHON3_VERSIONEER_INSTALLED" = "false" ]; then - dnf remove -y python3-versioneer - fi - exit 255 - fi - - LOG_INFO "步骤6: 执行versioneer --version命令" - versioneer --version - CHECK_RESULT $? 0 0 "执行versioneer --version命令失败" - - LOG_INFO "步骤7: 清理测试环境" - if [ "$PYTHON3_VERSIONEER_INSTALLED" = "false" ]; then - LOG_INFO "卸载测试安装的python3-versioneer软件包" - dnf remove -y python3-versioneer - CHECK_RESULT $? 0 0 "卸载python3-versioneer失败" - else - LOG_INFO "保持原有的python3-versioneer安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_install.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_install.sh deleted file mode 100644 index e19a1b94ec4..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_install.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-27 -# @License : Mulan PSL v2 -# @Desc : 测试python3-versioneer软件包的安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-versioneer软件包的安装" - LOG_INFO "检查yum源中是否存在python3-versioneer软件包" - dnf list available python3-versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-versioneer软件包" - exit 255 - fi - - LOG_INFO "检查当前环境是否已安装python3-versioneer" - rpm -q python3-versioneer > /dev/null 2>&1 - installed=$? - - if [ $installed -eq 0 ]; then - LOG_INFO "环境已安装python3-versioneer,测试将保持安装状态" - need_cleanup=0 - else - LOG_INFO "环境未安装python3-versioneer,将进行安装测试" - need_cleanup=1 - fi - - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "安装python3-versioneer软件包" - dnf install -y python3-versioneer - CHECK_RESULT $? 0 0 "安装python3-versioneer失败" - - LOG_INFO "验证python3-versioneer安装成功" - rpm -q python3-versioneer - CHECK_RESULT $? 0 0 "验证python3-versioneer安装失败" - fi - - LOG_INFO "测试python3-versioneer基本功能" - python3 -m versioneer --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "python3-versioneer基本功能测试失败" - - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "清理测试环境,卸载python3-versioneer" - dnf remove -y python3-versioneer - CHECK_RESULT $? 0 0 "卸载python3-versioneer失败" - - LOG_INFO "验证python3-versioneer已卸载" - rpm -q python3-versioneer > /dev/null 2>&1 - CHECK_RESULT $? 1 0 "验证python3-versioneer卸载失败" - else - LOG_INFO "保持python3-versioneer安装状态,无需清理" - fi - - LOG_INFO "python3-versioneer软件包安装测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_remove.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_remove.sh deleted file mode 100644 index 9f008ececdb..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_package_remove.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-27 -# @License : Mulan PSL v2 -# @Desc : 测试python3-versioneer软件包的卸载 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-versioneer软件包的卸载" - - # 检查软件包是否在yum源中 - LOG_INFO "检查python3-versioneer软件包是否在yum源中" - dnf list available python3-versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到python3-versioneer软件包" - exit 255 - fi - - # 检查当前是否已安装python3-versioneer - LOG_INFO "检查当前是否已安装python3-versioneer" - rpm -q python3-versioneer > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-versioneer已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-versioneer未安装,将在测试前安装" - INSTALLED=false - fi - - # 如果未安装,则先安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装python3-versioneer软件包" - dnf install -y python3-versioneer - CHECK_RESULT $? 0 0 "安装python3-versioneer失败" - fi - - # 执行卸载测试 - LOG_INFO "开始卸载python3-versioneer软件包" - dnf remove -y python3-versioneer - CHECK_RESULT $? 0 0 "卸载python3-versioneer失败" - - # 验证卸载是否成功 - LOG_INFO "验证python3-versioneer是否已卸载" - rpm -q python3-versioneer > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "python3-versioneer卸载后仍然存在" - CHECK_RESULT 1 0 0 "卸载验证失败" - else - LOG_INFO "python3-versioneer已成功卸载" - fi - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ "$INSTALLED" = false ]; then - LOG_INFO "恢复环境:卸载测试安装的python3-versioneer" - # 由于上一步已经卸载,这里不需要再执行卸载操作 - LOG_INFO "环境已恢复到测试前状态" - else - LOG_INFO "恢复环境:重新安装python3-versioneer" - dnf install -y python3-versioneer - CHECK_RESULT $? 0 0 "恢复环境时重新安装python3-versioneer失败" - LOG_INFO "环境已恢复到测试前状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_setup_py.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_setup_py.sh deleted file mode 100644 index 9cdf29c0b34..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_setup_py.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-27 -# @License : Mulan PSL v2 -# @Desc : 测试versioneer在setup.py中的集成与版本生成 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装python3-versioneer - LOG_INFO "检查环境是否已安装python3-versioneer" - rpm -qa | grep -q python3-versioneer - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装python3-versioneer,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "环境未安装python3-versioneer,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有python3-versioneer软件包 - LOG_INFO "检查yum源中是否有python3-versioneer软件包" - dnf list available python3-versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有python3-versioneer软件包" - exit 255 - fi - - # 如果未安装,则安装python3-versioneer - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-versioneer" - dnf install -y python3-versioneer - CHECK_RESULT $? 0 0 "安装python3-versioneer失败" - fi - - # 创建测试目录 - LOG_INFO "创建测试目录" - mkdir -p /tmp/test_versioneer - cd /tmp/test_versioneer - - # 初始化git仓库 - LOG_INFO "初始化git仓库" - git init - CHECK_RESULT $? 0 0 "初始化git仓库失败" - - # 创建初始提交 - LOG_INFO "创建初始提交" - echo "test" > README.md - git add . - git config --global user.email "test@example.com" - git config --global user.name "Test User" - git commit -m "Initial commit" - CHECK_RESULT $? 0 0 "创建初始提交失败" - - # 创建setup.py文件 - LOG_INFO "创建setup.py文件" - cat > setup.py << "EOF" - from setuptools import setup - import versioneer - - setup( - name="test-package", - version=versioneer.get_version(), - cmdclass=versioneer.get_cmdclass(), - ) - EOF - CHECK_RESULT $? 0 0 "创建setup.py文件失败" - - # 初始化versioneer - LOG_INFO "初始化versioneer" - versioneer install - CHECK_RESULT $? 0 0 "初始化versioneer失败" - - # 检查versioneer是否成功集成到setup.py - LOG_INFO "检查versioneer是否成功集成到setup.py" - grep -q "versioneer" setup.py - CHECK_RESULT $? 0 0 "versioneer未成功集成到setup.py" - - # 生成版本号 - LOG_INFO "生成版本号" - python3 setup.py --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "生成版本号失败" - - # 创建git标签 - LOG_INFO "创建git标签" - git tag v1.0.0 - CHECK_RESULT $? 0 0 "创建git标签失败" - - # 再次生成版本号,检查是否包含标签信息 - LOG_INFO "再次生成版本号,检查是否包含标签信息" - VERSION=$(python3 setup.py --version) - echo $VERSION | grep -q "1.0.0" - CHECK_RESULT $? 0 0 "版本号不包含标签信息" - - # 清理测试目录 - LOG_INFO "清理测试目录" - cd / - rm -rf /tmp/test_versioneer - - # 如果测试前未安装,则卸载python3-versioneer - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-versioneer" - dnf remove -y python3-versioneer - CHECK_RESULT $? 0 0 "卸载python3-versioneer失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_version_check.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_version_check.sh deleted file mode 100644 index 4a71245b758..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_function_version_check.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-07 -# @License : Mulan PSL v2 -# @Desc : 测试 versioneer 版本检查功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试 versioneer 版本检查功能 - - LOG_INFO "开始测试 versioneer 版本检查功能" - - # 检查是否已安装 python3-versioneer - LOG_INFO "检查是否已安装 python3-versioneer" - dnf list installed python3-versioneer > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-versioneer 已安装,脚本结束时将保持安装状态" - installed=true - else - LOG_INFO "python3-versioneer 未安装,将在测试结束后卸载" - installed=false - fi - - # 检查 yum 源中是否有 python3-versioneer - LOG_INFO "检查 yum 源中是否有 python3-versioneer" - dnf list available python3-versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 python3-versioneer" - exit 255 - fi - - # 安装 python3-versioneer - if [ "$installed" = false ]; then - LOG_INFO "开始安装 python3-versioneer" - dnf install -y python3-versioneer > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 python3-versioneer 失败" - fi - - # 测试 versioneer 版本检查功能 - LOG_INFO "测试 versioneer 版本检查功能" - versioneer --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "versioneer 版本检查失败" - - #清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载 python3-versioneer" - dnf remove -y python3-versioneer > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 python-verseioneere失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_install.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_install.sh deleted file mode 100644 index 653749165bb..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_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-12-07 -# @License : Mulan PSL v2 -# @Desc : 测试 versioneer install 命令 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装python3-versioneer-versioneer - LOG_INFO "检查是否已安装python3-versioneer-versioneer" - if dnf list installed python3-versioneer-versioneer &>/dev/null; then - LOG_INFO "python3-versioneer-versioneer已安装,脚本结束后保持安装状态" - installed=true - else - LOG_INFO "python3-versioneer-versioneer未安装,将在测试后卸载" - installed=false - fi - - # 检查yum源中是否存在python3-versioneer-versioneer软件包 - LOG_INFO "检查yum源中是否存在python3-versioneer-versioneer软件包" - if ! dnf list available python3-versioneer-versioneer &>/dev/null; then - LOG_ERROR "yum源中未找到python3-versioneer-versioneer软件包" - exit 255 - fi - - # 安装python3-versioneer-versioneer软件包 - if [ "$installed" = false ]; then - LOG_INFO "开始安装python3-versioneer-versioneer软件包" - dnf install -y python3-versioneer-versioneer - CHECK_RESULT $? 0 0 "安装python3-versioneerversio失败" - fi - - # 测试versioinstall命令 - LOG_INFO "测试versioinstall命令" - versioinstall --help &>/dev/null - CHECK_RESULT $? 0 0 "versioinstall命令不支持或参数错误" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3versioware软件包" - dnf remove -y pythonversioware - CHECK_RESULT $?00"卸载pythonversioware失败" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_install_vendor.sh b/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_install_vendor.sh deleted file mode 100644 index bdfa8e38642..00000000000 --- a/testcases/function_test/pkg_test/python-versioneer/python3-versioneer/test_python3-versioneer_versioneer_install_vendor.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-27 -# @License : Mulan PSL v2 -# @Desc : 执行 versioneer install --vendor 命令 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装python3-versioneer - LOG_INFO "检查是否已安装python3-versioneer" - rpm -q python3-versioneer > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-versioneer已安装,记录安装状态" - installed=true - else - LOG_INFO "python3-versioneer未安装,记录安装状态" - installed=false - fi - - # 检查yum源中是否有python3-versioneer软件包 - LOG_INFO "检查yum源中是否有python3-versioneer软件包" - dnf list available python3-versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-versioneer软件包" - exit 255 - fi - - # 如果未安装,则安装python3-versioneer - if [ "$installed" = false ]; then - LOG_INFO "安装python3-versioneer软件包" - dnf install -y python3-versioneer - CHECK_RESULT $? 0 0 "安装python3-versioneer失败" - fi - - # 检查versioneer命令是否存在 - LOG_INFO "检查versioneer命令是否存在" - command -v versioneer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "versioneer命令不存在" - # 如果之前未安装,需要卸载已安装的软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-versioneer软件包" - dnf remove -y python3-versioneer - fi - exit 255 - fi - - # 检查versioneer install命令是否支持--vendor参数 - LOG_INFO "检查versioneer install命令是否支持--vendor参数" - versioneer install --help 2>&1 | grep -q "\-\-vendor" - if [ $? -ne 0 ]; then - LOG_ERROR "versioneer install命令不支持--vendor参数" - # 如果之前未安装,需要卸载已安装的软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-versioneer软件包" - dnf remove -y python3-versioneer - fi - exit 255 - fi - - # 创建测试目录 - LOG_INFO "创建测试目录" - test_dir="/tmp/test_versioneer_$(date +%s)" - mkdir -p "$test_dir" - CHECK_RESULT $? 0 0 "创建测试目录失败" - cd "$test_dir" || exit 1 - - # 初始化git仓库(versioneer需要git仓库) - LOG_INFO "初始化git仓库" - git init - CHECK_RESULT $? 0 0 "初始化git仓库失败" - git config user.email "test@example.com" - git config user.name "Test User" - - # 创建测试Python项目 - LOG_INFO "创建测试Python项目" - cat > setup.py << EOF - from setuptools import setup - setup( - name="test_project", - version="0.1.0", - ) - EOF - - cat > test_project.py << EOF - def hello(): - return "Hello, World!" - EOF - - git add . - git commit -m "Initial commit" - - # 执行versioneer install --vendor命令 - LOG_INFO "执行versioneer install --vendor命令" - versioneer install --vendor - CHECK_RESULT $? 0 0 "执行versioneer install --vendor命令失败" - - # 检查是否生成了versioneer.py文件 - LOG_INFO "检查是否生成了versioneer.py文件" - if [ -f "versioneer.py" ]; then - LOG_INFO "versioneer.py文件已生成" - else - LOG_ERROR "versioneer.py文件未生成" - # 清理测试目录 - cd /tmp && rm -rf "$test_dir" - # 如果之前未安装,需要卸载已安装的软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-versioneer软件包" - dnf remove -y python3-versioneer - fi - exit 1 - fi - - # 清理测试目录 - LOG_INFO "清理测试目录" - cd /tmp && rm -rf "$test_dir" - CHECK_RESULT $? 0 0 "清理测试目录失败" - - # 如果测试开始时未安装,则卸载python3-versioneer - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-versioneer软件包" - dnf remove -y python3-versioneer - CHECK_RESULT $? 0 0 "卸载python3-versioneer失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file From 3cf45f6a1f8bee887c7e43220b4f6254fd984e40 Mon Sep 17 00:00:00 2001 From: honghua Date: Fri, 17 Apr 2026 15:03:45 +0800 Subject: [PATCH 9/9] update testcase for testsuite maven-monitor --- .../pkg_test/maven2/maven-monitor.json | 4 -- .../test_maven-monitor_function_start.sh | 68 ------------------- 2 files changed, 72 deletions(-) delete mode 100644 testcases/function_test/pkg_test/maven2/maven-monitor/test_maven-monitor_function_start.sh diff --git a/suite2cases/function_test/pkg_test/maven2/maven-monitor.json b/suite2cases/function_test/pkg_test/maven2/maven-monitor.json index f76abde87a0..a11c69b5193 100644 --- a/suite2cases/function_test/pkg_test/maven2/maven-monitor.json +++ b/suite2cases/function_test/pkg_test/maven2/maven-monitor.json @@ -6,10 +6,6 @@ "name": "test_maven-monitor_install", "desc": "测试maven-monitor软件包的安装功能,验证安装过程是否正常完成。", "machine num": 1 - }, - { - "name": "test_maven-monitor_function_start", - "desc": "测试maven-monitor软件包的启动功能,验证启动过程是否正常完成。" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/maven2/maven-monitor/test_maven-monitor_function_start.sh b/testcases/function_test/pkg_test/maven2/maven-monitor/test_maven-monitor_function_start.sh deleted file mode 100644 index fecf32cbab9..00000000000 --- a/testcases/function_test/pkg_test/maven2/maven-monitor/test_maven-monitor_function_start.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-12 -# @License : Mulan PSL v2 -# @Desc : 测试maven-monitor软件包的启动功能,验证启动过程是否正常完成。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试maven-monitor软件包的启动功能" - - # 检查yum源中是否存在maven-monitor软件包 - LOG_INFO "检查yum源中是否存在maven-monitor软件包" - dnf list available maven-monitor > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到maven-monitor软件包" - exit 255 - fi - - # 检查是否已安装maven-monitor - LOG_INFO "检查是否已安装maven-monitor" - rpm -q maven-monitor > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "maven-monitor已安装,跳过安装步骤" - installed=true - else - LOG_INFO "maven-monitor未安装,开始安装" - dnf install -y maven-monitor - CHECK_RESULT $? 0 0 "安装maven-monitor失败" - installed=false - fi - - # 验证启动功能 - LOG_INFO "验证maven-monitor启动功能" - systemctl start maven-monitor - CHECK_RESULT $? 0 0 "启动maven-monitor失败" - - # 检查服务状态 - LOG_INFO "检查maven-monitor服务状态" - systemctl status maven-monitor > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "maven-monitor服务未正常运行" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "清理环境:卸载maven-monitor" - dnf remove -y maven-monitor - CHECK_RESULT $? 0 0 "卸载maven-monitor失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file