This commit is contained in:
2026-04-16 20:48:57 +08:00
98 changed files with 0 additions and 6884 deletions

View File

@@ -9,18 +9,6 @@
{
"name": "test_blktrace-help_function_uninstall",
"desc": "测试blktrace-help软件包是否能够成功卸载"
},
{
"name": "test_blktrace-help_function_check_installed",
"desc": "验证blktrace-help软件包是否已正确安装"
},
{
"name": "test_blktrace-help_function_display_help",
"desc": "测试执行blktrace-help命令是否能正常显示帮助信息"
},
{
"name": "test_blktrace-help_function_man_page",
"desc": "验证blktrace-help软件包提供的man手册页是否存在且可读"
}
]
}

View File

@@ -14,14 +14,6 @@
"name": "test_culmus-shofar-fonts_function_font_files",
"desc": "测试检查软件包安装的字体文件是否存在。"
},
{
"name": "test_culmus-shofar-fonts_function_fontconfig",
"desc": "测试字体配置系统是否能正确识别并列出culmus-shofar字体。"
},
{
"name": "test_culmus-shofar-fonts_function_app_usage",
"desc": "测试在支持字体选择的应用程序中能否使用culmus-shofar字体。"
},
{
"name": "test_culmus-shofar-fonts_function_uninstall",
"desc": "测试通过包管理器卸载culmus-shofar-fonts软件包。"

View File

@@ -1,22 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/nagios-plugins/nagios-plugins-nagios",
"machine num": 1,
"cases": [
{
"name": "test_nagios-plugins-nagios_function_check_disk",
"desc": "Verify disk usage monitoring functionality"
},
{
"name": "test_nagios-plugins-nagios_function_check_cpu",
"desc": "Verify CPU usage monitoring functionality"
},
{
"name": "test_nagios-plugins-nagios_function_check_mem",
"desc": "Verify memory usage monitoring functionality"
},
{
"name": "test_nagios-plugins-nagios_function_check_net",
"desc": "Verify network connectivity monitoring functionality"
}
]
}

View File

@@ -19,86 +19,14 @@
"name": "test_ocaml-cppo_function_no_line_dir",
"desc": "测试使用 -n 参数不输出行指令的功能"
},
{
"name": "test_ocaml-cppo_cppo__upper_d",
"desc": "测试使用-D参数定义宏并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo__upper_u",
"desc": "测试使用-U参数取消宏定义并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo__upper_i",
"desc": "测试使用-I参数添加包含文件搜索目录并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo__upper_v",
"desc": "测试使用-V参数根据语义化版本字符串定义相关变量并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo_q",
"desc": "测试使用-q参数识别并保留camlp4引用并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo_s",
"desc": "测试使用-s参数输出指向每个标记精确源代码位置的行指令并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo_n",
"desc": "测试使用-n参数不输出任何行指令覆盖-s参数并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo_version",
"desc": "测试使用-version参数打印程序版本并退出"
},
{
"name": "test_ocaml-cppo_cppo_x",
"desc": "测试使用-x参数定义自定义预处理器目标段并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo_help",
"desc": "测试使用-help参数显示选项列表"
},
{
"name": "test_ocaml-cppo_cppo__help",
"desc": "测试使用--help参数显示选项列表"
},
{
"name": "test_ocaml-cppo_cppo__upper_d__upper_u",
"desc": "测试组合使用-D和-U参数定义与取消宏定义并处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo__upper_i_o",
"desc": "测试组合使用-I和-o参数添加包含目录并指定输出文件处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo__upper_v_s",
"desc": "测试组合使用-V和-s参数定义版本变量并输出精确行指令处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo_q_n",
"desc": "测试组合使用-q和-n参数识别保留引用且不输出行指令处理输入文件"
},
{
"name": "test_ocaml-cppo_cppo__upper_d__upper_i_o",
"desc": "测试组合使用-D、-I和-o参数定义宏、添加包含目录并指定输出文件处理输入文件"
},
{
"name": "test_ocaml-cppo_function_install",
"desc": "测试 ocaml-cppo 软件包的安装功能,验证安装过程是否成功。"
},
{
"name": "test_ocaml-cppo_function_basic_usage",
"desc": "测试 cppo 基本文件处理功能,验证标准输入输出处理"
},
{
"name": "test_ocaml-cppo_function_define_macro",
"desc": "测试使用 -D 参数定义宏并处理文件"
},
{
"name": "test_ocaml-cppo_function_version",
"desc": "测试使用 -version 参数打印程序版本"
},
{
"name": "test_ocaml-cppo_function_help",
"desc": "测试使用 -help 参数显示选项列表"

View File

@@ -6,22 +6,6 @@
"name": "test_openwebbeans-resource_install",
"desc": "测试openwebbeans-resource软件包的安装功能",
"machine num": 1
},
{
"name": "test_openwebbeans-resource_function_load",
"desc": "测试openwebbeans-resource软件包的资源加载功能"
},
{
"name": "test_openwebbeans-resource_function_config",
"desc": "测试openwebbeans-resource软件包的配置功能"
},
{
"name": "test_openwebbeans-resource_function_inject",
"desc": "测试openwebbeans-resource软件包的依赖注入功能"
},
{
"name": "test_openwebbeans-resource_function_scope",
"desc": "测试openwebbeans-resource软件包的作用域功能"
}
]
}

View File

@@ -5,18 +5,6 @@
{
"name": "test_perl-Alien-Build-help_function_install",
"desc": "测试 perl-Alien-Build-help 软件包能否成功安装"
},
{
"name": "test_perl-Alien-Build-help_function_version",
"desc": "测试 perl-Alien-Build-help 软件包是否能正确查询版本信息"
},
{
"name": "test_perl-Alien-Build-help_function_usage",
"desc": "测试 perl-Alien-Build-help 软件包是否能显示基本用法或帮助信息"
},
{
"name": "test_perl-Alien-Build-help_function_uninstall",
"desc": "测试 perl-Alien-Build-help 软件包能否被干净地卸载"
}
]
}

View File

@@ -6,18 +6,6 @@
"name": "test_rrdtool-devel_function_install",
"desc": "Test installation of rrdtool-devel package"
},
{
"name": "test_rrdtool-devel_function_verify_install",
"desc": "Verify rrdtool-devel package is installed"
},
{
"name": "test_rrdtool-devel_function_check_files",
"desc": "Check existence of key header and lib files"
},
{
"name": "test_rrdtool-devel_function_compile_test",
"desc": "Test compile a simple program with rrdtool libs"
},
{
"name": "test_rrdtool-devel_function_uninstall",
"desc": "Test uninstallation of rrdtool-devel package"

View File

@@ -6,10 +6,6 @@
"name": "test_rubygem-rr-doc_install",
"desc": "测试软件包 rubygem-rr-doc 的安装功能,验证是否能够成功安装到系统中。",
"machine num": 1
},
{
"name": "test_rubygem-rr-doc_function_load",
"desc": "测试软件包 rubygem-rr-doc 的加载功能,验证是否能够成功加载到系统中。"
}
]
}

View File

@@ -2,225 +2,9 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/tensorflow/python3-tensorflow",
"machine num": 1,
"cases": [
{
"name": "test_python3-tensorflow_estimator_ckpt_converter_h",
"desc": "测试 estimator_ckpt_converter 命令的 -h 参数,显示帮助信息"
},
{
"name": "test_python3-tensorflow_estimator_ckpt_converter_v",
"desc": "测试 estimator_ckpt_converter 命令的 -v 参数,显示版本信息"
},
{
"name": "test_python3-tensorflow_estimator_ckpt_converter_upper_v",
"desc": "测试 estimator_ckpt_converter 命令的 -V 参数,显示详细版本信息"
},
{
"name": "test_python3-tensorflow_import_pb_to_tensorboard__",
"desc": "测试 import_pb_to_tensorboard 命令不带参数时的行为"
},
{
"name": "test_python3-tensorflow_saved_model_cli_helpfull",
"desc": "测试 saved_model_cli 的 --helpfull 参数,获取所有支持的标志列表"
},
{
"name": "test_python3-tensorflow_tensorboard_logdir",
"desc": "测试使用 --logdir 参数指定日志目录"
},
{
"name": "test_python3-tensorflow_tensorboard_host",
"desc": "测试使用 --host 参数指定监听地址"
},
{
"name": "test_python3-tensorflow_tensorboard_bind_all",
"desc": "测试使用 --bind_all 参数在所有公共接口上提供服务"
},
{
"name": "test_python3-tensorflow_tensorboard_port",
"desc": "测试使用 --port 参数指定服务端口"
},
{
"name": "test_python3-tensorflow_tensorboard_reuse_port",
"desc": "测试使用 --reuse_port 参数启用端口重用"
},
{
"name": "test_python3-tensorflow_tensorboard_load_fast",
"desc": "测试使用 --load_fast 参数启用快速加载模式"
},
{
"name": "test_python3-tensorflow_tensorboard_purge_orphaned_data",
"desc": "测试使用 --purge_orphaned_data 参数控制是否清理孤立数据"
},
{
"name": "test_python3-tensorflow_tensorboard_inspect",
"desc": "测试使用 --inspect 参数检查事件文件摘要"
},
{
"name": "test_python3-tensorflow_tensorboard_version_tb",
"desc": "测试使用 --version_tb 参数打印 TensorBoard 版本"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_infile_outfile",
"desc": "测试单个文件转换功能"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_intree_outtree",
"desc": "测试整个目录树转换功能"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_copyotherfiles",
"desc": "测试转换时是否复制其他文件"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_inplace",
"desc": "测试是否允许直接在输入文件上进行转换"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_no_import_rename",
"desc": "测试是否不重命名导入为compat.v2"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_no_upgrade_compat_v1_import",
"desc": "测试是否不升级显式导入tensorflow.compat.v1为v2 API"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_reportfile",
"desc": "测试报告日志文件的存储名称"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_mode_default",
"desc": "测试升级脚本的默认模式"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_mode_safety",
"desc": "测试升级脚本的安全模式"
},
{
"name": "test_python3-tensorflow_tf_upgrade_v2_print_all",
"desc": "测试是否打印完整日志到标准输出"
},
{
"name": "test_python3-tensorflow_tflite_convert_output_file",
"desc": "测试 tflite_convert 命令的 --output_file 参数"
},
{
"name": "test_python3-tensorflow_tflite_convert_saved_model_dir",
"desc": "测试 tflite_convert 命令的 --saved_model_dir 参数"
},
{
"name": "test_python3-tensorflow_tflite_convert_keras_model_file",
"desc": "测试 tflite_convert 命令的 --keras_model_file 参数"
},
{
"name": "test_python3-tensorflow_tflite_convert_saved_model_tag_set",
"desc": "测试 tflite_convert 命令的 --saved_model_tag_set 参数"
},
{
"name": "test_python3-tensorflow_tflite_convert_saved_model_signature_key",
"desc": "测试 tflite_convert 命令的 --saved_model_signature_key 参数"
},
{
"name": "test_python3-tensorflow_tflite_convert_enable_v1_converter",
"desc": "测试 tflite_convert 命令的 --enable_v1_converter 参数"
},
{
"name": "test_python3-tensorflow_tflite_convert_experimental_new_converter",
"desc": "测试 tflite_convert 命令的 --experimental_new_converter 参数"
},
{
"name": "test_python3-tensorflow_tflite_convert_experimental_new_quantizer",
"desc": "测试 tflite_convert 命令的 --experimental_new_quantizer 参数"
},
{
"name": "test_python3-tensorflow_toco_output_file",
"desc": "测试 toco 命令的 --output_file 参数"
},
{
"name": "test_python3-tensorflow_toco_saved_model_dir",
"desc": "测试 toco 命令的 --saved_model_dir 参数"
},
{
"name": "test_python3-tensorflow_toco_keras_model_file",
"desc": "测试 toco 命令的 --keras_model_file 参数"
},
{
"name": "test_python3-tensorflow_toco_saved_model_tag_set",
"desc": "测试 toco 命令的 --saved_model_tag_set 参数"
},
{
"name": "test_python3-tensorflow_toco_saved_model_signature_key",
"desc": "测试 toco 命令的 --saved_model_signature_key 参数"
},
{
"name": "test_python3-tensorflow_toco_enable_v1_converter",
"desc": "测试 toco 命令的 --enable_v1_converter 参数"
},
{
"name": "test_python3-tensorflow_toco_experimental_new_converter",
"desc": "测试 toco 命令的 --experimental_new_converter 参数"
},
{
"name": "test_python3-tensorflow_toco_experimental_new_quantizer",
"desc": "测试 toco 命令的 --experimental_new_quantizer 参数"
},
{
"name": "test_python3-tensorflow_toco_from_protos_model_proto_file",
"desc": "测试使用 model_proto_file 参数进行 TOCO 转换"
},
{
"name": "test_python3-tensorflow_toco_from_protos_toco_proto_file",
"desc": "测试使用 toco_proto_file 参数进行 TOCO 转换"
},
{
"name": "test_python3-tensorflow_toco_from_protos_model_input_file",
"desc": "测试使用 model_input_file 参数进行 TOCO 转换"
},
{
"name": "test_python3-tensorflow_toco_from_protos_model_output_file",
"desc": "测试使用 model_output_file 参数进行 TOCO 转换"
},
{
"name": "test_python3-tensorflow_toco_from_protos_debug_proto_file",
"desc": "测试使用 debug_proto_file 选项进行 TOCO 转换"
},
{
"name": "test_python3-tensorflow_toco_from_protos_enable_mlir_converter",
"desc": "测试启用 MLIR 转换器进行 TOCO 转换"
},
{
"name": "test_python3-tensorflow_function_keras_model",
"desc": "Test Keras model loading and saving functionality"
},
{
"name": "test_python3-tensorflow_estimator_ckpt_converter_help",
"desc": "测试 estimator_ckpt_converter 命令的帮助文档是否正常显示"
},
{
"name": "test_python3-tensorflow_estimator_ckpt_converter_version",
"desc": "测试 estimator_ckpt_converter 命令的版本信息是否正常显示"
},
{
"name": "test_python3-tensorflow_tensorboard_path_prefix",
"desc": "测试使用--path_prefix参数设置路径前缀"
},
{
"name": "test_python3-tensorflow_tensorboard_window_title",
"desc": "测试使用--window_title参数更改浏览器窗口标题"
},
{
"name": "test_python3-tensorflow_tensorboard_reload_interval_num_0",
"desc": "测试使用--reload_interval=0参数仅在启动时加载一次数据"
},
{
"name": "test_python3-tensorflow_tensorboard_special_helpfull",
"desc": "测试使用--helpfull参数显示完整帮助信息"
},
{
"name": "test_python3-tensorflow_toco_from_protos_basic",
"desc": "测试 toco_from_protos 基本功能,包含必需的四个参数"
},
{
"name": "test_python3-tensorflow_function_keras_save",
"desc": "Test saving a Keras model to a file"
}
]
}

View File

@@ -1,10 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-d/texlive-borceux-doc",
"machine num": 1,
"cases": [
{
"name": "test_texlive-borceux-doc_function_install",
"desc": "Test package installation"
}
]
}

View File

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

View File

@@ -1,30 +0,0 @@
{
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-g/texlive-doctools",
"machine num": 1,
"cases": [
{
"name": "test_texlive-doctools_function_docgen",
"desc": "Test document generation"
},
{
"name": "test_texlive-doctools_function_install",
"desc": "Test package installation"
},
{
"name": "test_texlive-doctools_function_uninstall",
"desc": "Test package removal"
},
{
"name": "test_texlive-doctools_function_check_installed",
"desc": "Test if package is installed"
},
{
"name": "test_texlive-doctools_function_basic_usage",
"desc": "Test basic command execution"
},
{
"name": "test_texlive-doctools_function_version_check",
"desc": "Test version information query"
}
]
}

View File

@@ -6,10 +6,6 @@
"name": "test_texlive-draftcopy-doc_install",
"desc": "测试texlive-draftcopy-doc软件包的安装功能",
"machine num": 1
},
{
"name": "test_texlive-draftcopy-doc_function_build",
"desc": "测试texlive-draftcopy-doc软件包的构建功能"
}
]
}

View File

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

View File

@@ -2,17 +2,9 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-l/texlive-ijmart",
"machine num": 1,
"cases": [
{
"name": "test_texlive-ijmart_function_install",
"desc": "Test package installation"
},
{
"name": "test_texlive-ijmart_function_uninstall",
"desc": "Test package removal"
},
{
"name": "test_texlive-ijmart_function_basic",
"desc": "Test basic command usage"
}
]
}

View File

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

View File

@@ -2,10 +2,6 @@
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-x/texlive-timbreicmc",
"machine num": 1,
"cases": [
{
"name": "test_texlive-timbreicmc_function_basic",
"desc": "Test basic command usage"
},
{
"name": "test_texlive-timbreicmc_install",
"desc": "Test installation of the package"
@@ -14,10 +10,6 @@
"name": "test_texlive-timbreicmc_verify",
"desc": "Test if the package is installed and functional"
},
{
"name": "test_texlive-timbreicmc_basic_usage",
"desc": "Test basic document compilation with the package"
},
{
"name": "test_texlive-timbreicmc_uninstall",
"desc": "Test removal of the package"

View File

@@ -6,10 +6,6 @@
"name": "test_texlive-yfonts-t1-doc_function_install",
"desc": "Test package installation"
},
{
"name": "test_texlive-yfonts-t1-doc_function_check_installed",
"desc": "Check if the package is installed"
},
{
"name": "test_texlive-yfonts-t1-doc_function_remove",
"desc": "Test package removal"

View File

@@ -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-10
# @License : Mulan PSL v2
# @Desc : 验证blktrace-help软件包是否已正确安装
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试验证blktrace-help软件包是否已正确安装"
# 检查yum源中是否存在blktrace-help软件包
LOG_INFO "步骤1检查yum源中是否存在blktrace-help软件包"
dnf list available blktrace-help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到blktrace-help软件包"
exit 255
fi
# 检查是否已安装blktrace-help软件包
LOG_INFO "步骤2检查是否已安装blktrace-help软件包"
rpm -q blktrace-help > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "blktrace-help软件包已安装跳过安装步骤"
INSTALLED=true
else
LOG_INFO "blktrace-help软件包未安装开始安装"
INSTALLED=false
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "步骤3安装blktrace-help软件包"
dnf install -y blktrace-help
CHECK_RESULT $? 0 0 "安装blktrace-help软件包失败"
fi
# 验证blktrace-help软件包是否正确安装
LOG_INFO "步骤4验证blktrace-help软件包是否正确安装"
rpm -q blktrace-help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "blktrace-help软件包未正确安装"
# 测试blktrace-help命令是否可用
LOG_INFO "步骤5测试blktrace-help命令是否可用"
blktrace --help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "blktrace-help命令不可用"
# 清理环境:如果之前未安装,则卸载软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "步骤6清理环境卸载blktrace-help软件包"
dnf remove -y blktrace-help
CHECK_RESULT $? 0 0 "卸载blktrace-help软件包失败"
else
LOG_INFO "步骤6保持blktrace-help软件包安装状态"
fi
LOG_INFO "测试完成blktrace-help软件包已正确安装"
}
main "$@"

View File

@@ -1,130 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 : 测试执行blktrace-help命令是否能正常显示帮助信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义日志函数
LOG_INFO() {
echo "[INFO] $*"
}
LOG_ERROR() {
echo "[ERROR] $*"
}
# 检查软件包是否存在
check_package_exists() {
local package_name=$1
dnf list available "$package_name" &> /dev/null
return $?
}
# 检查命令参数是否存在
check_command_param() {
local command=$1
local param=$2
$command --help 2>&1 | grep -q "\<$param\>"
return $?
}
# 检查环境是否已安装指定软件包
check_installed() {
local package_name=$1
rpm -q "$package_name" &> /dev/null
return $?
}
# 安装软件包
install_package() {
local package_name=$1
LOG_INFO "安装软件包:$package_name"
dnf install -y "$package_name"
CHECK_RESULT $? 0 0 "安装软件包失败"
}
# 卸载软件包
uninstall_package() {
local package_name=$1
LOG_INFO "卸载软件包:$package_name"
dnf remove -y "$package_name"
CHECK_RESULT $? 0 0 "卸载软件包失败"
}
# 主测试函数
main() {
local package_name="blktrace"
local command="blktrace"
local param="--help"
local installed_before_test=false
local need_uninstall=false
# 步骤1检查环境是否已安装blktrace
LOG_INFO "检查环境是否已安装blktrace"
if check_installed "$package_name"; then
LOG_INFO "blktrace已安装测试结束后保持安装状态"
installed_before_test=true
else
LOG_INFO "blktrace未安装将在测试步骤中安装"
need_uninstall=true
fi
# 步骤2检查yum源中是否有blktrace软件包
LOG_INFO "检查yum源中是否有blktrace软件包"
if ! check_package_exists "$package_name"; then
LOG_ERROR "yum源中没有blktrace软件包"
exit 255
fi
# 步骤3如果未安装则安装blktrace
if [ "$installed_before_test" = false ]; then
install_package "$package_name"
fi
# 步骤4检查blktrace命令是否支持--help参数
LOG_INFO "检查blktrace命令是否支持--help参数"
if ! check_command_param "$command" "$param"; then
LOG_ERROR "blktrace命令不支持--help参数"
if [ "$need_uninstall" = true ]; then
uninstall_package "$package_name"
fi
exit 255
fi
# 步骤5执行blktrace --help命令
LOG_INFO "执行blktrace --help命令"
$command $param
CHECK_RESULT $? 0 0 "执行blktrace --help命令失败"
# 步骤6清理环境
LOG_INFO "清理环境"
if [ "$need_uninstall" = true ] && [ "$installed_before_test" = false ]; then
uninstall_package "$package_name"
else
LOG_INFO "保持blktrace安装状态无需卸载"
fi
LOG_INFO "测试完成"
}
# 执行主函数
main
}
main "$@"

