This commit is contained in:
2026-04-24 07:38:53 +08:00
35 changed files with 0 additions and 2433 deletions

View File

@@ -17,18 +17,6 @@
{
"name": "test_dracut-caps_function_remove",
"desc": "Test the removal (uninstallation) process of the dracut-caps package."
},
{
"name": "test_dracut-caps_function_install",
"desc": "Test the initial installation process of the dracut-caps package."
},
{
"name": "test_dracut-caps_function_check",
"desc": "Test if the dracut-caps package is properly installed on the system."
},
{
"name": "test_dracut-caps_function_upgrade",
"desc": "Test upgrading the dracut-caps package to a newer version."
}
]
}

View File

@@ -2,37 +2,9 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/gcc/gcc-plugin-devel",
"machine num": 1,
"cases": [
{
"name": "test_gcc-plugin-devel_install",
"desc": "测试gcc-plugin-devel软件包是否能够成功安装"
},
{
"name": "test_gcc-plugin-devel_query",
"desc": "测试查询gcc-plugin-devel软件包的版本和详细信息"
},
{
"name": "test_gcc-plugin-devel_headers",
"desc": "测试gcc-plugin-devel的头文件是否存在"
},
{
"name": "test_gcc-plugin-devel_uninstall",
"desc": "测试gcc-plugin-devel软件包是否能够成功卸载"
},
{
"name": "test_gcc-plugin-devel_function_compile_plugin",
"desc": "测试使用gcc-plugin-devel编译一个简单的GCC插件"
},
{
"name": "test_gcc-plugin-devel_function_link_plugin",
"desc": "测试GCC插件能否被正确链接和加载"
},
{
"name": "test_gcc-plugin-devel_function_plugin_api",
"desc": "测试核心GCC插件API如gcc_plugin_info的可用性"
},
{
"name": "test_gcc-plugin-devel_function_pkg_config",
"desc": "测试pkg-config能否正确提供插件的编译和链接标志"
}
]
}

View File

@@ -5,10 +5,6 @@
{
"name": "test_jmh-generator-asm_function_install",
"desc": "Test the installation of jmh-generator-asm package"
},
{
"name": "test_jmh-generator-asm_function_generate",
"desc": "Test the code generation functionality of jmh-generator-asm"
}
]
}

View File

@@ -6,10 +6,6 @@
"name": "test_mybatis-javadoc_install",
"desc": "测试mybatis-javadoc软件包的安装功能",
"machine num": 1
},
{
"name": "test_mybatis-javadoc_function_generate",
"desc": "测试mybatis-javadoc生成文档功能"
}
]
}

View File

