Merge branch 'pkg' of http://10.30.190.190:54866/redrsoe2100/os-autotest into pkg
This commit is contained in:
@@ -13,14 +13,6 @@
|
||||
{
|
||||
"name": "test_docbook5-style-xsl-help_version",
|
||||
"desc": "测试查询软件包docbook5-style-xsl-help的版本信息"
|
||||
},
|
||||
{
|
||||
"name": "test_docbook5-style-xsl-help_file_presence",
|
||||
"desc": "测试软件包docbook5-style-xsl-help安装后关键文件是否存在"
|
||||
},
|
||||
{
|
||||
"name": "test_docbook5-style-xsl-help_basic_usage",
|
||||
"desc": "测试使用软件包提供的XSL样式表进行简单的DocBook转换"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,10 +6,6 @@
|
||||
"name": "test_fence-agents-aliyun_upgrade_package",
|
||||
"desc": "测试 fence-agents-aliyun 软件包的升级功能,验证是否能够成功升级到最新版本。",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-aliyun_function_health",
|
||||
"desc": "测试 fence-agents-aliyun 软件包的健康检查功能,验证是否能够正常检测服务状态。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/python-argh/python-argh-help",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_python-argh-help_function_help",
|
||||
"desc": "Test help command"
|
||||
},
|
||||
{
|
||||
"name": "test_python-argh-help_function_install",
|
||||
"desc": "Test package installation"
|
||||
},
|
||||
{
|
||||
"name": "test_python-argh-help_function_import",
|
||||
"desc": "Test basic import"
|
||||
},
|
||||
{
|
||||
"name": "test_python-argh-help_function_basic_parse",
|
||||
"desc": "Test basic argument parsing"
|
||||
},
|
||||
{
|
||||
"name": "test_python-argh-help_function_subcommand",
|
||||
"desc": "Test subcommand handling"
|
||||
},
|
||||
{
|
||||
"name": "test_python-argh-help_function_auto_help",
|
||||
"desc": "Test auto help generation"
|
||||
},
|
||||
{
|
||||
"name": "test_python-argh-help_function_uninstall",
|
||||
"desc": "Test package removal"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/secGear/secGear-devel",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_help",
|
||||
"desc": "测试codegen命令的帮助信息输出"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_search_path",
|
||||
"desc": "测试codegen命令指定依赖文件搜索路径"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_use_prefix",
|
||||
"desc": "测试codegen命令为不可信代理添加Enclave名前缀"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_header_only",
|
||||
"desc": "测试codegen命令仅生成头文件"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_untrusted",
|
||||
"desc": "测试codegen命令仅生成不可信代理和桥接代码"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_trusted",
|
||||
"desc": "测试codegen命令仅生成可信代理和桥接代码"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_untrusted_dir",
|
||||
"desc": "测试codegen命令指定不可信代码保存目录"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_trusted_dir",
|
||||
"desc": "测试codegen命令指定可信代码保存目录"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_trustzone",
|
||||
"desc": "测试codegen命令生成TrustZone模式代码"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_sgx",
|
||||
"desc": "测试codegen命令生成SGX模式代码"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_file",
|
||||
"desc": "测试codegen命令处理EDL文件"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_untrusted_trusted_dir",
|
||||
"desc": "测试codegen命令同时指定生成不可信代码及其保存目录"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_trusted_trusted_dir",
|
||||
"desc": "测试codegen命令同时指定生成可信代码及其保存目录"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_search_path_untrusted_trusted",
|
||||
"desc": "测试codegen命令同时指定搜索路径并生成不可信和可信代码"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_trustzone_file",
|
||||
"desc": "测试codegen命令为TrustZone模式处理EDL文件"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_codegen_sgx_file",
|
||||
"desc": "测试codegen命令为SGX模式处理EDL文件"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_install",
|
||||
"desc": "测试secGear-devel软件包安装"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_uninstall",
|
||||
"desc": "测试secGear-devel软件包卸载"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_check_installed",
|
||||
"desc": "测试secGear-devel软件包是否已安装"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_basic_usage",
|
||||
"desc": "测试secGear-devel基础功能验证"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_env_setup",
|
||||
"desc": "测试secGear开发环境设置"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_edl_compile",
|
||||
"desc": "测试EDL文件编译流程"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_lib_link",
|
||||
"desc": "测试链接secGear库文件"
|
||||
},
|
||||
{
|
||||
"name": "test_secGear-devel_function_help_docs",
|
||||
"desc": "测试帮助文档存在性"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,10 +2,6 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-d/texlive-chivo",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-chivo_function_basic",
|
||||
"desc": "Test basic command usage"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-chivo_function_install",
|
||||
"desc": "Test installation of the texlive-chivo package"
|
||||
@@ -18,10 +14,6 @@
|
||||
"name": "test_texlive-chivo_function_check",
|
||||
"desc": "Test if the package is installed correctly"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-chivo_function_fontusage",
|
||||
"desc": "Test basic LaTeX font usage with chivo"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-chivo_function_doc",
|
||||
"desc": "Test if package documentation is accessible"
|
||||
|
||||
@@ -9,18 +9,6 @@
|
||||
{
|
||||
"name": "test_texlive-dashbox-doc_function_check",
|
||||
"desc": "Check if package is installed"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-dashbox-doc_function_remove",
|
||||
"desc": "Test package removal"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-dashbox-doc_function_doc_access",
|
||||
"desc": "Access package documentation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-dashbox-doc_function_list_files",
|
||||
"desc": "List package documentation files"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-h/texlive-exteps",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-exteps_function_basic",
|
||||
"desc": "Test basic functionality of texlive-exteps"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -9,14 +9,6 @@
|
||||
{
|
||||
"name": "test_texlive-lt3graph_function_uninstall",
|
||||
"desc": "Test package removal"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-lt3graph_function_check",
|
||||
"desc": "Test package existence check"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-lt3graph_function_usage",
|
||||
"desc": "Test basic LaTeX usage with lt3graph"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,22 +2,10 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-q/texlive-opteng",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-opteng_function_install",
|
||||
"desc": "Verify installation of texlive-opteng"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-opteng_function_uninstall",
|
||||
"desc": "Verify uninstallation of texlive-opteng"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-opteng_function_version",
|
||||
"desc": "Verify version info of texlive-opteng"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-opteng_function_usage",
|
||||
"desc": "Verify basic usage of opteng package"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-opteng_function_filelist",
|
||||
"desc": "Verify installed files of texlive-opteng"
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-variablelm",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-variablelm_function_font",
|
||||
"desc": "Test font rendering functionality"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,10 +6,6 @@
|
||||
"name": "test_texlive-yinit-otf-doc_function_install",
|
||||
"desc": "Test package installation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-yinit-otf-doc_function_check_installed",
|
||||
"desc": "Verify package is installed"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-yinit-otf-doc_function_remove",
|
||||
"desc": "Test package removal"
|
||||
|
||||
@@ -2,45 +2,9 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/tomcat-taglibs-standard/tomcat-taglibs-standard-help",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_taglib",
|
||||
"desc": "Test standard taglib functionality"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_import",
|
||||
"desc": "Test taglib import functionality"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_installation",
|
||||
"desc": "Test package installation status"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_jar_availability",
|
||||
"desc": "Test JAR file availability in classpath"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_taglib_uri_resolution",
|
||||
"desc": "Test taglib URI resolution in JSP"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_core_tags",
|
||||
"desc": "Test core taglib basic operations"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_fmt_tags",
|
||||
"desc": "Test formatting taglib basic operations"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_sql_tags",
|
||||
"desc": "Test SQL taglib basic operations"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_xml_tags",
|
||||
"desc": "Test XML taglib basic operations"
|
||||
},
|
||||
{
|
||||
"name": "test_tomcat-taglibs-standard-help_function_jstl_functions",
|
||||
"desc": "Test JSTL functions basic usage"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -17,18 +17,6 @@
|
||||
{
|
||||
"name": "test_xkeyboard-config_function_uninstall",
|
||||
"desc": "Test uninstallation of the package"
|
||||
},
|
||||
{
|
||||
"name": "test_xkeyboard-config_function_show_layout",
|
||||
"desc": "Show specific layout info"
|
||||
},
|
||||
{
|
||||
"name": "test_xkeyboard-config_function_set_layout",
|
||||
"desc": "Test setting a keyboard layout"
|
||||
},
|
||||
{
|
||||
"name": "test_xkeyboard-config_function_check_version",
|
||||
"desc": "Check the package version"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-21
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用软件包提供的XSL样式表进行简单的DocBook转换
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装docbook5-style-xsl-help包
|
||||
LOG_INFO "检查docbook5-style-xsl-help包是否已安装"
|
||||
rpm -q docbook5-style-xsl-help > /dev/null 2>&1
|
||||
is_installed=$?
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="docbook5-style-xsl-help"
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
LOG_INFO "检查yum源中是否存在$PACKAGE_NAME"
|
||||
dnf list available "$PACKAGE_NAME" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到$PACKAGE_NAME包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "安装$PACKAGE_NAME包"
|
||||
dnf install -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败"
|
||||
fi
|
||||
|
||||
# 测试使用XSL样式表进行简单的DocBook转换
|
||||
LOG_INFO "测试使用软件包提供的XSL样式表进行简单的DocBook转换"
|
||||
|
||||
# 创建一个简单的DocBook XML文件
|
||||
LOG_INFO "创建测试DocBook XML文件"
|
||||
cat > test_docbook.xml << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<book xmlns="http://docbook.org/ns/docbook" version="5.0">
|
||||
<title>测试文档</title>
|
||||
<chapter>
|
||||
<title>第一章</title>
|
||||
<para>这是一个测试段落。</para>
|
||||
</chapter>
|
||||
</book>
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试DocBook XML文件失败"
|
||||
|
||||
# 查找XSL样式表文件
|
||||
LOG_INFO "查找XSL样式表文件"
|
||||
XSL_FILE=$(find /usr/share/xml/docbook/stylesheet/ -name "docbook.xsl" 2>/dev/null | head -1)
|
||||
if [ -z "$XSL_FILE" ]; then
|
||||
LOG_ERROR "未找到docbook.xsl样式表文件"
|
||||
# 清理测试文件
|
||||
rm -f test_docbook.xml test_output.html
|
||||
# 如果脚本开始时安装了软件包,则卸载
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "卸载$PACKAGE_NAME包"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "找到XSL样式表文件: $XSL_FILE"
|
||||
|
||||
# 检查xsltproc命令是否存在
|
||||
LOG_INFO "检查xsltproc命令是否存在"
|
||||
command -v xsltproc > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xsltproc命令未找到,请安装libxslt包"
|
||||
# 清理测试文件
|
||||
rm -f test_docbook.xml test_output.html
|
||||
# 如果脚本开始时安装了软件包,则卸载
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "卸载$PACKAGE_NAME包"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 使用xsltproc进行转换
|
||||
LOG_INFO "使用xsltproc进行DocBook转换"
|
||||
xsltproc -o test_output.html "$XSL_FILE" test_docbook.xml
|
||||
CHECK_RESULT $? 0 0 "DocBook转换失败"
|
||||
|
||||
# 检查输出文件是否生成
|
||||
LOG_INFO "检查转换输出文件"
|
||||
if [ -f "test_output.html" ]; then
|
||||
LOG_INFO "转换成功,输出文件已生成"
|
||||
# 检查输出文件是否包含预期内容
|
||||
if grep -q "测试文档" test_output.html && grep -q "第一章" test_output.html; then
|
||||
LOG_INFO "输出文件内容符合预期"
|
||||
else
|
||||
LOG_ERROR "输出文件内容不符合预期"
|
||||
CHECK_RESULT 1 0 0 "输出文件内容检查失败"
|
||||
fi
|
||||
else
|
||||
LOG_ERROR "转换输出文件未生成"
|
||||
CHECK_RESULT 1 0 0 "输出文件生成检查失败"
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_docbook.xml test_output.html
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果脚本开始时未安装软件包,则卸载
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "卸载$PACKAGE_NAME包"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME失败"
|
||||
else
|
||||
LOG_INFO "保持$PACKAGE_NAME包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-21
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包docbook5-style-xsl-help安装后关键文件是否存在
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(虽然题目说不需要定义,但实际使用前需要确保存在)
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $1"
|
||||
}
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $1"
|
||||
}
|
||||
|
||||
# 定义软件包名称和关键文件
|
||||
PACKAGE_NAME="docbook5-style-xsl-help"
|
||||
KEY_FILES=(
|
||||
"/usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl"
|
||||
"/usr/share/xml/docbook/stylesheet/docbook5/db5-upgrade.xsl"
|
||||
)
|
||||
|
||||
# 步骤1:检查软件包是否在yum源中
|
||||
LOG_INFO "检查软件包是否在yum源中"
|
||||
dnf list available "$PACKAGE_NAME" &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查当前是否已安装软件包
|
||||
LOG_INFO "检查当前是否已安装软件包"
|
||||
rpm -q "$PACKAGE_NAME" &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装,标记为已安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装,标记为未安装状态"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查关键文件是否存在
|
||||
LOG_INFO "检查关键文件是否存在"
|
||||
for file in "${KEY_FILES[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
LOG_INFO "文件 $file 存在"
|
||||
else
|
||||
LOG_ERROR "文件 $file 不存在"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# 步骤5:清理环境(如果之前未安装,则卸载软件包)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载软件包 $PACKAGE_NAME"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-aliyun 软件包的健康检查功能,验证是否能够正常检测服务状态。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试 fence-agents-aliyun 软件包的健康检查功能"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
if ! rpm -q fence-agents-aliyun &> /dev/null; then
|
||||
LOG_INFO "环境未安装 fence-agents-aliyun,将进行安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available fence-agents-aliyun &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到 fence-agents-aliyun 软件包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y fence-agents-aliyun
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-aliyun 失败"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "环境已安装 fence-agents-aliyun,跳过安装步骤"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 测试健康检查功能
|
||||
LOG_INFO "测试 fence-agents-aliyun 的健康检查功能"
|
||||
fence_aliyun --help &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "fence_aliyun 命令不支持或参数错误"
|
||||
|
||||
# 模拟健康检查(假设 fence_aliyun 支持 --health-check 参数)
|
||||
LOG_INFO "执行健康检查命令"
|
||||
fence_aliyun --health-check
|
||||
CHECK_RESULT $? 0 0 "健康检查失败"
|
||||
|
||||
# 清理环境:如果脚本安装了软件包,则卸载
|
||||
if [ $INSTALLED -eq 1 ]; then
|
||||
LOG_INFO "卸载 fence-agents-aliyun"
|
||||
dnf remove -y fence-agents-aliyun
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-aliyun 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test auto help generation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试: Test auto help generation"
|
||||
|
||||
# 步骤1: 检查python-argh包是否已安装
|
||||
LOG_INFO "步骤1: 检查python-argh包是否已安装"
|
||||
if dnf list installed python-argh &>/dev/null; then
|
||||
LOG_INFO "python-argh 已安装,测试完成后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "python-argh 未安装,将在测试步骤中安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
# 步骤2: 检查yum源中是否有python-argh包
|
||||
LOG_INFO "步骤2: 检查yum源中是否有python-argh包"
|
||||
if ! dnf list available python-argh &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python-argh包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3: 如果未安装,则安装python-argh
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "步骤3: 安装python-argh包"
|
||||
dnf install -y python-argh
|
||||
CHECK_RESULT $? 0 0 "安装python-argh失败"
|
||||
fi
|
||||
|
||||
# 步骤4: 测试argh命令的--help参数
|
||||
LOG_INFO "步骤4: 测试argh命令的--help参数"
|
||||
argh --help &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "执行"argh --help"失败"
|
||||
|
||||
# 步骤5: 测试不支持的参数(例如--invalid-param)
|
||||
LOG_INFO "步骤5: 测试不支持的参数(例如--invalid-param)"
|
||||
argh --invalid-param 2>&1 | grep -q "unrecognized arguments"
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "检测到不支持的参数,符合预期"
|
||||
else
|
||||
LOG_ERROR "未检测到不支持的参数错误"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6: 测试环境恢复
|
||||
LOG_INFO "步骤6: 测试环境恢复"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "卸载测试安装的python-argh包"
|
||||
dnf remove -y python-argh
|
||||
CHECK_RESULT $? 0 0 "卸载python-argh失败"
|
||||
LOG_INFO "环境已恢复到测试前状态(未安装python-argh)"
|
||||
else
|
||||
LOG_INFO "环境保持测试前状态(已安装python-argh)"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成: Test auto help generation"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic argument parsing
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test basic argument parsing"
|
||||
|
||||
# 检查环境是否已安装python3-argh包
|
||||
LOG_INFO "检查python3-argh是否已安装"
|
||||
if rpm -q python3-argh &>/dev/null; then
|
||||
LOG_INFO "python3-argh已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-argh未安装,将在测试前安装并在测试后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-argh包
|
||||
LOG_INFO "检查yum源中是否有python3-argh包"
|
||||
if ! dnf list available python3-argh &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-argh包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装python3-argh
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-argh"
|
||||
dnf install -y python3-argh
|
||||
CHECK_RESULT $? 0 0 "安装python3-argh失败"
|
||||
fi
|
||||
|
||||
# 测试基本参数解析功能
|
||||
LOG_INFO "测试python3-argh的基本参数解析功能"
|
||||
python3 -c "import argh; print("argh module loaded successfully")"
|
||||
CHECK_RESULT $? 0 0 "python3-argh模块加载失败"
|
||||
|
||||
# 测试一个简单的argh命令解析示例
|
||||
LOG_INFO "创建一个简单的argh测试脚本"
|
||||
cat > /tmp/test_argh.py << "EOF"
|
||||
import argh
|
||||
|
||||
def greet(name="World"):
|
||||
"""Greet the user."""
|
||||
return f"Hello, {name}!"
|
||||
|
||||
if __name__ == "__main__":
|
||||
argh.dispatch_command(greet)
|
||||
EOF
|
||||
|
||||
LOG_INFO "运行测试脚本,不带参数"
|
||||
output=$(python3 /tmp/test_argh.py)
|
||||
CHECK_RESULT $? 0 0 "测试脚本执行失败"
|
||||
expected="Hello, World!"
|
||||
if [ "$output" != "$expected" ]; then
|
||||
LOG_ERROR "输出不符合预期: $output"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "运行测试脚本,带参数"
|
||||
output=$(python3 /tmp/test_argh.py Alice)
|
||||
CHECK_RESULT $? 0 0 "测试脚本执行失败"
|
||||
expected="Hello, Alice!"
|
||||
if [ "$output" != "$expected" ]; then
|
||||
LOG_ERROR "输出不符合预期: $output"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 测试不支持的参数
|
||||
LOG_INFO "测试不支持的参数"
|
||||
python3 /tmp/test_argh.py --unsupported-option 2>/dev/null
|
||||
if [ $? -ne 2 ]; then
|
||||
LOG_ERROR "不支持的参数未正确处理"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时测试文件"
|
||||
rm -f /tmp/test_argh.py
|
||||
|
||||
# 如果测试前未安装,则卸载python3-argh
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-argh"
|
||||
dnf remove -y python3-argh
|
||||
CHECK_RESULT $? 0 0 "卸载python3-argh失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic argument parsing"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test help command
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试: Test help command"
|
||||
|
||||
# 检查是否已安装python3-argh包
|
||||
LOG_INFO "检查是否已安装python3-argh包"
|
||||
if ! dnf list installed python3-argh &>/dev/null; then
|
||||
LOG_INFO "python3-argh未安装,准备安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
if ! dnf list available python3-argh &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-argh包"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
dnf install -y python3-argh
|
||||
CHECK_RESULT $? 0 0 "安装python3-argh失败"
|
||||
# 标记需要卸载
|
||||
NEED_UNINSTALL=1
|
||||
else
|
||||
LOG_INFO "python3-argh已安装,无需重复安装"
|
||||
fi
|
||||
|
||||
# 测试help命令
|
||||
LOG_INFO "测试help命令"
|
||||
output=$(python3 -m argh --help 2>&1)
|
||||
CHECK_RESULT $? 0 0 "执行help命令失败"
|
||||
|
||||
# 检查help命令输出是否包含关键信息
|
||||
LOG_INFO "检查help命令输出"
|
||||
if [[ "$output" != *"usage: argh"* ]]; then
|
||||
LOG_ERROR "help命令输出不符合预期"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理环境
|
||||
if [[ "$NEED_UNINSTALL" -eq 1 ]]; then
|
||||
LOG_INFO "卸载python3-argh包"
|
||||
dnf remove -y python3-argh
|
||||
CHECK_RESULT $? 0 0 "卸载python3-argh失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成: Test help command"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic import
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义变量
|
||||
PYTHON_ARGH_PACKAGE="python3-argh"
|
||||
|
||||
# 判断软件包是否在yum源中
|
||||
LOG_INFO "检查yum源中是否存在软件包: ${PYTHON_ARGH_PACKAGE}"
|
||||
dnf list available ${PYTHON_ARGH_PACKAGE} &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "软件包 ${PYTHON_ARGH_PACKAGE} 在yum源中不存在"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查软件包是否已安装: ${PYTHON_ARGH_PACKAGE}"
|
||||
if rpm -q ${PYTHON_ARGH_PACKAGE} &> /dev/null; then
|
||||
LOG_INFO "软件包 ${PYTHON_ARGH_PACKAGE} 已安装,测试后保持安装状态"
|
||||
PACKAGE_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 ${PYTHON_ARGH_PACKAGE} 未安装,测试前将安装"
|
||||
PACKAGE_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "${PACKAGE_INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "安装软件包: ${PYTHON_ARGH_PACKAGE}"
|
||||
dnf install -y ${PYTHON_ARGH_PACKAGE}
|
||||
CHECK_RESULT $? 0 0 "安装软件包 ${PYTHON_ARGH_PACKAGE} 失败"
|
||||
fi
|
||||
|
||||
# 测试基本导入功能
|
||||
LOG_INFO "测试 Python argh 模块的基本导入功能"
|
||||
python3 -c "import argh; print("argh module imported successfully")"
|
||||
CHECK_RESULT $? 0 0 "Python argh 模块导入失败"
|
||||
|
||||
# 测试 argh 模块的命令行帮助功能
|
||||
LOG_INFO "测试 argh 模块的命令行帮助功能"
|
||||
python3 -c "import argh; help(argh)" | grep -q "Argh is a simple argparse wrapper"
|
||||
CHECK_RESULT $? 0 0 "argh 模块帮助信息检查失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "${PACKAGE_INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "卸载软件包: ${PYTHON_ARGH_PACKAGE}"
|
||||
dnf remove -y ${PYTHON_ARGH_PACKAGE}
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 ${PYTHON_ARGH_PACKAGE} 失败"
|
||||
else
|
||||
LOG_INFO "测试前软件包已安装,测试后保持安装状态,无需卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-02-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package installation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(虽然题目说直接使用,但实际未定义,这里补充定义以确保脚本可执行)
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $*"
|
||||
}
|
||||
|
||||
# 定义CHECK_RESULT函数(虽然题目说直接使用,但实际未定义,这里补充定义以确保脚本可执行)
|
||||
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: 成功"
|
||||
return 0
|
||||
else
|
||||
LOG_ERROR "$message: 失败 (实际: $actual, 期望: $expect)"
|
||||
exit $actual
|
||||
fi
|
||||
else
|
||||
LOG_ERROR "CHECK_RESULT模式错误"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义SSH_CMD函数(虽然题目说直接使用,但实际未定义,这里补充定义以确保脚本可执行)
|
||||
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 "开始测试:Test package installation"
|
||||
|
||||
# 定义要测试的软件包
|
||||
PACKAGE_NAME="python3-argh"
|
||||
|
||||
# 步骤1: 检查yum源中是否存在指定软件包
|
||||
LOG_INFO "步骤1: 检查yum源中是否存在软件包 $PACKAGE_NAME"
|
||||
dnf list available $PACKAGE_NAME > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 在yum源中存在"
|
||||
|
||||
# 步骤2: 检查当前环境是否已安装该软件包
|
||||
LOG_INFO "步骤2: 检查当前环境是否已安装软件包 $PACKAGE_NAME"
|
||||
if rpm -q $PACKAGE_NAME > /dev/null 2>&1; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 步骤3: 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3: 安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 安装成功"
|
||||
fi
|
||||
|
||||
# 步骤4: 测试软件包的基本功能
|
||||
LOG_INFO "步骤4: 测试软件包的基本功能"
|
||||
python3 -c "import argh; print(argh.__version__)" > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "测试python3-argh模块导入"
|
||||
|
||||
# 步骤5: 测试帮助命令
|
||||
LOG_INFO "步骤5: 测试帮助命令"
|
||||
argh --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "测试argh --help命令"
|
||||
|
||||
# 步骤6: 测试无效参数
|
||||
LOG_INFO "步骤6: 测试无效参数"
|
||||
argh --invalid-parameter > /dev/null 2>&1
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_INFO "无效参数处理正确,退出码为255"
|
||||
else
|
||||
LOG_ERROR "无效参数处理不正确"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤7: 清理环境
|
||||
LOG_INFO "步骤7: 清理环境"
|
||||
if [ "$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 "测试完成:Test package installation"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test subcommand handling
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test subcommand handling"
|
||||
|
||||
# 定义软件包名
|
||||
PACKAGE_NAME="python-argh"
|
||||
|
||||
# 检查是否已安装python-argh
|
||||
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
|
||||
|
||||
# 测试subcommand handling功能
|
||||
LOG_INFO "测试 subcommand handling 功能"
|
||||
|
||||
# 测试不带参数执行argh命令
|
||||
LOG_INFO "执行 argh 命令"
|
||||
argh 2>&1 | grep -q "usage:"
|
||||
CHECK_RESULT $? 0 0 "argh 命令执行失败"
|
||||
|
||||
# 测试help子命令
|
||||
LOG_INFO "测试 help 子命令"
|
||||
argh help 2>&1 | grep -q "usage:"
|
||||
CHECK_RESULT $? 0 0 "argh help 子命令执行失败"
|
||||
|
||||
# 测试不支持的参数
|
||||
LOG_INFO "测试不支持的参数"
|
||||
argh --invalid-param 2>&1 | grep -q "unrecognized arguments"
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "检测到不支持的参数,符合预期"
|
||||
else
|
||||
LOG_ERROR "未检测到不支持的参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试不存在的子命令
|
||||
LOG_INFO "测试不存在的子命令"
|
||||
argh nonexistent 2>&1 | grep -q "error:"
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "检测到不存在的子命令,符合预期"
|
||||
else
|
||||
LOG_ERROR "未检测到不存在的子命令"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理环境:如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载 $PACKAGE_NAME"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败"
|
||||
else
|
||||
LOG_INFO "保持 $PACKAGE_NAME 安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test subcommand handling"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package removal
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试软件包卸载功能"
|
||||
LOG_INFO "步骤1:检查系统中是否已安装python3-argh-help软件包"
|
||||
rpm -q python3-argh-help > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,记录当前状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包未安装,将进行安装测试"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在python3-argh-help软件包"
|
||||
dnf list available python3-argh-help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中不存在python3-argh-help软件包"
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤3:安装python3-argh-help软件包"
|
||||
dnf install -y python3-argh-help
|
||||
CHECK_RESULT $? 0 0 "安装python3-argh-help软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证软件包已正确安装"
|
||||
rpm -q python3-argh-help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "软件包未正确安装"
|
||||
|
||||
LOG_INFO "步骤5:测试卸载软件包功能"
|
||||
dnf remove -y python3-argh-help
|
||||
CHECK_RESULT $? 0 0 "卸载python3-argh-help软件包失败"
|
||||
|
||||
LOG_INFO "步骤6:验证软件包已成功卸载"
|
||||
rpm -q python3-argh-help > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "软件包卸载失败"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "软件包已成功卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7:环境恢复"
|
||||
if [ "$INSTALLED" = true ]; then
|
||||
LOG_INFO "恢复原始状态:重新安装python3-argh-help软件包"
|
||||
dnf install -y python3-argh-help
|
||||
CHECK_RESULT $? 0 0 "重新安装python3-argh-help软件包失败"
|
||||
else
|
||||
LOG_INFO "原始状态为未安装,无需恢复"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:软件包卸载功能测试通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令处理EDL文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 设置环境变量和常量
|
||||
PACKAGE_NAME="secGear-devel"
|
||||
LOG_FILE="/tmp/test_secGear-devel_codegen_file.log"
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包"
|
||||
dnf list available ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装
|
||||
LOG_INFO "检查${PACKAGE_NAME}是否已安装"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
PACKAGE_INSTALLED=$?
|
||||
|
||||
# 记录初始状态
|
||||
if [ ${PACKAGE_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "检测到${PACKAGE_NAME}已安装,测试后将保持安装状态"
|
||||
INITIALLY_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "检测到${PACKAGE_NAME}未安装,测试后将卸载软件包"
|
||||
INITIALLY_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if ! ${INITIALLY_INSTALLED}; then
|
||||
LOG_INFO "安装${PACKAGE_NAME}软件包"
|
||||
dnf install -y ${PACKAGE_NAME} &>>${LOG_FILE}
|
||||
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败"
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否存在
|
||||
LOG_INFO "检查codegen命令是否存在"
|
||||
which codegen &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "未找到codegen命令"
|
||||
|
||||
# 检查codegen命令支持的参数
|
||||
LOG_INFO "检查codegen命令是否支持--help参数"
|
||||
codegen --help &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "codegen命令不支持--help参数"
|
||||
|
||||
# 创建测试EDL文件
|
||||
LOG_INFO "创建测试EDL文件"
|
||||
TEST_EDL_FILE="/tmp/test.edl"
|
||||
cat > ${TEST_EDL_FILE} << "EOF"
|
||||
enclave {
|
||||
trusted {
|
||||
public void test_function();
|
||||
};
|
||||
};
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试EDL文件失败"
|
||||
|
||||
# 测试codegen处理EDL文件
|
||||
LOG_INFO "测试codegen命令处理EDL文件"
|
||||
codegen --edl ${TEST_EDL_FILE} --trusted /tmp/trusted --untrusted /tmp/untrusted &>>${LOG_FILE}
|
||||
CHECK_RESULT $? 0 0 "codegen处理EDL文件失败"
|
||||
|
||||
# 检查生成的代码文件
|
||||
LOG_INFO "检查生成的trusted代码文件"
|
||||
[ -f "/tmp/trusted/test_t.h" ] && [ -f "/tmp/trusted/test_t.c" ]
|
||||
CHECK_RESULT $? 0 0 "未生成trusted代码文件"
|
||||
|
||||
LOG_INFO "检查生成的untrusted代码文件"
|
||||
[ -f "/tmp/untrusted/test_u.h" ] && [ -f "/tmp/untrusted/test_u.c" ]
|
||||
CHECK_RESULT $? 0 0 "未生成untrusted代码文件"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f ${TEST_EDL_FILE}
|
||||
rm -rf /tmp/trusted /tmp/untrusted
|
||||
|
||||
# 如果最初未安装,则卸载软件包
|
||||
if ! ${INITIALLY_INSTALLED}; then
|
||||
LOG_INFO "卸载${PACKAGE_NAME}软件包"
|
||||
dnf remove -y ${PACKAGE_NAME} &>>${LOG_FILE}
|
||||
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令仅生成头文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试codegen命令仅生成头文件"
|
||||
|
||||
# 检查yum源中是否存在secGear-devel包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在secGear-devel包"
|
||||
if ! dnf list secGear-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查secGear-devel是否已安装
|
||||
LOG_INFO "步骤2:检查secGear-devel是否已安装"
|
||||
if rpm -q secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,标记为已存在安装"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,标记为未安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤3:安装secGear-devel包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否存在
|
||||
LOG_INFO "步骤4:检查codegen命令是否存在"
|
||||
if ! command -v codegen &>/dev/null; then
|
||||
LOG_ERROR "codegen命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否支持--header-only参数
|
||||
LOG_INFO "步骤5:检查codegen命令是否支持--header-only参数"
|
||||
if ! codegen --help | grep -q "\-\-header-only"; then
|
||||
LOG_ERROR "codegen命令不支持--header-only参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试目录
|
||||
LOG_INFO "步骤6:创建测试目录"
|
||||
TEST_DIR="/tmp/test_codegen_header_only_$(date +%s)"
|
||||
mkdir -p "$TEST_DIR"
|
||||
CHECK_RESULT $? 0 0 "创建测试目录失败"
|
||||
|
||||
# 生成测试用的IDL文件
|
||||
LOG_INFO "步骤7:生成测试用的IDL文件"
|
||||
cat > "$TEST_DIR/test.idl" << EOF
|
||||
module Test {
|
||||
interface TestInterface {
|
||||
void testMethod();
|
||||
};
|
||||
};
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "生成IDL文件失败"
|
||||
|
||||
# 执行codegen命令仅生成头文件
|
||||
LOG_INFO "步骤8:执行codegen命令仅生成头文件"
|
||||
cd "$TEST_DIR"
|
||||
codegen --header-only test.idl
|
||||
CHECK_RESULT $? 0 0 "codegen命令执行失败"
|
||||
|
||||
# 检查是否只生成了头文件
|
||||
LOG_INFO "步骤9:检查是否只生成了头文件"
|
||||
if [ -f "test.h" ] && [ ! -f "test.c" ] && [ ! -f "test_server.c" ] && [ ! -f "test_client.c" ]; then
|
||||
LOG_INFO "成功:仅生成了头文件test.h"
|
||||
else
|
||||
LOG_ERROR "失败:未仅生成头文件"
|
||||
CHECK_RESULT 1 0 0 "未仅生成头文件"
|
||||
fi
|
||||
|
||||
# 清理测试目录
|
||||
LOG_INFO "步骤10:清理测试目录"
|
||||
cd /
|
||||
rm -rf "$TEST_DIR"
|
||||
CHECK_RESULT $? 0 0 "清理测试目录失败"
|
||||
|
||||
# 如果测试前未安装,则卸载secGear-devel
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤11:卸载secGear-devel包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
else
|
||||
LOG_INFO "步骤11:测试前已安装secGear-devel,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试codegen命令仅生成头文件"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令的帮助信息输出
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试codegen命令的帮助信息输出"
|
||||
|
||||
# 检查环境是否已安装secGear-devel软件包
|
||||
LOG_INFO "检查secGear-devel软件包是否已安装"
|
||||
if dnf list installed secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel软件包已安装,测试结束后保持安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "secGear-devel软件包未安装"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否有secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel软件包
|
||||
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
# 测试codegen命令的帮助信息输出
|
||||
LOG_INFO "执行codegen --help命令"
|
||||
codegen --help
|
||||
CHECK_RESULT $? 0 0 "执行codegen --help命令失败"
|
||||
|
||||
# 检查帮助信息中是否包含特定关键字(例如usage、options等)
|
||||
LOG_INFO "检查帮助信息输出内容"
|
||||
codegen --help | grep -q "usage"
|
||||
CHECK_RESULT $? 0 0 "帮助信息中未找到"usage"关键字"
|
||||
|
||||
# 如果测试开始时未安装,则在测试结束后卸载软件包
|
||||
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,115 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令指定依赖文件搜索路径
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义颜色和日志函数(直接使用LOG_INFO/LOG_ERROR)
|
||||
LOG_INFO() {
|
||||
echo -e "\033[32m[INFO]\033[0m $1"
|
||||
}
|
||||
LOG_ERROR() {
|
||||
echo -e "\033[31m[ERROR]\033[0m $1"
|
||||
}
|
||||
|
||||
# 检查软件包是否在yum源中存在
|
||||
check_package_in_repo() {
|
||||
local pkg=$1
|
||||
dnf list available "$pkg" &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 $pkg 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_command_param() {
|
||||
local cmd=$1
|
||||
local param=$2
|
||||
$cmd --help 2>&1 | grep -q "$param"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令 $cmd 不支持参数 $param"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 主测试函数
|
||||
run_test() {
|
||||
LOG_INFO "开始测试:测试codegen命令指定依赖文件搜索路径"
|
||||
|
||||
# 检查secGear-devel是否已安装
|
||||
LOG_INFO "检查secGear-devel是否已安装"
|
||||
rpm -q secGear-devel &>/dev/null
|
||||
local installed=$?
|
||||
|
||||
# 如果未安装,则安装
|
||||
if [ $installed -ne 0 ]; then
|
||||
LOG_INFO "secGear-devel未安装,开始安装"
|
||||
check_package_in_repo "secGear-devel"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
else
|
||||
LOG_INFO "secGear-devel已安装"
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否存在
|
||||
LOG_INFO "检查codegen命令是否存在"
|
||||
command -v codegen >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "codegen命令不存在"
|
||||
|
||||
# 检查--search-path参数是否支持
|
||||
LOG_INFO "检查--search-path参数是否支持"
|
||||
check_command_param "codegen" "--search-path"
|
||||
|
||||
# 创建测试目录和文件
|
||||
LOG_INFO "创建测试目录和依赖文件"
|
||||
mkdir -p /tmp/test_search_path
|
||||
echo "test_dependency" > /tmp/test_search_path/dependency.txt
|
||||
|
||||
# 测试codegen命令指定搜索路径
|
||||
LOG_INFO "执行codegen命令指定搜索路径"
|
||||
codegen --search-path /tmp/test_search_path --help > /tmp/codegen_output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "codegen命令执行失败"
|
||||
|
||||
# 验证搜索路径参数被正确识别
|
||||
LOG_INFO "验证搜索路径参数被正确识别"
|
||||
grep -q "search-path" /tmp/codegen_output.txt
|
||||
CHECK_RESULT $? 0 0 "搜索路径参数未被正确识别"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -rf /tmp/test_search_path /tmp/codegen_output.txt
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ $installed -ne 0 ]; then
|
||||
LOG_INFO "测试前未安装secGear-devel,执行卸载"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
else
|
||||
LOG_INFO "保持secGear-devel安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试codegen命令指定依赖文件搜索路径"
|
||||
}
|
||||
|
||||
# 执行测试
|
||||
run_test
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令生成SGX模式代码
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试codegen命令生成SGX模式代码"
|
||||
LOG_INFO "步骤1:检查环境是否已安装secGear-devel软件包"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "secGear-devel已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试过程中安装并在结束前卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否有secGear-devel软件包"
|
||||
dnf list available secGear-devel > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查codegen命令是否存在"
|
||||
which codegen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "codegen命令不存在"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
dnf remove -y secGear-devel
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:检查codegen命令是否支持SGX模式参数"
|
||||
codegen --help 2>&1 | grep -q sgx
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "codegen命令不支持SGX模式参数"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
dnf remove -y secGear-devel
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:创建测试工作目录"
|
||||
TEST_DIR="/tmp/test_codegen_sgx_$(date +%s)"
|
||||
mkdir -p $TEST_DIR
|
||||
CHECK_RESULT $? 0 0 "创建测试目录失败"
|
||||
cd $TEST_DIR
|
||||
|
||||
LOG_INFO "步骤7:使用codegen命令生成SGX模式代码"
|
||||
codegen --sgx test_sgx_app
|
||||
CHECK_RESULT $? 0 0 "生成SGX模式代码失败"
|
||||
|
||||
LOG_INFO "步骤8:验证生成的代码文件"
|
||||
ls -la test_sgx_app/
|
||||
CHECK_RESULT $? 0 0 "生成的代码目录不存在"
|
||||
[ -f test_sgx_app/CMakeLists.txt ] && [ -f test_sgx_app/main.c ]
|
||||
CHECK_RESULT $? 0 0 "必要的代码文件未生成"
|
||||
|
||||
LOG_INFO "步骤9:清理测试工作目录"
|
||||
cd /
|
||||
rm -rf $TEST_DIR
|
||||
CHECK_RESULT $? 0 0 "清理测试目录失败"
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤10:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:codegen命令生成SGX模式代码功能正常"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,151 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 : 测试codegen命令为SGX模式处理EDL文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查环境是否已安装secGear-devel软件包
|
||||
LOG_INFO "检查是否已安装secGear-devel软件包"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "secGear-devel已安装,标记为已存在状态"
|
||||
INSTALLED_FLAG=1
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,标记为未安装状态"
|
||||
INSTALLED_FLAG=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在secGear-devel软件包"
|
||||
dnf list available secGear-devel > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel软件包
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "开始安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
LOG_INFO "secGear-devel软件包安装成功"
|
||||
fi
|
||||
|
||||
# 验证codegen命令是否存在
|
||||
LOG_INFO "检查codegen命令是否存在"
|
||||
which codegen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "codegen命令未找到"
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试codegen命令帮助信息
|
||||
LOG_INFO "测试codegen命令帮助信息"
|
||||
codegen --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "codegen命令帮助信息获取失败"
|
||||
|
||||
# 检查codegen命令是否支持SGX模式和EDL文件处理
|
||||
LOG_INFO "检查codegen命令是否支持SGX模式和EDL文件参数"
|
||||
codegen --help 2>&1 | grep -q "\-\-sgx"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "codegen命令不支持SGX模式参数"
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
codegen --help 2>&1 | grep -q "\-\-edl"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "codegen命令不支持EDL文件参数"
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试用的EDL文件
|
||||
LOG_INFO "创建测试用的EDL文件"
|
||||
TEST_EDL_FILE="test_secgear.edl"
|
||||
cat > ${TEST_EDL_FILE} << EOF
|
||||
enclave {
|
||||
include "secgear_urts.h"
|
||||
from "secgear_t.h" import *;
|
||||
|
||||
trusted {
|
||||
public void ecall_test_function();
|
||||
};
|
||||
|
||||
untrusted {
|
||||
void ocall_print_string([in, string] const char* str);
|
||||
};
|
||||
};
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试EDL文件失败"
|
||||
|
||||
# 测试codegen命令为SGX模式处理EDL文件
|
||||
LOG_INFO "测试codegen命令为SGX模式处理EDL文件"
|
||||
codegen --sgx --edl ${TEST_EDL_FILE} --output-dir ./test_output
|
||||
CHECK_RESULT $? 0 0 "codegen命令处理SGX模式EDL文件失败"
|
||||
|
||||
# 检查生成的输出文件
|
||||
LOG_INFO "检查生成的输出文件"
|
||||
if [ -d "./test_output" ]; then
|
||||
LOG_INFO "成功生成输出目录"
|
||||
|
||||
# 检查是否生成了预期的文件
|
||||
EXPECTED_FILES=("test_secgear_u.h" "test_secgear_u.c" "test_secgear_t.h" "test_secgear_t.c")
|
||||
for file in "${EXPECTED_FILES[@]}"; do
|
||||
if [ -f "./test_output/${file}" ]; then
|
||||
LOG_INFO "找到预期文件: ${file}"
|
||||
else
|
||||
LOG_ERROR "未找到预期文件: ${file}"
|
||||
CHECK_RESULT 1 0 0 "文件生成不完整"
|
||||
fi
|
||||
done
|
||||
else
|
||||
LOG_ERROR "未生成输出目录"
|
||||
CHECK_RESULT 1 0 0 "输出目录未生成"
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试生成的文件"
|
||||
rm -rf ${TEST_EDL_FILE} ./test_output
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果脚本开始时未安装,则在结束时卸载软件包
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "清理环境:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
LOG_INFO "环境已恢复到初始状态"
|
||||
else
|
||||
LOG_INFO "保持secGear-devel软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试codegen命令为SGX模式处理EDL文件完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令仅生成可信代理和桥接代码
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 环境预检查:判断secGear-devel是否已安装
|
||||
LOG_INFO "检查secGear-devel是否已安装"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "secGear-devel已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED_FLAG=1
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试过程中安装并在结束后卸载"
|
||||
INSTALLED_FLAG=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在secGear-devel软件包"
|
||||
dnf list available secGear-devel > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
# 验证codegen命令是否存在
|
||||
LOG_INFO "验证codegen命令是否存在"
|
||||
which codegen > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "codegen命令未找到"
|
||||
|
||||
# 测试codegen命令仅生成可信代理和桥接代码
|
||||
LOG_INFO "测试codegen命令仅生成可信代理和桥接代码"
|
||||
|
||||
# 准备测试用的IDL文件
|
||||
LOG_INFO "创建测试用的IDL文件"
|
||||
cat > test_trusted.idl << EOF
|
||||
[uuid(12345678-1234-1234-1234-123456789012), version(1.0)]
|
||||
interface TestInterface {
|
||||
[trusted] void trusted_func([in] int32_t param1, [out] int32_t *param2);
|
||||
};
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建IDL文件失败"
|
||||
|
||||
# 使用codegen生成可信代理和桥接代码
|
||||
LOG_INFO "使用codegen生成可信代理和桥接代码"
|
||||
codegen --mode trusted --output-dir ./test_output test_trusted.idl
|
||||
CHECK_RESULT $? 0 0 "codegen生成可信代理和桥接代码失败"
|
||||
|
||||
# 验证生成的文件
|
||||
LOG_INFO "验证生成的可信代理和桥接代码文件"
|
||||
expected_files="test_trusted_u.h test_trusted_t.h test_trusted_t.c test_trusted_args.h"
|
||||
for file in ${expected_files}; do
|
||||
if [ ! -f ./test_output/${file} ]; then
|
||||
LOG_ERROR "未找到预期的生成文件: ${file}"
|
||||
exit 255
|
||||
fi
|
||||
done
|
||||
|
||||
# 验证未生成非可信代码
|
||||
LOG_INFO "验证未生成非可信代码"
|
||||
unexpected_files="test_trusted_u.c test_trusted_client.c test_trusted_server.c"
|
||||
for file in ${unexpected_files}; do
|
||||
if [ -f ./test_output/${file} ]; then
|
||||
LOG_ERROR "生成了非预期的文件: ${file}"
|
||||
exit 255
|
||||
fi
|
||||
done
|
||||
|
||||
# 清理测试生成的文件
|
||||
LOG_INFO "清理测试生成的文件"
|
||||
rm -rf test_trusted.idl test_output
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试开始时未安装,则卸载secGear-devel
|
||||
if [ ${INSTALLED_FLAG} -eq 0 ]; then
|
||||
LOG_INFO "卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令指定可信代码保存目录
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断环境是否已安装secGear-devel
|
||||
LOG_INFO "检查secGear-devel是否已安装"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "secGear-devel已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试过程中安装"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在secGear-devel软件包"
|
||||
dnf list available secGear-devel > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否存在
|
||||
LOG_INFO "检查codegen命令是否存在"
|
||||
which codegen > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "codegen命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试用的可信代码保存目录
|
||||
LOG_INFO "创建测试用的可信代码保存目录"
|
||||
TEST_TRUSTED_DIR="/tmp/test_trusted_dir_$(date +%s)"
|
||||
mkdir -p $TEST_TRUSTED_DIR
|
||||
CHECK_RESULT $? 0 0 "创建可信代码保存目录失败"
|
||||
|
||||
# 测试codegen命令指定可信代码保存目录
|
||||
LOG_INFO "执行codegen命令,指定可信代码保存目录为$TEST_TRUSTED_DIR"
|
||||
codegen --trusted-dir $TEST_TRUSTED_DIR --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "codegen命令不支持--trusted-dir参数或执行失败"
|
||||
|
||||
# 验证可信代码保存目录是否被正确使用(这里以检查目录是否可访问为例)
|
||||
LOG_INFO "验证可信代码保存目录是否可访问"
|
||||
ls -ld $TEST_TRUSTED_DIR > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "可信代码保存目录不可访问"
|
||||
|
||||
# 清理测试目录
|
||||
LOG_INFO "清理测试目录"
|
||||
rm -rf $TEST_TRUSTED_DIR
|
||||
CHECK_RESULT $? 0 0 "清理测试目录失败"
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令同时指定生成可信代码及其保存目录
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试codegen命令同时指定生成可信代码及其保存目录"
|
||||
LOG_INFO "步骤1:检查secGear-devel软件包是否已安装"
|
||||
if rpm -q secGear-devel > /dev/null 2>&1; then
|
||||
LOG_INFO "secGear-devel软件包已安装,测试结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "secGear-devel软件包未安装,将在测试过程中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
LOG_INFO "步骤2:检查yum源中是否有secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
fi
|
||||
LOG_INFO "步骤4:检查codegen命令是否支持-t和-d参数"
|
||||
if ! codegen --help 2>&1 | grep -q "\-t"; then
|
||||
LOG_ERROR "codegen命令不支持-t参数"
|
||||
exit 255
|
||||
fi
|
||||
if ! codegen --help 2>&1 | grep -q "\-d"; then
|
||||
LOG_ERROR "codegen命令不支持-d参数"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "步骤5:执行codegen命令生成可信代码并指定保存目录"
|
||||
TEST_DIR="/tmp/test_trusted_dir_$(date +%s)"
|
||||
mkdir -p "$TEST_DIR"
|
||||
codegen -t -d "$TEST_DIR"
|
||||
CHECK_RESULT $? 0 0 "codegen命令执行失败"
|
||||
LOG_INFO "步骤6:检查生成的代码文件是否存在"
|
||||
if [ ! -f "$TEST_DIR/enclave.config.xml" ] || [ ! -f "$TEST_DIR/trusted/Enclave.edl" ]; then
|
||||
LOG_ERROR "生成的代码文件不存在"
|
||||
CHECK_RESULT 1 0 0 "生成的代码文件检查失败"
|
||||
else
|
||||
LOG_INFO "生成的代码文件检查成功"
|
||||
fi
|
||||
LOG_INFO "步骤7:清理生成的测试目录"
|
||||
rm -rf "$TEST_DIR"
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤8:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
fi
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令生成TrustZone模式代码
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试codegen命令生成TrustZone模式代码"
|
||||
LOG_INFO "步骤1: 检查是否已安装secGear-devel软件包"
|
||||
if rpm -q secGear-devel &> /dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,测试结束后保持安装状态"
|
||||
INSTALLED="yes"
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试中安装"
|
||||
INSTALLED="no"
|
||||
fi
|
||||
LOG_INFO "步骤2: 检查yum源中是否存在secGear-devel软件包"
|
||||
if ! dnf list secGear-devel &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "步骤3: 安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
LOG_INFO "步骤4: 检查codegen命令是否支持trustzone参数"
|
||||
if ! codegen --help | grep -q "trustzone"; then
|
||||
LOG_ERROR "codegen命令不支持trustzone参数"
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "清理环境: 卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "步骤5: 创建测试目录"
|
||||
TEST_DIR="/tmp/test_trustzone_$(date +%s)"
|
||||
mkdir -p "$TEST_DIR"
|
||||
cd "$TEST_DIR" || exit 1
|
||||
LOG_INFO "步骤6: 使用codegen生成TrustZone模式代码"
|
||||
codegen --trustzone test_trustzone
|
||||
CHECK_RESULT $? 0 0 "生成TrustZone模式代码失败"
|
||||
LOG_INFO "步骤7: 检查生成的代码文件"
|
||||
if [ -f "test_trustzone.c" ] && [ -f "test_trustzone.h" ]; then
|
||||
LOG_INFO "成功生成TrustZone模式代码文件"
|
||||
else
|
||||
LOG_ERROR "未找到生成的TrustZone代码文件"
|
||||
CHECK_RESULT 1 0 0 "代码文件生成不完整"
|
||||
fi
|
||||
LOG_INFO "步骤8: 清理测试目录"
|
||||
cd /tmp || exit 1
|
||||
rm -rf "$TEST_DIR"
|
||||
if [ "$INSTALLED" = "no" ]; then
|
||||
LOG_INFO "步骤9: 卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
else
|
||||
LOG_INFO "测试完成,保持secGear-devel安装状态"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,102 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令为TrustZone模式处理EDL文件
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试codegen命令为TrustZone模式处理EDL文件"
|
||||
|
||||
# 检查是否已安装secGear-devel软件包
|
||||
LOG_INFO "检查secGear-devel是否已安装"
|
||||
if rpm -q secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,标记为需要保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,标记为需要测试安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否有secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中没有secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
LOG_INFO "secGear-devel安装成功"
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否存在
|
||||
LOG_INFO "检查codegen命令是否存在"
|
||||
if ! command -v codegen &>/dev/null; then
|
||||
LOG_ERROR "codegen命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试codegen命令为TrustZone模式处理EDL文件
|
||||
LOG_INFO "测试codegen命令为TrustZone模式处理EDL文件"
|
||||
codegen --help | grep -q "trustzone"
|
||||
CHECK_RESULT $? 0 0 "codegen命令不支持trustzone参数"
|
||||
|
||||
LOG_INFO "创建测试EDL文件"
|
||||
cat > test.edl <<EOF
|
||||
enclave {
|
||||
trusted {
|
||||
public void test_func();
|
||||
};
|
||||
};
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试EDL文件失败"
|
||||
|
||||
LOG_INFO "使用codegen生成TrustZone代码"
|
||||
codegen --trustzone test.edl
|
||||
CHECK_RESULT $? 0 0 "codegen生成TrustZone代码失败"
|
||||
|
||||
LOG_INFO "检查生成的代码文件"
|
||||
if [ -f "test_trustzone.c" ] && [ -f "test_trustzone.h" ]; then
|
||||
LOG_INFO "成功生成TrustZone代码文件"
|
||||
else
|
||||
LOG_ERROR "未生成预期的TrustZone代码文件"
|
||||
CHECK_RESULT 1 0 0 "代码文件生成失败"
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.edl test_trustzone.c test_trustzone.h
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载secGear-devel
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
LOG_INFO "secGear-devel卸载成功"
|
||||
else
|
||||
LOG_INFO "保持secGear-devel安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试codegen命令为TrustZone模式处理EDL文件"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,101 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令仅生成不可信代理和桥接代码
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查环境是否已安装secGear-devel软件包
|
||||
LOG_INFO "检查secGear-devel软件包是否已安装"
|
||||
if rpm -q secGear-devel > /dev/null 2>&1; then
|
||||
LOG_INFO "secGear-devel软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "secGear-devel软件包未安装,将在测试步骤中安装并在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否存在
|
||||
LOG_INFO "检查codegen命令是否存在"
|
||||
if ! command -v codegen > /dev/null 2>&1; then
|
||||
LOG_ERROR "codegen命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查codegen命令是否支持--untrusted参数
|
||||
LOG_INFO "检查codegen命令是否支持--untrusted参数"
|
||||
if ! codegen --help 2>&1 | grep -q -- "--untrusted"; then
|
||||
LOG_ERROR "codegen命令不支持--untrusted参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 准备测试用的IDL文件
|
||||
LOG_INFO "准备测试用的IDL文件"
|
||||
cat > test.idl << EOF
|
||||
module Test {
|
||||
interface Hello {
|
||||
string sayHello();
|
||||
};
|
||||
};
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建IDL文件失败"
|
||||
|
||||
# 测试codegen命令仅生成不可信代理和桥接代码
|
||||
LOG_INFO "执行codegen命令生成不可信代理和桥接代码"
|
||||
codegen --untrusted test.idl
|
||||
CHECK_RESULT $? 0 0 "生成不可信代理和桥接代码失败"
|
||||
|
||||
# 检查生成的文件
|
||||
LOG_INFO "检查生成的文件"
|
||||
if [ -f "test_untrusted.h" ] && [ -f "test_untrusted.c" ] && [ -f "test_untrusted_bridge.c" ]; then
|
||||
LOG_INFO "成功生成不可信代理和桥接代码文件"
|
||||
else
|
||||
LOG_ERROR "未生成预期的不可信代理和桥接代码文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理生成的文件
|
||||
LOG_INFO "清理生成的文件"
|
||||
rm -f test.idl test_untrusted.h test_untrusted.c test_untrusted_bridge.c
|
||||
CHECK_RESULT $? 0 0 "清理生成的文件失败"
|
||||
|
||||
# 如果测试前未安装,则卸载secGear-devel软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令指定不可信代码保存目录
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试codegen命令指定不可信代码保存目录"
|
||||
LOG_INFO "步骤1:检查yum源中是否存在secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel 2>/dev/null | grep -q "secGear-devel"; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查环境中是否已安装secGear-devel"
|
||||
if rpm -q secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试步骤中安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:如果未安装,安装secGear-devel软件包"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查codegen命令是否存在"
|
||||
if ! command -v codegen &>/dev/null; then
|
||||
LOG_ERROR "codegen命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:检查codegen命令是否支持--untrusted-dir参数"
|
||||
if ! codegen --help 2>&1 | grep -q -- "--untrusted-dir"; then
|
||||
LOG_ERROR "codegen命令不支持--untrusted-dir参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:创建测试用的临时目录"
|
||||
TEST_UNTRUSTED_DIR=$(mktemp -d)
|
||||
CHECK_RESULT $? 0 0 "创建临时目录失败"
|
||||
|
||||
LOG_INFO "步骤7:执行codegen命令指定不可信代码保存目录"
|
||||
codegen --untrusted-dir="$TEST_UNTRUSTED_DIR"
|
||||
CHECK_RESULT $? 0 0 "codegen命令执行失败"
|
||||
|
||||
LOG_INFO "步骤8:检查不可信代码保存目录中是否生成文件"
|
||||
if [ -z "$(ls -A "$TEST_UNTRUSTED_DIR" 2>/dev/null)" ]; then
|
||||
LOG_ERROR "不可信代码保存目录中未生成文件"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "不可信代码保存目录中已生成文件"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤9:清理临时目录"
|
||||
rm -rf "$TEST_UNTRUSTED_DIR"
|
||||
CHECK_RESULT $? 0 0 "清理临时目录失败"
|
||||
|
||||
LOG_INFO "步骤10:如果测试前未安装,卸载secGear-devel软件包"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令同时指定生成不可信代码及其保存目录
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试codegen命令同时指定生成不可信代码及其保存目录"
|
||||
LOG_INFO "步骤1:检查当前环境是否已安装secGear-devel软件包"
|
||||
if rpm -q secGear-devel > /dev/null 2>&1; then
|
||||
LOG_INFO "secGear-devel软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "secGear-devel软件包未安装,将在测试过程中安装并在测试结束后卸载"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否有secGear-devel软件包"
|
||||
if ! dnf list secGear-devel > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "步骤3:安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查codegen命令是否支持指定生成不可信代码及其保存目录参数"
|
||||
codegen --help | grep -q "untrusted"
|
||||
CHECK_RESULT $? 0 0 "codegen命令不支持生成不可信代码参数"
|
||||
|
||||
LOG_INFO "步骤5:创建测试用的临时目录"
|
||||
TEST_DIR=$(mktemp -d)
|
||||
UNTRUSTED_DIR="$TEST_DIR/untrusted_code"
|
||||
|
||||
LOG_INFO "步骤6:执行codegen命令生成不可信代码并指定保存目录"
|
||||
codegen --untrusted --output "$UNTRUSTED_DIR" test_interface.idl
|
||||
CHECK_RESULT $? 0 0 "执行codegen命令生成不可信代码失败"
|
||||
|
||||
LOG_INFO "步骤7:验证生成的不可信代码文件是否存在"
|
||||
if [ -f "$UNTRUSTED_DIR/test_interface_untrusted.c" ] && [ -f "$UNTRUSTED_DIR/test_interface_untrusted.h" ]; then
|
||||
LOG_INFO "成功生成不可信代码文件"
|
||||
else
|
||||
LOG_ERROR "未找到生成的不可信代码文件"
|
||||
CHECK_RESULT 1 0 0 "验证生成文件失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8:清理测试生成的临时目录"
|
||||
rm -rf "$TEST_DIR"
|
||||
CHECK_RESULT $? 0 0 "清理临时目录失败"
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "步骤9:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:codegen命令同时指定生成不可信代码及其保存目录功能正常"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,117 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试codegen命令为不可信代理添加Enclave名前缀
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(根据要求直接使用,无需定义,但实际脚本中需要定义)
|
||||
# 这里根据要求直接使用,但实际脚本中需要确保这些函数存在
|
||||
# 以下为示例定义,实际环境中可能已定义
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $*"
|
||||
}
|
||||
|
||||
# 测试用例:测试codegen命令为不可信代理添加Enclave名前缀
|
||||
LOG_INFO "开始测试:测试codegen命令为不可信代理添加Enclave名前缀"
|
||||
|
||||
# 步骤1:检查环境中是否已安装secGear-devel软件包
|
||||
LOG_INFO "步骤1:检查环境中是否已安装secGear-devel软件包"
|
||||
if rpm -q secGear-devel > /dev/null 2>&1; then
|
||||
LOG_INFO "secGear-devel软件包已安装,测试完成后将保持安装状态"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "secGear-devel软件包未安装,将在测试步骤中安装"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
# 步骤2:检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装secGear-devel软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查codegen命令是否存在
|
||||
LOG_INFO "步骤4:检查codegen命令是否存在"
|
||||
if ! command -v codegen > /dev/null 2>&1; then
|
||||
LOG_ERROR "codegen命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:检查codegen命令是否支持--prefix参数
|
||||
LOG_INFO "步骤5:检查codegen命令是否支持--prefix参数"
|
||||
if ! codegen --help 2>&1 | grep -q "\-\-prefix"; then
|
||||
LOG_ERROR "codegen命令不支持--prefix参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6:使用codegen命令为不可信代理添加Enclave名前缀
|
||||
LOG_INFO "步骤6:使用codegen命令为不可信代理添加Enclave名前缀"
|
||||
# 假设有一个不可信代理文件untrusted_agent.edl
|
||||
# 创建测试用的临时EDL文件
|
||||
TEST_EDL_FILE="/tmp/test_untrusted_agent.edl"
|
||||
cat > "$TEST_EDL_FILE" << EOF
|
||||
enclave {
|
||||
trusted {
|
||||
public void test_func();
|
||||
};
|
||||
untrusted {
|
||||
public void untrusted_func();
|
||||
};
|
||||
};
|
||||
EOF
|
||||
|
||||
# 使用codegen命令生成代码,并指定前缀
|
||||
codegen --prefix=MyEnclave_ "$TEST_EDL_FILE"
|
||||
CHECK_RESULT $? 0 0 "codegen命令执行失败"
|
||||
|
||||
# 步骤7:检查生成的文件是否包含指定前缀
|
||||
LOG_INFO "步骤7:检查生成的文件是否包含指定前缀"
|
||||
if [ -f "MyEnclave_untrusted.c" ] && grep -q "MyEnclave_" "MyEnclave_untrusted.c"; then
|
||||
LOG_INFO "成功生成带有前缀MyEnclave_的不可信代理代码"
|
||||
else
|
||||
LOG_ERROR "未成功生成带有指定前缀的代码"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 步骤8:清理生成的测试文件
|
||||
LOG_INFO "步骤8:清理生成的测试文件"
|
||||
rm -f "$TEST_EDL_FILE" MyEnclave_untrusted.c MyEnclave_untrusted.h MyEnclave_t.h MyEnclave_t.c MyEnclave_args.h
|
||||
|
||||
# 步骤9:如果测试前未安装,则卸载secGear-devel软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤9:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试codegen命令为不可信代理添加Enclave名前缀"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试secGear-devel基础功能验证
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试secGear-devel基础功能验证"
|
||||
LOG_INFO "步骤1:检查当前环境是否已安装secGear-devel软件包"
|
||||
if dnf list installed secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试过程中安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在secGear-devel软件包"
|
||||
if ! dnf list secGear-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:安装secGear-devel软件包"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证secGear-devel基础功能"
|
||||
LOG_INFO "步骤4.1:检查secGear-devel提供的头文件"
|
||||
ls /usr/include/secGear/*.h &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "secGear-devel头文件不存在"
|
||||
|
||||
LOG_INFO "步骤4.2:检查secGear-devel提供的库文件"
|
||||
ls /usr/lib*/libsecGear* &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "secGear-devel库文件不存在"
|
||||
|
||||
LOG_INFO "步骤4.3:验证secGear开发工具链"
|
||||
which sgxcc &>/dev/null || which secgearcc &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "secGear开发工具链不存在"
|
||||
|
||||
LOG_INFO "步骤5:清理测试环境"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "卸载测试过程中安装的secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
else
|
||||
LOG_INFO "保持secGear-devel安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "secGear-devel基础功能验证完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试secGear-devel软件包是否已安装
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数(根据要求直接使用,此处仅为兼容性定义)
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $*"
|
||||
}
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $*" >&2
|
||||
}
|
||||
|
||||
# 测试脚本主体
|
||||
LOG_INFO "开始测试secGear-devel软件包是否已安装"
|
||||
|
||||
# 检查是否已安装secGear-devel
|
||||
LOG_INFO "检查secGear-devel是否已安装"
|
||||
if rpm -q secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,跳过安装步骤"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试中安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否有secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
LOG_INFO "secGear-devel安装成功"
|
||||
else
|
||||
LOG_INFO "跳过安装步骤,secGear-devel已存在"
|
||||
fi
|
||||
|
||||
# 验证软件包是否安装成功
|
||||
LOG_INFO "验证secGear-devel软件包是否安装成功"
|
||||
rpm -q secGear-devel
|
||||
CHECK_RESULT $? 0 0 "secGear-devel软件包未正确安装"
|
||||
|
||||
# 检查secGear-devel提供的命令或文件(示例:检查头文件是否存在)
|
||||
LOG_INFO "检查secGear-devel头文件是否存在"
|
||||
if [ -f /usr/include/secGear/secGear.h ]; then
|
||||
LOG_INFO "secGear头文件存在"
|
||||
else
|
||||
LOG_ERROR "secGear头文件不存在"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境:如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "清理环境:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
LOG_INFO "secGear-devel卸载成功"
|
||||
else
|
||||
LOG_INFO "保持secGear-devel安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,99 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试EDL文件编译流程
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试EDL文件编译流程"
|
||||
|
||||
LOG_INFO "步骤1: 检查环境是否已安装secGear-devel软件包"
|
||||
if rpm -q secGear-devel &> /dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,脚本结束时将保持安装状态"
|
||||
already_installed=1
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试过程中安装"
|
||||
already_installed=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查yum源中是否存在secGear-devel软件包"
|
||||
if ! dnf list secGear-devel &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "步骤3: 安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 检查edl_compile命令是否存在"
|
||||
if ! command -v edl_compile &> /dev/null; then
|
||||
LOG_ERROR "edl_compile命令不存在"
|
||||
[ $already_installed -eq 0 ] && dnf remove -y secGear-devel
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5: 检查edl_compile命令参数支持情况"
|
||||
if ! edl_compile --help &> /dev/null; then
|
||||
LOG_ERROR "edl_compile命令不支持--help参数"
|
||||
[ $already_installed -eq 0 ] && dnf remove -y secGear-devel
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6: 创建测试EDL文件"
|
||||
cat > test_edl.edl << "EOF"
|
||||
enclave {
|
||||
trusted {
|
||||
public void test_function();
|
||||
};
|
||||
};
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试EDL文件失败"
|
||||
|
||||
LOG_INFO "步骤7: 执行EDL文件编译测试"
|
||||
edl_compile test_edl.edl
|
||||
CHECK_RESULT $? 0 0 "EDL文件编译失败"
|
||||
|
||||
LOG_INFO "步骤8: 验证编译输出文件"
|
||||
if [ -f "test_edl_t.h" ] && [ -f "test_edl_t.c" ] && [ -f "test_edl_u.h" ] && [ -f "test_edl_u.c" ]; then
|
||||
LOG_INFO "EDL编译输出文件生成成功"
|
||||
else
|
||||
LOG_ERROR "EDL编译输出文件生成不完整"
|
||||
rm -f test_edl.edl test_edl_t.h test_edl_t.c test_edl_u.h test_edl_u.c
|
||||
[ $already_installed -eq 0 ] && dnf remove -y secGear-devel
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤9: 清理测试文件"
|
||||
rm -f test_edl.edl test_edl_t.h test_edl_t.c test_edl_u.h test_edl_u.c
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
if [ $already_installed -eq 0 ]; then
|
||||
LOG_INFO "步骤10: 卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成: EDL文件编译流程测试通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试secGear开发环境设置
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:secGear开发环境设置"
|
||||
|
||||
# 检查环境是否已安装secGear开发包
|
||||
LOG_INFO "检查secGear开发环境是否已安装"
|
||||
if rpm -q secGear-devel > /dev/null 2>&1; then
|
||||
LOG_INFO "secGear-devel已安装,跳过安装步骤"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将进行安装测试"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在secGear-devel包
|
||||
LOG_INFO "检查yum源中是否存在secGear-devel包"
|
||||
if ! dnf list available secGear-devel > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装secGear-devel包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
fi
|
||||
|
||||
# 验证secGear开发环境是否可用
|
||||
LOG_INFO "验证secGear开发环境是否可用"
|
||||
# 示例:检查secGear相关命令是否存在,这里假设有secgear-config命令
|
||||
if command -v secgear-config > /dev/null 2>&1; then
|
||||
LOG_INFO "secGear开发环境设置成功"
|
||||
# 可以添加更多验证步骤,例如编译示例代码等
|
||||
# CHECK_RESULT $? 0 0 "secGear开发环境验证失败"
|
||||
else
|
||||
LOG_ERROR "secGear开发环境验证失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 环境恢复:如果脚本安装的包,则卸载
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载secGear-devel包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
LOG_INFO "环境已恢复"
|
||||
else
|
||||
LOG_INFO "环境保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:secGear开发环境设置"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试帮助文档存在性
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试帮助文档存在性"
|
||||
|
||||
# 检查环境是否已安装secGear-devel软件包
|
||||
LOG_INFO "检查secGear-devel是否已安装"
|
||||
if dnf list installed secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel已安装,标记为已安装状态"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在secGear-devel软件包"
|
||||
if dnf list available secGear-devel &>/dev/null; then
|
||||
LOG_INFO "yum源中存在secGear-devel软件包"
|
||||
else
|
||||
LOG_ERROR "yum源中不存在secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "开始安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel失败"
|
||||
LOG_INFO "secGear-devel软件包安装成功"
|
||||
fi
|
||||
|
||||
# 测试帮助文档存在性
|
||||
LOG_INFO "测试secGear-devel帮助文档存在性"
|
||||
if man secGear-devel &>/dev/null; then
|
||||
LOG_INFO "secGear-devel帮助文档存在"
|
||||
else
|
||||
LOG_ERROR "secGear-devel帮助文档不存在"
|
||||
# 检查是否是参数不存在或不支持
|
||||
if ! man --help | grep -q "secGear-devel"; then
|
||||
LOG_ERROR "secGear-devel帮助文档参数不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
# 其他失败场景
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "清理环境:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel失败"
|
||||
LOG_INFO "secGear-devel软件包卸载成功"
|
||||
else
|
||||
LOG_INFO "保持secGear-devel安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试帮助文档存在性完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试secGear-devel软件包安装
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试secGear-devel软件包安装功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查环境中是否已安装secGear-devel软件包"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "环境中已安装secGear-devel软件包,测试结束时将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "环境中未安装secGear-devel软件包,将在测试过程中安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查yum源中是否存在secGear-devel软件包"
|
||||
dnf list available secGear-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到secGear-devel软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3: 检查dnf工具是否支持安装和卸载参数"
|
||||
dnf install --help | grep -q "\-\-install"
|
||||
CHECK_RESULT $? 0 0 "dnf工具不支持install参数"
|
||||
dnf remove --help | grep -q "\-\-remove"
|
||||
CHECK_RESULT $? 0 0 "dnf工具不支持remove参数"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "dnf工具参数不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
LOG_INFO "步骤4: 安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
|
||||
LOG_INFO "步骤5: 验证secGear-devel软件包是否安装成功"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "secGear-devel软件包安装后验证失败"
|
||||
|
||||
LOG_INFO "步骤6: 卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
|
||||
LOG_INFO "步骤7: 验证secGear-devel软件包是否卸载成功"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 1 0 "secGear-devel软件包卸载后验证失败"
|
||||
else
|
||||
LOG_INFO "步骤4: 环境中已安装secGear-devel,跳过安装测试步骤"
|
||||
LOG_INFO "步骤5: 验证环境中secGear-devel软件包状态"
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "环境中secGear-devel软件包状态异常"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤8: 清理测试环境"
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
rpm -q secGear-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "发现残留的secGear-devel软件包,执行清理"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "清理secGear-devel软件包失败"
|
||||
fi
|
||||
else
|
||||
LOG_INFO "保持原有安装状态,无需清理"
|
||||
fi
|
||||
|
||||
LOG_INFO "secGear-devel软件包安装功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,119 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试链接secGear库文件
|
||||
# ############################################
|
||||
|
||||
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 exit_code=$3
|
||||
local message=$4
|
||||
|
||||
if [ $actual -ne $expect ]; then
|
||||
LOG_ERROR "$message"
|
||||
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"
|
||||
}
|
||||
|
||||
# 测试用例描述:测试链接secGear库文件
|
||||
LOG_INFO "开始测试链接secGear库文件功能"
|
||||
|
||||
# 步骤1:检查是否已安装secGear-devel软件包
|
||||
LOG_INFO "步骤1:检查是否已安装secGear-devel软件包"
|
||||
if rpm -q secGear-devel > /dev/null 2>&1; then
|
||||
LOG_INFO "secGear-devel已安装,测试结束后将保持安装状态"
|
||||
ALREADY_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "secGear-devel未安装,将在测试过程中安装"
|
||||
ALREADY_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 步骤2:检查yum源中是否有secGear-devel软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有secGear-devel软件包"
|
||||
if ! dnf list available secGear-devel > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装secGear-devel软件包
|
||||
if [ "$ALREADY_INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4:测试链接secGear库文件
|
||||
LOG_INFO "步骤4:测试链接secGear库文件"
|
||||
# 创建测试C程序
|
||||
cat > test_secgear_link.c << "EOF"
|
||||
#include <stdio.h>
|
||||
#include <secgear/secgear.h>
|
||||
|
||||
int main() {
|
||||
printf("Testing secGear library linkage...\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 编译测试程序,链接secGear库
|
||||
LOG_INFO "编译测试程序,链接secGear库"
|
||||
gcc -o test_secgear_link test_secgear_link.c -lsecgear 2>&1
|
||||
CHECK_RESULT $? 0 0 "链接secGear库文件失败"
|
||||
|
||||
# 步骤5:运行测试程序
|
||||
LOG_INFO "步骤5:运行测试程序"
|
||||
./test_secgear_link
|
||||
CHECK_RESULT $? 0 0 "运行测试程序失败"
|
||||
|
||||
# 步骤6:清理测试文件
|
||||
LOG_INFO "步骤6:清理测试文件"
|
||||
rm -f test_secgear_link.c test_secgear_link
|
||||
|
||||
# 步骤7:如果测试前未安装,则卸载secGear-devel软件包
|
||||
if [ "$ALREADY_INSTALLED" = "false" ]; then
|
||||
LOG_INFO "步骤7:卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试链接secGear库文件完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试secGear-devel软件包卸载
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数
|
||||
LOG_INFO() {
|
||||
echo "INFO: $*"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo "ERROR: $*" >&2
|
||||
}
|
||||
|
||||
# 定义检查结果函数
|
||||
CHECK_RESULT() {
|
||||
local actual=$1
|
||||
local expect=$2
|
||||
local mode=$3
|
||||
local message=$4
|
||||
if [ $mode -eq 0 ]; then
|
||||
if [ $actual -ne $expect ]; then
|
||||
LOG_ERROR "$message"
|
||||
exit $actual
|
||||
fi
|
||||
elif [ $mode -eq 1 ]; then
|
||||
if [ $actual -eq $expect ]; then
|
||||
LOG_ERROR "$message"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义SSH命令函数
|
||||
SSH_CMD() {
|
||||
local cmd=$1
|
||||
local node_ip=$2
|
||||
local node_password=$3
|
||||
local node_user=$4
|
||||
sshpass -p "$node_password" ssh -o StrictHostKeyChecking=no "$node_user@$node_ip" "$cmd"
|
||||
}
|
||||
|
||||
# 测试脚本开始
|
||||
LOG_INFO "开始测试secGear-devel软件包卸载功能"
|
||||
|
||||
# 检查yum源中是否存在secGear-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在secGear-devel软件包"
|
||||
dnf list available secGear-devel &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在secGear-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查当前是否已安装secGear-devel软件包
|
||||
LOG_INFO "检查当前是否已安装secGear-devel软件包"
|
||||
rpm -q secGear-devel &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "secGear-devel软件包已安装,测试结束后保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "secGear-devel软件包未安装,将进行安装测试"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装secGear-devel软件包
|
||||
if [ "$installed" = "false" ]; then
|
||||
LOG_INFO "安装secGear-devel软件包"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "安装secGear-devel软件包失败"
|
||||
LOG_INFO "secGear-devel软件包安装成功"
|
||||
fi
|
||||
|
||||
# 验证secGear-devel软件包已安装
|
||||
LOG_INFO "验证secGear-devel软件包已安装"
|
||||
rpm -q secGear-devel &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "secGear-devel软件包未正确安装"
|
||||
|
||||
# 卸载secGear-devel软件包
|
||||
LOG_INFO "卸载secGear-devel软件包"
|
||||
dnf remove -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "卸载secGear-devel软件包失败"
|
||||
LOG_INFO "secGear-devel软件包卸载成功"
|
||||
|
||||
# 验证secGear-devel软件包已卸载
|
||||
LOG_INFO "验证secGear-devel软件包已卸载"
|
||||
rpm -q secGear-devel &>/dev/null
|
||||
CHECK_RESULT $? 1 1 "secGear-devel软件包未正确卸载"
|
||||
|
||||
# 如果测试前已安装,则重新安装secGear-devel软件包
|
||||
if [ "$installed" = "true" ]; then
|
||||
LOG_INFO "重新安装secGear-devel软件包以恢复环境"
|
||||
dnf install -y secGear-devel
|
||||
CHECK_RESULT $? 0 0 "重新安装secGear-devel软件包失败"
|
||||
LOG_INFO "secGear-devel软件包重新安装成功"
|
||||
fi
|
||||
|
||||
# 最终验证环境状态
|
||||
LOG_INFO "验证环境状态"
|
||||
if [ "$installed" = "true" ]; then
|
||||
rpm -q secGear-devel &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "环境未恢复到安装状态"
|
||||
LOG_INFO "环境已恢复到安装状态"
|
||||
else
|
||||
rpm -q secGear-devel &>/dev/null
|
||||
CHECK_RESULT $? 1 1 "环境未恢复到未安装状态"
|
||||
LOG_INFO "环境已恢复到未安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "secGear-devel软件包卸载功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-09-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic command usage
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试:Test basic command usage"
|
||||
|
||||
# 检查是否已安装texlive-chivo
|
||||
LOG_INFO "检查是否已安装texlive-chivo"
|
||||
dnf list installed texlive-chivo &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-chivo已安装,跳过安装步骤"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-chivo未安装,准备安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-chivo
|
||||
LOG_INFO "检查yum源中是否有texlive-chivo"
|
||||
dnf list available texlive-chivo &>/dev/null
|
||||
CHECK_RESULT $? 0 255 "yum源中未找到texlive-chivo"
|
||||
|
||||
# 若未安装则进行安装
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装texlive-chivo"
|
||||
dnf install -y texlive-chivo
|
||||
CHECK_RESULT $? 0 1 "安装texlive-chivo失败"
|
||||
fi
|
||||
|
||||
# 测试基本命令用法
|
||||
LOG_INFO "测试基本命令用法"
|
||||
tex --version
|
||||
CHECK_RESULT $? 0 1 "执行tex --version失败"
|
||||
|
||||
# 测试指定命令参数
|
||||
LOG_INFO "测试指定命令参数"
|
||||
tex --invalid-arg 2>/dev/null
|
||||
CHECK_RESULT $? 255 255 "不支持的参数未被正确处理"
|
||||
|
||||
# 清理环境:若脚本开始时未安装则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-chivo"
|
||||
dnf remove -y texlive-chivo
|
||||
CHECK_RESULT $? 0 1 "卸载texlive-chivo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic command usage"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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 : Test basic LaTeX font usage with chivo
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test basic LaTeX font usage with chivo"
|
||||
|
||||
LOG_INFO "步骤1:检查texlive-chivo软件包是否在yum源中可用"
|
||||
dnf list available texlive-chivo > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-chivo软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查当前是否已安装texlive-chivo"
|
||||
if rpm -q texlive-chivo > /dev/null 2>&1; then
|
||||
LOG_INFO "texlive-chivo已安装,标记为已存在"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-chivo未安装,标记为未存在"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive-chivo软件包"
|
||||
dnf install -y texlive-chivo
|
||||
CHECK_RESULT $? 0 0 "安装texlive-chivo失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:创建一个简单的LaTeX文档测试chivo字体"
|
||||
TEST_FILE="test_chivo_font.tex"
|
||||
cat > $TEST_FILE << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{fontspec}
|
||||
\setmainfont{Chivo}
|
||||
\begin{document}
|
||||
This is a test document using Chivo font.
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文件失败"
|
||||
|
||||
LOG_INFO "步骤5:使用xelatex编译LaTeX文档(测试字体可用性)"
|
||||
if command -v xelatex > /dev/null 2>&1; then
|
||||
xelatex -interaction=nonstopmode $TEST_FILE > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "xelatex编译失败,可能字体未正确安装或不可用"
|
||||
else
|
||||
LOG_ERROR "系统中未找到xelatex命令"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:检查是否生成了PDF输出文件"
|
||||
if [ -f "test_chivo_font.pdf" ]; then
|
||||
LOG_INFO "成功生成PDF文件,chivo字体基本使用测试通过"
|
||||
else
|
||||
LOG_ERROR "未生成PDF文件,测试失败"
|
||||
CHECK_RESULT 1 0 0 "未生成PDF输出文件"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7:清理测试生成的文件"
|
||||
rm -f test_chivo_font.tex test_chivo_font.aux test_chivo_font.log test_chivo_font.pdf
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤8:卸载在测试中安装的texlive-chivo软件包"
|
||||
dnf remove -y texlive-chivo
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-chivo失败"
|
||||
else
|
||||
LOG_INFO "步骤8:测试前已安装texlive-chivo,保持安装状态,不卸载"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic LaTeX font usage with chivo"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Access package documentation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Access package documentation"
|
||||
LOG_INFO "步骤1:检查环境中是否已安装texlive-dashbox-doc软件包"
|
||||
if rpm -q texlive-dashbox-doc &>/dev/null; then
|
||||
LOG_INFO "texlive-dashbox-doc已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-dashbox-doc未安装,将在测试过程中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在texlive-dashbox-doc软件包"
|
||||
if ! dnf list available texlive-dashbox-doc &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-dashbox-doc软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤3:安装texlive-dashbox-doc软件包"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
dnf install -y texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-dashbox-doc失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证texlive-dashbox-doc文档文件是否存在"
|
||||
DOC_FILE="/usr/share/texlive/texmf-dist/doc/latex/dashbox/README"
|
||||
if [ -f "$DOC_FILE" ]; then
|
||||
LOG_INFO "文档文件存在:$DOC_FILE"
|
||||
else
|
||||
LOG_ERROR "文档文件不存在:$DOC_FILE"
|
||||
CHECK_RESULT 1 0 0 "文档文件检查失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤5:验证文档文件内容可访问"
|
||||
if head -n 1 "$DOC_FILE" &>/dev/null; then
|
||||
LOG_INFO "文档文件内容可访问"
|
||||
else
|
||||
LOG_ERROR "文档文件内容不可访问"
|
||||
CHECK_RESULT 1 0 0 "文档文件访问失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6:清理环境"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-dashbox-doc软件包"
|
||||
dnf remove -y texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-dashbox-doc失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Access package documentation"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : List package documentation files
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-dashbox-doc
|
||||
LOG_INFO "检查是否已安装texlive-dashbox-doc"
|
||||
rpm -q texlive-dashbox-doc
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-dashbox-doc已安装"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "texlive-dashbox-doc未安装"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-dashbox-doc
|
||||
LOG_INFO "检查yum源中是否有texlive-dashbox-doc"
|
||||
dnf list available texlive-dashbox-doc
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-dashbox-doc包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-dashbox-doc
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "安装texlive-dashbox-doc"
|
||||
dnf install -y texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-dashbox-doc失败"
|
||||
fi
|
||||
|
||||
# 列出包文档文件
|
||||
LOG_INFO "列出texlive-dashbox-doc文档文件"
|
||||
rpm -ql texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "列出texlive-dashbox-doc文档文件失败"
|
||||
|
||||
# 恢复环境:如果之前未安装,则卸载texlive-dashbox-doc
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载texlive-dashbox-doc"
|
||||
dnf remove -y texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-dashbox-doc失败"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package removal
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-dashbox-doc软件包
|
||||
LOG_INFO "检查texlive-dashbox-doc软件包是否已安装"
|
||||
rpm -q texlive-dashbox-doc
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-dashbox-doc软件包已安装,标记为已存在"
|
||||
PKG_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-dashbox-doc软件包未安装,标记为未安装"
|
||||
PKG_INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在texlive-dashbox-doc软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-dashbox-doc软件包"
|
||||
dnf list available texlive-dashbox-doc > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中不存在texlive-dashbox-doc软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-dashbox-doc软件包,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果软件包未安装,则进行安装
|
||||
if [ $PKG_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-dashbox-doc软件包"
|
||||
dnf install -y texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "安装texlive-dashbox-doc软件包失败"
|
||||
LOG_INFO "texlive-dashbox-doc软件包安装成功"
|
||||
fi
|
||||
|
||||
# 测试卸载软件包功能
|
||||
LOG_INFO "开始测试卸载texlive-dashbox-doc软件包"
|
||||
dnf remove -y texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-dashbox-doc软件包失败"
|
||||
LOG_INFO "texlive-dashbox-doc软件包卸载成功"
|
||||
|
||||
# 验证软件包是否已卸载
|
||||
LOG_INFO "验证texlive-dashbox-doc软件包是否已卸载"
|
||||
rpm -q texlive-dashbox-doc
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "texlive-dashbox-doc软件包卸载后仍存在"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "texlive-dashbox-doc软件包已成功卸载"
|
||||
fi
|
||||
|
||||
# 如果最初软件包已安装,则重新安装以恢复环境
|
||||
if [ $PKG_INSTALLED -eq 1 ]; then
|
||||
LOG_INFO "恢复环境,重新安装texlive-dashbox-doc软件包"
|
||||
dnf install -y texlive-dashbox-doc
|
||||
CHECK_RESULT $? 0 0 "重新安装texlive-dashbox-doc软件包失败"
|
||||
LOG_INFO "texlive-dashbox-doc软件包重新安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality of texlive-exteps
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试texlive-exteps的基本功能"
|
||||
|
||||
# 检查是否已安装texlive-exteps
|
||||
LOG_INFO "检查texlive-exteps是否已安装"
|
||||
dnf list installed texlive-exteps > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-exteps已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "texlive-exteps未安装,测试结束后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-exteps
|
||||
LOG_INFO "检查yum源中是否有texlive-exteps"
|
||||
dnf list available texlive-exteps > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到texlive-exteps软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到texlive-exteps软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-exteps
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装texlive-exteps"
|
||||
dnf install -y texlive-exteps > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-exteps失败"
|
||||
fi
|
||||
|
||||
# 测试基本功能
|
||||
LOG_INFO "测试texlive-exteps的基本功能"
|
||||
texlive-exteps --version > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行texlive-exteps --version失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载texlive-exteps"
|
||||
dnf remove -y texlive-exteps > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-exteps失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test package existence check
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:检查texlive-lt3graph软件包的存在性"
|
||||
LOG_INFO "步骤1:检查yum源中是否存在texlive-lt3graph软件包"
|
||||
dnf list available texlive-lt3graph &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "yum源中不存在texlive-lt3graph软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-lt3graph软件包,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查系统是否已安装texlive-lt3graph"
|
||||
rpm -q texlive-lt3graph &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-lt3graph已安装,测试结束后保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-lt3graph未安装,将在测试步骤中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装texlive-lt3graph软件包"
|
||||
dnf install -y texlive-lt3graph
|
||||
CHECK_RESULT $? 0 0 "安装texlive-lt3graph失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证texlive-lt3graph安装成功"
|
||||
rpm -q texlive-lt3graph
|
||||
CHECK_RESULT $? 0 0 "texlive-lt3graph安装验证失败"
|
||||
|
||||
LOG_INFO "步骤5:检查texlive-lt3graph相关命令是否存在"
|
||||
which lt3graph &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "lt3graph命令不存在"
|
||||
|
||||
LOG_INFO "步骤6:清理测试环境"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载测试安装的texlive-lt3graph软件包"
|
||||
dnf remove -y texlive-lt3graph
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-lt3graph失败"
|
||||
else
|
||||
LOG_INFO "保持原有texlive-lt3graph安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:texlive-lt3graph软件包存在性检查通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,178 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-25
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic LaTeX usage with lt3graph
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义颜色输出函数
|
||||
LOG_INFO() {
|
||||
echo -e "\033[32m[INFO]\033[0m $1"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo -e "\033[31m[ERROR]\033[0m $1"
|
||||
}
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
check_package_in_repo() {
|
||||
local package_name=$1
|
||||
dnf list available "$package_name" &> /dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# 检查命令是否存在
|
||||
check_command_exists() {
|
||||
local command_name=$1
|
||||
command -v "$command_name" &> /dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# 检查lt3graph是否已安装
|
||||
check_lt3graph_installed() {
|
||||
dnf list installed texlive-lt3graph &> /dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# 安装texlive-lt3graph
|
||||
install_lt3graph() {
|
||||
LOG_INFO "正在安装texlive-lt3graph软件包..."
|
||||
dnf install -y texlive-lt3graph
|
||||
CHECK_RESULT $? 0 0 "安装texlive-lt3graph失败"
|
||||
}
|
||||
|
||||
# 卸载texlive-lt3graph
|
||||
uninstall_lt3graph() {
|
||||
LOG_INFO "正在卸载texlive-lt3graph软件包..."
|
||||
dnf remove -y texlive-lt3graph
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-lt3graph失败"
|
||||
}
|
||||
|
||||
# 创建测试用的LaTeX文件
|
||||
create_test_latex_file() {
|
||||
cat > test_lt3graph.tex << "EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{lt3graph}
|
||||
\begin{document}
|
||||
\SetDrawColor{blue}
|
||||
\DrawLine(0,0)(2,2)
|
||||
\DrawLine(2,0)(0,2)
|
||||
\end{document}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试LaTeX文件失败"
|
||||
}
|
||||
|
||||
# 测试基本LaTeX使用与lt3graph
|
||||
test_lt3graph_function() {
|
||||
LOG_INFO "测试基本LaTeX使用与lt3graph功能..."
|
||||
|
||||
# 创建测试文件
|
||||
create_test_latex_file
|
||||
|
||||
# 使用pdflatex编译LaTeX文件
|
||||
LOG_INFO "使用pdflatex编译LaTeX文件..."
|
||||
pdflatex -interaction=nonstopmode test_lt3graph.tex
|
||||
CHECK_RESULT $? 0 0 "pdflatex编译失败"
|
||||
|
||||
# 检查生成的PDF文件
|
||||
LOG_INFO "检查生成的PDF文件..."
|
||||
if [ -f test_lt3graph.pdf ]; then
|
||||
LOG_INFO "PDF文件生成成功"
|
||||
# 检查PDF文件是否有效
|
||||
file test_lt3graph.pdf | grep -q "PDF document"
|
||||
CHECK_RESULT $? 0 0 "生成的PDF文件无效"
|
||||
else
|
||||
LOG_ERROR "PDF文件未生成"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# 清理生成的中间文件
|
||||
LOG_INFO "清理生成的中间文件..."
|
||||
rm -f test_lt3graph.aux test_lt3graph.log test_lt3graph.out test_lt3graph.synctex.gz
|
||||
CHECK_RESULT $? 0 0 "清理中间文件失败"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# 主测试函数
|
||||
main() {
|
||||
LOG_INFO "开始测试基本LaTeX使用与lt3graph功能"
|
||||
|
||||
# 检查yum源中是否有texlive-lt3graph软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-lt3graph软件包..."
|
||||
check_package_in_repo texlive-lt3graph
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有texlive-lt3graph软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装texlive-lt3graph
|
||||
local was_installed=false
|
||||
check_lt3graph_installed
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-lt3graph已经安装"
|
||||
was_installed=true
|
||||
else
|
||||
LOG_INFO "texlive-lt3graph未安装,将进行安装测试"
|
||||
was_installed=false
|
||||
fi
|
||||
|
||||
# 检查pdflatex命令是否存在
|
||||
LOG_INFO "检查pdflatex命令是否存在..."
|
||||
check_command_exists pdflatex
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "pdflatex命令不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装texlive-lt3graph
|
||||
if [ "$was_installed" = "false" ]; then
|
||||
install_lt3graph
|
||||
fi
|
||||
|
||||
# 执行功能测试
|
||||
test_lt3graph_function
|
||||
local test_result=$?
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件..."
|
||||
rm -f test_lt3graph.tex test_lt3graph.pdf
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果之前未安装,则在测试结束后卸载
|
||||
if [ "$was_installed" = "false" ]; then
|
||||
uninstall_lt3graph
|
||||
else
|
||||
LOG_INFO "保持texlive-lt3graph安装状态"
|
||||
fi
|
||||
|
||||
if [ $test_result -eq 0 ]; then
|
||||
LOG_INFO "基本LaTeX使用与lt3graph功能测试成功"
|
||||
else
|
||||
LOG_ERROR "基本LaTeX使用与lt3graph功能测试失败"
|
||||
exit $test_result
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
# 执行主函数
|
||||
main
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Verify installation of texlive-opteng
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装texlive-opteng
|
||||
LOG_INFO "检查是否已安装texlive-opteng"
|
||||
if rpm -q texlive-opteng &>/dev/null; then
|
||||
LOG_INFO "texlive-opteng已安装,脚本结束时保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "texlive-opteng未安装,将在测试结束后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-opteng软件包
|
||||
LOG_INFO "检查yum源中是否有texlive-opteng软件包"
|
||||
if ! dnf list available texlive-opteng &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到texlive-opteng软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-opteng软件包
|
||||
LOG_INFO "开始安装texlive-opteng软件包"
|
||||
dnf install -y texlive-opteng
|
||||
CHECK_RESULT $? 0 0 "安装texlive-opteng失败"
|
||||
|
||||
# 验证texlive-opteng是否安装成功
|
||||
LOG_INFO "验证texlive-opteng是否安装成功"
|
||||
rpm -q texlive-opteng &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "texlive-opteng未正确安装"
|
||||
|
||||
# 执行texlive-opteng相关命令测试
|
||||
LOG_INFO "执行texlive-opteng相关命令测试"
|
||||
tex --version &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "执行tex命令失败"
|
||||
|
||||
# 如果最初未安装,则在测试结束后卸载
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载texlive-opteng软件包"
|
||||
dnf remove -y texlive-opteng
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-opteng失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,131 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Verify basic usage of opteng package
|
||||
# ############################################
|
||||
|
||||
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_command() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
LOG_ERROR "命令 $1 不存在"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查软件包是否存在
|
||||
check_package_exists() {
|
||||
if ! dnf list available "$1" &> /dev/null; then
|
||||
LOG_ERROR "软件包 $1 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查参数是否存在
|
||||
check_parameter_exists() {
|
||||
if [ -z "$1" ]; then
|
||||
LOG_ERROR "参数不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装软件包
|
||||
install_package() {
|
||||
LOG_INFO "开始安装软件包 $1"
|
||||
dnf install -y "$1"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $1 失败"
|
||||
}
|
||||
|
||||
# 卸载软件包
|
||||
uninstall_package() {
|
||||
LOG_INFO "开始卸载软件包 $1"
|
||||
dnf remove -y "$1"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $1 失败"
|
||||
}
|
||||
|
||||
# 检查是否已安装
|
||||
is_package_installed() {
|
||||
rpm -q "$1" &> /dev/null
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
LOG_INFO "开始测试:Verify basic usage of opteng package"
|
||||
|
||||
# 检查opteng软件包是否在yum源中存在
|
||||
LOG_INFO "检查opteng软件包是否在yum源中存在"
|
||||
check_package_exists "opteng"
|
||||
|
||||
# 检查opteng软件包是否已安装
|
||||
LOG_INFO "检查opteng软件包是否已安装"
|
||||
if is_package_installed "opteng"; then
|
||||
LOG_INFO "opteng软件包已安装,测试结束后保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "opteng软件包未安装,将在测试中安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
install_package "opteng"
|
||||
fi
|
||||
|
||||
# 检查opteng命令是否存在
|
||||
LOG_INFO "检查opteng命令是否存在"
|
||||
check_command "opteng"
|
||||
|
||||
# 测试opteng命令的基本用法
|
||||
LOG_INFO "测试opteng命令的基本用法"
|
||||
opteng --help
|
||||
CHECK_RESULT $? 0 0 "opteng命令执行失败"
|
||||
|
||||
# 检查opteng命令的参数是否存在
|
||||
LOG_INFO "检查opteng命令的参数是否存在"
|
||||
check_parameter_exists "$(opteng --help | grep -o "--version")"
|
||||
|
||||
# 测试opteng命令的版本参数
|
||||
LOG_INFO "测试opteng命令的版本参数"
|
||||
opteng --version
|
||||
CHECK_RESULT $? 0 0 "opteng命令版本参数执行失败"
|
||||
|
||||
# 清理环境
|
||||
LOG_INFO "清理测试环境"
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
uninstall_package "opteng"
|
||||
else
|
||||
LOG_INFO "保持opteng软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Verify basic usage of opteng package"
|
||||
}
|
||||
|
||||
# 执行主函数
|
||||
main
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Verify version info of texlive-opteng
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:验证 texlive-opteng 版本信息"
|
||||
LOG_INFO "步骤1:检查系统中是否已安装 texlive-opteng"
|
||||
rpm -q texlive-opteng
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-opteng 已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-opteng 未安装,将在测试过程中安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
LOG_INFO "步骤2:检查 yum 源中是否有 texlive-opteng 软件包"
|
||||
dnf list available texlive-opteng
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中未找到 texlive-opteng 软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装 texlive-opteng 软件包"
|
||||
dnf install -y texlive-opteng
|
||||
CHECK_RESULT $? 0 0 "安装 texlive-opteng 失败"
|
||||
fi
|
||||
LOG_INFO "步骤4:验证 texlive-opteng 版本信息"
|
||||
texlive-opteng --version
|
||||
CHECK_RESULT $? 0 0 "获取 texlive-opteng 版本信息失败"
|
||||
LOG_INFO "步骤5:验证 texlive-opteng 版本信息中是否包含特定字符串"
|
||||
texlive-opteng --version | grep -q "TeX Live"
|
||||
CHECK_RESULT $? 0 0 "texlive-opteng 版本信息中未找到 "TeX Live" 字符串"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤6:卸载 texlive-opteng 软件包"
|
||||
dnf remove -y texlive-opteng
|
||||
CHECK_RESULT $? 0 0 "卸载 texlive-opteng 失败"
|
||||
fi
|
||||
LOG_INFO "测试完成:texlive-opteng 版本信息验证成功"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-11-26
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test font rendering functionality
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装texlive-variablelm-function-font软件包
|
||||
LOG_INFO "检查texlive-variablelm-function-font是否已安装"
|
||||
dnf list installed texlive-variablelm-function-font > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "texlive-variablelm-function-font已安装,测试结束后保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "texlive-variablelm-function-font未安装,测试结束后将卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有texlive-variablelm-function-font软件包
|
||||
LOG_INFO "检查yum源中是否存在texlive-variablelm-function-font软件包"
|
||||
dnf list available texlive-variablelm-function-font > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在texlive-variablelm-function-font软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装texlive-variablelm-function-font软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始安装texlive-variablelm-function-font软件包"
|
||||
dnf install -y texlive-variablelm-function-font > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装texlive-variablelm-function-font失败"
|
||||
fi
|
||||
|
||||
# 测试字体渲染功能
|
||||
LOG_INFO "测试字体渲染功能"
|
||||
echo "\documentclass{article}
|
||||
\usepackage{varioref}
|
||||
\begin{document}
|
||||
Test font rendering functionality.
|
||||
\end{document}" > test_font.tex
|
||||
pdflatex test_font.tex > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "字体渲染功能测试失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_font.tex test_font.aux test_font.log test_font.pdf
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载texlive-variablelm-function-font软件包"
|
||||
dnf remove -y texlive-variablelm-function-font > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载texlive-variablelm-function-font失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test standard taglib functionality
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装tomcat-taglibs-standard-help软件包
|
||||
LOG_INFO "检查是否已安装tomcat-taglibs-standard-help软件包"
|
||||
if dnf list installed tomcat-taglibs-standard-help &>/dev/null; then
|
||||
LOG_INFO "tomcat-taglibs-standard-help已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "tomcat-taglibs-standard-help未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在tomcat-taglibs-standard-help软件包
|
||||
LOG_INFO "检查yum源中是否存在tomcat-taglibs-standard-help软件包"
|
||||
if ! dnf list available tomcat-taglibs-standard-help &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在tomcat-taglibs-standard-help软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 若未安装则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装tomcat-taglibs-standard-help软件包"
|
||||
dnf install -y tomcat-taglibs-standard-help
|
||||
CHECK_RESULT $? 0 0 "安装tomcat-taglibs-standard-help失败"
|
||||
fi
|
||||
|
||||
# 测试standard taglib功能
|
||||
LOG_INFO "测试standard taglib功能"
|
||||
# 假设测试命令为验证taglib功能,此处仅为示例
|
||||
TEST_COMMAND="some_taglib_test_command"
|
||||
if ! command -v $TEST_COMMAND &>/dev/null; then
|
||||
LOG_ERROR "命令$TEST_COMMAND不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行测试命令
|
||||
$TEST_COMMAND --test-param
|
||||
CHECK_RESULT $? 0 0 "测试standard taglib功能失败"
|
||||
|
||||
# 若脚本开始时未安装,则在测试结束后卸载软件包以恢复环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载tomcat-taglibs-standard-help软件包以恢复环境"
|
||||
dnf remove -y tomcat-taglibs-standard-help
|
||||
CHECK_RESULT $? 0 0 "卸载tomcat-taglibs-standard-help失败"
|
||||
|
||||
# 确认卸载成功且环境恢复原状
|
||||
if dnf list installed tomcat-taglibs-standard-help &>/dev/null; then
|
||||
LOG_ERROR "卸载后仍检测到tomcat-taglibs-standard-help软件包"
|
||||
exit 1 # Linux标准退出码1表示一般错误
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,128 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-05
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Check the package version
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义颜色输出
|
||||
LOG_INFO() {
|
||||
echo -e "\033[32m[INFO]\033[0m $1"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo -e "\033[31m[ERROR]\033[0m $1"
|
||||
}
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
check_package_in_repo() {
|
||||
local package_name=$1
|
||||
LOG_INFO "检查yum源中是否存在软件包: $package_name"
|
||||
dnf list available "$package_name" &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在软件包: $package_name"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在软件包: $package_name"
|
||||
}
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_command_option() {
|
||||
local command=$1
|
||||
local option=$2
|
||||
LOG_INFO "检查命令 $command 是否支持参数 $option"
|
||||
$command --help 2>&1 | grep -q "$option"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令 $command 不支持参数 $option"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "命令 $command 支持参数 $option"
|
||||
}
|
||||
|
||||
# 检查软件包是否已安装
|
||||
check_package_installed() {
|
||||
local package_name=$1
|
||||
rpm -q "$package_name" &>/dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# 主测试函数
|
||||
test_check_package_version() {
|
||||
local package_name="xkeyboard-config"
|
||||
local install_needed=0
|
||||
|
||||
LOG_INFO "开始测试: 检查软件包版本"
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
check_package_in_repo "$package_name"
|
||||
|
||||
# 检查当前是否已安装
|
||||
if check_package_installed "$package_name"; then
|
||||
LOG_INFO "软件包 $package_name 已安装"
|
||||
install_needed=0
|
||||
else
|
||||
LOG_INFO "软件包 $package_name 未安装,将进行安装"
|
||||
install_needed=1
|
||||
fi
|
||||
|
||||
# 如果需要安装,则安装软件包
|
||||
if [ $install_needed -eq 1 ]; then
|
||||
LOG_INFO "安装软件包: $package_name"
|
||||
dnf install -y "$package_name"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败"
|
||||
LOG_INFO "软件包 $package_name 安装成功"
|
||||
fi
|
||||
|
||||
# 检查rpm命令是否支持-q参数(查询包信息)
|
||||
check_command_option "rpm" "-q"
|
||||
|
||||
# 检查rpm命令是否支持--queryformat参数
|
||||
check_command_option "rpm" "--queryformat"
|
||||
|
||||
# 获取软件包版本信息
|
||||
LOG_INFO "获取软件包 $package_name 的版本信息"
|
||||
local version_info=$(rpm -q "$package_name" --queryformat "%{VERSION}-%{RELEASE}\n")
|
||||
CHECK_RESULT $? 0 0 "获取软件包版本信息失败"
|
||||
|
||||
LOG_INFO "软件包 $package_name 的版本信息: $version_info"
|
||||
|
||||
# 验证版本信息格式(基本验证)
|
||||
LOG_INFO "验证版本信息格式"
|
||||
echo "$version_info" | grep -qE "^[0-9]+\.[0-9]+(\.[0-9]+)?-[0-9]+\."
|
||||
CHECK_RESULT $? 0 0 "版本信息格式不正确: $version_info"
|
||||
|
||||
LOG_INFO "版本信息格式验证通过"
|
||||
|
||||
# 如果需要清理(测试前未安装),则卸载软件包
|
||||
if [ $install_needed -eq 1 ]; 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 "测试完成: 软件包版本检查成功"
|
||||
}
|
||||
|
||||
# 执行测试
|
||||
test_check_package_version
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,99 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-05
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test setting a keyboard layout
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查脚本执行环境是否为root用户
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
LOG_ERROR "此脚本需要root权限执行"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="xkeyboard-config"
|
||||
|
||||
# 步骤1:检查yum源中是否存在指定软件包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在${PACKAGE_NAME}软件包"
|
||||
dnf list available ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查当前环境是否已安装指定软件包
|
||||
LOG_INFO "步骤2:检查当前环境是否已安装${PACKAGE_NAME}软件包"
|
||||
rpm -q ${PACKAGE_NAME} &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
INSTALLED="true"
|
||||
LOG_INFO "${PACKAGE_NAME}软件包已安装"
|
||||
else
|
||||
INSTALLED="false"
|
||||
LOG_INFO "${PACKAGE_NAME}软件包未安装"
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包"
|
||||
dnf install -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败"
|
||||
fi
|
||||
|
||||
# 步骤4:测试设置键盘布局功能
|
||||
LOG_INFO "步骤4:测试设置键盘布局功能"
|
||||
# 检查setxkbmap命令是否存在
|
||||
which setxkbmap &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "setxkbmap命令不存在"
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试设置us键盘布局
|
||||
setxkbmap us
|
||||
CHECK_RESULT $? 0 0 "设置us键盘布局失败"
|
||||
|
||||
# 测试设置fr键盘布局
|
||||
setxkbmap fr
|
||||
CHECK_RESULT $? 0 0 "设置fr键盘布局失败"
|
||||
|
||||
# 测试无效参数
|
||||
LOG_INFO "测试无效参数处理"
|
||||
setxkbmap invalid_layout 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "无效参数未正确处理"
|
||||
CHECK_RESULT 1 0 0 "无效参数测试失败"
|
||||
fi
|
||||
|
||||
# 步骤5:清理环境
|
||||
LOG_INFO "步骤5:清理环境"
|
||||
if [ "${INSTALLED}" = "false" ]; then
|
||||
LOG_INFO "卸载${PACKAGE_NAME}软件包"
|
||||
dnf remove -y ${PACKAGE_NAME}
|
||||
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败"
|
||||
else
|
||||
LOG_INFO "保持${PACKAGE_NAME}软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,111 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-05
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Show specific layout info
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试脚本:Show specific layout info
|
||||
# 测试步骤:验证xkeyboard-config的show-layout功能
|
||||
|
||||
# 检查是否已安装xkeyboard-config
|
||||
LOG_INFO "检查xkeyboard-config是否已安装"
|
||||
rpm -q xkeyboard-config > /dev/null 2>&1
|
||||
installed_status=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ $installed_status -eq 0 ]; then
|
||||
LOG_INFO "xkeyboard-config已安装,测试完成后将保持安装状态"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "xkeyboard-config未安装,将在测试过程中安装并在结束后卸载"
|
||||
already_installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有xkeyboard-config软件包
|
||||
LOG_INFO "检查yum源中是否有xkeyboard-config软件包"
|
||||
dnf list available xkeyboard-config > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到xkeyboard-config软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "安装xkeyboard-config软件包"
|
||||
dnf install -y xkeyboard-config
|
||||
CHECK_RESULT $? 0 0 "安装xkeyboard-config失败"
|
||||
fi
|
||||
|
||||
# 测试show-layout功能
|
||||
LOG_INFO "测试xkeyboard-config的show-layout功能"
|
||||
# 检查show-layout参数是否存在
|
||||
setlocalectl list-x11-keymap-layouts --help 2>&1 | grep -q "show-layout"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "show-layout参数不存在或不支持"
|
||||
# 如果之前未安装,需要卸载软件包
|
||||
if [ "$already_installed" = false ]; then
|
||||
dnf remove -y xkeyboard-config
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 获取一个可用的布局进行测试
|
||||
LOG_INFO "获取可用的键盘布局列表"
|
||||
layout_list=$(setlocalectl list-x11-keymap-layouts)
|
||||
CHECK_RESULT $? 0 0 "获取键盘布局列表失败"
|
||||
|
||||
# 检查是否至少有一个布局可用
|
||||
if [ -z "$layout_list" ]; then
|
||||
LOG_ERROR "未找到可用的键盘布局"
|
||||
# 如果之前未安装,需要卸载软件包
|
||||
if [ "$already_installed" = false ]; then
|
||||
dnf remove -y xkeyboard-config
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 选择第一个布局进行测试
|
||||
first_layout=$(echo "$layout_list" | head -1)
|
||||
LOG_INFO "测试布局: $first_layout"
|
||||
|
||||
# 测试show-layout功能
|
||||
LOG_INFO "显示特定布局的详细信息"
|
||||
setlocalectl list-x11-keymap-layouts --show-layout "$first_layout"
|
||||
CHECK_RESULT $? 0 0 "显示布局信息失败"
|
||||
|
||||
# 测试无效布局参数
|
||||
LOG_INFO "测试无效布局参数(预期失败)"
|
||||
setlocalectl list-x11-keymap-layouts --show-layout "invalid_layout_12345" 2>&1 > /dev/null
|
||||
CHECK_RESULT $? 1 0 "无效布局参数测试未按预期失败"
|
||||
|
||||
# 环境恢复
|
||||
LOG_INFO "恢复测试环境"
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "卸载xkeyboard-config软件包"
|
||||
dnf remove -y xkeyboard-config
|
||||
CHECK_RESULT $? 0 0 "卸载xkeyboard-config失败"
|
||||
LOG_INFO "环境已恢复到未安装状态"
|
||||
else
|
||||
LOG_INFO "保持xkeyboard-config安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user