View File

@@ -1,77 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-11
# @License : Mulan PSL v2
# @Desc : 验证blktrace-help软件包提供的man手册页是否存在且可读
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 环境初始化
LOG_INFO "开始测试验证blktrace-help软件包提供的man手册页是否存在且可读"
# 步骤1检查软件包是否已在系统中安装
LOG_INFO "步骤1检查blktrace-help软件包是否已安装"
rpm -q blktrace-help
if [ $? -eq 0 ]; then
LOG_INFO "blktrace-help软件包已安装测试结束后将保持安装状态"
INSTALLED=1
else
LOG_INFO "blktrace-help软件包未安装将在测试过程中安装并最终卸载"
INSTALLED=0
fi
# 步骤2检查yum源中是否存在blktrace-help软件包
LOG_INFO "步骤2检查yum源中是否存在blktrace-help软件包"
dnf list available blktrace-help 2>&1 | grep -q "blktrace-help"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到blktrace-help软件包"
exit 255
fi
# 步骤3安装blktrace-help软件包如果未安装
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤3安装blktrace-help软件包"
dnf install -y blktrace-help
CHECK_RESULT $? 0 0 "安装blktrace-help软件包失败"
fi
# 步骤4检查blktrace-help软件包是否成功安装
LOG_INFO "步骤4验证blktrace-help软件包安装状态"
rpm -q blktrace-help
CHECK_RESULT $? 0 0 "blktrace-help软件包未正确安装"
# 步骤5验证man手册页是否存在
LOG_INFO "步骤5验证blktrace-help软件包提供的man手册页是否存在"
man -w blktrace-help 2>&1
CHECK_RESULT $? 0 0 "blktrace-help的man手册页不存在"
# 步骤6验证man手册页是否可读
LOG_INFO "步骤6验证blktrace-help软件包提供的man手册页是否可读"
man blktrace-help > /dev/null 2>&1
CHECK_RESULT $? 0 0 "blktrace-help的man手册页不可读"
# 步骤7清理环境如果测试前未安装则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤7卸载blktrace-help软件包"
dnf remove -y blktrace-help
CHECK_RESULT $? 0 0 "卸载blktrace-help软件包失败"
fi
LOG_INFO "测试完成blktrace-help软件包提供的man手册页存在且可读"
}
main "$@"

View File