@@ -17,10 +17,6 @@
{
"name": "test_perl-Math-BigInt-help_function_help",
"desc": "测试软件包提供的帮助文档或命令是否可用,验证能获取使用说明"
},
{
"name": "test_perl-Math-BigInt-help_function_basic",
"desc": "测试软件包作为基础依赖库,验证其核心文件是否存在且可访问"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-g/texlive-dice",
"machine num": 1,
"cases": [
{
"name": "test_texlive-dice_function_install",
"desc": "Test installation of texlive-dice package"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-r/texlive-picinpar-doc",
"machine num": 1,
"cases": [
{
"name": "test_texlive-picinpar-doc_function_basic",
"desc": "Basic functionality test for texlive-picinpar-doc"
}
]
}

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-simurgh",
"machine num": 1,
"cases": [
{
"name": "test_texlive-simurgh_function_install",
"desc": "Verify package installation"
},
{
"name": "test_texlive-simurgh_function_uninstall",
"desc": "Verify package removal"
@@ -14,17 +10,9 @@
"name": "test_texlive-simurgh_function_version",
"desc": "Check package version info"
},
{
"name": "test_texlive-simurgh_function_list_files",
"desc": "List files provided by package"
},
{
"name": "test_texlive-simurgh_function_doc_exist",
"desc": "Check if documentation exists"
},
{
"name": "test_texlive-simurgh_function_use_style",
"desc": "Test basic usage of simurgh style"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-smalltableof-doc",
"machine num": 1,
"cases": [
{
"name": "test_texlive-smalltableof-doc_function_basic",
"desc": "Test basic functionality of texlive-smalltableof-doc"
}
]
}

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-inter",
"machine num": 1,
"cases": [
{
"name": "test_texlive-inter_function_font",
"desc": "Test font rendering functionality"
},
{
"name": "test_texlive-inter_function_install",
"desc": "Test if the texlive-inter package can be successfully installed."
@@ -13,26 +9,6 @@
{
"name": "test_texlive-inter_function_uninstall",
"desc": "Test if the texlive-inter package can be completely uninstalled."
},
{
"name": "test_texlive-inter_function_verify",
"desc": "Test if the texlive-inter package is correctly installed and available."
},
{
"name": "test_texlive-inter_function_basic_usage",
"desc": "Test basic LaTeX document compilation using the inter package."
},
{
"name": "test_texlive-inter_function_font_switch",
"desc": "Test switching to and from the inter font family in a document."
},
{
"name": "test_texlive-inter_function_scale",
"desc": "Test the font scaling options provided by the inter package."
},
{
"name": "test_texlive-inter_function_opentype",
"desc": "Test loading and using OpenType/TrueType fonts via the inter package."
}
]
}

View File

@@ -1,67 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-07
# @License : Mulan PSL v2
# @Desc : Test if the dracut-caps package is properly installed on the system.
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "测试开始检查dracut-caps软件包是否正确安装"
LOG_INFO "步骤1检查yum源中是否存在dracut-caps软件包"
if ! dnf list available dracut-caps &>/dev/null; then
LOG_ERROR "yum源中未找到dracut-caps软件包"
exit 255
fi
LOG_INFO "步骤2检查系统是否已安装dracut-caps"
if rpm -q dracut-caps &>/dev/null; then
LOG_INFO "dracut-caps已安装跳过安装步骤"
INSTALLED=true
else
LOG_INFO "dracut-caps未安装开始安装"
dnf install -y dracut-caps
CHECK_RESULT $? 0 0 "安装dracut-caps失败"
INSTALLED=false
fi
LOG_INFO "步骤3验证dracut-caps命令是否可用"
if ! command -v dracut-caps &>/dev/null; then
LOG_ERROR "dracut-caps命令不存在"
exit 255
fi
LOG_INFO "步骤4检查dracut-caps命令参数支持"
dracut-caps --help &>/dev/null
CHECK_RESULT $? 0 0 "dracut-caps命令参数不支持或执行失败"
LOG_INFO "步骤5执行dracut-caps基本功能测试"
dracut-caps --version
CHECK_RESULT $? 0 0 "获取dracut-caps版本信息失败"
LOG_INFO "步骤6清理环境"
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载测试安装的dracut-caps软件包"
dnf remove -y dracut-caps
CHECK_RESULT $? 0 0 "卸载dracut-caps失败"
else
LOG_INFO "保持原有安装状态不卸载dracut-caps"
fi
LOG_INFO "测试结束dracut-caps软件包安装和基本功能检查完成"
}
main "$@"

View File

@@ -1,118 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-07
# @License : Mulan PSL v2
# @Desc : Test the initial installation process of the dracut-caps package.
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否以root权限运行
if [[ $EUID -ne 0 ]]; then
LOG_ERROR "此脚本需要root权限运行"
exit 1
fi
LOG_INFO "开始测试dracut-caps包的初始安装过程"
# 定义软件包名称
PACKAGE_NAME="dracut-caps"
# 步骤1检查软件包是否已在系统中安装
LOG_INFO "步骤1检查系统是否已安装${PACKAGE_NAME}"
if dnf list installed "${PACKAGE_NAME}" &>/dev/null; then
LOG_INFO "${PACKAGE_NAME}已安装,脚本结束时将保持安装状态"
ALREADY_INSTALLED=true
else
LOG_INFO "${PACKAGE_NAME}未安装,将作为测试步骤安装"
ALREADY_INSTALLED=false
fi
# 步骤2检查yum源中是否有该软件包
LOG_INFO "步骤2检查yum源中是否有${PACKAGE_NAME}软件包"
if ! dnf list available "${PACKAGE_NAME}" &>/dev/null; then
LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包"
exit 255
fi
LOG_INFO "yum源中找到${PACKAGE_NAME}软件包"
# 步骤3检查dracut命令是否支持--caps参数
LOG_INFO "步骤3检查dracut命令是否支持--caps参数"
if ! dracut --help 2>&1 | grep -q -- "--caps"; then
LOG_ERROR "dracut命令不支持--caps参数"
exit 255
fi
LOG_INFO "dracut命令支持--caps参数"
# 步骤4如果未安装则安装软件包
if [[ "${ALREADY_INSTALLED}" == "false" ]]; then
LOG_INFO "步骤4安装${PACKAGE_NAME}软件包"
dnf install -y "${PACKAGE_NAME}"
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败"
LOG_INFO "成功安装${PACKAGE_NAME}软件包"
fi
# 步骤5验证安装后dracut命令功能
LOG_INFO "步骤5验证dracut命令功能"
dracut --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "dracut命令执行失败"
# 步骤6测试dracut-caps的基本功能
LOG_INFO "步骤6测试dracut-caps基本功能"
# 创建一个临时initramfs文件进行测试
TEMP_INITRAMFS="/tmp/test-initramfs-$$.img"
TEMP_KERNEL_VERSION=$(uname -r)
dracut --caps --force "${TEMP_INITRAMFS}" "${TEMP_KERNEL_VERSION}" 2>&1
DRACUT_RESULT=$?
# 检查dracut命令是否成功执行
if [[ ${DRACUT_RESULT} -eq 0 ]]; then
LOG_INFO "dracut --caps命令成功执行"
# 检查生成的initramfs文件是否存在
if [[ -f "${TEMP_INITRAMFS}" ]]; then
LOG_INFO "成功生成initramfs文件${TEMP_INITRAMFS}"
# 清理临时文件
rm -f "${TEMP_INITRAMFS}"
else
LOG_ERROR "未找到生成的initramfs文件"
fi
else
LOG_ERROR "dracut --caps命令执行失败退出码${DRACUT_RESULT}"
# 清理可能的临时文件
rm -f "${TEMP_INITRAMFS}"
exit ${DRACUT_RESULT}
fi
# 步骤7环境清理
LOG_INFO "步骤7清理测试环境"
# 清理临时文件
rm -f "${TEMP_INITRAMFS}"
# 如果测试前未安装,则在测试后卸载软件包
if [[ "${ALREADY_INSTALLED}" == "false" ]]; then
LOG_INFO "卸载${PACKAGE_NAME}软件包"
dnf remove -y "${PACKAGE_NAME}"
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败"
LOG_INFO "成功卸载${PACKAGE_NAME}软件包"
else
LOG_INFO "保持${PACKAGE_NAME}软件包的安装状态"
fi
LOG_INFO "dracut-caps包初始安装过程测试完成"
}
main "$@"

View File

@@ -1,120 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-07
# @License : Mulan PSL v2
# @Desc : Test upgrading the dracut-caps package to a newer version.
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否以root用户运行
if [[ $EUID -ne 0 ]]; then
LOG_ERROR "此脚本必须以root用户权限运行"
exit 1
fi
# 定义软件包名称
PACKAGE_NAME="dracut-caps"
# 步骤1: 检查yum源中是否存在dracut-caps软件包
LOG_INFO "步骤1: 检查yum源中是否存在${PACKAGE_NAME}软件包"
dnf list available ${PACKAGE_NAME} &> /dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包"
exit 255
fi
# 步骤2: 检查当前是否已安装dracut-caps
LOG_INFO "步骤2: 检查当前是否已安装${PACKAGE_NAME}"
rpm -q ${PACKAGE_NAME} &> /dev/null
if [ $? -eq 0 ]; then
ALREADY_INSTALLED=1
LOG_INFO "${PACKAGE_NAME}已安装,测试结束后将保持安装状态"
else
ALREADY_INSTALLED=0
LOG_INFO "${PACKAGE_NAME}未安装,将作为测试步骤安装"
fi
# 步骤3: 检查升级命令参数是否支持
LOG_INFO "步骤3: 检查dnf升级命令参数"
dnf upgrade --help | grep -q "\-\-nobest"
if [ $? -ne 0 ]; then
LOG_ERROR "dnf upgrade命令不支持--nobest参数"
exit 255
fi
# 步骤4: 获取当前安装的版本(如果已安装)
if [ ${ALREADY_INSTALLED} -eq 1 ]; then
LOG_INFO "步骤4: 获取当前安装的版本"
CURRENT_VERSION=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}" ${PACKAGE_NAME})
CHECK_RESULT $? 0 0 "获取当前版本失败"
LOG_INFO "当前安装版本: ${CURRENT_VERSION}"
fi
# 步骤5: 检查可用的最新版本
LOG_INFO "步骤5: 检查可用的最新版本"
AVAILABLE_VERSION=$(dnf list available ${PACKAGE_NAME} | grep ${PACKAGE_NAME} | awk "{print $2}")
CHECK_RESULT $? 0 0 "检查可用版本失败"
LOG_INFO "可用最新版本: ${AVAILABLE_VERSION}"
# 步骤6: 如果未安装,则安装软件包
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "步骤6: 安装${PACKAGE_NAME}软件包"
dnf install -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败"
LOG_INFO "成功安装${PACKAGE_NAME}"
fi
# 步骤7: 执行软件包升级测试
LOG_INFO "步骤7: 执行${PACKAGE_NAME}软件包升级测试"
dnf upgrade -y --nobest ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "${PACKAGE_NAME}升级失败"
# 步骤8: 验证升级后的版本
LOG_INFO "步骤8: 验证升级后的版本"
UPGRADED_VERSION=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}" ${PACKAGE_NAME})
CHECK_RESULT $? 0 0 "获取升级后版本失败"
if [ ${ALREADY_INSTALLED} -eq 1 ]; then
if [ "${CURRENT_VERSION}" != "${UPGRADED_VERSION}" ]; then
LOG_INFO "版本已从${CURRENT_VERSION}升级到${UPGRADED_VERSION}"
else
LOG_INFO "版本未变化,当前已是最新版本${UPGRADED_VERSION}"
fi
else
LOG_INFO "新安装版本: ${UPGRADED_VERSION}"
fi
# 步骤9: 验证软件包功能
LOG_INFO "步骤9: 验证${PACKAGE_NAME}基本功能"
rpm -V ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "${PACKAGE_NAME}验证失败"
# 步骤10: 清理环境
LOG_INFO "步骤10: 清理测试环境"
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "卸载测试安装的${PACKAGE_NAME}软件包"
dnf remove -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败"
LOG_INFO "成功卸载${PACKAGE_NAME},环境已恢复"
else
LOG_INFO "保持${PACKAGE_NAME}安装状态,版本为${UPGRADED_VERSION}"
fi
LOG_INFO "测试完成: ${PACKAGE_NAME}软件包升级功能测试通过"
}
main "$@"

View File

@@ -1,94 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-03
# @License : Mulan PSL v2
# @Desc : 测试使用gcc-plugin-devel编译一个简单的GCC插件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试gcc-plugin-devel插件编译功能"
# 检查yum源中是否存在gcc-plugin-devel软件包
LOG_INFO "检查yum源中是否存在gcc-plugin-devel软件包"
dnf list available gcc-plugin-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中不存在gcc-plugin-devel软件包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在gcc-plugin-devel软件包"
exit 255
fi
# 检查是否已安装gcc-plugin-devel
LOG_INFO "检查是否已安装gcc-plugin-devel"
if rpm -q gcc-plugin-devel > /dev/null 2>&1; then
LOG_INFO "gcc-plugin-devel已安装测试结束后将保持安装状态"
already_installed=true
else
LOG_INFO "gcc-plugin-devel未安装将在测试过程中安装"
already_installed=false
fi
# 如果未安装则安装gcc-plugin-devel
if [ "$already_installed" = false ]; then
LOG_INFO "安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "安装gcc-plugin-devel失败"
fi
# 创建一个简单的GCC插件源代码
LOG_INFO "创建简单的GCC插件源代码"
cat > test_plugin.c << "EOF"
#include <gcc-plugin.h>
#include <plugin-version.h>
#include <tree-pass.h>
int plugin_is_GPL_compatible;
int plugin_init(struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
if (!plugin_default_version_check(version, &gcc_version))
return 1;
printf("Hello from GCC plugin!\n");
return 0;
}
EOF
# 编译GCC插件
LOG_INFO "编译GCC插件"
gcc -fPIC -shared test_plugin.c -o test_plugin.so -I/usr/include `gcc -print-file-name=plugin`/include
CHECK_RESULT $? 0 0 "编译GCC插件失败"
# 测试插件是否能被GCC加载
LOG_INFO "测试GCC插件加载"
gcc -fplugin=./test_plugin.so -c -x c /dev/null -o /dev/null 2>&1 | grep -q "Hello from GCC plugin"
CHECK_RESULT $? 0 0 "GCC插件加载失败"
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_plugin.c test_plugin.so
# 如果测试前未安装则卸载gcc-plugin-devel
if [ "$already_installed" = false ]; then
LOG_INFO "卸载gcc-plugin-devel软件包"
dnf remove -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "卸载gcc-plugin-devel失败"
fi
LOG_INFO "gcc-plugin-devel插件编译功能测试完成"
}
main "$@"

View File

@@ -1,91 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-03
# @License : Mulan PSL v2
# @Desc : 测试GCC插件能否被正确链接和加载
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 判断是否已安装gcc-plugin-devel软件包
LOG_INFO "检查是否已安装gcc-plugin-devel软件包"
if dnf list installed gcc-plugin-devel &>/dev/null; then
LOG_INFO "gcc-plugin-devel软件包已安装"
INSTALLED_BEFORE_TEST=true
else
LOG_INFO "gcc-plugin-devel软件包未安装"
INSTALLED_BEFORE_TEST=false
fi
# 检查yum源中是否存在gcc-plugin-devel软件包
LOG_INFO "检查yum源中是否存在gcc-plugin-devel软件包"
if ! dnf list available gcc-plugin-devel &>/dev/null; then
LOG_ERROR "yum源中不存在gcc-plugin-devel软件包"
exit 255
fi
# 如果未安装则安装软件包
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "安装gcc-plugin-devel软件包失败"
fi
# 测试GCC插件能否被正确链接和加载
LOG_INFO "测试GCC插件能否被正确链接和加载"
# 创建测试插件源文件
LOG_INFO "创建测试插件源文件"
cat > test_plugin.c << "EOF"
#include <stdio.h>
#include <gcc-plugin.h>
int plugin_is_GPL_compatible;
int plugin_init(struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
printf("GCC插件加载成功\n");
return 0;
}
EOF
# 编译测试插件
LOG_INFO "编译测试插件"
gcc -fPIC -shared -I/usr/lib/gcc/$(uname -m)-linux-gnu/$(gcc -dumpversion)/plugin/include \
-o test_plugin.so test_plugin.c
CHECK_RESULT $? 0 0 "编译GCC插件失败"
# 测试插件加载
LOG_INFO "测试GCC插件加载"
gcc -fplugin=./test_plugin.so -c -x c /dev/null -o /dev/null 2>&1 | grep -q "GCC插件加载成功"
CHECK_RESULT $? 0 0 "GCC插件加载失败"
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_plugin.c test_plugin.so
# 如果测试前未安装,则卸载软件包
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "卸载gcc-plugin-devel软件包"
dnf remove -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "卸载gcc-plugin-devel软件包失败"
fi
LOG_INFO "GCC插件链接和加载测试完成"
}
main "$@"

View File

@@ -1,129 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-03
# @License : Mulan PSL v2
# @Desc : 测试pkg-config能否正确提供插件的编译和链接标志
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义日志函数
LOG_INFO() {
echo "[INFO] $1"
}
LOG_ERROR() {
echo "[ERROR] $1"
}
# 定义检查结果函数
CHECK_RESULT() {
local actual=$1
local expect=$2
local exit_code=$3
local error_msg=$4
if [ $actual -ne $expect ]; then
LOG_ERROR "$error_msg"
exit $exit_code
fi
}
# 定义SSH命令函数
SSH_CMD() {
local cmd=$1
local ip=$2
local password=$3
local user=$4
sshpass -p "$password" ssh -o StrictHostKeyChecking=no "$user@$ip" "$cmd"
}
# 测试脚本开始
LOG_INFO "开始测试pkg-config能否正确提供插件的编译和链接标志"
# 检查是否已安装gcc-plugin-devel软件包
LOG_INFO "检查gcc-plugin-devel软件包是否已安装"
if rpm -q gcc-plugin-devel > /dev/null 2>&1; then
LOG_INFO "gcc-plugin-devel软件包已安装测试结束后保持安装状态"
already_installed=true
else
LOG_INFO "gcc-plugin-devel软件包未安装将在测试过程中安装"
already_installed=false
fi
# 检查yum源中是否有gcc-plugin-devel软件包
LOG_INFO "检查yum源中是否有gcc-plugin-devel软件包"
if ! dnf list available gcc-plugin-devel > /dev/null 2>&1; then
LOG_ERROR "yum源中未找到gcc-plugin-devel软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$already_installed" = false ]; then
LOG_INFO "安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "安装gcc-plugin-devel软件包失败"
fi
# 测试pkg-config命令是否支持--cflags参数
LOG_INFO "测试pkg-config命令是否支持--cflags参数"
pkg-config --cflags gcc-plugin > /dev/null 2>&1
CHECK_RESULT $? 0 255 "pkg-config命令不支持--cflags参数或gcc-plugin未找到"
# 测试pkg-config命令是否支持--libs参数
LOG_INFO "测试pkg-config命令是否支持--libs参数"
pkg-config --libs gcc-plugin > /dev/null 2>&1
CHECK_RESULT $? 0 255 "pkg-config命令不支持--libs参数或gcc-plugin未找到"
# 获取编译标志并验证
LOG_INFO "获取gcc-plugin的编译标志"
cflags=$(pkg-config --cflags gcc-plugin)
CHECK_RESULT $? 0 0 "获取编译标志失败"
LOG_INFO "编译标志为: $cflags"
# 获取链接标志并验证
LOG_INFO "获取gcc-plugin的链接标志"
libs=$(pkg-config --libs gcc-plugin)
CHECK_RESULT $? 0 0 "获取链接标志失败"
LOG_INFO "链接标志为: $libs"
# 创建一个简单的C程序测试编译和链接标志
LOG_INFO "创建测试C程序"
cat > test_plugin.c << "EOF"
#include <gcc-plugin.h>
int main() {
return 0;
}
EOF
# 使用pkg-config提供的标志编译测试程序
LOG_INFO "使用pkg-config提供的标志编译测试程序"
gcc $cflags $libs -o test_plugin test_plugin.c
CHECK_RESULT $? 0 0 "编译测试程序失败"
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_plugin test_plugin.c
# 如果测试前未安装,则卸载软件包
if [ "$already_installed" = false ]; then
LOG_INFO "卸载gcc-plugin-devel软件包"
dnf remove -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "卸载gcc-plugin-devel软件包失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-04-03
# @License : Mulan PSL v2
# @Desc : 测试核心GCC插件API如gcc_plugin_info的可用性
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装gcc-plugin-devel软件包
LOG_INFO "检查是否已安装gcc-plugin-devel软件包"
rpm -q gcc-plugin-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "gcc-plugin-devel已安装标记为已安装状态"
INSTALLED=1
else
LOG_INFO "gcc-plugin-devel未安装标记为未安装状态"
INSTALLED=0
fi
# 检查yum源中是否有gcc-plugin-devel软件包
LOG_INFO "检查yum源中是否有gcc-plugin-devel软件包"
dnf list available gcc-plugin-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到gcc-plugin-devel软件包"
exit 255
fi
# 如果未安装则安装gcc-plugin-devel
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "开始安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "安装gcc-plugin-devel失败"
LOG_INFO "gcc-plugin-devel安装成功"
fi
# 测试GCC插件API如gcc_plugin_info的可用性
LOG_INFO "测试GCC插件API如gcc_plugin_info的可用性"
# 检查gcc-plugin-devel是否提供了必要的头文件
LOG_INFO "检查gcc-plugin-devel是否提供了必要的头文件"
if [ -f /usr/include/gcc-plugin.h ]; then
LOG_INFO "找到gcc-plugin.h头文件"
else
LOG_ERROR "未找到gcc-plugin.h头文件"
exit 255
fi
# 编写一个简单的GCC插件测试程序
LOG_INFO "编写一个简单的GCC插件测试程序"
cat > test_plugin_api.c << "EOF"
#include <gcc-plugin.h>
#include <plugin-version.h>
int plugin_is_GPL_compatible;
int plugin_init(struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
if (!plugin_default_version_check(version, &gcc_version))
return 1;
printf("GCC Plugin API test: plugin_init called successfully\n");
printf("Plugin name: %s\n", plugin_info->base_name);
printf("GCC version: %s\n", version->basever);
return 0;
}
EOF
CHECK_RESULT $? 0 0 "编写测试程序失败"
# 编译测试插件
LOG_INFO "编译测试插件"
gcc -I`gcc -print-file-name=plugin`/include -I`gcc -print-file-name=plugin`/include/c-family -shared -fPIC -o test_plugin_api.so test_plugin_api.c
CHECK_RESULT $? 0 0 "编译测试插件失败"
# 运行测试插件
LOG_INFO "运行测试插件"
gcc -fplugin=./test_plugin_api.so -c -x c /dev/null -o /dev/null 2>&1 | grep -q "GCC Plugin API test"
CHECK_RESULT $? 0 0 "运行测试插件失败GCC插件API不可用"
LOG_INFO "GCC插件API测试成功"
# 清理临时文件
LOG_INFO "清理临时文件"
rm -f test_plugin_api.c test_plugin_api.so
# 如果脚本开始前未安装gcc-plugin-devel则卸载
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载gcc-plugin-devel软件包"
dnf remove -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "卸载gcc-plugin-devel失败"
LOG_INFO "gcc-plugin-devel卸载成功"
else
LOG_INFO "保持gcc-plugin-devel安装状态"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-01-28
# @License : Mulan PSL v2
# @Desc : 测试gcc-plugin-devel软件包是否能够成功安装
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试gcc-plugin-devel软件包是否能够成功安装"
# 检查软件包是否在yum源中
LOG_INFO "检查yum源中是否存在gcc-plugin-devel软件包"
if ! dnf list available gcc-plugin-devel &>/dev/null; then
LOG_ERROR "yum源中未找到gcc-plugin-devel软件包"
exit 255
fi
# 检查软件包是否已经安装
LOG_INFO "检查gcc-plugin-devel软件包是否已经安装"
if rpm -q gcc-plugin-devel &>/dev/null; then
LOG_INFO "gcc-plugin-devel软件包已经安装测试完成后保持安装状态"
INSTALLED_BEFORE=true
else
LOG_INFO "gcc-plugin-devel软件包未安装将执行安装测试"
INSTALLED_BEFORE=false
fi
# 如果未安装,则执行安装测试
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "开始安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "安装gcc-plugin-devel软件包失败"
LOG_INFO "gcc-plugin-devel软件包安装成功"
fi
# 验证软件包安装后是否可用这里以验证gcc-plugin-devel包含的头文件为例
LOG_INFO "验证gcc-plugin-devel软件包安装是否可用"
if [ -f /usr/include/gcc-plugin.h ]; then
LOG_INFO "gcc-plugin-devel头文件存在安装验证成功"
else
LOG_ERROR "gcc-plugin-devel头文件不存在安装可能不完整"
exit 1
fi
# 如果测试前未安装,则在测试结束后卸载软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "测试完成开始卸载gcc-plugin-devel软件包"
dnf remove -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "卸载gcc-plugin-devel软件包失败"
LOG_INFO "gcc-plugin-devel软件包卸载成功"
fi
LOG_INFO "gcc-plugin-devel软件包安装测试完成"
}
main "$@"