@@ -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-26
# @License : Mulan PSL v2
# @Desc : 测试在支持字体选择的应用程序中能否使用culmus-shofar字体。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试测试在支持字体选择的应用程序中能否使用culmus-shofar字体。"
LOG_INFO "步骤1检查yum源中是否存在culmus-shofar-fonts软件包"
dnf list available culmus-shofar-fonts
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到culmus-shofar-fonts软件包"
exit 255
fi
LOG_INFO "步骤2检查系统是否已安装culmus-shofar-fonts"
rpm -q culmus-shofar-fonts
if [ $? -eq 0 ]; then
LOG_INFO "culmus-shofar-fonts已安装测试完成后将保持安装状态"
INSTALLED=1
else
LOG_INFO "culmus-shofar-fonts未安装将进行安装"
INSTALLED=0
fi
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤3安装culmus-shofar-fonts软件包"
dnf install -y culmus-shofar-fonts
CHECK_RESULT $? 0 0 "安装culmus-shofar-fonts失败"
fi
LOG_INFO "步骤4验证字体文件是否存在"
ls /usr/share/fonts/culmus-shofar/*.ttf > /dev/null 2>&1
CHECK_RESULT $? 0 0 "culmus-shofar字体文件不存在"
LOG_INFO "步骤5检查fontconfig是否能够识别culmus-shofar字体"
fc-list | grep -i "shofar" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "fontconfig未识别到culmus-shofar字体"
LOG_INFO "步骤6测试在支持字体选择的应用程序中能否使用culmus-shofar字体"
echo "测试文本" | pango-view --font="Shofar" -t "测试culmus-shofar字体渲染" -qo /tmp/font_test.png 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "参数"Shofar"可能不被支持或命令执行失败"
exit 255
fi
CHECK_RESULT $? 0 0 "使用culmus-shofar字体渲染测试失败"
LOG_INFO "步骤7清理测试生成的文件"
rm -f /tmp/font_test.png
CHECK_RESULT $? 0 0 "清理测试文件失败"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤8卸载culmus-shofar-fonts软件包"
dnf remove -y culmus-shofar-fonts
CHECK_RESULT $? 0 0 "卸载culmus-shofar-fonts失败"
LOG_INFO "环境已恢复至测试前状态"
else
LOG_INFO "测试完成保持culmus-shofar-fonts安装状态"
fi
LOG_INFO "测试结束测试在支持字体选择的应用程序中能否使用culmus-shofar字体。"
}
main "$@"

View File

@@ -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-26
# @License : Mulan PSL v2
# @Desc : 测试字体配置系统是否能正确识别并列出culmus-shofar字体。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试culmus-shofar字体配置功能"
LOG_INFO "步骤1: 检查culmus-shofar-fonts软件包是否在yum源中"
dnf list available culmus-shofar-fonts > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "culmus-shofar-fonts软件包不在yum源中"
exit 255
fi
LOG_INFO "步骤2: 检查系统是否已安装culmus-shofar-fonts"
rpm -q culmus-shofar-fonts > /dev/null 2>&1
INSTALLED=$?
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "culmus-shofar-fonts已安装测试后保持安装状态"
NEED_UNINSTALL=0
else
LOG_INFO "culmus-shofar-fonts未安装将进行安装测试"
NEED_UNINSTALL=1
fi
if [ $NEED_UNINSTALL -eq 1 ]; then
LOG_INFO "步骤3: 安装culmus-shofar-fonts软件包"
dnf install -y culmus-shofar-fonts
CHECK_RESULT $? 0 0 "安装culmus-shofar-fonts失败"
fi
LOG_INFO "步骤4: 检查fc-list命令是否存在"
command -v fc-list > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "fc-list命令不存在"
if [ $NEED_UNINSTALL -eq 1 ]; then
dnf remove -y culmus-shofar-fonts
fi
exit 255
fi
LOG_INFO "步骤5: 检查fc-list是否支持--format参数"
fc-list --help 2>&1 | grep -q "\-\-format"
if [ $? -ne 0 ]; then
LOG_ERROR "fc-list不支持--format参数"
if [ $NEED_UNINSTALL -eq 1 ]; then
dnf remove -y culmus-shofar-fonts
fi
exit 255
fi
LOG_INFO "步骤6: 使用fc-list列出culmus-shofar字体"
fc-list --format="%{family}\n" | grep -i "shofar" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "字体配置系统未能正确识别culmus-shofar字体"
LOG_INFO "步骤7: 验证culmus-shofar字体文件存在"
FONT_FILES=$(rpm -ql culmus-shofar-fonts | grep -E "\.(ttf|otf)$" | head -5)
if [ -z "$FONT_FILES" ]; then
LOG_ERROR "未找到culmus-shofar字体文件"
CHECK_RESULT 1 0 0 "未找到culmus-shofar字体文件"
else
LOG_INFO "找到culmus-shofar字体文件:"
echo "$FONT_FILES"
CHECK_RESULT 0 0 0 "检查字体文件失败"
fi
if [ $NEED_UNINSTALL -eq 1 ]; then
LOG_INFO "步骤8: 清理环境卸载culmus-shofar-fonts软件包"
dnf remove -y culmus-shofar-fonts
CHECK_RESULT $? 0 0 "卸载culmus-shofar-fonts失败"
else
LOG_INFO "步骤8: 保持culmus-shofar-fonts安装状态"
fi
LOG_INFO "测试完成字体配置系统能正确识别并列出culmus-shofar字体"
}
main "$@"

View File

@@ -1,72 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-02
# @License : Mulan PSL v2
# @Desc : Verify CPU usage monitoring functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试CPU使用率监控功能"
# 检查是否已安装nagios-plugins-nagios软件包
LOG_INFO "检查nagios-plugins-nagios是否已安装"
if rpm -q nagios-plugins-nagios > /dev/null; then
LOG_INFO "nagios-plugins-nagios已安装"
INSTALLED=true
else
LOG_INFO "nagios-plugins-nagios未安装"
INSTALLED=false
fi
# 检查yum源中是否有nagios-plugins-nagios软件包
LOG_INFO "检查yum源中是否有nagios-plugins-nagios软件包"
if ! dnf list available nagios-plugins-nagios > /dev/null 2>&1; then
LOG_ERROR "yum源中未找到nagios-plugins-nagios软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装nagios-plugins-nagios软件包"
dnf install -y nagios-plugins-nagios
CHECK_RESULT $? 0 0 "安装nagios-plugins-nagios失败"
fi
# 检查check_cpu命令是否存在
LOG_INFO "检查check_cpu命令是否存在"
if ! command -v check_cpu > /dev/null; then
LOG_ERROR "check_cpu命令不存在"
exit 255
fi
# 测试check_cpu命令的基本功能
LOG_INFO "测试check_cpu命令的基本功能"
check_cpu -w 80 -c 90
CHECK_RESULT $? 0 0 "check_cpu命令执行失败"
# 测试不支持的参数
LOG_INFO "测试check_cpu命令不支持的参数"
check_cpu --invalid-option > /dev/null 2>&1
CHECK_RESULT $? 255 0 "check_cpu命令不支持--invalid-option参数"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载nagios-plugins-nagios软件包"
dnf remove -y nagio
}
main "$@"

View File

@@ -1,71 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-11-30
# @License : Mulan PSL v2
# @Desc : Verify disk usage monitoring functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装nagios-plugins-nagios软件包
LOG_INFO "检查是否已安装nagios-plugins-nagios软件包"
rpm -q nagios-plugins-nagios > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "nagios-plugins-nagios已安装"
installed=true
else
LOG_INFO "nagios-plugins-nagios未安装"
installed=false
fi
# 检查yum源中是否存在nagios-plugins-nagios软件包
LOG_INFO "检查yum源中是否存在nagios-plugins-nagios软件包"
dnf list available nagios-plugins-nagios > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在nagios-plugins-nagios软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装nagios-plugins-nagios软件包"
dnf install -y nagios-plugins-nagios > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装nagios-plugins-nagios失败"
fi
# 测试check_disk命令的功能
LOG_INFO "测试check_disk命令的功能"
check_disk_output=$(/usr/lib64/nagios/plugins/check_disk -w 80% -c 90% /)
CHECK_RESULT $? 0 0 "check_disk命令执行失败"
# 验证输出结果是否符合预期
LOG_INFO "验证check_disk命令输出结果"
echo "$check_disk_output" | grep -q "OK"
CHECK_RESULT $? 0 0 "check_disk命令输出结果不符合预期"
# 清理环境
if [ "$installed" = false ]; then
LOG_INFO "卸载nagios-plugins-nagios软件包"
dnf remove -y nagios-plugins-nagios > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载nagios-plugins-nagios失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,73 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-02
# @License : Mulan PSL v2
# @Desc : Verify memory usage monitoring functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试内存使用监控功能"
# 检查是否已安装nagios-plugins-nagios
LOG_INFO "检查nagios-plugins-nagios是否已安装"
if ! dnf list installed nagios-plugins-nagios &>/dev/null; then
LOG_INFO "nagios-plugins-nagios未安装将进行安装"
installed_flag=1
else
LOG_INFO "nagios-plugins-nagios已安装"
installed_flag=0
fi
# 检查yum源中是否有nagios-plugins-nagios
LOG_INFO "检查yum源中是否有nagios-plugins-nagios"
if ! dnf list available nagios-plugins-nagios &>/dev/null; then
LOG_ERROR "yum源中未找到nagios-plugins-nagios"
exit 255
fi
# 如果未安装,则安装软件包
if [ $installed_flag -eq 1 ]; then
LOG_INFO "安装nagios-plugins-nagios"
dnf install -y nagios-plugins-nagios
CHECK_RESULT $? 0 0 "安装nagios-plugins-nagios失败"
fi
# 测试check_mem命令是否存在
LOG_INFO "测试check_mem命令是否存在"
if ! command -v check_mem &>/dev/null; then
LOG_ERROR "check_mem命令不存在或不支持"
exit 255
fi
# 测试check_mem命令的基本功能
LOG_INFO "测试check_mem命令的基本功能"
check_mem -w 80 -c 90
CHECK_RESULT $? 0 0 "check_mem命令执行失败"
# 测试无效参数
LOG_INFO "测试无效参数"
check_mem --invalid-option &>/dev/null
CHECK_RESULT $? 255 0 "check_mem命令未正确处理无效参数"
# 清理环境:如果之前未安装,则卸载软件包
if [ $installed_flag -eq 1 ]; then
LOG_INFO "卸载nagios-plugins-nagios"
dnf remove -y nagios-plugins-nagios
CHECK_RESULT $? 0 0 "卸载nagios-plugins-nag
}
main "$@"

View File

@@ -1,66 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-02
# @License : Mulan PSL v2
# @Desc : Verify network connectivity monitoring functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装nagios-plugins-nagios软件包
LOG_INFO "检查是否已安装nagios-plugins-nagios软件包"
if dnf list installed nagios-plugins-nagios &>/dev/null; then
LOG_INFO "nagios-plugins-nagios已安装"
INSTALLED=true
else
LOG_INFO "nagios-plugins-nagios未安装"
INSTALLED=false
fi
# 检查yum源中是否存在nagios-plugins-nagios软件包
LOG_INFO "检查yum源中是否存在nagios-plugins-nagios软件包"
if ! dnf list available nagios-plugins-nagios &>/dev/null; then
LOG_ERROR "yum源中不存在nagios-plugins-nagios软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装nagios-plugins-nagios软件包"
dnf install -y nagios-plugins-nagios
CHECK_RESULT $? 0 0 "安装nagios-plugins-nagios软件包失败"
fi
# 检查check_net命令是否存在
LOG_INFO "检查check_net命令是否存在"
if ! command -v check_net &>/dev/null; then
LOG_ERROR "check_net命令不存在或不支持"
exit 255
fi
# 测试网络连通性监控功能
LOG_INFO "测试网络连通性监控功能"
check_net -H localhost
CHECK_RESULT $? 0 0 "网络连通性监控功能测试失败"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载nagios-plugins-nagios软件包"
dnf remove -y nagios-plugins-nagios
CHECK_RESULT $? 0 0 "卸载nag
}
main "$@"

View File

@@ -1,93 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-D参数定义宏并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "测试开始:测试使用-D参数定义宏并处理输入文件"
LOG_INFO "步骤1检查软件包是否在yum源中"
if ! dnf list available ocaml-cppo-cppo 2>/dev/null | grep -q "ocaml-cppo-cppo"; then
LOG_ERROR "软件包 ocaml-cppo-cppo 不在yum源中"
exit 255
fi
LOG_INFO "步骤2检查环境是否已安装软件包"
if rpm -q ocaml-cppo-cppo >/dev/null 2>&1; then
LOG_INFO "软件包已安装,标记为已存在安装"
INSTALLED_BEFORE=1
else
LOG_INFO "软件包未安装,标记为需要安装"
INSTALLED_BEFORE=0
fi
if [ $INSTALLED_BEFORE -eq 0 ]; then
LOG_INFO "步骤3安装软件包"
dnf install -y ocaml-cppo-cppo
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
LOG_INFO "步骤4验证cppo命令是否存在"
if ! command -v cppo >/dev/null 2>&1; then
LOG_ERROR "cppo命令不存在"
exit 255
fi
LOG_INFO "步骤5验证-D参数是否支持"
if ! cppo --help 2>&1 | grep -q "\-D"; then
LOG_ERROR "cppo命令不支持-D参数"
exit 255
fi
LOG_INFO "步骤6创建测试输入文件"
cat > test_input.ml << "EOF"
let x = [%TEST]
EOF
CHECK_RESULT $? 0 0 "创建测试输入文件失败"
LOG_INFO "步骤7使用-D参数定义宏并处理文件"
cppo -D TEST=""hello"" test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "使用-D参数处理文件失败"
LOG_INFO "步骤8验证输出文件内容"
EXPECTED="let x = \"hello\""
ACTUAL=$(cat test_output.ml)
if [ "$ACTUAL" = "$EXPECTED" ]; then
LOG_INFO "输出文件内容符合预期"
else
LOG_ERROR "输出文件内容不符合预期,期望:$EXPECTED,实际:$ACTUAL"
exit 1
fi
LOG_INFO "步骤9清理临时文件"
rm -f test_input.ml test_output.ml
CHECK_RESULT $? 0 0 "清理临时文件失败"
if [ $INSTALLED_BEFORE -eq 0 ]; then
LOG_INFO "步骤10卸载软件包"
dnf remove -y ocaml-cppo-cppo
CHECK_RESULT $? 0 0 "卸载软件包失败"
else
LOG_INFO "步骤10软件包在测试前已安装保持安装状态"
fi
LOG_INFO "测试结束:测试使用-D参数定义宏并处理输入文件完成"
}
main "$@"

View File

@@ -1,79 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试组合使用-D、-I和-o参数定义宏、添加包含目录并指定输出文件处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试组合使用-D、-I和-o参数定义宏、添加包含目录并指定输出文件处理输入文件"
LOG_INFO "检查当前环境是否已安装ocaml-cppo软件包"
if dnf list installed ocaml-cppo &>/dev/null; then
LOG_INFO "软件包已安装,标记为已安装状态"
INSTALLED=1
else
LOG_INFO "软件包未安装,标记为未安装状态"
INSTALLED=0
fi
LOG_INFO "检查yum源中是否存在ocaml-cppo软件包"
if ! dnf list available ocaml-cppo &>/dev/null; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo软件包失败"
fi
LOG_INFO "测试cppo命令的-D、-I和-o参数功能"
LOG_INFO "创建测试输入文件"
cat > test_input.ml << "EOF"
let x = [%TEST_MACRO]
EOF
CHECK_RESULT $? 0 0 "创建测试输入文件失败"
LOG_INFO "创建包含目录和宏定义文件"
mkdir -p test_include
cat > test_include/macro.h << "EOF"
#define TEST_MACRO 42
EOF
CHECK_RESULT $? 0 0 "创建宏定义文件失败"
LOG_INFO "执行cppo命令使用-D定义宏、-I添加包含目录、-o指定输出文件"
cppo -D TEST_MACRO -I test_include -o test_output.ml test_input.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败参数可能不支持或命令执行错误"
LOG_INFO "检查输出文件内容是否符合预期"
if grep -q "let x = 42" test_output.ml; then
LOG_INFO "输出文件内容正确,宏替换成功"
else
LOG_ERROR "输出文件内容错误,宏替换失败"
exit 1
fi
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml
rm -rf test_include
CHECK_RESULT $? 0 0 "清理测试文件失败"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo软件包失败"
LOG_INFO "软件包已卸载,环境已恢复"
else
LOG_INFO "保持软件包安装状态,环境已恢复"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,108 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试组合使用-D和-U参数定义与取消宏定义并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 定义软件包名称
PACKAGE_NAME="ocaml-cppo"
# 检查软件包是否已在yum源中
LOG_INFO "检查yum源中是否存在软件包$PACKAGE_NAME"
if ! dnf list available $PACKAGE_NAME &>/dev/null; then
LOG_ERROR "yum源中不存在软件包$PACKAGE_NAME"
exit 255
fi
# 检查环境是否已安装软件包
LOG_INFO "检查环境是否已安装软件包:$PACKAGE_NAME"
if rpm -q $PACKAGE_NAME &>/dev/null; then
LOG_INFO "软件包已安装,脚本结束后将保持安装状态"
INSTALLED_BEFORE=true
else
LOG_INFO "软件包未安装,将在测试步骤中安装"
INSTALLED_BEFORE=false
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "安装软件包:$PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装软件包失败"
fi
# 验证cppo命令是否存在
LOG_INFO "验证cppo命令是否存在"
if ! command -v cppo &>/dev/null; then
LOG_ERROR "cppo命令不存在"
exit 255
fi
# 测试组合使用-D和-U参数定义与取消宏定义并处理输入文件
LOG_INFO "测试组合使用-D和-U参数定义与取消宏定义并处理输入文件"
# 创建测试输入文件
LOG_INFO "创建测试输入文件"
cat > test_input.ml << EOF
#ifdef TEST_MACRO
let x = 1
#else
let x = 2
#endif
#ifdef ANOTHER_MACRO
let y = 3
#else
let y = 4
#endif
EOF
# 使用-D定义宏TEST_MACRO使用-U取消宏ANOTHER_MACRO并处理输入文件
LOG_INFO "使用-D定义宏TEST_MACRO使用-U取消宏ANOTHER_MACRO并处理输入文件"
cppo -D TEST_MACRO -U ANOTHER_MACRO test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败"
# 检查输出文件内容是否符合预期
LOG_INFO "检查输出文件内容是否符合预期"
EXPECTED_OUTPUT="let x = 1
let y = 4"
ACTUAL_OUTPUT=$(cat test_output.ml)
if [ "$ACTUAL_OUTPUT" = "$EXPECTED_OUTPUT" ]; then
LOG_INFO "输出文件内容符合预期"
else
LOG_ERROR "输出文件内容不符合预期"
LOG_ERROR "期望输出:$EXPECTED_OUTPUT"
LOG_ERROR "实际输出:$ACTUAL_OUTPUT"
exit 1
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml
# 如果之前未安装,则在脚本结束前卸载软件包
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "卸载软件包:$PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载软件包失败"
fi
LOG_INFO "测试脚本执行完毕"
}
main "$@"

View File

@@ -1,89 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-I参数添加包含文件搜索目录并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 判断是否已经安装了cppo软件包
LOG_INFO "检查是否已安装cppo软件包"
rpm -q ocaml-cppo > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "cppo软件包已安装脚本结束后将保持安装状态"
already_installed=1
else
LOG_INFO "cppo软件包未安装"
already_installed=0
fi
# 检查yum源中是否有cppo软件包
LOG_INFO "检查yum源中是否有cppo软件包"
dnf list available ocaml-cppo > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中没有cppo软件包"
exit 255
fi
# 如果未安装则安装cppo软件包
if [ $already_installed -eq 0 ]; then
LOG_INFO "安装cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装cppo软件包失败"
fi
# 创建测试目录和文件
LOG_INFO "创建测试目录和文件"
test_dir="/tmp/test_cppo_$$"
mkdir -p $test_dir/include $test_dir/src
echo "#define MESSAGE \"Hello from include\"" > $test_dir/include/test.h
echo "#include \"test.h\"" > $test_dir/src/test.ml
echo "print_string MESSAGE" >> $test_dir/src/test.ml
# 测试使用-I参数添加包含文件搜索目录
LOG_INFO "测试使用-I参数添加包含文件搜索目录"
cppo -I $test_dir/include $test_dir/src/test.ml -o $test_dir/output.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败"
# 检查输出文件内容
LOG_INFO "检查输出文件内容"
grep "Hello from include" $test_dir/output.ml > /dev/null 2>&1
CHECK_RESULT $? 0 0 "输出文件内容不符合预期"
# 测试不支持的参数
LOG_INFO "测试不支持的参数"
cppo --invalid-param 2>&1 | grep -q "unrecognized option"
if [ $? -ne 0 ]; then
LOG_ERROR "cppo命令没有正确识别无效参数"
exit 255
fi
# 清理测试目录
LOG_INFO "清理测试目录"
rm -rf $test_dir
# 如果脚本开始前未安装,则卸载软件包
if [ $already_installed -eq 0 ]; then
LOG_INFO "卸载cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载cppo软件包失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,79 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试组合使用-I和-o参数添加包含目录并指定输出文件处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试组合使用-I和-o参数添加包含目录并指定输出文件处理输入文件"
LOG_INFO "步骤1检查yum源中是否有ocaml-cppo软件包"
dnf list ocaml-cppo 2>/dev/null | grep -q "ocaml-cppo"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
LOG_INFO "步骤2检查环境中是否已安装ocaml-cppo"
rpm -q ocaml-cppo > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "环境中已安装ocaml-cppo测试结束后将保持安装状态"
already_installed=1
else
LOG_INFO "环境中未安装ocaml-cppo将安装软件包"
already_installed=0
fi
if [ $already_installed -eq 0 ]; then
LOG_INFO "步骤3安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo软件包失败"
fi
LOG_INFO "步骤4检查cppo命令是否支持-I和-o参数"
cppo --help 2>&1 | grep -q "\-I"
CHECK_RESULT $? 0 0 "cppo命令不支持-I参数"
cppo --help 2>&1 | grep -q "\-o"
CHECK_RESULT $? 0 0 "cppo命令不支持-o参数"
LOG_INFO "步骤5创建测试输入文件和包含目录"
mkdir -p test_include_dir
echo "#define TEST_MACRO 123" > test_include_dir/test_header.h
echo "#include \"test_header.h\"\nint main() { return TEST_MACRO; }" > test_input.ml
LOG_INFO "步骤6使用-I参数添加包含目录-o参数指定输出文件"
cppo -I test_include_dir -o test_output.ml test_input.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败"
LOG_INFO "步骤7验证输出文件内容"
grep -q "123" test_output.ml
CHECK_RESULT $? 0 0 "输出文件内容不符合预期"
LOG_INFO "步骤8清理测试文件"
rm -rf test_include_dir test_input.ml test_output.ml
if [ $already_installed -eq 0 ]; then
LOG_INFO "步骤9卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo软件包失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,103 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-U参数取消宏定义并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试使用-U参数取消宏定义并处理输入文件"
# 检查软件包是否在yum源中
LOG_INFO "检查yum源中是否有ocaml-cppo软件包"
if ! dnf list available ocaml-cppo &> /dev/null; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
# 判断是否已安装软件包
if rpm -q ocaml-cppo &> /dev/null; then
LOG_INFO "检测到ocaml-cppo已安装测试完成后将保持安装状态"
INSTALLED_BEFORE_TEST=true
else
LOG_INFO "检测到ocaml-cppo未安装将在测试过程中安装"
INSTALLED_BEFORE_TEST=false
fi
# 若未安装则安装软件包
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
fi
# 测试-U参数支持性
LOG_INFO "检查cppo命令是否支持-U参数"
if ! cppo --help 2>&1 | grep -q -- "-U"; then
LOG_ERROR "cppo命令不支持-U参数"
# 清理环境
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "卸载测试安装的ocaml-cppo软件包"
dnf remove -y ocaml-cppo
fi
exit 255
fi
# 创建测试输入文件
LOG_INFO "创建测试输入文件"
INPUT_FILE="test_input.ml"
echo "#ifdef TEST_MACRO" > "$INPUT_FILE"
echo "let x = 1" >> "$INPUT_FILE"
echo "#else" >> "$INPUT_FILE"
echo "let x = 2" >> "$INPUT_FILE"
echo "#endif" >> "$INPUT_FILE"
# 使用-U参数取消宏定义并处理文件
LOG_INFO "使用-U TEST_MACRO参数处理输入文件"
cppo -U TEST_MACRO "$INPUT_FILE" > output.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败"
# 检查输出结果
LOG_INFO "检查输出文件内容"
EXPECTED="let x = 2"
ACTUAL=$(cat output.ml)
if [ "$ACTUAL" = "$EXPECTED" ]; then
LOG_INFO "输出符合预期:$ACTUAL"
else
LOG_ERROR "输出不符合预期,期望:$EXPECTED,实际:$ACTUAL"
exit 1
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f "$INPUT_FILE" output.ml
# 环境恢复
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
LOG_INFO "卸载测试安装的ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
else
LOG_INFO "保持ocaml-cppo软件包安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-V参数根据语义化版本字符串定义相关变量并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试cppo的-V参数功能根据语义化版本字符串定义相关变量并处理输入文件"
# 检查是否已安装cppo
if dnf list installed ocaml-cppo &>/dev/null; then
LOG_INFO "检测到cppo已安装测试结束后将保持安装状态"
INSTALLED="true"
else
LOG_INFO "cppo未安装将在测试过程中安装并在测试结束后卸载"
INSTALLED="false"
fi
# 检查yum源中是否有cppo软件包
LOG_INFO "检查yum源中是否存在ocaml-cppo软件包"
if ! dnf list available ocaml-cppo &>/dev/null; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
# 如果未安装则安装cppo
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
fi
# 验证cppo命令是否可用
LOG_INFO "验证cppo命令是否可用"
which cppo
CHECK_RESULT $? 0 0 "cppo命令未找到"
# 测试-V参数是否存在
LOG_INFO "测试cppo的-V参数是否支持"
cppo --help 2>&1 | grep -q "\-V"
if [ $? -ne 0 ]; then
LOG_ERROR "cppo不支持-V参数"
exit 255
fi
# 创建测试输入文件
LOG_INFO "创建测试输入文件test_input.ml"
cat > test_input.ml << "EOF"
let version = "%%VERSION%%"
let major = %%VERSION_MAJOR%%
let minor = %%VERSION_MINOR%%
let patch = %%VERSION_PATCH%%
EOF
# 使用-V参数处理文件
LOG_INFO "使用cppo -V参数处理测试文件"
cppo -V 1.2.3 test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "cppo -V参数执行失败"
# 验证输出文件内容
LOG_INFO "验证输出文件内容"
EXPECTED_CONTENT="let version = "1.2.3"
let major = 1
let minor = 2
let patch = 3"
ACTUAL_CONTENT=$(cat test_output.ml)
if [ "$ACTUAL_CONTENT" = "$EXPECTED_CONTENT" ]; then
LOG_INFO "输出文件内容符合预期"
else
LOG_ERROR "输出文件内容不符合预期"
LOG_ERROR "期望内容: $EXPECTED_CONTENT"
LOG_ERROR "实际内容: $ACTUAL_CONTENT"
exit 1
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml
CHECK_RESULT $? 0 0 "清理测试文件失败"
# 如果测试前未安装则卸载cppo
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
fi
LOG_INFO "cppo -V参数测试完成"
}
main "$@"

View File

@@ -1,92 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试组合使用-V和-s参数定义版本变量并输出精确行指令处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试组合使用-V和-s参数定义版本变量并输出精确行指令处理输入文件"
LOG_INFO "检查是否已安装ocaml-cppo软件包"
if dnf list installed ocaml-cppo &>/dev/null; then
LOG_INFO "ocaml-cppo软件包已安装测试完成后将保持安装状态"
already_installed=true
else
LOG_INFO "ocaml-cppo软件包未安装将在测试前安装并在测试后卸载"
already_installed=false
fi
LOG_INFO "检查yum源中是否存在ocaml-cppo软件包"
if ! dnf list available ocaml-cppo &>/dev/null; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
if [ "$already_installed" = false ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo软件包失败"
fi
LOG_INFO "验证cppo命令是否存在"
if ! command -v cppo &>/dev/null; then
LOG_ERROR "cppo命令未找到"
exit 255
fi
LOG_INFO "验证cppo命令是否支持-V参数"
cppo -V &>/dev/null
if [ $? -eq 255 ]; then
LOG_ERROR "cppo命令不支持-V参数"
exit 255
fi
LOG_INFO "验证cppo命令是否支持-s参数"
cppo -s VERSION=1.0.0 -V 2>&1 | grep -q "unknown option"
if [ $? -eq 0 ]; then
LOG_ERROR "cppo命令不支持-s参数"
exit 255
fi
LOG_INFO "创建测试输入文件"
cat > test_input.ml << "EOF"
let version = "VERSION"
let message = "Hello, World!"
EOF
LOG_INFO "使用-V和-s参数处理输入文件"
cppo -V -s VERSION=1.0.0 test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败"
LOG_INFO "检查输出文件内容"
grep -q "let version = "1.0.0"" test_output.ml
CHECK_RESULT $? 0 0 "版本变量替换失败"
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml
if [ "$already_installed" = false ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo软件包失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,76 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-help参数显示选项列表
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 判断是否已安装ocaml-cppo软件包
LOG_INFO "检查是否已安装ocaml-cppo软件包"
rpm -q ocaml-cppo > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "ocaml-cppo软件包已安装测试后将保持安装状态"
INSTALLED=true
else
LOG_INFO "ocaml-cppo软件包未安装将在测试后卸载"
INSTALLED=false
fi
# 检查yum源中是否有ocaml-cppo软件包
LOG_INFO "检查yum源中是否有ocaml-cppo软件包"
dnf list available ocaml-cppo > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中没有ocaml-cppo软件包"
# 如果未安装,则安装软件包
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装ocaml-cppo软件包失败"
fi
# 测试cppo命令的-help参数
LOG_INFO "测试cppo命令的-help参数"
cppo --help > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "cppo命令支持--help参数"
else
cppo -help > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "cppo命令支持-help参数"
else
LOG_ERROR "cppo命令不支持-help或--help参数"
exit 255
fi
fi
# 验证-help参数显示的选项列表
LOG_INFO "验证-help参数显示的选项列表"
cppo --help 2>&1 | grep -q "Usage:" || cppo -help 2>&1 | grep -q "Usage:"
CHECK_RESULT $? 0 0 "cppo命令的-help参数未显示选项列表"
# 环境清理:如果测试前未安装,则卸载软件包
if [ "$INSTALLED" = "false" ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载ocaml-cppo软件包失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,89 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-n参数不输出任何行指令覆盖-s参数并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 判断是否已安装cppo软件包
LOG_INFO "检查是否已安装cppo软件包"
rpm -q ocaml-cppo-cppo > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "cppo软件包已安装测试结束后将保持安装状态"
INSTALLED=1
else
LOG_INFO "cppo软件包未安装将在测试前安装并在测试后卸载"
INSTALLED=0
fi
# 检查yum源中是否存在cppo软件包
LOG_INFO "检查yum源中是否存在ocaml-cppo-cppo软件包"
dnf list available ocaml-cppo-cppo > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中未找到ocaml-cppo-cppo软件包"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到ocaml-cppo-cppo软件包"
exit 255
fi
# 如果未安装则安装cppo软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装ocaml-cppo-cppo软件包"
dnf install -y ocaml-cppo-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo-cppo软件包失败"
fi
# 创建测试输入文件
LOG_INFO "创建测试输入文件"
cat > test_input.txt << EOF
#define TEST 1
#ifdef TEST
This is a test line.
#endif
EOF
CHECK_RESULT $? 0 0 "创建测试输入文件失败"
# 测试使用-n参数不输出任何行指令覆盖-s参数并处理输入文件
LOG_INFO "测试使用-n参数不输出任何行指令覆盖-s参数并处理输入文件"
cppo -n test_input.txt > test_output.txt 2>&1
CHECK_RESULT $? 0 0 "执行cppo -n命令失败"
# 检查输出文件是否为空(-n参数应不输出任何行
LOG_INFO "检查输出文件是否为空"
if [ -s test_output.txt ]; then
LOG_ERROR "输出文件不为空,-n参数未生效"
exit 1
else
LOG_INFO "输出文件为空,-n参数生效"
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_input.txt test_output.txt
CHECK_RESULT $? 0 0 "清理测试文件失败"
# 如果测试前未安装则卸载cppo软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载ocaml-cppo-cppo软件包"
dnf remove -y ocaml-cppo-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo-cppo软件包失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,89 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-q参数识别并保留camlp4引用并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试:测试使用-q参数识别并保留camlp4引用并处理输入文件"
LOG_INFO "步骤1检查yum源中是否存在ocaml-cppo软件包"
if ! dnf list available ocaml-cppo &>/dev/null; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
LOG_INFO "步骤2检查当前是否已安装ocaml-cppo"
if rpm -q ocaml-cppo &>/dev/null; then
LOG_INFO "ocaml-cppo已安装测试结束后将保持安装状态"
already_installed=true
else
LOG_INFO "ocaml-cppo未安装将在测试过程中安装"
already_installed=false
fi
if [ "$already_installed" = "false" ]; then
LOG_INFO "步骤3安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
fi
LOG_INFO "步骤4检查cppo命令是否支持-q参数"
cppo --help | grep -q "\-q" || {
LOG_ERROR "cppo命令不支持-q参数"
exit 255
}
LOG_INFO "步骤5创建测试输入文件"
cat > test_input.ml << "EOF"
(* This is a test file *)
let x = 1
(*#if OCAML_VERSION < 402 *)
let y = 2
(*#else *)
let z = 3
(*#endif *)
EOF
LOG_INFO "步骤6使用-q参数处理输入文件"
cppo -q test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败"
LOG_INFO "步骤7验证输出文件是否包含camlp4引用"
if grep -q "(*#" test_output.ml; then
LOG_INFO "测试成功输出文件中保留了camlp4引用"
else
LOG_ERROR "测试失败输出文件中未找到camlp4引用"
exit 1
fi
LOG_INFO "步骤8清理测试文件"
rm -f test_input.ml test_output.ml
if [ "$already_installed" = "false" ]; then
LOG_INFO "步骤9卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,91 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试组合使用-q和-n参数识别保留引用且不输出行指令处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试组合使用-q和-n参数识别保留引用且不输出行指令处理输入文件"
LOG_INFO "检查是否已安装ocaml-cppo软件包"
if dnf list installed ocaml-cppo &>/dev/null; then
LOG_INFO "ocaml-cppo已安装测试结束后保持安装状态"
installed=true
else
LOG_INFO "ocaml-cppo未安装将在测试过程中安装并在结束后卸载"
installed=false
fi
LOG_INFO "检查yum源中是否有ocaml-cppo软件包"
if ! dnf list available ocaml-cppo &>/dev/null; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
if [ "$installed" = false ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
fi
LOG_INFO "创建测试输入文件"
cat > test_input.ml << "EOF"
let x = 1
let y = "hello"
(* # 42 *)
EOF
LOG_INFO "测试cppo命令组合使用-q和-n参数"
LOG_INFO "执行命令cppo -q -n test_input.ml -o test_output.ml"
cppo -q -n test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "cppo命令执行失败"
LOG_INFO "检查输出文件是否生成"
if [ -f test_output.ml ]; then
LOG_INFO "输出文件生成成功"
else
LOG_ERROR "输出文件未生成"
exit 1
fi
LOG_INFO "检查输出文件内容是否符合预期"
expected_content="let x = 1
let y = \"hello\""
actual_content=$(cat test_output.ml)
if [ "$expected_content" = "$actual_content" ]; then
LOG_INFO "输出文件内容符合预期"
else
LOG_ERROR "输出文件内容不符合预期"
LOG_INFO "期望内容:$expected_content"
LOG_INFO "实际内容:$actual_content"
exit 1
fi
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml
if [ "$installed" = false ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,91 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用-s参数输出指向每个标记精确源代码位置的行指令并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试使用-s参数输出指向每个标记精确源代码位置的行指令并处理输入文件"
# 检查软件包是否在yum源中
LOG_INFO "检查yum源中是否存在ocaml-cppo软件包"
if ! dnf list available ocaml-cppo 2>/dev/null | grep -q "ocaml-cppo"; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
# 检查环境是否已安装ocaml-cppo
LOG_INFO "检查环境是否已安装ocaml-cppo"
if dnf list installed ocaml-cppo 2>/dev/null | grep -q "ocaml-cppo"; then
LOG_INFO "环境已安装ocaml-cppo测试结束后保持安装状态"
already_installed=true
else
LOG_INFO "环境未安装ocaml-cppo将进行安装"
already_installed=false
fi
# 如果未安装,则安装软件包
if [ "$already_installed" = false ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
fi
# 检查cppo命令是否支持-s参数
LOG_INFO "检查cppo命令是否支持-s参数"
if ! cppo --help 2>&1 | grep -q "\-s"; then
LOG_ERROR "cppo命令不支持-s参数"
exit 255
fi
# 创建测试输入文件
LOG_INFO "创建测试输入文件test_input.ml"
cat > test_input.ml << EOF
let x = 1
let y = 2
EOF
# 使用-s参数处理输入文件
LOG_INFO "使用cppo -s参数处理输入文件"
cppo -s test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "cppo -s命令执行失败"
# 检查输出文件是否生成
LOG_INFO "检查输出文件是否生成"
if [ -f test_output.ml ]; then
LOG_INFO "输出文件test_output.ml生成成功"
else
LOG_ERROR "输出文件test_output.ml未生成"
exit 1
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml
# 如果测试前未安装,则卸载软件包
if [ "$already_installed" = false ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,109 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 : 测试使用-x参数定义自定义预处理器目标段并处理输入文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:使用-x参数定义自定义预处理器目标段并处理输入文件"
# 检查软件包是否已在yum源中
LOG_INFO "检查ocaml-cppo软件包是否在yum源中"
dnf list ocaml-cppo 2>&1 | grep -q "Available Packages"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
# 检查是否已安装ocaml-cppo
LOG_INFO "检查ocaml-cppo是否已安装"
rpm -q ocaml-cppo > /dev/null 2>&1
INSTALLED=$?
if [ $INSTALLED -ne 0 ]; then
LOG_INFO "ocaml-cppo未安装开始安装"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
NEED_CLEANUP=1
else
LOG_INFO "ocaml-cppo已安装跳过安装步骤"
NEED_CLEANUP=0
fi
# 创建测试输入文件
LOG_INFO "创建测试输入文件"
cat > test_input.ml << "EOF"
#ifdef CUSTOM
let message = "Custom defined"
#else
let message = "Default"
#endif
let () = print_endline message
EOF
# 测试-x参数是否存在
LOG_INFO "检查cppo命令是否支持-x参数"
cppo --help 2>&1 | grep -q -- "-x"
if [ $? -ne 0 ]; then
LOG_ERROR "cppo命令不支持-x参数"
exit 255
fi
# 使用-x参数定义自定义预处理器目标段
LOG_INFO "使用-x参数处理输入文件"
cat > test_definitions << "EOF"
#define CUSTOM
EOF
cppo -x "CUSTOM" -D CUSTOM test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "使用-x参数处理文件失败"
# 验证输出结果
LOG_INFO "验证处理结果"
EXPECTED="let message = "Custom defined"
let () = print_endline message"
ACTUAL=$(cat test_output.ml)
if [ "$ACTUAL" = "$EXPECTED" ]; then
LOG_INFO "测试成功:自定义预处理器目标段正确处理"
else
LOG_ERROR "测试失败:输出不符合预期"
echo "期望输出:$EXPECTED"
echo "实际输出:$ACTUAL"
exit 1
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml test_definitions
# 根据安装状态决定是否卸载
if [ $NEED_CLEANUP -eq 1 ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
else
LOG_INFO "保持ocaml-cppo安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,109 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 : 测试 cppo 基本文件处理功能,验证标准输入输出处理
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 cppo 基本文件处理功能,验证标准输入输出处理"
# 检查 yum 源中是否存在 ocaml-cppo 软件包
LOG_INFO "检查 yum 源中是否存在 ocaml-cppo 软件包"
if ! dnf list available ocaml-cppo &> /dev/null; then
LOG_ERROR "yum 源中未找到 ocaml-cppo 软件包"
exit 255
fi
# 判断环境是否已经安装 ocaml-cppo
LOG_INFO "判断环境是否已经安装 ocaml-cppo"
if rpm -q ocaml-cppo &> /dev/null; then
LOG_INFO "环境中已安装 ocaml-cppo测试结束后将保持安装状态"
already_installed=1
else
LOG_INFO "环境中未安装 ocaml-cppo将进行安装"
already_installed=0
fi
# 如果未安装,则安装 ocaml-cppo
if [ $already_installed -eq 0 ]; then
LOG_INFO "安装 ocaml-cppo 软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装 ocaml-cppo 失败"
fi
# 验证 cppo 命令是否存在
LOG_INFO "验证 cppo 命令是否存在"
if ! command -v cppo &> /dev/null; then
LOG_ERROR "cppo 命令不存在"
exit 255
fi
# 测试 cppo 基本文件处理功能:标准输入输出处理
LOG_INFO "测试 cppo 基本文件处理功能:标准输入输出处理"
# 创建一个简单的 OCaml 源文件用于测试
LOG_INFO "创建测试用的 OCaml 源文件"
cat > test_input.ml << "EOF"
(* 测试文件 *)
let x = 1
#if OCAML_VERSION >= 402
let y = 2
#else
let y = 3
#endif
let z = 4
EOF
# 使用 cppo 处理文件,并验证输出
LOG_INFO "使用 cppo 处理测试文件"
cppo -D OCAML_VERSION=402 test_input.ml -o test_output.ml
CHECK_RESULT $? 0 0 "cppo 处理文件失败"
# 检查输出文件内容是否符合预期
LOG_INFO "检查输出文件内容是否符合预期"
expected_content="(* 测试文件 *)
let x = 1
let y = 2
let z = 4"
actual_content=$(cat test_output.ml)
if [ "$actual_content" = "$expected_content" ]; then
LOG_INFO "输出文件内容符合预期"
else
LOG_ERROR "输出文件内容不符合预期"
LOG_ERROR "期望内容:$expected_content"
LOG_ERROR "实际内容:$actual_content"
exit 1
fi
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_input.ml test_output.ml
# 如果测试前未安装,则卸载 ocaml-cppo
if [ $already_installed -eq 0 ]; then
LOG_INFO "卸载 ocaml-cppo 软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载 ocaml-cppo 失败"
else
LOG_INFO "测试前已安装 ocaml-cppo保持安装状态"
fi
LOG_INFO "测试 cppo 基本文件处理功能完成"
}
main "$@"

View File

@@ -1,104 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用 -D 参数定义宏并处理文件
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
set -e
LOG_INFO "开始测试 -D 参数定义宏并处理文件"
# 步骤1: 检查yum源中是否存在ocaml-cppo软件包
LOG_INFO "步骤1: 检查yum源中是否存在ocaml-cppo软件包"
if ! dnf list available ocaml-cppo &> /dev/null; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
# 步骤2: 检查系统是否已安装ocaml-cppo
LOG_INFO "步骤2: 检查系统是否已安装ocaml-cppo"
if rpm -q ocaml-cppo &> /dev/null; then
LOG_INFO "ocaml-cppo已安装标记为保持安装状态"
keep_installed=true
else
LOG_INFO "ocaml-cppo未安装将在测试过程中安装"
keep_installed=false
fi
# 步骤3: 如果未安装则安装ocaml-cppo
if [ "$keep_installed" = false ]; then
LOG_INFO "步骤3: 安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
fi
# 步骤4: 验证cppo命令是否存在
LOG_INFO "步骤4: 验证cppo命令是否存在"
which cppo
CHECK_RESULT $? 0 0 "cppo命令未找到"
# 步骤5: 测试cppo命令的-D参数是否存在
LOG_INFO "步骤5: 测试cppo命令的-D参数是否存在"
if ! cppo --help 2>&1 | grep -q "\-D"; then
LOG_ERROR "cppo命令不支持-D参数"
exit 255
fi
# 步骤6: 创建一个测试输入文件
LOG_INFO "步骤6: 创建一个测试输入文件"
test_input_file=$(mktemp)
cat > "$test_input_file" << "EOF"
#ifndef TEST_MACRO
#error "TEST_MACRO is not defined"
#endif
EOF
# 步骤7: 使用-D参数定义宏并处理文件
LOG_INFO "步骤7: 使用-D参数定义宏并处理文件"
test_output_file=$(mktemp)
cppo -D TEST_MACRO "$test_input_file" > "$test_output_file"
CHECK_RESULT $? 0 0 "cppo命令执行失败"
# 步骤8: 验证输出文件内容
LOG_INFO "步骤8: 验证输出文件内容"
if grep -q "#error" "$test_output_file"; then
LOG_ERROR "宏定义未生效,输出文件中仍包含#error"
rm -f "$test_input_file" "$test_output_file"
exit 1
else
LOG_INFO "宏定义成功,输出文件正常"
fi
# 步骤9: 清理临时文件
LOG_INFO "步骤9: 清理临时文件"
rm -f "$test_input_file" "$test_output_file"
# 步骤10: 如果测试开始前未安装,则卸载软件包
if [ "$keep_installed" = false ]; then
LOG_INFO "步骤10: 卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
else
LOG_INFO "步骤10: 保持ocaml-cppo安装状态不卸载"
fi
LOG_INFO "测试 -D 参数定义宏并处理文件 完成"
}
main "$@"

View File

@@ -1,73 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试 ocaml-cppo 软件包的安装功能,验证安装过程是否成功。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 ocaml-cppo 软件包的安装功能"
LOG_INFO "步骤1检查软件包是否已在环境中安装"
if dnf list installed ocaml-cppo &> /dev/null; then
LOG_INFO "软件包 ocaml-cppo 已安装,保持安装状态"
INSTALLED=true
else
LOG_INFO "软件包 ocaml-cppo 未安装"
INSTALLED=false
fi
LOG_INFO "步骤2检查yum源中是否有 ocaml-cppo 软件包"
if ! dnf list available ocaml-cppo &> /dev/null; then
LOG_ERROR "yum源中未找到 ocaml-cppo 软件包"
exit 255
fi
if [ "$INSTALLED" = false ]; then
LOG_INFO "步骤3安装 ocaml-cppo 软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装 ocaml-cppo 软件包失败"
LOG_INFO "安装 ocaml-cppo 软件包成功"
fi
LOG_INFO "步骤4验证 ocaml-cppo 命令是否可用"
if ! command -v cppo &> /dev/null; then
LOG_ERROR "cppo 命令不存在"
exit 255
fi
LOG_INFO "步骤5测试 cppo 命令的基本功能"
echo "let x = 1" > test_input.ml
cppo -V test_input.ml > /dev/null 2>&1
CHECK_RESULT $? 0 0 "cppo 命令执行失败"
LOG_INFO "cppo 命令执行成功"
LOG_INFO "步骤6清理临时文件"
rm -f test_input.ml
if [ "$INSTALLED" = false ]; then
LOG_INFO "步骤7卸载 ocaml-cppo 软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载 ocaml-cppo 软件包失败"
LOG_INFO "卸载 ocaml-cppo 软件包成功"
else
LOG_INFO "步骤7保持 ocaml-cppo 软件包安装状态,无需卸载"
fi
LOG_INFO "测试 ocaml-cppo 软件包的安装功能完成"
}
main "$@"

View File

@@ -1,76 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-05
# @License : Mulan PSL v2
# @Desc : 测试使用 -version 参数打印程序版本
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:使用 -version 参数打印程序版本"
# 检查yum源中是否有ocaml-cppo软件包
LOG_INFO "检查yum源中是否有ocaml-cppo软件包"
dnf list ocaml-cppo 2>/dev/null | grep -q "ocaml-cppo"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到ocaml-cppo软件包"
exit 255
fi
# 检查系统是否已安装ocaml-cppo
LOG_INFO "检查系统是否已安装ocaml-cppo"
rpm -q ocaml-cppo >/dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "ocaml-cppo已安装测试结束后将保持安装状态"
INSTALLED=1
else
LOG_INFO "ocaml-cppo未安装将在测试前安装"
INSTALLED=0
fi
# 如果未安装,则安装软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装ocaml-cppo软件包"
dnf install -y ocaml-cppo
CHECK_RESULT $? 0 0 "安装ocaml-cppo失败"
fi
# 检查cppo命令是否支持-version参数
LOG_INFO "检查cppo命令是否支持-version参数"
cppo --help 2>&1 | grep -q "\-\-version"
if [ $? -ne 0 ]; then
LOG_ERROR "cppo命令不支持-version参数"
exit 255
fi
# 执行cppo --version命令
LOG_INFO "执行cppo --version命令"
cppo --version
CHECK_RESULT $? 0 0 "执行cppo --version命令失败"
# 清理环境:如果测试前未安装,则卸载软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载ocaml-cppo软件包"
dnf remove -y ocaml-cppo
CHECK_RESULT $? 0 0 "卸载ocaml-cppo失败"
else
LOG_INFO "测试前已安装ocaml-cppo保持安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -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-13
# @License : Mulan PSL v2
# @Desc : 测试openwebbeans-resource软件包的配置功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试openwebbeans-resource软件包的配置功能"
# 检查是否已安装openwebbeans-resource
LOG_INFO "检查是否已安装openwebbeans-resource"
if dnf list installed openwebbeans-resource &>/dev/null; then
LOG_INFO "openwebbeans-resource已安装保持安装状态"
installed=true
else
LOG_INFO "openwebbeans-resource未安装将在测试后卸载"
installed=false
fi
# 检查yum源中是否有openwebbeans-resource软件包
LOG_INFO "检查yum源中是否有openwebbeans-resource软件包"
if ! dnf list available openwebbeans-resource &>/dev/null; then
LOG_ERROR "yum源中未找到openwebbeans-resource软件包"
exit 255
fi
# 如果未安装则安装openwebbeans-resource
if [ "$installed" = false ]; then
LOG_INFO "开始安装openwebbeans-resource"
dnf install -y openwebbeans-resource
CHECK_RESULT $? 0 0 "安装openwebbeans-resource失败"
fi
# 测试配置功能
LOG_INFO "测试openwebbeans-resource的配置功能"
command_to_test="openwebbeans-resource --config" # 假设--config是测试参数
$command_to_test
CHECK_RESULT $? 0 0 "执行配置功能失败"
# 清理环境
if [ "$installed" = false ]; then
LOG_INFO "卸载openwebbeans-resource"
dnf remove -y openwebbeans-resource
CHECK_RESULT $? 0 0 "卸载openwebbeans-resource失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,63 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-13
# @License : Mulan PSL v2
# @Desc : 测试openwebbeans-resource软件包的依赖注入功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试openwebbeans-resource软件包的依赖注入功能"
# 检查yum源中是否存在openwebbeans-resource软件包
LOG_INFO "检查yum源中是否存在openwebbeans-resource软件包"
dnf list available openwebbeans-resource &>/dev/null
CHECK_RESULT $? 0 255 "yum源中不存在openwebbeans-resource软件包"
# 检查是否已安装openwebbeans-resource
LOG_INFO "检查是否已安装openwebbeans-resource"
if rpm -q openwebbeans-resource &>/dev/null; then
LOG_INFO "openwebbeans-resource已安装测试结束后保持安装状态"
INSTALLED=true
else
LOG_INFO "openwebbeans-resource未安装测试结束后将卸载"
INSTALLED=false
fi
# 安装openwebbeans-resource
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装openwebbeans-resource"
dnf install -y openwebbeans-resource
CHECK_RESULT $? 0 255 "安装openwebbeans-resource失败"
fi
# 测试依赖注入功能
LOG_INFO "测试依赖注入功能"
test_command="java -jar /path/to/testjar.jar" # 假设测试命令为java -jar实际需替换为具体命令
$test_command
CHECK_RESULT $? 0 0 "依赖注入功能测试失败"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载openwebbeans-resource"
dnf remove -y openwebbeans-resource
CHECK_RESULT $? 0 0 "卸载openwebbeans-resource失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,69 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-13
# @License : Mulan PSL v2
# @Desc : 测试openwebbeans-resource软件包的资源加载功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试openwebbeans-resource软件包的资源加载功能
LOG_INFO "开始测试openwebbeans-resource软件包的资源加载功能"
# 检查yum源中是否存在openwebbeans-resource软件包
LOG_INFO "检查yum源中是否存在openwebbeans-resource软件包"
dnf list available openwebbeans-resource &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在openwebbeans-resource软件包"
exit 255
fi
# 检查是否已安装openwebbeans-resource软件包
LOG_INFO "检查是否已安装openwebbeans-resource软件包"
rpm -q openwebbeans-resource &>/dev/null
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "openwebbeans-resource软件包已安装"
else
installed=false
LOG_INFO "openwebbeans-resource软件包未安装将进行安装"
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装openwebbeans-resource软件包"
dnf install -y openwebbeans-resource
CHECK_RESULT $? 0 0 "安装openwebbeans-resource软件包失败"
fi
# 测试资源加载功能
LOG_INFO "测试openwebbeans-resource软件包的资源加载功能"
command_to_test="openwebbeans-resource --load" # 假设这是测试命令,根据实际命令调整
$command_to_test
CHECK_RESULT $? 0 0 "资源加载功能测试失败"
# 清理环境
if [ "$installed" = false ]; then
LOG_INFO "卸载openwebbeans-resource软件包"
dnf remove -y openwebbeans-resource
CHECK_RESULT $? 0 0 "卸载openwebbeans-resource软件包失败"
fi
LOG_INFO "测试openwebbeans-resource软件包的资源加载功能完成"
}
main "$@"

View File

@@ -1,70 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-13
# @License : Mulan PSL v2
# @Desc : 测试openwebbeans-resource软件包的作用域功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试openwebbeans-resource软件包的作用域功能
# 步骤1检查yum源中是否存在openwebbeans-resource软件包
LOG_INFO "检查yum源中是否存在openwebbeans-resource软件包"
dnf list available openwebbeans-resource > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到openwebbeans-resource软件包"
exit 255
fi
# 步骤2检查是否已安装openwebbeans-resource软件包
LOG_INFO "检查是否已安装openwebbeans-resource软件包"
rpm -q openwebbeans-resource > /dev/null 2>&1
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "openwebbeans-resource已安装脚本结束时将保持安装状态"
else
installed=false
LOG_INFO "openwebbeans-resource未安装将在测试后卸载"
fi
# 步骤3如果未安装则安装openwebbeans-resource软件包
if [ "$installed" = false ]; then
LOG_INFO "开始安装openwebbeans-resource软件包"
dnf install -y openwebbeans-resource > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装openwebbeans-resource软件包失败"
fi
# 步骤4测试openwebbeans-resource的作用域功能
LOG_INFO "测试openwebbeans-resource的作用域功能"
# 假设测试命令为test_command这里仅为示例
test_command="some_command_related_to_openwebbeans_resource"
$test_command > /dev/null 2>&1
CHECK_RESULT $? 0 0 "测试openwebbeans-resource作用域功能失败"
# 步骤5如果之前未安装则卸载openwebbeans-resource软件包以恢复环境
if [ "$installed" = false ]; then
LOG_INFO "卸载openwebbeans-resource软件包以恢复环境"
dnf remove -y openwebbeans-resource > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载openwebbeans-resource软件包失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -1,115 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-06
# @License : Mulan PSL v2
# @Desc : 测试 perl-Alien-Build-help 软件包能否被干净地卸载
# ############################################
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_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"
}
# 定义软件包名称
PACKAGE_NAME="perl-Alien-Build-help"
# 检查yum源中是否存在该软件包
LOG_INFO "检查yum源中是否存在软件包$PACKAGE_NAME"
dnf list available "$PACKAGE_NAME" &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在"
exit 255
fi
# 检查是否已经安装该软件包
LOG_INFO "检查是否已经安装软件包:$PACKAGE_NAME"
if dnf list installed "$PACKAGE_NAME" &>/dev/null; then
LOG_INFO "软件包 $PACKAGE_NAME 已经安装,脚本结束时将保持安装状态"
INSTALLED_BEFORE=true
else
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将进行安装测试"
INSTALLED_BEFORE=false
fi
# 如果未安装,则安装软件包作为测试步骤
if [ "$INSTALLED_BEFORE" = false ]; then
LOG_INFO "安装软件包:$PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
fi
# 检查软件包是否安装成功
LOG_INFO "验证软件包安装状态"
dnf list installed "$PACKAGE_NAME" &>/dev/null
CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 安装后未在已安装列表中"
# 测试卸载软件包
LOG_INFO "测试卸载软件包:$PACKAGE_NAME"
dnf remove -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
# 验证软件包是否被成功卸载
LOG_INFO "验证软件包卸载状态"
dnf list installed "$PACKAGE_NAME" &>/dev/null
if [ $? -eq 0 ]; then
LOG_ERROR "软件包 $PACKAGE_NAME 卸载后仍存在于已安装列表中"
exit 1
else
LOG_INFO "软件包 $PACKAGE_NAME 已成功卸载"
fi
# 如果脚本开始前软件包已安装,则重新安装以恢复环境
if [ "$INSTALLED_BEFORE" = true ]; then
LOG_INFO "恢复环境:重新安装软件包 $PACKAGE_NAME"
dnf install -y "$PACKAGE_NAME"
CHECK_RESULT $? 0 0 "恢复环境时重新安装软件包 $PACKAGE_NAME 失败"
LOG_INFO "环境已恢复,软件包 $PACKAGE_NAME 保持安装状态"
else
LOG_INFO "环境已清理,软件包 $PACKAGE_NAME 已卸载"
fi
# 脚本结束
LOG_INFO "测试脚本执行完毕"
}
main "$@"

View File

@@ -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-06
# @License : Mulan PSL v2
# @Desc : 测试 perl-Alien-Build-help 软件包是否能显示基本用法或帮助信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试 perl-Alien-Build-help 软件包是否能显示基本用法或帮助信息
LOG_INFO "开始测试 perl-Alien-Build-help 软件包是否能显示基本用法或帮助信息"
# 定义软件包名称
PACKAGE_NAME="perl-Alien-Build-help"
# 步骤1检查软件包是否已在yum源中
LOG_INFO "步骤1检查软件包是否已在yum源中"
dnf list available $PACKAGE_NAME &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在"
exit 255
fi
LOG_INFO "软件包 $PACKAGE_NAME 在yum源中存在"
# 步骤2检查软件包是否已经安装
LOG_INFO "步骤2检查软件包是否已经安装"
rpm -q $PACKAGE_NAME &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "软件包 $PACKAGE_NAME 已经安装"
ALREADY_INSTALLED=true
else
LOG_INFO "软件包 $PACKAGE_NAME 未安装"
ALREADY_INSTALLED=false
fi
# 步骤3如果未安装则安装软件包
if [ "$ALREADY_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检查软件包是否提供了帮助命令"
rpm -ql $PACKAGE_NAME | grep -E "\.pod$|\.pm$|/bin/" | head -5 > /tmp/package_files.txt
if [ ! -s /tmp/package_files.txt ]; then
LOG_ERROR "软件包 $PACKAGE_NAME 未找到帮助文件或可执行文件"
exit 255
fi
LOG_INFO "软件包 $PACKAGE_NAME 包含以下主要文件:"
cat /tmp/package_files.txt
# 步骤5尝试获取帮助信息
LOG_INFO "步骤5尝试获取帮助信息"
HELP_FOUND=false
# 检查是否有可执行文件
for file in $(rpm -ql $PACKAGE_NAME | grep -E "/bin/"); do
if [ -x "$file" ]; then
LOG_INFO "尝试执行 $file --help"
$file --help 2>&1 | head -20
if [ ${PIPESTATUS[0]} -eq 0 ]; then
HELP_FOUND=true
break
fi
LOG_INFO "尝试执行 $file -h"
$file -h 2>&1 | head -20
if [ ${PIPESTATUS[0]} -eq 0 ]; then
HELP_FOUND=true
break
fi
fi
done
# 检查是否有POD文档
if [ "$HELP_FOUND" = "false" ]; then
LOG_INFO "检查POD文档"
for pod_file in $(rpm -ql $PACKAGE_NAME | grep "\.pod$"); do
LOG_INFO "查看POD文档: $pod_file"
pod2text "$pod_file" 2>/dev/null | head -30
if [ ${PIPESTATUS[0]} -eq 0 ]; then
HELP_FOUND=true
break
fi
done
fi
# 步骤6验证帮助信息显示
LOG_INFO "步骤6验证帮助信息显示"
if [ "$HELP_FOUND" = "true" ]; then
LOG_INFO "软件包 $PACKAGE_NAME 能够显示基本用法或帮助信息"
CHECK_RESULT 0 0 0 "帮助信息显示验证失败"
else
LOG_ERROR "软件包 $PACKAGE_NAME 未能显示基本用法或帮助信息"
CHECK_RESULT 1 0 0 "帮助信息显示验证失败"
fi
# 步骤7清理环境
LOG_INFO "步骤7清理环境"
rm -f /tmp/package_files.txt
# 步骤8如果测试前未安装则卸载软件包
if [ "$ALREADY_INSTALLED" = "false" ]; then
LOG_INFO "步骤8卸载软件包 $PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
LOG_INFO "软件包 $PACKAGE_NAME 卸载成功"
else
LOG_INFO "步骤8保持软件包 $PACKAGE_NAME 的安装状态"
fi
LOG_INFO "测试 perl-Alien-Build-help 软件包是否能显示基本用法或帮助信息完成"
}
main "$@"

View File

@@ -1,76 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-06
# @License : Mulan PSL v2
# @Desc : 测试 perl-Alien-Build-help 软件包是否能正确查询版本信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 perl-Alien-Build-help 软件包是否能正确查询版本信息"
# 检查软件包是否已在yum源中
LOG_INFO "检查yum源中是否存在 perl-Alien-Build-help 软件包"
dnf list available perl-Alien-Build-help > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到 perl-Alien-Build-help 软件包"
exit 255
fi
# 判断软件包是否已安装
LOG_INFO "检查 perl-Alien-Build-help 软件包是否已安装"
rpm -q perl-Alien-Build-help > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "perl-Alien-Build-help 软件包已安装,测试结束后将保持安装状态"
ALREADY_INSTALLED=1
else
LOG_INFO "perl-Alien-Build-help 软件包未安装,将在测试过程中安装"
ALREADY_INSTALLED=0
fi
# 如果未安装,则安装软件包
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "安装 perl-Alien-Build-help 软件包"
dnf install -y perl-Alien-Build-help
CHECK_RESULT $? 0 0 "安装 perl-Alien-Build-help 软件包失败"
fi
# 测试查询版本信息
LOG_INFO "测试 perl-Alien-Build-help 软件包查询版本信息功能"
perl-Alien-Build-help --version > /dev/null 2>&1
CHECK_RESULT $? 0 0 "perl-Alien-Build-help 软件包查询版本信息失败"
# 测试不支持的参数
LOG_INFO "测试 perl-Alien-Build-help 软件包不支持参数的情况"
perl-Alien-Build-help --invalid-param > /dev/null 2>&1
if [ $? -ne 255 ]; then
LOG_ERROR "perl-Alien-Build-help 软件包对不支持参数的处理不符合预期"
exit 255
fi
# 清理环境:如果之前未安装,则卸载软件包
if [ ${ALREADY_INSTALLED} -eq 0 ]; then
LOG_INFO "卸载在测试过程中安装的 perl-Alien-Build-help 软件包"
dnf remove -y perl-Alien-Build-help
CHECK_RESULT $? 0 0 "卸载 perl-Alien-Build-help 软件包失败"
else
LOG_INFO "perl-Alien-Build-help 软件包在测试前已安装,保持安装状态"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,85 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-27
# @License : Mulan PSL v2
# @Desc : Check existence of key header and lib files
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:检查关键头文件和库文件的存在性"
LOG_INFO "步骤1检查rrdtool-devel软件包是否在yum源中"
dnf list available rrdtool-devel 2>&1 | grep -q "rrdtool-devel"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到rrdtool-devel软件包"
exit 255
fi
LOG_INFO "步骤2检查当前是否已安装rrdtool-devel"
rpm -q rrdtool-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "rrdtool-devel已安装测试后保持安装状态"
INSTALLED=1
else
LOG_INFO "rrdtool-devel未安装开始安装"
dnf install -y rrdtool-devel
CHECK_RESULT $? 0 0 "安装rrdtool-devel失败"
INSTALLED=0
fi
LOG_INFO "步骤3检查关键头文件是否存在"
HEADER_FILES="/usr/include/rrd.h /usr/include/rrd_client.h"
for file in $HEADER_FILES; do
if [ ! -f "$file" ]; then
LOG_ERROR "头文件 $file 不存在"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "清理环境卸载rrdtool-devel"
dnf remove -y rrdtool-devel
fi
exit 255
else
LOG_INFO "头文件 $file 存在"
fi
done
LOG_INFO "步骤4检查关键库文件是否存在"
LIB_FILES="/usr/lib64/librrd.so /usr/lib64/librrd_th.so"
for file in $LIB_FILES; do
if [ ! -f "$file" ]; then
LOG_ERROR "库文件 $file 不存在"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "清理环境卸载rrdtool-devel"
dnf remove -y rrdtool-devel
fi
exit 255
else
LOG_INFO "库文件 $file 存在"
fi
done
LOG_INFO "步骤5清理环境"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载rrdtool-devel"
dnf remove -y rrdtool-devel
CHECK_RESULT $? 0 0 "卸载rrdtool-devel失败"
else
LOG_INFO "保持rrdtool-devel安装状态"
fi
LOG_INFO "测试完成:所有关键头文件和库文件均存在"
}
main "$@"

View File

@@ -1,89 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-27
# @License : Mulan PSL v2
# @Desc : Test compile a simple program with rrdtool libs
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试使用rrdtool库编译简单程序"
# 检查rrdtool-devel包是否在yum源中
LOG_INFO "检查rrdtool-devel包是否在yum源中"
dnf list available rrdtool-devel &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到rrdtool-devel包"
exit 255
fi
# 检查系统是否已安装rrdtool-devel
LOG_INFO "检查系统是否已安装rrdtool-devel"
rpm -q rrdtool-devel &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "rrdtool-devel已安装测试结束后将保持安装状态"
already_installed=1
else
LOG_INFO "rrdtool-devel未安装将在测试过程中安装"
already_installed=0
fi
# 如果未安装则安装rrdtool-devel
if [ $already_installed -eq 0 ]; then
LOG_INFO "安装rrdtool-devel包"
dnf install -y rrdtool-devel
CHECK_RESULT $? 0 0 "安装rrdtool-devel失败"
fi
# 创建测试C程序
LOG_INFO "创建测试C程序"
cat > test_rrdtool.c << "EOF"
#include <rrd.h>
#include <stdio.h>
int main() {
printf("RRDtool version: %s\n", rrd_strversion());
return 0;
}
EOF
# 编译测试程序
LOG_INFO "编译测试程序"
gcc -o test_rrdtool test_rrdtool.c $(pkg-config --cflags --libs rrd) 2>&1
CHECK_RESULT $? 0 0 "编译测试程序失败"
# 运行测试程序
LOG_INFO "运行测试程序"
./test_rrdtool
CHECK_RESULT $? 0 0 "运行测试程序失败"
# 清理测试文件
LOG_INFO "清理测试文件"
rm -f test_rrdtool test_rrdtool.c
# 如果测试前未安装则卸载rrdtool-devel
if [ $already_installed -eq 0 ]; then
LOG_INFO "卸载rrdtool-devel包"
dnf remove -y rrdtool-devel
CHECK_RESULT $? 0 0 "卸载rrdtool-devel失败"
else
LOG_INFO "保持rrdtool-devel安装状态"
fi
LOG_INFO "测试完成使用rrdtool库编译简单程序"
}
main "$@"

View File

@@ -1,92 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-03-27
# @License : Mulan PSL v2
# @Desc : Verify rrdtool-devel package is installed
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装rrdtool-devel包
LOG_INFO "检查rrdtool-devel包是否已安装"
rpm -q rrdtool-devel > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "rrdtool-devel包已安装将保持安装状态"
ALREADY_INSTALLED=1
else
LOG_INFO "rrdtool-devel包未安装"
ALREADY_INSTALLED=0
fi
# 检查yum源中是否有rrdtool-devel包
LOG_INFO "检查yum源中是否有rrdtool-devel包"
dnf list available rrdtool-devel > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中没有rrdtool-devel包"
# 如果未安装则安装rrdtool-devel包
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "安装rrdtool-devel包"
dnf install -y rrdtool-devel
CHECK_RESULT $? 0 0 "安装rrdtool-devel包失败"
LOG_INFO "rrdtool-devel包安装成功"
fi
# 验证rrdtool-devel包的功能
LOG_INFO "验证rrdtool-devel包的功能"
# 检查rrdtool命令是否存在
LOG_INFO "检查rrdtool命令是否存在"
which rrdtool > /dev/null 2>&1
CHECK_RESULT $? 0 0 "rrdtool命令不存在"
# 检查rrdtool命令是否支持--version参数
LOG_INFO "检查rrdtool命令是否支持--version参数"
rrdtool --version > /dev/null 2>&1
CHECK_RESULT $? 0 255 "rrdtool命令不支持--version参数"
# 获取rrdtool版本信息
LOG_INFO "获取rrdtool版本信息"
rrdtool --version | grep -q "RRDtool"
CHECK_RESULT $? 0 0 "获取rrdtool版本信息失败"
# 检查rrdtool-devel头文件是否存在
LOG_INFO "检查rrdtool-devel头文件是否存在"
ls /usr/include/rrd.h > /dev/null 2>&1
CHECK_RESULT $? 0 0 "rrd.h头文件不存在"
# 检查rrdtool库文件是否存在
LOG_INFO "检查rrdtool库文件是否存在"
ls /usr/lib*/librrd.so > /dev/null 2>&1
if [ $? -ne 0 ]; then
ls /usr/lib64/librrd.so > /dev/null 2>&1
CHECK_RESULT $? 0 0 "librrd.so库文件不存在"
fi
# 清理环境
LOG_INFO "清理环境"
if [ $ALREADY_INSTALLED -eq 0 ]; then
LOG_INFO "卸载rrdtool-devel包"
dnf remove -y rrdtool-devel
CHECK_RESULT $? 0 0 "卸载rrdtool-devel包失败"
LOG_INFO "rrdtool-devel包卸载成功"
else
LOG_INFO "保持rrdtool-devel包安装状态"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,66 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-02
# @License : Mulan PSL v2
# @Desc : 测试软件包 rubygem-rr-doc 的加载功能,验证是否能够成功加载到系统中。
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查yum源中是否存在rubygem-rr-doc软件包
LOG_INFO "检查yum源中是否存在rubygem-rr-doc软件包"
dnf list available rubygem-rr-doc &> /dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在rubygem-rr-doc软件包"
exit 255
fi
# 检查系统是否已安装rubygem-rr-doc软件包
LOG_INFO "检查系统是否已安装rubygem-rr-doc软件包"
rpm -q rubygem-rr-doc &> /dev/null
if [ $? -eq 0 ]; then
LOG_INFO "系统已安装rubygem-rr-doc软件包测试结束后保持安装状态"
installed=true
else
LOG_INFO "系统未安装rubygem-rr-doc软件包测试结束后将卸载"
installed=false
fi
# 安装rubygem-rr-doc软件包
if [ "$installed" = false ]; then
LOG_INFO "安装rubygem-rr-doc软件包"
dnf install -y rubygem-rr-doc
CHECK_RESULT $? 0 0 "安装rubygem-rr-doc软件包失败"
fi
# 验证rubygem-rr-doc的加载功能
LOG_INFO "验证rubygem-rr-doc的加载功能"
echo "require "rr"" | ruby &> /dev/null
CHECK_RESULT $? 0 0 "加载rubygem-rr-doc失败"
# 清理环境,恢复到之前的状态
if [ "$installed" = false ]; then
LOG_INFO "卸载rubygem-rr-doc软件包"
dnf remove -y rubygem-rr-doc
CHECK_RESULT $? 0 0 "卸载rubygem-rr-doc软件包失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,64 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试 estimator_ckpt_converter 命令的 -h 参数,显示帮助信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-estimator-ckpt-converter
LOG_INFO "检查是否已安装python3-tensorflow-estimator-ckpt-converter"
if dnf list installed python3-tensorflow-estimator-ckpt-converter &>/dev/null; then
LOG_INFO "python3-tensorflow-estimator-ckpt-converter已安装"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-estimator-ckpt-converter未安装"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-estimator-ckpt-converter软件包
LOG_INFO "检查yum源中是否有python3-tensorflow-estimator-ckpt-converter软件包"
if ! dnf list available python3-tensorflow-estimator-ckpt-converter &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-estimator-ckpt-converter软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装python3-tensorflow-estimator-ckpt-converter"
dnf install -y python3-tensorflow-estimator-ckpt-converter
CHECK_RESULT $? 0 0 "安装python3-tensorflow-estimator-ckpt-converter失败"
fi
# 测试estimator_ckpt_converter命令的-h参数
LOG_INFO "测试estimator_ckpt_converter命令的-h参数"
estimator_ckpt_converter -h
CHECK_RESULT $? 0 0 "执行estimator_ckpt_converter -h失败"
# 如果之前未安装,则卸载软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tensorflow-estimator-ckpt-converter"
dnf remove -y python3-tensorflow-estimator-ckpt-converter
CHECK_RESULT $? 0 0 "卸载python3-tensorflow-estimator-ckpt-converter失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,66 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试 estimator_ckpt_converter 命令的 -v 参数,显示版本信息
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-estimator-ckpt-converter
LOG_INFO "检查是否已安装python3-tensorflow-estimator-ckpt-converter"
rpm -q python3-tensorflow-estimator-ckpt-converter > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "python3-tensorflow-estimator-ckpt-converter已安装"
installed=true
else
LOG_INFO "python3-tensorflow-estimator-ckpt-converter未安装"
installed=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有python3-tensorflow-estimator-ckpt-converter"
dnf list available python3-tensorflow-estimator-ckpt-converter > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-tensorflow-estimator-ckpt-converter"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装python3-tensorflow-estimator-ckpt-converter"
dnf install -y python3-tensorflow-estimator-ckpt-converter > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装python3-tensorflow-estimator-ckpt-converter失败"
fi
# 测试estimator_ckpt_converter命令的-v参数
LOG_INFO "测试estimator_ckpt_converter命令的-v参数"
estimator_ckpt_converter -v > /dev/null 2>&1
CHECK_RESULT $? 0 0 "estimator_ckpt_converter命令的-v参数测试失败"
# 如果脚本开始时未安装,则卸载软件包以恢复环境
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-tensorflow-estimator-ckpt-converter以恢复环境"
dnf remove -y python3-tensorflow-estimator-ckpt-converter > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载python3-tensorflow-estimator-ckpt-converter失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,93 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : Test Keras model loading and saving functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-function-keras
LOG_INFO "检查是否已安装python3-tensorflow-function-keras"
dnf list installed python3-tensorflow-function-keras > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "python3-tensorflow-function-keras已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-function-keras未安装将在测试后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-function-keras
LOG_INFO "检查yum源中是否有python3-tensorflow-function-keras"
dnf list available python3-tensorflow-function-keras > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中未找到python3-tensorflow-function-keras"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-tensorflow-function-keras退出码255"
exit 255
fi
# 若未安装则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装python3-tensorflow-function-keras"
dnf install -y python3-tensorflow-function-keras
CHECK_RESULT $? 0 0 "安装python3-tensorflow-function-keras失败"
fi
# 测试Keras模型加载和保存功能
LOG_INFO "测试Keras模型加载和保存功能"
# 创建临时目录用于测试
TEMP_DIR=$(mktemp -d)
LOG_INFO "创建临时目录: $TEMP_DIR"
# 生成测试模型
LOG_INFO "生成测试模型"
python3 -c "
import tensorflow as tf
from tensorflow import keras
model = keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
model.compile(optimizer="sgd", loss="mean_squared_error")
model.save("$TEMP_DIR/test_model.h5")
"
CHECK_RESULT $? 0 0 "生成测试模型失败"
# 加载测试模型
LOG_INFO "加载测试模型"
python3 -c "
import tensorflow as tf
from tensorflow import keras
model = keras.models.load_model("$TEMP_DIR/test_model.h5")
print(model.summary())
"
CHECK_RESULT $? 0 0 "加载测试模型失败"
# 清理临时目录
LOG_INFO "清理临时目录"
rm -rf "$TEMP_DIR"
CHECK_RESULT $? 0 0 "清理临时目录失败"
# 若脚本开始时未安装则卸载软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tensorflow-function-keras"
dnf remove -y python3-tensorflow-function-keras
CHECK_RESULT $? 00"卸载python32tensorlowfunctionkeras失败"
fi
LOG_INFO"测试完成"
}
main "$@"

View File

@@ -1,75 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-13
# @License : Mulan PSL v2
# @Desc : Test saving a Keras model to a file
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-function-keras
LOG_INFO "检查是否已安装python3-tensorflow-function-keras"
if dnf list installed python3-tensorflow-function-keras &>/dev/null; then
LOG_INFO "python3-tensorflow-function-keras已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-function-keras未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-function-keras
LOG_INFO "检查yum源中是否有python3-tensorflow-function-keras"
if ! dnf list available python3-tensorflow-function-keras &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-function-keras"
exit 255
fi
# 安装python3-tensorflow-function-keras如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装python3-tensorflow-function-keras"
dnf install -y python3-tensorflow-function-keras
CHECK_RESULT $? 0 0 "安装python3-tensorflow-function-keras失败"
fi
# 测试保存Keras模型到文件的功能
LOG_INFO "测试保存Keras模型到文件的功能"
python3 -c "
import tensorflow as tf
from tensorflow import keras
model = keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
model.compile(optimizer="sgd", loss="mean_squared_error")
model.save("keras_model.h5")
"
CHECK_RESULT $? 0 0 "保存Keras模型到文件失败"
# 清理测试生成的文件
LOG_INFO "清理测试生成的文件"
rm -f keras_model.h5
CHECK_RESULT $? 0 0 "清理测试文件失败"
# 卸载python3-tensorflow-function-keras如果之前未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在卸载python3-tensorflow-function-keras"
dnf remove -y python3-tensorflow-function-keras
CHECK_RESULT $? 0 0 "卸载python3-tensorflow-function-keras失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -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 : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试 saved_model_cli 的 --helpfull 参数,获取所有支持的标志列表
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow
LOG_INFO "检查是否已安装python3-tensorflow..."
if ! dnf list installed python3-tensorflow &>/dev/null; then
LOG_INFO "python3-tensorflow未安装将进行安装..."
# 检查yum源中是否有python3-tensorflow
if ! dnf list available python3-tensorflow &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow软件包"
exit 255
fi
# 安装python3-tensorflow
dnf install -y python3-tensorflow
CHECK_RESULT $? 0 0 "安装python3-tensorflow失败"
INSTALLED=true
else
LOG_INFO "python3-tensorflow已安装跳过安装步骤..."
INSTALLED=false
fi
# 测试saved_model_cli的--helpfull参数
LOG_INFO "测试saved_model_cli的--helpfull参数..."
saved_model_cli --helpfull &>/dev/null
CHECK_RESULT $? 0 0 "saved_model_cli --helpfull执行失败"
# 清理环境如果脚本开始时未安装则卸载python3-tensorflow
if [ "$INSTALLED" = true ]; then
LOG_INFO "清理环境卸载python3-tensorflow..."
dnf remove -y python3-tensorflow
CHECK_RESULT $? 0 0 "卸载python3-tensorflow失败"
fi
LOG_INFO "测试脚本执行完毕"
}
main "$@"