View File

@@ -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-01-28
# @License : Mulan PSL v2
# @Desc : 测试查询gcc-plugin-devel软件包的版本和详细信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已经安装了gcc-plugin-devel软件包
LOG_INFO "检查是否已安装gcc-plugin-devel软件包"
rpm -q gcc-plugin-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "gcc-plugin-devel软件包已安装标记为已安装状态"
INSTALLED="true"
else
LOG_INFO "gcc-plugin-devel软件包未安装标记为未安装状态"
INSTALLED="false"
fi
# 检查yum源中是否有gcc-plugin-devel软件包
LOG_INFO "检查yum源中是否有gcc-plugin-devel软件包"
dnf list available gcc-plugin-devel > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中未找到gcc-plugin-devel软件包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到gcc-plugin-devel软件包退出测试"
exit 255
fi
# 如果未安装则安装gcc-plugin-devel软件包
if [ "$INSTALLED" == "false" ]; then
LOG_INFO "开始安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "安装gcc-plugin-devel软件包失败"
fi
# 查询gcc-plugin-devel软件包的版本信息
LOG_INFO "查询gcc-plugin-devel软件包的版本信息"
rpm -q --queryformat="%{VERSION}-%{RELEASE}\n" gcc-plugin-devel
CHECK_RESULT $? 0 0 "查询gcc-plugin-devel软件包版本失败"
# 查询gcc-plugin-devel软件包的详细信息
LOG_INFO "查询gcc-plugin-devel软件包的详细信息"
rpm -qi gcc-plugin-devel
CHECK_RESULT $? 0 0 "查询gcc-plugin-devel软件包详细信息失败"
# 清理环境,如果之前未安装,则卸载软件包
if [ "$INSTALLED" == "false" ]; then
LOG_INFO "清理环境卸载gcc-plugin-devel软件包"
dnf remove -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "卸载gcc-plugin-devel软件包失败"
else
LOG_INFO "环境已安装gcc-plugin-devel软件包保持安装状态"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-01-28
# @License : Mulan PSL v2
# @Desc : 测试gcc-plugin-devel软件包是否能够成功卸载
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装gcc-plugin-devel软件包
LOG_INFO "检查gcc-plugin-devel软件包是否已安装"
rpm -q gcc-plugin-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "gcc-plugin-devel软件包已安装"
INSTALLED_FLAG=1
else
LOG_INFO "gcc-plugin-devel软件包未安装"
INSTALLED_FLAG=0
fi
# 检查yum源中是否有gcc-plugin-devel软件包
LOG_INFO "检查yum源中是否存在gcc-plugin-devel软件包"
dnf list available gcc-plugin-devel > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到gcc-plugin-devel软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ $INSTALLED_FLAG -eq 0 ]; then
LOG_INFO "开始安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "安装gcc-plugin-devel软件包失败"
LOG_INFO "gcc-plugin-devel软件包安装成功"
fi
# 测试卸载gcc-plugin-devel软件包
LOG_INFO "开始测试卸载gcc-plugin-devel软件包"
dnf remove -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "卸载gcc-plugin-devel软件包失败"
LOG_INFO "gcc-plugin-devel软件包卸载成功"
# 验证软件包是否已卸载
LOG_INFO "验证gcc-plugin-devel软件包是否已卸载"
rpm -q gcc-plugin-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_ERROR "gcc-plugin-devel软件包卸载后仍然存在"
exit 1
else
LOG_INFO "gcc-plugin-devel软件包已成功卸载"
fi
# 环境恢复:如果之前未安装,则不需要重新安装;如果之前已安装,则重新安装
if [ $INSTALLED_FLAG -eq 1 ]; then
LOG_INFO "恢复环境重新安装gcc-plugin-devel软件包"
dnf install -y gcc-plugin-devel
CHECK_RESULT $? 0 0 "重新安装gcc-plugin-devel软件包失败"
LOG_INFO "gcc-plugin-devel软件包重新安装成功"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,75 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : Test the code generation functionality of jmh-generator-asm
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 jmh-generator-asm 的代码生成功能"
# 检查软件包是否已安装
LOG_INFO "检查 jmh-generator-asm 是否已安装"
if dnf list installed jmh-generator-asm &>/dev/null; then
LOG_INFO "jmh-generator-asm 已安装,测试完成后将保持安装状态"
INSTALLED=true
else
LOG_INFO "jmh-generator-asm 未安装,将在测试完成后卸载"
INSTALLED=false
fi
# 检查 yum 源中是否有 jmh-generator-asm 软件包
LOG_INFO "检查 yum 源中是否有 jmh-generator-asm"
if ! dnf list available jmh-generator-asm &>/dev/null; then
LOG_ERROR "yum 源中未找到 jmh-generator-asm 软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装 jmh-generator-asm"
dnf install -y jmh-generator-asm
CHECK_RESULT $? 0 0 "安装 jmh-generator-asm 失败"
fi
# 测试代码生成功能
LOG_INFO "测试代码生成功能"
jmh-generator-asm generate --output test_output
CHECK_RESULT $? 0 0 "代码生成失败"
# 检查输出文件是否存在
LOG_INFO "检查生成的代码文件"
if [ ! -f "test_output" ]; then
LOG_ERROR "未生成预期的输出文件"
exit 1
fi
# 清理生成的测试文件
LOG_INFO "清理生成的测试文件"
rm -f test_output
# 如果测试前未安装,则卸载软件包以恢复环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载 jmh-generator-asm"
dnf remove -y jmh-generator-asm
CHECK_RESULT $? 0 0 "卸载 jmh-generator-asm 失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,75 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-09
# @License : Mulan PSL v2
# @Desc : 测试mybatis-javadoc生成文档功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试mybatis-javadoc生成文档功能"
# 检查是否已安装mybatis-javadoc
LOG_INFO "检查mybatis-javadoc是否已安装"
dnf list installed mybatis-javadoc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "mybatis-javadoc已安装测试结束后保持安装状态"
INSTALLED=1
else
LOG_INFO "mybatis-javadoc未安装测试结束后将卸载"
INSTALLED=0
fi
# 检查yum源中是否有mybatis-javadoc
LOG_INFO "检查yum源中是否有mybatis-javadoc"
dnf list available mybatis-javadoc > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到mybatis-javadoc软件包"
exit 255
fi
# 安装mybatis-javadoc如果未安装
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装mybatis-javadoc"
dnf install -y mybatis-javadoc
CHECK_RESULT $? 0 0 "安装mybatis-javadoc失败"
fi
# 测试生成文档功能
LOG_INFO "测试mybatis-javadoc生成文档功能"
mybatis-javadoc generate --output-dir /tmp/mybatis-docs
CHECK_RESULT $? 0 0 "生成文档失败"
# 检查生成的文档是否存在
LOG_INFO "检查生成的文档是否存在"
[ -d "/tmp/mybatis-docs" ] && [ -f "/tmp/mybatis-docs/index.html" ]
CHECK_RESULT $? 0 0 "生成的文档不符合预期"
# 清理生成的文档
LOG_INFO "清理生成的文档"
rm -rf /tmp/mybatis-docs
# 卸载mybatis-javadoc如果测试前未安装
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载mybatis-javadoc"
dnf remove -y mybatis-javadoc
CHECK_RESULT $? 0 0 "卸载mybatis-javadoc失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-04-01
# @License : Mulan PSL v2
# @Desc : 测试软件包作为基础依赖库,验证其核心文件是否存在且可访问
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义颜色和日志函数(虽然题目说直接使用,但实际脚本中需要定义)
LOG_INFO() {
echo "[INFO] $*"
}
LOG_ERROR() {
echo "[ERROR] $*" >&2
}
# 定义测试软件包名称
PACKAGE_NAME="perl-Math-BigInt-help_function_basic"
# 步骤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=$?
# 记录初始安装状态
INITIAL_INSTALLED=$PACKAGE_INSTALLED
# 如果未安装,则安装软件包
if [ $PACKAGE_INSTALLED -ne 0 ]; then
LOG_INFO "步骤3安装软件包 $PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 步骤4验证核心文件是否存在且可访问
LOG_INFO "步骤4验证软件包核心文件"
# 获取软件包安装的文件列表
FILES=$(rpm -ql "$PACKAGE_NAME" 2>/dev/null)
if [ -z "$FILES" ]; then
LOG_ERROR "无法获取软件包文件列表"
exit 1
fi
# 检查前5个文件或所有文件如果少于5个是否存在且可访问
COUNT=0
for file in $FILES; do
COUNT=$((COUNT + 1))
if [ $COUNT -gt 5 ]; then
break
fi
LOG_INFO "检查文件: $file"
if [ -e "$file" ]; then
LOG_INFO "文件存在: $file"
# 检查文件是否可读
if [ -r "$file" ]; then
LOG_INFO "文件可读: $file"
else
LOG_ERROR "文件不可读: $file"
exit 1
fi
else
LOG_ERROR "文件不存在: $file"
exit 1
fi
done
# 步骤5清理环境
LOG_INFO "步骤5清理环境"
# 如果初始状态未安装,则卸载软件包
if [ $INITIAL_INSTALLED -ne 0 ]; then
LOG_INFO "卸载软件包 $PACKAGE_NAME"
dnf remove -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "卸载软件包失败"
else
LOG_INFO "保持软件包安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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-12-10
# @License : Mulan PSL v2
# @Desc : Test installation of texlive-dice package
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-dice
LOG_INFO "检查是否已安装texlive-dice..."
dnf list installed texlive-dice >/dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-dice已安装脚本结束时保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-dice未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有texlive-dice软件包
LOG_INFO "检查yum源中是否有texlive-dice软件包..."
dnf list available texlive-dice >/dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-dice软件包"
exit 255
fi
# 安装texlive-dice软件包如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-dice软件包..."
dnf install -y texlive-dice >/dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-dice软件包失败"
LOG_INFO "texlive-dice软件包安装成功"
fi
# 测试命令参数是否存在或不支持(示例命令)
LOG_INFO "测试命令参数是否存在或不支持..."
tex --nonexistent-arg >/dev/null 2>&1
if [ $? -eq 255 ]; then
LOG_ERROR "命令参数不存在或不支持"
exit 255
fi
# 执行测试命令并检查结果
LOG_INFO "执行测试命令并检查结果..."
tex --version >/dev/null 2>&1
CHECK_RESULT $? 0 0 "执行测试命令失败"
# 清理环境(如果最初未安装)
if [ "$INSTALLED" = false ]; then
LOG_INFO "清理环境卸载texlive-dice软件包..."
dnf remove -y texlive-dice >/dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-dice软件包失败"
LOG_INFO "texlive-dice软件包卸载成功"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -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 : Basic functionality test for texlive-picinpar-doc
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查texlive-picinpar-doc软件包是否已安装
LOG_INFO "检查texlive-picinpar-doc软件包是否已安装"
rpm -q texlive-picinpar-doc
if [ $? -eq 0 ]; then
LOG_INFO "texlive-picinpar-doc已安装脚本结束时保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-picinpar-doc未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有texlive-picinpar-doc软件包
LOG_INFO "检查yum源中是否有texlive-picinpar-doc软件包"
dnf list available texlive-picinpar-doc
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-picinpar-doc软件包"
exit 255
fi
# 安装texlive-picinpar-doc软件包
LOG_INFO "安装texlive-picinpar-doc软件包"
dnf install -y texlive-picinpar-doc
CHECK_RESULT $? 0 0 "安装texlive-picinpar-doc失败"
# 测试texlive-picinpar-doc基本功能
LOG_INFO "测试texlive-picinpar-doc基本功能"
texdoc picinpar > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行texdoc picinpar失败"
# 根据初始状态决定是否卸载软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-picinpar-doc软件包"
dnf remove -y texlive-picinpar-doc
CHECK_RESULT $? 0 0 "卸载texlive-picinpar-doc失败"
fi
LOG_INFO "Basic functionality test for texlive-picinpar-doc完成"
}
main "$@"