View File

@@ -1,76 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --bind_all 参数在所有公共接口上提供服务
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装python3-tensorflow-tensorboard"
if dnf list installed python3-tensorflow-tensorboard &>/dev/null; then
LOG_INFO "python3-tensorflow-tensorboard已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-tensorboard未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-tensorboard
LOG_INFO "检查yum源中是否有python3-tensorflow-tensorboard"
if ! dnf list available python3-tensorflow-tensorboard &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-tensorboard软件包"
exit 255
fi
# 安装python3-tensorflow-tensorboard如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "安装python3-tensorflow-tensorboard失败"
fi
# 测试--bind_all参数在所有公共接口上提供服务
LOG_INFO "测试--bind_all参数在所有公共接口上提供服务"
tensorbard_cmd="tensorboard --bind_all --logdir=/tmp/logs"
$tensorbard_cmd &
PID=$!
sleep 5
# 检查tensorbard是否成功启动并监听端口
LOG_INFO "检查tensorbard是否成功启动并监听端口"
netstat -tulnp | grep tensorboard
CHECK_RESULT $? 0 0 "tensorboard未成功启动或未监听端口"
# 清理临时进程和日志目录(如果存在)
LOG_INFO "清理临时进程和日志目录"
kill $PID
rm -rf /tmp/logs
# 卸载python3-tenso rflow-ten so rboard如果之前未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tenso rflow-ten so rboard"
dnf remove -y python3-tenso r flow-ten so r board
CHECK_RESULT $? 0 0 "卸载python3-tenso r flow-ten so r board失败"
fi
LOG_INFO "测试脚本执行完毕"
}
main "$@"

View File

@@ -1,81 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --host 参数指定监听地址
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试使用 --host 参数指定监听地址"
# 检查是否已安装 python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装 python3-tensorflow-tensorboard"
if dnf list installed python3-tensorflow-tensorboard &>/dev/null; then
LOG_INFO "python3-tensorflow-tensorboard 已安装"
installed=true
else
LOG_INFO "python3-tensorflow-tensorboard 未安装"
installed=false
fi
# 检查 yum 源中是否有该软件包
LOG_INFO "检查 yum 源中是否有 python3-tensorflow-tensorboard"
if ! dnf list available python3-tensorflow-tensorboard &>/dev/null; then
LOG_ERROR "yum 源中未找到 python3-tensorflow-tensorboard"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装 python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "安装失败"
fi
# 测试 --host 参数
LOG_INFO "测试 --host 参数"
tensorboard --host 127.0.0.1 --logdir=/tmp &>/dev/null &
pid=$!
sleep 2
# 检查进程是否在运行
if ps -p $pid &>/dev/null; then
LOG_INFO "--host 参数测试成功"
else
LOG_ERROR "--host 参数测试失败"
kill -9 $pid &>/dev/null
if [ "$installed" = false ]; then
dnf remove -y python3-tensorflow-tensorboard &>/dev/null
CHECK_RESULT $? 0 0 "卸载失败"
fi
exit 1
fi
# 清理环境,恢复到之前的状态
LOG_INFO "清理环境"
kill -9 $pid &>/dev/null
if [ "$installed" = false ]; then
LOG_INFO "卸载 python3-tensorflow-tensorboard"
dnf remove -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "卸载失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,63 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --inspect 参数检查事件文件摘要
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试使用 --inspect 参数检查事件文件摘要"
# 检查yum源中是否存在python3-tensorflow-tensorboard包
LOG_INFO "检查yum源中是否存在python3-tensorflow-tensorboard包"
dnf list available python3-tensorflow-tensorboard &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在python3-tensorflow-tensorboard包"
exit 255
fi
# 检查是否已安装python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装python3-tensorflow-tensorboard"
rpm -q python3-tensorflow-tensorboard &>/dev/null
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "python3-tensorflow-tensorboard已安装"
else
installed=false
LOG_INFO "python3-tensorflow-tensorboard未安装将进行安装"
fi
# 若未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "安装python3-tensorflow-tensorboard失败"
fi
# 测试--inspect参数
LOG_INFO "测试--inspect参数检查事件文件摘要"
tensorboard --inspect /tmp/eventfile &>/dev/null
CHECK_RESULT $? 0 0 "--inspect参数检查事件文件摘要失败"
# 若未安装,则卸载软件包以恢复环境
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-tensorflow-tensorboard以恢复环境"
dnf remove -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "卸载python3-tensorflow-t
}
main "$@"

View File

@@ -1,77 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --load_fast 参数启用快速加载模式
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装python3-tensorflow-tensorboard"
dnf list installed python3-tensorflow-tensorboard &> /dev/null
if [ $? -eq 0 ]; then
LOG_INFO "python3-tensorflow-tensorboard已安装脚本结束时将保持安装状态"
installed=true
else
LOG_INFO "python3-tensorflow-tensorboard未安装将在测试后卸载"
installed=false
fi
# 检查yum源中是否有python3-tensorflow-tensorboard
LOG_INFO "检查yum源中是否有python3-tensorflow-tensorboard"
dnf list available python3-tensorflow-tensorboard &> /dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-tensorflow-tensorboard"
exit 255
fi
# 安装python3-tensorflow-tensorboard如果未安装
if [ "$installed" = false ]; then
LOG_INFO "安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "安装python3-tensorflow-tensorboard失败"
fi
# 测试--load_fast参数是否支持
LOG_INFO "测试--load_fast参数是否支持"
tensorboard --help | grep -- "--load_fast" &> /dev/null
CHECK_RESULT $? 0 0 "--load_fast参数不支持"
# 执行带--load_fast参数的tensorboad命令
LOG_INFO "执行带--load_fast参数的tensorboard命令"
tensorboad --logdir=/tmp --load_fast &> /dev/null &
pid=$!
sleep 2
# 检查tensorboad进程是否运行
ps -p $pid &> /dev/null
CHECK_RESULT $? 0 0 "tensorboad进程未运行"
# 清理环境
kill -9 $pid &> /dev/null
# 如果之前未安装则卸载python3-tesorflwo_tesorbaord
if [ "$installed" = false ]; then
LOG_INFO “卸载python_tesnorflwo_tesnorbaord”
dnf remove -y python_tesnorflwo_tesnorbaord
CHECK_RESULT $ 0 0 “卸载失败”
fi
LOG_INFO “测试完成”
}
main "$@"

View File

@@ -1,87 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --logdir 参数指定日志目录
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装python3-tensorflow-tensorboard"
if dnf list installed python3-tensorflow-tensorboard &>/dev/null; then
LOG_INFO "python3-tensorflow-tensorboard已安装"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-tensorboard未安装"
INSTALLED=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有python3-tensorflow-tensorboard"
if ! dnf list available python3-tensorflow-tensorboard &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-tensorboard"
exit 255
fi
# 若未安装则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard || {
LOG_ERROR "安装python3-tensorflow-tensorboard失败"
exit 1
}
fi
# 测试--logdir参数指定日志目录功能
LOG_INFO "测试--logdir参数指定日志目录功能"
TEST_DIR="/tmp/tb_logdir_test"
mkdir -p "$TEST_DIR" || {
LOG_ERROR "创建测试目录失败: $TEST_DIR"
exit 1
}
tensorboard --logdir="$TEST_DIR" --port=6006 &>/dev/null &
TB_PID=$!
sleep 2
# 检查tensorboard是否成功启动
if ! ps -p $TB_PID &>/dev/null; then
LOG_ERROR "tensorboard启动失败"
rm -rf "$TEST_DIR"
exit 1
fi
# 清理测试环境
kill $TB_PID
rm -rf "$TEST_DIR"
# 若脚本开始时未安装则卸载软件包以恢复环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tensorflow-tensorboard以恢复环境"
dnf remove -y python3-tensorflow-tensoboard || {
LOG_ERROR "卸载python3-tensorflow-tensoboard失败"
exit 1
}
fi
LOG_INFO "测试完成,环境已恢复"
exit 0
}
main "$@"

View File

@@ -1,77 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-13
# @License : Mulan PSL v2
# @Desc : 测试使用--path_prefix参数设置路径前缀
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:测试使用--path_prefix参数设置路径前缀"
# 检查是否已安装python3-tensorflow-tensorboard
if dnf list installed python3-tensorflow-tensorboard &>/dev/null; then
LOG_INFO "检测到python3-tensorflow-tensorboard已安装脚本结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "未检测到python3-tensorflow-tensorboard安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-tensorboard软件包
LOG_INFO "检查yum源中是否存在python3-tensorflow-tensorboard软件包"
if ! dnf list available python3-tensorflow-tensorboard &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-tensorboard软件包"
exit 255
fi
# 安装python3-tensorflow-tensorboard
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "安装python3-tensorflow-tensorboard失败"
fi
# 检查--path_prefix参数是否支持
LOG_INFO "检查tensorboard是否支持--path_prefix参数"
tensorbard --help | grep -q -- --path_prefix
CHECK_RESULT $? 0 255 "tensorboard不支持--path_prefix参数"
# 测试--path_prefix参数功能
LOG_INFO "测试--path_prefix参数功能"
tensorbard --logdir=/tmp --port=6006 --path_prefix=/test &>/dev/null &
PID=$!
sleep 2
# 检查服务是否启动成功
ps -p $PID &>/dev/null
CHECK_RESULT $? 0 0 "tensorboard服务启动失败"
# 清理测试环境
kill -9 $PID &>/dev/null
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tensorflow-tensoboard"
dnf remove -y python3-rensorflow-tensoboadl
CHECK_RESULT $? 0 0 "卸载python-rensoflow-tensoboarl失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,82 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --port 参数指定服务端口
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试使用 --port 参数指定服务端口"
# 检查是否已安装python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装python3-tensorflow-tensorboard"
dnf list installed python3-tensorflow-tensorboard > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "python3-tensorflow-tensorboard 已安装,脚本结束时将保持安装状态"
INSTALLED=1
else
LOG_INFO "python3-tensorflow-tensorboard 未安装,将在测试结束后卸载"
INSTALLED=0
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有python3-tensorflow-tensorboard"
dnf list available python3-tensorflow-tensorboard > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-tensorflow-tensorboard软件包"
exit 255
fi
# 安装软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "安装python3-tensorflow-tensorboard失败"
fi
# 测试--port参数是否支持
LOG_INFO "测试--port参数是否支持"
tensorboard --help | grep -- "--port" > /dev/null 2>&1
CHECK_RESULT $? 0 255 "--port参数不支持"
# 启动tensorboard服务并指定端口为6006
LOG_INFO "启动tensorboard服务并指定端口为6006"
tensorbord_pid=$(tensorboard --port 6006 --logdir /tmp &> /dev/null & echo $!)
CHECK_RESULT $? 0 0 "启动tensorboard服务失败"
# 检查端口是否监听成功
LOG_INFO "检查6006端口是否监听成功"
sleep 5 # 等待服务启动
netstat -tuln | grep ":6006" > /dev/null 2>&1
CHECK_RESULT $? 0 0 "6006端口未监听"
# 停止tensorbord服务
LOG_INFO "停止tensorboard服务"
kill -9 $tensorbord_pid
# 清理环境(如果最初未安装)
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载python3-tesorflow-tesorboarad软件包"
dnf remove -y python3-tesorflow-tesorboarad
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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 : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --reuse_port 参数启用端口重用
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 --reuse_port 参数启用端口重用功能"
# 检查是否已安装 python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装 python3-tensorflow-tensorboard"
if dnf list installed python3-tensorflow-tensorboard &>/dev/null; then
LOG_INFO "python3-tensorflow-tensorboard 已安装"
installed=true
else
LOG_INFO "python3-tensorflow-tensorboard 未安装"
installed=false
fi
# 检查 yum 源中是否有 python3-tensorflow-tensorboard
LOG_INFO "检查 yum 源中是否有 python3-tensorflow-tensorboard"
if ! dnf list available python3-tensorflow-tensorboard &>/dev/null; then
LOG_ERROR "yum 源中未找到 python3-tensorflow-tensorboard退出测试"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "开始安装 python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard || {
LOG_ERROR "安装 python3-tensorflow-tensorboard 失败"
exit 255
}
fi
# 检查 --reuse_port 参数是否支持
LOG_INFO "检查 tensorboard --help 是否包含 --reuse_port 参数"
if ! tensorboard --help | grep -q -- "--reuse_port"; then
LOG_ERROR "tensorboard 不支持 --reuse_port 参数,退出测试"
exit 255
fi
# 启动 tensorboard 并启用端口重用
LOG_INFO "启动 tensorboard启用 --reuse_port"
tensorboard --logdir=/tmp --port=6006 --reuse_port &
pid=$!
sleep 2
# 检查 tensorboard 是否成功启动
CHECK_RESULT $? 0 0 "tensorboard 启动失败"
# 检查端口是否被监听
LOG_INFO "检查端口 6006 是否被监听"
netstat -tuln | grep -q ":6006 "
CHECK_RESULT $? 0 0 "端口 6006未被监听"
# 停止 tensorboard
kill $pid
wait $pid 2>/dev/null
#如果之前未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载 python3-rensorflow-rensorboard"
dnf remove -y python3-rensorflow-rensorboarrd || {
LOG_ERROR"卸载 python-rensorflow-rensorboard失败"
exit 1
}
fi
LOG_INF0“测试完成”
}
main "$@"

View File

@@ -1,59 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试使用 --version_tb 参数打印 TensorBoard 版本
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装python3-tensorflow-tensorboard"
if dnf list installed python3-tensorflow-tensorboard &>/dev/null; then
LOG_INFO "python3-tensorflow-tensorboard已安装脚本结束后将保持安装状态"
installed=true
else
LOG_INFO "python3-tensorflow-tensorboard未安装将在测试后卸载"
installed=false
fi
# 检查yum源中是否有python3-tensorflow-tensorboard
LOG_INFO "检查yum源中是否有python3-tensorflow-tensorboard"
if ! dnf list available python3-tensorflow-tensorboard &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-tensorboard"
exit 255
fi
# 安装python3-tensorflow-tensorboard如果未安装
if [ "$installed" = false ]; then
LOG_INFO "安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard
CHECK_RESULT $? 0 0 "安装python3-tensorflow-tensorboard失败"
fi
# 测试--version_tb参数打印TensorBoard版本
LOG_INFO "测试--version_tb参数打印TensorBoard版本"
tensorboard --version_tb
CHECK_RESULT $? 0 0 "执行tensorboard --version_tb失败"
# 清理环境(如果脚本开始时未安装)
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-tensorflow-tensorboard"
dnf remove -y python3-tensorflow-t
}
main "$@"

View File

@@ -1,90 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-13
# @License : Mulan PSL v2
# @Desc : 测试使用--window_title参数更改浏览器窗口标题
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试:测试使用--window_title参数更改浏览器窗口标题"
# 检查是否已安装python3-tensorflow-tensorboard
LOG_INFO "检查是否已安装python3-tensorflow-tensorboard"
if dnf list installed python3-tensorflow-tensorboard &>/dev/null; then
LOG_INFO "python3-tensorflow-tensorboard已安装测试结束后保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-tensorboard未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-tensorboard
LOG_INFO "检查yum源中是否有python3-tensorflow-tensorboard"
if ! dnf list available python3-tensorflow-tensorboard &>/dev/null; then
LOG_ERROR "yum源中没有找到python3-tensorflow-tensorboard软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装python3-tensorflow-tensorboard"
dnf install -y python3-tensorflow-tensorboard || {
LOG_ERROR "安装python3-tensorflow-tensorboard失败"
exit 1
}
fi
# 检查--window_title参数是否支持
LOG_INFO "检查tensorboard是否支持--window_title参数"
tensorbard --help | grep -- --window_title &>/dev/null || {
LOG_ERROR "--window_title参数不支持"
exit 255
}
# 启动tensorboard并指定窗口标题
LOG_INFO "启动tensorboard并指定窗口标题为"TestTitle""
tensorboard --logdir=/tmp --window_title="TestTitle" &>/dev/null &
TB_PID=$!
# 检查tensorbard进程是否启动成功
CHECK_RESULT $? 0 0 "启动tensorbard失败"
# 获取窗口标题并验证
LOG_INFO "验证浏览器窗口标题是否为"TestTitle""
WINDOW_TITLE=$(curl -s http://localhost:6006 | grep -oP "<title>\K.*?(?=</title>)")
CHECK_RESULT "$?" 0 0 "获取窗口标题失败"
[ "$WINDOW_TITLE" = "TestTitle" ] || {
LOG_ERROR "窗口标题不符合预期,实际为:$WINDOW_TITLE"
exit 1
}
# 清理环境
kill $TB_PID &>/dev/null
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tensortlow-tensortboard"
dnf remove -y python3-tenstorlow-tensortoard || {
LOG_ERROR "卸载python3-tensortlow-tensortoard失败"
exit 1
}
fi
LOG_INFO "测试完成:成功验证--window_title参数功能"
}
main "$@"