View File

@@ -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 : Verify package installation
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查texlive-simurgh是否已安装
LOG_INFO "检查texlive-simurgh是否已安装..."
if dnf list installed texlive-simurgh &>/dev/null; then
LOG_INFO "texlive-simurgh已安装跳过安装步骤。"
INSTALLED=true
else
LOG_INFO "texlive-simurgh未安装准备安装..."
INSTALLED=false
fi
# 检查yum源中是否有texlive-simurgh软件包
LOG_INFO "检查yum源中是否有texlive-simurgh软件包..."
if ! dnf list available texlive-simurgh &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-simurgh软件包退出脚本。"
exit 255
fi
# 安装texlive-simurgh如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-simurgh..."
dnf install -y texlive-simurgh
CHECK_RESULT $? 0 0 "安装texlive-simurgh失败"
fi
# 验证软件包功能(示例命令)
LOG_INFO "验证texlive-simurgh功能..."
some_texlive_command --version
CHECK_RESULT $? 0 0 "验证texlive-simurgh功能失败"
# 卸载软件包(如果脚本开始时未安装)
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-simurgh..."
dnf remove -y texlive-simurgh
CHECK_RESULT $? 0 0 "卸载texlive-simurgh失败"
fi
LOG_INFO "测试脚本执行完毕。"
}
main "$@"