View File

@@ -1,67 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试是否允许直接在输入文件上进行转换
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow_tf_upgrade_v2_inplace
LOG_INFO "检查是否已安装python3-tensorflow_tf_upgrade_v2_inplace"
if dnf list installed python3-tensorflow_tf_upgrade_v2_inplace &>/dev/null; then
LOG_INFO "python3-tensorflow_tf_upgrade_v2_inplace已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow_tf_upgrade_v2_inplace未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow_tf_upgrade_v2_inplace软件包
LOG_INFO "检查yum源中是否有python3-tensorflow_tf_upgrade_v2_inplace软件包"
if ! dnf list available python3-tensorflow_tf_upgrade_v2_inplace &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow_tf_upgrade_v2_inplace软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装python3-tensorflow_tf_upgrade_v2_inplace"
dnf install -y python3-tensorflow_tf_upgrade_v2_inplace
CHECK_RESULT $? 0 0 "安装python3-tensorflow_tf_upgrade_v2_inplace失败"
fi
# 测试是否允许直接在输入文件上进行转换
LOG_INFO "测试是否允许直接在输入文件上进行转换"
if ! tf_upgrade_v2 --inplace --intree /path/to/input/file &>/dev/null; then
LOG_ERROR "参数--inplace或--intree不支持或不存在"
exit 255
fi
CHECK_RESULT $? 0 0 "直接在输入文件上进行转换失败"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tensorflow_tf_upgrade_v2_inplace"
dnf remove -y python3-tensorflow_tf_upgrade_v2_inplace
CHECK_RESULT $? 0 0 "卸载python3-tensorflow_tf_upgrade_v2_inplace失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -1,62 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试升级脚本的默认模式
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow_tf_upgrade_v2_mode_default
LOG_INFO "检查是否已安装python3-tensorflow_tf_upgrade_v2_mode_default"
if dnf list installed python3-tensorflow_tf_upgrade_v2_mode_default &>/dev/null; then
LOG_INFO "python3-tensorflow_tf_upgrade_v2_mode_default已安装"
installed=true
else
LOG_INFO "python3-tensorflow_tf_upgrade_v2_mode_default未安装"
installed=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有python3-tensorflow_tf_upgrade_v2_mode_default"
if ! dnf list available python3-tensorflow_tf_upgrade_v2_mode_default &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow_tf_upgrade_v2_mode_default"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装python3-tensorflow_tf_upgrade_v2_mode_default"
dnf install -y python3-tensorflow_tf_upgrade_v2_mode_default
CHECK_RESULT $? 0 0 "安装python3-tensorflow_tf_upgrade_v2_mode_default失败"
fi
# 测试升级脚本的默认模式
LOG_INFO "测试升级脚本的默认模式"
tf_upgrade_v2 --mode default
CHECK_RESULT $? 0 0 "升级脚本的默认模式执行失败"
# 如果脚本开始时未安装,则在结束时卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-tensorflow_tf_upgrade_v2_mode_default"
dnf remove -y python3-tensorflow_tf_upgrade_v2_mode_default
CHECK_RESULT $? 0 0 "卸载python3-tensorflow_tf_upgrade_v2_mode_default失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

@@ -1,64 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试升级脚本的安全模式
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-tf-upgrade-v2-mode-safety
LOG_INFO "检查是否已安装python3-tensorflow-tf-upgrade-v2-mode-safety"
if dnf list installed python3-tensorflow-tf-upgrade-v2-mode-safety &> /dev/null; then
LOG_INFO "python3-tensorflow-tf-upgrade-v2-mode-safety已安装"
installed=true
else
LOG_INFO "python3-tensorflow-tf-upgrade-v2-mode-safety未安装"
installed=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有python3-tensorflow-tf-upgrade-v2-mode-safety"
if ! dnf list available python3-tensorflow-tf-upgrade-v2-mode-safety &> /dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-tf-upgrade-v2-mode-safety"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "开始安装python3-tensorflow-tf-upgrade-v2-mode-safety"
dnf install -y python3-tensorflow-tf-upgrade-v2-mode-safety
CHECK_RESULT $? 0 0 "安装python3-tensorflow-tf-upgrade-v2-mode-safety失败"
fi
# 测试升级脚本的安全模式
LOG_INFO "测试升级脚本的安全模式"
tf_upgrade_v2 --safety_mode
CHECK_RESULT $? 0 0 "升级脚本的安全模式测试失败"
# 如果之前未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-tensorflow-tf-upgrade-v2-mode-safety"
dnf remove -y python3-tensorflow-tf-upgrade-v2-mode-safety
CHECK_RESULT $? 0 0 "卸载python3-tensorflow-tf-upgrade-v2-mode-safety失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,74 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试是否打印完整日志到标准输出
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow软件包
LOG_INFO "检查是否已安装python3-tensorflow软件包"
dnf list installed python3-tensorflow &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "python3-tensorflow已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow未安装将在测试后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow软件包
LOG_INFO "检查yum源中是否有python3-tensorflow软件包"
dnf list available python3-tensorflow &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-tensorflow软件包"
exit 255
fi
# 如果未安装则安装python3-tensorflow
if ! $INSTALLED; then
LOG_INFO "安装python3-tensorflow软件包"
dnf install -y python3-tensorflow
CHECK_RESULT $? 0 0 "安装python3-tensorflow失败"
fi
# 执行tf_upgrade_v2命令并检查是否打印完整日志到标准输出
LOG_INFO "执行tf_upgrade_v2命令并检查日志输出"
tf_upgrade_v2 --print_all &> output.log
CHECK_RESULT $? 0 0 "执行tf_upgrade_v2命令失败"
# 检查日志文件是否包含预期内容
LOG_INFO "检查日志文件内容"
grep "完整日志" output.log
CHECK_RESULT $? 0 0 "未找到完整日志输出"
# 清理环境
if ! $INSTALLED; then
LOG_INFO "卸载python3-tensorflow软件包"
dnf remove -y python3-tensorflow
CHECK_RESULT $? 0 0 "卸载python3-tensorflow失败"
fi
# 删除临时文件
rm -f output.log
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,71 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试报告日志文件的存储名称
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查yum源中是否存在python3-tensorflow-tf-upgrade-v2-reportfile包
LOG_INFO "检查yum源中是否存在python3-tensorflow-tf-upgrade-v2-reportfile包"
dnf list available python3-tensorflow-tf-upgrade-v2-reportfile > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在python3-tensorflow-tf-upgrade-v2-reportfile包"
# 检查是否已安装python3-tensorflow-tf-upgrade-v2-reportfile包
LOG_INFO "检查是否已安装python3-tensorflow-tf-upgrade-v2-reportfile包"
if rpm -q python3-tensorflow-tf-upgrade-v2-reportfile > /dev/null 2>&1; then
LOG_INFO "python3-tensorflow-tf-upgrade-v2-reportfile包已安装"
installed=true
else
LOG_INFO "python3-tensorflow-tf-upgrade-v2-reportfile包未安装"
installed=false
fi
# 如果未安装,则安装软件包
if [ "$installed" = false ]; then
LOG_INFO "安装python3-tensorflow-tf-upgrade-v2-reportfile包"
dnf install -y python3-tensorflow-tf-upgrade-v2-reportfile > /dev/null 2>&1
CHECK_RESULT $? 0 255 "安装python3-tensorflow-tf-upgrade-v2-reportfile包失败"
fi
# 测试报告日志文件的存储名称
LOG_INFO "测试报告日志文件的存储名称"
tf_upgrade_v2 --reportfile test_report.log > /dev/null 2>&1
CHECK_RESULT $? 0 255 "执行tf_upgrade_v2命令失败"
# 检查报告文件是否存在
LOG_INFO "检查报告文件test_report.log是否存在"
if [ -f "test_report.log" ]; then
LOG_INFO "报告文件test_report.log存在"
else
LOG_ERROR "报告文件test_report.log不存在"
exit 255
fi
# 清理环境:如果之前未安装,则卸载软件包
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-tensorflow-tf-upgrade-v2-reportfile包"
dnf remove -y python3-tensorflow-f-upgrade-v2-reportfile > /dev/null 2>&1
CHECK_RESULT $? 0 255 "卸载python3-fupgradetensorlowv eportfile失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -1,85 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试 tflite_convert 命令的 --output_file 参数
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow
LOG_INFO "检查是否已安装python3-tensorflow"
rpm -q python3-tensorflow > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "python3-tensorflow已安装脚本结束后将保持安装状态"
installed=true
else
LOG_INFO "python3-tensorflow未安装将在测试结束后卸载"
installed=false
fi
# 检查yum源中是否有python3-tensorflow包
LOG_INFO "检查yum源中是否有python3-tensorflow包"
dnf list available python3-tensorflow > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到python3-tensorflow包"
exit 255
fi
# 安装python3-tensorflow
if [ "$installed" = false ]; then
LOG_INFO "安装python3-tensorflow"
dnf install -y python3-tensorflow
CHECK_RESULT $? 0 0 "安装python3-tensorflow失败"
fi
# 检查tflite_convert命令是否存在
LOG_INFO "检查tflite_convert命令是否存在"
which tflite_convert > /dev/null 2>&1
CHECK_RESULT $? 0 0 "tflite_convert命令不存在"
# 测试--output_file参数
LOG_INFO "测试tflite_convert命令的--output_file参数"
# 创建一个临时模型文件用于测试假设为test_model.h5
echo "dummy model content" > test_model.h5
# 执行tflite_convert命令并指定--output_file参数
tflite_convert --keras_model_file=test_model.h5 --output_file=output.tflite
CHECK_RESULT $? 0 0 "tflite_convert命令执行失败"
# 检查输出文件是否存在
LOG_INFO "检查输出文件output.tflite是否存在"
[ -f output.tflite ]
CHECK_RESULT $? 0 0 "输出文件未生成"
# 清理临时文件
LOG_INFO "清理临时文件"
rm -f test_model.h5 output.tflite
# 如果脚本开始时未安装python3-tensorflow则卸载
if [ "$installed" = false ]; then
LOG_INFO "卸载python3-tensorflow"
dnf remove -y python3-tensorflow
CHECK_RESULT $? 0 0 "卸载python3-tensorflow失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

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

View File

@@ -1,64 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-13
# @License : Mulan PSL v2
# @Desc : 测试 toco_from_protos 基本功能,包含必需的四个参数
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装python3-tensorflow-toco
LOG_INFO "检查是否已安装python3-tensorflow-toco"
if dnf list installed python3-tensorflow-toco &>/dev/null; then
LOG_INFO "python3-tensorflow-toco已安装脚本结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-toco未安装将在测试后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-toco软件包
LOG_INFO "检查yum源中是否有python3-tensorflow-toco软件包"
if ! dnf list available python3-tensorflow-toco &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-toco软件包"
exit 255
fi
# 若未安装则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装python3-tensorflow-toco"
dnf install -y python3-tensorflow-toco
CHECK_RESULT $? 0 0 "安装python3-tensorflow-toco失败"
fi
# 测试toco_from_protos基本功能
LOG_INFO "测试toco_from_protos基本功能"
toco_from_protos --input_file=test.pb --output_file=test.tflite --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE
CHECK_RESULT $? 0 0 "toco_from_protos执行失败"
# 清理环境:若脚本开始时未安装则卸载软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载python3-tensorflow-toco"
dnf remove -y python3-tensorflow-toco
CHECK_RESULT $? 0 0 "卸载python3-tensorflow-toco失败"
fi
LOG_INFO "测试脚本执行完成"
}
main "$@"

View File

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

View File

@@ -1,85 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试 toco 命令的 --output_file 参数
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查环境是否已安装python3-tensorflow-toco
LOG_INFO "检查是否已安装python3-tensorflow-toco"
if dnf list installed python3-tensorflow-toco &>/dev/null; then
LOG_INFO "python3-tensorflow-toco已安装脚本结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-toco未安装将在测试后卸载"
INSTALLED=false
fi
# 检查yum源中是否有python3-tensorflow-toco包
LOG_INFO "检查yum源中是否有python3-tensorflow-toco包"
if ! dnf list available python3-tensorflow-toco &>/dev/null; then
LOG_ERROR "yum源中未找到python3-tensorflow-toco包"
exit 255
fi
# 安装python3-tensorflow-toco包如果未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装python3-tensorflow-toco包"
dnf install -y python3-tensorflow-toco
CHECK_RESULT $? 0 0 "安装python3-tensorflow-toco失败"
fi
# 测试toco命令的--output_file参数功能
LOG_INFO "测试toco命令的--output_file参数功能"
# 创建临时测试文件
TEMP_INPUT_FILE=$(mktemp)
TEMP_OUTPUT_FILE=$(mktemp)
echo "dummy data for test" > "$TEMP_INPUT_FILE"
# 执行toco命令
LOG_INFO "执行toco命令并指定--output_file参数"
toco --input_file="$TEMP_INPUT_FILE" --output_file="$TEMP_OUTPUT_FILE" &>/dev/null
CHECK_RESULT $? 0 0 "toco命令执行失败"
# 验证输出文件是否存在
LOG_INFO "验证输出文件是否生成"
if [ -f "$TEMP_OUTPUT_FILE" ]; then
LOG_INFO "输出文件成功生成"
else
LOG_ERROR "输出文件未生成"
exit 1
fi
# 清理临时文件
LOG_INFO "清理临时文件"
rm -f "$TEMP_INPUT_FILE" "$TEMP_OUTPUT_FILE"
# 卸载python3-tensorflow-toco包如果之前未安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在卸载python3-tensorflow-toco包"
dnf remove -y python3-tensorflow-toco
CHECK_RESULT $? 0 0 "卸载python3- tensorflow- toco失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -1,64 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试 toco 命令的 --saved_model_dir 参数
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 toco 命令的 --saved_model_dir 参数"
# 检查是否已安装 python3-tensorflow-toco
LOG_INFO "检查是否已安装 python3-tensorflow-toco"
if dnf list installed python3-tensorflow-toco &>/dev/null; then
LOG_INFO "python3-tensorflow-toco 已安装"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-toco 未安装"
INSTALLED=false
fi
# 检查 yum 源中是否有 python3-tensorflow-toco
LOG_INFO "检查 yum 源中是否有 python3-tensorflow-toco"
if ! dnf list available python3-tensorflow-toco &>/dev/null; then
LOG_ERROR "yum 源中未找到 python3-tensorflow-toco"
exit 255
fi
# 如果未安装,则安装 python3-tensorflow-toco
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装 python3-tensorflow-toco"
dnf install -y python3-tensorflow-toco
CHECK_RESULT $? 0 0 "安装 python3-tensorflow-toco 失败"
fi
# 测试 toco 命令的 --saved_model_dir 参数
LOG_INFO "测试 toco --saved_model_dir 参数"
toco --saved_model_dir=/tmp/test_saved_model &>/dev/null
CHECK_RESULT $? 0 255 "toco --saved_model_dir 参数不支持或无效"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载 python3-tensorflow-toco"
dnf remove -y python3-tensorflow-toco
CHECK_RESULT $? 0 0 "卸载 python3-tensorflow-toco失败"
fi
LOG_INFO "测试完成"
}
main "$@"

View File

@@ -1,78 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-01
# @License : Mulan PSL v2
# @Desc : 测试 toco 命令的 --saved_model_tag_set 参数
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试 toco 命令的 --saved_model_tag_set 参数"
# 检查是否已安装 python3-tensorflow-toco
LOG_INFO "检查是否已安装 python3-tensorflow-toco"
dnf list installed python3-tensorflow-toco > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "python3-tensorflow-toco 已安装,脚本结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "python3-tensorflow-toco 未安装,将在测试完成后卸载"
INSTALLED=false
fi
# 检查 yum 源中是否有 python3-tensorflow-toco
LOG_INFO "检查 yum 源中是否有 python3-tensorflow-toco"
dnf list available python3-tensorflow-toco > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum 源中未找到 python3-tensorflow-toco"
exit 255
fi
# 安装 python3-tensorflow-toco
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在安装 python3-tensorflow-toco"
dnf install -y python3-tensorflow-toco > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装 python3-tensorflow-toco 失败"
fi
# 测试 toco 命令的 --saved_model_tag_set 参数
LOG_INFO "测试 toco 命令的 --saved_model_tag_set 参数"
toco --help | grep -- "--saved_model_tag_set" > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "toco 命令不支持 --saved_model_tag_set 参数"
exit 255
fi
# TODO: 替换为实际的测试命令和预期结果检查逻辑示例:
LOG_INFO "执行 toco --saved_model_tag_set=serve ...(示例)"
toco --saved_model_tag_set=serve > /dev/null 2>&1
CHECK_RESULT $? 0 0 "toco --saved_model_tag_set=serve 执行失败"
# TODO: 根据实际需求补充其他测试步骤
#清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "正在卸载 python3-tensorflow-toco"
dnf remove -y python3-tensorflow-toco > /dev/null 2>&1
CHECK_RESULT $? 0 0 “卸载 python3-tensorflow—to co失败”
fi
LOG _INFO “测试完成”
}
main "$@"

View File

@@ -1,59 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-09-17
# @License : Mulan PSL v2
# @Desc : Test package installation
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-borceux-doc软件包
LOG_INFO "检查是否已安装texlive-borceux-doc软件包"
rpm -q texlive-borceux-doc > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-borceux-doc已安装脚本结束时将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-borceux-doc未安装脚本结束时将卸载"
INSTALLED=false
fi
# 检查yum源中是否存在texlive-borceux-doc软件包
LOG_INFO "检查yum源中是否存在texlive-borceux-doc软件包"
dnf list available texlive-borceux-doc > /dev/null 2>&1
CHECK_RESULT $? 0 255 "yum源中不存在texlive-borceux-doc软件包"
# 安装texlive-borceux-doc软件包
LOG_INFO "安装texlive-borceux-doc软件包"
dnf install -y texlive-borceux-doc
CHECK_RESULT $? 0 0 "安装texlive-borceux-doc失败"
# 验证安装是否成功
LOG_INFO "验证texlive-borceux-doc是否安装成功"
rpm -q texlive-borceux-doc > /dev/null 2>&1
CHECK_RESULT $? 0 0 "验证texlive-borceux-doc安装失败"
# 测试完成后清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-borceux-doc软件包"
dnf remove -y texlive-borceux-doc
CHECK_RESULT $? 0 0 "卸载texlive-borceux-doc失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,76 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-11-26
# @License : Mulan PSL v2
# @Desc : Test basic functionality of texlive-cellprops
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查texlive-cellprops是否已安装
LOG_INFO "检查texlive-cellprops是否已安装"
dnf list installed texlive-cellprops > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-cellprops已安装脚本结束后保持安装状态"
INSTALLED=1
else
LOG_INFO "texlive-cellprops未安装将在测试后卸载"
INSTALLED=0
fi
# 检查yum源中是否有texlive-cellprops软件包
LOG_INFO "检查yum源中是否有texlive-cellprops软件包"
dnf list available texlive-cellprops > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到texlive-cellprops软件包"
exit 255
fi
# 安装texlive-cellprops软件包如果未安装
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "开始安装texlive-cellprops软件包"
dnf install -y texlive-cellprops > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-cellprops失败"
fi
# 测试基本功能
LOG_INFO "测试texlive-cellprops基本功能"
command_to_test="some_texlive_cellprops_command --basic-option" # 替换为实际命令和参数
$command_to_test > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行基本功能测试失败"
# 检查不支持参数的情况
LOG_INFO "检查不支持参数的情况"
command_to_test="some_texlive_cellprops_command --invalid-option" # 替换为实际命令和无效参数
$command_to_test > /dev/null 2>&1
if [ $? -ne 255 ]; then
LOG_ERROR "不支持参数时未返回正确退出码"
exit 255
fi
# 清理环境(如果之前未安装)
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载texlive-cellprops软件包"
dnf remove -y texlive-cellprops > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-cellprops失败"
fi
LOG_INFO "测试脚本执行完毕,环境已恢复"
}
main "$@"

View File

@@ -1,94 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-06
# @License : Mulan PSL v2
# @Desc : Test basic command execution
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test basic command execution"
# 检查是否已安装texlive-doctools
LOG_INFO "步骤1检查texlive-doctools是否已安装"
if dnf list installed texlive-doctools &>/dev/null; then
LOG_INFO "texlive-doctools已安装测试后将保持安装状态"
already_installed=1
else
LOG_INFO "texlive-doctools未安装将进行安装测试"
already_installed=0
fi
# 检查yum源中是否有texlive-doctools软件包
LOG_INFO "步骤2检查yum源中是否存在texlive-doctools软件包"
if ! dnf list available texlive-doctools &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-doctools软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ $already_installed -eq 0 ]; then
LOG_INFO "步骤3安装texlive-doctools软件包"
dnf install -y texlive-doctools
CHECK_RESULT $? 0 0 "安装texlive-doctools失败"
fi
# 测试基本命令执行
LOG_INFO "步骤4测试texlive-doctools基本命令执行"
# 这里以假设texlive-doctools包含一个名为"texdoctools"的命令为例
# 实际命令可能不同,需要根据实际情况调整
command_to_test="texdoctools"
if ! command -v $command_to_test &>/dev/null; then
LOG_ERROR "命令 $command_to_test 不存在"
# 清理环境
if [ $already_installed -eq 0 ]; then
LOG_INFO "清理环境卸载texlive-doctools"
dnf remove -y texlive-doctools
fi
exit 255
fi
# 测试命令的基本用法,这里以"--help"参数为例
LOG_INFO "步骤5测试命令 $command_to_test --help"
$command_to_test --help
CHECK_RESULT $? 0 0 "命令 $command_to_test --help 执行失败"
# 测试不支持的参数
LOG_INFO "步骤6测试不支持的参数例如--nonexistent"
$command_to_test --nonexistent 2>/dev/null
if [ $? -ne 255 ] && [ $? -ne 1 ]; then
LOG_ERROR "命令 $command_to_test 不支持参数 --nonexistent 但未正确退出"
# 清理环境
if [ $already_installed -eq 0 ]; then
LOG_INFO "清理环境卸载texlive-doctools"
dnf remove -y texlive-doctools
fi
exit 255
fi
# 清理环境:如果测试前未安装,则卸载软件包
if [ $already_installed -eq 0 ]; then
LOG_INFO "步骤7清理环境卸载texlive-doctools"
dnf remove -y texlive-doctools
CHECK_RESULT $? 0 0 "卸载texlive-doctools失败"
else
LOG_INFO "步骤7保持texlive-doctools安装状态"
fi
LOG_INFO "测试完成Test basic command execution"
}
main "$@"

View File

@@ -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-06
# @License : Mulan PSL v2
# @Desc : Test if package is installed
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本检查texlive-doctools软件包是否安装
LOG_INFO "==============================================="
LOG_INFO "开始测试检查texlive-doctools软件包安装状态"
LOG_INFO "==============================================="
# 定义软件包名称
PACKAGE_NAME="texlive-doctools"
LOG_INFO "测试目标软件包: ${PACKAGE_NAME}"
# 步骤1检查yum源中是否存在该软件包
LOG_INFO "步骤1: 检查yum源中是否存在${PACKAGE_NAME}软件包"
dnf list available ${PACKAGE_NAME} &>/dev/null
if [ $? -ne 0 ]; then
LOG_ERROR "错误: yum源中未找到${PACKAGE_NAME}软件包"
exit 255
fi
LOG_INFO "✓ yum源中存在${PACKAGE_NAME}软件包"
# 步骤2检查当前是否已安装该软件包
LOG_INFO "步骤2: 检查${PACKAGE_NAME}软件包当前安装状态"
dnf list installed ${PACKAGE_NAME} &>/dev/null
INSTALLED=$?
if [ ${INSTALLED} -eq 0 ]; then
LOG_INFO "${PACKAGE_NAME}软件包已安装"
NEED_CLEANUP=0
else
LOG_INFO "${PACKAGE_NAME}软件包未安装"
NEED_CLEANUP=1
fi
# 步骤3如果未安装则进行安装测试
if [ ${NEED_CLEANUP} -eq 1 ]; then
LOG_INFO "步骤3: 安装${PACKAGE_NAME}软件包进行测试"
dnf install -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败"
LOG_INFO "${PACKAGE_NAME}软件包安装成功"
# 验证安装是否成功
LOG_INFO "步骤4: 验证${PACKAGE_NAME}软件包安装结果"
dnf list installed ${PACKAGE_NAME} &>/dev/null
CHECK_RESULT $? 0 0 "${PACKAGE_NAME}软件包安装后验证失败"
LOG_INFO "${PACKAGE_NAME}软件包安装验证成功"
fi
# 步骤4检查软件包是否可正常使用如果有相关命令
LOG_INFO "步骤5: 检查${PACKAGE_NAME}软件包相关功能"
# 这里可以根据实际软件包特性添加具体的功能检查
# 例如:检查是否有相关的二进制文件或库文件
rpm -ql ${PACKAGE_NAME} | head -5 &>/dev/null
CHECK_RESULT $? 0 0 "无法获取${PACKAGE_NAME}软件包文件列表"
LOG_INFO "${PACKAGE_NAME}软件包文件列表可正常获取"
# 步骤5环境清理
LOG_INFO "步骤6: 环境清理"
if [ ${NEED_CLEANUP} -eq 1 ]; then
LOG_INFO "清理: 卸载测试安装的${PACKAGE_NAME}软件包"
dnf remove -y ${PACKAGE_NAME}
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败"
# 验证卸载是否成功
dnf list installed ${PACKAGE_NAME} &>/dev/null
if [ $? -eq 0 ]; then
LOG_ERROR "错误: ${PACKAGE_NAME}软件包卸载后仍然存在"
exit 1
fi
LOG_INFO "${PACKAGE_NAME}软件包已成功卸载,环境已恢复"
else
LOG_INFO "无需清理: ${PACKAGE_NAME}软件包保持原有安装状态"
fi
LOG_INFO "==============================================="
LOG_INFO "测试完成: ${PACKAGE_NAME}软件包安装状态检查通过"
LOG_INFO "==============================================="
}
main "$@"

View File

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

View File

@@ -1,82 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2026-04-06
# @License : Mulan PSL v2
# @Desc : Test package installation
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test package installation"
# 定义软件包名称
PACKAGE_NAME="texlive-doctools"
# 步骤1检查yum源中是否存在软件包
LOG_INFO "步骤1检查yum源中是否存在软件包 $PACKAGE_NAME"
dnf list available $PACKAGE_NAME > /dev/null 2>&1
CHECK_RESULT $? 0 0 "yum源中未找到软件包 $PACKAGE_NAME"
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME"
exit 255
fi
# 步骤2检查是否已安装
LOG_INFO "步骤2检查是否已安装 $PACKAGE_NAME"
if rpm -q $PACKAGE_NAME > /dev/null 2>&1; then
LOG_INFO "软件包 $PACKAGE_NAME 已安装,跳过安装步骤"
INSTALLED=1
else
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将进行安装"
INSTALLED=0
fi
# 步骤3如果未安装则安装软件包
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "步骤3安装软件包 $PACKAGE_NAME"
dnf install -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
fi
# 步骤4验证软件包安装成功
LOG_INFO "步骤4验证软件包 $PACKAGE_NAME 安装成功"
rpm -q $PACKAGE_NAME > /dev/null 2>&1
CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 安装后验证失败"
# 步骤5执行软件包相关功能测试示例检查版本信息
LOG_INFO "步骤5执行软件包相关功能测试"
# 假设软件包提供一个命令 "texdoctools" 来检查版本
if command -v texdoctools > /dev/null 2>&1; then
texdoctools --version > /dev/null 2>&1
CHECK_RESULT $? 0 0 "软件包 $PACKAGE_NAME 功能测试失败"
else
LOG_INFO "软件包 $PACKAGE_NAME 未提供可执行命令,跳过功能测试"
fi
# 步骤6环境恢复
LOG_INFO "步骤6环境恢复"
if [ $INSTALLED -eq 0 ]; then
LOG_INFO "卸载软件包 $PACKAGE_NAME"
dnf remove -y $PACKAGE_NAME
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
else
LOG_INFO "软件包 $PACKAGE_NAME 在测试前已安装,保持安装状态"
fi
LOG_INFO "测试完成Test package installation"
}
main "$@"

View File

@@ -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-04-06
# @License : Mulan PSL v2
# @Desc : Test package removal
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 检查是否已安装texlive-doctools
LOG_INFO "检查是否已安装texlive-doctools"
if rpm -q texlive-doctools &>/dev/null; then
LOG_INFO "texlive-doctools已安装记录当前状态"
INSTALLED_BEFORE=true
else
LOG_INFO "texlive-doctools未安装记录当前状态"
INSTALLED_BEFORE=false
fi
# 检查yum源中是否存在texlive-doctools
LOG_INFO "检查yum源中是否存在texlive-doctools"
if ! dnf list available texlive-doctools &>/dev/null; then
LOG_ERROR "yum源中未找到texlive-doctools软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED_BEFORE" = "false" ]; then
LOG_INFO "开始安装texlive-doctools"
dnf install -y texlive-doctools
CHECK_RESULT $? 0 0 "安装texlive-doctools失败"
LOG_INFO "安装texlive-doctools成功"
fi
# 测试卸载功能
LOG_INFO "开始测试卸载texlive-doctools"
dnf remove -y texlive-doctools
CHECK_RESULT $? 0 0 "卸载texlive-doctools失败"
LOG_INFO "卸载texlive-doctools成功"
# 验证卸载后软件包不存在
LOG_INFO "验证卸载后texlive-doctools不存在"
if rpm -q texlive-doctools &>/dev/null; then
LOG_ERROR "卸载后texlive-doctools仍然存在"
exit 1
else
LOG_INFO "卸载验证成功texlive-doctools已不存在"
fi
# 环境恢复:如果测试前已安装,则重新安装
if [ "$INSTALLED_BEFORE" = "true" ]; then
LOG_INFO "恢复环境重新安装texlive-doctools"
dnf install -y texlive-doctools
CHECK_RESULT $? 0 0 "重新安装texlive-doctools失败"
LOG_INFO "环境恢复成功texlive-doctools已重新安装"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -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-04-06
# @License : Mulan PSL v2
# @Desc : Test version information query
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test version information query"
LOG_INFO "步骤1检查系统是否已安装texlive-doctools软件包"
if dnf list installed texlive-doctools &>/dev/null; then
LOG_INFO "texlive-doctools已安装保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-doctools未安装将在测试过程中安装"
INSTALLED=false
fi
LOG_INFO "步骤2检查yum源中是否存在texlive-doctools软件包"
if ! dnf list available texlive-doctools &>/dev/null; then
LOG_ERROR "yum源中不存在texlive-doctools软件包退出测试"
exit 255
fi
if [ "$INSTALLED" = false ]; then
LOG_INFO "步骤3安装texlive-doctools软件包"
dnf install -y texlive-doctools
CHECK_RESULT $? 0 0 "安装texlive-doctools失败"
LOG_INFO "texlive-doctools安装成功"
fi
LOG_INFO "步骤4测试version参数查询版本信息"
texlive-doctools --version
CHECK_RESULT $? 0 0 "执行texlive-doctools --version失败"
LOG_INFO "步骤5测试-V参数查询版本信息"
texlive-doctools -V
CHECK_RESULT $? 0 0 "执行texlive-doctools -V失败"
LOG_INFO "步骤6测试不支持的参数"
texlive-doctools --invalid-param 2>/dev/null
if [ $? -eq 255 ]; then
LOG_INFO "不支持的参数处理正确返回退出码255"
else
LOG_ERROR "不支持的参数处理不正确"
exit 255
fi
if [ "$INSTALLED" = false ]; then
LOG_INFO "步骤7卸载texlive-doctools软件包"
dnf remove -y texlive-doctools
CHECK_RESULT $? 0 0 "卸载texlive-doctools失败"
LOG_INFO "texlive-doctools卸载成功"
else
LOG_INFO "步骤7保持texlive-doctools安装状态无需卸载"
fi
LOG_INFO "测试完成Test version information query"
}
main "$@"

View File

@@ -1,69 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-06
# @License : Mulan PSL v2
# @Desc : 测试texlive-draftcopy-doc软件包的构建功能
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试texlive-draftcopy-doc软件包的构建功能"
# 检查软件包是否已安装
if dnf list installed texlive-draftcopy-doc &>/dev/null; then
LOG_INFO "texlive-draftcopy-doc软件包已安装"
INSTALLED=true
else
LOG_INFO "texlive-draftcopy-doc软件包未安装"
INSTALLED=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否存在texlive-draftcopy-doc软件包"
if ! dnf list available texlive-draftcopy-doc &>/dev/null; then
LOG_ERROR "yum源中不存在texlive-draftcopy-doc软件包"
exit 255
fi
# 如果未安装,则安装软件包
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装texlive-draftcopy-doc软件包"
dnf install -y texlive-draftcopy-doc
CHECK_RESULT $? 0 0 "安装texlive-draftcopy-doc软件包失败"
fi
# 测试构建功能
LOG_INFO "测试texlive-draftcopy-doc的构建功能"
BUILD_COMMAND="some_build_command" # 替换为实际的构建命令
if ! command -v $BUILD_COMMAND &>/dev/null; then
LOG_ERROR "$BUILD_COMMAND命令不存在或不支持"
exit 255
fi
$BUILD_COMMAND --some-flag # 替换为实际的构建命令和参数
CHECK_RESULT $? 0 0 "构建texlive-draftcopy-doc失败"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-draftcopy-doc软件包"
dnf remove -y texlive-draftcopy-doc
CHECK_RESULT $? 0 0 "卸载texlive-draftcopy-doc软件包失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

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

View File

@@ -1,66 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-09-26
# @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"
# 检查软件包是否存在于yum源中
LOG_INFO "检查texlive-ijmart软件包是否存在于yum源中"
dnf list available texlive-ijmart >/dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "texlive-ijmart软件包不存在于yum源中"
exit 255
fi
# 检查环境是否已安装texlive-ijmart
LOG_INFO "检查环境是否已安装texlive-ijmart"
rpm -q texlive-ijmart >/dev/null 2>&1
if [ $? -eq 0 ]; then
installed=true
LOG_INFO "texlive-ijmart已安装脚本结束时将保持安装状态"
else
installed=false
LOG_INFO "texlive-ijmart未安装将在测试结束后卸载"
fi
# 安装texlive-ijmart如果未安装
if [ "$installed" = false ]; then
LOG_INFO "安装texlive-ijmart软件包"
dnf install -y texlive-ijmart
CHECK_RESULT $? 0 0 "安装texlive-ijmart失败"
fi
# 测试基本命令用法
LOG_INFO "测试基本命令用法"
texlive-ijmart --help >/dev/null 2>&1
CHECK_RESULT $? 0 0 "texlive-ijmart --help命令执行失败"
# 清理环境(如果之前未安装)
if [ "$installed" = false ]; then
LOG_INFO "卸载texlive-ijmart软件包"
dnf remove -y texlive-ijmart
CHECK_RESULT $? 0 0 "卸载texlive-ijmart失败"
fi
LOG_INFO "测试完成Test basic command usage"
}
main "$@"

View File

@@ -1,66 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-09-26
# @License : Mulan PSL v2
# @Desc : Test package installation
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本test_texlive-ijmart_function_install
LOG_INFO "开始测试软件包安装功能"
# 检查是否已安装软件包
LOG_INFO "检查软件包是否已安装"
if dnf list installed texlive-ijmart &>/dev/null; then
LOG_INFO "软件包已安装,跳过安装步骤"
INSTALLED=true
else
LOG_INFO "软件包未安装,准备安装"
INSTALLED=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否存在texlive-ijmart软件包"
if ! dnf list available texlive-ijmart &>/dev/null; then
LOG_ERROR "yum源中不存在texlive-ijmart软件包"
exit 255
fi
# 如果未安装,则执行安装
if [ "$INSTALLED" = false ]; then
LOG_INFO "开始安装texlive-ijmart软件包"
dnf install -y texlive-ijmart
CHECK_RESULT $? 0 0 "安装texlive-ijmart失败"
fi
# 测试命令参数是否支持假设命令为texlive-ijmart --version
LOG_INFO "测试命令参数是否支持"
texlive-ijmart --version &>/dev/null
CHECK_RESULT $? 0 0 "命令参数不支持或命令执行失败"
# 如果脚本开始时未安装,则在结束时卸载
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-ijmart软件包"
dnf remove -y texlive-ijmart
CHECK_RESULT $? 0 0 "卸载texlive-ijmart失败"
fi
LOG_INFO "测试完成,环境已恢复"
}
main "$@"

View File

@@ -1,71 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-11-26
# @License : Mulan PSL v2
# @Desc : Test installation of texlive-selnolig package
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test installation of texlive-selnolig package"
# 检查yum源中是否存在texlive-selnolig包
LOG_INFO "检查yum源中是否存在texlive-selnolig包"
dnf list available texlive-selnolig > /dev/null 2>&1
if [ $? -ne 0 ]; then
LOG_ERROR "yum源中不存在texlive-selnolig包"
exit 255
fi
# 检查是否已安装texlive-selnolig包
LOG_INFO "检查是否已安装texlive-selnolig包"
rpm -q texlive-selnolig > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_INFO "texlive-selnolig包已安装测试结束后将保持安装状态"
INSTALLED=true
else
LOG_INFO "texlive-selnolig包未安装测试结束后将卸载"
INSTALLED=false
fi
# 若未安装则安装texlive-selnolig包
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装texlive-selnolig包"
dnf install -y texlive-selnolig > /dev/null 2>&1
CHECK_RESULT $? 0 0 "安装texlive-selnolig包失败"
fi
# 测试命令参数是否存在或不支持
LOG_INFO "测试命令参数是否存在或不支持"
texlua --help > /dev/null 2>&1
CHECK_RESULT $? 0 255 "texlua命令参数不支持"
# 执行测试命令
LOG_INFO "执行测试命令texlua --version"
texlua --version > /dev/null 2>&1
CHECK_RESULT $? 0 0 "执行texlua --version失败"
# 若未安装则卸载texlive-selinux包
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载texlive-selinux包"
dnf remove -y texlive-selinux > /dev/null 2>&1
CHECK_RESULT $? 0 0 "卸载texlive-selinux包失败"
fi
LOG_INFO "测试完成Test installation of texlive-selnolig package"
}
main "$@"

View File

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

View File

@@ -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-10-04
# @License : Mulan PSL v2
# @Desc : Test basic command usage
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
# 测试脚本test_texlive-timbreicmc_function_basic
LOG_INFO "开始测试Test basic command usage"
# 检查软件包是否已安装
LOG_INFO "检查软件包是否已安装"
dnf list installed texlive-timbreicmc &>/dev/null
if [ $? -eq 0 ]; then
LOG_INFO "软件包已安装,脚本结束时保持安装状态"
already_installed=true
else
LOG_INFO "软件包未安装,将在测试结束后卸载"
already_installed=false
fi
# 检查yum源中是否有该软件包
LOG_INFO "检查yum源中是否有texlive-timbreicmc软件包"
dnf list available texlive-timbreicmc &>/dev/null
CHECK_RESULT $? 0 255 "yum源中不存在texlive-timbreicmc软件包"
# 安装软件包
if [ "$already_installed" = false ]; then
LOG_INFO "安装texlive-timbreicmc软件包"
dnf install -y texlive-timbreicmc
CHECK_RESULT $? 0 0 "安装texlive-timbreicmc失败"
fi
# 测试基本命令用法
LOG_INFO "测试基本命令用法"
texlive-timbreicmc --help &>/dev/null
CHECK_RESULT $? 0 255 "texlive-timbreicmc命令不支持--help参数或执行失败"
# 清理环境(如果之前未安装)
if [ "$already_installed" = false ]; then
LOG_INFO "卸载texlive-timbreicmc软件包"
dnf remove -y texlive-timbreicmc
CHECK_RESULT $? 0 0 "卸载texlive-timbreicmc失败"
fi
LOG_INFO "测试完成Test basic command usage"
}
main "$@"