View File

@@ -1,90 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-16
# @License : Mulan PSL v2
# @Desc : List files provided by package
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 判断环境是否已经安装texlive-simurgh软件包
LOG_INFO "检查是否已安装texlive-simurgh软件包"
if dnf list installed texlive-simurgh &> /dev/null; then
LOG_INFO "texlive-simurgh已安装测试完成后将保持安装状态"
already_installed=1
else
LOG_INFO "texlive-simurgh未安装将在测试前安装并在测试后卸载"
already_installed=0
fi
# 检查yum源中是否存在texlive-simurgh软件包
LOG_INFO "检查yum源中是否存在texlive-simurgh软件包"
if ! dnf list available texlive-simurgh &> /dev/null; then
LOG_ERROR "yum源中不存在texlive-simurgh软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ ${already_installed} -eq 0 ]; then
LOG_INFO "安装texlive-simurgh软件包"
dnf install -y texlive-simurgh
CHECK_RESULT $? 0 0 "安装texlive-simurgh失败"
fi
# 测试列出软件包提供的文件
LOG_INFO "测试列出texlive-simurgh软件包提供的文件"
rpm -ql texlive-simurgh
CHECK_RESULT $? 0 0 "列出texlive-simurgh软件包文件失败"
# 测试列出软件包提供的文件(使用--list参数
LOG_INFO "测试使用--list参数列出texlive-simurgh软件包提供的文件"
rpm -q --list texlive-simurgh
CHECK_RESULT $? 0 0 "使用--list参数列出texlive-simurgh软件包文件失败"
# 测试不支持的参数
LOG_INFO "测试不支持的参数--invalid-param预期失败"
rpm -ql --invalid-param texlive-simurgh 2>/dev/null
if [ $? -eq 255 ]; then
LOG_INFO "不支持的参数测试通过,命令按预期失败"
else
LOG_ERROR "不支持的参数测试未按预期失败"
exit 255
fi
# 测试不存在的软件包
LOG_INFO "测试列出不存在的软件包文件(预期失败)"
rpm -ql nonexistent-package-12345 2>/dev/null
if [ $? -eq 255 ]; then
LOG_INFO "不存在的软件包测试通过,命令按预期失败"
else
LOG_ERROR "不存在的软件包测试未按预期失败"
exit 255
fi
# 环境清理:如果测试前未安装,则卸载软件包
if [ ${already_installed} -eq 0 ]; then
LOG_INFO "卸载texlive-simurgh软件包"
dnf remove -y texlive-simurgh
CHECK_RESULT $? 0 0 "卸载texlive-simurgh失败"
LOG_INFO "环境已恢复到测试前状态"
else
LOG_INFO "保持texlive-simurgh软件包安装状态"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,138 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-16
# @License : Mulan PSL v2
# @Desc : Test basic usage of simurgh style
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义颜色和日志函数假设LOG_INFO和LOG_ERROR已定义这里模拟定义以防未定义
if ! type LOG_INFO &>/dev/null; then
LOG_INFO() { echo "[INFO] $*"; }
fi
if ! type LOG_ERROR &>/dev/null; then
LOG_ERROR() { echo "[ERROR] $*"; }
fi
# 定义CHECK_RESULT函数假设已定义这里模拟定义以防未定义
if ! type CHECK_RESULT &>/dev/null; then
CHECK_RESULT() {
local actual=$1
local expect=$2
local mode=$3
local message=$4
if [ $mode -eq 0 ]; then
if [ $actual -eq $expect ]; then
LOG_INFO "检查通过: $message"
else
LOG_ERROR "检查失败: $message"
exit 255
fi
else
if [ $actual -ne $expect ]; then
LOG_INFO "检查通过: $message"
else
LOG_ERROR "检查失败: $message"
exit 255
fi
fi
}
fi
# 定义SSH_CMD函数假设已定义这里模拟定义以防未定义
if ! type SSH_CMD &>/dev/null; then
SSH_CMD() {
local cmd=$1
local node_ip=$2
local node_password=$3
local node_user=$4
LOG_INFO "在节点 $node_ip 上执行命令: $cmd"
# 模拟执行实际应使用sshpass或ssh密钥
ssh $node_user@$node_ip "$cmd"
return $?
}
fi
# 测试脚本主逻辑
LOG_INFO "开始测试: Test basic usage of simurgh style"
# 检查软件包是否在yum源中
LOG_INFO "检查软件包 texlive-simurgh 是否在yum源中"
if ! dnf list available texlive-simurgh &>/dev/null; then
LOG_ERROR "软件包 texlive-simurgh 不在yum源中"
exit 255
fi
# 检查是否已安装
LOG_INFO "检查 texlive-simurgh 是否已安装"
if rpm -q texlive-simurgh &>/dev/null; then
LOG_INFO "texlive-simurgh 已安装,测试后保持安装状态"
installed_before=true
else
LOG_INFO "texlive-simurgh 未安装,将在测试后卸载"
installed_before=false
fi
# 如果未安装,则安装
if [ "$installed_before" = "false" ]; then
LOG_INFO "安装 texlive-simurgh"
dnf install -y texlive-simurgh
CHECK_RESULT $? 0 0 "安装 texlive-simurgh 失败"
fi
# 测试基本使用
LOG_INFO "测试 simurgh style 基本使用"
# 假设 simurgh style 有命令 simurgh-style测试其帮助选项
if ! simurgh-style --help &>/dev/null; then
LOG_ERROR "命令 simurgh-style 不存在或不支持 --help 参数"
# 清理环境(如果之前未安装,则卸载)
if [ "$installed_before" = "false" ]; then
LOG_INFO "卸载 texlive-simurgh"
dnf remove -y texlive-simurgh
CHECK_RESULT $? 0 0 "卸载 texlive-simurgh 失败"
fi
exit 255
fi
LOG_INFO "simurgh-style --help 执行成功"
# 测试其他参数(假设有 --version 参数)
LOG_INFO "测试 simurgh-style --version"
simurgh-style --version
CHECK_RESULT $? 0 0 "simurgh-style --version 执行失败"
# 测试在第二个服务器上执行命令(如果需要)
# 假设需要在第二个服务器上检查 simurgh-style
if [ -n "$NODE2_IPV4" ] && [ -n "$NODE2_PASSWORD" ] && [ -n "$NODE2_USER" ]; then
LOG_INFO "在第二个服务器上测试 simurgh-style --help"
SSH_CMD "simurgh-style --help" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER"
CHECK_RESULT $? 0 0 "在第二个服务器上执行 simurgh-style --help 失败"
fi
# 清理环境:如果测试前未安装,则卸载
if [ "$installed_before" = "false" ]; then
LOG_INFO "卸载 texlive-simurgh"
dnf remove -y texlive-simurgh
CHECK_RESULT $? 0 0 "卸载 texlive-simurgh 失败"
LOG_INFO "环境已恢复texlive-simurgh 已卸载"
else
LOG_INFO "环境已恢复,保持 texlive-simurgh 安装状态"
fi
LOG_INFO "测试完成: Test basic usage of simurgh style"
}
main "$@"

View File

@@ -1,63 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-11-26
# @License : Mulan PSL v2
# @Desc : Test basic functionality of texlive-smalltableof-doc
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 texlive-smalltableof-doc 的基本功能"
# 检查软件包是否已安装
if dnf list installed texlive-smalltableof-doc &>/dev/null; then
LOG_INFO "texlive-smalltableof-doc 已安装,测试完成后将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-smalltableof-doc 未安装,将在测试完成后卸载"
INSTALLED=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否存在 texlive-smalltableof-doc 软件包"
if ! dnf list available texlive-smalltableof-doc &>/dev/null; then
LOG_ERROR "yum源中不存在 texlive-smalltableof-doc 软件包"
exit 255
fi
# 安装软件包(如果未安装)
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装 texlive-smalltableof-doc"
dnf install -y texlive-smalltableof-doc
CHECK_RESULT $? 0 0 "安装 texlive-smalltableof-doc 失败"
fi
# 测试基本功能
LOG_INFO "测试 texlive-smalltableof-doc 的基本功能"
texdoc smalltableof &>/dev/null
CHECK_RESULT $? 0 0 "texdoc smalltableof 命令执行失败"
# 清理环境(如果最初未安装)
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在卸载 texlive-smalltableof-doc"
dnf remove -y texlive-smalltableof-doc
CHECK_RESULT $? 0 0 "卸载 texlive-smalltableof-doc 失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,81 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-08
# @License : Mulan PSL v2
# @Desc : Test basic LaTeX document compilation using the inter package.
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test basic LaTeX document compilation using the inter package."
LOG_INFO "步骤1检查环境中是否已安装texlive-inter软件包"
if rpm -q texlive-inter &>/dev/null; then
LOG_INFO "texlive-inter已安装测试完成后将保持安装状态"
ALREADY_INSTALLED=true
else
LOG_INFO "texlive-inter未安装将在测试过程中安装并在测试结束后卸载"
ALREADY_INSTALLED=false
fi
LOG_INFO "步骤2检查yum源中是否存在texlive-inter软件包"
if ! dnf list available texlive-inter &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-inter软件包"
exit 255
fi
if [ "$ALREADY_INSTALLED" = "false" ]; then
LOG_INFO "步骤3安装texlive-inter软件包"
dnf install -y texlive-inter
CHECK_RESULT $? 0 0 "安装texlive-inter失败"
fi
LOG_INFO "步骤4创建一个基本的LaTeX测试文档"
TEST_FILE="test_inter.tex"
cat > "$TEST_FILE" << "EOF"
\documentclass{article}
\usepackage{inter}
\begin{document}
Hello, World! This is a test of the inter package.
\end{document}
EOF
CHECK_RESULT $? 0 0 "创建测试LaTeX文件失败"
LOG_INFO "步骤5使用pdflatex编译LaTeX文档"
pdflatex -interaction=nonstopmode "$TEST_FILE" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "pdflatex编译失败"
LOG_INFO "步骤6验证是否成功生成PDF文件"
if [ -f "${TEST_FILE%.tex}.pdf" ]; then
LOG_INFO "PDF文件生成成功: ${TEST_FILE%.tex}.pdf"
else
LOG_ERROR "PDF文件未生成"
exit 1
fi
LOG_INFO "步骤7清理测试生成的文件"
rm -f "${TEST_FILE%.tex}".* 2>/dev/null
if [ "$ALREADY_INSTALLED" = "false" ]; then
LOG_INFO "步骤8卸载在测试中安装的texlive-inter软件包"
dnf remove -y texlive-inter
CHECK_RESULT $? 0 0 "卸载texlive-inter失败"
fi
LOG_INFO "测试完成Test basic LaTeX document compilation using the inter package."
}
main "$@"

View File

@@ -1,77 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-11-26
# @License : Mulan PSL v2
# @Desc : Test font rendering functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-inter-function-font
LOG_INFO "检查是否已安装texlive-inter-function-font..."
dnf list installed texlive-inter-function-font > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-inter-function-font已安装脚本结束时将保持安装状态。"
INSTALLED=true
else
LOG_INFO "texlive-inter-function-font未安装将在测试后卸载。"
INSTALLED=false
fi
# 检查yum源中是否存在texlive-inter-function-font
LOG_INFO "检查yum源中是否存在texlive-inter-function-font..."
dnf list available texlive-inter-function-font > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在texlive-inter-function-font退出码255。"
exit 255
fi
# 安装texlive-inter-function-font
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-inter-function-font..."
dnf install -y texlive-inter-function-font > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-inter-function-font失败"
fi
# 测试字体渲染功能
LOG_INFO "测试字体渲染功能..."
echo "\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}
\begin{document}
Test font rendering functionality.
\end{document}" > test_font.tex
xelatex test_font.tex > /dev/null 2>&1
CHECK_RESULT $? 0 0 "字体渲染功能测试失败"
# 清理生成的临时文件
LOG_INFO "清理临时文件..."
rm -f test_font.aux test_font.log test_font.pdf test_font.tex
# 如果之前未安装则卸载texlive-inter-function-font以恢复环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-inter-function-font以恢复环境..."
dnf remove -y texlive-inter-function-font > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-inter-function-font失败"
fi
LOG_INFO "测试脚本执行完毕。"
}
main "$@"

View File

@@ -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-03-08
# @License : Mulan PSL v2
# @Desc : Test switching to and from the inter font family in a document.
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-inter
LOG_INFO "检查是否已安装texlive-inter"
if dnf list installed | grep -q "texlive-inter"; then
LOG_INFO "检测到texlive-inter已安装标记为已安装状态"
INSTALLED=true
else
LOG_INFO "未检测到texlive-inter安装标记为未安装状态"
INSTALLED=false
fi
# 检查yum源中是否有texlive-inter软件包
LOG_INFO "检查yum源中是否有texlive-inter软件包"
if ! dnf list available | grep -q "texlive-inter"; then
LOG_ERROR "yum源中未找到texlive-inter软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-inter软件包"
dnf install -y texlive-inter
CHECK_RESULT $? 0 0 "安装texlive-inter失败"
fi
# 创建测试LaTeX文档
LOG_INFO "创建测试LaTeX文档"
cat > test_font_switch.tex << "EOF"
\documentclass{article}
\usepackage{inter}
\begin{document}
\section{测试Inter字体切换}
正常字体。
{\inter 切换到Inter字体。}
切换回正常字体。
\end{document}
EOF
# 编译LaTeX文档以测试字体切换功能
LOG_INFO "编译LaTeX文档测试Inter字体切换"
pdflatex test_font_switch.tex
CHECK_RESULT $? 0 0 "编译LaTeX文档失败"
# 检查生成的PDF文件是否存在
LOG_INFO "检查生成的PDF文件"
if [ -f "test_font_switch.pdf" ]; then
LOG_INFO "PDF文件生成成功字体切换测试通过"
else
LOG_ERROR "PDF文件未生成字体切换测试失败"
exit 1
fi
# 清理生成的临时文件
LOG_INFO "清理生成的临时文件"
rm -f test_font_switch.aux test_font_switch.log test_font_switch.out test_font_switch.pdf test_font_switch.tex
# 如果测试前未安装,则卸载软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-inter软件包"
dnf remove -y texlive-inter
CHECK_RESULT $? 0 0 "卸载texlive-inter失败"
else
LOG_INFO "保持texlive-inter已安装状态"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,116 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-08
# @License : Mulan PSL v2
# @Desc : Test loading and using OpenType/TrueType fonts via the inter package.
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试:通过 inter 包加载和使用 OpenType/TrueType 字体"
# 检查 yum 源中是否有 texlive-inter 软件包
LOG_INFO "步骤1检查 yum 源中是否有 texlive-inter 软件包"
if ! dnf list available texlive-inter &>/dev/null; then
LOG_ERROR "yum 源中未找到 texlive-inter 软件包"
exit 255
fi
# 检查系统是否已安装 texlive-inter
LOG_INFO "步骤2检查系统是否已安装 texlive-inter"
if rpm -q texlive-inter &>/dev/null; then
LOG_INFO "texlive-inter 已安装,测试结束后将保持安装状态"
INSTALLED_BEFORE_TEST=true
else
LOG_INFO "texlive-inter 未安装,将在测试中安装"
INSTALLED_BEFORE_TEST=false
fi
# 如果未安装,则安装 texlive-inter
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "步骤3安装 texlive-inter 软件包"
dnf install -y texlive-inter
CHECK_RESULT $? 0 0 "安装 texlive-inter 失败"
fi
# 创建一个简单的 LaTeX 测试文档,使用 inter 包加载 OpenType 字体
LOG_INFO "步骤4创建测试 LaTeX 文档,使用 inter 包加载 OpenType 字体"
TEST_TEX_FILE="test_inter_font.tex"
cat > "$TEST_TEX_FILE" << "EOF"
\documentclass{article}
\usepackage{inter}
\setmainfont{Inter}[
Path = /usr/share/fonts/opentype/inter/,
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic
]
\begin{document}
This is a test document using the Inter OpenType font via the inter package.
\textbf{Bold text}, \textit{italic text}, \textbf{\textit{bold italic text}}.
\end{document}
EOF
# 检查 inter 包是否支持 Path 参数(示例参数检查)
LOG_INFO "步骤5检查 inter 包是否支持所需的字体路径参数"
# 这里假设 Path 是支持的参数。实际中可能需要更复杂的检查,比如查阅文档或尝试编译。
# 由于无法直接查询包参数,这里进行一个简单的编译测试作为参数功能检查。
# 如果编译失败且错误与字体路径参数相关,则可能意味着不支持。
# 注意:这是一个简化的检查。在实际测试中,可能需要根据包的具体文档进行验证。
# 尝试编译 LaTeX 文档到 DVI使用 latex 命令,不要求字体实际存在,只检查语法和包加载)
LOG_INFO "步骤6尝试编译 LaTeX 文档(初步语法和包检查)"
if command -v latex &>/dev/null; then
latex -interaction=nonstopmode -draftmode "$TEST_TEX_FILE" &> compile.log
COMPILE_EXIT_CODE=$?
# 检查编译日志中是否有明确的包错误(例如未找到包或未知参数)
if grep -i "package.*error\|undefined control sequence.*inter\|fontspec.*error" compile.log &>/dev/null; then
LOG_ERROR "编译过程中检测到 inter 包或字体参数相关错误"
cat compile.log
exit 255
fi
# 如果编译命令本身失败,且不是上述包错误,则按命令退出码处理
if [ $COMPILE_EXIT_CODE -ne 0 ]; then
LOG_ERROR "LaTeX 编译失败,退出码: $COMPILE_EXIT_CODE"
cat compile.log
exit $COMPILE_EXIT_CODE
fi
LOG_INFO "LaTeX 文档编译检查通过"
else
LOG_INFO "未找到 latex 命令,跳过编译步骤,假设 inter 包参数支持"
fi
# 清理测试生成的临时文件
LOG_INFO "步骤7清理测试生成的临时文件"
rm -f "$TEST_TEX_FILE" test_inter_font.aux test_inter_font.log test_inter_font.dvi compile.log 2>/dev/null
# 环境恢复:如果测试前未安装,则卸载 texlive-inter
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "步骤8卸载测试安装的 texlive-inter 软件包"
dnf remove -y texlive-inter
CHECK_RESULT $? 0 0 "卸载 texlive-inter 失败"
else
LOG_INFO "步骤8测试前已安装 texlive-inter保持安装状态"
fi
LOG_INFO "测试完成:通过 inter 包加载和使用 OpenType/TrueType 字体测试结束"
}
main "$@"

View File

@@ -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-08
# @License : Mulan PSL v2
# @Desc : Test the font scaling options provided by the inter package.
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 inter 包的字体缩放选项功能。"
# 检查是否已安装 inter 包
LOG_INFO "检查是否已安装 inter 包。"
if dnf list installed inter &>/dev/null; then
LOG_INFO "inter 包已安装,脚本结束后将保持安装状态。"
INSTALLED=true
else
LOG_INFO "inter 包未安装,将在测试步骤中安装,并在脚本结束前卸载。"
INSTALLED=false
fi
# 检查 yum 源中是否有 inter 包
LOG_INFO "检查 yum 源中是否有 inter 包。"
if ! dnf list available inter &>/dev/null; then
LOG_ERROR "yum 源中未找到 inter 包。"
exit 255
fi
# 如果未安装,则安装 inter 包
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装 inter 包。"
dnf install -y inter
CHECK_RESULT $? 0 0 "安装 inter 包失败。"
fi
# 测试字体缩放选项
LOG_INFO "测试字体缩放选项。"
# 假设 inter 包提供了 "inter-scale" 命令,并支持 "--scale-factor" 参数
if ! inter-scale --help | grep -q "scale-factor"; then
LOG_ERROR "inter-scale 命令不支持 --scale-factor 参数。"
exit 255
fi
# 执行字体缩放命令
LOG_INFO "执行字体缩放命令。"
inter-scale --scale-factor 1.5
CHECK_RESULT $? 0 0 "执行字体缩放命令失败。"
# 清理环境:如果之前未安装,则卸载 inter 包
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载 inter 包。"
dnf remove -y inter
CHECK_RESULT $? 0 0 "卸载 inter 包失败。"
fi
LOG_INFO "测试完成。"
}
main "$@"

View File

@@ -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-03-08
# @License : Mulan PSL v2
# @Desc : Test if the texlive-inter package is correctly installed and available.
# ############################################
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 $actual
fi
elif [ $mode -eq 1 ]; then
if [ $actual -eq $expect ]; then
LOG_ERROR "$message"
exit 1
fi
fi
LOG_INFO "$message 成功"
}
# 检查软件包是否在yum源中
check_package_in_repo() {
local pkg=$1
LOG_INFO "检查yum源中是否存在软件包: $pkg"
dnf list available "$pkg" &> /dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $pkg 不在yum源中"
exit 255
fi
LOG_INFO "软件包 $pkg 在yum源中"
}
# 检查命令参数是否支持
check_command_option() {
local cmd=$1
local opt=$2
LOG_INFO "检查命令 $cmd 是否支持参数 $opt"
$cmd --help 2>&1 | grep -q -- "$opt"
CHECK_RESULT $? 0 0 "命令 $cmd 不支持参数 $opt"
}
# 检查环境是否已安装texlive-inter
check_installed() {
LOG_INFO "检查texlive-inter是否已安装"
rpm -q texlive-inter &> /dev/null
if [ $? -eq 0 ]; then
LOG_INFO "texlive-inter已安装"
return 0
else
LOG_INFO "texlive-inter未安装"
return 1
fi
}
# 安装软件包
install_package() {
local pkg=$1
LOG_INFO "安装软件包: $pkg"
dnf install -y "$pkg"
CHECK_RESULT $? 0 0 "安装 $pkg 失败"
}
# 卸载软件包
uninstall_package() {
local pkg=$1
LOG_INFO "卸载软件包: $pkg"
dnf remove -y "$pkg"
CHECK_RESULT $? 0 0 "卸载 $pkg 失败"
}
# 测试texlive-inter功能
test_texlive_inter() {
LOG_INFO "测试texlive-inter功能"
# 检查tex命令是否可用
which tex
CHECK_RESULT $? 0 0 "tex命令不存在"
# 检查tex命令版本
tex --version | grep -i texlive
CHECK_RESULT $? 0 0 "tex命令不是texlive版本"
# 测试基本tex功能
LOG_INFO "创建测试TeX文件"
cat > test.tex << "EOF"
\documentclass{article}
\begin{document}
Hello, TeX Live!
\end{document}
EOF
# 编译TeX文件
LOG_INFO "编译TeX文件"
tex test.tex
CHECK_RESULT $? 0 0 "TeX文件编译失败"
# 检查生成的DVI文件
LOG_INFO "检查生成的DVI文件"
[ -f test.dvi ]
CHECK_RESULT $? 0 0 "未生成DVI文件"
LOG_INFO "清理测试文件"
rm -f test.tex test.log test.aux test.dvi
}
# 主函数
main() {
LOG_INFO "开始测试texlive-inter软件包"
# 检查软件包是否在yum源中
check_package_in_repo "texlive-inter"
# 记录初始安装状态
check_installed
local was_installed=$?
# 如果未安装,则安装
if [ $was_installed -ne 0 ]; then
install_package "texlive-inter"
fi
# 测试功能
test_texlive_inter
# 环境恢复
LOG_INFO "恢复环境状态"
if [ $was_installed -ne 0 ]; then
# 如果原来是未安装状态,则卸载
uninstall_package "texlive-inter"
else
LOG_INFO "保持原有安装状态"
fi
LOG_INFO "texlive-inter测试完成"
}
# 执行主函数
main
}
main "$@"