diff --git a/suite2cases/function_test/pkg_test/dpdk/dpdk.json b/suite2cases/function_test/pkg_test/dpdk/dpdk.json index c9853239978..9c54f7c80c9 100644 --- a/suite2cases/function_test/pkg_test/dpdk/dpdk.json +++ b/suite2cases/function_test/pkg_test/dpdk/dpdk.json @@ -38,10 +38,6 @@ { "name": "test_dpdk_dpdk-devbind__status_dev_crypto", "desc": "打印加密设备的当前状态" - }, - { - "name": "test_dpdk_function_devbind_status", - "desc": "测试dpdk-devbind命令查看所有网络设备状态的功能。" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/drbd/drbd-xen.json b/suite2cases/function_test/pkg_test/drbd/drbd-xen.json index da6305014f8..806bd5e4a41 100644 --- a/suite2cases/function_test/pkg_test/drbd/drbd-xen.json +++ b/suite2cases/function_test/pkg_test/drbd/drbd-xen.json @@ -2,29 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/drbd/drbd-xen", "machine num": 1, "cases": [ - { - "name": "test_drbd-xen_function_install", - "desc": "测试软件包drbd-xen的安装功能,验证其是否能成功安装到系统中。" - }, { "name": "test_drbd-xen_function_remove", "desc": "测试软件包drbd-xen的卸载功能,验证其是否能被完全且干净地移除。" - }, - { - "name": "test_drbd-xen_function_status", - "desc": "测试drbd-xen相关服务(如drbd)的状态查询功能。" - }, - { - "name": "test_drbd-xen_function_primary", - "desc": "测试将drbd资源设置为Primary角色的功能。" - }, - { - "name": "test_drbd-xen_function_secondary", - "desc": "测试将drbd资源设置为Secondary角色的功能。" - }, - { - "name": "test_drbd-xen_function_verify_conf", - "desc": "测试验证drbd-xen配置文件语法正确性的功能。" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts.json b/suite2cases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts.json deleted file mode 100644 index 3b1cb3b3a14..00000000000 --- a/suite2cases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts", - "machine num": 1, - "cases": [ - { - "name": "test_google-noto-sans-cham-fonts_function_install", - "desc": "测试google-noto-sans-cham-fonts软件包能否被成功安装。" - }, - { - "name": "test_google-noto-sans-cham-fonts_function_uninstall", - "desc": "测试google-noto-sans-cham-fonts软件包能否被成功卸载。" - }, - { - "name": "test_google-noto-sans-cham-fonts_function_font_file", - "desc": "测试软件包安装后,主要的Cham字体文件(如NotoSansCham-Regular.ttf)是否存在于系统字体目录中。" - }, - { - "name": "test_google-noto-sans-cham-fonts_function_font_list", - "desc": "测试系统字体缓存或列表中是否包含Noto Sans Cham字体。" - }, - { - "name": "test_google-noto-sans-cham-fonts_function_display", - "desc": "测试能否使用Noto Sans Cham字体渲染基本的占语(Cham)字符。" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/hadoop/hadoop-yarn.json b/suite2cases/function_test/pkg_test/hadoop/hadoop-yarn.json index 2b792d2e271..3f185cb110e 100644 --- a/suite2cases/function_test/pkg_test/hadoop/hadoop-yarn.json +++ b/suite2cases/function_test/pkg_test/hadoop/hadoop-yarn.json @@ -2,293 +2,13 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/hadoop/hadoop-yarn", "machine num": 1, "cases": [ - { - "name": "test_hadoop-yarn_container-executor_upper_v", - "desc": "测试 container-executor 命令的 -V 参数" - }, - { - "name": "test_hadoop-yarn_oom-listener_default", - "desc": "测试 oom-listener 命令的默认行为" - }, - { - "name": "test_hadoop-yarn_test-container-executor_help", - "desc": "测试帮助命令" - }, { "name": "test_hadoop-yarn_yarn_--help", "desc": "测试 yarn 命令的 --help 参数,验证是否能正确显示帮助信息" }, - { - "name": "test_hadoop-yarn_yarn_--debug", - "desc": "测试 yarn 命令的 --debug 参数,验证是否能正确开启调试模式" - }, - { - "name": "test_hadoop-yarn_yarn_--config_dir", - "desc": "测试 yarn 命令的 --config 参数,验证是否能正确指定 Hadoop 配置目录" - }, - { - "name": "test_hadoop-yarn_yarn_--daemon_start", - "desc": "测试 yarn 命令的 --daemon start 参数,验证是否能正确启动守护进程" - }, - { - "name": "test_hadoop-yarn_yarn_--daemon_status", - "desc": "测试 yarn 命令的 --daemon status 参数,验证是否能正确查看守护进程状态" - }, - { - "name": "test_hadoop-yarn_yarn_--daemon_stop", - "desc": "测试 yarn 命令的 --daemon stop 参数,验证是否能正确停止守护进程" - }, - { - "name": "test_hadoop-yarn_yarn_--loglevel_level", - "desc": "测试 yarn 命令的 --loglevel 参数,验证是否能正确设置日志级别" - }, - { - "name": "test_hadoop-yarn_function_resourcemanager", - "desc": "测试 resourcemanager 功能是否正常启动和运行" - }, - { - "name": "test_hadoop-yarn_test-container-executor__help", - "desc": "测试 test-container-executor 命令的帮助文档功能" - }, - { - "name": "test_hadoop-yarn_yarn_--hostnames_list_of_host_names", - "desc": "测试 yarn 命令的 --hostnames 参数,指定工作模式下的主机列表" - }, - { - "name": "test_hadoop-yarn_yarn_--hosts_filename", - "desc": "测试 yarn 命令的 --hosts 参数,指定工作模式下的主机文件列表" - }, { "name": "test_hadoop-yarn_yarn_--workers", "desc": "测试 yarn 命令的 --workers 参数,开启工作模式" - }, - { - "name": "test_hadoop-yarn_function_nodemanager", - "desc": "测试 nodemanager 功能是否正常启动和运行" - }, - { - "name": "test_hadoop-yarn_container-executor_help", - "desc": "测试container-executor命令的help参数,用于显示帮助信息" - }, - { - "name": "test_hadoop-yarn_container-executor_version", - "desc": "测试container-executor命令的version参数,用于显示版本信息" - }, - { - "name": "test_hadoop-yarn_oom-listener__upper_v", - "desc": "使用-V参数运行oom-listener命令,验证其版本信息显示功能" - }, - { - "name": "test_hadoop-yarn_oom-listener__v", - "desc": "使用-v参数运行oom-listener命令,验证其详细信息输出功能" - }, - { - "name": "test_hadoop-yarn_test-container-executor__upper_v", - "desc": "测试使用-V参数显示版本信息" - }, - { - "name": "test_hadoop-yarn_test-container-executor__h", - "desc": "测试使用-h参数显示帮助信息" - }, - { - "name": "test_hadoop-yarn_test-container-executor__upper_r", - "desc": "测试使用-R参数指定运行模式" - }, - { - "name": "test_hadoop-yarn_test-container-executor__upper_d", - "desc": "测试使用-D参数指定配置属性" - }, - { - "name": "test_hadoop-yarn_test-container-executor__upper_u", - "desc": "测试使用-U参数指定用户" - }, - { - "name": "test_hadoop-yarn_yarn__help", - "desc": "测试yarn命令的帮助信息" - }, - { - "name": "test_hadoop-yarn_yarn__daemon_start", - "desc": "测试以守护进程模式启动yarn" - }, - { - "name": "test_hadoop-yarn_yarn__daemon_stop", - "desc": "测试停止yarn守护进程" - }, - { - "name": "test_hadoop-yarn_yarn__daemon_status", - "desc": "测试查看yarn守护进程状态" - }, - { - "name": "test_hadoop-yarn_yarn__config_dir", - "desc": "测试指定Hadoop配置目录" - }, - { - "name": "test_hadoop-yarn_yarn__debug", - "desc": "测试开启shell脚本调试模式" - }, - { - "name": "test_hadoop-yarn_yarn__loglevel_level", - "desc": "测试设置命令的日志级别" - }, - { - "name": "test_hadoop-yarn_yarn__workers", - "desc": "测试开启工作节点模式" - }, - { - "name": "test_hadoop-yarn_yarn__hostnames_list", - "desc": "测试指定工作节点模式下的主机列表" - }, - { - "name": "test_hadoop-yarn_yarn__hosts_filename", - "desc": "测试指定包含工作节点主机列表的文件" - }, - { - "name": "test_hadoop-yarn_yarn_app", - "desc": "测试查看应用程序报告" - }, - { - "name": "test_hadoop-yarn_yarn_application", - "desc": "测试查看应用程序报告(长格式)" - }, - { - "name": "test_hadoop-yarn_yarn_applicationattempt", - "desc": "测试查看应用程序尝试报告" - }, - { - "name": "test_hadoop-yarn_yarn_classpath", - "desc": "测试打印运行hadoop jar所需的类路径" - }, - { - "name": "test_hadoop-yarn_yarn_cluster", - "desc": "测试打印集群信息" - }, - { - "name": "test_hadoop-yarn_yarn_container", - "desc": "测试打印容器报告" - }, - { - "name": "test_hadoop-yarn_yarn_envvars", - "desc": "测试显示计算出的Hadoop环境变量" - }, - { - "name": "test_hadoop-yarn_yarn_jar_jar", - "desc": "测试运行一个jar文件" - }, - { - "name": "test_hadoop-yarn_yarn_logs", - "desc": "测试转储容器日志" - }, - { - "name": "test_hadoop-yarn_yarn_node", - "desc": "测试打印节点报告" - }, - { - "name": "test_hadoop-yarn_yarn_nodeattributes", - "desc": "测试节点属性命令行客户端" - }, - { - "name": "test_hadoop-yarn_yarn_queue", - "desc": "测试打印队列信息" - }, - { - "name": "test_hadoop-yarn_yarn_rmadmin", - "desc": "测试运行资源管理器管理工具" - }, - { - "name": "test_hadoop-yarn_yarn_schedulerconf", - "desc": "测试更新调度器配置" - }, - { - "name": "test_hadoop-yarn_yarn_top", - "desc": "测试查看集群信息(top命令)" - }, - { - "name": "test_hadoop-yarn_yarn_version", - "desc": "测试打印yarn版本信息" - }, - { - "name": "test_hadoop-yarn_yarn_daemonlog", - "desc": "测试获取/设置每个守护进程的日志级别" - }, - { - "name": "test_hadoop-yarn_yarn_scmadmin", - "desc": "测试共享缓存管理器管理工具" - }, - { - "name": "test_hadoop-yarn_yarn_fs2cs", - "desc": "测试将公平调度器配置转换为容量调度器配置(实验性)" - }, - { - "name": "test_hadoop-yarn_yarn_timelinereader", - "desc": "测试运行时间轴读取器服务器" - }, - { - "name": "test_hadoop-yarn_yarn_nodemanager", - "desc": "测试在每个工作节点上运行节点管理器" - }, - { - "name": "test_hadoop-yarn_yarn_proxyserver", - "desc": "测试运行Web应用程序代理服务器" - }, - { - "name": "test_hadoop-yarn_yarn_registrydns", - "desc": "测试运行注册表DNS服务器" - }, - { - "name": "test_hadoop-yarn_yarn_resourcemanager", - "desc": "测试运行资源管理器" - }, - { - "name": "test_hadoop-yarn_yarn_router", - "desc": "测试运行路由器守护进程" - }, - { - "name": "test_hadoop-yarn_yarn_sharedcachemanager", - "desc": "测试运行共享缓存管理器守护进程" - }, - { - "name": "test_hadoop-yarn_yarn_timelineserver", - "desc": "测试运行时间轴服务器" - }, - { - "name": "test_hadoop-yarn_function_install", - "desc": "测试软件包安装功能" - }, - { - "name": "test_hadoop-yarn_function_uninstall", - "desc": "测试软件包卸载功能" - }, - { - "name": "test_hadoop-yarn_function_check_installed", - "desc": "测试检查软件包是否已安装" - }, - { - "name": "test_hadoop-yarn_function_start_rm", - "desc": "测试启动资源管理器服务" - }, - { - "name": "test_hadoop-yarn_function_start_nm", - "desc": "测试启动节点管理器服务" - }, - { - "name": "test_hadoop-yarn_function_submit_job", - "desc": "测试提交YARN作业" - }, - { - "name": "test_hadoop-yarn_function_job_status", - "desc": "测试查询YARN作业状态" - }, - { - "name": "test_hadoop-yarn_function_kill_job", - "desc": "测试终止YARN作业" - }, - { - "name": "test_hadoop-yarn_function_view_logs", - "desc": "测试查看作业容器日志" - }, - { - "name": "test_hadoop-yarn_function_cluster_info", - "desc": "测试查看YARN集群信息" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/hadoop/libhdfs.json b/suite2cases/function_test/pkg_test/hadoop/libhdfs.json deleted file mode 100644 index cfdebf5ecdb..00000000000 --- a/suite2cases/function_test/pkg_test/hadoop/libhdfs.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/hadoop/libhdfs", - "machine num": 1, - "cases": [ - { - "name": "test_libhdfs_function_open", - "desc": "Test opening a file in HDFS" - }, - { - "name": "test_libhdfs_function_read", - "desc": "Test reading a file in HDFS" - }, - { - "name": "test_libhdfs_function_write", - "desc": "Test writing to a file in HDFS" - }, - { - "name": "test_libhdfs_function_close", - "desc": "Test closing a file in HDFS" - }, - { - "name": "test_libhdfs_function_stat", - "desc": "Test getting file status in HDFS" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/kyotocabinet/kyotocabinet-help.json b/suite2cases/function_test/pkg_test/kyotocabinet/kyotocabinet-help.json deleted file mode 100644 index 9272a0a2a3b..00000000000 --- a/suite2cases/function_test/pkg_test/kyotocabinet/kyotocabinet-help.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help", - "machine num": 1, - "cases": [ - { - "name": "test_kyotocabinet-help_function_basic", - "desc": "Test basic functionality of kyotocabinet-help" - }, - { - "name": "test_kyotocabinet-help_function_open", - "desc": "Test opening a database with kyotocabinet-help" - }, - { - "name": "test_kyotocabinet-help_function_set", - "desc": "Test setting a key-value pair" - }, - { - "name": "test_kyotocabinet-help_function_get", - "desc": "Test retrieving a value by key" - }, - { - "name": "test_kyotocabinet-help_function_del", - "desc": "Test deleting a key-value pair" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/libnfs/libnfs-help.json b/suite2cases/function_test/pkg_test/libnfs/libnfs-help.json index 92075752049..f0ea9e65560 100644 --- a/suite2cases/function_test/pkg_test/libnfs/libnfs-help.json +++ b/suite2cases/function_test/pkg_test/libnfs/libnfs-help.json @@ -10,18 +10,6 @@ { "name": "test_libnfs-help_function_uninstall", "desc": "测试libnfs-help软件包的卸载功能,验证是否能够从系统中完全移除。" - }, - { - "name": "test_libnfs-help_function_check_version", - "desc": "测试libnfs-help软件包的版本查询功能,验证能否正确显示其版本信息。" - }, - { - "name": "test_libnfs-help_function_help_info", - "desc": "测试libnfs-help软件包的帮助信息功能,验证执行帮助命令能否正常输出使用说明。" - }, - { - "name": "test_libnfs-help_function_file_exist", - "desc": "测试libnfs-help软件包的核心文件是否存在,验证安装后关键文件(如手册页、文档)是否已部署。" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/librepo/python3-librepo.json b/suite2cases/function_test/pkg_test/librepo/python3-librepo.json index d40c4719ba3..b154a18396b 100644 --- a/suite2cases/function_test/pkg_test/librepo/python3-librepo.json +++ b/suite2cases/function_test/pkg_test/librepo/python3-librepo.json @@ -53,54 +53,6 @@ { "name": "test_python3-librepo_function_install", "desc": "测试软件包安装功能" - }, - { - "name": "test_python3-librepo_function_remove", - "desc": "测试软件包卸载功能" - }, - { - "name": "test_python3-librepo_function_update", - "desc": "测试软件包更新功能" - }, - { - "name": "test_python3-librepo_function_query", - "desc": "测试软件包查询功能" - }, - { - "name": "test_python3-librepo_function_verify", - "desc": "测试软件包完整性验证" - }, - { - "name": "test_python3-librepo_function_repolist", - "desc": "测试列出可用软件仓库" - }, - { - "name": "test_python3-librepo_function_repoconfig", - "desc": "测试仓库配置文件读取" - }, - { - "name": "test_python3-librepo_function_repodata", - "desc": "测试仓库元数据下载" - }, - { - "name": "test_python3-librepo_function_repoclean", - "desc": "测试清理缓存数据" - }, - { - "name": "test_python3-librepo_function_repohandle", - "desc": "测试仓库句柄基本操作" - }, - { - "name": "test_python3-librepo_function_pkgimport", - "desc": "测试导入本地软件包" - }, - { - "name": "test_python3-librepo_function_pkgexport", - "desc": "测试导出软件包信息" - }, - { - "name": "test_python3-librepo_function_pkgverify", - "desc": "测试软件包签名验证" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/openwebbeans/openwebbeans-test.json b/suite2cases/function_test/pkg_test/openwebbeans/openwebbeans-test.json deleted file mode 100644 index 163c4b8f0b9..00000000000 --- a/suite2cases/function_test/pkg_test/openwebbeans/openwebbeans-test.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test", - "machine num": 1, - "cases": [ - { - "name": "test_openwebbeans-test_function_di", - "desc": "Test dependency injection functionality" - }, - { - "name": "test_openwebbeans-test_function_event", - "desc": "Test event handling functionality" - }, - { - "name": "test_openwebbeans-test_function_install", - "desc": "Test installation of the openwebbeans-test package" - }, - { - "name": "test_openwebbeans-test_function_uninstall", - "desc": "Test uninstallation of the openwebbeans-test package" - }, - { - "name": "test_openwebbeans-test_function_version", - "desc": "Test checking the installed package version" - }, - { - "name": "test_openwebbeans-test_function_help", - "desc": "Test accessing the package help or usage information" - }, - { - "name": "test_openwebbeans-test_function_basic_bean", - "desc": "Test basic bean creation and injection" - }, - { - "name": "test_openwebbeans-test_function_scope", - "desc": "Test bean scope functionality (e.g., @ApplicationScoped, @RequestScoped)" - }, - { - "name": "test_openwebbeans-test_function_interceptor", - "desc": "Test interceptor binding and execution" - }, - { - "name": "test_openwebbeans-test_function_alternatives", - "desc": "Test the use of @Alternative and selection" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/p11-kit/p11-kit-help.json b/suite2cases/function_test/pkg_test/p11-kit/p11-kit-help.json index fc63c7e6b44..cb1adad4a25 100644 --- a/suite2cases/function_test/pkg_test/p11-kit/p11-kit-help.json +++ b/suite2cases/function_test/pkg_test/p11-kit/p11-kit-help.json @@ -14,17 +14,9 @@ "name": "test_p11-kit-help_function_check_installed", "desc": "Verify if p11-kit-help is installed" }, - { - "name": "test_p11-kit-help_function_update", - "desc": "Test updating p11-kit-help package" - }, { "name": "test_p11-kit-help_function_verify", "desc": "Verify package integrity and files" - }, - { - "name": "test_p11-kit-help_function_help_content", - "desc": "Check help content availability and format" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/poppler/poppler-utils.json b/suite2cases/function_test/pkg_test/poppler/poppler-utils.json deleted file mode 100644 index ea7604dcd9b..00000000000 --- a/suite2cases/function_test/pkg_test/poppler/poppler-utils.json +++ /dev/null @@ -1,970 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/poppler/poppler-utils", - "machine num": 1, - "cases": [ - { - "name": "test_poppler-utils_pdfattach_replace", - "desc": "测试使用-replace参数替换已存在的同名附件" - }, - { - "name": "test_poppler-utils_pdfattach_upper_v", - "desc": "测试使用-v参数打印版本和版权信息" - }, - { - "name": "test_poppler-utils_pdfattach_h", - "desc": "测试使用-h参数打印帮助信息" - }, - { - "name": "test_poppler-utils_pdfattach_help", - "desc": "测试使用-help参数打印帮助信息" - }, - { - "name": "test_poppler-utils_pdfattach_special_double_help", - "desc": "测试使用--help参数打印帮助信息" - }, - { - "name": "test_poppler-utils_pdfattach_special_question", - "desc": "测试使用-?参数打印帮助信息" - }, - { - "name": "test_poppler-utils_pdfdetach__list", - "desc": "测试pdfdetach命令的-list参数,用于列出PDF文件中所有嵌入文件" - }, - { - "name": "test_poppler-utils_pdfdetach__save_num_1", - "desc": "测试pdfdetach命令的-save参数,用于通过文件编号(如1)保存指定的嵌入文件" - }, - { - "name": "test_poppler-utils_pdfdetach__savefile_filename", - "desc": "测试pdfdetach命令的-savefile参数,用于通过文件名保存指定的嵌入文件" - }, - { - "name": "test_poppler-utils_pdfdetach__saveall", - "desc": "测试pdfdetach命令的-saveall参数,用于保存PDF文件中所有嵌入文件" - }, - { - "name": "test_poppler-utils_pdfdetach__o_outputname", - "desc": "测试pdfdetach命令的-o参数,用于指定保存嵌入文件的输出文件名" - }, - { - "name": "test_poppler-utils_pdfdetach__enc_encoding", - "desc": "测试pdfdetach命令的-enc参数,用于指定输出文本的编码名称" - }, - { - "name": "test_poppler-utils_pdfdetach__opw_ownerpass", - "desc": "测试pdfdetach命令的-opw参数,用于提供加密PDF文件的所有者密码" - }, - { - "name": "test_poppler-utils_pdfdetach__upw_userpass", - "desc": "测试pdfdetach命令的-upw参数,用于提供加密PDF文件的用户密码" - }, - { - "name": "test_poppler-utils_pdfdetach__upper_v", - "desc": "测试pdfdetach命令的-v参数,用于打印版权和版本信息" - }, - { - "name": "test_poppler-utils_pdfdetach__h", - "desc": "测试pdfdetach命令的-h参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdfdetach__help", - "desc": "测试pdfdetach命令的-help参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdfdetach__special__help", - "desc": "测试pdfdetach命令的--help参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdffonts_h", - "desc": "测试pdffonts命令的-h参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdffonts_help", - "desc": "测试pdffonts命令的-help参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdffonts__help", - "desc": "测试pdffonts命令的--help参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdffonts_special_", - "desc": "测试pdffonts命令的-?参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdffonts_v", - "desc": "测试pdffonts命令的-v参数,用于打印版本和版权信息" - }, - { - "name": "test_poppler-utils_pdffonts_f_num_1", - "desc": "测试pdffonts命令的-f参数,指定从第1页开始检查字体" - }, - { - "name": "test_poppler-utils_pdffonts_l_num_10", - "desc": "测试pdffonts命令的-l参数,指定检查到第10页为止" - }, - { - "name": "test_poppler-utils_pdffonts_f_l", - "desc": "测试pdffonts命令的-f和-l参数组合,指定检查第5到第15页的字体" - }, - { - "name": "test_poppler-utils_pdffonts_subst", - "desc": "测试pdffonts命令的-subst参数,用于显示字体替换信息" - }, - { - "name": "test_poppler-utils_pdffonts_opw", - "desc": "测试pdffonts命令的-opw参数,为加密PDF文件提供所有者密码" - }, - { - "name": "test_poppler-utils_pdffonts_upw", - "desc": "测试pdffonts命令的-upw参数,为加密PDF文件提供用户密码" - }, - { - "name": "test_poppler-utils_pdfimages_f", - "desc": "测试 -f 参数,指定从PDF文件的第一页开始提取图像" - }, - { - "name": "test_poppler-utils_pdfimages_l", - "desc": "测试 -l 参数,指定提取PDF文件的最后一页图像" - }, - { - "name": "test_poppler-utils_pdfimages_png", - "desc": "测试 -png 参数,将默认输出格式更改为PNG" - }, - { - "name": "test_poppler-utils_pdfimages_tiff", - "desc": "测试 -tiff 参数,将默认输出格式更改为TIFF" - }, - { - "name": "test_poppler-utils_pdfimages_j", - "desc": "测试 -j 参数,将JPEG图像保存为JPEG文件" - }, - { - "name": "test_poppler-utils_pdfimages_jp2", - "desc": "测试 -jp2 参数,将JPEG2000图像保存为JP2文件" - }, - { - "name": "test_poppler-utils_pdfimages_jbig2", - "desc": "测试 -jbig2 参数,将JBIG2图像保存为JBIG2文件" - }, - { - "name": "test_poppler-utils_pdfimages_ccitt", - "desc": "测试 -ccitt 参数,将CCITT图像保存为CCITT文件" - }, - { - "name": "test_poppler-utils_pdfimages_all", - "desc": "测试 -all 参数,启用所有支持的图像格式输出" - }, - { - "name": "test_poppler-utils_pdfimages_list", - "desc": "测试 -list 参数,列出PDF文件中的图像信息而不保存" - }, - { - "name": "test_poppler-utils_pdfimages_opw", - "desc": "测试 -opw 参数,为加密PDF文件指定所有者密码" - }, - { - "name": "test_poppler-utils_pdfimages_upw", - "desc": "测试 -upw 参数,为加密PDF文件指定用户密码" - }, - { - "name": "test_poppler-utils_pdfimages_p", - "desc": "测试 -p 参数,在输出文件名中包含页码" - }, - { - "name": "test_poppler-utils_pdfimages_q", - "desc": "测试 -q 参数,静默模式,不打印任何消息或错误" - }, - { - "name": "test_poppler-utils_pdfimages_upper_v", - "desc": "测试 -v 参数,打印版权和版本信息" - }, - { - "name": "test_poppler-utils_pdfimages_h", - "desc": "测试 -h 参数,打印使用帮助信息" - }, - { - "name": "test_poppler-utils_pdfimages_help", - "desc": "测试 -help 参数,打印使用帮助信息" - }, - { - "name": "test_poppler-utils_pdfimages_special_help", - "desc": "测试 --help 参数,打印使用帮助信息" - }, - { - "name": "test_poppler-utils_pdfimages_special_question", - "desc": "测试 -? 参数,打印使用帮助信息" - }, - { - "name": "test_poppler-utils_pdfimages_f_l", - "desc": "测试 -f 和 -l 参数组合,指定提取PDF文件的特定页面范围图像" - }, - { - "name": "test_poppler-utils_pdfinfo__v", - "desc": "测试pdfinfo命令的版本和版权信息输出" - }, - { - "name": "test_poppler-utils_pdfinfo__h", - "desc": "测试pdfinfo命令的用法帮助信息输出" - }, - { - "name": "test_poppler-utils_pdfinfo__help", - "desc": "测试pdfinfo命令的用法帮助信息输出(长格式)" - }, - { - "name": "test_poppler-utils_pdfinfo__question", - "desc": "测试pdfinfo命令的用法帮助信息输出(问号格式)" - }, - { - "name": "test_poppler-utils_pdfinfo_f", - "desc": "测试pdfinfo命令指定起始页码" - }, - { - "name": "test_poppler-utils_pdfinfo_l", - "desc": "测试pdfinfo命令指定结束页码" - }, - { - "name": "test_poppler-utils_pdfinfo_box", - "desc": "测试pdfinfo命令打印页面边界框" - }, - { - "name": "test_poppler-utils_pdfinfo_meta", - "desc": "测试pdfinfo命令以XML格式打印文档元数据" - }, - { - "name": "test_poppler-utils_pdfinfo_custom", - "desc": "测试pdfinfo命令打印自定义和标准元数据" - }, - { - "name": "test_poppler-utils_pdfinfo_js", - "desc": "测试pdfinfo命令打印PDF中的所有JavaScript" - }, - { - "name": "test_poppler-utils_pdfinfo_struct", - "desc": "测试pdfinfo命令打印逻辑文档结构(针对标记文件)" - }, - { - "name": "test_poppler-utils_pdfinfo_struct_text", - "desc": "测试pdfinfo命令打印文档结构及文本内容(针对标记文件)" - }, - { - "name": "test_poppler-utils_pdfinfo_isodates", - "desc": "测试pdfinfo命令以ISO-8601格式打印日期" - }, - { - "name": "test_poppler-utils_pdfinfo_rawdates", - "desc": "测试pdfinfo命令直接从PDF文件打印未解码的日期字符串" - }, - { - "name": "test_poppler-utils_pdfinfo_dests", - "desc": "测试pdfinfo命令打印PDF中的所有命名目标" - }, - { - "name": "test_poppler-utils_pdfinfo_url", - "desc": "测试pdfinfo命令打印PDF对象内的所有URL(不扫描文本内容)" - }, - { - "name": "test_poppler-utils_pdfinfo_enc", - "desc": "测试pdfinfo命令指定输出文本编码" - }, - { - "name": "test_poppler-utils_pdfinfo_listenc", - "desc": "测试pdfinfo命令列出可用编码" - }, - { - "name": "test_poppler-utils_pdfinfo_opw", - "desc": "测试pdfinfo命令指定所有者密码(用于加密文件)" - }, - { - "name": "test_poppler-utils_pdfinfo_upw", - "desc": "测试pdfinfo命令指定用户密码(用于加密文件)" - }, - { - "name": "test_poppler-utils_pdfinfo_f_l", - "desc": "测试pdfinfo命令同时指定起始和结束页码" - }, - { - "name": "test_poppler-utils_pdfinfo_box_meta", - "desc": "测试pdfinfo命令同时打印页面边界框和文档元数据" - }, - { - "name": "test_poppler-utils_pdfinfo_custom_isodates", - "desc": "测试pdfinfo命令同时打印自定义元数据和ISO格式日期" - }, - { - "name": "test_poppler-utils_pdfinfo_enc_opw", - "desc": "测试pdfinfo命令同时指定输出编码和所有者密码" - }, - { - "name": "test_poppler-utils_pdfseparate__v", - "desc": "测试pdfseparate命令的版本信息输出" - }, - { - "name": "test_poppler-utils_pdfseparate__h", - "desc": "测试pdfseparate命令的帮助信息输出" - }, - { - "name": "test_poppler-utils_pdfseparate__help", - "desc": "测试pdfseparate命令的长格式帮助信息输出" - }, - { - "name": "test_poppler-utils_pdfseparate___help", - "desc": "测试pdfseparate命令的双横杠帮助信息输出" - }, - { - "name": "test_poppler-utils_pdfseparate__f__num_1__l__num_5", - "desc": "测试pdfseparate命令提取PDF第1页到第5页的功能" - }, - { - "name": "test_poppler-utils_pdfseparate__f__num_3", - "desc": "测试pdfseparate命令从第3页开始提取PDF页面的功能" - }, - { - "name": "test_poppler-utils_pdfseparate__l__num_10", - "desc": "测试pdfseparate命令提取PDF到第10页为止的功能" - }, - { - "name": "test_poppler-utils_pdfsig_v", - "desc": "测试pdfsig命令的版本和版权信息输出功能" - }, - { - "name": "test_poppler-utils_pdfsig_h", - "desc": "测试pdfsig命令打印帮助信息的功能" - }, - { - "name": "test_poppler-utils_pdfsig_help", - "desc": "测试pdfsig命令打印帮助信息的功能" - }, - { - "name": "test_poppler-utils_pdfsig__upper__upper_help", - "desc": "测试pdfsig命令打印帮助信息的功能" - }, - { - "name": "test_poppler-utils_pdfsig_special_question", - "desc": "测试pdfsig命令打印帮助信息的功能" - }, - { - "name": "test_poppler-utils_pdfsig_list_backends", - "desc": "测试pdfsig命令列出可用加密签名后端的功能" - }, - { - "name": "test_poppler-utils_pdfsig_nssdir", - "desc": "测试pdfsig命令指定NSS数据库目录路径的功能" - }, - { - "name": "test_poppler-utils_pdfsig_nss_pwd", - "desc": "测试pdfsig命令指定NSS数据库访问密码的功能" - }, - { - "name": "test_poppler-utils_pdfsig_nocert", - "desc": "测试pdfsig命令禁用证书验证的功能" - }, - { - "name": "test_poppler-utils_pdfsig_no_ocsp", - "desc": "测试pdfsig命令禁用在线OCSP证书吊销检查的功能" - }, - { - "name": "test_poppler-utils_pdfsig_aia", - "desc": "测试pdfsig命令使用AIA扩展获取证书的功能" - }, - { - "name": "test_poppler-utils_pdfsig_dump", - "desc": "测试pdfsig命令将所有签名转储到当前目录的功能" - }, - { - "name": "test_poppler-utils_pdfsig_add_signature", - "desc": "测试pdfsig命令向文档添加新签名的功能" - }, - { - "name": "test_poppler-utils_pdfsig_new_signature_field_name", - "desc": "测试pdfsig命令为新添加的签名指定字段名称的功能" - }, - { - "name": "test_poppler-utils_pdfsig_sign", - "desc": "测试pdfsig命令在指定签名字段(按名称或编号)对文档进行签名的功能" - }, - { - "name": "test_poppler-utils_pdfsig_etsi", - "desc": "测试pdfsig命令创建ETSI.CAdES.detached类型签名的功能" - }, - { - "name": "test_poppler-utils_pdfsig_backend", - "desc": "测试pdfsig命令指定用于签名/验证的后端的功能" - }, - { - "name": "test_poppler-utils_pdfsig_nick", - "desc": "测试pdfsig命令使用指定昵称/指纹的证书进行签名的功能" - }, - { - "name": "test_poppler-utils_pdfsig_kpw", - "desc": "测试pdfsig命令指定签名密钥密码的功能" - }, - { - "name": "test_poppler-utils_pdfsig_digest", - "desc": "测试pdfsig命令指定摘要算法的功能" - }, - { - "name": "test_poppler-utils_pdfsig_reason", - "desc": "测试pdfsig命令指定签名原因的功能" - }, - { - "name": "test_poppler-utils_pdfsig_list_nicks", - "desc": "测试pdfsig命令列出NSS数据库中可用昵称的功能" - }, - { - "name": "test_poppler-utils_pdfsig_opw", - "desc": "测试pdfsig命令指定所有者密码(用于加密文件)的功能" - }, - { - "name": "test_poppler-utils_pdfsig_upw", - "desc": "测试pdfsig命令指定用户密码(用于加密文件)的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_png", - "desc": "测试pdftocairo生成PNG图片文件的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_jpeg", - "desc": "测试pdftocairo生成JPEG图片文件的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_tiff", - "desc": "测试pdftocairo生成TIFF图片文件的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_ps", - "desc": "测试pdftocairo生成PostScript文件的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_eps", - "desc": "测试pdftocairo生成EPS文件的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_pdf", - "desc": "测试pdftocairo生成PDF文件的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_svg", - "desc": "测试pdftocairo生成SVG文件的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_f_num_1", - "desc": "测试pdftocairo从第1页开始转换的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_l_num_10", - "desc": "测试pdftocairo转换到第10页为止的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_o", - "desc": "测试pdftocairo仅转换奇数页的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_e", - "desc": "测试pdftocairo仅转换偶数页的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_singlefile", - "desc": "测试pdftocairo仅输出第一页且文件名不加页码的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_r_num_300", - "desc": "测试pdftocairo设置输出分辨率为300 PPI的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_scale_to_num_1000", - "desc": "测试pdftocairo缩放页面以适应1000x1000像素框的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_mono", - "desc": "测试pdftocairo生成单色图片的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_gray", - "desc": "测试pdftocairo生成灰度图片的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_transp", - "desc": "测试pdftocairo为PNG图片生成透明背景的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_cropbox", - "desc": "测试pdftocairo使用CropBox而非MediaBox的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_paper_A4", - "desc": "测试pdftocairo设置纸张大小为A4的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_nocrop", - "desc": "测试pdftocairo不裁剪页面至CropBox的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_upper_q", - "desc": "测试pdftocairo静默模式(不输出信息)的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_upper_v", - "desc": "测试pdftocairo打印版本和版权信息的功能" - }, - { - "name": "test_poppler-utils_pdftocairo_h", - "desc": "测试pdftocairo打印帮助信息的功能" - }, - { - "name": "test_poppler-utils_pdftohtml_f", - "desc": "测试-f参数,指定转换的起始页码" - }, - { - "name": "test_poppler-utils_pdftohtml_l", - "desc": "测试-l参数,指定转换的结束页码" - }, - { - "name": "test_poppler-utils_pdftohtml_q", - "desc": "测试-q参数,不打印任何消息或错误" - }, - { - "name": "test_poppler-utils_pdftohtml_h", - "desc": "测试-h参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftohtml_help", - "desc": "测试-help参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftohtml__help", - "desc": "测试--help参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftohtml_p", - "desc": "测试-p参数,将.pdf链接替换为.html链接" - }, - { - "name": "test_poppler-utils_pdftohtml_c", - "desc": "测试-c参数,生成复杂文档" - }, - { - "name": "test_poppler-utils_pdftohtml_s", - "desc": "测试-s参数,生成包含所有页面的单一文档" - }, - { - "name": "test_poppler-utils_pdftohtml_dataurls", - "desc": "测试-dataurls参数,在HTML中使用data URL而非外部图片" - }, - { - "name": "test_poppler-utils_pdftohtml_i", - "desc": "测试-i参数,忽略图片" - }, - { - "name": "test_poppler-utils_pdftohtml_noframes", - "desc": "测试-noframes参数,不生成框架" - }, - { - "name": "test_poppler-utils_pdftohtml_stdout", - "desc": "测试-stdout参数,使用标准输出" - }, - { - "name": "test_poppler-utils_pdftohtml_zoom", - "desc": "测试-zoom参数,缩放PDF文档" - }, - { - "name": "test_poppler-utils_pdftohtml_xml", - "desc": "测试-xml参数,输出用于XML后处理" - }, - { - "name": "test_poppler-utils_pdftohtml_noroundcoord", - "desc": "测试-noroundcoord参数,不四舍五入坐标(仅限XML输出)" - }, - { - "name": "test_poppler-utils_pdftohtml_hidden", - "desc": "测试-hidden参数,输出隐藏文本" - }, - { - "name": "test_poppler-utils_pdftohtml_nomerge", - "desc": "测试-nomerge参数,不合并段落" - }, - { - "name": "test_poppler-utils_pdftohtml_enc", - "desc": "测试-enc参数,指定输出文本编码名称" - }, - { - "name": "test_poppler-utils_pdftohtml_fmt", - "desc": "测试-fmt参数,指定Splash输出的图片文件格式(png或jpg)" - }, - { - "name": "test_poppler-utils_pdftohtml_upper_v", - "desc": "测试-v参数,打印版权和版本信息" - }, - { - "name": "test_poppler-utils_pdftohtml_opw", - "desc": "测试-opw参数,指定所有者密码(用于加密文件)" - }, - { - "name": "test_poppler-utils_pdftohtml_upw", - "desc": "测试-upw参数,指定用户密码(用于加密文件)" - }, - { - "name": "test_poppler-utils_pdftohtml_nodrm", - "desc": "测试-nodrm参数,覆盖文档DRM设置" - }, - { - "name": "test_poppler-utils_pdftohtml_wbt", - "desc": "测试-wbt参数,指定断词阈值" - }, - { - "name": "test_poppler-utils_pdftohtml_fontfullname", - "desc": "测试-fontfullname参数,输出字体全名" - }, - { - "name": "test_poppler-utils_pdftoppm_f", - "desc": "测试 pdftoppm 命令的 -f 参数,指定从第几页开始转换" - }, - { - "name": "test_poppler-utils_pdftoppm_l", - "desc": "测试 pdftoppm 命令的 -l 参数,指定转换到第几页结束" - }, - { - "name": "test_poppler-utils_pdftoppm_o", - "desc": "测试 pdftoppm 命令的 -o 参数,仅转换奇数页" - }, - { - "name": "test_poppler-utils_pdftoppm_e", - "desc": "测试 pdftoppm 命令的 -e 参数,仅转换偶数页" - }, - { - "name": "test_poppler-utils_pdftoppm_singlefile", - "desc": "测试 pdftoppm 命令的 -singlefile 参数,只转换第一页且文件名不加页码" - }, - { - "name": "test_poppler-utils_pdftoppm_scale-dimension-before-rotation", - "desc": "测试 pdftoppm 命令的 -scale-dimension-before-rotation 参数,对旋转的PDF在旋转前调整尺寸" - }, - { - "name": "test_poppler-utils_pdftoppm_r", - "desc": "测试 pdftoppm 命令的 -r 参数,设置分辨率(DPI)" - }, - { - "name": "test_poppler-utils_pdftoppm_rx", - "desc": "测试 pdftoppm 命令的 -rx 参数,设置X轴分辨率(DPI)" - }, - { - "name": "test_poppler-utils_pdftoppm_ry", - "desc": "测试 pdftoppm 命令的 -ry 参数,设置Y轴分辨率(DPI)" - }, - { - "name": "test_poppler-utils_pdftoppm_scale-to", - "desc": "测试 pdftoppm 命令的 -scale-to 参数,将页面缩放至指定像素的方框内" - }, - { - "name": "test_poppler-utils_pdftoppm_scale-to-x", - "desc": "测试 pdftoppm 命令的 -scale-to-x 参数,将页面水平缩放至指定像素" - }, - { - "name": "test_poppler-utils_pdftoppm_scale-to-y", - "desc": "测试 pdftoppm 命令的 -scale-to-y 参数,将页面垂直缩放至指定像素" - }, - { - "name": "test_poppler-utils_pdftoppm_x", - "desc": "测试 pdftoppm 命令的 -x 参数,设置裁剪区域左上角的X坐标" - }, - { - "name": "test_poppler-utils_pdftoppm_y", - "desc": "测试 pdftoppm 命令的 -y 参数,设置裁剪区域左上角的Y坐标" - }, - { - "name": "test_poppler-utils_pdftoppm_upper_w", - "desc": "测试 pdftoppm 命令的 -W 参数,设置裁剪区域的宽度(像素)" - }, - { - "name": "test_poppler-utils_pdftoppm_upper_h", - "desc": "测试 pdftoppm 命令的 -H 参数,设置裁剪区域的高度(像素)" - }, - { - "name": "test_poppler-utils_pdftoppm_sz", - "desc": "测试 pdftoppm 命令的 -sz 参数,设置正方形裁剪区域的边长(像素)" - }, - { - "name": "test_poppler-utils_pdftoppm_cropbox", - "desc": "测试 pdftoppm 命令的 -cropbox 参数,使用裁剪框而非媒体框" - }, - { - "name": "test_poppler-utils_pdftoppm_hide-annotations", - "desc": "测试 pdftoppm 命令的 -hide-annotations 参数,不显示注释" - }, - { - "name": "test_poppler-utils_pdftoppm_mono", - "desc": "测试 pdftoppm 命令的 -mono 参数,生成单色PBM文件" - }, - { - "name": "test_poppler-utils_pdftoppm_gray", - "desc": "测试 pdftoppm 命令的 -gray 参数,生成灰度PGM文件" - }, - { - "name": "test_poppler-utils_pdftoppm_png", - "desc": "测试 pdftoppm 命令的 -png 参数,生成PNG文件" - }, - { - "name": "test_poppler-utils_pdftoppm_jpeg", - "desc": "测试 pdftoppm 命令的 -jpeg 参数,生成JPEG文件" - }, - { - "name": "test_poppler-utils_pdftoppm_jpegcmyk", - "desc": "测试 pdftoppm 命令的 -jpegcmyk 参数,生成CMYK JPEG文件" - }, - { - "name": "test_poppler-utils_pdftoppm_tiff", - "desc": "测试 pdftoppm 命令的 -tiff 参数,生成TIFF文件" - }, - { - "name": "test_poppler-utils_pdftoppm_q", - "desc": "测试 pdftoppm 命令的 -q 参数,不打印任何消息或错误" - }, - { - "name": "test_poppler-utils_pdftoppm_progress", - "desc": "测试 pdftoppm 命令的 -progress 参数,打印进度信息" - }, - { - "name": "test_poppler-utils_pdftoppm_v", - "desc": "测试 pdftoppm 命令的 -v 参数,打印版权和版本信息" - }, - { - "name": "test_poppler-utils_pdftoppm_h", - "desc": "测试 pdftoppm 命令的 -h 参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftoppm_help", - "desc": "测试 pdftoppm 命令的 -help 参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftoppm__upper_help", - "desc": "测试 pdftoppm 命令的 --help 参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftoppm_special_question", - "desc": "测试 pdftoppm 命令的 -? 参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftops_f", - "desc": "测试 pdftops 命令的 -f 参数,指定起始打印页码" - }, - { - "name": "test_poppler-utils_pdftops_l", - "desc": "测试 pdftops 命令的 -l 参数,指定结束打印页码" - }, - { - "name": "test_poppler-utils_pdftops_level1", - "desc": "测试 pdftops 命令的 -level1 参数,生成 Level 1 PostScript" - }, - { - "name": "test_poppler-utils_pdftops_eps", - "desc": "测试 pdftops 命令的 -eps 参数,生成 Encapsulated PostScript" - }, - { - "name": "test_poppler-utils_pdftops_r", - "desc": "测试 pdftops 命令的 -r 参数,指定光栅化分辨率" - }, - { - "name": "test_poppler-utils_pdftops_paper", - "desc": "测试 pdftops 命令的 -paper 参数,指定纸张大小" - }, - { - "name": "test_poppler-utils_pdftops_duplex", - "desc": "测试 pdftops 命令的 -duplex 参数,启用双面打印" - }, - { - "name": "test_poppler-utils_pdftops_q", - "desc": "测试 pdftops 命令的 -q 参数,不打印任何消息或错误" - }, - { - "name": "test_poppler-utils_pdftops_upper_v", - "desc": "测试 pdftops 命令的 -v 参数,打印版权和版本信息" - }, - { - "name": "test_poppler-utils_pdftops_h", - "desc": "测试 pdftops 命令的 -h 参数,打印使用信息" - }, - { - "name": "test_poppler-utils_pdftops_f_l", - "desc": "测试 pdftops 命令的 -f 和 -l 参数组合,指定打印页码范围" - }, - { - "name": "test_poppler-utils_pdftops_level1_eps", - "desc": "测试 pdftops 命令的 -level1 和 -eps 参数组合,生成 Level 1 封装的 PostScript" - }, - { - "name": "test_poppler-utils_pdftops_r_paper", - "desc": "测试 pdftops 命令的 -r 和 -paper 参数组合,指定分辨率和纸张大小" - }, - { - "name": "test_poppler-utils_pdftops_nocrop_nocenter", - "desc": "测试 pdftops 命令的 -nocrop 和 -nocenter 参数组合,不裁剪页面且不居中" - }, - { - "name": "test_poppler-utils_pdftops_optimizecolorspace", - "desc": "测试 pdftops 命令的 -optimizecolorspace 参数,优化灰色RGB图像的色彩空间" - }, - { - "name": "test_poppler-utils_pdftotext_f", - "desc": "测试指定起始页码进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_l", - "desc": "测试指定结束页码进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_f_l", - "desc": "测试同时指定起始和结束页码进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_r", - "desc": "测试设置分辨率进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_x_y_upper_w_upper_h", - "desc": "测试指定裁剪区域进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_layout", - "desc": "测试保持原始物理布局进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_fixed", - "desc": "测试以固定宽度字体模式进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_raw", - "desc": "测试保持内容流顺序进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_nodiag", - "desc": "测试丢弃对角线文本进行转换" - }, - { - "name": "test_poppler-utils_pdftotext_htmlmeta", - "desc": "测试生成包含元信息的简单HTML文件" - }, - { - "name": "test_poppler-utils_pdftotext_tsv", - "desc": "测试生成包含边界框元信息的简单TSV文件" - }, - { - "name": "test_poppler-utils_pdftotext_enc", - "desc": "测试指定输出文本编码" - }, - { - "name": "test_poppler-utils_pdftotext_listenc", - "desc": "测试列出可用编码" - }, - { - "name": "test_poppler-utils_pdftotext_eol", - "desc": "测试指定输出行尾符" - }, - { - "name": "test_poppler-utils_pdftotext_nopgbrk", - "desc": "测试不在页面间插入分页符" - }, - { - "name": "test_poppler-utils_pdftotext_bbox", - "desc": "测试输出每个单词的边界框和页面尺寸到HTML" - }, - { - "name": "test_poppler-utils_pdftotext_bbox_layout", - "desc": "测试输出包含额外布局边界框数据的HTML" - }, - { - "name": "test_poppler-utils_pdftotext_cropbox", - "desc": "测试使用裁剪框而非媒体框" - }, - { - "name": "test_poppler-utils_pdftotext_colspacing", - "desc": "测试设置列间距判定阈值" - }, - { - "name": "test_poppler-utils_pdftotext_opw", - "desc": "测试使用所有者密码打开加密文件" - }, - { - "name": "test_poppler-utils_pdftotext_upw", - "desc": "测试使用用户密码打开加密文件" - }, - { - "name": "test_poppler-utils_pdftotext_q", - "desc": "测试静默模式,不打印任何信息或错误" - }, - { - "name": "test_poppler-utils_pdftotext_v", - "desc": "测试打印版本和版权信息" - }, - { - "name": "test_poppler-utils_pdftotext_h", - "desc": "测试打印帮助信息" - }, - { - "name": "test_poppler-utils_pdfunite__v", - "desc": "测试pdfunite命令的-v参数,用于打印版本和版权信息" - }, - { - "name": "test_poppler-utils_pdfunite__h", - "desc": "测试pdfunite命令的-h参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdfunite_help", - "desc": "测试pdfunite命令的-help参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdfunite___help", - "desc": "测试pdfunite命令的--help参数,用于打印使用信息" - }, - { - "name": "test_poppler-utils_pdfunite_merge_two_pdfs", - "desc": "测试pdfunite命令合并两个PDF源文件到一个目标PDF文件" - }, - { - "name": "test_poppler-utils_pdfunite_merge_multiple_pdfs", - "desc": "测试pdfunite命令合并多个PDF源文件到一个目标PDF文件" - }, - { - "name": "test_poppler-utils_function_install_check", - "desc": "检查软件包是否已正确安装" - }, - { - "name": "test_poppler-utils_function_pdfinfo_basic", - "desc": "使用pdfinfo命令获取PDF文档基本信息" - }, - { - "name": "test_poppler-utils_function_pdftotext_extract", - "desc": "使用pdftotext命令从PDF中提取文本内容" - }, - { - "name": "test_poppler-utils_function_pdftoppm_convert", - "desc": "使用pdftoppm命令将PDF页面转换为PNG图片" - }, - { - "name": "test_poppler-utils_function_pdfimages_extract", - "desc": "使用pdfimages命令从PDF中提取所有图像" - }, - { - "name": "test_poppler-utils_function_pdftocairo_convert", - "desc": "使用pdftocairo命令将PDF转换为SVG格式" - }, - { - "name": "test_poppler-utils_function_pdfunite_merge", - "desc": "使用pdfunite命令合并多个PDF文件" - }, - { - "name": "test_poppler-utils_function_pdfseparate_split", - "desc": "使用pdfseparate命令将PDF文件拆分为单页文件" - }, - { - "name": "test_poppler-utils_function_pdffonts_list", - "desc": "使用pdffonts命令列出PDF文件中使用的字体" - }, - { - "name": "test_poppler-utils_function_pdfattach_add", - "desc": "使用pdfattach命令向PDF添加附件文件" - }, - { - "name": "test_poppler-utils_function_pdfdetach_list", - "desc": "使用pdfdetach命令列出PDF中的嵌入文件" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/python-docker-pycreds/python3-docker-pycreds.json b/suite2cases/function_test/pkg_test/python-docker-pycreds/python3-docker-pycreds.json deleted file mode 100644 index c3f56ceb5cd..00000000000 --- a/suite2cases/function_test/pkg_test/python-docker-pycreds/python3-docker-pycreds.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-docker-pycreds/python3-docker-pycreds", - "machine num": 1, - "cases": [ - { - "name": "test_python3-docker-pycreds_function_auth", - "desc": "Test authentication functionality" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/python-hug/python3-hug.json b/suite2cases/function_test/pkg_test/python-hug/python3-hug.json index 2dbbd52fc21..de8ea3c8b31 100644 --- a/suite2cases/function_test/pkg_test/python-hug/python3-hug.json +++ b/suite2cases/function_test/pkg_test/python-hug/python3-hug.json @@ -10,217 +10,9 @@ "name": "test_python3-hug_hug__v", "desc": "测试 hug 命令的 -v 参数,显示版本信息" }, - { - "name": "test_python3-hug_hug__f_file", - "desc": "测试 hug 命令的 -f 参数,指定文件" - }, - { - "name": "test_python3-hug_hug__m_module", - "desc": "测试 hug 命令的 -m 参数,指定模块" - }, - { - "name": "test_python3-hug_hug__ho_host", - "desc": "测试 hug 命令的 -ho 参数,指定主机" - }, - { - "name": "test_python3-hug_hug__p_port", - "desc": "测试 hug 命令的 -p 参数,指定端口号" - }, - { - "name": "test_python3-hug_hug__n", - "desc": "测试 hug 命令的 -n 参数,禁用 404 文档" - }, - { - "name": "test_python3-hug_hug__ma", - "desc": "测试 hug 命令的 -ma 参数,手动重载" - }, - { - "name": "test_python3-hug_hug__i_interval", - "desc": "测试 hug 命令的 -i 参数,指定间隔时间" - }, - { - "name": "test_python3-hug_hug__c_command", - "desc": "测试 hug 命令的 -c 参数,指定命令" - }, - { - "name": "test_python3-hug_hug__s", - "desc": "测试 hug 命令的 -s 参数,静默模式" - }, - { - "name": "test_python3-hug_hug-3__h", - "desc": "测试显示帮助信息" - }, - { - "name": "test_python3-hug_hug-3__v", - "desc": "测试显示程序版本号" - }, - { - "name": "test_python3-hug_hug-3__f_file", - "desc": "测试指定文件参数" - }, - { - "name": "test_python3-hug_hug-3__m_module", - "desc": "测试指定模块参数" - }, - { - "name": "test_python3-hug_hug-3__ho_host", - "desc": "测试指定主机参数" - }, - { - "name": "test_python3-hug_hug-3__p_port", - "desc": "测试指定端口参数" - }, - { - "name": "test_python3-hug_hug-3__n", - "desc": "测试禁用404文档参数" - }, - { - "name": "test_python3-hug_hug-3__ma", - "desc": "测试手动重载参数" - }, - { - "name": "test_python3-hug_hug-3__i_interval", - "desc": "测试指定间隔参数" - }, - { - "name": "test_python3-hug_hug-3__c_command", - "desc": "测试指定命令参数" - }, - { - "name": "test_python3-hug_hug-3__s", - "desc": "测试静默模式参数" - }, - { - "name": "test_python3-hug_function_api", - "desc": "测试API接口功能" - }, - { - "name": "test_python3-hug_hug_h", - "desc": "测试显示帮助信息" - }, - { - "name": "test_python3-hug_hug_v", - "desc": "测试显示程序版本号" - }, - { - "name": "test_python3-hug_hug_f", - "desc": "测试指定文件启动" - }, - { - "name": "test_python3-hug_hug_m", - "desc": "测试指定模块启动" - }, - { - "name": "test_python3-hug_hug_ho", - "desc": "测试指定主机地址" - }, - { - "name": "test_python3-hug_hug_p", - "desc": "测试指定端口号" - }, - { - "name": "test_python3-hug_hug_n", - "desc": "测试禁用404文档" - }, - { - "name": "test_python3-hug_hug_ma", - "desc": "测试手动重载模式" - }, - { - "name": "test_python3-hug_hug_i", - "desc": "测试指定轮询间隔" - }, - { - "name": "test_python3-hug_hug_c", - "desc": "测试指定启动命令" - }, - { - "name": "test_python3-hug_hug_s", - "desc": "测试静默模式" - }, - { - "name": "test_python3-hug_hug_f_m", - "desc": "测试同时指定文件和模块" - }, - { - "name": "test_python3-hug_hug_ho_p", - "desc": "测试同时指定主机和端口" - }, - { - "name": "test_python3-hug_hug_n_ma", - "desc": "测试同时禁用404文档并启用手动重载" - }, - { - "name": "test_python3-hug_hug_i_c", - "desc": "测试同时指定轮询间隔和启动命令" - }, - { - "name": "test_python3-hug_hug_s_n", - "desc": "测试同时启用静默模式和禁用404文档" - }, - { - "name": "test_python3-hug_hug_f_ho_p", - "desc": "测试同时指定文件、主机和端口" - }, - { - "name": "test_python3-hug_hug_m_i_s", - "desc": "测试同时指定模块、轮询间隔和静默模式" - }, - { - "name": "test_python3-hug_hug-3__f", - "desc": "测试指定API文件" - }, - { - "name": "test_python3-hug_hug-3__m", - "desc": "测试指定API模块" - }, - { - "name": "test_python3-hug_hug-3__ho", - "desc": "测试指定服务器监听主机" - }, - { - "name": "test_python3-hug_hug-3__p", - "desc": "测试指定服务器监听端口" - }, - { - "name": "test_python3-hug_hug-3__i", - "desc": "测试指定自动重载间隔" - }, { "name": "test_python3-hug_hug-3__c", "desc": "测试指定启动命令" - }, - { - "name": "test_python3-hug_hug-3__f__ho__p", - "desc": "测试组合指定文件、主机和端口启动服务器" - }, - { - "name": "test_python3-hug_function_install", - "desc": "测试软件包安装功能" - }, - { - "name": "test_python3-hug_function_uninstall", - "desc": "测试软件包卸载功能" - }, - { - "name": "test_python3-hug_function_import", - "desc": "测试导入hug模块" - }, - { - "name": "test_python3-hug_function_version", - "desc": "测试获取hug版本号" - }, - { - "name": "test_python3-hug_function_basic_api", - "desc": "测试创建基础API" - }, - { - "name": "test_python3-hug_function_api_cli", - "desc": "测试API命令行接口" - }, - { - "name": "test_python3-hug_function_api_http", - "desc": "测试API HTTP接口" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/python-logutils/help.json b/suite2cases/function_test/pkg_test/python-logutils/help.json deleted file mode 100644 index b9a47c25239..00000000000 --- a/suite2cases/function_test/pkg_test/python-logutils/help.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/python-logutils/help", - "machine num": 1, - "cases": [ - { - "name": "test_help_function_basic", - "desc": "Test basic help functionality" - }, - { - "name": "test_help_function_args", - "desc": "Test help with arguments" - }, - { - "name": "test_help_function_flags", - "desc": "Test help with flags" - }, - { - "name": "test_help_function_output", - "desc": "Test help output format" - }, - { - "name": "test_help_function_error", - "desc": "Test help error handling" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/qt6-qtserialport/qt6-qtserialport-devel.json b/suite2cases/function_test/pkg_test/qt6-qtserialport/qt6-qtserialport-devel.json deleted file mode 100644 index 754d15afa7a..00000000000 --- a/suite2cases/function_test/pkg_test/qt6-qtserialport/qt6-qtserialport-devel.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/qt6-qtserialport/qt6-qtserialport-devel", - "machine num": 1, - "cases": [ - { - "name": "test_qt6-qtserialport-devel_function_serialport", - "desc": "Test serial port basic functionality" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-a/texlive-12many-doc.json b/suite2cases/function_test/pkg_test/texlive-split-a/texlive-12many-doc.json deleted file mode 100644 index 59322c75e0e..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-a/texlive-12many-doc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-a/texlive-12many-doc", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-12many-doc_function_basic", - "desc": "Test basic functionality" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collection-music.json b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collection-music.json deleted file mode 100644 index d84c9364ebc..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collection-music.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-e/texlive-collection-music", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-collection-music_function_package_install", - "desc": "测试 texlive-collection-music 软件包能否成功安装" - }, - { - "name": "test_texlive-collection-music_function_package_remove", - "desc": "测试 texlive-collection-music 软件包能否被完整卸载" - }, - { - "name": "test_texlive-collection-music_function_contains_musictex", - "desc": "测试软件包是否包含核心音乐排版包 musictex 及其相关文件" - }, - { - "name": "test_texlive-collection-music_function_contains_packages", - "desc": "测试软件包是否包含其他常用音乐排版组件(如 musixtex, pmx, lilypond)" - }, - { - "name": "test_texlive-collection-music_function_basic_compile", - "desc": "测试使用软件包中的工具(如 musictex 或 musixtex)能否编译一个简单的乐谱示例文件" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace.json b/suite2cases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace.json index 868d0e27304..f0558e3ce44 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace.json +++ b/suite2cases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace.json @@ -9,14 +9,6 @@ { "name": "test_texlive-mathpunctspace_function_remove", "desc": "Test package removal" - }, - { - "name": "test_texlive-mathpunctspace_function_check", - "desc": "Check package availability" - }, - { - "name": "test_texlive-mathpunctspace_function_usage", - "desc": "Test basic package usage" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc.json b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc.json index d4e4422d050..95078e0b663 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc.json @@ -2,21 +2,9 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc", "machine num": 1, "cases": [ - { - "name": "test_texlive-sf298-doc_function_install", - "desc": "Test package installation" - }, { "name": "test_texlive-sf298-doc_function_remove", "desc": "Test package removal" - }, - { - "name": "test_texlive-sf298-doc_function_check_files", - "desc": "Check if documentation files exist" - }, - { - "name": "test_texlive-sf298-doc_function_latex_compile", - "desc": "Test compiling a sample SF298 form" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-showdim-doc.json b/suite2cases/function_test/pkg_test/texlive-split-v/texlive-showdim-doc.json deleted file mode 100644 index 2582cb8f0af..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-showdim-doc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-showdim-doc", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-showdim-doc_function_dim", - "desc": "Test dimension calculation functionality" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc.json b/suite2cases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc.json deleted file mode 100644 index 3a6421a7278..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-struktex-doc_function_install", - "desc": "Test package installation" - }, - { - "name": "test_texlive-struktex-doc_function_basic", - "desc": "Test basic functionality" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-translation-dcolumn-fr-doc.json b/suite2cases/function_test/pkg_test/texlive-split-x/texlive-translation-dcolumn-fr-doc.json index e23f5b4dd0a..dd142db6ef8 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-x/texlive-translation-dcolumn-fr-doc.json +++ b/suite2cases/function_test/pkg_test/texlive-split-x/texlive-translation-dcolumn-fr-doc.json @@ -6,22 +6,6 @@ "name": "test_texlive-translation-dcolumn-fr-doc_install", "desc": "测试软件包 texlive-translation-dcolumn-fr-doc 的安装功能,验证是否能够成功安装到系统中。", "machine num": 1 - }, - { - "name": "test_texlive-translation-dcolumn-fr-doc_function_install", - "desc": "测试软件包 texlive-translation-dcolumn-fr-doc 的安装功能,验证是否能够通过包管理器成功安装。" - }, - { - "name": "test_texlive-translation-dcolumn-fr-doc_function_uninstall", - "desc": "测试软件包 texlive-translation-dcolumn-fr-doc 的卸载功能,验证是否能够从系统中完全移除。" - }, - { - "name": "test_texlive-translation-dcolumn-fr-doc_function_check_installed", - "desc": "测试验证软件包 texlive-translation-dcolumn-fr-doc 是否已正确安装到系统中。" - }, - { - "name": "test_texlive-translation-dcolumn-fr-doc_function_doc_existence", - "desc": "测试软件包安装后,其核心文档文件(如README、手册)是否存在于预期的系统路径下。" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer.json b/suite2cases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer.json deleted file mode 100644 index 2f6b7a1f9c6..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-hitszbeamer_function_basic", - "desc": "Test basic functionality of texlive-hitszbeamer" - }, - { - "name": "test_texlive-hitszbeamer_function_install", - "desc": "Test installation of texlive-hitszbeamer package" - }, - { - "name": "test_texlive-hitszbeamer_function_uninstall", - "desc": "Test uninstallation of texlive-hitszbeamer package" - }, - { - "name": "test_texlive-hitszbeamer_function_check_installed", - "desc": "Check if texlive-hitszbeamer is installed" - }, - { - "name": "test_texlive-hitszbeamer_function_basic_compile", - "desc": "Test basic compilation with hitszbeamer document class" - }, - { - "name": "test_texlive-hitszbeamer_function_theme_options", - "desc": "Test applying different theme options in hitszbeamer" - }, - { - "name": "test_texlive-hitszbeamer_function_logo_usage", - "desc": "Test logo inclusion functionality in hitszbeamer" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xtab.json b/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xtab.json deleted file mode 100644 index c9ea657d92d..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-z/texlive-xtab.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-z/texlive-xtab", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-xtab_function_install", - "desc": "Test package installation" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/utf8proc/utf8proc-devel.json b/suite2cases/function_test/pkg_test/utf8proc/utf8proc-devel.json index c2e9b0a2141..7e289bb9b53 100644 --- a/suite2cases/function_test/pkg_test/utf8proc/utf8proc-devel.json +++ b/suite2cases/function_test/pkg_test/utf8proc/utf8proc-devel.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/utf8proc/utf8proc-devel", "machine num": 1, "cases": [ - { - "name": "test_utf8proc-devel_function_install", - "desc": "Test installation of utf8proc-devel package" - }, { "name": "test_utf8proc-devel_function_uninstall", "desc": "Test uninstallation of utf8proc-devel package" @@ -17,14 +13,6 @@ { "name": "test_utf8proc-devel_function_library", "desc": "Test presence of library files" - }, - { - "name": "test_utf8proc-devel_function_pkgconfig", - "desc": "Test pkg-config file availability" - }, - { - "name": "test_utf8proc-devel_function_compile", - "desc": "Test basic compile and link with library" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/xstream/xstream-javadoc.json b/suite2cases/function_test/pkg_test/xstream/xstream-javadoc.json deleted file mode 100644 index 9d615b93d56..00000000000 --- a/suite2cases/function_test/pkg_test/xstream/xstream-javadoc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/xstream/xstream-javadoc", - "machine num": 1, - "cases": [ - { - "name": "test_xstream-javadoc_function_parse", - "desc": "Test parsing functionality" - }, - { - "name": "test_xstream-javadoc_function_serialize", - "desc": "Test serialization functionality" - } - ] -} \ No newline at end of file diff --git a/testcases/function_test/pkg_test/dpdk/dpdk/test_dpdk_function_devbind_status.sh b/testcases/function_test/pkg_test/dpdk/dpdk/test_dpdk_function_devbind_status.sh deleted file mode 100644 index 541adb9dacb..00000000000 --- a/testcases/function_test/pkg_test/dpdk/dpdk/test_dpdk_function_devbind_status.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-24 -# @License : Mulan PSL v2 -# @Desc : 测试dpdk-devbind命令查看所有网络设备状态的功能。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试dpdk-devbind命令查看所有网络设备状态的功能" - - LOG_INFO "步骤1:检查dpdk软件包是否已在yum源中" - if ! dnf list available dpdk 2>/dev/null | grep -q dpdk; then - LOG_ERROR "yum源中未找到dpdk软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查dpdk-devbind命令参数是否支持" - if ! dpdk-devbind --help 2>/dev/null | grep -q "\-\-status"; then - LOG_ERROR "dpdk-devbind命令不支持--status参数" - exit 255 - fi - - LOG_INFO "步骤3:检查dpdk是否已安装" - if ! command -v dpdk-devbind &> /dev/null; then - LOG_INFO "dpdk未安装,开始安装" - dnf install -y dpdk - CHECK_RESULT $? 0 0 "dpdk安装失败" - INSTALLED_FLAG=1 - else - LOG_INFO "dpdk已安装" - INSTALLED_FLAG=0 - fi - - LOG_INFO "步骤4:执行dpdk-devbind --status命令查看所有网络设备状态" - dpdk-devbind --status - CHECK_RESULT $? 0 0 "执行dpdk-devbind --status命令失败" - - LOG_INFO "步骤5:环境恢复" - if [ "$INSTALLED_FLAG" -eq 1 ]; then - LOG_INFO "卸载dpdk软件包" - dnf remove -y dpdk - CHECK_RESULT $? 0 0 "dpdk卸载失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_install.sh b/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_install.sh deleted file mode 100644 index 4406e8eb671..00000000000 --- a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_install.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-06 -# @License : Mulan PSL v2 -# @Desc : 测试软件包drbd-xen的安装功能,验证其是否能成功安装到系统中。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PKG_NAME="drbd-xen" - LOG_INFO "开始测试软件包 ${PKG_NAME} 的安装功能" - LOG_INFO "步骤1:检查当前环境是否已安装 ${PKG_NAME}" - rpm -q ${PKG_NAME} > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到 ${PKG_NAME} 已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "检测到 ${PKG_NAME} 未安装,将在测试过程中安装并在结束前卸载" - INSTALLED=0 - fi - LOG_INFO "步骤2:检查 yum 源中是否存在 ${PKG_NAME} 软件包" - dnf list available ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum 源中不存在 ${PKG_NAME} 软件包" - LOG_INFO "步骤3:测试安装 ${PKG_NAME} 软件包" - if [ ${INSTALLED} -eq 0 ]; then - dnf install -y ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 ${PKG_NAME} 失败" - LOG_INFO "安装 ${PKG_NAME} 成功" - else - LOG_INFO "${PKG_NAME} 已安装,跳过安装步骤" - fi - LOG_INFO "步骤4:验证 ${PKG_NAME} 是否成功安装" - rpm -q ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "${PKG_NAME} 未正确安装" - LOG_INFO "步骤5:验证 ${PKG_NAME} 相关命令是否可用" - if command -v drbdadm > /dev/null 2>&1; then - LOG_INFO "drbdadm 命令可用" - else - LOG_ERROR "drbdadm 命令不可用" - exit 255 - fi - LOG_INFO "步骤6:清理测试环境" - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "卸载测试安装的 ${PKG_NAME} 软件包" - dnf remove -y ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 ${PKG_NAME} 失败" - LOG_INFO "卸载 ${PKG_NAME} 成功" - else - LOG_INFO "测试前 ${PKG_NAME} 已安装,保持安装状态" - fi - LOG_INFO "测试完成,${PKG_NAME} 安装功能验证通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_primary.sh b/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_primary.sh deleted file mode 100644 index 4126b23018a..00000000000 --- a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_primary.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-06 -# @License : Mulan PSL v2 -# @Desc : 测试将drbd资源设置为Primary角色的功能。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断环境是否已安装drbd-xen软件包 - LOG_INFO "检查是否已安装drbd-xen软件包" - if dnf list installed drbd-xen &>/dev/null; then - LOG_INFO "drbd-xen已安装,标记为环境已安装状态" - ENV_INSTALLED=1 - else - LOG_INFO "drbd-xen未安装,标记为环境未安装状态" - ENV_INSTALLED=0 - fi - - # 检查yum源中是否有drbd-xen软件包 - LOG_INFO "检查yum源中是否有drbd-xen软件包" - if ! dnf list available drbd-xen &>/dev/null; then - LOG_ERROR "yum源中未找到drbd-xen软件包" - exit 255 - fi - - # 如果环境未安装,则安装drbd-xen - if [ $ENV_INSTALLED -eq 0 ]; then - LOG_INFO "开始安装drbd-xen软件包" - dnf install -y drbd-xen - CHECK_RESULT $? 0 0 "安装drbd-xen失败" - LOG_INFO "drbd-xen安装成功" - fi - - # 检查drbdadm命令是否支持primary参数 - LOG_INFO "检查drbdadm命令是否支持primary参数" - if ! drbdadm primary --help &>/dev/null; then - LOG_ERROR "drbdadm命令不支持primary参数" - exit 255 - fi - - # 创建测试用的drbd资源配置文件 - LOG_INFO "创建测试用的drbd资源配置文件" - cat > /tmp/test-resource.res << EOF - resource test-resource { - device /dev/drbd0; - disk /dev/sdb1; - meta-disk internal; - on node1 { - address 192.168.1.10:7788; - } - on node2 { - address 192.168.1.11:7788; - } - } - EOF - - # 检查配置文件语法 - LOG_INFO "检查drbd配置文件语法" - drbdadm dump test-resource /tmp/test-resource.res - CHECK_RESULT $? 0 0 "drbd配置文件语法检查失败" - - # 模拟将drbd资源设置为Primary角色 - LOG_INFO "模拟将drbd资源设置为Primary角色" - drbdadm primary test-resource --dry-run - CHECK_RESULT $? 0 0 "将drbd资源设置为Primary角色失败" - - # 清理测试配置文件 - LOG_INFO "清理测试配置文件" - rm -f /tmp/test-resource.res - CHECK_RESULT $? 0 0 "清理测试配置文件失败" - - # 如果测试前环境未安装,则卸载drbd-xen - if [ $ENV_INSTALLED -eq 0 ]; then - LOG_INFO "卸载drbd-xen软件包" - dnf remove -y drbd-xen - CHECK_RESULT $? 0 0 "卸载drbd-xen失败" - LOG_INFO "drbd-xen卸载成功" - else - LOG_INFO "保持drbd-xen安装状态" - fi - - LOG_INFO "测试将drbd资源设置为Primary角色的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_secondary.sh b/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_secondary.sh deleted file mode 100644 index a197c232121..00000000000 --- a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_secondary.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-06 -# @License : Mulan PSL v2 -# @Desc : 测试将drbd资源设置为Secondary角色的功能。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称和命令 - PACKAGE_NAME="drbd-xen" - DRBDADM_CMD="/sbin/drbdadm" - RESOURCE_NAME="test_res" - NODE2_IPV4="192.168.1.100" - NODE2_PASSWORD="password" - NODE2_USER="root" - - # 步骤1:检查环境是否已安装软件包 - LOG_INFO "步骤1:检查环境是否已安装软件包" - if dnf list installed | grep -q "$PACKAGE_NAME"; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,脚本结束时将保持安装状态" - INSTALLED="true" - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试过程中安装" - INSTALLED="false" - fi - - # 步骤2:检查yum源中是否有软件包 - LOG_INFO "步骤2:检查yum源中是否有软件包" - if ! dnf list available | grep -q "$PACKAGE_NAME"; then - LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME" - exit 255 - fi - - # 步骤3:安装软件包(如果未安装) - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4:检查drbdadm命令是否存在 - LOG_INFO "步骤4:检查drbdadm命令是否存在" - if [ ! -x "$DRBDADM_CMD" ]; then - LOG_ERROR "命令 $DRBDADM_CMD 不存在或不可执行" - exit 255 - fi - - # 步骤5:检查drbdadm是否支持secondary参数 - LOG_INFO "步骤5:检查drbdadm是否支持secondary参数" - if ! "$DRBDADM_CMD" --help 2>&1 | grep -q "secondary"; then - LOG_ERROR "命令 $DRBDADM_CMD 不支持secondary参数" - exit 255 - fi - - # 步骤6:在第二个服务器上创建测试资源 - LOG_INFO "步骤6:在第二个服务器上创建测试资源" - SSH_CMD "$DRBDADM_CMD create-md $RESOURCE_NAME" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "在第二个服务器上创建测试资源失败" - - # 步骤7:在本地节点设置资源为Secondary角色 - LOG_INFO "步骤7:在本地节点设置资源为Secondary角色" - "$DRBDADM_CMD" secondary "$RESOURCE_NAME" - CHECK_RESULT $? 0 0 "设置资源为Secondary角色失败" - - # 步骤8:验证资源角色是否为Secondary - LOG_INFO "步骤8:验证资源角色是否为Secondary" - ROLE=$("$DRBDADM_CMD" role "$RESOURCE_NAME" | awk "{print $1}") - if [ "$ROLE" = "Secondary" ]; then - LOG_INFO "资源角色已成功设置为Secondary" - else - LOG_ERROR "资源角色设置失败,当前角色为 $ROLE" - exit 1 - fi - - # 步骤9:清理测试资源 - LOG_INFO "步骤9:清理测试资源" - SSH_CMD "$DRBDADM_CMD down $RESOURCE_NAME" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "清理第二个服务器上的测试资源失败" - - # 步骤10:卸载软件包(如果测试前未安装) - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤10:卸载软件包 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_status.sh b/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_status.sh deleted file mode 100644 index 50431d1bb86..00000000000 --- a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_status.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-06 -# @License : Mulan PSL v2 -# @Desc : 测试drbd-xen相关服务(如drbd)的状态查询功能。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装drbd-xen相关软件包 - LOG_INFO "检查是否已安装drbd-xen相关软件包" - rpm -q drbd-xen >/dev/null 2>&1 - installed=$? - - # 定义软件包名称 - PACKAGE_NAME="drbd-xen" - - # 检查yum源中是否有该软件包 - LOG_INFO "检查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 - - # 如果未安装,则安装软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败" - fi - - # 测试drbd服务状态查询功能 - LOG_INFO "测试drbd服务状态查询功能" - systemctl status drbd.service >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "查询drbd服务状态失败" - if [ $? -ne 0 ]; then - LOG_ERROR "drbd服务状态查询失败" - # 根据Linux命令退出码标准含义退出 - exit $? - fi - - LOG_INFO "drbd服务状态查询成功" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME失败" - else - LOG_INFO "保持$PACKAGE_NAME软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_verify_conf.sh b/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_verify_conf.sh deleted file mode 100644 index ad97b90f128..00000000000 --- a/testcases/function_test/pkg_test/drbd/drbd-xen/test_drbd-xen_function_verify_conf.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 : 测试验证drbd-xen配置文件语法正确性的功能。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试验证drbd-xen配置文件语法正确性的功能" - - # 定义软件包名称 - PACKAGE_NAME="drbd-xen" - - # 检查是否已安装 - if rpm -q $PACKAGE_NAME &> /dev/null; then - LOG_INFO "检测到$PACKAGE_NAME已安装,测试完成后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "检测到$PACKAGE_NAME未安装,将在测试过程中安装,并在测试结束后卸载" - INSTALLED_BEFORE_TEST=false - fi - - # 检查yum源中是否存在该软件包 - LOG_INFO "步骤1:检查yum源中是否存在$PACKAGE_NAME软件包" - if ! dnf list available $PACKAGE_NAME &> /dev/null; then - LOG_ERROR "yum源中未找到$PACKAGE_NAME软件包" - exit 255 - fi - LOG_INFO "yum源中存在$PACKAGE_NAME软件包" - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤2:安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败" - LOG_INFO "$PACKAGE_NAME软件包安装成功" - fi - - # 检查drbd-xen命令是否存在 - LOG_INFO "步骤3:检查drbd-xen命令是否可用" - if ! command -v drbd-xen &> /dev/null; then - LOG_ERROR "drbd-xen命令未找到" - exit 255 - fi - LOG_INFO "drbd-xen命令可用" - - # 检查drbd-xen命令是否支持--help参数 - LOG_INFO "步骤4:检查drbd-xen命令是否支持--help参数" - if ! drbd-xen --help &> /dev/null; then - LOG_ERROR "drbd-xen命令不支持--help参数或执行失败" - exit 255 - fi - LOG_INFO "drbd-xen命令支持--help参数" - - # 测试验证配置文件语法正确性的功能 - LOG_INFO "步骤5:测试验证配置文件语法正确性的功能" - # 创建一个临时的正确配置文件 - TEMP_CONF=$(mktemp) - cat > $TEMP_CONF << EOF - resource r0 { - protocol C; - startup { - wfc-timeout 30; - degr-wfc-timeout 15; - } - net { - cram-hmac-alg sha1; - shared-secret "secret"; - } - on node1 { - device /dev/drbd0; - disk /dev/vg0/lv0; - address 192.168.1.1:7788; - meta-disk internal; - } - on node2 { - device /dev/drbd0; - disk /dev/vg0/lv0; - address 192.168.1.2:7788; - meta-disk internal; - } - } - EOF - - # 使用drbd-xen验证配置文件语法 - drbd-xen -c $TEMP_CONF -t - CHECK_RESULT $? 0 0 "验证正确的配置文件语法失败" - - # 创建一个有语法错误的临时配置文件 - TEMP_BAD_CONF=$(mktemp) - cat > $TEMP_BAD_CONF << EOF - resource r0 { - protocol C; - startup { - wfc-timeout 30; - degr-wfc-timeout 15; - } - net { - cram-hmac-alg sha1; - shared-secret "secret"; - } - on node1 { - device /dev/drbd0; - disk /dev/vg0/lv0; - address 192.168.1.1:7788; - meta-disk internal; - # 缺少闭合大括号 - } - EOF - - # 验证有语法错误的配置文件,预期失败 - LOG_INFO "步骤6:测试验证有语法错误的配置文件" - drbd-xen -c $TEMP_BAD_CONF -t - # 检查命令是否执行失败(非零退出码) - if [ $? -eq 0 ]; then - LOG_ERROR "验证有语法错误的配置文件未按预期失败" - CHECK_RESULT 1 0 0 "验证有语法错误的配置文件未按预期失败" - else - LOG_INFO "验证有语法错误的配置文件按预期失败" - CHECK_RESULT $? 0 1 "验证有语法错误的配置文件未按预期失败" - fi - - # 清理临时文件 - LOG_INFO "步骤7:清理临时文件" - rm -f $TEMP_CONF $TEMP_BAD_CONF - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果测试前未安装,则在测试结束后卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = 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 "测试前$PACKAGE_NAME已安装,测试后保持安装状态,无需卸载" - fi - - LOG_INFO "测试验证drbd-xen配置文件语法正确性的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts/test_google-noto-sans-cham-fonts_function_display.sh b/testcases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts/test_google-noto-sans-cham-fonts_function_display.sh deleted file mode 100644 index f11043cecd4..00000000000 --- a/testcases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts/test_google-noto-sans-cham-fonts_function_display.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-04 -# @License : Mulan PSL v2 -# @Desc : 测试能否使用Noto Sans Cham字体渲染基本的占语(Cham)字符。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:测试能否使用Noto Sans Cham字体渲染基本的占语(Cham)字符" - - LOG_INFO "步骤1:检查环境中是否已安装google-noto-sans-cham-fonts软件包" - if rpm -q google-noto-sans-cham-fonts &>/dev/null; then - LOG_INFO "软件包已安装,测试后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在google-noto-sans-cham-fonts软件包" - if ! dnf list available google-noto-sans-cham-fonts &>/dev/null; then - LOG_ERROR "yum源中未找到google-noto-sans-cham-fonts软件包" - exit 255 - fi - - LOG_INFO "步骤3:安装google-noto-sans-cham-fonts软件包" - if [ "$INSTALLED_BEFORE" = false ]; then - dnf install -y google-noto-sans-cham-fonts - CHECK_RESULT $? 0 0 "安装google-noto-sans-cham-fonts失败" - fi - - LOG_INFO "步骤4:检查fc-list命令是否可用" - if ! command -v fc-list &>/dev/null; then - LOG_ERROR "fc-list命令不存在" - if [ "$INSTALLED_BEFORE" = false ]; then - dnf remove -y google-noto-sans-cham-fonts - fi - exit 255 - fi - - LOG_INFO "步骤5:使用fc-list检查Noto Sans Cham字体是否已正确安装并可用" - fc-list | grep -i "Noto Sans Cham" &>/dev/null - CHECK_RESULT $? 0 0 "未找到Noto Sans Cham字体" - - LOG_INFO "步骤6:创建一个简单的占语字符测试文件" - TEST_TEXT="ꨀꨁꨂꨃꨄꨅꨆꨇꨈꨉ" - TEST_FILE="/tmp/cham_test.txt" - echo "$TEST_TEXT" > "$TEST_FILE" - CHECK_RESULT $? 0 0 "创建测试文件失败" - - LOG_INFO "步骤7:使用Noto Sans Cham字体渲染占语字符" - if command -v pango-view &>/dev/null; then - RENDER_OUTPUT="/tmp/cham_render.png" - pango-view --font="Noto Sans Cham" --text="$TEST_TEXT" --output="$RENDER_OUTPUT" --dpi=96 - RENDER_EXIT_CODE=$? - if [ $RENDER_EXIT_CODE -ne 0 ]; then - LOG_ERROR "pango-view渲染失败,退出码: $RENDER_EXIT_CODE" - CHECK_RESULT $RENDER_EXIT_CODE 0 0 "使用pango-view渲染占语字符失败" - else - LOG_INFO "使用pango-view渲染成功" - if [ -f "$RENDER_OUTPUT" ]; then - file "$RENDER_OUTPUT" | grep -q "PNG image" - CHECK_RESULT $? 0 0 "生成的渲染文件不是有效的PNG图像" - LOG_INFO "成功生成PNG格式的渲染图像" - fi - fi - else - LOG_INFO "pango-view命令未找到,尝试使用其他方法验证字体" - LOG_INFO "使用fc-match验证字体" - fc-match "Noto Sans Cham" &>/dev/null - CHECK_RESULT $? 0 0 "fc-match验证Noto Sans Cham字体失败" - fi - - LOG_INFO "步骤8:清理临时测试文件" - rm -f "$TEST_FILE" "$RENDER_OUTPUT" 2>/dev/null - LOG_INFO "临时文件已清理" - - LOG_INFO "步骤9:恢复测试环境" - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载测试安装的google-noto-sans-cham-fonts软件包" - dnf remove -y google-noto-sans-cham-fonts - CHECK_RESULT $? 0 0 "卸载google-noto-sans-cham-fonts失败" - LOG_INFO "环境已恢复至测试前状态" - else - LOG_INFO "环境保持原有安装状态" - fi - - LOG_INFO "测试完成:Noto Sans Cham字体能够正确渲染基本的占语字符" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts/test_google-noto-sans-cham-fonts_function_install.sh b/testcases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts/test_google-noto-sans-cham-fonts_function_install.sh deleted file mode 100644 index 75dc0dcef1e..00000000000 --- a/testcases/function_test/pkg_test/google-noto-fonts/google-noto-sans-cham-fonts/test_google-noto-sans-cham-fonts_function_install.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-04 -# @License : Mulan PSL v2 -# @Desc : 测试google-noto-sans-cham-fonts软件包能否被成功安装。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试google-noto-sans-cham-fonts软件包能否被成功安装。" - - LOG_INFO "步骤1: 检查yum源中是否存在google-noto-sans-cham-fonts软件包" - dnf list available google-noto-sans-cham-fonts > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到google-noto-sans-cham-fonts软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查当前是否已安装google-noto-sans-cham-fonts" - rpm -q google-noto-sans-cham-fonts > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "google-noto-sans-cham-fonts已安装,测试将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "google-noto-sans-cham-fonts未安装,将执行安装测试" - INSTALLED_BEFORE=false - fi - - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤3: 安装google-noto-sans-cham-fonts软件包" - dnf install -y google-noto-sans-cham-fonts - CHECK_RESULT $? 0 0 "安装google-noto-sans-cham-fonts失败" - - LOG_INFO "步骤4: 验证google-noto-sans-cham-fonts安装成功" - rpm -q google-noto-sans-cham-fonts - CHECK_RESULT $? 0 0 "验证google-noto-sans-cham-fonts安装状态失败" - - LOG_INFO "步骤5: 测试完成后卸载google-noto-sans-cham-fonts" - dnf remove -y google-noto-sans-cham-fonts - CHECK_RESULT $? 0 0 "卸载google-noto-sans-cham-fonts失败" - else - LOG_INFO "步骤3: 已安装状态,跳过安装和卸载步骤" - fi - - LOG_INFO "步骤6: 环境恢复检查" - if [ "$INSTALLED_BEFORE" = "true" ]; then - rpm -q google-noto-sans-cham-fonts > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "环境未恢复到初始安装状态" - LOG_INFO "环境已恢复: 保持google-noto-sans-cham-fonts安装状态" - else - rpm -q google-noto-sans-cham-fonts > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "环境未恢复: google-noto-sans-cham-fonts未被正确卸载" - exit 1 - else - LOG_INFO "环境已恢复: google-noto-sans-cham-fonts未安装" - fi - fi - - LOG_INFO "google-noto-sans-cham-fonts软件包安装测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_help.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_help.sh deleted file mode 100644 index d01788c879c..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_help.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试container-executor命令的help参数,用于显示帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查脚本是否以root用户运行 - if [[ $(id -u) -ne 0 ]]; then - LOG_ERROR "此脚本需要root权限运行" - exit 1 - fi - - # 定义软件包名称 - PACKAGE_NAME="hadoop-yarn" - - # 步骤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}软件包" - INSTALLED=false - rpm -q ${PACKAGE_NAME} &>/dev/null - if [[ $? -eq 0 ]]; then - LOG_INFO "${PACKAGE_NAME}软件包已安装" - INSTALLED=true - else - LOG_INFO "${PACKAGE_NAME}软件包未安装" - fi - - # 步骤3: 如果未安装则安装软件包 - if [[ ${INSTALLED} == false ]]; then - LOG_INFO "步骤3: 安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} &>/dev/null - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - LOG_INFO "${PACKAGE_NAME}软件包安装成功" - fi - - # 步骤4: 查找container-executor命令路径 - LOG_INFO "步骤4: 查找container-executor命令路径" - CONTAINER_EXECUTOR_PATH=$(find /usr -name "container-executor" -type f 2>/dev/null | head -1) - if [[ -z "${CONTAINER_EXECUTOR_PATH}" ]]; then - LOG_ERROR "未找到container-executor命令" - exit 1 - fi - LOG_INFO "找到container-executor命令: ${CONTAINER_EXECUTOR_PATH}" - - # 步骤5: 测试container-executor命令的help参数 - LOG_INFO "步骤5: 测试container-executor命令的help参数" - # 尝试使用--help参数 - ${CONTAINER_EXECUTOR_PATH} --help &>/dev/null - HELP_EXIT_CODE=$? - - # 尝试使用-h参数(如果--help失败) - if [[ ${HELP_EXIT_CODE} -ne 0 ]]; then - ${CONTAINER_EXECUTOR_PATH} -h &>/dev/null - HELP_EXIT_CODE=$? - fi - - # 检查help参数是否支持 - if [[ ${HELP_EXIT_CODE} -eq 0 ]]; then - LOG_INFO "container-executor命令支持help参数" - # 实际执行help命令并检查输出 - ${CONTAINER_EXECUTOR_PATH} --help 2>&1 | head -5 &>/dev/null - CHECK_RESULT $? 0 0 "container-executor --help命令执行失败" - LOG_INFO "container-executor --help命令执行成功,显示帮助信息" - elif [[ ${HELP_EXIT_CODE} -eq 255 ]]; then - LOG_ERROR "container-executor命令不支持help参数" - exit 255 - else - LOG_ERROR "container-executor help命令执行失败,退出码: ${HELP_EXIT_CODE}" - exit ${HELP_EXIT_CODE} - fi - - # 步骤6: 清理环境 - LOG_INFO "步骤6: 清理环境" - if [[ ${INSTALLED} == false ]]; then - LOG_INFO "卸载测试安装的${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} &>/dev/null - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - LOG_INFO "${PACKAGE_NAME}软件包卸载成功" - else - LOG_INFO "保持${PACKAGE_NAME}软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_upper_v.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_upper_v.sh deleted file mode 100644 index 69392640a79..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_upper_v.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 container-executor 命令的 -V 参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试脚本:test_hadoop-yarn_container-executor_upper_v - - LOG_INFO "开始测试 container-executor 命令的 -V 参数" - - # 检查环境是否已安装 - LOG_INFO "检查环境是否已安装" - if ! dnf list installed hadoop-yarn > /dev/null 2>&1; then - LOG_INFO "环境未安装,开始安装 hadoop-yarn" - if ! dnf list available hadoop-yarn > /dev/null 2>&1; then - LOG_ERROR "yum源中不存在 hadoop-yarn 软件包" - exit 255 - fi - dnf install -y hadoop-yarn - INSTALLED=true - else - LOG_INFO "环境已安装,跳过安装步骤" - INSTALLED=false - fi - - # 检查 container-executor 命令是否存在 - LOG_INFO "检查 container-executor 命令是否存在" - if ! command -v container-executor > /dev/null 2>&1; then - LOG_ERROR "container-executor 命令不存在" - if [ "$INSTALLED" = true ]; then - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - # 测试 -V 参数 - LOG_INFO "测试 container-executor 命令的 -V 参数" - container-executor -V - CHECK_RESULT $? 0 0 "container-executor -V 执行失败" - - # 清理环境 - if [ "$INSTALLED" = true ]; then - LOG_INFO "清理环境,卸载 hadoop-yarn" - dnf remove -y hadoop-yarn - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_version.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_version.sh deleted file mode 100644 index 46d9f8c653b..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_container-executor_version.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试container-executor命令的version参数,用于显示版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试container-executor命令的version参数功能" - - # 检查是否已安装hadoop-yarn-container-executor - LOG_INFO "检查hadoop-yarn-container-executor是否已安装" - if rpm -q hadoop-yarn-container-executor &> /dev/null; then - LOG_INFO "hadoop-yarn-container-executor已安装,测试完成后将保持安装状态" - ALREADY_INSTALLED=true - else - LOG_INFO "hadoop-yarn-container-executor未安装,将在测试步骤中安装" - ALREADY_INSTALLED=false - fi - - # 检查yum源中是否存在该软件包 - LOG_INFO "检查yum源中是否存在hadoop-yarn-container-executor软件包" - if ! dnf list available hadoop-yarn-container-executor &> /dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn-container-executor软件包" - exit 255 - fi - - # 如果未安装,则进行安装 - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "安装hadoop-yarn-container-executor软件包" - dnf install -y hadoop-yarn-container-executor - CHECK_RESULT $? 0 0 "安装hadoop-yarn-container-executor失败" - fi - - # 检查container-executor命令是否支持version参数 - LOG_INFO "检查container-executor命令是否支持version参数" - if ! container-executor --help 2>&1 | grep -q "\-\-version"; then - LOG_ERROR "container-executor命令不支持version参数" - # 如果测试过程中安装了软件包,需要卸载 - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载hadoop-yarn-container-executor" - dnf remove -y hadoop-yarn-container-executor - fi - exit 255 - fi - - # 执行container-executor --version命令 - LOG_INFO "执行container-executor --version命令" - container-executor --version - CHECK_RESULT $? 0 0 "执行container-executor --version命令失败" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载hadoop-yarn-container-executor" - dnf remove -y hadoop-yarn-container-executor - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-container-executor失败" - else - LOG_INFO "环境已安装,保持安装状态" - fi - - LOG_INFO "测试container-executor命令的version参数完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_check_installed.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_check_installed.sh deleted file mode 100644 index 0bedd77ba69..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_check_installed.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试检查软件包是否已安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:检查hadoop-yarn软件包是否已安装" - LOG_INFO "步骤1:检查yum源中是否存在hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - LOG_INFO "yum源中存在hadoop-yarn软件包" - LOG_INFO "步骤2:检查系统是否已安装hadoop-yarn" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装,将保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,将执行安装操作" - INSTALLED=false - fi - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - LOG_INFO "hadoop-yarn安装成功" - fi - LOG_INFO "步骤4:验证hadoop-yarn安装状态" - rpm -q hadoop-yarn - CHECK_RESULT $? 0 0 "验证hadoop-yarn安装状态失败" - LOG_INFO "hadoop-yarn安装状态验证成功" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤5:卸载hadoop-yarn软件包以恢复环境" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - LOG_INFO "hadoop-yarn卸载成功,环境已恢复" - fi - LOG_INFO "测试完成:检查hadoop-yarn软件包是否已安装" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_cluster_info.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_cluster_info.sh deleted file mode 100644 index 63841660006..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_cluster_info.sh +++ /dev/null @@ -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 : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查看YARN集群信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试查看YARN集群信息功能" - LOG_INFO "检查是否已安装hadoop-yarn" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,将进行安装" - INSTALLED=false - fi - - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - LOG_INFO "检查yarn命令是否存在" - if ! command -v yarn &>/dev/null; then - LOG_ERROR "yarn命令不存在" - exit 255 - fi - - LOG_INFO "查看YARN集群信息" - yarn cluster --list - CHECK_RESULT $? 0 0 "查看YARN集群信息失败" - - LOG_INFO "清理环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_install.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_install.sh deleted file mode 100644 index 81e5ae2721c..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_install.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试软件包安装功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装hadoop-yarn - LOG_INFO "检查hadoop-yarn是否已安装" - rpm -q hadoop-yarn > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到hadoop-yarn软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 安装hadoop-yarn(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装hadoop-yarn" - dnf install -y hadoop-yarn > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "hadoop-yarn安装失败" - if [ $? -ne 0 ]; then - LOG_ERROR "hadoop-yarn安装失败" - exit 1 - fi - LOG_INFO "hadoop-yarn安装成功" - fi - - # 测试hadoop-yarn基本功能 - LOG_INFO "测试hadoop-yarn版本信息" - yarn version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "获取yarn版本信息失败" - - LOG_INFO "测试yarn命令参数" - yarn --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yarn --help命令执行失败" - - # 检查特定参数是否存在 - LOG_INFO "检查yarn命令是否支持node参数" - yarn node --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持node参数" - exit 255 - fi - - LOG_INFO "检查yarn命令是否支持queue参数" - yarn queue --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持queue参数" - exit 255 - fi - - # 清理环境(如果测试前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理测试环境,卸载hadoop-yarn" - dnf remove -y hadoop-yarn > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "hadoop-yarn卸载失败" - if [ $? -ne 0 ]; then - LOG_ERROR "hadoop-yarn卸载失败" - exit 1 - fi - LOG_INFO "hadoop-yarn卸载成功" - else - LOG_INFO "测试前hadoop-yarn已安装,保持安装状态" - fi - - LOG_INFO "hadoop-yarn安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_job_status.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_job_status.sh deleted file mode 100644 index e2b62d10f82..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_job_status.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查询YARN作业状态 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称和命令 - PACKAGE_NAME="hadoop-yarn" - COMMAND="yarn" - SUBCOMMAND="application" - ACTION="-status" - - # 步骤1:检查环境是否已安装 - LOG_INFO "步骤1:检查Hadoop YARN环境是否已安装" - if dnf list installed | grep -q "^${PACKAGE_NAME}\."; then - LOG_INFO "Hadoop YARN已安装,脚本结束时将保持安装状态" - ENV_INSTALLED=true - else - LOG_INFO "Hadoop YARN未安装,将在测试过程中安装,并在结束时卸载" - ENV_INSTALLED=false - fi - - # 步骤2:检查YUM源中是否存在软件包 - LOG_INFO "步骤2:检查YUM源中是否存在${PACKAGE_NAME}软件包" - if ! dnf list available | grep -q "^${PACKAGE_NAME}\."; then - LOG_ERROR "YUM源中不存在${PACKAGE_NAME}软件包" - exit 255 - fi - - # 步骤3:如果环境未安装,则安装软件包 - if [ "$ENV_INSTALLED" = false ]; then - LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 步骤4:检查yarn命令是否支持application -status参数 - LOG_INFO "步骤4:检查yarn命令是否支持application -status参数" - if ! ${COMMAND} ${SUBCOMMAND} --help 2>/dev/null | grep -q "\-status"; then - LOG_ERROR "yarn命令不支持application -status参数" - exit 255 - fi - - # 步骤5:启动YARN服务(如果未运行) - LOG_INFO "步骤5:检查并启动YARN服务" - if ! systemctl is-active --quiet resourcemanager; then - systemctl start resourcemanager - CHECK_RESULT $? 0 0 "启动YARN ResourceManager失败" - sleep 5 - fi - - # 步骤6:提交一个测试作业 - LOG_INFO "步骤6:提交一个测试作业到YARN" - TEST_JOB_ID=$(yarn jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar pi 1 10 2>&1 | grep -oP "application_\d+_\d+") - if [ -z "$TEST_JOB_ID" ]; then - LOG_ERROR "提交测试作业失败" - exit 1 - fi - LOG_INFO "测试作业提交成功,作业ID: ${TEST_JOB_ID}" - - # 步骤7:测试查询YARN作业状态 - LOG_INFO "步骤7:测试查询YARN作业状态" - ${COMMAND} ${SUBCOMMAND} ${ACTION} ${TEST_JOB_ID} - CHECK_RESULT $? 0 0 "查询YARN作业状态失败" - - # 步骤8:清理测试作业 - LOG_INFO "步骤8:清理测试作业" - yarn application -kill ${TEST_JOB_ID} 2>/dev/null - - # 步骤9:停止YARN服务(如果之前是脚本启动的) - LOG_INFO "步骤9:停止YARN服务" - if [ "$ENV_INSTALLED" = false ]; then - systemctl stop resourcemanager 2>/dev/null - fi - - # 步骤10:如果环境是脚本安装的,则卸载软件包 - if [ "$ENV_INSTALLED" = false ]; then - LOG_INFO "步骤10:卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_kill_job.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_kill_job.sh deleted file mode 100644 index 7e96c7ec1f5..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_kill_job.sh +++ /dev/null @@ -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-18 -# @License : Mulan PSL v2 -# @Desc : 测试终止YARN作业 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:终止YARN作业" - - # 检查环境是否已安装Hadoop YARN - LOG_INFO "检查Hadoop YARN是否已安装" - if dnf list installed hadoop-yarn &> /dev/null; then - LOG_INFO "Hadoop YARN已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "Hadoop YARN未安装,将在测试中安装" - INSTALLED=false - fi - - # 检查YUM源中是否有hadoop-yarn软件包 - LOG_INFO "检查YUM源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &> /dev/null; then - LOG_ERROR "YUM源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 启动YARN服务 - LOG_INFO "启动YARN服务" - systemctl start yarn-resourcemanager - CHECK_RESULT $? 0 0 "启动YARN服务失败" - - # 提交一个示例作业到YARN - LOG_INFO "提交一个示例作业到YARN" - yarn jar /usr/share/hadoop/mapreduce/hadoop-mapreduce-examples.jar pi 1 1 > /tmp/yarn_job_output.txt 2>&1 & - JOB_PID=$! - CHECK_RESULT $? 0 0 "提交YARN作业失败" - - # 等待作业开始运行 - LOG_INFO "等待作业开始运行" - sleep 10 - - # 获取作业ID - LOG_INFO "获取作业ID" - JOB_ID=$(yarn application -list | grep "application_" | awk "{print $1}" | head -n 1) - if [ -z "$JOB_ID" ]; then - LOG_ERROR "未找到YARN作业ID" - exit 1 - fi - - # 终止YARN作业 - LOG_INFO "终止YARN作业:$JOB_ID" - yarn application -kill $JOB_ID - CHECK_RESULT $? 0 0 "终止YARN作业失败" - - # 验证作业是否已终止 - LOG_INFO "验证作业是否已终止" - yarn application -status $JOB_ID 2>&1 | grep -q "FINISHED\|KILLED\|FAILED" - CHECK_RESULT $? 0 0 "作业未正确终止" - - # 停止YARN服务 - LOG_INFO "停止YARN服务" - systemctl stop yarn-resourcemanager - CHECK_RESULT $? 0 0 "停止YARN服务失败" - - # 如果测试前未安装,则卸载hadoop-yarn - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成:终止YARN作业" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_nodemanager.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_nodemanager.sh deleted file mode 100644 index 4ae627cf58b..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_nodemanager.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-01 -# @License : Mulan PSL v2 -# @Desc : 测试 nodemanager 功能是否正常启动和运行 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试脚本:test_hadoop-yarn_function_nodemanager - - # 步骤1:检查是否已安装hadoop-yarn-nodemanager - LOG_INFO "检查是否已安装hadoop-yarn-nodemanager" - if dnf list installed hadoop-yarn-nodemanager &> /dev/null; then - LOG_INFO "hadoop-yarn-nodemanager已安装" - INSTALLED=true - else - LOG_INFO "hadoop-yarn-nodemanager未安装" - INSTALLED=false - fi - - # 步骤2:检查yum源中是否存在hadoop-yarn-nodemanager软件包 - LOG_INFO "检查yum源中是否存在hadoop-yarn-nodemanager软件包" - if ! dnf list available hadoop-yarn-nodemanager &> /dev/null; then - LOG_ERROR "yum源中不存在hadoop-yarn-nodemanager软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装hadoop-yarn-nodemanager - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装hadoop-yarn-nodemanager" - dnf install -y hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "安装hadoop-yarn-nodemanager失败" - fi - - # 步骤4:启动nodemanager服务 - LOG_INFO "启动nodemanager服务" - systemctl start hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "启动nodemanager服务失败" - - # 步骤5:检查nodemanager服务状态 - LOG_INFO "检查nodemanager服务状态" - systemctl status hadoop-yarn-nodemanager &> /dev/null - CHECK_RESULT $? 0 0 "nodemanager服务未正常运行" - - # 步骤6:测试nodemanager功能是否正常(例如通过jps命令检查) - LOG_INFO "测试nodemanager功能是否正常" - jps | grep NodeManager &> /dev/null - CHECK_RESULT $? 0 0 "nodemanager功能异常" - - # 步骤7:停止nodermaner服务 - LOG_INFO "停止nodemanage服务" - systemctl stop hadoop-yarm-nodeamanger - CHECK_RESULT $? 0 0 "停止nodemanger服务失败" - - # 环境恢复:如果脚本开始时未安装,则卸载hadooep-yaen-noedmanger - if [ "$INSTALLED" = false ]; then - LOG_INFO “卸载hadooep-yaen-noedmanger” - dnf remove -y hadooep-yaen-noedmanger - CHECK_RESULT $? O O “卸载hadooep-yaen-noedmanger失败” - fi - - LOG_INFO “测试完成” - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_resourcemanager.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_resourcemanager.sh deleted file mode 100644 index cbdc1c45ad5..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_resourcemanager.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 resourcemanager 功能是否正常启动和运行 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装hadoop-yarn-resourcemanager - LOG_INFO "检查是否已安装hadoop-yarn-resourcemanager" - dnf list installed hadoop-yarn-resourcemanager > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn-resourcemanager已安装" - INSTALLED=true - else - LOG_INFO "hadoop-yarn-resourcemanager未安装" - INSTALLED=false - fi - - # 检查yum源中是否有hadoop-yarn-resourcemanager软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn-resourcemanager软件包" - dnf list available hadoop-yarn-resourcemanager > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn-resourcemanager软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装hadoop-yarn-resourcemanager" - dnf install -y hadoop-yarn-resourcemanager > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装hadoop-yarn-resourcemanager失败" - fi - - # 启动resourcemanager服务 - LOG_INFO "启动resourcemanager服务" - systemctl start hadoop-yarn-resourcemanager > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "启动resourcemanager服务失败" - - # 检查resourcemanager服务状态 - LOG_INFO "检查resourcemanager服务状态" - systemctl status hadoop-yarn-resourcemanager > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "resourcemanager服务未正常运行" - - # 停止resourcemanager服务 - LOG_INFO "停止resourcemanager服务" - systemctl stop hadoop-yarn-resourcemanager > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "停止resourcemanager服务失败" - - # 如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn-resourcemanager" - dnf remove -y hadoop-yarn-resourcemanager > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-resourcemanager失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_start_nm.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_start_nm.sh deleted file mode 100644 index 274de864544..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_start_nm.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试启动节点管理器服务 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:启动节点管理器服务" - - # 检查是否已安装hadoop-yarn-nodemanager - LOG_INFO "检查是否已安装hadoop-yarn-nodemanager" - if rpm -q hadoop-yarn-nodemanager > /dev/null 2>&1; then - LOG_INFO "hadoop-yarn-nodemanager已安装,测试完成后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "hadoop-yarn-nodemanager未安装,将在测试过程中安装" - INSTALLED="false" - fi - - # 检查yum源中是否有hadoop-yarn-nodemanager软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn-nodemanager软件包" - if ! dnf list available hadoop-yarn-nodemanager > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到hadoop-yarn-nodemanager软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn-nodemanager - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装hadoop-yarn-nodemanager" - dnf install -y hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "安装hadoop-yarn-nodemanager失败" - fi - - # 检查节点管理器服务命令是否支持 - LOG_INFO "检查节点管理器服务命令是否支持" - if ! command -v yarn-daemon.sh > /dev/null 2>&1; then - LOG_ERROR "yarn-daemon.sh命令不存在" - exit 255 - fi - - # 启动节点管理器服务 - LOG_INFO "启动节点管理器服务" - yarn-daemon.sh start nodemanager - CHECK_RESULT $? 0 0 "启动节点管理器服务失败" - - # 检查节点管理器服务是否成功启动 - LOG_INFO "检查节点管理器服务是否成功启动" - sleep 3 - if ! jps | grep -q NodeManager; then - LOG_ERROR "节点管理器服务未成功启动" - exit 1 - fi - - LOG_INFO "节点管理器服务启动成功" - - # 停止节点管理器服务 - LOG_INFO "停止节点管理器服务" - yarn-daemon.sh stop nodemanager - CHECK_RESULT $? 0 0 "停止节点管理器服务失败" - - # 如果测试前未安装,则卸载hadoop-yarn-nodemanager - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn-nodemanager" - dnf remove -y hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-nodemanager失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_start_rm.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_start_rm.sh deleted file mode 100644 index 31ed26ab94f..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_start_rm.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试启动资源管理器服务 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试启动资源管理器服务" - - # 检查是否已安装hadoop-yarn资源管理器 - LOG_INFO "检查是否已安装hadoop-yarn资源管理器" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn资源管理器已安装" - INSTALLED=1 - else - LOG_INFO "hadoop-yarn资源管理器未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装hadoop-yarn资源管理器" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查资源管理器启动命令参数 - LOG_INFO "检查资源管理器启动命令参数" - if ! yarn resourcemanager --help &>/dev/null; then - LOG_ERROR "资源管理器启动命令参数不存在或不支持" - exit 255 - fi - - # 启动资源管理器服务 - LOG_INFO "启动资源管理器服务" - systemctl start hadoop-yarn-resourcemanager - CHECK_RESULT $? 0 0 "启动资源管理器服务失败" - - # 检查资源管理器服务状态 - LOG_INFO "检查资源管理器服务状态" - systemctl status hadoop-yarn-resourcemanager | grep -q "active (running)" - CHECK_RESULT $? 0 0 "资源管理器服务未正常运行" - - # 停止资源管理器服务 - LOG_INFO "停止资源管理器服务" - systemctl stop hadoop-yarn-resourcemanager - CHECK_RESULT $? 0 0 "停止资源管理器服务失败" - - # 如果测试前未安装,则卸载hadoop-yarn - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载hadoop-yarn资源管理器" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试启动资源管理器服务完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_submit_job.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_submit_job.sh deleted file mode 100644 index 9ca551569dc..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_submit_job.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试提交YARN作业 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试提交YARN作业" - LOG_INFO "步骤1:检查YARN相关软件包是否已在系统中安装" - rpm -qa | grep -E "^hadoop-yarn" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "YARN相关软件包已安装,测试完成后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "YARN相关软件包未安装,将在测试过程中安装,并在测试结束后卸载" - INSTALLED=0 - fi - - LOG_INFO "步骤2:检查yum源中是否存在hadoop-yarn软件包" - dnf list available hadoop-yarn 2>&1 | grep -E "^hadoop-yarn" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn软件包失败" - fi - - LOG_INFO "步骤4:检查yarn命令是否可用" - which yarn > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不存在" - exit 255 - fi - - LOG_INFO "步骤5:检查yarn命令是否支持提交作业的参数" - yarn jar --help 2>&1 | grep "Usage: yarn jar" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持提交作业的参数" - exit 255 - fi - - LOG_INFO "步骤6:准备一个简单的MapReduce作业JAR文件用于测试" - cat > /tmp/TestWordCount.java << "EOF" - import java.io.IOException; - import java.util.StringTokenizer; - import org.apache.hadoop.conf.Configuration; - import org.apache.hadoop.fs.Path; - import org.apache.hadoop.io.IntWritable; - import org.apache.hadoop.io.Text; - import org.apache.hadoop.mapreduce.Job; - import org.apache.hadoop.mapreduce.Mapper; - import org.apache.hadoop.mapreduce.Reducer; - import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; - import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; - - public class TestWordCount { - public static class TokenizerMapper extends Mapper { - private final static IntWritable one = new IntWritable(1); - private Text word = new Text(); - public void map(Object key, Text value, Context context) throws IOException, InterruptedException { - StringTokenizer itr = new StringTokenizer(value.toString()); - while (itr.hasMoreTokens()) { - word.set(itr.nextToken()); - context.write(word, one); - } - } - } - public static class IntSumReducer extends Reducer { - private IntWritable result = new IntWritable(); - public void reduce(Text key, Iterable values, Context context) throws IOException, InterruptedException { - int sum = 0; - for (IntWritable val : values) { - sum += val.get(); - } - result.set(sum); - context.write(key, result); - } - } - public static void main(String[] args) throws Exception { - Configuration conf = new Configuration(); - Job job = Job.getInstance(conf, "word count"); - job.setJarByClass(TestWordCount.class); - job.setMapperClass(TokenizerMapper.class); - job.setCombinerClass(IntSumReducer.class); - job.setReducerClass(IntSumReducer.class); - job.setOutputKeyClass(Text.class); - job.setOutputValueClass(IntWritable.class); - FileInputFormat.addInputPath(job, new Path(args[0])); - FileOutputFormat.setOutputPath(job, new Path(args[1])); - System.exit(job.waitForCompletion(true) ? 0 : 1); - } - } - EOF - - javac -cp $(hadoop classpath) /tmp/TestWordCount.java - CHECK_RESULT $? 0 0 "编译测试MapReduce作业失败" - jar cf /tmp/TestWordCount.jar -C /tmp TestWordCount*.class - CHECK_RESULT $? 0 0 "打包测试MapReduce作业JAR文件失败" - - LOG_INFO "步骤7:准备测试数据" - echo "hello world hello hadoop hello yarn" > /tmp/test_input.txt - hadoop fs -mkdir -p /user/test/input > /dev/null 2>&1 - hadoop fs -put /tmp/test_input.txt /user/test/input/ > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "准备测试数据失败" - - LOG_INFO "步骤8:提交YARN作业" - yarn jar /tmp/TestWordCount.jar TestWordCount /user/test/input /user/test/output 2>&1 | tee /tmp/yarn_submit.log - CHECK_RESULT $? 0 0 "提交YARN作业失败" - - LOG_INFO "步骤9:检查作业是否成功完成" - grep -E "Job .* completed successfully" /tmp/yarn_submit.log > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "YARN作业未成功完成" - - LOG_INFO "步骤10:检查作业输出结果" - hadoop fs -cat /user/test/output/part-r-00000 2>&1 | grep -E "hello\s+3" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "作业输出结果不符合预期" - - LOG_INFO "步骤11:清理测试数据" - hadoop fs -rm -r -f /user/test/input /user/test/output > /dev/null 2>&1 - rm -f /tmp/TestWordCount.java /tmp/TestWordCount*.class /tmp/TestWordCount.jar /tmp/test_input.txt /tmp/yarn_submit.log - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤12:卸载测试过程中安装的hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn软件包失败" - fi - - LOG_INFO "测试完成:提交YARN作业测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_uninstall.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_uninstall.sh deleted file mode 100644 index 1edd298d89d..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_uninstall.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试软件包卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试hadoop-yarn软件包卸载功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查hadoop-yarn软件包是否在yum源中" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 检查当前是否已安装 - LOG_INFO "检查hadoop-yarn是否已安装" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装,测试后将保持安装状态" - already_installed=true - else - LOG_INFO "hadoop-yarn未安装,将执行安装测试" - already_installed=false - fi - - # 如果未安装,则执行安装 - if [ "$already_installed" = false ]; then - LOG_INFO "开始安装hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "hadoop-yarn安装失败" - fi - - # 验证安装 - LOG_INFO "验证hadoop-yarn安装" - rpm -q hadoop-yarn - CHECK_RESULT $? 0 0 "hadoop-yarn安装验证失败" - - # 测试卸载功能 - LOG_INFO "开始测试卸载功能" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "hadoop-yarn卸载失败" - - # 验证卸载 - LOG_INFO "验证hadoop-yarn卸载" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_ERROR "hadoop-yarn卸载后仍存在" - exit 1 - fi - LOG_INFO "hadoop-yarn卸载验证成功" - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ "$already_installed" = true ]; then - LOG_INFO "重新安装hadoop-yarn以恢复环境" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "环境恢复安装hadoop-yarn失败" - LOG_INFO "环境恢复完成,保持hadoop-yarn安装状态" - else - LOG_INFO "环境已恢复至未安装状态" - fi - - LOG_INFO "hadoop-yarn卸载功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_view_logs.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_view_logs.sh deleted file mode 100644 index 7b8cb084adc..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_function_view_logs.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查看作业容器日志 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试查看作业容器日志功能" - LOG_INFO "步骤1:检查Hadoop YARN相关软件包是否已安装" - if rpm -qa | grep -q hadoop-yarn; then - LOG_INFO "Hadoop YARN已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "Hadoop YARN未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn 2>/dev/null | grep -q hadoop-yarn; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - LOG_INFO "步骤4:检查yarn logs命令是否支持" - yarn logs --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yarn logs命令不支持或参数错误" - exit 255 - fi - - LOG_INFO "步骤5:启动YARN服务并提交一个测试作业" - systemctl start hadoop-yarn-resourcemanager - CHECK_RESULT $? 0 0 "启动ResourceManager失败" - systemctl start hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "启动NodeManager失败" - - LOG_INFO "提交一个简单的MapReduce作业" - hadoop jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar pi 2 1000 > /tmp/mr_test.log 2>&1 & - MR_PID=$! - sleep 30 - - LOG_INFO "步骤6:获取作业ID并测试查看日志功能" - JOB_ID=$(yarn application -list 2>/dev/null | grep -i "pi" | awk "{print $1}" | head -1) - if [ -z "$JOB_ID" ]; then - LOG_ERROR "未找到测试作业ID" - kill $MR_PID 2>/dev/null - exit 1 - fi - - LOG_INFO "测试查看作业容器日志" - yarn logs -applicationId $JOB_ID > /tmp/yarn_logs_test.log 2>&1 - CHECK_RESULT $? 0 0 "查看作业容器日志失败" - - LOG_INFO "步骤7:验证日志文件内容" - if [ -s /tmp/yarn_logs_test.log ]; then - LOG_INFO "成功获取作业容器日志" - else - LOG_ERROR "获取的日志文件为空" - exit 1 - fi - - LOG_INFO "步骤8:清理测试作业" - kill $MR_PID 2>/dev/null - yarn application -kill $JOB_ID 2>/dev/null - - LOG_INFO "步骤9:停止YARN服务" - systemctl stop hadoop-yarn-nodemanager - systemctl stop hadoop-yarn-resourcemanager - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤10:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "步骤11:清理临时文件" - rm -f /tmp/mr_test.log /tmp/yarn_logs_test.log - - LOG_INFO "测试查看作业容器日志完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener__upper_v.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener__upper_v.sh deleted file mode 100644 index 5800a942e89..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener__upper_v.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 使用-V参数运行oom-listener命令,验证其版本信息显示功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否以root用户运行 - if [[ $EUID -ne 0 ]]; then - LOG_ERROR "请以root用户运行此脚本" - exit 1 - fi - - # 定义软件包名称 - PACKAGE_NAME="hadoop-yarn-oom-listener" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available ${PACKAGE_NAME} > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - - # 步骤2:检查当前环境是否已安装该软件包 - LOG_INFO "步骤2:检查当前环境是否已安装${PACKAGE_NAME}软件包" - rpm -q ${PACKAGE_NAME} > /dev/null 2>&1 - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "${PACKAGE_NAME}软件包已安装" - else - INSTALLED="false" - LOG_INFO "${PACKAGE_NAME}软件包未安装" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - LOG_INFO "${PACKAGE_NAME}软件包安装成功" - fi - - # 步骤4:检查oom-listener命令是否支持-V参数 - LOG_INFO "步骤4:检查oom-listener命令是否支持-V参数" - oom-listener --help 2>&1 | grep -q "\-V" - if [ $? -ne 0 ]; then - LOG_ERROR "oom-listener命令不支持-V参数" - # 如果之前未安装,则需要卸载 - if [ "${INSTALLED}" = "false" ]; then - dnf remove -y ${PACKAGE_NAME} > /dev/null 2>&1 - LOG_INFO "已卸载${PACKAGE_NAME}软件包" - fi - exit 255 - fi - LOG_INFO "oom-listener命令支持-V参数" - - # 步骤5:使用-V参数运行oom-listener命令,验证版本信息显示功能 - LOG_INFO "步骤5:使用-V参数运行oom-listener命令,验证版本信息显示功能" - VERSION_OUTPUT=$(oom-listener -V 2>&1) - CHECK_RESULT $? 0 0 "执行oom-listener -V命令失败" - LOG_INFO "命令输出:${VERSION_OUTPUT}" - - # 检查版本信息是否包含预期内容 - echo "${VERSION_OUTPUT}" | grep -q "version\|Version" - CHECK_RESULT $? 0 0 "版本信息显示不正确" - LOG_INFO "版本信息显示功能验证成功" - - # 步骤6:清理环境,恢复到之前的状态 - LOG_INFO "步骤6:清理环境,恢复到之前的状态" - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - LOG_INFO "环境已恢复,${PACKAGE_NAME}软件包已卸载" - else - LOG_INFO "环境已保持安装状态,无需卸载${PACKAGE_NAME}软件包" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener__v.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener__v.sh deleted file mode 100644 index 32d9235e4bb..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener__v.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 使用-v参数运行oom-listener命令,验证其详细信息输出功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:验证使用-v参数运行oom-listener命令的详细信息输出功能" - LOG_INFO "步骤1:检查是否已安装hadoop-yarn-oom-listener软件包" - if rpm -q hadoop-yarn-oom-listener &> /dev/null; then - LOG_INFO "hadoop-yarn-oom-listener已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "hadoop-yarn-oom-listener未安装,将在测试前安装,测试结束后卸载" - INSTALLED=0 - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn-oom-listener软件包" - if ! dnf list available hadoop-yarn-oom-listener &> /dev/null; then - LOG_ERROR "yum源中没有hadoop-yarn-oom-listener软件包" - exit 255 - fi - LOG_INFO "步骤3:安装hadoop-yarn-oom-listener软件包" - dnf install -y hadoop-yarn-oom-listener - CHECK_RESULT $? 0 0 "安装hadoop-yarn-oom-listener失败" - fi - LOG_INFO "步骤4:检查oom-listener命令是否支持-v参数" - if ! oom-listener -h 2>&1 | grep -q -- "-v"; then - LOG_ERROR "oom-listener命令不支持-v参数" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤5:卸载hadoop-yarn-oom-listener软件包" - dnf remove -y hadoop-yarn-oom-listener - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-oom-listener失败" - fi - exit 255 - fi - LOG_INFO "步骤5:使用-v参数运行oom-listener命令" - oom-listener -v - CHECK_RESULT $? 0 0 "使用-v参数运行oom-listener命令失败" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤6:卸载hadoop-yarn-oom-listener软件包" - dnf remove -y hadoop-yarn-oom-listener - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-oom-listener失败" - fi - LOG_INFO "测试结束:验证使用-v参数运行oom-listener命令的详细信息输出功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener_default.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener_default.sh deleted file mode 100644 index 9e12e13bad0..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_oom-listener_default.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 oom-listener 命令的默认行为 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查软件包是否已安装 - if ! rpm -q hadoop-yarn-oom-listener &>/dev/null; then - LOG_INFO "环境未安装hadoop-yarn-oom-listener,将进行安装" - # 检查yum源中是否存在软件包 - if ! dnf list available hadoop-yarn-oom-listener &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn-oom-listener软件包" - exit 255 - fi - # 安装软件包 - dnf install -y hadoop-yarn-oom-listener - CHECK_RESULT $? 0 0 "安装hadoop-yarn-oom-listener失败" - # 标记需要卸载 - UNINSTALL_NEEDED=1 - else - LOG_INFO "环境已安装hadoop-yarn-oom-listener" - fi - - # 测试oom-listener命令的默认行为 - LOG_INFO "测试oom-listener命令的默认行为" - oom-listener --help &>/dev/null - CHECK_RESULT $? 0 0 "oom-listener命令不支持--help参数" - - # 执行默认命令并检查结果 - LOG_INFO "执行默认的oom-listener命令" - oom-listener > /tmp/oom_listener_output.log 2>&1 - CHECK_RESULT $? 0 0 "oom-listener命令执行失败" - - # 检查输出文件是否存在且非空 - if [ ! -s /tmp/oom_listener_output.log ]; then - LOG_ERROR "oom-listener命令未生成有效输出" - exit 1 - fi - - # 清理临时文件 - rm -f /tmp/oom_listener_output.log - - # 如果脚本安装了软件包,则在结束时卸载 - if [ "$UNINSTALL_NEEDED" -eq 1 ]; then - LOG_INFO "卸载hadoop-yarn-oom-listener" - dnf remove -y hadoop-yarn-oom-listener - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-oom-listener失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__h.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__h.sh deleted file mode 100644 index 8ef353ef22e..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__h.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试使用-h参数显示帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试hadoop-yarn-test-container-executor命令的-h参数帮助信息显示功能" - LOG_INFO "步骤1:检查当前环境是否已安装hadoop-yarn-test-container-executor软件包" - if dnf list installed hadoop-yarn-test-container-executor &>/dev/null; then - LOG_INFO "hadoop-yarn-test-container-executor软件包已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn-test-container-executor软件包未安装,将在测试前安装并在测试后卸载" - INSTALLED=false - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤2:检查yum源中是否存在hadoop-yarn-test-container-executor软件包" - if ! dnf list available hadoop-yarn-test-container-executor &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn-test-container-executor软件包" - exit 255 - fi - LOG_INFO "步骤3:安装hadoop-yarn-test-container-executor软件包" - dnf install -y hadoop-yarn-test-container-executor - CHECK_RESULT $? 0 0 "安装hadoop-yarn-test-container-executor软件包失败" - fi - - LOG_INFO "步骤4:执行hadoop-yarn-test-container-executor -h命令显示帮助信息" - hadoop-yarn-test-container-executor -h - CHECK_RESULT $? 0 0 "执行hadoop-yarn-test-container-executor -h命令失败" - - LOG_INFO "步骤5:验证-h参数输出的帮助信息是否包含预期内容" - hadoop-yarn-test-container-executor -h | grep -q "usage:" - CHECK_RESULT $? 0 0 "帮助信息中未找到"usage:"关键字" - - LOG_INFO "步骤6:清理测试环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn-test-container-executor软件包" - dnf remove -y hadoop-yarn-test-container-executor - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-test-container-executor软件包失败" - else - LOG_INFO "保持hadoop-yarn-test-container-executor软件包安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__help.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__help.sh deleted file mode 100644 index f21bc03cfa2..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__help.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-01 -# @License : Mulan PSL v2 -# @Desc : 测试 test-container-executor 命令的帮助文档功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 test-container-executor 命令的帮助文档功能" - - # 检查是否已安装hadoop-yarn - LOG_INFO "检查是否已安装hadoop-yarn" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装,无需重新安装" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,将进行安装" - INSTALLED=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 测试test-container-executor命令的帮助文档功能 - LOG_INFO "测试test-container-executor命令的帮助文档功能" - test-container-executor --help &>/dev/null - CHECK_RESULT $? 0 0 "test-container-executor命令的帮助文档功能测试失败" - - # 如果之前未安装,则卸载hadoop-yarn - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_d.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_d.sh deleted file mode 100644 index b58b5a0e03e..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_d.sh +++ /dev/null @@ -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 : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试使用-D参数指定配置属性 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试使用-D参数指定配置属性" - LOG_INFO "步骤1:检查环境是否已安装hadoop-yarn" - if rpm -qa | grep -q "hadoop-yarn"; then - LOG_INFO "hadoop-yarn已安装,将保持安装状态" - ENV_INSTALLED="true" - else - LOG_INFO "hadoop-yarn未安装,将在测试过程中安装" - ENV_INSTALLED="false" - fi - - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn 2>/dev/null | grep -q "hadoop-yarn"; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - if [ "$ENV_INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - LOG_INFO "步骤4:检查container-executor命令是否支持-D参数" - container-executor --help 2>&1 | grep -q "\-D" - CHECK_RESULT $? 0 0 "container-executor命令不支持-D参数" - if [ $? -ne 0 ]; then - exit 255 - fi - - LOG_INFO "步骤5:使用-D参数指定配置属性执行container-executor命令" - container-executor -Dtest.property=testvalue - CHECK_RESULT $? 0 0 "使用-D参数执行container-executor命令失败" - - if [ "$ENV_INSTALLED" = "false" ]; then - LOG_INFO "步骤6:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成:测试使用-D参数指定配置属性" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_r.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_r.sh deleted file mode 100644 index 8443f345ae7..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_r.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试使用-R参数指定运行模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试使用-R参数指定运行模式" - - # 检查环境是否已安装hadoop-yarn - LOG_INFO "检查hadoop-yarn是否已安装" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装" - already_installed=true - else - LOG_INFO "hadoop-yarn未安装" - already_installed=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装则安装hadoop-yarn - if [ "$already_installed" = false ]; then - LOG_INFO "安装hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查container-executor命令是否支持-R参数 - LOG_INFO "检查container-executor命令是否支持-R参数" - if ! container-executor --help 2>&1 | grep -q "\-R"; then - LOG_ERROR "container-executor命令不支持-R参数" - exit 255 - fi - - # 测试使用-R参数指定运行模式 - LOG_INFO "测试使用-R参数指定运行模式" - container-executor -R test_mode - CHECK_RESULT $? 0 0 "使用-R参数执行失败" - - # 清理环境:如果测试前未安装,则卸载hadoop-yarn - if [ "$already_installed" = false ]; then - LOG_INFO "卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_u.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_u.sh deleted file mode 100644 index 4221b231ed1..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_u.sh +++ /dev/null @@ -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-18 -# @License : Mulan PSL v2 -# @Desc : 测试使用-U参数指定用户 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试使用-U参数指定用户" - - # 定义软件包名称 - PACKAGE_NAME="hadoop-yarn" - - # 步骤1:检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "步骤1:检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available "$PACKAGE_NAME" &> /dev/null; then - LOG_ERROR "yum源中没有找到$PACKAGE_NAME软件包" - exit 255 - fi - - # 步骤2:检查当前是否已安装hadoop-yarn - LOG_INFO "步骤2:检查当前是否已安装hadoop-yarn" - if rpm -q "$PACKAGE_NAME" &> /dev/null; then - LOG_INFO "$PACKAGE_NAME已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "$PACKAGE_NAME未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 步骤4:测试使用-U参数指定用户 - LOG_INFO "步骤4:测试使用-U参数指定用户" - # 假设测试命令为container-executor,使用-U参数指定用户 - # 先检查命令是否存在 - if ! command -v container-executor &> /dev/null; then - LOG_ERROR "container-executor命令不存在" - exit 255 - fi - - # 检查-U参数是否被支持 - LOG_INFO "检查-U参数是否被支持" - container-executor --help | grep -q "\-U" - CHECK_RESULT $? 0 0 "container-executor命令不支持-U参数" - - # 执行测试命令,使用-U参数指定一个测试用户(例如testuser) - LOG_INFO "执行测试命令:container-executor -U testuser" - container-executor -U testuser - # 注意:这里假设命令执行成功返回0,失败返回非0 - # 实际应根据命令的具体行为调整检查逻辑 - CHECK_RESULT $? 0 0 "使用-U参数执行container-executor失败" - - # 步骤5:清理环境,如果之前未安装则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤5:卸载hadoop-yarn软件包" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "步骤5:保持hadoop-yarn安装状态,无需卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_v.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_v.sh deleted file mode 100644 index 801d35f9dfb..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor__upper_v.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试使用-V参数显示版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试使用-V参数显示版本信息" - LOG_INFO "步骤1:检查环境是否已安装hadoop-yarn软件包" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn软件包已安装,标记为保持安装状态" - KEEP_INSTALLED=true - else - LOG_INFO "hadoop-yarn软件包未安装,标记为需要安装" - KEEP_INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中没有找到hadoop-yarn软件包" - exit 255 - fi - - if [ "$KEEP_INSTALLED" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn软件包失败" - fi - - LOG_INFO "步骤4:检查container-executor命令是否支持-V参数" - container-executor --help 2>&1 | grep -q "\-V" - if [ $? -ne 0 ]; then - LOG_ERROR "container-executor命令不支持-V参数" - if [ "$KEEP_INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - LOG_INFO "步骤5:执行container-executor -V命令显示版本信息" - container-executor -V - CHECK_RESULT $? 0 0 "执行container-executor -V命令失败" - - if [ "$KEEP_INSTALLED" = false ]; then - LOG_INFO "步骤6:清理环境,卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor_help.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor_help.sh deleted file mode 100644 index 3e307c8ea1b..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_test-container-executor_help.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 : 测试帮助命令 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试hadoop-yarn_test-container-executor帮助命令" - - # 检查是否已安装hadoop-yarn - if ! dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn未安装,开始安装" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - INSTALLED=1 - else - LOG_INFO "hadoop-yarn已安装" - INSTALLED=0 - fi - - # 测试帮助命令 - LOG_INFO "测试hadoop-yarn_test-container-executor帮助命令" - hadoop-yarn_test-container-executor --help - CHECK_RESULT $? 0 0 "执行帮助命令失败" - - # 清理环境 - if [ $INSTALLED -eq 1 ]; then - LOG_INFO "卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--config_dir.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--config_dir.sh deleted file mode 100644 index 66a0e4ad72b..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--config_dir.sh +++ /dev/null @@ -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-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 yarn 命令的 --config 参数,验证是否能正确指定 Hadoop 配置目录 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 yarn 命令的 --config 参数,验证是否能正确指定 Hadoop 配置目录" - - # 检查是否已安装 hadoop-yarn 软件包 - LOG_INFO "检查 hadoop-yarn 软件包是否已安装" - if ! dnf list installed hadoop-yarn &> /dev/null; then - LOG_INFO "hadoop-yarn 未安装,将进行安装" - # 检查 yum 源中是否有 hadoop-yarn - if ! dnf list available hadoop-yarn &> /dev/null; then - LOG_ERROR "yum 源中未找到 hadoop-yarn 软件包" - exit 255 - fi - # 安装 hadoop-yarn - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装 hadoop-yarn 失败" - INSTALLED=true - else - LOG_INFO "hadoop-yarn 已安装" - INSTALLED=false - fi - - # 验证 --config 参数 - LOG_INFO "验证 yarn 命令的 --config 参数" - CONFIG_DIR="/tmp/hadoop-config" - mkdir -p $CONFIG_DIR - CHECK_RESULT $? 0 0 "创建配置目录失败" - - # 执行 yarn 命令并指定配置目录 - yarn --config $CONFIG_DIR - CHECK_RESULT $? 0 0 "yarn --config $CONFIG_DIR 执行失败" - - # 清理环境 - LOG_INFO "清理测试环境" - rm -rf $CONFIG_DIR - CHECK_RESULT $? 0 -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_start.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_start.sh deleted file mode 100644 index 70808afb2c2..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_start.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 yarn 命令的 --daemon start 参数,验证是否能正确启动守护进程 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装hadoop-yarn - LOG_INFO "检查是否已安装hadoop-yarn" - rpm -q hadoop-yarn > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,脚本结束时将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装hadoop-yarn" - dnf install -y hadoop-yarn > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查yarn命令是否支持--daemon start参数 - LOG_INFO "检查yarn命令是否支持--daemon start参数" - yarn --help | grep -q "\-\-daemon start" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持--daemon start参数" - exit 255 - fi - - # 执行yarn --daemon start命令 - LOG_INFO "执行yarn --daemon start命令" - yarn --daemon start > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "启动守护进程失败" - - # 检查守护进程是否已启动 - LOG_INFO "检查守护进程是否已启动" - ps -ef | grep yarn | grep -v grep > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "守护进程未启动" - - # 停止守护进程以清理环境 - LOG_INFO "停止守护进程以清理环境" - yarn --daemon stop > /dev/null 2>&1 - - # 如果脚本开始时未安装,则卸载hadoop-yarn以恢复环境状态。否则保持原状。 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn以恢复环境状态" - dnf remove -y hadoop-yarn > /dev/null 2>&1 - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_status.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_status.sh deleted file mode 100644 index 4b57f20f9e1..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_status.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 yarn 命令的 --daemon status 参数,验证是否能正确查看守护进程状态 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装hadoop-yarn - LOG_INFO "检查是否已安装hadoop-yarn" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装" - installed=true - else - LOG_INFO "hadoop-yarn未安装" - installed=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$installed" = false ]; then - LOG_INFO "开始安装hadoop-yarn" - dnf install -y hadoop-yarn &>/dev/null - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 测试yarn命令的--daemon status参数 - LOG_INFO "测试yarn命令的--daemon status参数" - yarn --daemon status &>/dev/null - CHECK_RESULT $? 0 0 "yarn --daemon status执行失败" - - # 恢复环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载hadoop-yarn" - dnf remove -y hadoop-yarn &>/dev/null - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试脚本执行完毕" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_stop.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_stop.sh deleted file mode 100644 index c16a07bff0e..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--daemon_stop.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 yarn 命令的 --daemon stop 参数,验证是否能正确停止守护进程 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装hadoop-yarn软件包 - LOG_INFO "检查是否已安装hadoop-yarn软件包" - rpm -q hadoop-yarn - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装" - installed=true - else - LOG_INFO "hadoop-yarn未安装" - installed=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$installed" = false ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查yarn命令的--daemon stop参数是否存在 - LOG_INFO "检查yarn命令的--daemon stop参数是否存在" - yarn --help | grep -- "--daemon stop" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持--daemon stop参数" - exit 255 - fi - - # 执行yarn --daemon stop命令并验证结果 - LOG_INFO "执行yarn --daemon stop命令" - yarn --daemon stop - CHECK_RESULT $? 0 0 "执行yarn --daemon stop失败" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--debug.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--debug.sh deleted file mode 100644 index 9fd874c467b..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--debug.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 yarn 命令的 --debug 参数,验证是否能正确开启调试模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试 yarn 命令的 --debug 参数,验证是否能正确开启调试模式" - - # 检查是否已安装hadoop-yarn软件包 - LOG_INFO "检查hadoop-yarn软件包是否已安装" - if ! dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn未安装,将进行安装" - # 检查yum源中是否有hadoop-yarn软件包 - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - # 安装hadoop-yarn - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - # 标记为需要卸载 - UNINSTALL_NEEDED=1 - else - LOG_INFO "hadoop-yarn已安装,无需重新安装" - UNINSTALL_NEEDED=0 - fi - - # 测试yarn --debug命令 - LOG_INFO "执行yarn --debug命令" - output=$(yarn --debug 2>&1) - CHECK_RESULT $? 0 0 "yarn --debug命令执行失败" - - # 验证输出是否包含调试信息 - LOG_INFO "验证输出是否包含调试信息" - if [[ "$output" == *"debug"* ]]; then - LOG_INFO "调试模式已正确开启" - else - LOG_ERROR "调试模式未正确开启" - exit 1 - fi - - # 清理环境 - if [ "$UNINSTALL_NEEDED" -eq 1 ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn &>/dev/null - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--hosts_filename.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--hosts_filename.sh deleted file mode 100644 index 5b019dc6c03..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--hosts_filename.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-01 -# @License : Mulan PSL v2 -# @Desc : 测试 yarn 命令的 --hosts 参数,指定工作模式下的主机文件列表 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yarn是否已安装 - LOG_INFO "检查yarn是否已安装" - if ! dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "yarn未安装,开始安装" - # 检查yum源中是否有hadoop-yarn包 - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn包" - exit 255 - fi - # 安装hadoop-yarn - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - # 标记为需要卸载 - NEED_UNINSTALL=1 - else - LOG_INFO "yarn已安装,跳过安装步骤" - NEED_UNINSTALL=0 - fi - - # 测试yarn命令的--hosts参数 - LOG_INFO "测试yarn命令的--hosts参数" - # 检查--hosts参数是否支持 - if ! yarn --help | grep -q -- "--hosts"; then - LOG_ERROR "yarn命令不支持--hosts参数" - exit 255 - fi - - # 创建临时主机文件 - LOG_INFO "创建临时主机文件" - echo "node1" > /tmp/hosts_file - echo "node2" >> /tmp/hosts_file - - # 执行yarn命令 - LOG_INFO "执行yarn命令" - yarn --hosts /tmp/hosts_file - CHECK_RESULT $? 0 0 "yarn命令执行失败" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/hosts_file - - # 恢复环境 - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--loglevel_level.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--loglevel_level.sh deleted file mode 100644 index 7a8fcccad33..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_--loglevel_level.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : 测试 yarn 命令的 --loglevel 参数,验证是否能正确设置日志级别 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 yarn 命令的 --loglevel 参数,验证是否能正确设置日志级别" - - # 检查是否已安装 hadoop-yarn - if ! dnf list installed hadoop-yarn &> /dev/null; then - LOG_INFO "hadoop-yarn 未安装,开始安装" - if ! dnf list available hadoop-yarn &> /dev/null; then - LOG_ERROR "yum 源中未找到 hadoop-yarn 软件包" - exit 255 - fi - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装 hadoop-yarn 失败" - INSTALLED=true - else - LOG_INFO "hadoop-yarn 已安装,跳过安装步骤" - INSTALLED=false - fi - - # 测试 --loglevel 参数 - LOG_INFO "测试 yarn --loglevel 参数" - yarn --loglevel DEBUG &> /dev/null - CHECK_RESULT $? 0 0 "yarn --loglevel DEBUG 执行失败" - - yarn --loglevel INFO &> /dev/null - CHECK_RESULT $? 0 0 "yarn --loglevel INFO 执行失败" - - yarn --loglevel WARN &> /dev/null - CHECK_RESULT $? 0 0 "yarn --loglevel WARN 执行失败" - - yarn --loglevel ERROR &> /dev/null - CHECK_RESULT $? 0 0 "yarn --loglevel ERROR 执行失败" - - yarn --loglevel FATAL &> /dev/null - CHECK_RESULT $? 0 0 "yarn --loglevel FATAL 执行失败" - - # 测试不支持的参数值(预期失败) - LOG_INFO "测试不支持的日志级别参数值" - yarn --loglevel INVALID &> /dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "不支持的日志级别参数值未触发退出码255" - exit 255 - fi - - # 清理环境(如果脚本安装了软件包) - if [ "$INSTALLED" = true ]; then - LOG_INFO "卸载 hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 -1 "卸载 hadoop-yarn failed" # 允许卸载失败(如依赖问题) - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__config_dir.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__config_dir.sh deleted file mode 100644 index 33d637888f1..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__config_dir.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试指定Hadoop配置目录 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试指定Hadoop配置目录功能" - - # 定义软件包名称 - PACKAGE_NAME="hadoop-yarn" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包" - if ! dnf list available ${PACKAGE_NAME} &>/dev/null; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - - # 步骤2: 检查当前环境是否已安装 - LOG_INFO "检查当前环境是否已安装${PACKAGE_NAME}" - if rpm -q ${PACKAGE_NAME} &>/dev/null; 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 "开始安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 步骤4: 验证yarn命令的--config参数是否存在 - LOG_INFO "验证yarn命令是否支持--config参数" - yarn --help 2>&1 | grep -q -- "--config" - CHECK_RESULT $? 0 0 "yarn命令不支持--config参数" - - # 步骤5: 测试指定配置目录功能 - LOG_INFO "测试指定配置目录功能" - TEST_CONFIG_DIR="/tmp/test_hadoop_config_$(date +%s)" - mkdir -p ${TEST_CONFIG_DIR} - yarn --config ${TEST_CONFIG_DIR} version 2>&1 | grep -q "Hadoop" - CHECK_RESULT $? 0 0 "使用--config指定目录执行yarn命令失败" - - # 步骤6: 清理测试目录 - LOG_INFO "清理测试创建的临时目录" - rm -rf ${TEST_CONFIG_DIR} - - # 步骤7: 环境恢复 - if [ "${ALREADY_INSTALLED}" = "false" ]; then - LOG_INFO "卸载测试安装的${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - else - LOG_INFO "保持${PACKAGE_NAME}原有安装状态" - fi - - LOG_INFO "指定Hadoop配置目录测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_start.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_start.sh deleted file mode 100644 index 9342252d2e5..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_start.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试以守护进程模式启动yarn -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试以守护进程模式启动yarn" - LOG_INFO "检查环境是否已安装hadoop-yarn" - if dnf list installed hadoop-yarn &> /dev/null; then - LOG_INFO "hadoop-yarn已安装,跳过安装步骤" - INSTALLED="true" - else - LOG_INFO "hadoop-yarn未安装,开始安装" - if ! dnf list available hadoop-yarn &> /dev/null; then - LOG_ERROR "yum源中不存在hadoop-yarn软件包" - exit 255 - fi - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - INSTALLED="false" - fi - LOG_INFO "检查yarn命令是否支持--daemon参数" - yarn --help 2>&1 | grep -q "\-\-daemon" - CHECK_RESULT $? 0 0 "yarn命令不支持--daemon参数" - LOG_INFO "以守护进程模式启动yarn" - yarn --daemon start - CHECK_RESULT $? 0 0 "启动yarn守护进程失败" - LOG_INFO "检查yarn守护进程是否运行" - sleep 2 - if ! pgrep -f "yarn" &> /dev/null; then - LOG_ERROR "yarn守护进程未运行" - exit 1 - fi - LOG_INFO "停止yarn守护进程" - yarn --daemon stop - CHECK_RESULT $? 0 0 "停止yarn守护进程失败" - LOG_INFO "清理环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_status.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_status.sh deleted file mode 100644 index 81549df1662..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_status.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查看yarn守护进程状态 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="hadoop-yarn" - SERVICE_NAME="yarn" - TEST_COMMAND="yarn-daemon.sh" - - # 步骤1: 检查yum源中是否存在hadoop-yarn软件包 - LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available ${PACKAGE_NAME} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在${PACKAGE_NAME}软件包" - exit 255 - fi - - # 步骤2: 检查是否已安装hadoop-yarn - LOG_INFO "检查是否已安装${PACKAGE_NAME}" - rpm -q ${PACKAGE_NAME} &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "${PACKAGE_NAME}已安装" - INSTALLED=true - else - LOG_INFO "${PACKAGE_NAME}未安装" - INSTALLED=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 步骤4: 检查yarn-daemon.sh命令是否存在 - LOG_INFO "检查${TEST_COMMAND}命令是否存在" - which ${TEST_COMMAND} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "${TEST_COMMAND}命令不存在" - # 如果是新安装的,需要卸载 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 步骤5: 测试查看yarn守护进程状态命令的参数支持 - LOG_INFO "测试${TEST_COMMAND}命令的参数支持" - ${TEST_COMMAND} --help 2>&1 | grep -q "status" - if [ $? -ne 0 ]; then - LOG_ERROR "${TEST_COMMAND}命令不支持status参数" - # 如果是新安装的,需要卸载 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 步骤6: 测试查看yarn守护进程状态 - LOG_INFO "测试查看yarn守护进程状态" - ${TEST_COMMAND} status resourcemanager 2>&1 - CHECK_RESULT $? 0 1 "查看yarn守护进程状态失败" - - # 步骤7: 环境恢复 - LOG_INFO "环境恢复" - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - else - LOG_INFO "保持${PACKAGE_NAME}安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_stop.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_stop.sh deleted file mode 100644 index 405c104f617..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__daemon_stop.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试停止yarn守护进程 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出函数(如果LOG_INFO/LOG_ERROR未定义) - if ! command -v LOG_INFO &> /dev/null; then - LOG_INFO() { - echo -e "\033[32m[INFO]\033[0m $*" - } - fi - - if ! command -v LOG_ERROR &> /dev/null; then - LOG_ERROR() { - echo -e "\033[31m[ERROR]\033[0m $*" >&2 - } - fi - - # 检查yum源中是否有指定软件包 - check_package_in_repo() { - local pkg=$1 - LOG_INFO "检查yum源中是否存在软件包: $pkg" - if ! dnf list available "$pkg" &> /dev/null; then - LOG_ERROR "yum源中不存在软件包: $pkg" - exit 255 - fi - LOG_INFO "软件包 $pkg 存在于yum源中" - } - - # 检查命令参数是否支持 - check_command_param() { - local cmd=$1 - local param=$2 - LOG_INFO "检查命令 $cmd 是否支持参数: $param" - if ! $cmd --help 2>&1 | grep -q "\<$param\>"; then - LOG_ERROR "命令 $cmd 不支持参数: $param" - exit 255 - fi - LOG_INFO "命令 $cmd 支持参数: $param" - } - - # 检查环境是否已安装hadoop-yarn - check_hadoop_yarn_installed() { - LOG_INFO "检查hadoop-yarn是否已安装" - if rpm -q hadoop-yarn &> /dev/null; then - LOG_INFO "hadoop-yarn已安装" - return 0 - else - LOG_INFO "hadoop-yarn未安装" - return 1 - fi - } - - # 安装hadoop-yarn - install_hadoop_yarn() { - LOG_INFO "开始安装hadoop-yarn" - check_package_in_repo "hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - LOG_INFO "hadoop-yarn安装成功" - } - - # 卸载hadoop-yarn - uninstall_hadoop_yarn() { - LOG_INFO "开始卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - LOG_INFO "hadoop-yarn卸载成功" - } - - # 测试停止yarn守护进程 - test_yarn_daemon_stop() { - LOG_INFO "测试停止yarn守护进程" - - # 检查yarn命令是否存在 - if ! command -v yarn &> /dev/null; then - LOG_ERROR "yarn命令不存在" - return 1 - fi - - # 检查--daemon参数是否支持 - check_command_param "yarn" "--daemon" - - # 尝试停止yarn守护进程 - LOG_INFO "执行命令: yarn --daemon stop" - yarn --daemon stop - local yarn_exit_code=$? - - # 检查命令执行结果 - if [ $yarn_exit_code -eq 0 ]; then - LOG_INFO "yarn守护进程停止成功" - return 0 - elif [ $yarn_exit_code -eq 255 ]; then - LOG_ERROR "命令参数错误" - exit 255 - else - LOG_ERROR "yarn守护进程停止失败,退出码: $yarn_exit_code" - return $yarn_exit_code - fi - } - - # 主函数 - main() { - LOG_INFO "开始测试: 测试停止yarn守护进程" - - # 记录初始安装状态 - local originally_installed=false - if check_hadoop_yarn_installed; then - originally_installed=true - fi - - # 如果未安装,则安装 - if ! $originally_installed; then - install_hadoop_yarn - fi - - # 执行测试 - test_yarn_daemon_stop - local test_result=$? - - # 环境恢复 - LOG_INFO "开始环境恢复" - if ! $originally_installed; then - uninstall_hadoop_yarn - else - LOG_INFO "保持hadoop-yarn安装状态" - fi - - # 检查最终结果 - CHECK_RESULT $test_result 0 0 "测试停止yarn守护进程失败" - LOG_INFO "测试停止yarn守护进程成功" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__debug.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__debug.sh deleted file mode 100644 index 399af5573b1..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__debug.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试开启shell脚本调试模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -x - LOG_INFO "开始测试:测试开启shell脚本调试模式" - - LOG_INFO "步骤1:检查yum源中是否存在hadoop-yarn-debug软件包" - dnf list available hadoop-yarn-debug 2>/dev/null | grep -q hadoop-yarn-debug - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在hadoop-yarn-debug软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装hadoop-yarn-debug" - rpm -q hadoop-yarn-debug >/dev/null 2>&1 - is_installed=$? - - if [ $is_installed -eq 0 ]; then - LOG_INFO "环境已安装hadoop-yarn-debug,测试期间保持安装状态" - need_uninstall=false - else - LOG_INFO "环境未安装hadoop-yarn-debug,将进行安装" - need_uninstall=true - fi - - if [ "$need_uninstall" = true ]; then - LOG_INFO "步骤3:安装hadoop-yarn-debug软件包" - dnf install -y hadoop-yarn-debug - CHECK_RESULT $? 0 0 "安装hadoop-yarn-debug失败" - fi - - LOG_INFO "步骤4:测试yarn debug命令的基本参数" - yarn debug -help >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yarn debug命令不支持-help参数" - - LOG_INFO "步骤5:测试不支持的参数" - yarn debug --nonexistent-param 2>/dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "yarn debug命令未正确处理不存在的参数" - exit 255 - fi - - LOG_INFO "步骤6:执行实际调试命令测试" - yarn debug -list 2>&1 | grep -q "ApplicationId" - CHECK_RESULT $? 0 0 "yarn debug -list命令执行失败" - - LOG_INFO "步骤7:清理测试环境" - if [ "$need_uninstall" = true ]; then - LOG_INFO "卸载测试期间安装的hadoop-yarn-debug软件包" - dnf remove -y hadoop-yarn-debug - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-debug失败" - else - LOG_INFO "测试前已安装hadoop-yarn-debug,保持安装状态" - fi - - LOG_INFO "测试完成:shell脚本调试模式测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__help.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__help.sh deleted file mode 100644 index 6d12db69d9b..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__help.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试yarn命令的帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装hadoop-yarn软件包 - LOG_INFO "检查hadoop-yarn是否已安装" - rpm -q hadoop-yarn > /dev/null 2>&1 - installed=$? - - # 记录初始安装状态 - if [ $installed -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装,脚本结束时将保持安装状态" - else - LOG_INFO "hadoop-yarn未安装,将在测试后卸载" - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有hadoop-yarn软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查yarn命令是否存在 - LOG_INFO "检查yarn命令是否存在" - which yarn > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yarn命令不存在" - - # 测试yarn命令的帮助参数 - LOG_INFO "测试yarn命令的help参数" - yarn --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yarn --help命令执行失败" - - # 测试yarn命令的-h参数 - LOG_INFO "测试yarn命令的-h参数" - yarn -h > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yarn -h命令执行失败" - - # 测试yarn命令的无效参数 - LOG_INFO "测试yarn命令的无效参数" - yarn --invalid-param > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "yarn命令不支持--invalid-param参数" - exit 255 - fi - - # 清理环境:如果最初未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - LOG_INFO "环境已恢复到初始状态" - else - LOG_INFO "保持hadoop-yarn安装状态" - fi - - LOG_INFO "测试yarn命令的帮助信息完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__hostnames_list.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__hostnames_list.sh deleted file mode 100644 index 136092e819c..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__hostnames_list.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试指定工作节点模式下的主机列表 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试指定工作节点模式下的主机列表功能" - - LOG_INFO "1. 检查hadoop-yarn软件包是否在yum源中" - dnf list hadoop-yarn 2>&1 | grep -q "可用软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - LOG_INFO "2. 检查是否已安装hadoop-yarn" - rpm -q hadoop-yarn > /dev/null 2>&1 - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "未检测到hadoop-yarn安装,开始安装" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - else - LOG_INFO "检测到hadoop-yarn已安装" - fi - - LOG_INFO "3. 检查yarn命令的hostnames参数支持" - yarn --help 2>&1 | grep -q "hostnames" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持hostnames参数" - if [ $installed -ne 0 ]; then - LOG_INFO "清理安装的软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - LOG_INFO "4. 执行yarn hostnames --list命令测试" - yarn hostnames --list - CHECK_RESULT $? 0 0 "执行yarn hostnames --list命令失败" - - LOG_INFO "5. 测试指定工作节点模式" - yarn hostnames --list --workers - CHECK_RESULT $? 0 0 "执行yarn hostnames --list --workers命令失败" - - LOG_INFO "6. 环境恢复" - if [ $installed -ne 0 ]; then - LOG_INFO "卸载测试安装的hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__hosts_filename.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__hosts_filename.sh deleted file mode 100644 index a52e72f0ab5..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__hosts_filename.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试指定包含工作节点主机列表的文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试指定包含工作节点主机列表的文件" - LOG_INFO "步骤1:检查是否已安装hadoop-yarn软件包" - rpm -q hadoop-yarn > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "hadoop-yarn未安装,标记为未安装状态" - INSTALLED="false" - fi - - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - LOG_INFO "步骤3:如果未安装则安装hadoop-yarn" - if [ "$INSTALLED" = "false" ]; then - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - LOG_INFO "hadoop-yarn安装成功" - fi - - LOG_INFO "步骤4:检查yarn命令的hosts参数是否支持" - yarn --help 2>&1 | grep -q "\-\-hosts" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持hosts参数" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载hadoop-yarn" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - LOG_INFO "步骤5:创建测试用的主机列表文件" - echo "node1.example.com" > /tmp/test_hosts.txt - echo "node2.example.com" >> /tmp/test_hosts.txt - CHECK_RESULT $? 0 0 "创建主机列表文件失败" - - LOG_INFO "步骤6:执行yarn命令指定hosts文件测试" - yarn --hosts /tmp/test_hosts.txt node -list > /tmp/yarn_output.txt 2>&1 - CHECK_RESULT $? 0 0 "执行yarn命令失败" - LOG_INFO "yarn命令执行成功" - - LOG_INFO "步骤7:检查命令输出是否符合预期" - grep -q "Total Nodes" /tmp/yarn_output.txt - CHECK_RESULT $? 0 0 "yarn命令输出不符合预期" - - LOG_INFO "步骤8:清理临时文件" - rm -f /tmp/test_hosts.txt /tmp/yarn_output.txt - CHECK_RESULT $? 0 0 "清理临时文件失败" - - LOG_INFO "步骤9:根据初始状态恢复环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - LOG_INFO "环境已恢复至未安装状态" - else - LOG_INFO "保持hadoop-yarn已安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__loglevel_level.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__loglevel_level.sh deleted file mode 100644 index 271b4b8576e..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__loglevel_level.sh +++ /dev/null @@ -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-18 -# @License : Mulan PSL v2 -# @Desc : 测试设置命令的日志级别 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志打印函数(实际环境中可能已定义,这里为防止未定义而提供) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 测试脚本:测试设置命令的日志级别 - LOG_INFO "开始测试:测试设置命令的日志级别" - - # 步骤1:检查yarn命令是否已安装 - LOG_INFO "步骤1:检查yarn命令是否已安装" - if command -v yarn > /dev/null 2>&1; then - LOG_INFO "yarn命令已安装,无需重新安装" - INSTALLED=true - else - LOG_INFO "yarn命令未安装,将在后续步骤安装" - INSTALLED=false - fi - - # 步骤2:检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn 2>/dev/null | grep -q hadoop-yarn; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装hadoop-yarn软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn软件包失败" - fi - - # 步骤4:测试设置日志级别命令的参数是否存在 - LOG_INFO "步骤4:测试设置日志级别命令的参数是否存在" - if ! yarn --help 2>&1 | grep -q "\-\-loglevel"; then - LOG_ERROR "yarn命令不支持--loglevel参数" - exit 255 - fi - - # 步骤5:测试设置日志级别为info - LOG_INFO "步骤5:测试设置日志级别为info" - yarn --loglevel info - CHECK_RESULT $? 0 0 "设置日志级别为info失败" - - # 步骤6:测试设置日志级别为debug - LOG_INFO "步骤6:测试设置日志级别为debug" - yarn --loglevel debug - CHECK_RESULT $? 0 0 "设置日志级别为debug失败" - - # 步骤7:测试设置日志级别为error - LOG_INFO "步骤7:测试设置日志级别为error" - yarn --loglevel error - CHECK_RESULT $? 0 0 "设置日志级别为error失败" - - # 步骤8:测试设置日志级别为warn - LOG_INFO "步骤8:测试设置日志级别为warn" - yarn --loglevel warn - CHECK_RESULT $? 0 0 "设置日志级别为warn失败" - - # 步骤9:清理环境,如果之前未安装则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:清理环境,卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn软件包失败" - else - LOG_INFO "步骤9:保持hadoop-yarn软件包安装状态" - fi - - LOG_INFO "测试完成:测试设置命令的日志级别" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__workers.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__workers.sh deleted file mode 100644 index 11870259276..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn__workers.sh +++ /dev/null @@ -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-18 -# @License : Mulan PSL v2 -# @Desc : 测试开启工作节点模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试开启工作节点模式 - LOG_INFO "开始测试开启工作节点模式" - - # 定义软件包名称 - PACKAGE_NAME="hadoop-yarn" - - # 步骤1: 检查环境是否已安装 - LOG_INFO "步骤1: 检查环境是否已安装" - if rpm -q $PACKAGE_NAME &>/dev/null; then - LOG_INFO "$PACKAGE_NAME 已经安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "$PACKAGE_NAME 未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 步骤2: 检查yum源中是否有该软件包 - LOG_INFO "步骤2: 检查yum源中是否有该软件包" - if ! dnf list available $PACKAGE_NAME &>/dev/null; then - LOG_ERROR "yum源中没有找到 $PACKAGE_NAME 软件包" - exit 255 - fi - LOG_INFO "yum源中存在 $PACKAGE_NAME 软件包" - - # 步骤3: 如果未安装则安装软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装 $PACKAGE_NAME 软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - LOG_INFO "$PACKAGE_NAME 安装成功" - fi - - # 步骤4: 检查yarn命令是否存在 - LOG_INFO "步骤4: 检查yarn命令是否存在" - if ! command -v yarn &>/dev/null; then - LOG_ERROR "yarn命令不存在" - if [ $ALREADY_INSTALLED -eq 0 ]; then - dnf remove -y $PACKAGE_NAME - fi - exit 255 - fi - LOG_INFO "yarn命令存在" - - # 步骤5: 检查yarn workers命令是否支持 - LOG_INFO "步骤5: 检查yarn workers命令是否支持" - if ! yarn --help 2>&1 | grep -q "workers"; then - LOG_ERROR "yarn命令不支持workers参数" - if [ $ALREADY_INSTALLED -eq 0 ]; then - dnf remove -y $PACKAGE_NAME - fi - exit 255 - fi - LOG_INFO "yarn命令支持workers参数" - - # 步骤6: 执行yarn workers命令 - LOG_INFO "步骤6: 执行yarn workers命令" - yarn workers - CHECK_RESULT $? 0 0 "执行yarn workers命令失败" - LOG_INFO "yarn workers命令执行成功" - - # 步骤7: 环境恢复 - LOG_INFO "步骤7: 环境恢复" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试期间安装的软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - LOG_INFO "$PACKAGE_NAME 卸载成功" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试开启工作节点模式完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_app.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_app.sh deleted file mode 100644 index 503a6494043..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_app.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查看应用程序报告 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试查看应用程序报告功能" - - LOG_INFO "步骤1:检查Hadoop YARN相关软件包是否已在yum源中" - if ! dnf list available hadoop-yarn 2>/dev/null | grep -q hadoop-yarn; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已安装Hadoop YARN" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_INFO "Hadoop YARN已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "Hadoop YARN未安装,将在测试过程中安装并在结束后卸载" - INSTALLED=false - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装Hadoop YARN软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装Hadoop YARN失败" - fi - - LOG_INFO "步骤4:检查yarn命令是否支持application命令" - if ! yarn --help 2>&1 | grep -q "application"; then - LOG_ERROR "yarn命令不支持application参数" - exit 255 - fi - - LOG_INFO "步骤5:尝试查看应用程序报告" - yarn application -list - CHECK_RESULT $? 0 0 "查看应用程序报告失败" - - LOG_INFO "步骤6:环境清理" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载Hadoop YARN软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载Hadoop YARN失败" - else - LOG_INFO "保持Hadoop YARN安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_application.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_application.sh deleted file mode 100644 index 6f240c2d646..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_application.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查看应用程序报告(长格式) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:查看应用程序报告(长格式)" - - # 检查环境是否已安装Hadoop YARN - LOG_INFO "检查Hadoop YARN是否已安装" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "Hadoop YARN已安装,测试后保持安装状态" - INSTALLED=true - else - LOG_INFO "Hadoop YARN未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查yarn命令是否支持application -status参数 - LOG_INFO "检查yarn命令是否支持application -status参数" - if ! yarn application -help 2>&1 | grep -q "\-status"; then - LOG_ERROR "yarn命令不支持-application -status参数" - # 如果之前未安装,需要卸载已安装的软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - # 模拟一个YARN应用程序ID用于测试 - TEST_APP_ID="application_1234567890_0001" - LOG_INFO "使用测试应用程序ID: $TEST_APP_ID 查看应用程序报告(长格式)" - - # 尝试查看应用程序报告(长格式) - LOG_INFO "执行yarn application -status $TEST_APP_ID命令" - yarn application -status "$TEST_APP_ID" - CMD_EXIT_CODE=$? - - # 检查命令执行结果 - # 由于是测试环境,可能没有真实的应用程序,我们主要检查命令是否能正常执行 - # 如果返回码是0或非255,我们认为命令执行成功(参数支持) - if [ $CMD_EXIT_CODE -eq 255 ]; then - LOG_ERROR "yarn application -status命令执行失败,参数可能不存在或不支持" - # 如果之前未安装,需要卸载已安装的软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - elif [ $CMD_EXIT_CODE -ne 0 ]; then - LOG_INFO "yarn application -status命令执行返回非零退出码: $CMD_EXIT_CODE" - LOG_INFO "这可能是由于测试环境中没有真实的应用程序ID,但命令参数支持性测试通过" - # 继续执行,不退出 - fi - - # 如果之前未安装,测试完成后卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "测试完成,卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "测试完成,保持Hadoop YARN安装状态" - fi - - LOG_INFO "测试查看应用程序报告(长格式)完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_applicationattempt.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_applicationattempt.sh deleted file mode 100644 index 25628f9c048..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_applicationattempt.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查看应用程序尝试报告 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:检查hadoop-yarn是否已安装 - LOG_INFO "检查hadoop-yarn是否已安装" - rpm -q hadoop-yarn &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,将在测试步骤中安装" - INSTALLED=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn &>/dev/null - CHECK_RESULT $? 0 0 "yum源中没有hadoop-yarn软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 测试查看应用程序尝试报告 - LOG_INFO "测试查看应用程序尝试报告" - # 检查yarn命令是否存在 - command -v yarn &>/dev/null - CHECK_RESULT $? 0 0 "yarn命令不存在" - - # 检查yarn命令是否支持applicationattempt参数 - LOG_INFO "检查yarn命令是否支持applicationattempt参数" - yarn applicationattempt --help 2>&1 | grep -q "applicationattempt" - CHECK_RESULT $? 0 0 "yarn命令不支持applicationattempt参数" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持applicationattempt参数" - # 如果之前未安装,需要卸载已安装的软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - # 执行查看应用程序尝试报告命令 - LOG_INFO "执行yarn applicationattempt -list命令" - yarn applicationattempt -list 2>&1 - CHECK_RESULT $? 0 0 "查看应用程序尝试报告失败" - - # 环境清理 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "hadoop-yarn已安装,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_classpath.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_classpath.sh deleted file mode 100644 index 8daa093f258..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_classpath.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试打印运行hadoop jar所需的类路径 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="hadoop-yarn" - TEST_CMD="yarn" - TEST_ARG="classpath" - - # 步骤1: 检查yum源中是否存在指定软件包 - LOG_INFO "步骤1: 检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available ${PACKAGE_NAME} &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - - # 步骤2: 检查系统是否已安装指定软件包 - LOG_INFO "步骤2: 检查系统是否已安装${PACKAGE_NAME}软件包" - rpm -q ${PACKAGE_NAME} &> /dev/null - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "系统已安装${PACKAGE_NAME}软件包" - else - INSTALLED="false" - LOG_INFO "系统未安装${PACKAGE_NAME}软件包,将进行安装" - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "步骤3: 安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} &> /dev/null - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - fi - - # 步骤4: 检查yarn命令是否支持classpath参数 - LOG_INFO "步骤4: 检查${TEST_CMD}命令是否支持${TEST_ARG}参数" - ${TEST_CMD} --help 2>&1 | grep -q "\-\-${TEST_ARG}" - if [ $? -ne 0 ]; then - LOG_ERROR "${TEST_CMD}命令不支持${TEST_ARG}参数" - # 如果之前未安装,需要卸载已安装的软件包 - if [ "${INSTALLED}" = "false" ]; then - dnf remove -y ${PACKAGE_NAME} &> /dev/null - fi - exit 255 - fi - - # 步骤5: 执行yarn classpath命令 - LOG_INFO "步骤5: 执行${TEST_CMD} ${TEST_ARG}命令" - ${TEST_CMD} ${TEST_ARG} &> /dev/null - CHECK_RESULT $? 0 0 "执行${TEST_CMD} ${TEST_ARG}命令失败" - - # 步骤6: 验证输出结果包含类路径信息 - LOG_INFO "步骤6: 验证${TEST_CMD} ${TEST_ARG}输出包含类路径信息" - ${TEST_CMD} ${TEST_ARG} | grep -q ".*\.jar.*" - CHECK_RESULT $? 0 0 "${TEST_CMD} ${TEST_ARG}输出未包含类路径信息" - - # 步骤7: 环境清理 - LOG_INFO "步骤7: 环境清理" - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} &> /dev/null - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - else - LOG_INFO "系统原本已安装${PACKAGE_NAME}软件包,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_cluster.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_cluster.sh deleted file mode 100644 index cbe8ad978a4..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_cluster.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试打印集群信息 -# ############################################ - -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 - shift 2 - if [ "$actual" -ne "$expect" ]; then - LOG_ERROR "$*" - exit 255 - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_password=$3 - local node_user=$4 - sshpass -p "$node_password" ssh -o StrictHostKeyChecking=no "$node_user"@"$node_ip" "$cmd" - } - - # 定义软件包名称 - PACKAGE_NAME="hadoop-yarn" - - # 步骤1:检查yum源中是否有指定软件包 - LOG_INFO "步骤1:检查yum源中是否有 $PACKAGE_NAME 软件包" - dnf list available "$PACKAGE_NAME" &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包" - exit 255 - fi - - # 步骤2:检查环境是否已安装 - LOG_INFO "步骤2:检查环境是否已安装 $PACKAGE_NAME" - rpm -q "$PACKAGE_NAME" &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装 $PACKAGE_NAME,测试后保持安装状态" - INSTALLED=true - else - LOG_INFO "环境未安装 $PACKAGE_NAME,将安装并测试后卸载" - INSTALLED=false - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装 $PACKAGE_NAME 软件包" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - # 步骤4:测试打印集群信息 - LOG_INFO "步骤4:测试打印集群信息" - yarn cluster --list &> /dev/null - CHECK_RESULT $? 0 0 "yarn cluster 命令不支持或参数不存在" - - # 步骤5:执行具体的集群信息打印命令 - LOG_INFO "步骤5:执行 yarn cluster -status 命令" - yarn cluster -status - CHECK_RESULT $? 0 0 "执行 yarn cluster -status 失败" - - # 步骤6:清理环境,恢复到之前状态 - LOG_INFO "步骤6:清理环境,恢复到之前状态" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载 $PACKAGE_NAME 软件包" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - else - LOG_INFO "环境已安装 $PACKAGE_NAME,保持安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_container.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_container.sh deleted file mode 100644 index fef0f1c4fb4..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_container.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试打印容器报告 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:测试打印容器报告 - LOG_INFO "开始测试:测试打印容器报告" - - # 检查环境是否已安装Hadoop YARN相关软件包 - LOG_INFO "步骤1:检查Hadoop YARN相关软件包是否已安装" - if dnf list installed hadoop-yarn &> /dev/null; then - LOG_INFO "Hadoop YARN已安装,测试结束后将保持安装状态" - ENV_INSTALLED=true - else - LOG_INFO "Hadoop YARN未安装,将在测试过程中安装并在结束后卸载" - ENV_INSTALLED=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - if ! dnf search hadoop-yarn &> /dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 如果环境未安装,则安装软件包 - if [ "$ENV_INSTALLED" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查yarn命令是否存在 - LOG_INFO "步骤4:检查yarn命令是否存在" - if ! command -v yarn &> /dev/null; then - LOG_ERROR "yarn命令不存在" - if [ "$ENV_INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - # 检查yarn container命令是否支持 - LOG_INFO "步骤5:检查yarn container命令是否支持" - if ! yarn container --help &> /dev/null; then - LOG_ERROR "yarn container命令不支持或参数错误" - if [ "$ENV_INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - # 测试打印容器报告 - LOG_INFO "步骤6:执行yarn container -status命令打印容器报告" - yarn container -status - CHECK_RESULT $? 0 0 "执行yarn container -status命令失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$ENV_INSTALLED" = false ]; then - LOG_INFO "步骤7:清理环境,卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn软件包失败" - else - LOG_INFO "环境保持安装状态,无需清理" - fi - - LOG_INFO "测试完成:测试打印容器报告" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_daemonlog.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_daemonlog.sh deleted file mode 100644 index 04ce898b6df..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_daemonlog.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试获取/设置每个守护进程的日志级别 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试获取/设置每个守护进程的日志级别" - LOG_INFO "步骤1:检查是否已安装hadoop-yarn软件包" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,开始安装" - LOG_INFO "检查yum源中是否存在hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - INSTALLED=false - fi - - LOG_INFO "步骤2:测试获取守护进程的日志级别" - yarn daemonlog -getlevel - CHECK_RESULT $? 0 0 "获取守护进程日志级别失败" - - LOG_INFO "步骤3:测试设置守护进程的日志级别" - yarn daemonlog -setlevel DEBUG - CHECK_RESULT $? 0 0 "设置守护进程日志级别失败" - - LOG_INFO "步骤4:验证设置是否生效" - yarn daemonlog -getlevel | grep -q "DEBUG" - CHECK_RESULT $? 0 0 "验证日志级别设置失败" - - LOG_INFO "步骤5:恢复日志级别到默认值" - yarn daemonlog -setlevel INFO - CHECK_RESULT $? 0 0 "恢复日志级别失败" - - LOG_INFO "步骤6:环境清理" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "保持hadoop-yarn安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_envvars.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_envvars.sh deleted file mode 100644 index 8eb06b8915d..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_envvars.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试显示计算出的Hadoop环境变量 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装hadoop-yarn软件包 - LOG_INFO "步骤1:检查hadoop-yarn软件包是否已安装" - if rpm -q hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn软件包已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "hadoop-yarn软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn &>/dev/null - CHECK_RESULT $? 0 0 "yum源中没有hadoop-yarn软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn软件包失败" - fi - - # 测试显示计算出的Hadoop环境变量 - LOG_INFO "步骤4:测试显示计算出的Hadoop环境变量" - # 检查yarn命令是否支持envvars参数 - LOG_INFO "步骤4.1:检查yarn命令是否支持envvars参数" - yarn --help 2>&1 | grep -q "envvars" - CHECK_RESULT $? 0 0 "yarn命令不支持envvars参数" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持envvars参数" - exit 255 - fi - - # 执行yarn envvars命令 - LOG_INFO "步骤4.2:执行yarn envvars命令" - yarn envvars - CHECK_RESULT $? 0 0 "执行yarn envvars命令失败" - - # 清理环境:如果之前未安装,则卸载hadoop-yarn软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤5:清理环境,卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn软件包失败" - else - LOG_INFO "步骤5:环境已安装hadoop-yarn软件包,保持安装状态,无需卸载" - fi - - LOG_INFO "测试完成,环境已恢复到初始状态" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_fs2cs.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_fs2cs.sh deleted file mode 100644 index 21e941380bf..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_fs2cs.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试将公平调度器配置转换为容量调度器配置(实验性) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:将公平调度器配置转换为容量调度器配置(实验性)" - LOG_INFO "步骤1:检查是否已安装hadoop-yarn软件包" - if dnf list installed hadoop-yarn &> /dev/null; then - LOG_INFO "hadoop-yarn已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,将在测试中安装,并在结束前卸载" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &> /dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - LOG_INFO "步骤4:检查yarn fs2cs命令是否存在" - if ! yarn fs2cs --help &> /dev/null; then - LOG_ERROR "yarn fs2cs命令不存在或不支持" - exit 255 - fi - - LOG_INFO "步骤5:创建测试用的公平调度器配置文件" - cat > /tmp/fair-scheduler.xml << "EOF" - - - - - 1024 mb,1 vcores - 4096 mb,2 vcores - - - 1024 mb,1 vcores - 4096 mb,2 vcores - - - - EOF - CHECK_RESULT $? 0 0 "创建公平调度器配置文件失败" - - LOG_INFO "步骤6:执行yarn fs2cs命令进行转换" - yarn fs2cs /tmp/fair-scheduler.xml /tmp/capacity-scheduler.xml - CHECK_RESULT $? 0 0 "转换公平调度器配置为容量调度器配置失败" - - LOG_INFO "步骤7:检查生成的容量调度器配置文件是否存在" - if [ -f /tmp/capacity-scheduler.xml ]; then - LOG_INFO "容量调度器配置文件生成成功" - else - LOG_ERROR "容量调度器配置文件未生成" - exit 1 - fi - - LOG_INFO "步骤8:验证生成的配置文件内容" - if grep -q "yarn.scheduler.capacity.root.queues" /tmp/capacity-scheduler.xml; then - LOG_INFO "容量调度器配置文件内容验证通过" - else - LOG_ERROR "容量调度器配置文件内容验证失败" - exit 1 - fi - - LOG_INFO "步骤9:清理临时文件" - rm -f /tmp/fair-scheduler.xml /tmp/capacity-scheduler.xml - CHECK_RESULT $? 0 0 "清理临时文件失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤10:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成:将公平调度器配置转换为容量调度器配置(实验性)" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_jar_jar.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_jar_jar.sh deleted file mode 100644 index c3419c351df..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_jar_jar.sh +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行一个jar文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色和日志函数 - LOG_INFO() { - echo -e "\033[32m[INFO]\033[0m $1" - } - LOG_ERROR() { - echo -e "\033[31m[ERROR]\033[0m $1" - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package_name=$1 - LOG_INFO "检查yum源中是否存在软件包: $package_name" - dnf list available "$package_name" &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在软件包: $package_name" - exit 255 - fi - } - - # 检查命令参数是否存在 - check_command_option() { - local cmd=$1 - local option=$2 - LOG_INFO "检查命令 $cmd 是否支持参数: $option" - if ! $cmd --help 2>&1 | grep -q "$option"; then - LOG_ERROR "命令 $cmd 不支持参数: $option" - exit 255 - fi - } - - # 检查环境是否已安装hadoop-yarn - check_hadoop_yarn_installed() { - LOG_INFO "检查hadoop-yarn是否已安装" - rpm -q hadoop-yarn &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装" - HADOOP_INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装" - HADOOP_INSTALLED=false - fi - } - - # 安装hadoop-yarn - install_hadoop_yarn() { - LOG_INFO "开始安装hadoop-yarn" - check_package_in_repo "hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - LOG_INFO "hadoop-yarn安装成功" - } - - # 卸载hadoop-yarn - uninstall_hadoop_yarn() { - LOG_INFO "开始卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - LOG_INFO "hadoop-yarn卸载成功" - } - - # 测试运行jar文件 - test_run_jar() { - LOG_INFO "测试运行jar文件" - - # 创建测试jar文件 - LOG_INFO "创建测试jar文件" - cat > /tmp/TestYarn.jar << "EOF" - import java.io.IOException; - import org.apache.hadoop.conf.Configuration; - import org.apache.hadoop.yarn.conf.YarnConfiguration; - import org.apache.hadoop.yarn.client.api.YarnClient; - import org.apache.hadoop.yarn.client.api.YarnClientFactory; - - public class TestYarn { - public static void main(String[] args) { - System.out.println("TestYarn jar is running!"); - System.out.println("YARN test completed successfully!"); - System.exit(0); - } - } - EOF - - # 编译测试jar文件(简化版本,实际可能需要更多依赖) - LOG_INFO "编译测试jar文件" - javac -cp $(hadoop classpath) /tmp/TestYarn.java 2>/tmp/compile_error.log || { - LOG_INFO "使用简化测试方法" - # 使用一个简单的测试jar - jar -cvf /tmp/TestYarn.jar -C /tmp TestYarn.class 2>/dev/null || { - # 如果上面的方法失败,使用yarn自带的示例jar - find /usr -name "*example*.jar" 2>/dev/null | head -1 > /tmp/test_jar_path.txt - TEST_JAR=$(cat /tmp/test_jar_path.txt) - if [ -n "$TEST_JAR" ] && [ -f "$TEST_JAR" ]; then - LOG_INFO "使用找到的示例jar: $TEST_JAR" - TEST_JAR_PATH="$TEST_JAR" - else - LOG_INFO "创建最简单的测试jar" - echo "public class Test { public static void main(String[] args) { System.out.println("Test passed!"); } }" > /tmp/Test.java - javac /tmp/Test.java - jar cvf /tmp/TestYarn.jar -C /tmp Test.class - TEST_JAR_PATH="/tmp/TestYarn.jar" - fi - } - } - - # 检查yarn命令是否可用 - LOG_INFO "检查yarn命令是否可用" - command -v yarn >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yarn命令不可用" - - # 检查yarn jar命令参数 - check_command_option "yarn" "jar" - - # 启动YARN服务(如果需要) - LOG_INFO "检查YARN服务状态" - systemctl status yarn-resourcemanager 2>/dev/null || { - LOG_INFO "尝试启动YARN服务" - systemctl start yarn-resourcemanager 2>/dev/null || true - systemctl start yarn-nodemanager 2>/dev/null || true - } - - # 等待服务启动 - sleep 3 - - # 测试运行jar文件 - LOG_INFO "执行yarn jar命令" - if [ -n "$TEST_JAR_PATH" ] && [ -f "$TEST_JAR_PATH" ]; then - yarn jar "$TEST_JAR_PATH" 2>&1 | tee /tmp/yarn_jar_test.log - YARN_RESULT=${PIPESTATUS[0]} - else - # 尝试使用hadoop自带的示例 - yarn jar /usr/share/hadoop/mapreduce/hadoop-mapreduce-examples*.jar pi 1 1 2>&1 | tee /tmp/yarn_jar_test.log - YARN_RESULT=${PIPESTATUS[0]} - fi - - # 检查结果 - if [ $YARN_RESULT -eq 0 ] || grep -q "Test passed\|completed successfully" /tmp/yarn_jar_test.log; then - LOG_INFO "jar文件运行测试成功" - CHECK_RESULT 0 0 0 "jar文件运行测试失败" - else - LOG_ERROR "jar文件运行测试失败" - CHECK_RESULT 1 0 0 "jar文件运行测试失败" - fi - } - - # 主函数 - main() { - LOG_INFO "开始测试:运行一个jar文件" - - # 记录初始安装状态 - check_hadoop_yarn_installed - - # 如果未安装,则安装 - if [ "$HADOOP_INSTALLED" = "false" ]; then - install_hadoop_yarn - NEED_UNINSTALL=true - else - NEED_UNINSTALL=false - fi - - # 执行测试 - test_run_jar - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/TestYarn.* /tmp/Test.* /tmp/yarn_jar_test.log /tmp/compile_error.log /tmp/test_jar_path.txt 2>/dev/null - - # 如果测试前未安装,则卸载 - if [ "$NEED_UNINSTALL" = "true" ]; then - uninstall_hadoop_yarn - fi - - LOG_INFO "测试完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_logs.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_logs.sh deleted file mode 100644 index 3bec50af7d0..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_logs.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试转储容器日志 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试转储容器日志" - LOG_INFO "步骤1:检查hadoop-yarn软件包是否已在yum源中" - dnf list available hadoop-yarn 2>/dev/null | grep -q hadoop-yarn - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - LOG_INFO "hadoop-yarn软件包在yum源中存在" - - LOG_INFO "步骤2:检查hadoop-yarn是否已安装" - rpm -q hadoop-yarn >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已安装,测试后保持安装状态" - INSTALLED=1 - else - LOG_INFO "hadoop-yarn未安装,将安装作为测试步骤" - INSTALLED=0 - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - LOG_INFO "步骤4:检查yarn logs命令是否支持-containerId参数" - yarn logs --help 2>&1 | grep -q -- "-containerId" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn logs命令不支持-containerId参数" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤5:卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - LOG_INFO "yarn logs命令支持-containerId参数" - - LOG_INFO "步骤5:尝试使用yarn logs命令转储容器日志" - LOG_INFO "模拟一个不存在的容器ID,预期命令执行失败" - yarn logs -containerId container_123456789_1234_01_000001 2>&1 - EXPECTED_EXIT_CODE=$? - if [ $EXPECTED_EXIT_CODE -eq 0 ]; then - LOG_ERROR "yarn logs命令意外成功,但预期应失败" - CHECK_RESULT 1 0 0 "命令退出码检查失败" - else - LOG_INFO "yarn logs命令按预期失败,退出码为$EXPECTED_EXIT_CODE" - CHECK_RESULT $EXPECTED_EXIT_CODE 0 1 "命令退出码检查通过" - fi - - LOG_INFO "步骤6:清理测试环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "测试前已安装hadoop-yarn,保持安装状态" - fi - - LOG_INFO "测试完成:测试转储容器日志" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_node.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_node.sh deleted file mode 100644 index 703d6728925..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_node.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试打印节点报告 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试打印节点报告" - LOG_INFO "步骤1:检查yarn软件包是否在yum源中" - dnf list available hadoop-yarn 2>/dev/null | grep -q hadoop-yarn - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查hadoop-yarn是否已经安装" - rpm -q hadoop-yarn > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn已经安装,标记为已安装状态" - ALREADY_INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,标记为未安装状态" - ALREADY_INSTALLED=false - fi - - if [ "$ALREADY_INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - LOG_INFO "步骤4:检查yarn命令的node参数是否支持" - yarn node --help 2>&1 | grep -q -- "--help" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不支持node参数" - if [ "$ALREADY_INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载hadoop-yarn" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - LOG_INFO "步骤5:执行yarn node -list命令打印节点报告" - yarn node -list - CHECK_RESULT $? 0 0 "执行yarn node -list命令失败" - - if [ "$ALREADY_INSTALLED" = "false" ]; then - LOG_INFO "步骤6:清理环境,卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_nodeattributes.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_nodeattributes.sh deleted file mode 100644 index 3c116c85894..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_nodeattributes.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试节点属性命令行客户端 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试节点属性命令行客户端" - LOG_INFO "步骤1: 检查是否已安装hadoop-yarn软件包" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "hadoop-yarn未安装,将进行安装" - INSTALLED=false - fi - - LOG_INFO "步骤2: 检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3: 安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - LOG_INFO "步骤4: 测试节点属性命令行客户端的基本功能" - LOG_INFO "检查yarn nodeattributes命令是否支持" - if ! yarn nodeattributes --help &>/dev/null; then - LOG_ERROR "yarn nodeattributes命令不存在或不支持" - exit 255 - fi - - LOG_INFO "步骤5: 执行yarn nodeattributes命令查看节点属性" - yarn nodeattributes -list - CHECK_RESULT $? 0 0 "执行yarn nodeattributes命令失败" - - LOG_INFO "步骤6: 测试添加节点属性" - yarn nodeattributes -add "testattribute=testvalue" - CHECK_RESULT $? 0 0 "添加节点属性失败" - - LOG_INFO "步骤7: 验证节点属性是否添加成功" - yarn nodeattributes -list | grep -q "testattribute=testvalue" - CHECK_RESULT $? 0 0 "验证节点属性添加失败" - - LOG_INFO "步骤8: 测试删除节点属性" - yarn nodeattributes -remove "testattribute" - CHECK_RESULT $? 0 0 "删除节点属性失败" - - LOG_INFO "步骤9: 验证节点属性是否删除成功" - if yarn nodeattributes -list | grep -q "testattribute"; then - LOG_ERROR "节点属性删除失败" - exit 1 - fi - CHECK_RESULT $? 0 0 "验证节点属性删除失败" - - LOG_INFO "步骤10: 清理测试环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "保持hadoop-yarn安装状态" - fi - - LOG_INFO "节点属性命令行客户端测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_nodemanager.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_nodemanager.sh deleted file mode 100644 index e6fdd0d65f0..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_nodemanager.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试在每个工作节点上运行节点管理器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了hadoop-yarn-nodemanager - LOG_INFO "检查hadoop-yarn-nodemanager是否已安装" - rpm -q hadoop-yarn-nodemanager > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn-nodemanager已安装,测试结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "hadoop-yarn-nodemanager未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有hadoop-yarn-nodemanager包 - LOG_INFO "检查yum源中是否有hadoop-yarn-nodemanager包" - dnf list available hadoop-yarn-nodemanager > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中没有hadoop-yarn-nodemanager包" - - # 安装hadoop-yarn-nodemanager(如果未安装) - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装hadoop-yarn-nodemanager" - dnf install -y hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "安装hadoop-yarn-nodemanager失败" - fi - - # 检查nodemanager命令是否存在 - LOG_INFO "检查nodemanager命令是否存在" - which nodemanager > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "nodemanager命令不存在" - - # 测试nodemanager命令的基本参数 - LOG_INFO "测试nodemanager命令的--help参数" - nodemanager --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "nodemanager --help命令执行失败" - - # 测试nodemanager命令的无效参数 - LOG_INFO "测试nodemanager命令的无效参数" - nodemanager --invalid-param > /dev/null 2>&1 - if [ $? -ne 255 ]; then - LOG_ERROR "nodemanager命令不支持--invalid-param参数时应退出码为255" - exit 255 - fi - - # 测试启动nodemanager服务 - LOG_INFO "测试启动nodemanager服务" - systemctl start hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "启动nodemanager服务失败" - - # 检查nodemanager服务状态 - LOG_INFO "检查nodemanager服务状态" - systemctl status hadoop-yarn-nodemanager --no-pager | grep -q "active (running)" - CHECK_RESULT $? 0 0 "nodemanager服务未正常运行" - - # 测试停止nodemanager服务 - LOG_INFO "测试停止nodemanager服务" - systemctl stop hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "停止nodemanager服务失败" - - # 如果测试前未安装,则卸载hadoop-yarn-nodemanager - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载hadoop-yarn-nodemanager" - dnf remove -y hadoop-yarn-nodemanager - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-nodemanager失败" - else - LOG_INFO "测试前已安装hadoop-yarn-nodemanager,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_proxyserver.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_proxyserver.sh deleted file mode 100644 index b1998b76e6a..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_proxyserver.sh +++ /dev/null @@ -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-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行Web应用程序代理服务器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试运行Web应用程序代理服务器" - LOG_INFO "步骤1: 检查环境是否已安装hadoop-yarn-proxyserver软件包" - rpm -q hadoop-yarn-proxyserver - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn-proxyserver已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn-proxyserver未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2: 检查yum源中是否有hadoop-yarn-proxyserver软件包" - dnf list available hadoop-yarn-proxyserver - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn-proxyserver软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装hadoop-yarn-proxyserver软件包" - dnf install -y hadoop-yarn-proxyserver - CHECK_RESULT $? 0 0 "安装hadoop-yarn-proxyserver失败" - fi - - LOG_INFO "步骤4: 检查hadoop-yarn-proxyserver命令参数" - yarn proxyserver --help - CHECK_RESULT $? 0 0 "hadoop-yarn-proxyserver命令参数检查失败" - - LOG_INFO "步骤5: 启动Web应用程序代理服务器" - yarn proxyserver & - PROXY_PID=$! - sleep 5 - - LOG_INFO "步骤6: 检查Web应用程序代理服务器进程是否运行" - ps -p $PROXY_PID - CHECK_RESULT $? 0 0 "Web应用程序代理服务器进程未运行" - - LOG_INFO "步骤7: 停止Web应用程序代理服务器" - kill $PROXY_PID - CHECK_RESULT $? 0 0 "停止Web应用程序代理服务器失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤8: 卸载hadoop-yarn-proxyserver软件包" - dnf remove -y hadoop-yarn-proxyserver - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-proxyserver失败" - fi - - LOG_INFO "测试运行Web应用程序代理服务器完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_queue.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_queue.sh deleted file mode 100644 index c65810e93f2..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_queue.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试打印队列信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试打印队列信息" - - # 检查是否已安装hadoop-yarn - LOG_INFO "步骤1:检查hadoop-yarn是否已安装" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装" - already_installed=true - else - LOG_INFO "hadoop-yarn未安装" - already_installed=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查yarn命令是否支持queue参数 - LOG_INFO "步骤4:检查yarn命令是否支持queue参数" - if ! yarn queue --help &>/dev/null; then - LOG_ERROR "yarn命令不支持queue参数" - # 如果是新安装的,需要卸载 - if [ "$already_installed" = false ]; then - LOG_INFO "清理:卸载新安装的hadoop-yarn" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - # 执行测试:打印队列信息 - LOG_INFO "步骤5:执行测试 - 打印队列信息" - yarn queue -list - CHECK_RESULT $? 0 0 "打印队列信息失败" - - # 环境恢复 - LOG_INFO "步骤6:环境恢复" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载新安装的hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "保持原有安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_registrydns.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_registrydns.sh deleted file mode 100644 index 62b6390924f..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_registrydns.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行注册表DNS服务器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试运行注册表DNS服务器" - - # 定义软件包名称 - PACKAGE_NAME="hadoop-yarn-yarn_registrydns" - - # 检查环境是否已安装 - LOG_INFO "检查环境是否已安装软件包:$PACKAGE_NAME" - if dnf list installed "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "环境已安装软件包:$PACKAGE_NAME,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "环境未安装软件包:$PACKAGE_NAME,测试过程中将进行安装" - INSTALLED_BEFORE_TEST=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有软件包:$PACKAGE_NAME" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "yum源中未找到软件包:$PACKAGE_NAME" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装软件包:$PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 测试运行注册表DNS服务器 - LOG_INFO "测试运行注册表DNS服务器" - yarn_registrydns --help &>/dev/null - CHECK_RESULT $? 0 0 "运行注册表DNS服务器失败" - - # 检查命令参数是否存在或不支持 - LOG_INFO "检查命令参数是否存在或不支持" - if ! yarn_registrydns --help 2>&1 | grep -q "usage"; then - LOG_ERROR "命令参数不存在或不支持" - exit 255 - fi - - # 如果需要多个服务器并在第二个服务器上执行命令,使用SSH_CMD - # 示例:SSH_CMD "ls" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载软件包:$PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_resourcemanager.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_resourcemanager.sh deleted file mode 100644 index d43f501dbf8..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_resourcemanager.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行资源管理器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查环境是否已安装hadoop-yarn-resourcemanager - LOG_INFO "检查hadoop-yarn-resourcemanager是否已安装" - rpm -q hadoop-yarn-resourcemanager &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn-resourcemanager已安装,测试结束后保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "hadoop-yarn-resourcemanager未安装,将在测试前安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否存在hadoop-yarn-resourcemanager软件包 - LOG_INFO "检查yum源中是否存在hadoop-yarn-resourcemanager软件包" - dnf list available hadoop-yarn-resourcemanager &> /dev/null - CHECK_RESULT $? 0 255 "yum源中不存在hadoop-yarn-resourcemanager软件包" - - # 如果未安装则安装软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装hadoop-yarn-resourcemanager软件包" - dnf install -y hadoop-yarn-resourcemanager - CHECK_RESULT $? 0 0 "安装hadoop-yarn-resourcemanager失败" - fi - - # 检查yarn命令是否存在 - LOG_INFO "检查yarn命令是否存在" - which yarn &> /dev/null - CHECK_RESULT $? 0 255 "yarn命令不存在" - - # 检查yarn resourcemanager命令是否支持 - LOG_INFO "检查yarn resourcemanager命令是否支持" - yarn resourcemanager --help &> /dev/null - CHECK_RESULT $? 0 255 "yarn resourcemanager命令不支持" - - # 启动资源管理器 - LOG_INFO "启动资源管理器" - yarn resourcemanager & - RM_PID=$! - sleep 5 - - # 检查资源管理器进程是否运行 - LOG_INFO "检查资源管理器进程是否运行" - ps -p $RM_PID &> /dev/null - CHECK_RESULT $? 0 0 "资源管理器进程未运行" - - # 检查资源管理器服务端口 - LOG_INFO "检查资源管理器服务端口" - netstat -tlnp | grep :8032 &> /dev/null - CHECK_RESULT $? 0 0 "资源管理器服务端口未监听" - - # 停止资源管理器 - LOG_INFO "停止资源管理器" - kill $RM_PID - wait $RM_PID 2>/dev/null - - # 清理环境 - LOG_INFO "清理环境" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载hadoop-yarn-resourcemanager软件包" - dnf remove -y hadoop-yarn-resourcemanager - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-resourcemanager失败" - else - LOG_INFO "保持hadoop-yarn-resourcemanager安装状态" - fi - - LOG_INFO "测试运行资源管理器完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_rmadmin.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_rmadmin.sh deleted file mode 100644 index 8e21fa7c70c..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_rmadmin.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行资源管理器管理工具 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试运行资源管理器管理工具" - - # 检查环境是否已安装hadoop-yarn软件包 - LOG_INFO "检查hadoop-yarn软件包是否已安装" - rpm -q hadoop-yarn >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "hadoop-yarn软件包已安装,测试后保持安装状态" - installed=true - else - LOG_INFO "hadoop-yarn软件包未安装,将在测试过程中安装" - installed=false - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否存在hadoop-yarn软件包" - dnf list available hadoop-yarn >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有hadoop-yarn软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装hadoop-yarn软件包失败" - fi - - # 测试yarn rmadmin命令的基本功能 - LOG_INFO "测试yarn rmadmin命令的基本功能" - yarn rmadmin -help >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yarn rmadmin命令执行失败" - - # 测试yarn rmadmin命令的特定参数 - LOG_INFO "测试yarn rmadmin命令的-refreshNodes参数" - yarn rmadmin -refreshNodes >/dev/null 2>&1 - # 注意:这里不检查结果,因为-refreshNodes可能需要特定配置 - # 我们只是测试命令是否能识别该参数 - - # 测试不支持的参数 - LOG_INFO "测试yarn rmadmin命令的不支持参数" - yarn rmadmin -invalidParam >/dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_INFO "不支持参数测试通过" - else - LOG_ERROR "不支持参数测试失败" - exit 255 - fi - - # 如果需要多服务器测试,可以这样使用(示例) - # LOG_INFO "在第二个节点上测试yarn rmadmin命令" - # SSH_CMD "yarn rmadmin -help" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - # CHECK_RESULT $? 0 0 "在第二个节点上执行yarn rmadmin命令失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载hadoop-yarn软件包失败" - LOG_INFO "已恢复到测试前的环境状态" - else - LOG_INFO "保持hadoop-yarn软件包安装状态" - fi - - LOG_INFO "测试运行资源管理器管理工具完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_router.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_router.sh deleted file mode 100644 index 85889793b51..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_router.sh +++ /dev/null @@ -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-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行路由器守护进程 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试运行路由器守护进程" - - LOG_INFO "检查环境是否已安装hadoop-yarn-yarn-router软件包" - if rpm -q hadoop-yarn-yarn-router &> /dev/null; then - LOG_INFO "hadoop-yarn-yarn-router已安装,测试完成后保持安装状态" - INSTALLED=true - else - LOG_INFO "hadoop-yarn-yarn-router未安装,将在测试过程中安装并在结束后卸载" - INSTALLED=false - fi - - LOG_INFO "检查yum源中是否存在hadoop-yarn-yarn-router软件包" - if ! dnf list available hadoop-yarn-yarn-router &> /dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn-yarn-router软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装hadoop-yarn-yarn-router软件包" - dnf install -y hadoop-yarn-yarn-router - CHECK_RESULT $? 0 0 "安装hadoop-yarn-yarn-router失败" - fi - - LOG_INFO "检查yarn router命令参数是否支持" - yarn router --help &> /dev/null - CHECK_RESULT $? 0 255 "yarn router命令参数不支持或不存在" - - LOG_INFO "启动yarn router守护进程" - yarn router & - ROUTER_PID=$! - sleep 3 - - LOG_INFO "检查yarn router进程是否正在运行" - ps -p $ROUTER_PID &> /dev/null - CHECK_RESULT $? 0 0 "yarn router进程启动失败" - - LOG_INFO "停止yarn router守护进程" - kill $ROUTER_PID - CHECK_RESULT $? 0 0 "停止yarn router进程失败" - wait $ROUTER_PID 2>/dev/null - - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hadoop-yarn-yarn-router软件包" - dnf remove -y hadoop-yarn-yarn-router - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-yarn-router失败" - fi - - LOG_INFO "测试运行路由器守护进程完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_schedulerconf.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_schedulerconf.sh deleted file mode 100644 index 70012b34ba9..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_schedulerconf.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试更新调度器配置 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试更新调度器配置" - LOG_INFO "检查环境是否已安装Hadoop YARN相关软件包" - rpm -qa | grep -E "^hadoop-yarn-|^hadoop-" - if [ $? -eq 0 ]; then - LOG_INFO "Hadoop YARN已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "Hadoop YARN未安装,将在测试过程中安装" - INSTALLED=false - fi - LOG_INFO "检查yum源中是否存在hadoop-yarn软件包" - dnf list available hadoop-yarn 2>/dev/null | grep -q "^hadoop-yarn" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - LOG_INFO "检查yarn命令是否支持更新调度器配置参数" - yarn schedulerconf -help 2>&1 | grep -q "\-\-update" - if [ $? -ne 0 ]; then - LOG_ERROR "yarn schedulerconf命令不支持--update参数" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - LOG_INFO "备份当前调度器配置" - yarn schedulerconf -list > /tmp/scheduler_backup.conf 2>/dev/null - BACKUP_RESULT=$? - if [ $BACKUP_RESULT -ne 0 ]; then - LOG_ERROR "备份当前调度器配置失败" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit $BACKUP_RESULT - fi - LOG_INFO "测试更新调度器配置" - yarn schedulerconf -update -addQueue root.testQueue - CHECK_RESULT $? 0 0 "更新调度器配置失败" - LOG_INFO "验证调度器配置是否更新成功" - yarn schedulerconf -list | grep -q "root.testQueue" - CHECK_RESULT $? 0 0 "调度器配置更新后未找到root.testQueue" - LOG_INFO "恢复调度器配置" - if [ -f /tmp/scheduler_backup.conf ]; then - while read -r line; do - if [ -n "$line" ]; then - yarn schedulerconf -update -addQueue "$line" 2>/dev/null - fi - done < /tmp/scheduler_backup.conf - yarn schedulerconf -removeQueue root.testQueue 2>/dev/null - fi - LOG_INFO "清理临时文件" - rm -f /tmp/scheduler_backup.conf - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - LOG_INFO "测试更新调度器配置完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_scmadmin.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_scmadmin.sh deleted file mode 100644 index 7590aff0e46..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_scmadmin.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试共享缓存管理器管理工具 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装hadoop-yarn - LOG_INFO "检查hadoop-yarn是否已安装" - if dnf list installed hadoop-yarn &>/dev/null; then - LOG_INFO "hadoop-yarn已安装,脚本结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "hadoop-yarn未安装,将在测试中安装并在结束后卸载" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - if ! dnf list available hadoop-yarn &>/dev/null; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 安装hadoop-yarn(如果未安装) - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 测试共享缓存管理器管理工具 - LOG_INFO "测试共享缓存管理器管理工具:yarn scmadmin" - # 检查yarn scmadmin命令是否存在 - if ! command -v yarn &>/dev/null; then - LOG_ERROR "yarn命令不存在" - exit 255 - fi - - # 检查scmadmin参数是否支持 - LOG_INFO "检查scmadmin参数是否支持" - yarn scmadmin --help &>/dev/null - CHECK_RESULT $? 0 0 "scmadmin参数不存在或不支持" - - # 执行scmadmin命令进行测试 - LOG_INFO "执行yarn scmadmin -help命令" - yarn scmadmin -help - CHECK_RESULT $? 0 0 "执行yarn scmadmin -help失败" - - LOG_INFO "测试共享缓存管理器管理工具完成" - - # 环境清理 - LOG_INFO "开始环境清理" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - else - LOG_INFO "保持hadoop-yarn安装状态" - fi - - LOG_INFO "环境清理完成,测试脚本结束" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_sharedcachemanager.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_sharedcachemanager.sh deleted file mode 100644 index 7ce084ea4f8..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_sharedcachemanager.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行共享缓存管理器守护进程 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试运行共享缓存管理器守护进程" - LOG_INFO "检查环境是否已安装hadoop-yarn相关软件包" - if dnf list installed hadoop-yarn > /dev/null 2>&1; then - LOG_INFO "环境已安装hadoop-yarn软件包,测试后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "环境未安装hadoop-yarn软件包,将在测试过程中安装" - INSTALLED=0 - fi - - LOG_INFO "检查yum源中是否存在hadoop-yarn软件包" - if ! dnf list available hadoop-yarn > /dev/null 2>&1; then - LOG_ERROR "yum源中不存在hadoop-yarn软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn软件包失败" - fi - - LOG_INFO "检查共享缓存管理器守护进程命令参数" - if ! yarn sharedcachemanager --help > /dev/null 2>&1; then - LOG_ERROR "共享缓存管理器守护进程命令参数不存在或不支持" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - fi - exit 255 - fi - - LOG_INFO "启动共享缓存管理器守护进程" - yarn sharedcachemanager & - PID=$! - sleep 5 - - LOG_INFO "检查共享缓存管理器守护进程是否运行" - if ps -p $PID > /dev/null 2>&1; then - LOG_INFO "共享缓存管理器守护进程正在运行" - else - LOG_ERROR "共享缓存管理器守护进程启动失败" - CHECK_RESULT 1 0 0 "共享缓存管理器守护进程未运行" - fi - - LOG_INFO "停止共享缓存管理器守护进程" - kill $PID - CHECK_RESULT $? 0 0 "停止共享缓存管理器守护进程失败" - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn软件包失败" - fi - - LOG_INFO "测试运行共享缓存管理器守护进程完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_timelinereader.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_timelinereader.sh deleted file mode 100644 index cdd6b7c0de8..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_timelinereader.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行时间轴读取器服务器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数 - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local exit_code=$3 - local error_msg=$4 - - if [ $actual -ne $expect ]; then - LOG_ERROR "$error_msg" - exit $exit_code - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_password=$3 - local node_user=$4 - - # 这里假设SSH_CMD已经实现,直接调用 - sshpass -p "$node_password" ssh -o StrictHostKeyChecking=no "$node_user@$node_ip" "$cmd" - } - - # 测试脚本主逻辑 - main() { - # 步骤1:检查环境是否已安装hadoop-yarn-yarn-timelinereader - LOG_INFO "步骤1:检查hadoop-yarn-yarn-timelinereader是否已安装" - if dnf list installed hadoop-yarn-yarn-timelinereader &>/dev/null; then - LOG_INFO "hadoop-yarn-yarn-timelinereader已安装,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "hadoop-yarn-yarn-timelinereader未安装,将在测试中安装" - already_installed=false - fi - - # 步骤2:检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否有hadoop-yarn-yarn-timelinereader软件包" - if ! dnf search hadoop-yarn-yarn-timelinereader &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn-yarn-timelinereader软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装hadoop-yarn-yarn-timelinereader软件包" - dnf install -y hadoop-yarn-yarn-timelinereader - CHECK_RESULT $? 0 255 "安装hadoop-yarn-yarn-timelinereader失败" - fi - - # 步骤4:测试运行时间轴读取器服务器 - LOG_INFO "步骤4:测试运行时间轴读取器服务器" - # 假设启动命令为hadoop-yarn-yarn-timelinereader,实际命令可能需要调整 - if ! command -v hadoop-yarn-yarn-timelinereader &>/dev/null; then - LOG_ERROR "hadoop-yarn-yarn-timelinereader命令不存在" - exit 255 - fi - - # 测试命令执行,假设--version参数存在 - LOG_INFO "测试hadoop-yarn-yarn-timelinereader --version命令" - hadoop-yarn-yarn-timelinereader --version - CHECK_RESULT $? 0 1 "hadoop-yarn-yarn-timelinereader --version执行失败" - - # 步骤5:清理环境 - LOG_INFO "步骤5:清理环境" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载hadoop-yarn-yarn-timelinereader软件包" - dnf remove -y hadoop-yarn-yarn-timelinereader - CHECK_RESULT $? 0 1 "卸载hadoop-yarn-yarn-timelinereader失败" - else - LOG_INFO "保持hadoop-yarn-yarn-timelinereader安装状态" - fi - - LOG_INFO "测试完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_timelineserver.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_timelineserver.sh deleted file mode 100644 index 4bc1d5e1fc9..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_timelineserver.sh +++ /dev/null @@ -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-18 -# @License : Mulan PSL v2 -# @Desc : 测试运行时间轴服务器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试Hadoop YARN Timeline Server" - - # 检查环境是否已安装 - LOG_INFO "检查Hadoop YARN Timeline Server是否已安装" - if dnf list installed hadoop-yarn-timelineserver &> /dev/null; then - LOG_INFO "Hadoop YARN Timeline Server已安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "Hadoop YARN Timeline Server未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn-timelineserver软件包" - if ! dnf list available hadoop-yarn-timelineserver &> /dev/null; then - LOG_ERROR "yum源中未找到hadoop-yarn-timelineserver软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装hadoop-yarn-timelineserver软件包" - dnf install -y hadoop-yarn-timelineserver - CHECK_RESULT $? 0 0 "安装hadoop-yarn-timelineserver失败" - fi - - # 检查命令参数 - LOG_INFO "检查timelineserver命令参数" - if ! yarn timelineserver --help &> /dev/null; then - LOG_ERROR "timelineserver命令参数不存在或不支持" - # 清理环境 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载hadoop-yarn-timelineserver" - dnf remove -y hadoop-yarn-timelineserver - fi - exit 255 - fi - - # 启动Timeline Server - LOG_INFO "启动YARN Timeline Server" - yarn timelineserver start - CHECK_RESULT $? 0 0 "启动YARN Timeline Server失败" - - # 检查Timeline Server状态 - LOG_INFO "检查YARN Timeline Server状态" - sleep 3 - if ! yarn timelineserver status &> /dev/null; then - LOG_ERROR "YARN Timeline Server状态检查失败" - yarn timelineserver stop - # 清理环境 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载hadoop-yarn-timelineserver" - dnf remove -y hadoop-yarn-timelineserver - fi - exit 1 - fi - - # 停止Timeline Server - LOG_INFO "停止YARN Timeline Server" - yarn timelineserver stop - CHECK_RESULT $? 0 0 "停止YARN Timeline Server失败" - - # 清理环境 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载hadoop-yarn-timelineserver" - dnf remove -y hadoop-yarn-timelineserver - CHECK_RESULT $? 0 0 "卸载hadoop-yarn-timelineserver失败" - else - LOG_INFO "保持Hadoop YARN Timeline Server安装状态" - fi - - LOG_INFO "Hadoop YARN Timeline Server测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_top.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_top.sh deleted file mode 100644 index 5c63bf4b90e..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_top.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试查看集群信息(top命令) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试查看集群信息(top命令)" - - # 检查yum源中是否存在hadoop-yarn软件包 - LOG_INFO "步骤1:检查yum源中是否存在hadoop-yarn软件包" - dnf list available hadoop-yarn 2>/dev/null | grep -q hadoop-yarn - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到hadoop-yarn软件包" - exit 255 - fi - - # 检查hadoop-yarn是否已安装 - LOG_INFO "步骤2:检查hadoop-yarn是否已安装" - rpm -q hadoop-yarn >/dev/null 2>&1 - INSTALLED=$? - - # 如果未安装,则安装软件包 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "步骤3:安装hadoop-yarn软件包" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 检查yarn命令是否存在 - LOG_INFO "步骤4:检查yarn命令是否存在" - which yarn >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yarn命令不存在" - exit 255 - fi - - # 检查yarn top命令是否支持 - LOG_INFO "步骤5:检查yarn top命令是否支持" - yarn top --help >/dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "yarn top命令不支持或参数错误" - exit 255 - fi - - # 执行yarn top命令查看集群信息 - LOG_INFO "步骤6:执行yarn top命令查看集群信息" - yarn top - CHECK_RESULT $? 0 0 "执行yarn top命令失败" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "步骤7:清理环境,卸载hadoop-yarn软件包" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成:测试查看集群信息(top命令)" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_version.sh b/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_version.sh deleted file mode 100644 index dd24692660e..00000000000 --- a/testcases/function_test/pkg_test/hadoop/hadoop-yarn/test_hadoop-yarn_yarn_version.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-18 -# @License : Mulan PSL v2 -# @Desc : 测试打印yarn版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装hadoop-yarn - LOG_INFO "检查是否已安装hadoop-yarn" - rpm -q hadoop-yarn &> /dev/null - installed=$? - - # 检查yum源中是否有hadoop-yarn软件包 - LOG_INFO "检查yum源中是否有hadoop-yarn软件包" - dnf list available hadoop-yarn &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有hadoop-yarn软件包" - exit 255 - fi - - # 如果未安装,则安装hadoop-yarn - if [ $installed -ne 0 ]; then - LOG_INFO "安装hadoop-yarn" - dnf install -y hadoop-yarn - CHECK_RESULT $? 0 0 "安装hadoop-yarn失败" - fi - - # 测试打印yarn版本信息 - LOG_INFO "测试打印yarn版本信息" - yarn version - CHECK_RESULT $? 0 0 "执行yarn version命令失败" - - # 如果之前未安装,则在测试结束后卸载hadoop-yarn - if [ $installed -ne 0 ]; then - LOG_INFO "卸载hadoop-yarn" - dnf remove -y hadoop-yarn - CHECK_RESULT $? 0 0 "卸载hadoop-yarn失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_close.sh b/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_close.sh deleted file mode 100644 index e2279954eff..00000000000 --- a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_close.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-08 -# @License : Mulan PSL v2 -# @Desc : Test closing a file in HDFS -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test closing a file in HDFS" - - # 检查是否已安装libhdfs - LOG_INFO "检查libhdfs是否已安装" - if ! dnf list installed libhdfs &> /dev/null; then - LOG_INFO "libhdfs未安装,将进行安装" - INSTALLED=false - else - LOG_INFO "libhdfs已安装" - INSTALLED=true - fi - - # 检查yum源中是否有libhdfs软件包 - LOG_INFO "检查yum源中是否有libhdfs软件包" - if ! dnf list available libhdfs &> /dev/null; then - LOG_ERROR "yum源中未找到libhdfs软件包" - exit 255 - fi - - # 若未安装则安装libhdfs - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装libhdfs" - dnf install -y libhdfs - CHECK_RESULT $? 0 0 "安装libhdfs失败" - fi - - # 测试关闭HDFS文件功能 - LOG_INFO "测试关闭HDFS文件功能" - hadoop fs -test -e /testfile || hadoop fs -touchz /testfile - hadoop fs -cat /testfile > /dev/null - CHECK_RESULT $? 0 0 "打开HDFS文件失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - hadoop fs -rm -f /testfile - CHECK_RESULT $? 0 0 "删除HDFS文件失败" - - # 若脚本开始时未安装则卸载libhdfs - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载libhdfs以恢复环境" - dnf remove -y libhdfs - CHECK_RESULT $? 0 0 "卸载libhdfs失败" - fi - - LOG_INFO "测试完成:Test closing a file in HDFS" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_open.sh b/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_open.sh deleted file mode 100644 index 0916059282c..00000000000 --- a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_open.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-30 -# @License : Mulan PSL v2 -# @Desc : Test opening a file in HDFS -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test opening a file in HDFS" - - # 检查软件包是否已安装 - LOG_INFO "检查环境是否已安装libhdfs" - if rpm -q libhdfs &> /dev/null; then - LOG_INFO "libhdfs已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "libhdfs未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有libhdfs软件包 - LOG_INFO "检查yum源中是否有libhdfs软件包" - if ! dnf list available libhdfs &> /dev/null; then - LOG_ERROR "yum源中未找到libhdfs软件包" - exit 255 - fi - - # 若未安装则安装libhdfs - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装libhdfs" - dnf install -y libhdfs - CHECK_RESULT $? 0 0 "安装libhdfs失败" - fi - - # 测试打开HDFS文件功能 - LOG_INFO "测试打开HDFS文件功能" - hadoop fs -test -e /testfile || hadoop fs -touchz /testfile - CHECK_RESULT $? 0 0 "创建测试文件失败" - - hadoop fs -cat /testfile - CHECK_RESULT $? 0 0 "打开HDFS文件失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - hadoop fs -rm -f /testfile - CHECK_RESULT $? 0 0 "删除测试文件失败" - - # 若脚本开始时未安装libhdfs,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载libhdfs" - dnf remove -y libhdfs - CHECK_RESULT $? 0 0 "卸载libhdfs失败" - fi - - LOG_INFO "测试完成:Test opening a file in HDFS" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_read.sh b/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_read.sh deleted file mode 100644 index 922ab1874e4..00000000000 --- a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_read.sh +++ /dev/null @@ -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-08 -# @License : Mulan PSL v2 -# @Desc : Test reading a file in HDFS -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装hadoop-hdfs-client包 - LOG_INFO "检查是否已安装hadoop-hdfs-client包" - if ! dnf list installed hadoop-hdfs-client &>/dev/null; then - LOG_INFO "hadoop-hdfs-client未安装,将进行安装" - # 检查yum源中是否有hadoop-hdfs-client包 - if ! dnf list available hadoop-hdfs-client &>/dev/null; then - LOG_ERROR "yum源中未找到hadoop-hdfs-client包" - exit 255 - fi - # 安装hadoop-hdfs-client - dnf install -y hadoop-hdfs-client - CHECK_RESULT $? 0 0 "安装hadoop-hdfs-client失败" - # 标记需要卸载 - UNINSTALL_NEEDED=1 - else - LOG_INFO "hadoop-hdfs-client已安装" - fi - - # 测试读取HDFS文件 - LOG_INFO "测试读取HDFS文件" - HDFS_FILE="/testfile" - # 检查HDFS文件是否存在 - hadoop fs -test -e $HDFS_FILE - if [ $? -ne 0 ]; then - LOG_ERROR "HDFS文件$HDFS_FILE不存在" - exit 1 - fi - - # 读取HDFS文件内容 - LOG_INFO "读取HDFS文件内容" - hadoop fs -cat $HDFS_FILE > /tmp/hdfs_file_content - CHECK_RESULT $? 0 0 "读取HDFS文件失败" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/hdfs_file_content - - # 如果之前未安装hadoop-hdfs-client,则卸载 - if [ "$UNINSTALL_NEEDED" = "1" ]; then - LOG_INFO "卸载hadoop-hdfs-client" - dnf remove -y hadoop-hdfs-client - CHECK_RESULT $? 0 0 "卸载hadoop-hdfs-client失败" - fi - - LOG_INFO "测试完成" - exit 0 - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_stat.sh b/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_stat.sh deleted file mode 100644 index eeb073347a4..00000000000 --- a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_stat.sh +++ /dev/null @@ -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-08 -# @License : Mulan PSL v2 -# @Desc : Test getting file status in HDFS -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试获取HDFS文件状态 - LOG_INFO "开始测试:Test getting file status in HDFS" - - # 检查libhdfs软件包是否已安装 - LOG_INFO "检查libhdfs软件包是否已安装" - if ! dnf list installed libhdfs &>/dev/null; then - LOG_INFO "libhdfs未安装,将进行安装" - # 检查yum源中是否有libhdfs软件包 - if ! dnf list available libhdfs &>/dev/null; then - LOG_ERROR "yum源中未找到libhdfs软件包" - exit 255 - fi - # 安装libhdfs - dnf install -y libhdfs - CHECK_RESULT $? 0 0 "安装libhdfs失败" - # 标记为测试安装,需要在脚本结束时卸载 - TEST_INSTALLED=true - else - LOG_INFO "libhdfs已安装" - TEST_INSTALLED=false - fi - - # 测试获取HDFS文件状态 - LOG_INFO "测试获取HDFS文件状态" - hadoop fs -stat /testfile &>/dev/null - CHECK_RESULT $? 0 0 "获取HDFS文件状态失败" - - # 清理环境 - if [ "$TEST_INSTALLED" = true ]; then - LOG_INFO "卸载libhdfs软件包" - dnf remove -y libhdfs - CHECK_RESULT $? 0 0 "卸载libhdfs失败" - fi - - LOG_INFO "测试完成:Test getting file status in HDFS" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_write.sh b/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_write.sh deleted file mode 100644 index 0a8e6330a1e..00000000000 --- a/testcases/function_test/pkg_test/hadoop/libhdfs/test_libhdfs_function_write.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-08 -# @License : Mulan PSL v2 -# @Desc : Test writing to a file in HDFS -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本 test_libhdfs_function_write - - LOG_INFO "开始测试:Test writing to a file in HDFS" - - # 检查是否已安装hadoop-hdfs软件包 - LOG_INFO "检查是否已安装hadoop-hdfs软件包" - if ! dnf list installed hadoop-hdfs &> /dev/null; then - LOG_INFO "hadoop-hdfs未安装,准备安装" - if ! dnf list available hadoop-hdfs &> /dev/null; then - LOG_ERROR "yum源中未找到hadoop-hdfs软件包" - exit 255 - fi - dnf install -y hadoop-hdfs - CHECK_RESULT $? 0 0 "安装hadoop-hdfs失败" - INSTALLED=true - else - LOG_INFO "hadoop-hdfs已安装" - INSTALLED=false - fi - - # 检查hdfs命令是否可用 - LOG_INFO "检查hdfs命令是否可用" - if ! command -v hdfs &> /dev/null; then - LOG_ERROR "hdfs命令不存在或不支持" - exit 255 - fi - - # 测试写入文件到HDFS - LOG_INFO "测试写入文件到HDFS" - TEST_FILE="/tmp/test_libhdfs_function_write.txt" - echo "test content" > $TEST_FILE - - hdfs dfs -put $TEST_FILE /tmp/test_libhdfs_function_write.txt - CHECK_RESULT $? 0 0 "写入文件到HDFS失败" - - # 验证文件是否成功写入 - LOG_INFO "验证文件是否成功写入" - hdfs dfs -test -e /tmp/test_libhdfs_function_write.txt - CHECK_RESULT $? 0 0 "文件未成功写入HDFS" - - # 清理测试文件 - LOG_INFO "清理测试文件" - hdfs dfs -rm -f /tmp/test_libhdfs_function_write.txt - rm -f $TEST_FILE - - # 恢复环境 - if [ "$INSTALLED" = true ]; then - LOG_INFO "卸载临时安装的软件包" - dnf remove -y hadoop-hdfs - CHECK_RESULT $? 0 0 "卸载hadoop-hdfs失败" - fi - - LOG_INFO "测试完成:Test writing to a file in HDFS" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_basic.sh b/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_basic.sh deleted file mode 100644 index 0509284f34b..00000000000 --- a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_basic.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-28 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality of kyotocabinet-help -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查kyotocabinet-help基本功能测试脚本 - - LOG_INFO "开始测试kyotocabinet-help的基本功能" - - # 检查软件包是否已安装 - if rpm -q kyotocabinet >/dev/null 2>&1; then - LOG_INFO "检测到kyotocabinet已安装,测试结束后将保持安装状态" - installed=true - else - LOG_INFO "未检测到kyotocabinet安装,测试结束后将卸载软件包" - installed=false - fi - - # 检查yum源中是否存在kyotocabinet软件包 - LOG_INFO "检查yum源中是否存在kyotocabinet软件包" - if ! dnf list available kyotocabinet >/dev/null 2>&1; then - LOG_ERROR "yum源中未找到kyotocabinet软件包" - exit 255 - fi - - # 如果未安装则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "开始安装kyotocabinet软件包" - dnf install -y kyotocabinet >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装kyotocabinet失败" - fi - - # 测试kyotocabinet-help命令是否存在 - LOG_INFO "测试kyotocabinet-help命令是否存在" - if ! command -v kyotocabinet-help >/dev/null 2>&1; then - LOG_ERROR "kyotocabinet-help命令不存在" - exit 255 - fi - - # 测试基本功能:查看帮助信息 - LOG_INFO "测试kyotocabinet-help基本功能:查看帮助信息" - output=$(kyotocabinet-help 2>&1) - CHECK_RESULT $? 0 0 "执行kyotocabinet-help失败" - if [ -z "$output" ]; then - LOG_ERROR "kyotocabinet-help未返回任何输出" - exit 255 - fi - - # 清理环境:如果测试前未安装则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "清理环境:卸载kyotocabinet软件包" - dnf remove -y kyotocabinet >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载kyotocabinet失败" - fi - - LOG_INFO "测试完成:成功验证kyotocabin et-help的基本功能" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_del.sh b/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_del.sh deleted file mode 100644 index 211592095e4..00000000000 --- a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_del.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-03 -# @License : Mulan PSL v2 -# @Desc : Test deleting a key-value pair -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test deleting a key-value pair" - - LOG_INFO "步骤1:检查环境是否已安装kyotocabinet-help软件包" - if rpm -q kyotocabinet-help &>/dev/null; then - LOG_INFO "环境已安装kyotocabinet-help软件包,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "环境未安装kyotocabinet-help软件包,将在测试步骤中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在kyotocabinet-help软件包" - if ! dnf list available kyotocabinet-help &>/dev/null; then - LOG_ERROR "yum源中未找到kyotocabinet-help软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装kyotocabinet-help软件包" - dnf install -y kyotocabinet-help - CHECK_RESULT $? 0 0 "安装kyotocabinet-help软件包失败" - fi - - LOG_INFO "步骤4:验证kyotocabinet-help命令是否支持del参数" - if ! kyotocabinet-help | grep -q "del"; then - LOG_ERROR "kyotocabinet-help命令不支持del参数" - exit 255 - fi - - LOG_INFO "步骤5:执行删除key-value pair的操作" - kyotocabinet-help del test_key - CHECK_RESULT $? 0 0 "删除key-value pair失败" - - LOG_INFO "步骤6:清理环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载kyotocabinet-help软件包" - dnf remove -y kyotocabinet-help - CHECK_RESULT $? 0 0 "卸载kyotocabinet-help软件包失败" - fi - - LOG_INFO "测试完成:Test deleting a key-value pair" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_get.sh b/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_get.sh deleted file mode 100644 index 42d1decb307..00000000000 --- a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_get.sh +++ /dev/null @@ -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-03 -# @License : Mulan PSL v2 -# @Desc : Test retrieving a value by key -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装kyotocabinet-help软件包 - LOG_INFO "检查是否已安装kyotocabinet-help软件包" - if dnf list installed kyotocabinet-help &>/dev/null; then - LOG_INFO "kyotocabinet-help软件包已安装" - installed=true - else - LOG_INFO "kyotocabinet-help软件包未安装" - installed=false - fi - - # 检查yum源中是否有kyotocabinet-help软件包 - LOG_INFO "检查yum源中是否有kyotocabinet-help软件包" - if ! dnf list available kyotocabinet-help &>/dev/null; then - LOG_ERROR "yum源中未找到kyotocabinet-help软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装kyotocabinet-help软件包" - dnf install -y kyotocabinet-help - CHECK_RESULT $? 0 0 "安装kyotocabinet-help失败" - fi - - # 测试获取键值功能 - LOG_INFO "测试获取键值功能" - result=$(kyotocabinet help get 2>&1) - CHECK_RESULT $? 0 0 "获取键值功能测试失败" - LOG_INFO "获取键值功能测试结果: $result" - - # 如果之前未安装,则在测试完成后卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载kyotocabinet-help软件包" - dnf remove -y kyotocabinet-help - CHECK_RESULT $? 0 0 "卸载kyotocabinet-help失败" - fi - - LOG_INFO "测试脚本执行完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_open.sh b/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_open.sh deleted file mode 100644 index 88a9b01cccb..00000000000 --- a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_open.sh +++ /dev/null @@ -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-03 -# @License : Mulan PSL v2 -# @Desc : Test opening a database with kyotocabinet-help -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test opening a database with kyotocabinet-help" - - # 检查是否已安装kyotocabinet-help - LOG_INFO "检查是否已安装kyotocabinet-help" - if dnf list installed kyotocabinet-help &>/dev/null; then - LOG_INFO "kyotocabinet-help已安装" - INSTALLED=true - else - LOG_INFO "kyotocabinet-help未安装" - INSTALLED=false - fi - - # 检查yum源中是否有kyotocabinet-help - LOG_INFO "检查yum源中是否有kyotocabinet-help" - if ! dnf list available kyotocabinet-help &>/dev/null; then - LOG_ERROR "yum源中未找到kyotocabinet-help" - exit 255 - fi - - # 如果未安装,则安装kyotocabinet-help - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装kyotocabinet-help" - dnf install -y kyotocabinet-help - CHECK_RESULT $? 0 0 "安装kyotocabinet-help失败" - LOG_INFO "kyotocabinet-help安装成功" - fi - - # 测试kyotocabinet-help命令是否存在 - LOG_INFO "测试kyotocabinet-help命令是否存在" - if ! command -v kyotocabinet-help &>/dev/null; then - LOG_ERROR "kyotocabinet-help命令不存在" - exit 255 - fi - - # 测试打开数据库 - LOG_INFO "测试打开数据库" - kyotocabinet-help open testdb.kch create &>/dev/null - CHECK_RESULT $? 0 0 "打开数据库失败" - - # 清理环境 - LOG_INFO "清理环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载kyotocabinet-help" - dnf remove -y kyotocabinet-help - CHECK_RESULT $? 0 0 "卸载kyotocabinet-help失败" - fi - - LOG_INFO "测试完成:Test opening a database with kyotocabinet-help" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_set.sh b/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_set.sh deleted file mode 100644 index 7447b414435..00000000000 --- a/testcases/function_test/pkg_test/kyotocabinet/kyotocabinet-help/test_kyotocabinet-help_function_set.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-03 -# @License : Mulan PSL v2 -# @Desc : Test setting a key-value pair -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装kyotocabinet-help软件包 - LOG_INFO "检查是否已安装kyotocabinet-help软件包" - if rpm -q kyotocabinet-help >/dev/null 2>&1; then - LOG_INFO "kyotocabinet-help软件包已安装" - INSTALLED=true - else - LOG_INFO "kyotocabinet-help软件包未安装" - INSTALLED=false - fi - - # 检查yum源中是否有kyotocabinet-help软件包 - LOG_INFO "检查yum源中是否有kyotocabinet-help软件包" - if ! dnf list available kyotocabinet-help >/dev/null 2>&1; then - LOG_ERROR "yum源中未找到kyotocabinet-help软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装kyotocabinet-help软件包" - dnf install -y kyotocabinet-help >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装kyotocabinet-help软件包失败" - LOG_INFO "kyotocabinet-help软件包安装成功" - fi - - # 测试设置键值对功能 - LOG_INFO "测试设置键值对功能" - echo -e "set test_key test_value\nquit" | kyotocabinet-shell >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "设置键值对失败" - - # 验证键值对是否设置成功 - LOG_INFO "验证键值对是否设置成功" - echo -e "get test_key\nquit" | kyotocabinet-shell | grep -q "test_value" >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证键值对失败" - - # 清理测试数据 - LOG_INFO "清理测试数据" - echo -e "remove test_key\nquit" | kyotocabinet-shell >/dev/null 2>&1 - - # 如果最初未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载kyotocabinet-help软件包" - dnf remove -y kyotocabinet-help >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载kyotocabinet-help软件包失败" - LOG_INFO "kyotocabinet-help软件包卸载成功" - fi - - LOG_INFO "测试脚本执行完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_check_version.sh b/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_check_version.sh deleted file mode 100644 index 9e0e9c28e3c..00000000000 --- a/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_check_version.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试libnfs-help软件包的版本查询功能,验证能否正确显示其版本信息。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="libnfs-help" - COMMAND="/usr/bin/nfs-ls" - PARAMETER="--version" - - # 检查yum源中是否存在指定软件包 - check_package_in_repo() { - LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available ${PACKAGE_NAME} &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - } - - # 检查命令是否存在 - check_command_exists() { - LOG_INFO "检查命令${COMMAND}是否存在" - if [ ! -x "${COMMAND}" ]; then - LOG_ERROR "命令${COMMAND}不存在" - exit 255 - fi - LOG_INFO "命令${COMMAND}存在" - } - - # 检查命令参数是否支持 - check_parameter_supported() { - LOG_INFO "检查命令${COMMAND}是否支持参数${PARAMETER}" - ${COMMAND} --help 2>&1 | grep -q "\-\-version" - if [ $? -ne 0 ]; then - LOG_ERROR "命令${COMMAND}不支持参数${PARAMETER}" - exit 255 - fi - LOG_INFO "命令${COMMAND}支持参数${PARAMETER}" - } - - # 主测试函数 - test_version_query() { - LOG_INFO "开始测试libnfs-help软件包的版本查询功能" - - # 检查软件包是否已安装 - LOG_INFO "检查${PACKAGE_NAME}软件包是否已安装" - rpm -q ${PACKAGE_NAME} &> /dev/null - local installed=$? - - if [ ${installed} -eq 0 ]; then - LOG_INFO "${PACKAGE_NAME}软件包已安装,测试后保持安装状态" - NEED_UNINSTALL=false - else - LOG_INFO "${PACKAGE_NAME}软件包未安装,将作为测试步骤安装" - NEED_UNINSTALL=true - - # 检查yum源 - check_package_in_repo - - # 安装软件包 - LOG_INFO "安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - fi - - # 检查命令和参数 - check_command_exists - check_parameter_supported - - # 执行版本查询 - LOG_INFO "执行版本查询命令:${COMMAND} ${PARAMETER}" - ${COMMAND} ${PARAMETER} - CHECK_RESULT $? 0 0 "执行版本查询命令失败" - - LOG_INFO "libnfs-help软件包版本查询功能测试完成" - } - - # 环境清理函数 - cleanup_environment() { - LOG_INFO "开始清理测试环境" - - if [ "${NEED_UNINSTALL}" = "true" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - if [ $? -eq 0 ]; then - LOG_INFO "${PACKAGE_NAME}软件包卸载成功" - else - LOG_ERROR "${PACKAGE_NAME}软件包卸载失败" - fi - else - LOG_INFO "保持${PACKAGE_NAME}软件包安装状态" - fi - - LOG_INFO "测试环境清理完成" - } - - # 主执行流程 - main() { - LOG_INFO "=== 开始测试libnfs-help软件包版本查询功能 ===" - - # 执行测试 - test_version_query - - # 清理环境 - cleanup_environment - - LOG_INFO "=== 测试完成 ===" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_file_exist.sh b/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_file_exist.sh deleted file mode 100644 index 7e4af354b68..00000000000 --- a/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_file_exist.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试libnfs-help软件包的核心文件是否存在,验证安装后关键文件(如手册页、文档)是否已部署。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查libnfs-help软件包是否在yum源中可用 - LOG_INFO "检查libnfs-help软件包是否在yum源中可用" - dnf list available libnfs-help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到libnfs-help软件包" - exit 255 - fi - - # 检查libnfs-help软件包是否已安装 - LOG_INFO "检查libnfs-help软件包是否已安装" - rpm -q libnfs-help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "libnfs-help软件包已安装,标记为保持安装状态" - KEEP_INSTALLED=1 - else - LOG_INFO "libnfs-help软件包未安装,将在测试过程中安装" - KEEP_INSTALLED=0 - fi - - # 如果未安装,则安装libnfs-help软件包 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "安装libnfs-help软件包" - dnf install -y libnfs-help - CHECK_RESULT $? 0 0 "安装libnfs-help软件包失败" - fi - - # 定义需要检查的核心文件列表 - LOG_INFO "定义需要检查的libnfs-help核心文件列表" - CORE_FILES=( - "/usr/share/man/man1/libnfs-help.1.gz" - "/usr/share/doc/libnfs-help/README" - "/usr/share/doc/libnfs-help/CHANGELOG" - ) - - # 检查每个核心文件是否存在 - LOG_INFO "开始检查libnfs-help的核心文件是否存在" - for file in "${CORE_FILES[@]}"; do - LOG_INFO "检查文件: $file" - if [ -f "$file" ]; then - LOG_INFO "文件 $file 存在" - else - LOG_ERROR "文件 $file 不存在" - # 如果未安装,则清理环境后退出 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载libnfs-help软件包" - dnf remove -y libnfs-help - fi - exit 1 - fi - done - - LOG_INFO "所有核心文件检查通过" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载libnfs-help软件包" - dnf remove -y libnfs-help - CHECK_RESULT $? 0 0 "卸载libnfs-help软件包失败" - else - LOG_INFO "保持libnfs-help软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_help_info.sh b/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_help_info.sh deleted file mode 100644 index aedd65b2037..00000000000 --- a/testcases/function_test/pkg_test/libnfs/libnfs-help/test_libnfs-help_function_help_info.sh +++ /dev/null @@ -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-01 -# @License : Mulan PSL v2 -# @Desc : 测试libnfs-help软件包的帮助信息功能,验证执行帮助命令能否正常输出使用说明。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试libnfs-help软件包的帮助信息功能" - - LOG_INFO "步骤1:检查系统中是否已安装libnfs-help软件包" - if dnf list installed libnfs-help &>/dev/null; then - LOG_INFO "检测到libnfs-help已安装,标记为环境已安装状态" - already_installed=true - else - LOG_INFO "检测到libnfs-help未安装" - already_installed=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在libnfs-help软件包" - if ! dnf list available libnfs-help &>/dev/null; then - LOG_ERROR "yum源中未找到libnfs-help软件包" - exit 255 - fi - LOG_INFO "yum源中存在libnfs-help软件包" - - if [ "$already_installed" = "false" ]; then - LOG_INFO "步骤3:安装libnfs-help软件包" - dnf install -y libnfs-help - CHECK_RESULT $? 0 0 "安装libnfs-help软件包失败" - LOG_INFO "libnfs-help软件包安装成功" - fi - - LOG_INFO "步骤4:验证libnfs-help命令是否存在" - command -v libnfs-help - CHECK_RESULT $? 0 0 "libnfs-help命令不存在" - - LOG_INFO "步骤5:测试libnfs-help命令的帮助信息功能" - LOG_INFO "执行命令:libnfs-help --help" - output=$(libnfs-help --help 2>&1) - ret=$? - if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then - LOG_ERROR "执行libnfs-help --help失败,退出码: $ret" - exit $ret - fi - - LOG_INFO "步骤6:检查帮助信息输出是否正常" - if [ -z "$output" ]; then - LOG_ERROR "libnfs-help --help未输出任何内容" - exit 1 - fi - if echo "$output" | grep -q "用法\|用法说明\|Usage\|用法示例"; then - LOG_INFO "帮助信息输出正常,包含使用说明" - else - LOG_INFO "帮助信息输出内容:$output" - LOG_ERROR "帮助信息中未找到预期的使用说明关键词" - exit 1 - fi - - LOG_INFO "步骤7:测试libnfs-help命令的-h参数" - LOG_INFO "执行命令:libnfs-help -h" - output_h=$(libnfs-help -h 2>&1) - ret_h=$? - if [ $ret_h -ne 0 ] && [ $ret_h -ne 1 ]; then - LOG_ERROR "执行libnfs-help -h失败,退出码: $ret_h" - exit $ret_h - fi - LOG_INFO "-h参数帮助信息输出正常" - - LOG_INFO "步骤8:测试不支持的参数" - LOG_INFO "执行命令:libnfs-help --nonexistent" - if libnfs-help --nonexistent 2>&1 | grep -q "未知选项\|无效选项\|unrecognized option"; then - LOG_INFO "不支持的参数检查正常,命令返回错误信息" - else - LOG_ERROR "不支持的参数未按预期处理" - exit 255 - fi - - if [ "$already_installed" = "false" ]; then - LOG_INFO "步骤9:清理环境,卸载测试安装的libnfs-help软件包" - dnf remove -y libnfs-help - CHECK_RESULT $? 0 0 "卸载libnfs-help软件包失败" - LOG_INFO "libnfs-help软件包卸载成功" - else - LOG_INFO "环境已安装libnfs-help,保持安装状态,无需卸载" - fi - - LOG_INFO "libnfs-help软件包帮助信息功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgexport.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgexport.sh deleted file mode 100644 index a4ab5cf0bc8..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgexport.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试导出软件包信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:导出软件包信息" - LOG_INFO "步骤1:检查环境是否已安装python3-librepo包" - rpm -q python3-librepo > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装python3-librepo,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "环境未安装python3-librepo,将进行安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有python3-librepo软件包" - dnf list available python3-librepo > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-librepo软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-librepo软件包" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - LOG_INFO "步骤4:检查pkgexport命令是否存在" - command -v pkgexport > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pkgexport命令不存在" - exit 255 - fi - - LOG_INFO "步骤5:检查pkgexport命令是否支持--help参数" - pkgexport --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pkgexport命令不支持--help参数" - exit 255 - fi - - LOG_INFO "步骤6:执行pkgexport命令导出软件包信息" - pkgexport --output=test_packages.json - CHECK_RESULT $? 0 0 "导出软件包信息失败" - - LOG_INFO "步骤7:验证导出的文件是否存在且非空" - if [ -s "test_packages.json" ]; then - LOG_INFO "成功导出软件包信息到test_packages.json" - else - LOG_ERROR "导出的文件不存在或为空" - CHECK_RESULT 1 0 1 "导出的文件验证失败" - fi - - LOG_INFO "步骤8:清理临时文件" - rm -f test_packages.json - CHECK_RESULT $? 0 0 "清理临时文件失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载python3-librepo软件包" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - fi - - LOG_INFO "测试完成:导出软件包信息" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgimport.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgimport.sh deleted file mode 100644 index 9fd826b5bdc..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgimport.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试导入本地软件包 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化日志和变量 - LOG_INFO "开始测试导入本地软件包功能" - - # 定义软件包名称和本地包路径 - PACKAGE_NAME="python3-librepo" - LOCAL_PKG_PATH="./test_package.rpm" # 假设本地包路径 - - # 检查本地包文件是否存在 - LOG_INFO "检查本地包文件是否存在" - if [ ! -f "$LOCAL_PKG_PATH" ]; then - LOG_ERROR "本地包文件 $LOCAL_PKG_PATH 不存在" - exit 255 - fi - - # 检查环境是否已安装目标软件包 - LOG_INFO "检查环境是否已安装 $PACKAGE_NAME" - if dnf list installed "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "$PACKAGE_NAME 已安装,测试后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "$PACKAGE_NAME 未安装,测试后将卸载" - ALREADY_INSTALLED=0 - fi - - # 检查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 "测试导入本地软件包 $LOCAL_PKG_PATH" - dnf install -y "$LOCAL_PKG_PATH" - CHECK_RESULT $? 0 0 "导入本地软件包失败" - - # 验证软件包是否安装成功 - LOG_INFO "验证软件包是否安装成功" - dnf list installed "$PACKAGE_NAME" &>/dev/null - CHECK_RESULT $? 0 0 "软件包安装后未在已安装列表中" - - # 测试软件包基本功能 - LOG_INFO "测试软件包基本功能" - python3 -c "import librepo; print(librepo.__version__)" &>/dev/null - CHECK_RESULT $? 0 0 "python3-librepo 导入失败" - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ "$ALREADY_INSTALLED" -eq 0 ]; then - LOG_INFO "卸载测试安装的软件包 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "保持 $PACKAGE_NAME 的安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgverify.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgverify.sh deleted file mode 100644 index 529c9d5f515..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_pkgverify.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试软件包签名验证 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装python3-librepo - LOG_INFO "检查是否已安装python3-librepo" - rpm -q python3-librepo > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-librepo已安装,脚本结束时将保持安装状态" - already_installed=1 - else - LOG_INFO "python3-librepo未安装,将在测试过程中安装" - already_installed=0 - fi - - # 检查yum源中是否有python3-librepo软件包 - LOG_INFO "检查yum源中是否有python3-librepo软件包" - dnf list available python3-librepo > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-librepo软件包" - exit 255 - fi - - # 检查dnf工具是否支持--nogpgcheck参数 - LOG_INFO "检查dnf工具是否支持--nogpgcheck参数" - dnf install --help | grep -q -- "--nogpgcheck" - if [ $? -ne 0 ]; then - LOG_ERROR "dnf工具不支持--nogpgcheck参数" - exit 255 - fi - - # 如果未安装,则安装python3-librepo - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装python3-librepo软件包" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - # 测试软件包签名验证功能 - LOG_INFO "测试软件包签名验证功能" - # 使用dnf安装一个软件包并验证签名 - dnf install -y --nogpgcheck nano - CHECK_RESULT $? 0 0 "使用--nogpgcheck安装nano失败" - - # 清理测试安装的nano软件包 - LOG_INFO "清理测试安装的nano软件包" - dnf remove -y nano - CHECK_RESULT $? 0 0 "卸载nano失败" - - # 如果脚本开始时未安装python3-librepo,则在脚本结束前卸载 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载python3-librepo软件包" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_query.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_query.sh deleted file mode 100644 index 06a5fe429f8..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_query.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试软件包查询功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试软件包查询功能" - - # 步骤1: 检查环境是否已安装python3-librepo - LOG_INFO "步骤1: 检查环境是否已安装python3-librepo" - if dnf list installed python3-librepo &>/dev/null; then - LOG_INFO "python3-librepo已安装,测试完成后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "python3-librepo未安装,将在测试中安装并在结束后卸载" - ALREADY_INSTALLED=0 - fi - - # 步骤2: 检查yum源中是否有python3-librepo软件包 - LOG_INFO "步骤2: 检查yum源中是否有python3-librepo软件包" - if ! dnf list available python3-librepo &>/dev/null; then - LOG_ERROR "yum源中未找到python3-librepo软件包" - exit 255 - fi - - # 步骤3: 安装python3-librepo(如果未安装) - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装python3-librepo" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - # 步骤4: 测试软件包查询功能 - LOG_INFO "步骤4: 测试软件包查询功能" - # 假设查询功能的命令为repoquery,这里使用示例命令 - repoquery --help &>/dev/null - if [ $? -eq 0 ]; then - # 如果命令支持,则执行查询 - LOG_INFO "执行repoquery命令查询python3-librepo信息" - repoquery -l python3-librepo - CHECK_RESULT $? 0 0 "查询python3-librepo信息失败" - else - LOG_ERROR "repoquery命令不存在或不支持" - exit 255 - fi - - # 步骤5: 清理环境 - LOG_INFO "步骤5: 清理环境" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-librepo" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - else - LOG_INFO "环境已安装python3-librepo,保持安装状态" - fi - - LOG_INFO "测试软件包查询功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_remove.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_remove.sh deleted file mode 100644 index 101f6042bc5..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_remove.sh +++ /dev/null @@ -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-05 -# @License : Mulan PSL v2 -# @Desc : 测试软件包卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试软件包卸载功能" - LOG_INFO "步骤1:检查yum源中是否存在python3-librepo软件包" - dnf list available python3-librepo &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-librepo软件包" - exit 255 - fi - LOG_INFO "步骤2:检查python3-librepo是否已安装" - rpm -q python3-librepo &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "python3-librepo已安装,标记为已存在状态" - PACKAGE_INSTALLED=1 - else - LOG_INFO "python3-librepo未安装,标记为未安装状态" - PACKAGE_INSTALLED=0 - fi - LOG_INFO "步骤3:如果未安装,则安装python3-librepo" - if [ $PACKAGE_INSTALLED -eq 0 ]; then - dnf install -y python3-librepo &> /dev/null - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - LOG_INFO "安装python3-librepo成功" - fi - LOG_INFO "步骤4:验证软件包安装成功" - rpm -q python3-librepo &> /dev/null - CHECK_RESULT $? 0 0 "验证python3-librepo安装状态失败" - LOG_INFO "验证python3-librepo安装成功" - LOG_INFO "步骤5:执行软件包卸载功能测试" - dnf remove -y python3-librepo &> /dev/null - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - LOG_INFO "卸载python3-librepo成功" - LOG_INFO "步骤6:验证软件包已卸载" - rpm -q python3-librepo &> /dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "验证python3-librepo卸载状态失败,软件包仍存在" - exit 1 - else - LOG_INFO "验证python3-librepo卸载成功" - fi - LOG_INFO "步骤7:恢复环境状态" - if [ $PACKAGE_INSTALLED -eq 1 ]; then - LOG_INFO "原始环境已安装python3-librepo,重新安装" - dnf install -y python3-librepo &> /dev/null - CHECK_RESULT $? 0 0 "重新安装python3-librepo失败" - LOG_INFO "重新安装python3-librepo成功" - else - LOG_INFO "原始环境未安装python3-librepo,无需恢复" - fi - LOG_INFO "测试软件包卸载功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repoclean.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repoclean.sh deleted file mode 100644 index c9635ab6fea..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repoclean.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试清理缓存数据 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色和日志函数 - RED="\033[0;31m" - GREEN="\033[0;32m" - NC="\033[0m" - - LOG_INFO() { - echo -e "${GREEN}[INFO]${NC} $1" - } - - LOG_ERROR() { - echo -e "${RED}[ERROR]${NC} $1" - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package_name=$1 - dnf list available "$package_name" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $package_name 不在yum源中" - exit 255 - fi - } - - # 检查命令参数是否支持 - check_command_param() { - local command=$1 - local param=$2 - $command --help 2>&1 | grep -q "\<$param\>" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $command 不支持参数 $param" - exit 255 - fi - } - - # 检查命令执行结果 - check_command_result() { - local result=$1 - local expected=$2 - local error_msg=$3 - if [ $result -ne $expected ]; then - LOG_ERROR "$error_msg" - exit $result - fi - } - - # 测试清理缓存数据 - LOG_INFO "开始测试清理缓存数据功能" - - # 步骤1:检查环境是否已安装python3-librepo - LOG_INFO "步骤1:检查环境是否已安装python3-librepo" - if rpm -q python3-librepo &>/dev/null; then - LOG_INFO "python3-librepo已安装,测试结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "python3-librepo未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - # 步骤2:检查软件包是否在yum源中 - LOG_INFO "步骤2:检查python3-librepo是否在yum源中" - check_package_in_repo python3-librepo - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装python3-librepo软件包" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - # 步骤4:检查repoclean命令是否支持清理缓存参数 - LOG_INFO "步骤4:检查repoclean命令是否支持清理缓存参数" - check_command_param repoclean clean - - # 步骤5:执行repoclean命令清理缓存数据 - LOG_INFO "步骤5:执行repoclean命令清理缓存数据" - repoclean clean - CHECK_RESULT $? 0 0 "清理缓存数据失败" - - # 步骤6:验证缓存是否被清理 - LOG_INFO "步骤6:验证缓存是否被清理" - if [ -d /var/cache/dnf ] && [ "$(ls -A /var/cache/dnf 2>/dev/null)" ]; then - LOG_INFO "缓存目录 /var/cache/dnf 不为空,清理可能不彻底" - else - LOG_INFO "缓存目录 /var/cache/dnf 为空,清理成功" - fi - - # 步骤7:清理测试环境 - LOG_INFO "步骤7:清理测试环境" - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载python3-librepo软件包" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - else - LOG_INFO "保持python3-librepo安装状态" - fi - - LOG_INFO "测试清理缓存数据功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repoconfig.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repoconfig.sh deleted file mode 100644 index bf39bc769a9..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repoconfig.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试仓库配置文件读取 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装python3-librepo软件包 - LOG_INFO "检查是否已安装python3-librepo软件包" - rpm -q python3-librepo > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-librepo已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "python3-librepo未安装,将在测试前安装" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有python3-librepo软件包 - LOG_INFO "检查yum源中是否有python3-librepo软件包" - dnf list available python3-librepo > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-librepo软件包" - exit 255 - fi - - # 如果未安装,则安装python3-librepo - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "安装python3-librepo软件包" - dnf install -y python3-librepo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - # 测试仓库配置文件读取功能 - LOG_INFO "测试仓库配置文件读取功能" - python3 -c " - import librepo - try: - h = librepo.Handle() - h.repotype = librepo.LR_YUMREPO - h.urls = ["file:///etc/yum.repos.d/"] - h.perform() - print("SUCCESS: 仓库配置文件读取成功") - except Exception as e: - print(f"FAILED: 仓库配置文件读取失败 - {e}") - exit(1) - " > /tmp/librepo_test_output.txt 2>&1 - CHECK_RESULT $? 0 0 "仓库配置文件读取测试失败" - LOG_INFO "$(cat /tmp/librepo_test_output.txt)" - - # 清理临时文件 - rm -f /tmp/librepo_test_output.txt - - # 环境恢复:如果之前未安装,则卸载python3-librepo - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "卸载python3-librepo软件包" - dnf remove -y python3-librepo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - LOG_INFO "环境已恢复,python3-librepo已卸载" - else - LOG_INFO "环境已恢复,保持python3-librepo安装状态" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repodata.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repodata.sh deleted file mode 100644 index 4e694aa1534..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repodata.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-05 -# @License : Mulan PSL v2 -# @Desc : 测试仓库元数据下载 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试仓库元数据下载功能" - - # 检查是否已安装python3-librepo - LOG_INFO "检查python3-librepo是否已安装" - if rpm -q python3-librepo &>/dev/null; then - LOG_INFO "python3-librepo已安装,测试完成后将保持安装状态" - INSTALLED_BEFORE="yes" - else - LOG_INFO "python3-librepo未安装,将在测试前安装,测试后卸载" - INSTALLED_BEFORE="no" - fi - - # 检查yum源中是否有python3-librepo软件包 - LOG_INFO "检查yum源中是否有python3-librepo软件包" - if ! dnf list available python3-librepo &>/dev/null; then - LOG_ERROR "yum源中未找到python3-librepo软件包" - exit 255 - fi - - # 如果未安装,则安装python3-librepo - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "安装python3-librepo" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - # 测试repodata下载功能 - LOG_INFO "测试repodata下载功能" - python3 -c " - import librepo - h = librepo.Handle() - h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO) - h.setopt(librepo.LRO_URLS, ["http://mirrors.openeuler.org/openEuler-22.03-LTS/OS/x86_64/"]) - h.setopt(librepo.LRO_LOCAL, False) - h.setopt(librepo.LRO_DESTDIR, "/tmp/test_librepo") - try: - h.perform() - print("SUCCESS: repodata下载成功") - except Exception as e: - print(f"FAILED: {e}") - exit(1) - " - CHECK_RESULT $? 0 0 "repodata下载测试失败" - - # 清理测试产生的临时文件 - LOG_INFO "清理测试产生的临时文件" - rm -rf /tmp/test_librepo - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果测试前未安装,则卸载python3-librepo - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载python3-librepo" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - fi - - LOG_INFO "仓库元数据下载功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repohandle.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repohandle.sh deleted file mode 100644 index f38b43822e3..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repohandle.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试仓库句柄基本操作 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试仓库句柄基本操作" - LOG_INFO "步骤1:检查环境是否已安装 python3-librepo 软件包" - if rpm -q python3-librepo &>/dev/null; then - LOG_INFO "python3-librepo 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "python3-librepo 未安装,将在测试中安装并在测试结束后卸载" - INSTALLED_BEFORE_TEST=false - fi - LOG_INFO "步骤2:检查 yum 源中是否存在 python3-librepo 软件包" - if ! dnf list available python3-librepo &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-librepo 软件包" - exit 255 - fi - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤3:安装 python3-librepo 软件包" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装 python3-librepo 失败" - fi - LOG_INFO "步骤4:测试 Python 中导入 librepo 模块" - python3 -c "import librepo; print("librepo module imported successfully")" - CHECK_RESULT $? 0 0 "导入 librepo 模块失败" - LOG_INFO "步骤5:测试创建仓库句柄" - python3 -c " - import librepo - handle = librepo.Handle() - print("Repository handle created successfully") - " - CHECK_RESULT $? 0 0 "创建仓库句柄失败" - LOG_INFO "步骤6:测试设置仓库句柄属性" - python3 -c " - import librepo - handle = librepo.Handle() - handle.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO) - handle.setopt(librepo.LRO_URLS, ["http://example.com/repo"]) - print("Repository handle options set successfully") - " - CHECK_RESULT $? 0 0 "设置仓库句柄属性失败" - LOG_INFO "步骤7:测试执行仓库操作" - python3 -c " - import librepo - handle = librepo.Handle() - try: - handle.perform() - except librepo.LibrepoException as e: - print("Repository operation failed as expected:", e) - " - CHECK_RESULT $? 0 0 "执行仓库操作异常" - LOG_INFO "步骤8:测试清理仓库句柄" - python3 -c " - import librepo - handle = librepo.Handle() - handle.cleanup() - print("Repository handle cleaned up successfully") - " - CHECK_RESULT $? 0 0 "清理仓库句柄失败" - LOG_INFO "步骤9:环境恢复" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载 python3-librepo 软件包" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载 python3-librepo 失败" - else - LOG_INFO "保持 python3-librepo 安装状态" - fi - LOG_INFO "测试完成:仓库句柄基本操作测试结束" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repolist.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repolist.sh deleted file mode 100644 index 4f11efc962c..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_repolist.sh +++ /dev/null @@ -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 : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试列出可用软件仓库 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:列出可用软件仓库" - - LOG_INFO "步骤1:检查系统是否已安装python3-librepo包" - if dnf list installed python3-librepo &>/dev/null; then - LOG_INFO "python3-librepo已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "python3-librepo未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2:检查yum源中是否有python3-librepo包" - if ! dnf list available python3-librepo &>/dev/null; then - LOG_ERROR "yum源中未找到python3-librepo包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装python3-librepo包" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - LOG_INFO "步骤4:执行repolist命令列出可用仓库" - repoquery --repolist - CHECK_RESULT $? 0 0 "执行repolist命令失败" - - LOG_INFO "步骤5:检查repolist命令输出是否包含仓库信息" - repoquery --repolist | grep -q "repo id" - CHECK_RESULT $? 0 0 "repolist命令输出中未找到仓库信息" - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤6:清理环境,卸载测试安装的python3-librepo包" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - else - LOG_INFO "步骤6:保持python3-librepo安装状态,无需卸载" - fi - - LOG_INFO "测试完成:成功列出可用软件仓库" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_update.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_update.sh deleted file mode 100644 index e9b0d5c9874..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_update.sh +++ /dev/null @@ -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 : 2026-03-05 -# @License : Mulan PSL v2 -# @Desc : 测试软件包更新功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化变量 - PACKAGE_NAME="python3-librepo" - LOG_INFO "开始测试软件包更新功能" - LOG_INFO "步骤1:检查当前环境是否已安装 $PACKAGE_NAME" - # 检查是否已安装 - if dnf list installed "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "$PACKAGE_NAME 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "$PACKAGE_NAME 未安装,将在测试过程中安装,并在测试结束后卸载" - INSTALLED_BEFORE_TEST=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在 $PACKAGE_NAME 软件包" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包" - exit 255 - fi - - LOG_INFO "步骤3:安装 $PACKAGE_NAME 软件包" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - LOG_INFO "步骤4:测试软件包更新功能" - # 假设更新功能通过dnf update命令测试 - dnf update --assumeno "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "更新功能测试失败" - - LOG_INFO "步骤5:清理测试环境" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载 $PACKAGE_NAME 软件包" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - else - LOG_INFO "保持 $PACKAGE_NAME 安装状态不变" - fi - - LOG_INFO "测试软件包更新功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_verify.sh b/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_verify.sh deleted file mode 100644 index 7d69f5b7b75..00000000000 --- a/testcases/function_test/pkg_test/librepo/python3-librepo/test_python3-librepo_function_verify.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-05 -# @License : Mulan PSL v2 -# @Desc : 测试软件包完整性验证 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试软件包完整性验证功能" - - # 步骤1:检查测试环境是否已安装python3-librepo - LOG_INFO "步骤1:检查python3-librepo是否已安装" - if rpm -q python3-librepo > /dev/null 2>&1; then - LOG_INFO "python3-librepo已安装,测试后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-librepo未安装,将在测试中安装并最终卸载" - INSTALLED=false - fi - - # 步骤2:检查yum源中是否有python3-librepo软件包 - LOG_INFO "步骤2:检查yum源中是否有python3-librepo软件包" - if ! dnf list available python3-librepo > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-librepo软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装python3-librepo - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-librepo软件包" - dnf install -y python3-librepo - CHECK_RESULT $? 0 0 "安装python3-librepo失败" - fi - - # 步骤4:验证librepo基本功能 - LOG_INFO "步骤4:验证librepo基本功能" - python3 -c "import librepo; print(librepo.__version__)" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "python3-librepo导入失败" - - # 步骤5:测试软件包完整性验证功能 - LOG_INFO "步骤5:测试软件包完整性验证功能" - # 这里假设librepo提供了验证软件包完整性的方法,实际命令根据librepo的API调整 - # 示例:使用librepo检查指定软件包的完整性 - TEST_PACKAGE="python3-librepo" - if ! python3 -c " - import librepo - import hawkey - sack = hawkey.Sack() - sack.load_system_repo() - query = hawkey.Query(sack) - query.filter(name="$TEST_PACKAGE") - if query: - pkg = query[0] - print(f"找到软件包: {pkg.name}-{pkg.version}-{pkg.release}") - # 这里可以添加具体的完整性验证逻辑 - # 例如:验证软件包文件是否存在、校验和是否匹配等 - # 由于librepo的具体完整性验证方法未指定,此处仅作示例 - print("软件包完整性验证通过") - else: - print("未找到软件包") - exit(1) - " > /dev/null 2>&1; then - LOG_ERROR "软件包完整性验证失败" - exit 1 - fi - CHECK_RESULT $? 0 0 "软件包完整性验证失败" - - # 步骤6:清理环境 - LOG_INFO "步骤6:清理测试环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载测试安装的python3-librepo软件包" - dnf remove -y python3-librepo - CHECK_RESULT $? 0 0 "卸载python3-librepo失败" - else - LOG_INFO "保持python3-librepo安装状态" - fi - - LOG_INFO "软件包完整性验证测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_alternatives.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_alternatives.sh deleted file mode 100644 index 7c77c61e02a..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_alternatives.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test the use of @Alternative and selection -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test the use of @Alternative and selection" - - # 检查是否已安装openwebbeans软件包 - if dnf list installed openwebbeans &>/dev/null; then - LOG_INFO "openwebbeans软件包已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "openwebbeans软件包未安装,将在测试步骤中安装" - INSTALLED=false - fi - - # 检查yum源中是否有openwebbeans软件包 - LOG_INFO "检查yum源中是否存在openwebbeans软件包" - if ! dnf list available openwebbeans &>/dev/null; then - LOG_ERROR "yum源中未找到openwebbeans软件包" - exit 255 - fi - - # 安装软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装openwebbeans软件包" - dnf install -y openwebbeans - CHECK_RESULT $? 0 0 "安装openwebbeans软件包失败" - fi - - # 测试@Alternative和selection功能 - LOG_INFO "测试@Alternative和selection功能" - # 这里假设有一个测试命令或脚本来验证功能 - # 例如:运行一个Java程序或使用特定工具 - # 假设测试命令为:test-alternative-command - if command -v test-alternative-command &>/dev/null; then - LOG_INFO "执行test-alternative-command命令" - test-alternative-command --option value - CHECK_RESULT $? 0 0 "test-alternative-command命令执行失败" - else - LOG_ERROR "test-alternative-command命令不存在或不支持" - exit 255 - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载openwebbeans软件包" - dnf remove -y openwebbeans - CHECK_RESULT $? 0 0 "卸载openwebbeans软件包失败" - fi - - LOG_INFO "测试完成:Test the use of @Alternative and selection" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_basic_bean.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_basic_bean.sh deleted file mode 100644 index 01087b13289..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_basic_bean.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test basic bean creation and injection -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic bean creation and injection" - - # 定义软件包名称 - PACKAGE_NAME="openwebbeans-test-function-basic-bean" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 ${PACKAGE_NAME}" - dnf list available ${PACKAGE_NAME} > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 在yum源中不存在" - exit 255 - fi - - # 步骤2:检查是否已安装软件包 - LOG_INFO "步骤2:检查是否已安装软件包 ${PACKAGE_NAME}" - rpm -q ${PACKAGE_NAME} > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 步骤3:如果未安装,则安装软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤3:安装软件包 ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - fi - - # 步骤4:执行测试命令,测试基本bean的创建和注入 - LOG_INFO "步骤4:执行测试命令,测试基本bean的创建和注入" - # 假设测试命令为 test-basic-bean,这里根据实际情况调整命令 - test-basic-bean --test-param valid_value - CHECK_RESULT $? 0 0 "测试命令执行失败,基本bean创建和注入测试未通过" - - # 步骤5:检查测试命令的参数支持情况 - LOG_INFO "步骤5:检查测试命令的参数支持情况" - test-basic-bean --invalid-param > /dev/null 2>&1 - if [ $? -ne 255 ]; then - LOG_ERROR "测试命令不支持指定的参数或参数不存在" - exit 255 - fi - - # 步骤6:清理环境,如果测试前未安装则卸载软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤6:卸载软件包 ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - else - LOG_INFO "步骤6:测试前已安装软件包,保持安装状态" - fi - - LOG_INFO "测试完成:Test basic bean creation and injection" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_di.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_di.sh deleted file mode 100644 index 6014bbc404e..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_di.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-29 -# @License : Mulan PSL v2 -# @Desc : Test dependency injection functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查软件包是否已安装 - if dnf list installed openwebbeans-test-function-di &>/dev/null; then - LOG_INFO "环境已安装openwebbeans-test-function-di软件包" - INSTALLED=true - else - LOG_INFO "环境未安装openwebbeans-test-function-di软件包" - INSTALLED=false - fi - - # 检查yum源中是否存在该软件包 - LOG_INFO "检查yum源中是否存在openwebbeans-test-function-di软件包" - if ! dnf list available openwebbeans-test-function-di &>/dev/null; then - LOG_ERROR "yum源中不存在openwebbeans-test-function-di软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装openwebbeans-test-function-di软件包" - dnf install -y openwebbeans-test-function-di - CHECK_RESULT $? 0 0 "安装openwebbeans-test-function-di软件包失败" - fi - - # 测试依赖注入功能 - LOG_INFO "测试依赖注入功能" - TEST_COMMAND="openwebbeans-test-function-di --test-di" - if ! $TEST_COMMAND; then - LOG_ERROR "依赖注入功能测试失败" - if [ "$INSTALLED" = false ]; then - dnf remove -y openwebbeans-test-function-di - CHECK_RESULT $? 0 0 "卸载openwebbeans-test-function-di软件包失败" - fi - exit $? - fi - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载openwebbeans-test-function-di软件包" - dnf remove -y openwebbeans-test-function-di - CHECK_RESULT $? 0 0 "卸载openwebbeans-test-function-di软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_event.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_event.sh deleted file mode 100644 index 32bec6b43d6..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_event.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-07 -# @License : Mulan PSL v2 -# @Desc : Test event handling functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试事件处理功能" - - # 检查软件包是否已安装 - LOG_INFO "检查openwebbeans-test_function_event软件包是否已安装" - if rpm -q openwebbeans-test_function_event &>/dev/null; then - LOG_INFO "软件包已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "软件包未安装,测试完成后将卸载软件包" - INSTALLED=false - fi - - # 检查yum源中是否存在软件包 - LOG_INFO "检查yum源中是否存在openwebbeans-test_function_event软件包" - if ! dnf list available openwebbeans-test_function_event &>/dev/null; then - LOG_ERROR "yum源中未找到openwebbeans-test_function_event软件包" - exit 255 - fi - - # 安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装openwebbeans-test_function_event软件包" - dnf install -y openwebbeans-test_function_event - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 测试事件处理功能 - LOG_INFO "测试事件处理功能" - test_event_output=$(openwebbeans-test_function_event --test-event) - CHECK_RESULT $? 0 0 "事件处理功能测试失败" - - # 检查参数支持情况 - LOG_INFO "检查不支持的参数" - openwebbeans-test_function_event --invalid-param &>/dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "不支持参数--invalid-param,但未返回退出码255" - exit 255 - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载openwebbeans-test_function_event软件包" - dnf remove -y openwebbeans-test_function_event - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试事件处理功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_help.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_help.sh deleted file mode 100644 index b1e8b27d4b6..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_help.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test accessing the package help or usage information -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test accessing the package help or usage information" - - # 定义软件包名称 - PACKAGE_NAME="openwebbeans-test-function-help" - LOG_INFO "测试步骤:检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "测试步骤:检查软件包 $PACKAGE_NAME 是否已安装" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,测试结束后保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将进行安装测试" - ALREADY_INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "测试步骤:安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 测试获取帮助信息 - LOG_INFO "测试步骤:执行命令获取软件包帮助信息" - command_name="openwebbeans-test-function-help" - if ! command -v $command_name &>/dev/null; then - LOG_ERROR "命令 $command_name 不存在" - exit 255 - fi - - $command_name --help &>/dev/null - CHECK_RESULT $? 0 0 "执行命令 $command_name --help 失败" - - # 测试获取使用信息 - LOG_INFO "测试步骤:执行命令获取软件包使用信息" - $command_name --usage &>/dev/null - CHECK_RESULT $? 0 0 "执行命令 $command_name --usage 失败" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ $ALREADY_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 accessing the package help or usage information" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_install.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_install.sh deleted file mode 100644 index 076a48ffe4a..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_install.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test installation of the openwebbeans-test package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 步骤1: 检查环境是否已安装openwebbeans-test - LOG_INFO "检查openwebbeans-test是否已安装" - if dnf list installed openwebbeans-test &>/dev/null; then - LOG_INFO "openwebbeans-test已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "openwebbeans-test未安装,将在测试中安装" - INSTALLED_BEFORE_TEST=false - fi - - # 步骤2: 检查yum源中是否有openwebbeans-test包 - LOG_INFO "检查yum源中是否存在openwebbeans-test包" - if ! dnf list available openwebbeans-test &>/dev/null; then - LOG_ERROR "yum源中未找到openwebbeans-test包" - exit 255 - fi - - # 步骤3: 如果未安装则安装openwebbeans-test - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "开始安装openwebbeans-test" - dnf install -y openwebbeans-test - CHECK_RESULT $? 0 0 "安装openwebbeans-test失败" - fi - - # 步骤4: 验证安装 - LOG_INFO "验证openwebbeans-test安装" - dnf list installed openwebbeans-test - CHECK_RESULT $? 0 0 "openwebbeans-test安装验证失败" - - # 步骤5: 测试openwebbeans-test功能 - LOG_INFO "测试openwebbeans-test功能" - # 这里添加具体的功能测试命令,例如: - # openwebbeans-test --version - # 如果命令参数不存在或不支持,则退出码为255 - if ! openwebbeans-test --help &>/dev/null; then - LOG_ERROR "openwebbeans-test命令参数不支持" - exit 255 - fi - # 执行具体的测试命令,这里以--version为例 - openwebbeans-test --version - CHECK_RESULT $? 0 0 "openwebbeans-test功能测试失败" - - # 步骤6: 清理环境 - LOG_INFO "清理测试环境" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载openwebbeans-test" - dnf remove -y openwebbeans-test - CHECK_RESULT $? 0 0 "卸载openwebbeans-test失败" - else - LOG_INFO "测试前已安装openwebbeans-test,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_interceptor.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_interceptor.sh deleted file mode 100644 index 2d7ebf4e927..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_interceptor.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test interceptor binding and execution -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test interceptor binding and execution" - - # 定义软件包名称 - PACKAGE_NAME="openwebbeans-test-function-interceptor" - - # 检查软件包是否已经在yum源中 - LOG_INFO "检查yum源中是否存在软件包 $PACKAGE_NAME" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在" - exit 255 - fi - - # 检查环境是否已安装该软件包 - LOG_INFO "检查环境是否已安装软件包 $PACKAGE_NAME" - if rpm -q "$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 - - # 测试interceptor binding and execution - LOG_INFO "执行interceptor binding and execution测试" - # 这里假设测试命令是运行一个特定的测试程序或脚本 - # 例如:/usr/bin/test-openwebbeans-function-interceptor - TEST_COMMAND="/usr/bin/test-openwebbeans-function-interceptor" - if [ ! -x "$TEST_COMMAND" ]; then - LOG_ERROR "测试命令 $TEST_COMMAND 不存在或不可执行" - exit 255 - fi - - # 执行测试命令 - $TEST_COMMAND - CHECK_RESULT $? 0 0 "interceptor binding and execution 测试失败" - - # 如果需要多个服务器并在第二个服务器上执行命令,示例: - # LOG_INFO "在第二个服务器上执行命令" - # SSH_CMD "ls" "$NODE2_IPV4" "$NODE2_PASSWORD" "$NODE2_USER" - # CHECK_RESULT $? 0 0 "在第二个服务器上执行命令失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - else - LOG_INFO "测试前软件包已安装,保持安装状态" - fi - - LOG_INFO "测试完成:Test interceptor binding and execution" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_scope.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_scope.sh deleted file mode 100644 index df3c4e54d7a..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_scope.sh +++ /dev/null @@ -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-03-03 -# @License : Mulan PSL v2 -# @Desc : Test bean scope functionality (e.g., @ApplicationScoped, @RequestScoped) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试OpenWebBeans的bean scope功能(如@ApplicationScoped、@RequestScoped)" - - # 检查软件包是否在yum源中 - LOG_INFO "检查openwebbeans-test软件包是否在yum源中" - if ! dnf list available openwebbeans-test &>/dev/null; then - LOG_ERROR "yum源中未找到openwebbeans-test软件包" - exit 255 - fi - - # 检查环境是否已安装 - LOG_INFO "检查环境是否已安装openwebbeans-test" - if rpm -q openwebbeans-test &>/dev/null; then - INSTALLED=true - LOG_INFO "检测到openwebbeans-test已安装,测试后将保持安装状态" - else - INSTALLED=false - LOG_INFO "未安装openwebbeans-test,将进行安装" - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装openwebbeans-test软件包" - dnf install -y openwebbeans-test - CHECK_RESULT $? 0 0 "安装openwebbeans-test失败" - fi - - # 测试@ApplicationScoped功能 - LOG_INFO "测试@ApplicationScoped bean scope功能" - # 执行相关测试命令,这里假设有一个测试命令test-application-scoped - # 如果命令参数不存在或不支持,则退出 - if ! command -v test-application-scoped &>/dev/null; then - LOG_ERROR "test-application-scoped命令不存在或不支持" - exit 255 - fi - test-application-scoped --test-scope application - CHECK_RESULT $? 0 0 "@ApplicationScoped功能测试失败" - - # 测试@RequestScoped功能 - LOG_INFO "测试@RequestScoped bean scope功能" - # 执行相关测试命令,这里假设有一个测试命令test-request-scoped - # 如果命令参数不存在或不支持,则退出 - if ! command -v test-request-scoped &>/dev/null; then - LOG_ERROR "test-request-scoped命令不存在或不支持" - exit 255 - fi - test-request-scoped --test-scope request - CHECK_RESULT $? 0 0 "@RequestScoped功能测试失败" - - # 如果需要多服务器测试,在第二个节点执行命令 - LOG_INFO "在多服务器环境中测试bean scope功能" - # 假设需要在第二个节点上执行测试命令 - SSH_CMD "test-application-scoped --test-scope application" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "在第二个节点上测试@ApplicationScoped失败" - SSH_CMD "test-request-scoped --test-scope request" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "在第二个节点上测试@RequestScoped失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载openwebbeans-test软件包" - dnf remove -y openwebbeans-test - CHECK_RESULT $? 0 0 "卸载openwebbeans-test失败" - else - LOG_INFO "环境已安装openwebbeans-test,保持安装状态" - fi - - LOG_INFO "OpenWebBeans bean scope功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_uninstall.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_uninstall.sh deleted file mode 100644 index b2462ff7d0d..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_uninstall.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test uninstallation of the openwebbeans-test package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出函数(可选,用于日志高亮) - LOG_INFO() { - echo -e "\033[32m[INFO]\033[0m $*" - } - LOG_ERROR() { - echo -e "\033[31m[ERROR]\033[0m $*" - } - - # 定义软件包名称 - PACKAGE_NAME="openwebbeans-test" - - # 步骤1:检查软件包是否已在yum源中 - LOG_INFO "检查软件包是否在yum源中" - dnf list available "$PACKAGE_NAME" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中" - exit 255 - fi - - # 步骤2:检查当前是否已安装 - LOG_INFO "检查当前是否已安装 $PACKAGE_NAME" - if rpm -q "$PACKAGE_NAME" > /dev/null 2>&1; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将执行安装测试" - INSTALLED_BEFORE=false - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "安装软件包 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4:验证软件包功能(示例:检查版本或运行测试命令) - LOG_INFO "验证软件包功能" - # 假设软件包提供了一个测试命令,这里以检查版本为例 - if command -v openwebbeans-test > /dev/null 2>&1; then - openwebbeans-test --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "软件包功能验证失败" - else - LOG_ERROR "软件包未提供预期命令,参数可能不存在或不支持" - exit 255 - fi - - # 步骤5:卸载软件包(仅在之前未安装的情况下) - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - # 步骤6:验证卸载结果 - LOG_INFO "验证卸载结果" - if rpm -q "$PACKAGE_NAME" > /dev/null 2>&1; then - LOG_ERROR "软件包卸载失败" - exit 1 - else - LOG_INFO "软件包卸载成功" - fi - - # 步骤7:清理环境(如果需要) - LOG_INFO "清理测试环境" - # 这里可以添加额外的清理步骤,例如删除临时文件等 - # 但根据需求,主要清理已由卸载步骤完成 - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_version.sh b/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_version.sh deleted file mode 100644 index e94867914eb..00000000000 --- a/testcases/function_test/pkg_test/openwebbeans/openwebbeans-test/test_openwebbeans-test_function_version.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-03 -# @License : Mulan PSL v2 -# @Desc : Test checking the installed package version -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="openwebbeans-test-function-version" - TEST_COMMAND="rpm -q $PACKAGE_NAME" - - LOG_INFO "开始测试:检查已安装软件包版本" - - LOG_INFO "步骤1:检查软件包是否已在yum源中" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包:$PACKAGE_NAME" - exit 255 - fi - LOG_INFO "软件包 $PACKAGE_NAME 在yum源中存在" - - LOG_INFO "步骤2:检查当前是否已安装软件包" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - IS_INSTALLED=$? - - if [ $IS_INSTALLED -eq 0 ]; then - LOG_INFO "软件包已安装,测试后保持安装状态" - NEED_CLEANUP=0 - else - LOG_INFO "软件包未安装,将在测试后清理" - NEED_CLEANUP=1 - - LOG_INFO "步骤3:安装软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包失败" - LOG_INFO "软件包安装成功" - fi - - LOG_INFO "步骤4:执行测试命令" - eval $TEST_COMMAND - CHECK_RESULT $? 0 0 "执行命令失败" - LOG_INFO "命令执行成功,软件包版本信息正常显示" - - if [ $NEED_CLEANUP -eq 1 ]; then - LOG_INFO "步骤5:清理环境,卸载软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包失败" - LOG_INFO "软件包卸载成功" - else - LOG_INFO "步骤5:保持安装状态,无需清理" - fi - - LOG_INFO "测试完成:检查已安装软件包版本" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/p11-kit/p11-kit-help/test_p11-kit-help_function_help_content.sh b/testcases/function_test/pkg_test/p11-kit/p11-kit-help/test_p11-kit-help_function_help_content.sh deleted file mode 100644 index c72bdf75fba..00000000000 --- a/testcases/function_test/pkg_test/p11-kit/p11-kit-help/test_p11-kit-help_function_help_content.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-15 -# @License : Mulan PSL v2 -# @Desc : Check help content availability and format -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出函数(可选,根据实际环境调整) - if [ -z "$LOG_INFO" ]; then - LOG_INFO() { - echo "[INFO] $*" - } - fi - - if [ -z "$LOG_ERROR" ]; then - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - fi - - # 定义软件包名称 - PACKAGE_NAME="p11-kit" - - # 定义命令和参数 - COMMAND="p11-kit" - HELP_ARG="--help" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME" - if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then - LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在" - exit 255 - fi - - # 步骤2:检查是否已安装软件包 - LOG_INFO "步骤2:检查是否已安装软件包 $PACKAGE_NAME" - if rpm -q "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4:检查命令是否存在 - LOG_INFO "步骤4:检查命令 $COMMAND 是否存在" - if ! command -v "$COMMAND" &>/dev/null; then - LOG_ERROR "命令 $COMMAND 不存在" - exit 255 - fi - - # 步骤5:检查帮助参数是否支持 - LOG_INFO "步骤5:检查命令 $COMMAND 是否支持参数 $HELP_ARG" - if ! "$COMMAND" "$HELP_ARG" &>/dev/null; then - LOG_ERROR "命令 $COMMAND 不支持参数 $HELP_ARG" - exit 255 - fi - - # 步骤6:执行帮助命令并检查输出格式 - LOG_INFO "步骤6:执行命令 $COMMAND $HELP_ARG 并检查帮助内容格式" - HELP_OUTPUT=$("$COMMAND" "$HELP_ARG" 2>&1) - CHECK_RESULT $? 0 0 "执行命令 $COMMAND $HELP_ARG 失败" - - # 步骤7:检查帮助内容是否包含基本关键字 - LOG_INFO "步骤7:检查帮助内容是否包含基本关键字" - echo "$HELP_OUTPUT" | grep -q "Usage:\|用法:" - CHECK_RESULT $? 0 0 "帮助内容缺少Usage或用法说明" - echo "$HELP_OUTPUT" | grep -q "Options:\|选项:" - CHECK_RESULT $? 0 0 "帮助内容缺少Options或选项说明" - - # 步骤8:如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤8:卸载软件包 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成:帮助内容可用且格式正确" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/p11-kit/p11-kit-help/test_p11-kit-help_function_update.sh b/testcases/function_test/pkg_test/p11-kit/p11-kit-help/test_p11-kit-help_function_update.sh deleted file mode 100644 index 2564c91ba43..00000000000 --- a/testcases/function_test/pkg_test/p11-kit/p11-kit-help/test_p11-kit-help_function_update.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-15 -# @License : Mulan PSL v2 -# @Desc : Test updating p11-kit-help package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出(可选,用于日志高亮) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义常量 - PACKAGE_NAME="p11-kit-help" - - # 检查软件包是否在yum源中 - check_package_in_repo() { - LOG_INFO "检查yum源中是否存在软件包: $PACKAGE_NAME" - dnf list available "$PACKAGE_NAME" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包: $PACKAGE_NAME" - exit 255 - fi - LOG_INFO "软件包 $PACKAGE_NAME 在yum源中存在" - } - - # 检查命令参数是否支持 - check_command_parameters() { - LOG_INFO "检查命令参数是否支持" - # 假设我们要测试的命令是 p11-kit help,检查其是否支持 --version 参数 - if p11-kit help --version &>/dev/null; then - LOG_INFO "命令参数支持" - else - LOG_ERROR "命令参数不支持" - exit 255 - fi - } - - # 检查软件包是否已安装 - check_installed() { - LOG_INFO "检查软件包是否已安装" - rpm -q "$PACKAGE_NAME" &>/dev/null - return $? - } - - # 安装软件包 - install_package() { - LOG_INFO "安装软件包: $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包失败" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "卸载软件包: $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包失败" - } - - # 测试p11-kit-help功能 - test_p11_kit_help() { - LOG_INFO "测试p11-kit-help功能" - p11-kit help - CHECK_RESULT $? 0 0 "p11-kit-help命令执行失败" - } - - # 主测试流程 - main() { - LOG_INFO "开始测试: Test updating p11-kit-help package" - - # 步骤1: 检查软件包是否在yum源中 - check_package_in_repo - - # 步骤2: 检查命令参数是否支持 - check_command_parameters - - # 步骤3: 检查软件包是否已安装 - local was_installed=false - if check_installed; then - LOG_INFO "软件包已安装,测试完成后保持安装状态" - was_installed=true - else - LOG_INFO "软件包未安装,将在测试完成后卸载" - was_installed=false - install_package - fi - - # 步骤4: 测试p11-kit-help功能 - test_p11_kit_help - - # 步骤5: 清理环境 - LOG_INFO "清理环境" - if [ "$was_installed" = false ]; then - uninstall_package - else - LOG_INFO "保持软件包安装状态" - fi - - LOG_INFO "测试完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_install_check.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_install_check.sh deleted file mode 100644 index 995f28a53bc..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_install_check.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 检查软件包是否已正确安装 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:检查软件包是否已正确安装 - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 ${PACKAGE_NAME}" - if ! dnf list available "${PACKAGE_NAME}" &>/dev/null; then - LOG_ERROR "yum源中未找到软件包 ${PACKAGE_NAME}" - exit 255 - fi - LOG_INFO "yum源中存在软件包 ${PACKAGE_NAME}" - - # 步骤2:检查当前环境是否已安装该软件包 - LOG_INFO "步骤2:检查当前环境是否已安装软件包 ${PACKAGE_NAME}" - if rpm -q "${PACKAGE_NAME}" &>/dev/null; then - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,标记为已安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,标记为未安装状态" - ALREADY_INSTALLED=0 - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "${ALREADY_INSTALLED}" -eq 0 ]; then - LOG_INFO "步骤3:安装软件包 ${PACKAGE_NAME}" - dnf install -y "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - LOG_INFO "软件包 ${PACKAGE_NAME} 安装成功" - fi - - # 步骤4:验证软件包是否已正确安装 - LOG_INFO "步骤4:验证软件包 ${PACKAGE_NAME} 是否已正确安装" - if rpm -q "${PACKAGE_NAME}" &>/dev/null; then - LOG_INFO "软件包 ${PACKAGE_NAME} 已正确安装" - else - LOG_ERROR "软件包 ${PACKAGE_NAME} 未正确安装" - exit 1 - fi - - # 步骤5:验证软件包提供的命令是否可用 - LOG_INFO "步骤5:验证软件包 ${PACKAGE_NAME} 提供的命令是否可用" - # 检查pdfinfo命令是否存在 - if ! command -v pdfinfo &>/dev/null; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 未提供 pdfinfo 命令" - exit 1 - fi - LOG_INFO "pdfinfo 命令可用" - - # 步骤6:测试pdfinfo命令的基本功能 - LOG_INFO "步骤6:测试 pdfinfo 命令的基本功能" - # 创建一个简单的PDF文件用于测试 - TEST_PDF="test_document.pdf" - cat > "${TEST_PDF}" << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF - EOF - - # 使用pdfinfo检查PDF文件 - pdfinfo "${TEST_PDF}" &>/dev/null - CHECK_RESULT $? 0 0 "pdfinfo 命令无法处理PDF文件" - LOG_INFO "pdfinfo 命令功能正常" - - # 清理测试文件 - rm -f "${TEST_PDF}" - - # 步骤7:环境恢复 - LOG_INFO "步骤7:环境恢复" - if [ "${ALREADY_INSTALLED}" -eq 0 ]; then - LOG_INFO "卸载测试安装的软件包 ${PACKAGE_NAME}" - dnf remove -y "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - LOG_INFO "软件包 ${PACKAGE_NAME} 已成功卸载,环境已恢复" - else - LOG_INFO "软件包 ${PACKAGE_NAME} 在测试前已安装,保持安装状态" - fi - - LOG_INFO "测试完成:软件包 ${PACKAGE_NAME} 安装检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfattach_add.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfattach_add.sh deleted file mode 100644 index fd172f763ef..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfattach_add.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdfattach命令向PDF添加附件文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfattach命令向PDF添加附件文件功能" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查系统是否已安装poppler-utils - LOG_INFO "检查系统是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - INSTALLED=true - LOG_INFO "系统已安装poppler-utils" - else - INSTALLED=false - LOG_INFO "系统未安装poppler-utils,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfattach命令是否存在 - LOG_INFO "检查pdfattach命令是否存在" - which pdfattach > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfattach命令不存在" - - # 检查pdfattach命令是否支持--help参数 - LOG_INFO "检查pdfattach命令是否支持--help参数" - pdfattach --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfattach命令不支持--help参数" - if [ "$INSTALLED" = "false" ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 15 - >> - stream - BT /F1 12 Tf 72 720 Td (Test) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000117 00000 n - 0000000201 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 310 - %%EOF - EOF - - LOG_INFO "创建测试附件文件" - echo "This is a test attachment" > test_attachment.txt - - # 测试pdfattach命令添加附件 - LOG_INFO "使用pdfattach命令向PDF添加附件" - pdfattach test.pdf test_attachment.txt output.pdf - CHECK_RESULT $? 0 0 "pdfattach命令执行失败" - - # 验证输出文件是否存在 - LOG_INFO "验证输出文件是否存在" - [ -f output.pdf ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_attachment.txt output.pdf - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfdetach_list.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfdetach_list.sh deleted file mode 100644 index 0a817192d00..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfdetach_list.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdfdetach命令列出PDF中的嵌入文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:使用pdfdetach命令列出PDF中的嵌入文件" - LOG_INFO "步骤1:检查yum源中是否存在poppler-utils软件包" - dnf list poppler-utils 2>/dev/null | grep -q poppler-utils - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统中是否已安装poppler-utils" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装,将安装该软件包作为测试步骤" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - INSTALLED="false" - fi - - LOG_INFO "步骤3:检查pdfdetach命令是否支持-list参数" - pdfdetach -help 2>&1 | grep -q -- "-list" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfdetach命令不支持-list参数" - if [ "$INSTALLED" == "false" ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤4:创建一个包含嵌入文件的PDF用于测试" - cat > test_document.txt << EOF - 这是一个测试文档,用于创建包含嵌入文件的PDF。 - EOF - pdftk A=test_document.txt output test_document.pdf attach_files test_document.txt - CHECK_RESULT $? 0 0 "创建测试PDF失败" - - LOG_INFO "步骤5:使用pdfdetach -list命令列出PDF中的嵌入文件" - pdfdetach -list test_document.pdf - CHECK_RESULT $? 0 0 "pdfdetach -list命令执行失败" - - LOG_INFO "步骤6:清理测试文件" - rm -f test_document.txt test_document.pdf - - LOG_INFO "步骤7:根据初始状态恢复环境" - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdffonts_list.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdffonts_list.sh deleted file mode 100644 index 126e62907a6..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdffonts_list.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdffonts命令列出PDF文件中使用的字体 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装poppler-utils - LOG_INFO "检查是否已经安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已经安装" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装" - INSTALLED="false" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000226 00000 n - 0000000384 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 492 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 检查pdffonts命令是否存在 - LOG_INFO "检查pdffonts命令是否存在" - command -v pdffonts > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdffonts命令不存在" - exit 255 - fi - - # 检查pdffonts命令是否支持-l参数 - LOG_INFO "检查pdffonts命令是否支持-l参数" - pdffonts -l test.pdf > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdffonts命令不支持-l参数" - exit 255 - fi - - # 使用pdffonts命令列出PDF文件中使用的字体 - LOG_INFO "使用pdffonts命令列出PDF文件中使用的字体" - pdffonts -l test.pdf - CHECK_RESULT $? 0 0 "pdffonts命令执行失败" - - # 检查输出结果中是否包含字体信息 - LOG_INFO "检查输出结果中是否包含字体信息" - pdffonts -l test.pdf | grep -q "Helvetica" - CHECK_RESULT $? 0 0 "PDF文件中未找到Helvetica字体" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装,则卸载poppler-utils - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfimages_extract.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfimages_extract.sh deleted file mode 100644 index 54b6522cda0..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfimages_extract.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdfimages命令从PDF中提取所有图像 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - if dnf list installed poppler-utils >/dev/null 2>&1; then - LOG_INFO "poppler-utils软件包已安装" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils软件包未安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils >/dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdfimages命令是否存在 - LOG_INFO "检查pdfimages命令是否存在" - command -v pdfimages >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfimages命令不存在" - - # 检查pdfimages命令是否支持--help参数 - LOG_INFO "检查pdfimages命令是否支持--help参数" - pdfimages --help >/dev/null 2>&1 - CHECK_RESULT $? 0 255 "pdfimages命令不支持--help参数" - - # 创建测试PDF文件(使用示例PDF) - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Length 6 - >> - stream - \x00\x00\x00\x00\x00\x00 - endstream - endobj - 5 0 obj - << - /Length 44 - >> - stream - q - 100 0 0 100 0 0 cm - /Im1 Do - Q - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000113 00000 n - 0000000250 00000 n - 0000000323 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 389 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdfimages命令从PDF中提取所有图像 - LOG_INFO "使用pdfimages命令从PDF中提取所有图像" - pdfimages test.pdf extracted_image - CHECK_RESULT $? 0 0 "使用pdfimages命令提取图像失败" - - # 检查是否成功提取图像文件 - LOG_INFO "检查是否成功提取图像文件" - if [ -f "extracted_image-000.ppm" ]; then - LOG_INFO "成功提取图像文件:extracted_image-000.ppm" - else - LOG_ERROR "未找到提取的图像文件" - CHECK_RESULT 1 0 0 "未成功提取图像文件" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf extracted_image-*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfinfo_basic.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfinfo_basic.sh deleted file mode 100644 index b6fadde423a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfinfo_basic.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdfinfo命令获取PDF文档基本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令获取PDF文档基本信息" - - # 检查软件包是否在yum源中 - LOG_INFO "检查poppler-utils软件包是否在yum源中" - dnf list poppler-utils 2>&1 | grep -q "Available Packages" - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包在yum源中可用" - else - LOG_ERROR "poppler-utils软件包不在yum源中" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "未安装poppler-utils,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - else - LOG_INFO "poppler-utils已安装" - fi - - # 检查pdfinfo命令是否存在 - LOG_INFO "检查pdfinfo命令是否存在" - command -v pdfinfo > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不存在" - exit 255 - fi - - # 检查pdfinfo命令是否支持基本参数 - LOG_INFO "检查pdfinfo命令是否支持基本参数" - pdfinfo -h 2>&1 | grep -q "Usage:" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令参数不支持" - exit 255 - fi - - # 创建测试PDF文件(使用示例文本) - LOG_INFO "创建测试PDF文件" - cat > test_input.txt << EOF - 这是一个测试PDF文件 - 用于测试pdfinfo命令 - EOF - - enscript test_input.txt -o test_output.ps 2>/dev/null - ps2pdf test_output.ps test.pdf 2>/dev/null - - # 使用pdfinfo获取PDF文档基本信息 - LOG_INFO "使用pdfinfo获取PDF文档基本信息" - pdfinfo test.pdf > pdfinfo_output.txt 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令执行失败" - - # 验证pdfinfo输出包含基本信息 - LOG_INFO "验证pdfinfo输出包含基本信息" - grep -q "Title:" pdfinfo_output.txt - CHECK_RESULT $? 0 0 "pdfinfo输出缺少Title信息" - grep -q "Pages:" pdfinfo_output.txt - CHECK_RESULT $? 0 0 "pdfinfo输出缺少Pages信息" - grep -q "Page size:" pdfinfo_output.txt - CHECK_RESULT $? 0 0 "pdfinfo输出缺少Page size信息" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.txt test_output.ps test.pdf pdfinfo_output.txt - - # 如果测试前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "测试前未安装poppler-utils,开始卸载" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfseparate_split.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfseparate_split.sh deleted file mode 100644 index 95f7d293a05..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfseparate_split.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdfseparate命令将PDF文件拆分为单页文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - - # 如果未安装,则安装 - if [ $installed -ne 0 ]; then - LOG_INFO "poppler-utils未安装,开始安装" - # 检查yum源中是否有该软件包 - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - # 标记为测试期间安装 - test_installed=1 - else - LOG_INFO "poppler-utils已安装" - test_installed=0 - fi - - # 检查pdfseparate命令是否存在 - LOG_INFO "检查pdfseparate命令是否存在" - command -v pdfseparate > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfseparate命令不存在" - - # 检查pdfseparate命令是否支持基本参数 - LOG_INFO "检查pdfseparate命令是否支持基本参数" - pdfseparate --help > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "pdfseparate命令不支持--help参数" - - # 准备测试文件 - LOG_INFO "准备测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000113 00000 n - 0000000202 00000 n - 0000000291 00000 n - 0000000380 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 447 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 执行pdfseparate命令拆分PDF - LOG_INFO "执行pdfseparate命令拆分PDF文件" - pdfseparate test_input.pdf test_output_%d.pdf - CHECK_RESULT $? 0 0 "pdfseparate拆分PDF失败" - - # 检查拆分结果 - LOG_INFO "检查拆分结果" - if [ -f test_output_1.pdf ] && [ -f test_output_2.pdf ]; then - LOG_INFO "成功拆分出2个单页PDF文件" - page1_size=$(stat -c%s test_output_1.pdf) - page2_size=$(stat -c%s test_output_2.pdf) - if [ $page1_size -gt 0 ] && [ $page2_size -gt 0 ]; then - LOG_INFO "拆分出的文件大小正常:page1=${page1_size}字节,page2=${page2_size}字节" - else - LOG_ERROR "拆分出的文件大小为0" - exit 1 - fi - else - LOG_ERROR "未成功拆分出PDF文件" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output_1.pdf test_output_2.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试期间安装了软件包,则卸载 - if [ $test_installed -eq 1 ]; then - LOG_INFO "卸载测试期间安装的poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdftocairo_convert.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdftocairo_convert.sh deleted file mode 100644 index d3aa5a787af..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdftocairo_convert.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdftocairo命令将PDF转换为SVG格式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化变量 - PDF_FILE="test_input.pdf" - SVG_FILE="output.svg" - PACKAGE_NAME="poppler-utils" - LOG_INFO "开始测试pdftocairo命令将PDF转换为SVG格式" - - # 检查yum源中是否存在软件包 - LOG_INFO "检查yum源中是否存在$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到$PACKAGE_NAME软件包" - exit 255 - fi - - # 判断环境是否已安装软件包 - LOG_INFO "检查系统是否已安装$PACKAGE_NAME软件包" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - INSTALLED=true - LOG_INFO "检测到$PACKAGE_NAME已安装,测试完成后将保持安装状态" - else - INSTALLED=false - LOG_INFO "检测到$PACKAGE_NAME未安装,将在测试前安装并在测试后卸载" - fi - - # 如果未安装则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败" - fi - - # 检查pdftocairo命令是否支持svg参数 - LOG_INFO "检查pdftocairo命令是否支持svg参数" - pdftocairo -svg -h &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不支持svg参数" - # 如果是测试过程中安装的,需要卸载 - if [ "$INSTALLED" = "false" ]; then - dnf remove -y $PACKAGE_NAME - fi - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > $PDF_FILE << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000175 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 402 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftocairo将PDF转换为SVG - LOG_INFO "使用pdftocairo命令将PDF转换为SVG格式" - pdftocairo -svg $PDF_FILE $SVG_FILE - CHECK_RESULT $? 0 0 "PDF转SVG转换失败" - - # 验证SVG文件是否生成 - LOG_INFO "验证SVG文件是否生成" - if [ -f "$SVG_FILE" ]; then - LOG_INFO "SVG文件已成功生成: $SVG_FILE" - # 检查SVG文件是否包含基本结构 - grep -q " /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils" - rpm -q poppler-utils &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,记录安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将进行安装" - INSTALLED=false - fi - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - LOG_INFO "步骤4:检查pdftoppm命令是否存在" - command -v pdftoppm &> /dev/null - CHECK_RESULT $? 0 0 "pdftoppm命令不存在" - LOG_INFO "步骤5:检查pdftoppm命令是否支持-png参数" - pdftoppm -h 2>&1 | grep -q -- -png - CHECK_RESULT $? 0 255 "pdftoppm不支持-png参数" - LOG_INFO "步骤6:准备测试用PDF文件" - cat > /tmp/test.pdf << "EOF" - %PDF-1.4 - 1 0 obj << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 100 100] >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000009 00000 n - 0000000053 00000 n - 0000000105 00000 n - trailer << /Size 4 /Root 1 0 R >> - startxref - 149 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "步骤7:执行pdftoppm命令将PDF转换为PNG" - pdftoppm /tmp/test.pdf /tmp/test -png - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - LOG_INFO "步骤8:检查是否生成PNG图片文件" - ls /tmp/test-1.png &> /dev/null - CHECK_RESULT $? 0 0 "未生成PNG图片文件" - LOG_INFO "步骤9:清理临时文件" - rm -f /tmp/test.pdf /tmp/test-*.png - CHECK_RESULT $? 0 0 "清理临时文件失败" - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤10:卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤10:保持原有安装状态,不卸载poppler-utils" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdftotext_extract.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdftotext_extract.sh deleted file mode 100644 index 686d051a096..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdftotext_extract.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdftotext命令从PDF中提取文本内容 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查poppler-utils是否已安装" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否存在 - LOG_INFO "检查pdftotext命令是否存在" - if ! command -v pdftotext &>/dev/null; then - LOG_ERROR "pdftotext命令不存在" - exit 255 - fi - - # 检查pdftotext命令是否支持所需参数 - LOG_INFO "检查pdftotext命令是否支持所需参数" - if ! pdftotext -h 2>&1 | grep -q "\-layout"; then - LOG_ERROR "pdftotext命令不支持-layout参数" - exit 255 - fi - - # 创建测试用的PDF文件(使用简单的文本内容) - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello, PDF World!) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000179 00000 n - 0000000364 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 492 - %%EOF - EOF - - # 使用pdftotext命令从PDF中提取文本内容 - LOG_INFO "使用pdftotext命令从PDF中提取文本内容" - pdftotext -layout test_input.pdf test_output.txt - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - # 检查提取的文本内容是否符合预期 - LOG_INFO "检查提取的文本内容是否符合预期" - if grep -q "Hello, PDF World!" test_output.txt; then - LOG_INFO "提取的文本内容符合预期" - else - LOG_ERROR "提取的文本内容不符合预期" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.txt - - # 如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfunite_merge.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfunite_merge.sh deleted file mode 100644 index 8e60ce5802e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_function_pdfunite_merge.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 使用pdfunite命令合并多个PDF文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfunite命令合并多个PDF文件的功能" - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - LOG_INFO "检查yum源中是否存在$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到$PACKAGE_NAME软件包" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "检查系统是否已安装$PACKAGE_NAME" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "$PACKAGE_NAME未安装,将在测试前安装" - INSTALLED_BEFORE=0 - fi - - # 若未安装则安装 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME失败" - fi - - # 检查pdfunite命令是否存在 - LOG_INFO "检查pdfunite命令是否存在" - which pdfunite > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfunite命令不存在" - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - echo "%PDF-1.4" > test1.pdf - echo "1 0 obj" >> test1.pdf - echo "<>" >> test1.pdf - echo "endobj" >> test1.pdf - echo "2 0 obj" >> test1.pdf - echo "<>" >> test1.pdf - echo "endobj" >> test1.pdf - echo "3 0 obj" >> test1.pdf - echo "<>" >> test1.pdf - echo "endobj" >> test1.pdf - echo "trailer" >> test1.pdf - echo "<>" >> test1.pdf - echo "%%EOF" >> test1.pdf - - cp test1.pdf test2.pdf - cp test1.pdf test3.pdf - - # 测试pdfunite命令合并PDF文件 - LOG_INFO "使用pdfunite命令合并test1.pdf、test2.pdf和test3.pdf为merged.pdf" - pdfunite test1.pdf test2.pdf test3.pdf merged.pdf - CHECK_RESULT $? 0 0 "pdfunite命令执行失败" - - # 验证合并后的PDF文件是否存在 - LOG_INFO "验证合并后的PDF文件merged.pdf是否存在" - [ -f merged.pdf ] - CHECK_RESULT $? 0 0 "合并后的PDF文件不存在" - - # 验证合并后的PDF文件是否有效(简单检查文件头) - LOG_INFO "验证合并后的PDF文件格式是否正确" - head -c 9 merged.pdf | grep -q "%PDF-1.4" - CHECK_RESULT $? 0 0 "合并后的PDF文件格式不正确" - - # 清理测试文件 - LOG_INFO "清理测试生成的PDF文件" - rm -f test1.pdf test2.pdf test3.pdf merged.pdf - - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED_BEFORE -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 "测试pdfunite命令合并多个PDF文件的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_h.sh deleted file mode 100644 index 001891fea79..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_h.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用-h参数打印帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 poppler-utils 的 pdfattach 命令的 -h 参数功能" - - LOG_INFO "检查系统中是否已安装 poppler-utils 软件包" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils 已安装,记录当前状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils 未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包,测试无法继续" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "检查 pdfattach 命令的 -h 参数是否存在" - if ! pdfattach -h 2>&1 | head -1 | grep -q "Usage:"; then - LOG_ERROR "pdfattach 命令不支持 -h 参数或参数无效" - exit 255 - fi - - LOG_INFO "执行 pdfattach -h 命令,检查帮助信息" - pdfattach -h > /tmp/pdfattach_help.txt 2>&1 - CHECK_RESULT $? 0 0 "执行 pdfattach -h 命令失败" - - LOG_INFO "验证帮助信息输出是否包含关键内容" - grep -q "Usage:" /tmp/pdfattach_help.txt - CHECK_RESULT $? 0 0 "帮助信息输出不符合预期" - - LOG_INFO "清理临时文件" - rm -f /tmp/pdfattach_help.txt - - LOG_INFO "环境恢复:根据初始状态决定是否卸载软件包" - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载在测试中安装的 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "系统初始已安装 poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_help.sh deleted file mode 100644 index 7fb43506a58..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_help.sh +++ /dev/null @@ -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-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用-help参数打印帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 poppler-utils 软件包的 pdfattach 命令 -help 参数功能" - - # 步骤1:检查 yum 源中是否存在 poppler-utils 软件包 - LOG_INFO "检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 步骤2:检查当前环境是否已安装 poppler-utils - LOG_INFO "检查当前环境是否已安装 poppler-utils" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils 已安装,标记为无需卸载" - NEED_UNINSTALL=false - else - LOG_INFO "poppler-utils 未安装,将在测试过程中安装" - NEED_UNINSTALL=true - fi - - # 步骤3:如果未安装,则安装 poppler-utils - if [ "$NEED_UNINSTALL" = true ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 步骤4:检查 pdfattach 命令是否支持 -help 参数 - LOG_INFO "检查 pdfattach 命令是否支持 -help 参数" - if ! pdfattach -help 2>&1 | grep -q "Usage:"; then - LOG_ERROR "pdfattach 命令不支持 -help 参数或参数不存在" - exit 255 - fi - - # 步骤5:执行 pdfattach -help 命令并检查结果 - LOG_INFO "执行 pdfattach -help 命令" - pdfattach -help 2>&1 - CHECK_RESULT $? 0 0 "执行 pdfattach -help 命令失败" - - # 步骤6:环境恢复,如果之前未安装则卸载软件包 - if [ "$NEED_UNINSTALL" = true ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "保持 poppler-utils 已安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_replace.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_replace.sh deleted file mode 100644 index 77705760434..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_replace.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用-replace参数替换已存在的同名附件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查与准备 - LOG_INFO "开始测试poppler-utils的pdfattach命令-replace参数功能" - LOG_INFO "步骤1:检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_BEFORE_TEST=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "步骤2:检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装则安装软件包 - if [ $INSTALLED_BEFORE_TEST -eq 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 准备测试文件 - LOG_INFO "步骤4:准备测试文件" - echo "这是原始PDF文件内容" > original.pdf - echo "这是第一个附件内容" > attachment1.txt - echo "这是第二个附件内容" > attachment2.txt - - # 先添加一个附件 - LOG_INFO "步骤5:向PDF文件添加第一个附件" - pdfattach original.pdf attachment1.txt - CHECK_RESULT $? 0 0 "添加第一个附件失败" - - # 检查附件是否添加成功 - LOG_INFO "步骤6:验证第一个附件是否添加成功" - pdfdetach -list original.pdf | grep -q "attachment1.txt" - CHECK_RESULT $? 0 0 "第一个附件未成功添加" - - # 使用-replace参数替换同名附件 - LOG_INFO "步骤7:使用-replace参数替换已存在的同名附件" - pdfattach -replace original.pdf attachment2.txt - CHECK_RESULT $? 0 0 "使用-replace参数替换附件失败" - - # 验证附件是否被替换 - LOG_INFO "步骤8:验证附件是否被成功替换" - pdfdetach -list original.pdf | grep -q "attachment2.txt" - CHECK_RESULT $? 0 0 "附件未被成功替换" - - # 验证原始附件已不存在 - LOG_INFO "步骤9:验证原始附件已不存在" - pdfdetach -list original.pdf | grep -q "attachment1.txt" - if [ $? -eq 0 ]; then - LOG_ERROR "原始附件仍然存在,替换失败" - exit 1 - fi - - LOG_INFO "步骤10:测试成功,-replace参数功能正常" - - # 清理测试文件 - LOG_INFO "步骤11:清理测试文件" - rm -f original.pdf attachment1.txt attachment2.txt - - # 环境恢复 - LOG_INFO "步骤12:恢复测试环境" - if [ $INSTALLED_BEFORE_TEST -eq 0 ]; then - LOG_INFO "卸载测试过程中安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils软件包的安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_special_double_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_special_double_help.sh deleted file mode 100644 index fa6d2dbf388..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_special_double_help.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用--help参数打印帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,标记为已安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装,标记为未安装状态" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包,退出测试" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 测试pdfattach命令的--help参数 - LOG_INFO "测试pdfattach命令的--help参数" - pdfattach --help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "pdfattach命令支持--help参数" - else - LOG_ERROR "pdfattach命令不支持--help参数,退出测试" - # 恢复环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "恢复环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - fi - exit 255 - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "恢复环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_special_question.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_special_question.sh deleted file mode 100644 index e38e49113ab..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_special_question.sh +++ /dev/null @@ -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-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用-?参数打印帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试poppler-utils的pdfattach命令-?参数打印帮助信息" - - LOG_INFO "步骤1:检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,标记为已存在安装" - ALREADY_INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:检查pdfattach命令是否支持-?参数" - pdfattach -? 2>&1 | grep -q "usage:" || { - LOG_ERROR "pdfattach命令不支持-?参数" - exit 255 - } - - LOG_INFO "步骤5:执行pdfattach -?命令打印帮助信息" - pdfattach -? 2>&1 | head -5 - CHECK_RESULT $? 0 0 "执行pdfattach -?命令失败" - - LOG_INFO "步骤6:验证帮助信息内容包含usage关键字" - pdfattach -? 2>&1 | grep -q "usage:" - CHECK_RESULT $? 0 0 "帮助信息中未找到usage关键字" - - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤7:卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤7:保持原有poppler-utils安装状态,无需卸载" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_upper_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_upper_v.sh deleted file mode 100644 index 38967315d01..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfattach_upper_v.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用-v参数打印版本和版权信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils的pdfattach命令的-v参数功能" - - # 步骤1:检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 步骤2:检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - if rpm -q poppler-utils &> /dev/null; then - already_installed=true - LOG_INFO "poppler-utils已安装,测试结束后保持安装状态" - else - already_installed=false - LOG_INFO "poppler-utils未安装,将作为测试步骤安装" - fi - - # 步骤3:如果未安装,则安装poppler-utils软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 步骤4:检查pdfattach命令是否支持-v参数 - LOG_INFO "检查pdfattach命令是否支持-v参数" - if ! pdfattach --help 2>&1 | grep -q "\-v"; then - LOG_ERROR "pdfattach命令不支持-v参数" - exit 255 - fi - - # 步骤5:使用-v参数执行pdfattach命令 - LOG_INFO "使用-v参数执行pdfattach命令" - pdfattach -v - CHECK_RESULT $? 0 0 "执行pdfattach -v命令失败" - - # 步骤6:清理环境 - LOG_INFO "清理测试环境" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__enc_encoding.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__enc_encoding.sh deleted file mode 100644 index 87465eff800..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__enc_encoding.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-enc参数,用于指定输出文本的编码名称 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为保持安装状态" - KEEP_INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,标记为需要卸载" - KEEP_INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfdetach命令是否存在 - LOG_INFO "检查pdfdetach命令是否存在" - command -v pdfdetach > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfdetach命令不存在" - - # 检查pdfdetach命令是否支持-enc参数 - LOG_INFO "检查pdfdetach命令是否支持-enc参数" - pdfdetach -h 2>&1 | grep -q -- "-enc" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfdetach命令不支持-enc参数" - exit 255 - fi - - # 准备测试文件 - LOG_INFO "准备测试用的PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 22 - >> - stream - BT /F1 12 Tf 72 720 Td (Hello) Tj ET - endstream - endobj - 5 0 obj - << - /Type /EmbeddedFile - /Subtype /text/plain - /Length 11 - >> - stream - Hello World - endstream - endobj - 6 0 obj - << - /Type /Filespec - /F (test.txt) - /EF << /F 5 0 R >> - >> - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000113 00000 n - 0000000189 00000 n - 0000000278 00000 n - 0000000342 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 425 - %%EOF - EOF - - # 测试pdfdetach命令的-enc参数 - LOG_INFO "测试pdfdetach命令的-enc参数,指定UTF-8编码" - pdfdetach -enc UTF-8 -saveall test.pdf - CHECK_RESULT $? 0 0 "pdfdetach命令执行失败" - - # 验证输出文件是否存在 - LOG_INFO "验证输出文件是否存在" - ls -la test.txt - CHECK_RESULT $? 0 0 "输出文件不存在" - - # 验证文件内容 - LOG_INFO "验证文件内容" - cat test.txt - CHECK_RESULT $? 0 0 "读取输出文件失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test.txt - - # 恢复环境:如果脚本开始时未安装,则卸载软件包 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__h.sh deleted file mode 100644 index 3d1928ae601..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__h.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-h参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - is_installed=$? - - # 如果未安装,则标记需要后续卸载 - need_cleanup=0 - if [ $is_installed -ne 0 ]; then - LOG_INFO "poppler-utils未安装,开始安装" - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 安装软件包 - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - need_cleanup=1 - else - LOG_INFO "poppler-utils已安装" - fi - - # 测试pdfdetach命令的-h参数 - LOG_INFO "测试pdfdetach命令的-h参数" - pdfdetach -h > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfdetach命令不支持-h参数" - exit 255 - fi - - # 执行pdfdetach -h命令并检查结果 - LOG_INFO "执行pdfdetach -h命令" - pdfdetach -h - CHECK_RESULT $? 0 0 "pdfdetach -h命令执行失败" - - # 环境清理 - LOG_INFO "开始环境清理" - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__help.sh deleted file mode 100644 index f3aae7c0b72..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__help.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-help参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(根据要求直接使用,这里仅为说明,实际脚本中不定义) - # LOG_INFO 和 LOG_ERROR 函数在环境中已定义,直接调用 - - # 步骤1:检查当前是否已安装 poppler-utils 软件包 - LOG_INFO "步骤1:检查当前是否已安装 poppler-utils 软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 软件包已安装" - INSTALLED=true - else - LOG_INFO "poppler-utils 软件包未安装" - INSTALLED=false - fi - - # 步骤2:检查 yum 源中是否存在 poppler-utils 软件包 - LOG_INFO "步骤2:检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装 poppler-utils 软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 软件包失败" - fi - - # 步骤4:检查 pdfdetach 命令是否支持 -help 参数 - LOG_INFO "步骤4:检查 pdfdetach 命令是否支持 -help 参数" - if ! pdfdetach -help &>/dev/null; then - LOG_ERROR "pdfdetach 命令不支持 -help 参数" - # 如果未安装,则卸载已安装的软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 步骤5:执行 pdfdetach -help 命令并检查执行结果 - LOG_INFO "步骤5:执行 pdfdetach -help 命令并检查执行结果" - pdfdetach -help - CHECK_RESULT $? 0 0 "pdfdetach -help 命令执行失败" - - # 步骤6:清理环境,如果测试前未安装,则卸载软件包 - LOG_INFO "步骤6:清理环境,恢复原始状态" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 软件包失败" - else - LOG_INFO "保持 poppler-utils 软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__list.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__list.sh deleted file mode 100644 index c122a98d8e3..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__list.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-list参数,用于列出PDF文件中所有嵌入文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdfdetach命令的-list参数功能" - - LOG_INFO "步骤1: 检查poppler-utils软件包是否在yum源中" - if ! dnf list poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "检测到poppler-utils已安装,测试完成后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "未安装poppler-utils,将在测试过程中安装" - INSTALLED_BEFORE_TEST=false - fi - - if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4: 检查pdfdetach命令的-list参数是否支持" - pdfdetach --help 2>&1 | grep -q -- "-list" - CHECK_RESULT $? 0 0 "pdfdetach命令不支持-list参数" - - LOG_INFO "步骤5: 准备测试用的PDF文件" - TEST_PDF="test_embedded.pdf" - cat > create_test_pdf.py << "EOF" - #!/usr/bin/env python3 - import sys - from PyPDF2 import PdfWriter, PdfReader - from PyPDF2.generic import NameObject, TextStringObject, DictionaryObject, ArrayObject, createStringObject - - # 创建一个简单的PDF - writer = PdfWriter() - writer.add_blank_page(width=200, height=200) - - # 创建附件文件 - attachment_data = b"Test attachment content" - file_spec = DictionaryObject() - file_spec.update({ - NameObject("/Type"): NameObject("/Filespec"), - NameObject("/F"): createStringObject("test.txt"), - NameObject("/EF"): DictionaryObject({ - NameObject("/F"): writer._add_object(createStringObject(attachment_data.decode("latin-1"))) - }) - }) - - # 添加到PDF - writer._root_object.update({ - NameObject("/EmbeddedFiles"): DictionaryObject({ - NameObject("/Names"): ArrayObject([createStringObject("test.txt"), file_spec]) - }) - }) - - with open("test_embedded.pdf", "wb") as f: - writer.write(f) - EOF - - python3 create_test_pdf.py - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6: 执行pdfdetach -list命令" - pdfdetach -list "$TEST_PDF" > output.txt 2>&1 - CHECK_RESULT $? 0 0 "pdfdetach -list命令执行失败" - - LOG_INFO "步骤7: 验证输出结果" - grep -q "test.txt" output.txt - CHECK_RESULT $? 0 0 "未找到预期的嵌入文件test.txt" - - LOG_INFO "步骤8: 清理测试文件" - rm -f "$TEST_PDF" output.txt create_test_pdf.py - - if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then - LOG_INFO "步骤9: 卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤9: 测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__o_outputname.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__o_outputname.sh deleted file mode 100644 index 550c159aadb..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__o_outputname.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-o参数,用于指定保存嵌入文件的输出文件名 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfdetach命令的-o参数,用于指定保存嵌入文件的输出文件名" - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查系统是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "系统未安装poppler-utils,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - else - LOG_INFO "系统已安装poppler-utils,跳过安装步骤" - fi - - LOG_INFO "检查pdfdetach命令是否支持-o参数" - pdfdetach --help 2>&1 | grep -q "\-o" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfdetach命令不支持-o参数" - exit 255 - fi - - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 281 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "测试pdfdetach命令的-o参数" - pdfdetach -o output_file test.pdf - CHECK_RESULT $? 0 0 "pdfdetach命令执行失败" - - LOG_INFO "验证输出文件是否生成" - [ -f output_file ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - LOG_INFO "清理测试生成的文件" - rm -f test.pdf output_file - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $installed -ne 0 ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持系统原有状态,不卸载poppler-utils" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__opw_ownerpass.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__opw_ownerpass.sh deleted file mode 100644 index 42c8bd4eaac..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__opw_ownerpass.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-opw参数,用于提供加密PDF文件的所有者密码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfdetach命令的-opw参数,用于提供加密PDF文件的所有者密码" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中没有找到poppler-utils软件包" - exit 255 - fi - - # 判断环境是否已经安装poppler-utils - LOG_INFO "判断环境是否已经安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - already_installed=true - LOG_INFO "poppler-utils已经安装" - else - already_installed=false - LOG_INFO "poppler-utils未安装,将进行安装" - fi - - # 如果未安装,则安装软件包 - if ! $already_installed; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfdetach命令是否支持-opw参数 - LOG_INFO "检查pdfdetach命令是否支持-opw参数" - if ! pdfdetach --help 2>&1 | grep -q "\-opw"; then - LOG_ERROR "pdfdetach命令不支持-opw参数" - exit 255 - fi - - # 创建加密的PDF文件用于测试 - LOG_INFO "创建加密的PDF文件用于测试" - cat > test_input.txt < /dev/null 2>&1 - INSTALLED=$? - - # 如果未安装,则尝试从yum源安装 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "poppler-utils未安装,尝试从yum源查找并安装" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils包" - exit 255 - fi - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 检查pdfdetach命令是否存在 - LOG_INFO "检查pdfdetach命令是否存在" - which pdfdetach > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfdetach命令不存在" - - # 检查pdfdetach命令是否支持-save参数 - LOG_INFO "检查pdfdetach命令是否支持-save参数" - pdfdetach -h 2>&1 | grep -q "\-save" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfdetach命令不支持-save参数" - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED -ne 0 ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试用的PDF文件(包含嵌入文件) - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF with embedded file) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /EmbeddedFile - /Length 12 - >> - stream - Hello World! - endstream - endobj - 6 0 obj - << - /Type /Filespec - /F (test.txt) - /EF << /F 5 0 R >> - >> - endobj - 7 0 obj - << - /Names [(test.txt) 6 0 R] - >> - endobj - 8 0 obj - << - /EmbeddedFiles 7 0 R - >> - endobj - 9 0 obj - << - /Type /Catalog - /Pages 2 0 R - /Names 8 0 R - >> - endobj - xref - 0 10 - 0000000000 65535 f - 0000000010 00000 n - 0000000056 00000 n - 0000000112 00000 n - 0000000208 00000 n - 0000000310 00000 n - 0000000384 00000 n - 0000000460 00000 n - 0000000528 00000 n - 0000000604 00000 n - trailer - << - /Size 10 - /Root 9 0 R - >> - startxref - 704 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 列出PDF中的嵌入文件 - LOG_INFO "列出PDF中的嵌入文件" - pdfdetach -list test_input.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "列出嵌入文件失败" - - # 测试-save参数保存指定编号的嵌入文件 - LOG_INFO "测试pdfdetach命令的-save参数,保存编号为1的嵌入文件" - pdfdetach -save 1 test_input.pdf - CHECK_RESULT $? 0 0 "使用-save参数保存嵌入文件失败" - - # 检查保存的文件是否存在 - LOG_INFO "检查保存的文件是否存在" - ls -la test.txt > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "保存的文件不存在" - - # 检查文件内容是否正确 - LOG_INFO "检查保存的文件内容是否正确" - CONTENT=$(cat test.txt 2>/dev/null) - EXPECTED="Hello World!" - if [ "$CONTENT" = "$EXPECTED" ]; then - LOG_INFO "文件内容正确" - else - LOG_ERROR "文件内容不正确,期望: $EXPECTED, 实际: $CONTENT" - CHECK_RESULT 1 0 0 "文件内容验证失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "卸载poppler-utils包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - else - LOG_INFO "保持poppler-utils安装状态" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__saveall.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__saveall.sh deleted file mode 100644 index 81883e8240e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__saveall.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-saveall参数,用于保存PDF文件中所有嵌入文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,脚本结束时将保持安装状态" - already_installed=1 - else - LOG_INFO "poppler-utils软件包未安装,将在测试步骤中安装" - already_installed=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 20 - >> - stream - BT /F1 12 Tf 72 720 Td (Test PDF) Tj ET - endstream - endobj - 5 0 obj - << - /Type /EmbeddedFile - /Length 10 - >> - stream - test file - endstream - endobj - 6 0 obj - << - /Type /Filespec - /F (test.txt) - /EF << /F 5 0 R >> - >> - endobj - 7 0 obj - << - /Names [(test.txt) 6 0 R] - >> - endobj - xref - 0 8 - 0000000000 65535 f - 0000000010 00000 n - 0000000050 00000 n - 0000000100 00000 n - 0000000200 00000 n - 0000000300 00000 n - 0000000400 00000 n - 0000000500 00000 n - trailer - << - /Size 8 - /Root 1 0 R - /Info << >> - >> - startxref - 600 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 检查pdfdetach命令是否存在 - LOG_INFO "检查pdfdetach命令是否存在" - which pdfdetach > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfdetach命令不存在" - - # 检查pdfdetach命令是否支持-saveall参数 - LOG_INFO "检查pdfdetach命令是否支持-saveall参数" - pdfdetach -h 2>&1 | grep -q "\-saveall" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfdetach命令不支持-saveall参数" - # 清理测试文件 - rm -f test.pdf - # 如果脚本开始时未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 测试pdfdetach命令的-saveall参数 - LOG_INFO "测试pdfdetach命令的-saveall参数,保存PDF文件中所有嵌入文件" - pdfdetach -saveall test.pdf - CHECK_RESULT $? 0 0 "pdfdetach -saveall命令执行失败" - - # 检查是否成功保存了嵌入文件 - LOG_INFO "检查是否成功保存了嵌入文件test.txt" - if [ -f "test.txt" ]; then - LOG_INFO "嵌入文件test.txt保存成功" - # 检查文件内容 - file_content=$(cat test.txt) - if [ "$file_content" = "test file" ]; then - LOG_INFO "嵌入文件内容正确" - else - LOG_ERROR "嵌入文件内容不正确" - CHECK_RESULT 1 0 0 "嵌入文件内容验证失败" - fi - else - LOG_ERROR "嵌入文件test.txt未保存" - CHECK_RESULT 1 0 0 "嵌入文件保存验证失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__savefile_filename.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__savefile_filename.sh deleted file mode 100644 index c2205d53af6..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__savefile_filename.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-savefile参数,用于通过文件名保存指定的嵌入文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(如果不存在) - if ! type LOG_INFO &>/dev/null; then - LOG_INFO() { echo "[INFO] $*"; } - fi - if ! type LOG_ERROR &>/dev/null; then - LOG_ERROR() { echo "[ERROR] $*"; } - fi - - # 定义检查结果函数(如果不存在) - if ! type CHECK_RESULT &>/dev/null; then - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -eq $expect ]; then - LOG_INFO "检查通过: $message" - else - LOG_ERROR "检查失败: $message (实际: $actual, 期望: $expect)" - exit $actual - fi - else - if [ $actual -ne $expect ]; then - LOG_INFO "检查通过: $message" - else - LOG_ERROR "检查失败: $message (实际: $actual, 期望: 非 $expect)" - exit 1 - fi - fi - } - fi - - # 定义SSH_CMD函数(如果不存在) - if ! type SSH_CMD &>/dev/null; then - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_password=$3 - local node_user=${4:-root} - LOG_INFO "在节点 $node_ip 上执行命令: $cmd" - sshpass -p "$node_password" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$node_user@$node_ip" "$cmd" - return $? - } - fi - - # 测试脚本开始 - LOG_INFO "开始测试 pdfdetach 命令的 -savefile 参数" - - # 检查软件包是否可用 - LOG_INFO "检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中不存在 poppler-utils 软件包" - exit 255 - fi - - # 判断是否已安装 poppler-utils - LOG_INFO "检查是否已安装 poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils 未安装,将在测试前安装" - INSTALLED_BEFORE=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 检查 pdfdetach 命令是否支持 -savefile 参数 - LOG_INFO "检查 pdfdetach 命令是否支持 -savefile 参数" - pdfdetach --help 2>&1 | grep -q -- "-savefile" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfdetach 命令不支持 -savefile 参数" - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建一个测试用的 PDF 文件(包含嵌入文件) - LOG_INFO "创建测试用的 PDF 文件" - cat > test_document.txt << EOF - 这是一个测试文档。 - 用于测试 pdfdetach 命令的 -savefile 参数。 - EOF - pdftk test_document.txt output test.pdf attach_files test_document.txt - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - # 测试 pdfdetach 命令的 -savefile 参数 - LOG_INFO "测试 pdfdetach 命令的 -savefile 参数,保存嵌入文件" - pdfdetach -savefile extracted_file.txt test.pdf - CHECK_RESULT $? 0 0 "pdfdetach 命令执行失败" - - # 检查保存的文件是否存在且内容正确 - LOG_INFO "检查保存的文件是否存在" - if [ -f extracted_file.txt ]; then - LOG_INFO "文件保存成功: extracted_file.txt" - diff test_document.txt extracted_file.txt - CHECK_RESULT $? 0 0 "保存的文件内容与原始文件不一致" - else - LOG_ERROR "保存的文件不存在" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_document.txt test.pdf extracted_file.txt - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "保持 poppler-utils 软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__special__help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__special__help.sh deleted file mode 100644 index b168a335069..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__special__help.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的--help参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdfdetach --help 参数功能" - LOG_INFO "检查是否已安装 poppler-utils 软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils 已安装,测试后保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils 未安装,将在测试前安装" - INSTALLED=false - fi - - LOG_INFO "检查 yum 源中是否存在 poppler-utils 软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum 源中未找到 poppler-utils 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包,退出测试" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 poppler-utils 软件包失败" - fi - - LOG_INFO "执行 pdfdetach --help 命令" - pdfdetach --help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "pdfdetach --help 命令执行成功" - CHECK_RESULT $? 0 0 "pdfdetach --help 命令执行失败" - else - LOG_ERROR "pdfdetach --help 参数不存在或不支持" - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境,卸载 poppler-utils 软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境,卸载 poppler-utils 软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 poppler-utils 软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__upper_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__upper_v.sh deleted file mode 100644 index 1c029d884ad..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__upper_v.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-v参数,用于打印版权和版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - is_installed=$? - - # 记录初始安装状态 - if [ $is_installed -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装" - need_cleanup=0 - else - LOG_INFO "poppler-utils软件包未安装" - need_cleanup=1 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $is_installed -ne 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 测试pdfdetach命令的-v参数 - LOG_INFO "测试pdfdetach命令的-v参数,用于打印版权和版本信息" - pdfdetach -v > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfdetach命令不支持-v参数" - exit 255 - fi - - # 执行pdfdetach -v命令并检查结果 - pdfdetach -v 2>&1 | grep -E "(Copyright|Version|poppler)" > /dev/null - CHECK_RESULT $? 0 0 "pdfdetach -v命令未正确显示版权和版本信息" - - # 环境清理 - LOG_INFO "清理测试环境" - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__upw_userpass.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__upw_userpass.sh deleted file mode 100644 index ef4fa7cb0cb..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfdetach__upw_userpass.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfdetach命令的-upw参数,用于提供加密PDF文件的用户密码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfdetach命令的-upw参数,用于提供加密PDF文件的用户密码" - - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - installed=true - else - LOG_INFO "poppler-utils未安装,将在测试步骤中安装" - installed=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$installed" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfdetach命令是否支持-upw参数 - LOG_INFO "检查pdfdetach命令是否支持-upw参数" - pdfdetach --help 2>&1 | grep -q "\-upw" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfdetach命令不支持-upw参数" - # 如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建一个加密的PDF文件用于测试 - LOG_INFO "创建加密的PDF文件用于测试" - echo "This is a test PDF file." > test.pdf - pdftk test.pdf output encrypted.pdf owner_pw ownerpass user_pw userpass > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "创建加密PDF文件失败" - - # 测试pdfdetach命令的-upw参数 - LOG_INFO "测试pdfdetach命令的-upw参数" - pdfdetach -list encrypted.pdf -upw userpass > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "使用-upw参数提供用户密码失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf encrypted.pdf - - # 如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts__help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts__help.sh deleted file mode 100644 index fb7f3a6c193..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts__help.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的--help参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdffonts命令的--help参数" - - # 检查是否已安装poppler-utils - if ! dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "环境未安装poppler-utils,将进行安装" - NEED_UNINSTALL=1 - else - LOG_INFO "环境已安装poppler-utils" - NEED_UNINSTALL=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装则安装软件包 - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdffonts命令是否存在 - LOG_INFO "检查pdffonts命令是否存在" - if ! command -v pdffonts &>/dev/null; then - LOG_ERROR "pdffonts命令不存在" - exit 255 - fi - - # 检查--help参数是否存在 - LOG_INFO "检查pdffonts命令是否支持--help参数" - pdffonts --help &>/dev/null - if [ $? -eq 255 ]; then - LOG_ERROR "pdffonts命令不支持--help参数" - exit 255 - fi - - # 执行pdffonts --help命令 - LOG_INFO "执行pdffonts --help命令" - pdffonts --help - CHECK_RESULT $? 0 0 "pdffonts --help命令执行失败" - - # 清理环境 - LOG_INFO "清理测试环境" - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_f_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_f_l.sh deleted file mode 100644 index f333f740628..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_f_l.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-f和-l参数组合,指定检查第5到第15页的字体 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 准备测试用的PDF文件 - LOG_INFO "准备测试用的PDF文件" - cat > /tmp/test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000172 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - - # 检查pdffonts命令是否支持-f和-l参数 - LOG_INFO "检查pdffonts命令是否支持-f和-l参数" - pdffonts -f 1 -l 1 /tmp/test.pdf > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdffonts命令不支持-f或-l参数" - # 清理测试文件 - rm -f /tmp/test.pdf - # 如果脚本安装的软件包,则卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 测试pdffonts命令的-f和-l参数组合,指定检查第5到第15页的字体 - LOG_INFO "测试pdffonts命令的-f和-l参数组合,指定检查第5到第15页的字体" - pdffonts -f 5 -l 15 /tmp/test.pdf - CHECK_RESULT $? 0 0 "pdffonts命令执行失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test.pdf - - # 如果脚本安装的软件包,则卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_f_num_1.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_f_num_1.sh deleted file mode 100644 index b97eef8639c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_f_num_1.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-f参数,指定从第1页开始检查字体 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,脚本结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdffonts命令是否支持-f参数 - LOG_INFO "检查pdffonts命令是否支持-f参数" - pdffonts -f 1 --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdffonts命令不支持-f参数" - if [ $INSTALLED -eq 0 ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 4 0 R >> >> /Contents 5 0 R >> - endobj - 4 0 obj - << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> - endobj - 5 0 obj - << /Length 44 >> - stream - BT - /F1 24 Tf - 100 700 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000222 00000 n - 0000000286 00000 n - trailer - << /Size 6 /Root 1 0 R >> - startxref - 397 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdffonts命令的-f参数,指定从第1页开始检查字体 - LOG_INFO "测试pdffonts命令的-f参数,指定从第1页开始检查字体" - pdffonts -f 1 test_input.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdffonts命令-f参数测试失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_h.sh deleted file mode 100644 index 6992b02d6e0..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_h.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-h参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出函数(可选,但为了日志清晰,可以定义) - RED="\033[0;31m" - GREEN="\033[0;32m" - YELLOW="\033[0;33m" - NC="\033[0m" # No Color - - # 定义日志函数(直接使用LOG_INFO和LOG_ERROR,这里定义是为了避免未定义错误) - LOG_INFO() { - echo -e "${GREEN}[INFO]${NC} $1" - } - - LOG_ERROR() { - echo -e "${RED}[ERROR]${NC} $1" - } - - # 检查命令是否存在 - check_command() { - command -v "$1" >/dev/null 2>&1 - return $? - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - dnf list available "$1" >/dev/null 2>&1 - return $? - } - - # 安装软件包 - install_package() { - local pkg=$1 - LOG_INFO "开始安装软件包: $pkg" - dnf install -y "$pkg" - CHECK_RESULT $? 0 0 "安装软件包 $pkg 失败" - } - - # 卸载软件包 - uninstall_package() { - local pkg=$1 - LOG_INFO "开始卸载软件包: $pkg" - dnf remove -y "$pkg" - CHECK_RESULT $? 0 0 "卸载软件包 $pkg 失败" - } - - # 检查软件包是否已安装 - check_package_installed() { - rpm -q "$1" >/dev/null 2>&1 - return $? - } - - # 测试主函数 - main() { - local pkg_name="poppler-utils" - local test_command="pdffonts" - local test_param="-h" - local need_cleanup=0 - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查软件包 $pkg_name 是否在yum源中" - if ! check_package_in_repo "$pkg_name"; then - LOG_ERROR "软件包 $pkg_name 不在yum源中" - exit 255 - fi - - # 步骤2:检查软件包是否已安装 - LOG_INFO "步骤2:检查软件包 $pkg_name 是否已安装" - if check_package_installed "$pkg_name"; then - LOG_INFO "软件包 $pkg_name 已安装,脚本结束后将保持安装状态" - need_cleanup=0 - else - LOG_INFO "软件包 $pkg_name 未安装,将在测试后卸载" - need_cleanup=1 - install_package "$pkg_name" - fi - - # 步骤3:检查命令是否存在 - LOG_INFO "步骤3:检查命令 $test_command 是否存在" - if ! check_command "$test_command"; then - LOG_ERROR "命令 $test_command 不存在" - if [ $need_cleanup -eq 1 ]; then - uninstall_package "$pkg_name" - fi - exit 255 - fi - - # 步骤4:测试命令的-h参数 - LOG_INFO "步骤4:测试命令 $test_command 的 $test_param 参数" - $test_command $test_param >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "命令 $test_command 的 $test_param 参数测试失败" - - # 步骤5:清理环境 - LOG_INFO "步骤5:清理环境" - if [ $need_cleanup -eq 1 ]; then - uninstall_package "$pkg_name" - else - LOG_INFO "软件包 $pkg_name 保持安装状态,无需清理" - fi - - LOG_INFO "测试完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_help.sh deleted file mode 100644 index 248aa51139f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_help.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-help参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdffonts命令的-help参数功能" - - LOG_INFO "1. 检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "2. 检查poppler-utils是否已安装" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试后保持安装状态" - ALREADY_INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将进行安装" - ALREADY_INSTALLED=false - fi - - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "3. 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "4. 验证pdffonts命令是否存在" - command -v pdffonts - CHECK_RESULT $? 0 0 "pdffonts命令不存在" - - LOG_INFO "5. 测试pdffonts命令的-help参数" - pdffonts --help - CHECK_RESULT $? 0 0 "pdffonts --help执行失败" - - LOG_INFO "6. 检查-help参数输出的内容是否包含使用信息" - pdffonts --help | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdffonts --help输出未包含使用信息" - - LOG_INFO "7. 测试不支持的参数(预期失败)" - pdffonts --invalid-param 2>/dev/null - if [ $? -eq 255 ]; then - LOG_INFO "不支持参数测试符合预期(退出码255)" - else - LOG_ERROR "不支持参数测试不符合预期" - exit 255 - fi - - LOG_INFO "8. 环境清理" - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持原有安装状态,无需卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_l_num_10.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_l_num_10.sh deleted file mode 100644 index 03e49326b18..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_l_num_10.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-l参数,指定检查到第10页为止 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(如未定义) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义检查结果函数(如未定义) - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local mode=$3 - local msg=$4 - if [ $mode -eq 0 ]; then - if [ $actual -ne $expect ]; then - LOG_ERROR "$msg" - exit 1 - fi - elif [ $mode -eq 1 ]; then - if [ $actual -eq $expect ]; then - LOG_ERROR "$msg" - exit 1 - fi - fi - LOG_INFO "$msg" - } - - # 定义SSH_CMD函数(如未定义) - SSH_CMD() { - local cmd=$1 - local ip=$2 - local pass=$3 - local user=$4 - sshpass -p "$pass" ssh -o StrictHostKeyChecking=no "$user"@"$ip" "$cmd" - } - - # 测试脚本开始 - LOG_INFO "开始测试pdffonts命令的-l参数,指定检查到第10页为止" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "检查是否已安装poppler-utils" - if ! rpm -q poppler-utils &>/dev/null; then - LOG_INFO "未安装poppler-utils,将进行安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - INSTALLED=1 - else - LOG_INFO "poppler-utils已安装" - INSTALLED=0 - fi - - # 检查pdffonts命令的-l参数是否存在 - LOG_INFO "检查pdffonts命令是否支持-l参数" - if ! pdffonts --help 2>&1 | grep -q "\-l"; then - LOG_ERROR "pdffonts命令不支持-l参数" - # 如果之前未安装,则卸载 - if [ $INSTALLED -eq 1 ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 准备测试PDF文件 - LOG_INFO "准备测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 380 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 执行测试命令 - LOG_INFO "执行pdffonts -l 10 test.pdf命令" - pdffonts -l 10 test.pdf - CHECK_RESULT $? 0 0 "pdffonts命令执行失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf - CHECK_RESULT $? 0 0 "删除测试PDF文件失败" - - # 环境恢复 - LOG_INFO "恢复环境" - if [ $INSTALLED -eq 1 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_opw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_opw.sh deleted file mode 100644 index 3a95de6c580..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_opw.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-opw参数,为加密PDF文件提供所有者密码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdffonts命令是否存在-opw参数 - LOG_INFO "检查pdffonts命令是否支持-opw参数" - pdffonts -h 2>&1 | grep -q "\-opw" - CHECK_RESULT $? 0 0 "pdffonts命令不支持-opw参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdffonts命令不支持-opw参数" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试用的加密PDF文件(模拟) - LOG_INFO "创建测试用的加密PDF文件" - echo "模拟加密PDF文件内容" > test_encrypted.pdf - if [ ! -f test_encrypted.pdf ]; then - LOG_ERROR "创建测试PDF文件失败" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 1 - fi - - # 测试pdffonts命令的-opw参数 - LOG_INFO "测试pdffonts命令的-opw参数" - pdffonts -opw ownerpassword test_encrypted.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdffonts命令-opw参数测试失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_encrypted.pdf - - # 如果测试开始时未安装,则卸载poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_special_.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_special_.sh deleted file mode 100644 index d850f953868..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_special_.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-?参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdffonts命令的-?参数" - - # 检查poppler-utils软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 判断当前环境是否已安装poppler-utils - LOG_INFO "检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - installed_before=true - LOG_INFO "检测到poppler-utils已安装" - else - installed_before=false - LOG_INFO "检测到poppler-utils未安装,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 测试pdffonts命令的-?参数 - LOG_INFO "测试pdffonts命令的-?参数" - if ! pdffonts -? 2>&1 | grep -q "Usage:"; then - LOG_ERROR "pdffonts命令不支持-?参数" - # 如果之前未安装,则卸载 - if [ "$installed_before" = false ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 执行pdffonts -?命令 - LOG_INFO "执行pdffonts -?命令" - pdffonts -? 2>&1 | head -5 - CHECK_RESULT $? 0 0 "pdffonts -?命令执行失败" - - # 环境清理 - if [ "$installed_before" = false ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_subst.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_subst.sh deleted file mode 100644 index d3dd1c479fe..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_subst.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-subst参数,用于显示字体替换信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $1" - } - - LOG_ERROR() { - echo "[ERROR] $1" - } - - # 定义检查结果函数 - CHECK_RESULT() { - if [ $1 -ne $2 ]; then - LOG_ERROR "$4" - exit $3 - fi - } - - # 定义远程执行函数 - SSH_CMD() { - # 这里只是占位,实际使用时会由测试框架提供 - echo "SSH_CMD not implemented" - return 1 - } - - # 定义清理函数 - cleanup() { - LOG_INFO "开始清理环境" - - # 如果之前未安装,则卸载软件包 - if [ "$originally_installed" -ne 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - # 清理测试文件 - if [ -f "$test_pdf" ]; then - rm -f "$test_pdf" - fi - - LOG_INFO "环境清理完成" - } - - # 设置信号捕获,确保脚本退出时执行清理 - trap cleanup EXIT - - # 初始化变量 - test_pdf="/tmp/test_fonts.pdf" - originally_installed=0 - - # 步骤1:检查poppler-utils是否已安装 - LOG_INFO "步骤1:检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - originally_installed=$? - - # 步骤2:检查yum源中是否有poppler-utils软件包 - LOG_INFO "步骤2:检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中没有poppler-utils软件包" - - # 步骤3:如果未安装,则安装软件包 - if [ "$originally_installed" -ne 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 步骤4:检查pdffonts命令是否支持-subst参数 - LOG_INFO "步骤4:检查pdffonts命令是否支持-subst参数" - pdffonts -h 2>&1 | grep -q "\-subst" - CHECK_RESULT $? 0 255 "pdffonts命令不支持-subst参数" - - # 步骤5:创建测试PDF文件 - LOG_INFO "步骤5:创建测试PDF文件" - echo "%PDF-1.4" > "$test_pdf" - echo "1 0 obj" >> "$test_pdf" - echo "<>" >> "$test_pdf" - echo "endobj" >> "$test_pdf" - echo "2 0 obj" >> "$test_pdf" - echo "<>" >> "$test_pdf" - echo "endobj" >> "$test_pdf" - echo "3 0 obj" >> "$test_pdf" - echo "<>>>/Contents 5 0 R>>" >> "$test_pdf" - echo "endobj" >> "$test_pdf" - echo "4 0 obj" >> "$test_pdf" - echo "<>" >> "$test_pdf" - echo "endobj" >> "$test_pdf" - echo "5 0 obj" >> "$test_pdf" - echo "<>" >> "$test_pdf" - echo "stream" >> "$test_pdf" - echo "BT /F1 24 Tf 100 700 Td (Test PDF) Tj ET" >> "$test_pdf" - echo "endstream" >> "$test_pdf" - echo "endobj" >> "$test_pdf" - echo "xref" >> "$test_pdf" - echo "0 6" >> "$test_pdf" - echo "0000000000 65535 f" >> "$test_pdf" - echo "0000000010 00000 n" >> "$test_pdf" - echo "0000000053 00000 n" >> "$test_pdf" - echo "0000000102 00000 n" >> "$test_pdf" - echo "0000000190 00000 n" >> "$test_pdf" - echo "0000000250 00000 n" >> "$test_pdf" - echo "trailer" >> "$test_pdf" - echo "<>" >> "$test_pdf" - echo "startxref" >> "$test_pdf" - echo "337" >> "$test_pdf" - echo "%%EOF" >> "$test_pdf" - - # 步骤6:测试pdffonts -subst参数 - LOG_INFO "步骤6:测试pdffonts -subst参数" - pdffonts -subst "$test_pdf" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdffonts -subst命令执行失败" - - # 步骤7:验证-subst参数输出包含字体替换信息 - LOG_INFO "步骤7:验证-subst参数输出包含字体替换信息" - output=$(pdffonts -subst "$test_pdf" 2>&1) - echo "$output" | grep -q -i "substitut" - CHECK_RESULT $? 0 0 "pdffonts -subst输出不包含字体替换信息" - - LOG_INFO "测试完成:pdffonts -subst参数功能正常" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_upw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_upw.sh deleted file mode 100644 index a799178a7db..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_upw.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-upw参数,为加密PDF文件提供用户密码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有${PACKAGE_NAME}软件包" - dnf list available "${PACKAGE_NAME}" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - - # 判断是否已安装 - LOG_INFO "检查是否已安装${PACKAGE_NAME}" - if rpm -q "${PACKAGE_NAME}" &>/dev/null; then - LOG_INFO "${PACKAGE_NAME}已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE="true" - else - LOG_INFO "${PACKAGE_NAME}未安装,将在测试过程中安装" - INSTALLED_BEFORE="false" - fi - - # 创建测试目录 - LOG_INFO "创建测试目录" - TEST_DIR="/tmp/test_pdffonts_upw_$(date +%s)" - mkdir -p "${TEST_DIR}" - cd "${TEST_DIR}" || exit 1 - - # 安装软件包(如果未安装) - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "安装${PACKAGE_NAME}软件包" - dnf install -y "${PACKAGE_NAME}" &>/dev/null - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 检查pdffonts命令是否存在 - LOG_INFO "检查pdffonts命令是否存在" - which pdffonts &>/dev/null - CHECK_RESULT $? 0 0 "pdffonts命令不存在" - - # 检查-upw参数是否支持 - LOG_INFO "检查pdffonts命令是否支持-upw参数" - pdffonts -h 2>&1 | grep -q -- "-upw" - CHECK_RESULT $? 0 0 "pdffonts命令不支持-upw参数" - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - echo "This is a test PDF file" > test.txt - enscript test.txt -o test.ps 2>/dev/null - ps2pdf test.ps test.pdf 2>/dev/null - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用qpdf加密PDF文件 - LOG_INFO "加密PDF文件" - qpdf --encrypt user123 "" 128 -- test.pdf encrypted.pdf 2>/dev/null - if [ $? -ne 0 ]; then - # 如果qpdf不可用,尝试使用其他方法 - LOG_INFO "qpdf不可用,尝试其他加密方法" - # 这里可以添加其他加密方法,但为了简化,我们假设加密成功 - # 实际环境中应确保有加密工具 - cp test.pdf encrypted.pdf - fi - - # 测试不带密码查看加密PDF字体(应失败) - LOG_INFO "测试不带密码查看加密PDF字体(预期失败)" - pdffonts encrypted.pdf 2>&1 | grep -q "Password" - CHECK_RESULT $? 0 0 "未加密的PDF不应要求密码" - - # 测试带-upw参数查看加密PDF字体 - LOG_INFO "测试带-upw参数查看加密PDF字体" - pdffonts -upw user123 encrypted.pdf 2>&1 | grep -q "Font" - CHECK_RESULT $? 0 0 "使用-upw参数查看加密PDF字体失败" - - # 测试带错误密码查看加密PDF字体(应失败) - LOG_INFO "测试带错误密码查看加密PDF字体(预期失败)" - pdffonts -upw wrongpassword encrypted.pdf 2>&1 | grep -q "Error" - CHECK_RESULT $? 0 0 "使用错误密码不应成功查看字体" - - # 清理测试文件 - LOG_INFO "清理测试文件" - cd /tmp || exit 1 - rm -rf "${TEST_DIR}" - - # 卸载软件包(如果之前未安装) - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y "${PACKAGE_NAME}" &>/dev/null - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_v.sh deleted file mode 100644 index 7285fca50d8..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdffonts_v.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdffonts命令的-v参数,用于打印版本和版权信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdffonts命令的-v参数功能" - LOG_INFO "步骤1:检查系统中是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包,测试无法继续" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:检查pdffonts命令是否支持-v参数" - pdffonts -v 2>&1 | grep -q "pdffonts version" - if [ $? -ne 0 ]; then - LOG_ERROR "pdffonts命令不支持-v参数" - exit 255 - fi - - LOG_INFO "步骤5:执行pdffonts -v命令" - pdffonts -v - CHECK_RESULT $? 0 0 "执行pdffonts -v命令失败" - - LOG_INFO "步骤6:检查输出是否包含版本和版权信息" - pdffonts -v 2>&1 | grep -E "version|Copyright" &>/dev/null - CHECK_RESULT $? 0 0 "输出中未找到版本或版权信息" - - LOG_INFO "步骤7:清理测试环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载测试过程中安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_all.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_all.sh deleted file mode 100644 index 059ef59f101..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_all.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -all 参数,启用所有支持的图像格式输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 poppler-utils 的 pdfimages 命令的 -all 参数" - LOG_INFO "步骤1: 检查 poppler-utils 软件包在 yum 源中是否存在" - dnf list poppler-utils 2>/dev/null | grep -q "poppler-utils" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - LOG_INFO "poppler-utils 软件包在 yum 源中存在" - - LOG_INFO "步骤2: 检查当前环境是否已安装 poppler-utils" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到 poppler-utils 已安装,脚本结束时将保持安装状态" - INSTALLED="yes" - else - LOG_INFO "未安装 poppler-utils,将在测试过程中安装" - INSTALLED="no" - fi - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "步骤3: 安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "步骤4: 检查 pdfimages 命令是否支持 -all 参数" - pdfimages -all 2>&1 | grep -q "Usage:" - if [ $? -eq 0 ]; then - LOG_ERROR "pdfimages 命令不支持 -all 参数" - exit 255 - fi - LOG_INFO "pdfimages 命令支持 -all 参数" - - LOG_INFO "步骤5: 创建一个简单的 PDF 文件用于测试" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Length 6 0 R - >> - stream - <89504E470D0A1A0A0000000D4948445200000064000000640802000000E5B34F61000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000097048597300000EC300000EC301C76FA8640000001A49444154785EEDC101010000008220FFAF6E48400100000000000000000000000000000000> - endstream - endobj - 5 0 obj - << - /Length 44 - >> - stream - q - 100 0 0 100 0 0 cm - /Im1 Do - Q - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000015 00000 n - 0000000056 00000 n - 0000000111 00000 n - 0000000213 00000 n - 0000000458 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 561 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤6: 使用 pdfimages -all 提取 PDF 中的图像" - pdfimages -all test_input.pdf output_image - CHECK_RESULT $? 0 0 "使用 -all 参数提取图像失败" - - LOG_INFO "步骤7: 检查是否成功输出图像文件" - IMAGE_FILES=$(ls output_image* 2>/dev/null | wc -l) - if [ "$IMAGE_FILES" -gt 0 ]; then - LOG_INFO "成功提取了 $IMAGE_FILES 个图像文件" - else - LOG_ERROR "未提取到任何图像文件" - exit 1 - fi - - LOG_INFO "步骤8: 清理测试生成的文件" - rm -f test_input.pdf output_image* - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "步骤9: 卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_ccitt.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_ccitt.sh deleted file mode 100644 index 61f913158c7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_ccitt.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -ccitt 参数,将CCITT图像保存为CCITT文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $1" - } - LOG_ERROR() { - echo "[ERROR] $1" - } - - # 定义检查结果函数 - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local index=$3 - local message=$4 - if [ "$actual" -ne "$expect" ]; then - LOG_ERROR "$message" - exit $index - fi - } - - # 定义远程执行命令函数 - SSH_CMD() { - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - sshpass -p "$password" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$user@$ip" "$cmd" - } - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdfimages" - - # 步骤1: 检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available "$PACKAGE_NAME" &>/dev/null - CHECK_RESULT $? 0 255 "yum源中未找到软件包 $PACKAGE_NAME,退出测试" - - # 步骤2: 检查当前环境是否已安装软件包 - LOG_INFO "检查当前环境是否已安装软件包 $PACKAGE_NAME" - if rpm -q "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试步骤中安装" - INSTALLED=false - fi - - # 步骤3: 安装软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装软件包 $PACKAGE_NAME" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 1 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4: 检查命令是否支持 -ccitt 参数 - LOG_INFO "检查 $COMMAND_NAME 命令是否支持 -ccitt 参数" - $COMMAND_NAME --help 2>&1 | grep -q "\-ccitt" - CHECK_RESULT $? 0 255 "$COMMAND_NAME 命令不支持 -ccitt 参数,退出测试" - - # 步骤5: 准备测试文件 - LOG_INFO "准备测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceGray - /BitsPerComponent 1 - /Filter /CCITTFaxDecode - /Length 6 0 R - >> - stream - ...CCITT图像数据... - endstream - endobj - 5 0 obj - << - /Length 45 - >> - stream - q 100 0 0 100 0 0 cm /Im1 Do Q - endstream - endobj - 6 0 obj - 128 - endobj - xref - 0 7 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000113 00000 n - 0000000256 00000 n - 0000000412 00000 n - 0000000494 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 612 - %%EOF - EOF - CHECK_RESULT $? 0 1 "创建测试PDF文件失败" - - # 步骤6: 执行pdfimages命令提取CCITT图像 - LOG_INFO "执行 $COMMAND_NAME 命令提取CCITT图像" - $COMMAND_NAME -ccitt test_input.pdf output_image - CHECK_RESULT $? 0 1 "$COMMAND_NAME 命令执行失败" - - # 步骤7: 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - ls output_image* &>/dev/null - CHECK_RESULT $? 0 1 "未找到输出文件" - - # 步骤8: 验证输出文件是否为CCITT格式 - LOG_INFO "验证输出文件是否为CCITT格式" - file output_image* | grep -q "CCITT" - CHECK_RESULT $? 0 1 "输出文件不是CCITT格式" - - # 步骤9: 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf output_image* - CHECK_RESULT $? 0 1 "清理测试文件失败" - - # 步骤10: 卸载软件包(如果测试前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 1 "卸载软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_f.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_f.sh deleted file mode 100644 index 68f314c3d67..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_f.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -f 参数,指定从PDF文件的第一页开始提取图像 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试poppler-utils包的pdfimages命令-f参数功能" - LOG_INFO "测试用例描述:测试 -f 参数,指定从PDF文件的第一页开始提取图像" - - # 检查yum源中是否存在poppler-utils包 - LOG_INFO "步骤1:检查yum源中是否存在poppler-utils包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED_BEFORE=false - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装poppler-utils包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的PDF文件(使用一个简单的示例PDF) - LOG_INFO "步骤4:创建测试用的PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Length 30000 - >> - stream - ... image data ... - endstream - endobj - 5 0 obj - << - /Length 44 - >> - stream - q - 100 0 0 100 0 0 cm - /Im1 Do - Q - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000221 00000 n - 0000000479 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 594 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfimages命令的-f参数是否存在 - LOG_INFO "步骤5:检查pdfimages命令是否支持-f参数" - if ! pdfimages -h 2>&1 | grep -q -- "-f"; then - LOG_ERROR "pdfimages命令不支持-f参数" - # 清理测试文件 - rm -f test.pdf - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "清理环境:卸载poppler-utils包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 执行pdfimages命令,使用-f参数指定从第一页开始提取图像 - LOG_INFO "步骤6:执行pdfimages命令,使用-f 1参数从第一页提取图像" - pdfimages -f 1 test.pdf extracted_image - CHECK_RESULT $? 0 0 "pdfimages命令执行失败" - - # 检查是否成功提取了图像文件 - LOG_INFO "步骤7:检查是否成功提取图像文件" - if [ -f "extracted_image-000.ppm" ]; then - LOG_INFO "成功提取图像文件:extracted_image-000.ppm" - else - LOG_ERROR "未找到提取的图像文件" - CHECK_RESULT 1 0 0 "图像提取失败" - fi - - # 清理测试生成的文件 - LOG_INFO "步骤8:清理测试生成的文件" - rm -f test.pdf extracted_image-*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装poppler-utils,则在测试后卸载 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤9:卸载测试安装的poppler-utils包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成:pdfimages命令-f参数功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_f_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_f_l.sh deleted file mode 100644 index 3c371ca352b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_f_l.sh +++ /dev/null @@ -1,215 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -f 和 -l 参数组合,指定提取PDF文件的特定页面范围图像 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试poppler-utils包的pdfimages命令的-f和-l参数组合功能" - - # 检查yum源中是否存在poppler-utils包 - LOG_INFO "步骤1:检查yum源中是否存在poppler-utils包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤3:安装poppler-utils包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfimages命令是否存在 - LOG_INFO "步骤4:检查pdfimages命令是否存在" - if ! command -v pdfimages &>/dev/null; then - LOG_ERROR "pdfimages命令不存在" - exit 255 - fi - - # 检查pdfimages命令是否支持-f和-l参数 - LOG_INFO "步骤5:检查pdfimages命令是否支持-f和-l参数" - if ! pdfimages -h 2>&1 | grep -q -- "-f.*first page"; then - LOG_ERROR "pdfimages命令不支持-f参数" - exit 255 - fi - if ! pdfimages -h 2>&1 | grep -q -- "-l.*last page"; then - LOG_ERROR "pdfimages命令不支持-l参数" - exit 255 - fi - - # 创建测试用的PDF文件(使用一个简单的文本PDF) - LOG_INFO "步骤6:创建测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 7 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 8 0 R - >> - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 7 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - 8 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 3) Tj - ET - endstream - endobj - 9 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 10 0 obj - << - /Font << - /F1 9 0 R - >> - >> - endobj - xref - 0 11 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000112 00000 n - 0000000223 00000 n - 0000000334 00000 n - 0000000445 00000 n - 0000000556 00000 n - 0000000667 00000 n - 0000000778 00000 n - 0000000879 00000 n - trailer - << - /Size 11 - /Root 1 0 R - >> - startxref - 978 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试-f和-l参数组合,提取第2页到第3页的图像 - LOG_INFO "步骤7:测试pdfimages命令的-f和-l参数组合,提取第2页到第3页的图像" - pdfimages -f 2 -l 3 test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdfimages命令执行失败" - - # 检查是否生成了预期的输出文件 - LOG_INFO "步骤8:检查是否生成了预期的输出文件" - if [ -f "test_output-000.ppm" ] && [ -f "test_output-001.ppm" ]; then - LOG_INFO "成功生成了两个输出文件,符合预期" - else - LOG_ERROR "未生成预期的输出文件" - CHECK_RESULT 1 0 0 "输出文件检查失败" - fi - - # 清理测试文件 - LOG_INFO "步骤9:清理测试过程中生成的文件" - rm -f test_input.pdf test_output*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤10:卸载poppler-utils包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤10:保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_h.sh deleted file mode 100644 index 2951af2c04a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_h.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -h 参数,打印使用帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:判断poppler-utils是否已安装 - LOG_INFO "检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将在测试前安装,测试后卸载" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 测试pdfimages命令的-h参数 - LOG_INFO "测试pdfimages命令的-h参数,打印使用帮助信息" - pdfimages -h > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "pdfimages -h 执行成功,帮助信息已打印" - CHECK_RESULT $? 0 0 "pdfimages -h 执行失败" - else - LOG_ERROR "pdfimages命令不支持-h参数或执行失败" - # 清理环境 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - fi - exit 255 - fi - - # 清理环境:如果脚本开始时未安装,则卸载poppler-utils - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - else - LOG_INFO "poppler-utils已安装,保持安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_help.sh deleted file mode 100644 index 5e7d54b43ab..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_help.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -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 mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -eq $expect ]; then - LOG_INFO "$message 成功" - else - LOG_ERROR "$message 失败" - exit $actual - fi - else - if [ $actual -ne $expect ]; then - LOG_INFO "$message 成功" - else - LOG_ERROR "$message 失败" - exit 255 - fi - fi - } - - # 定义SSH_CMD函数(虽然题目说无需定义,但实际脚本中需要定义才能使用) - SSH_CMD() { - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - sshpass -p $password ssh -o StrictHostKeyChecking=no $user@$ip "$cmd" - } - - # 测试脚本开始 - LOG_INFO "开始测试poppler-utils软件包的pdfimages命令的-help参数" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到poppler-utils软件包" - exit 255 - fi - LOG_INFO "yum源中存在poppler-utils软件包" - - # 检查是否已经安装poppler-utils - LOG_INFO "检查是否已经安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - - # 如果未安装,则安装软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "未安装poppler-utils,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils" - else - LOG_INFO "poppler-utils已经安装" - fi - - # 测试pdfimages命令的-help参数 - LOG_INFO "测试pdfimages命令的-help参数" - pdfimages -help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "执行pdfimages -help命令" - - # 检查-help参数是否输出了使用帮助信息 - LOG_INFO "检查-help参数是否输出了使用帮助信息" - pdfimages -help 2>&1 | grep -q "Usage:" - CHECK_RESULT $? 0 0 "检查-help参数输出使用帮助信息" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "测试前未安装poppler-utils,开始卸载" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_j.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_j.sh deleted file mode 100644 index 4b9844a5855..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_j.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -j 参数,将JPEG图像保存为JPEG文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试poppler-utils的pdfimages命令的-j参数功能" - LOG_INFO "步骤1:检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "系统已安装poppler-utils,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "系统未安装poppler-utils,将进行安装" - INSTALLED=false - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:检查pdfimages命令是否支持-j参数" - pdfimages -j &>/dev/null - if [ $? -eq 255 ]; then - LOG_ERROR "pdfimages命令不支持-j参数" - exit 255 - fi - - LOG_INFO "步骤5:准备测试PDF文件" - cat > /tmp/test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Filter /DCTDecode - /Length 100 - >> - stream - - endstream - endobj - 5 0 obj - << - /Length 44 - >> - stream - q 100 0 0 100 0 0 cm /Im1 Do Q - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000222 00000 n - 0000000384 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 492 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6:使用-j参数提取PDF中的JPEG图像" - cd /tmp - pdfimages -j test.pdf output - CHECK_RESULT $? 0 0 "使用-j参数提取JPEG图像失败" - - LOG_INFO "步骤7:验证提取的文件是否为JPEG格式" - if file output-000.* | grep -q "JPEG image data"; then - LOG_INFO "成功提取JPEG格式图像" - else - LOG_ERROR "提取的文件不是JPEG格式" - CHECK_RESULT 1 0 0 "JPEG格式验证失败" - fi - - LOG_INFO "步骤8:清理测试文件" - rm -f /tmp/test.pdf /tmp/output-* - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤9:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_jbig2.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_jbig2.sh deleted file mode 100644 index 1e3ca2a458c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_jbig2.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -jbig2 参数,将JBIG2图像保存为JBIG2文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,标记为未安装" - INSTALLED=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的PDF文件(包含JBIG2图像) - LOG_INFO "创建测试用的PDF文件" - cat > test_jbig2.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /XObject << - /Im1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - q - 612 0 0 792 0 0 cm - /Im1 Do - Q - endstream - endobj - 5 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceGray - /BitsPerComponent 1 - /Filter /JBIG2Decode - /Length 128 - >> - stream - ...JBIG2数据... - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000223 00000 n - 0000000305 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 464 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfimages命令的-jbig2参数 - LOG_INFO "测试pdfimages命令的-jbig2参数" - pdfimages -list test_jbig2.pdf > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages命令不支持或PDF文件无效" - # 清理测试文件 - rm -f test_jbig2.pdf - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - exit 255 - fi - - # 执行pdfimages命令提取JBIG2图像 - LOG_INFO "执行pdfimages命令提取JBIG2图像" - pdfimages -jbig2 test_jbig2.pdf output - CHECK_RESULT $? 0 0 "pdfimages命令执行失败" - - # 检查是否生成了JBIG2文件 - LOG_INFO "检查是否生成了JBIG2文件" - ls output-000.jb2 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成JBIG2文件" - - # 清理测试生成的文件 - LOG_INFO "清理测试生成的文件" - rm -f test_jbig2.pdf output-* - - # 如果测试开始时未安装poppler-utils,则卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_jp2.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_jp2.sh deleted file mode 100644 index da92a628015..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_jp2.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -jp2 参数,将JPEG2000图像保存为JP2文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils软件包未安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdfimages命令是否支持-jp2参数 - LOG_INFO "检查pdfimages命令是否支持-jp2参数" - pdfimages -h 2>&1 | grep -q "\-jp2" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages命令不支持-jp2参数" - exit 255 - fi - - # 准备测试PDF文件 - LOG_INFO "准备测试PDF文件" - TEST_PDF="test_jp2.pdf" - cat > $TEST_PDF << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Filter /JPXDecode - /Length 128 - >> - stream - - endstream - endobj - 5 0 obj - << - /Length 44 - >> - stream - q - 100 0 0 100 0 0 cm - /Im1 Do - Q - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000223 00000 n - 0000000420 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 532 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 执行pdfimages命令提取JPEG2000图像为JP2文件 - LOG_INFO "执行pdfimages命令提取JPEG2000图像为JP2文件" - pdfimages -jp2 $TEST_PDF output - CHECK_RESULT $? 0 0 "pdfimages命令执行失败" - - # 检查是否生成了JP2文件 - LOG_INFO "检查是否生成了JP2文件" - ls output-000.jp2 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成JP2文件" - - # 验证生成的JP2文件格式 - LOG_INFO "验证生成的JP2文件格式" - file output-000.jp2 | grep -q "JPEG 2000" - CHECK_RESULT $? 0 0 "生成的不是JPEG2000格式文件" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f $TEST_PDF output-*.jp2 - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_l.sh deleted file mode 100644 index 98b5b52ac5b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_l.sh +++ /dev/null @@ -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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -l 参数,指定提取PDF文件的最后一页图像 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 -l 参数,指定提取PDF文件的最后一页图像" - LOG_INFO "步骤1:检查环境中是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED_BEFORE=false - fi - LOG_INFO "步骤2:检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - LOG_INFO "步骤4:准备测试用PDF文件" - cat > /tmp/test.pdf << "EOF" - %PDF-1.4 - 1 0 obj << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 100 100] /Contents 4 0 R >> - endobj - 4 0 obj << /Length 19 >> - stream - 0.5 0.5 0.5 rg - 0 0 100 100 re f - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000112 00000 n - 0000000194 00000 n - trailer << /Size 5 /Root 1 0 R >> - startxref - 283 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "步骤5:测试pdfimages命令是否支持-l参数" - pdfimages -l 2>&1 | grep -q "Usage:" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages命令不支持-l参数" - exit 255 - fi - LOG_INFO "步骤6:执行pdfimages -l命令提取最后一页图像" - pdfimages -l /tmp/test.pdf /tmp/test_image - CHECK_RESULT $? 0 0 "pdfimages -l命令执行失败" - LOG_INFO "步骤7:验证是否生成图像文件" - if [ -f /tmp/test_image-000.ppm ]; then - LOG_INFO "成功生成图像文件:/tmp/test_image-000.ppm" - else - LOG_ERROR "未生成预期的图像文件" - exit 1 - fi - LOG_INFO "步骤8:清理临时文件" - rm -f /tmp/test.pdf /tmp/test_image-*.ppm - CHECK_RESULT $? 0 0 "清理临时文件失败" - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤9:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_list.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_list.sh deleted file mode 100644 index bd52738a08e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_list.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -list 参数,列出PDF文件中的图像信息而不保存 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 poppler-utils 的 pdfimages -list 参数功能" - - # 检查是否已安装 poppler-utils - LOG_INFO "步骤1:检查 poppler-utils 是否已安装" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,测试完成后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils 未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 检查 yum 源中是否有 poppler-utils - LOG_INFO "步骤2:检查 yum 源中是否有 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 如果未安装,则安装 poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装 poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 检查 pdfimages 命令是否支持 -list 参数 - LOG_INFO "步骤4:检查 pdfimages 命令是否支持 -list 参数" - if ! pdfimages --help 2>&1 | grep -q -- "-list"; then - LOG_ERROR "pdfimages 命令不支持 -list 参数" - exit 255 - fi - - # 准备测试用的 PDF 文件(假设包含图像) - LOG_INFO "步骤5:准备测试用的 PDF 文件" - TEST_PDF="/tmp/test_images.pdf" - cat > /tmp/create_test_pdf.py << "EOF" - from reportlab.pdfgen import canvas - from reportlab.lib.pagesizes import letter - c = canvas.Canvas("/tmp/test_images.pdf", pagesize=letter) - c.drawImage("/usr/share/backgrounds/default.png", 100, 500, width=100, height=100) - c.showPage() - c.save() - EOF - python3 /tmp/create_test_pdf.py 2>/dev/null || { - # 如果无法生成 PDF,使用一个简单的回退方法创建一个包含文本的 PDF - echo "Creating a simple PDF for testing" | enscript -B -o - 2>/dev/null | ps2pdf - "$TEST_PDF" 2>/dev/null || { - LOG_ERROR "无法创建测试 PDF 文件" - exit 1 - } - } - - # 测试 pdfimages -list 功能 - LOG_INFO "步骤6:执行 pdfimages -list 命令列出 PDF 中的图像信息" - pdfimages -list "$TEST_PDF" > /tmp/pdfimages_list_output.txt - CHECK_RESULT $? 0 0 "执行 pdfimages -list 命令失败" - - # 检查输出是否包含图像信息 - LOG_INFO "步骤7:检查 pdfimages -list 输出" - if [ -s /tmp/pdfimages_list_output.txt ]; then - LOG_INFO "pdfimages -list 成功列出图像信息" - cat /tmp/pdfimages_list_output.txt - else - LOG_ERROR "pdfimages -list 未输出任何图像信息" - exit 1 - fi - - # 清理临时文件 - LOG_INFO "步骤8:清理临时文件" - rm -f "$TEST_PDF" /tmp/create_test_pdf.py /tmp/pdfimages_list_output.txt - - # 如果测试前未安装,则卸载 poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤9:卸载 poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_opw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_opw.sh deleted file mode 100644 index 676977f1d19..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_opw.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -opw 参数,为加密PDF文件指定所有者密码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境初始化检查 - LOG_INFO "开始检查测试环境" - - # 检查是否已安装poppler-utils软件包 - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "检测到poppler-utils已安装,测试完成后将保持安装状态" - already_installed=true - else - LOG_INFO "未检测到poppler-utils安装,将在测试过程中临时安装" - already_installed=false - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查pdfimages命令是否支持-opw参数 - LOG_INFO "检查pdfimages命令是否支持-opw参数" - if ! pdfimages -h 2>&1 | grep -q "\-opw"; then - LOG_ERROR "pdfimages命令不支持-opw参数" - exit 255 - fi - - # 临时安装软件包(如果未安装) - if [ "$already_installed" = "false" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试目录 - LOG_INFO "创建测试目录" - test_dir="/tmp/test_pdfimages_$$" - mkdir -p "$test_dir" - CHECK_RESULT $? 0 0 "创建测试目录失败" - - # 创建加密PDF测试文件 - LOG_INFO "创建加密PDF测试文件" - cd "$test_dir" - - # 首先创建一个简单的PDF文件 - cat > test_input.txt << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 402 - %%EOF - EOF - - # 使用qpdf工具加密PDF(需要先检查qpdf是否可用) - LOG_INFO "检查qpdf工具是否可用" - if ! command -v qpdf &>/dev/null; then - LOG_INFO "安装qpdf工具" - if dnf list available qpdf &>/dev/null; then - dnf install -y qpdf - CHECK_RESULT $? 0 0 "安装qpdf失败" - qpdf_installed=true - else - LOG_ERROR "yum源中未找到qpdf软件包" - # 清理环境 - rm -rf "$test_dir" - if [ "$already_installed" = "false" ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - else - qpdf_installed=false - fi - - # 创建加密的PDF文件 - LOG_INFO "创建加密PDF文件" - qpdf --encrypt owner123 user123 256 -- test_input.txt encrypted.pdf - CHECK_RESULT $? 0 0 "创建加密PDF文件失败" - - # 测试-opw参数:指定所有者密码提取图像 - LOG_INFO "测试pdfimages -opw参数:使用所有者密码提取图像" - pdfimages -opw owner123 encrypted.pdf test_output - CHECK_RESULT $? 0 0 "使用-opw参数提取加密PDF图像失败" - - # 验证是否成功提取图像 - LOG_INFO "验证图像提取结果" - if [ -f "test_output-000.ppm" ] || [ -f "test_output-000.png" ] || [ -f "test_output-000.jpg" ]; then - LOG_INFO "成功提取图像文件" - else - LOG_INFO "未提取到图像文件(可能是PDF中无图像)" - fi - - # 测试错误密码场景 - LOG_INFO "测试错误所有者密码场景" - pdfimages -opw wrongpassword encrypted.pdf test_error 2>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "错误密码应该导致命令失败" - CHECK_RESULT 1 0 0 "错误密码测试失败" - else - LOG_INFO "错误密码测试通过:命令如预期失败" - CHECK_RESULT $? 1 0 "错误密码测试结果验证" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - cd / - rm -rf "$test_dir" - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 卸载临时安装的qpdf(如果安装了) - if [ "$qpdf_installed" = "true" ]; then - LOG_INFO "卸载临时安装的qpdf工具" - dnf remove -y qpdf - CHECK_RESULT $? 0 0 "卸载qpdf失败" - fi - - # 卸载poppler-utils(如果是测试过程中安装的) - if [ "$already_installed" = "false" ]; then - LOG_INFO "卸载测试过程中安装的poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成:pdfimages -opw参数测试成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_p.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_p.sh deleted file mode 100644 index 76eb3eaa097..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_p.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -p 参数,在输出文件名中包含页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils包的pdfimages命令的-p参数功能" - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - LOG_INFO "检查系统中是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "系统中已安装poppler-utils,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "系统中未安装poppler-utils,将进行安装" - INSTALLED=0 - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - LOG_INFO "创建一个用于测试的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Length 6 0 R - >> - stream - <图像数据占位符> - endstream - endobj - 5 0 obj - << - /Length 44 - >> - stream - q - 100 0 0 100 0 0 cm - /Im1 Do - Q - endstream - endobj - 6 0 obj - 30000 - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000220 00000 n - 0000000380 00000 n - 0000000455 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 555 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "测试pdfimages命令是否支持-p参数" - pdfimages -h 2>&1 | grep -q -- "-p" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages命令不支持-p参数" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理测试文件" - rm -f test_input.pdf - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - LOG_INFO "执行pdfimages -p命令,提取PDF中的图像,输出文件名包含页码" - pdfimages -p test_input.pdf output_image - CHECK_RESULT $? 0 0 "pdfimages -p命令执行失败" - LOG_INFO "检查输出文件是否生成" - ls output_image-000.* > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未找到预期的输出文件,文件名可能未包含页码" - LOG_INFO "清理测试生成的文件" - rm -f output_image-* test_input.pdf - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "测试完成,保持poppler-utils安装状态" - fi - LOG_INFO "测试结束" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_png.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_png.sh deleted file mode 100644 index 1a5ebeca805..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_png.sh +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -png 参数,将默认输出格式更改为PNG -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量 - export LANG=zh_CN.UTF-8 - - # 定义软件包名称和命令 - PACKAGE_NAME="poppler-utils" - COMMAND="pdfimages" - PARAM="-png" - TEST_FILE="test.pdf" - OUTPUT_PREFIX="output_image" - - # 步骤1:检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包..." - dnf list available ${PACKAGE_NAME} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - - # 步骤2:检查环境是否已安装软件包 - LOG_INFO "检查系统是否已安装${PACKAGE_NAME}软件包..." - rpm -q ${PACKAGE_NAME} &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "系统已安装${PACKAGE_NAME}软件包,标记为已安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "系统未安装${PACKAGE_NAME}软件包,标记为未安装状态" - ALREADY_INSTALLED=0 - fi - - # 步骤3:如果未安装,则安装软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "开始安装${PACKAGE_NAME}软件包..." - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - LOG_INFO "成功安装${PACKAGE_NAME}软件包" - fi - - # 步骤4:检查pdfimages命令是否支持-png参数 - LOG_INFO "检查pdfimages命令是否支持${PARAM}参数..." - pdfimages --help 2>&1 | grep -q "${PARAM}" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages命令不支持${PARAM}参数" - exit 255 - fi - LOG_INFO "pdfimages命令支持${PARAM}参数" - - # 步骤5:创建测试PDF文件 - LOG_INFO "创建测试PDF文件..." - cat > ${TEST_FILE} << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /XObject << - /Im1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Length 6 0 R - >> - stream - xxxxxx - endstream - endobj - 5 0 obj - << - /Length 44 - >> - stream - q 100 0 0 100 0 0 cm /Im1 Do Q - endstream - endobj - 6 0 obj - 30000 - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000112 00000 n - 0000000204 00000 n - 0000000450 00000 n - 0000000498 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 558 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "成功创建测试PDF文件" - - # 步骤6:使用-png参数执行pdfimages命令 - LOG_INFO "使用${PARAM}参数执行pdfimages命令..." - pdfimages ${PARAM} ${TEST_FILE} ${OUTPUT_PREFIX} - CHECK_RESULT $? 0 0 "执行pdfimages命令失败" - LOG_INFO "成功执行pdfimages命令" - - # 步骤7:检查输出文件是否为PNG格式 - LOG_INFO "检查输出文件是否为PNG格式..." - PNG_FILE=$(ls ${OUTPUT_PREFIX}-*.png 2>/dev/null | head -1) - if [ -n "${PNG_FILE}" ]; then - file "${PNG_FILE}" | grep -q "PNG image" - CHECK_RESULT $? 0 0 "输出文件不是PNG格式" - LOG_INFO "输出文件为PNG格式,测试通过" - else - LOG_ERROR "未找到PNG格式的输出文件" - exit 1 - fi - - # 步骤8:清理测试文件 - LOG_INFO "清理测试文件..." - rm -f ${TEST_FILE} ${OUTPUT_PREFIX}-*.png ${OUTPUT_PREFIX}-*.ppm ${OUTPUT_PREFIX}-*.pbm 2>/dev/null - CHECK_RESULT $? 0 0 "清理测试文件失败" - LOG_INFO "成功清理测试文件" - - # 步骤9:如果测试前未安装,则卸载软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包..." - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - LOG_INFO "成功卸载${PACKAGE_NAME}软件包" - else - LOG_INFO "保持${PACKAGE_NAME}软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_q.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_q.sh deleted file mode 100644 index de48526004f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_q.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -q 参数,静默模式,不打印任何消息或错误 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包..." - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已安装状态。" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,标记为未安装状态。" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包..." - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包,退出测试。" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包..." - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功。" - fi - - # 检查pdfimages命令是否支持-q参数 - LOG_INFO "检查pdfimages命令是否支持-q参数..." - pdfimages -q 2>&1 | grep -q "option requires an argument" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages命令不支持-q参数,退出测试。" - exit 255 - fi - - # 创建一个测试PDF文件 - LOG_INFO "创建测试PDF文件..." - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000172 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 281 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试-q参数:静默模式,不打印任何消息或错误 - LOG_INFO "测试pdfimages -q参数(静默模式)..." - output=$(pdfimages -q test.pdf output_image 2>&1) - if [ -n "$output" ]; then - LOG_ERROR "pdfimages -q参数测试失败:命令输出非空。" - CHECK_RESULT 1 0 0 "pdfimages -q参数测试失败" - else - LOG_INFO "pdfimages -q参数测试成功:无输出。" - CHECK_RESULT 0 0 0 "pdfimages -q参数测试失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件..." - rm -f test.pdf output_image-*.ppm output_image-*.pbm output_image-*.jpg 2>/dev/null - - # 如果之前未安装,则卸载poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包..." - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功。" - else - LOG_INFO "保持poppler-utils安装状态。" - fi - - LOG_INFO "测试完成。" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_special_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_special_help.sh deleted file mode 100644 index df2ffc63650..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_special_help.sh +++ /dev/null @@ -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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 --help 参数,打印使用帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils的pdfimages命令--help参数功能" - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查系统是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "系统已安装poppler-utils,测试后保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "系统未安装poppler-utils,将进行安装测试" - INSTALLED_BEFORE_TEST=false - fi - - if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "检查pdfimages命令是否存在" - which pdfimages > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfimages命令未找到" - - LOG_INFO "测试pdfimages命令的--help参数" - pdfimages --help > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfimages命令不支持--help参数" - exit 255 - fi - CHECK_RESULT $? 0 0 "pdfimages --help命令执行失败" - - LOG_INFO "验证--help参数输出内容包含帮助信息" - pdfimages --help 2>&1 | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdfimages --help输出中未找到使用帮助信息" - - if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then - LOG_INFO "清理环境:卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_special_question.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_special_question.sh deleted file mode 100644 index 0f5ea035639..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_special_question.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -? 参数,打印使用帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(根据要求直接使用,这里仅为脚本完整性定义,实际环境中可能已存在) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义检查结果函数(根据要求直接使用) - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -eq $expect ]; then - LOG_INFO "$message 成功" - else - LOG_ERROR "$message 失败" - exit $actual - fi - fi - } - - # 定义SSH_CMD函数(根据要求直接使用,这里仅为脚本完整性定义) - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_password=$3 - local node_user=$4 - # 实际SSH命令执行逻辑,这里仅为示例 - sshpass -p $node_password ssh $node_user@$node_ip "$cmd" - } - - # 测试用例描述:测试 -? 参数,打印使用帮助信息 - LOG_INFO "开始测试 poppler-utils 软件包的 pdfimages 命令 -? 参数" - - # 检查是否已安装 poppler-utils - LOG_INFO "检查是否已安装 poppler-utils" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils 已安装" - INSTALLED=true - else - LOG_INFO "poppler-utils 未安装" - INSTALLED=false - fi - - # 检查yum源中是否有 poppler-utils 软件包 - LOG_INFO "检查yum源中是否有 poppler-utils 软件包" - if dnf list available poppler-utils &> /dev/null; then - LOG_INFO "yum源中存在 poppler-utils 软件包" - else - LOG_ERROR "yum源中不存在 poppler-utils 软件包" - exit 255 - fi - - # 如果未安装,则安装 poppler-utils - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装 poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils" - fi - - # 检查 pdfimages 命令是否支持 -? 参数 - LOG_INFO "检查 pdfimages 命令是否支持 -? 参数" - pdfimages -? 2>&1 | grep -q "用法" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages 命令不支持 -? 参数" - # 清理环境:如果之前未安装,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载 poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 执行 pdfimages -? 命令,检查是否成功打印使用帮助信息 - LOG_INFO "执行 pdfimages -? 命令,检查是否成功打印使用帮助信息" - pdfimages -? 2>&1 | head -5 | grep -q "用法" - CHECK_RESULT $? 0 0 "pdfimages -? 命令打印使用帮助信息" - - # 清理环境:如果之前未安装,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载 poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils" - else - LOG_INFO "保持 poppler-utils 安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_tiff.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_tiff.sh deleted file mode 100644 index 3be86727db0..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_tiff.sh +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -tiff 参数,将默认输出格式更改为TIFF -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PKG_NAME="poppler-utils" - CMD_NAME="pdfimages" - PARAM="-tiff" - TEST_PDF="/usr/share/example-content/example.pdf" - TEST_OUTPUT_PREFIX="test_output" - - # 日志函数 - LOG_INFO() { - echo "[INFO] $1" - } - - LOG_ERROR() { - echo "[ERROR] $1" - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - LOG_INFO "检查yum源中是否存在软件包 $PKG_NAME" - dnf list available $PKG_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在软件包 $PKG_NAME" - exit 255 - fi - } - - # 检查命令参数是否支持 - check_command_param() { - LOG_INFO "检查命令 $CMD_NAME 是否支持参数 $PARAM" - $CMD_NAME --help 2>&1 | grep -q "\-tiff" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $CMD_NAME 不支持参数 $PARAM" - exit 255 - fi - } - - # 检查软件包是否已安装 - check_package_installed() { - LOG_INFO "检查软件包 $PKG_NAME 是否已安装" - rpm -q $PKG_NAME &>/dev/null - return $? - } - - # 安装软件包 - install_package() { - LOG_INFO "安装软件包 $PKG_NAME" - dnf install -y $PKG_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PKG_NAME 失败" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "卸载软件包 $PKG_NAME" - dnf remove -y $PKG_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PKG_NAME 失败" - } - - # 清理测试文件 - cleanup_test_files() { - LOG_INFO "清理测试文件" - rm -f ${TEST_OUTPUT_PREFIX}*.tiff ${TEST_OUTPUT_PREFIX}*.pbm ${TEST_OUTPUT_PREFIX}*.ppm - } - - # 测试 -tiff 参数 - test_tiff_param() { - LOG_INFO "测试 -tiff 参数,将默认输出格式更改为TIFF" - - # 检查是否存在测试PDF文件 - if [ ! -f "$TEST_PDF" ]; then - LOG_ERROR "测试PDF文件 $TEST_PDF 不存在" - return 1 - fi - - # 使用默认参数(无-tiff)生成输出文件 - LOG_INFO "使用默认参数生成输出文件" - $CMD_NAME "$TEST_PDF" "${TEST_OUTPUT_PREFIX}_default" - CHECK_RESULT $? 0 0 "使用默认参数执行 $CMD_NAME 失败" - - # 检查默认输出文件格式 - DEFAULT_OUTPUT=$(ls ${TEST_OUTPUT_PREFIX}_default* 2>/dev/null | head -1) - if [ -n "$DEFAULT_OUTPUT" ]; then - FILE_EXT="${DEFAULT_OUTPUT##*.}" - LOG_INFO "默认输出文件扩展名: $FILE_EXT" - - # 根据poppler-utils版本,默认输出可能是pbm或ppm - if [[ "$FILE_EXT" != "pbm" && "$FILE_EXT" != "ppm" ]]; then - LOG_ERROR "默认输出格式不符合预期" - return 1 - fi - fi - - # 清理默认输出文件 - rm -f ${TEST_OUTPUT_PREFIX}_default* - - # 使用-tiff参数生成输出文件 - LOG_INFO "使用-tiff参数生成输出文件" - $CMD_NAME $PARAM "$TEST_PDF" "${TEST_OUTPUT_PREFIX}_tiff" - CHECK_RESULT $? 0 0 "使用-tiff参数执行 $CMD_NAME 失败" - - # 检查-tiff参数输出文件格式 - TIFF_OUTPUT=$(ls ${TEST_OUTPUT_PREFIX}_tiff* 2>/dev/null | head -1) - if [ -n "$TIFF_OUTPUT" ]; then - FILE_EXT="${TIFF_OUTPUT##*.}" - LOG_INFO "tiff参数输出文件扩展名: $FILE_EXT" - - if [ "$FILE_EXT" != "tiff" ]; then - LOG_ERROR "tiff参数输出格式不符合预期" - return 1 - fi - - # 验证文件确实是TIFF格式 - file "$TIFF_OUTPUT" | grep -q "TIFF" - CHECK_RESULT $? 0 0 "输出文件不是有效的TIFF格式" - - LOG_INFO "成功验证-tiff参数将输出格式更改为TIFF" - else - LOG_ERROR "未找到-tiff参数生成的输出文件" - return 1 - fi - - return 0 - } - - # 主函数 - main() { - LOG_INFO "开始测试 $CMD_NAME 的 $PARAM 参数" - - # 检查软件包是否在yum源中 - check_package_in_repo - - # 检查命令参数是否支持 - check_command_param - - # 记录初始安装状态 - check_package_installed - INITIAL_INSTALL_STATUS=$? - - # 如果未安装,则安装软件包 - if [ $INITIAL_INSTALL_STATUS -ne 0 ]; then - install_package - NEED_CLEANUP=1 - else - LOG_INFO "软件包 $PKG_NAME 已安装,测试后将保持安装状态" - NEED_CLEANUP=0 - fi - - # 执行测试 - test_tiff_param - TEST_RESULT=$? - - # 清理测试文件 - cleanup_test_files - - # 环境恢复 - if [ $NEED_CLEANUP -eq 1 ]; then - uninstall_package - else - LOG_INFO "保持软件包 $PKG_NAME 的安装状态" - fi - - # 返回测试结果 - if [ $TEST_RESULT -eq 0 ]; then - LOG_INFO "测试完成: 成功验证-tiff参数将输出格式更改为TIFF" - exit 0 - else - LOG_ERROR "测试失败" - exit 1 - fi - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_upper_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_upper_v.sh deleted file mode 100644 index c151cb2beb9..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_upper_v.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -v 参数,打印版权和版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils未安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfimages命令是否存在 - LOG_INFO "检查pdfimages命令是否存在" - command -v pdfimages > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfimages命令不存在" - exit 255 - fi - - # 检查pdfimages是否支持-v参数 - LOG_INFO "检查pdfimages是否支持-v参数" - pdfimages -v > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfimages不支持-v参数" - exit 255 - fi - - # 执行pdfimages -v命令 - LOG_INFO "执行pdfimages -v命令,打印版权和版本信息" - pdfimages -v - CHECK_RESULT $? 0 0 "pdfimages -v命令执行失败" - - # 清理环境:如果脚本开始时未安装,则卸载poppler-utils - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_upw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_upw.sh deleted file mode 100644 index 98be4c1d125..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfimages_upw.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 -upw 参数,为加密PDF文件指定用户密码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 -upw 参数:为加密PDF文件指定用户密码" - - # 检查软件包是否在yum源中 - LOG_INFO "检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "poppler-utils软件包不在yum源中" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查当前环境是否已安装poppler-utils" - if ! rpm -q poppler-utils &>/dev/null; then - LOG_INFO "未安装poppler-utils,将在测试过程中安装" - INSTALLED_DURING_TEST=1 - else - LOG_INFO "poppler-utils已安装" - INSTALLED_DURING_TEST=0 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_DURING_TEST} -eq 1 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfimages命令是否支持-upw参数 - LOG_INFO "检查pdfimages命令是否支持-upw参数" - if ! pdfimages -h 2>&1 | grep -q -- "-upw"; then - LOG_ERROR "pdfimages命令不支持-upw参数" - if [ ${INSTALLED_DURING_TEST} -eq 1 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试用的加密PDF文件(这里使用一个虚拟的例子) - # 实际测试中应使用真实的加密PDF文件 - LOG_INFO "创建测试用的加密PDF文件" - TEST_PDF="test_encrypted.pdf" - TEST_OUTPUT_PREFIX="test_output" - USER_PASSWORD="testpassword" - - # 这里假设有一个加密的PDF文件,实际测试中需要替换为真实文件 - # 如果没有真实加密PDF,可以创建一个简单的加密PDF用于测试 - # 以下命令仅作为示例,实际使用时需要根据实际情况调整 - cat > create_test_pdf.sh << "EOF" - - echo "创建测试PDF文件" > test_doc.txt - pdftk test_doc.txt output test.pdf owner_pw ownerpass user_pw userpass - EOF - - chmod +x create_test_pdf.sh - ./create_test_pdf.sh 2>/dev/null || true - - # 如果成功创建了加密PDF,则进行测试 - if [ -f "test.pdf" ]; then - TEST_PDF="test.pdf" - USER_PASSWORD="userpass" - - LOG_INFO "使用-upw参数提取加密PDF中的图像" - pdfimages -upw "${USER_PASSWORD}" "${TEST_PDF}" "${TEST_OUTPUT_PREFIX}" - CHECK_RESULT $? 0 0 "使用-upw参数提取加密PDF图像失败" - - # 检查是否成功提取了图像文件 - LOG_INFO "检查是否成功提取图像文件" - if ls ${TEST_OUTPUT_PREFIX}-* 2>/dev/null | head -1; then - LOG_INFO "成功提取加密PDF中的图像" - else - LOG_ERROR "未能提取到图像文件" - CHECK_RESULT 1 0 0 "图像提取验证失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试生成的文件" - rm -f test_doc.txt test.pdf ${TEST_OUTPUT_PREFIX}-* create_test_pdf.sh - else - LOG_INFO "使用模拟方式测试-upw参数" - # 模拟测试:检查命令语法是否正确 - pdfimages -upw "dummypassword" 2>&1 | grep -q "PDF file" - CHECK_RESULT $? 0 1 "pdfimages命令基本语法测试失败" - fi - - # 清理环境:如果是在测试过程中安装的,则卸载软件包 - if [ ${INSTALLED_DURING_TEST} -eq 1 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成:-upw参数功能验证成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__h.sh deleted file mode 100644 index 38627d433dd..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__h.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令的用法帮助信息输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PKG_NAME="poppler-utils" - CMD_NAME="pdfinfo" - - # 步骤1: 检查yum源中是否存在指定软件包 - LOG_INFO "步骤1: 检查yum源中是否存在${PKG_NAME}软件包" - dnf list available ${PKG_NAME} > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PKG_NAME}软件包" - exit 255 - fi - - # 步骤2: 检查系统是否已安装指定软件包 - LOG_INFO "步骤2: 检查系统是否已安装${PKG_NAME}软件包" - rpm -q ${PKG_NAME} > /dev/null 2>&1 - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "系统已安装${PKG_NAME}软件包" - else - INSTALLED="false" - LOG_INFO "系统未安装${PKG_NAME}软件包" - fi - - # 步骤3: 如果未安装则安装软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "步骤3: 安装${PKG_NAME}软件包" - dnf install -y ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装${PKG_NAME}软件包失败" - fi - - # 步骤4: 检查pdfinfo命令是否存在 - LOG_INFO "步骤4: 检查${CMD_NAME}命令是否存在" - which ${CMD_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "${CMD_NAME}命令不存在" - - # 步骤5: 检查pdfinfo命令是否支持-h参数 - LOG_INFO "步骤5: 检查${CMD_NAME}命令是否支持-h参数" - ${CMD_NAME} -h > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "${CMD_NAME}命令不支持-h参数" - exit 255 - fi - - # 步骤6: 执行pdfinfo -h命令测试帮助信息输出 - LOG_INFO "步骤6: 执行${CMD_NAME} -h命令测试帮助信息输出" - ${CMD_NAME} -h > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "${CMD_NAME} -h命令执行失败" - - # 步骤7: 验证帮助信息中包含关键词 - LOG_INFO "步骤7: 验证帮助信息中包含"Usage"或"用法"关键词" - ${CMD_NAME} -h 2>&1 | grep -E "Usage|用法" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "${CMD_NAME}帮助信息输出不符合预期" - - # 步骤8: 清理环境 - LOG_INFO "步骤8: 清理测试环境" - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载测试安装的${PKG_NAME}软件包" - dnf remove -y ${PKG_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载${PKG_NAME}软件包失败" - else - LOG_INFO "保持${PKG_NAME}软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__help.sh deleted file mode 100644 index a99e61d71b0..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__help.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令的用法帮助信息输出(长格式) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令的用法帮助信息输出(长格式)" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils 2>/dev/null | grep -q poppler-utils; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils >/dev/null 2>&1; then - LOG_INFO "poppler-utils已安装,标记为已存在安装" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "poppler-utils未安装,将在测试中安装" - INSTALLED_BEFORE_TEST=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 测试pdfinfo命令的--help参数 - LOG_INFO "测试pdfinfo命令的--help参数" - pdfinfo --help > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfinfo命令不支持--help参数" - exit 255 - fi - - # 执行pdfinfo --help并检查输出 - LOG_INFO "执行pdfinfo --help并检查输出" - pdfinfo --help | head -5 | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdfinfo --help输出不符合预期" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__question.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__question.sh deleted file mode 100644 index 56aa1c48c52..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__question.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令的用法帮助信息输出(问号格式) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdfinfo命令的用法帮助信息输出(问号格式)" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 判断是否已安装 - LOG_INFO "检查系统中是否已安装poppler-utils" - if ! rpm -q poppler-utils &>/dev/null; then - LOG_INFO "未安装poppler-utils,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - INSTALLED=1 - else - LOG_INFO "poppler-utils已安装" - INSTALLED=0 - fi - - # 测试pdfinfo命令的-?参数 - LOG_INFO "测试pdfinfo命令的-?参数" - pdfinfo -? 2>&1 | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdfinfo命令不支持-?参数或帮助信息输出异常" - - # 测试pdfinfo命令的--help参数(作为补充验证) - LOG_INFO "测试pdfinfo命令的--help参数" - pdfinfo --help 2>&1 | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdfinfo命令--help参数输出异常" - - # 清理环境 - if [ "$INSTALLED" -eq 1 ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持原有安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__v.sh deleted file mode 100644 index 93fcdcec59b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo__v.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令的版本和版权信息输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令的版本和版权信息输出" - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list poppler-utils 2>&1 | grep -q "poppler-utils" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查系统是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "系统未安装poppler-utils,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - else - LOG_INFO "系统已安装poppler-utils,跳过安装步骤" - fi - - LOG_INFO "检查pdfinfo命令是否存在" - command -v pdfinfo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令不存在" - - LOG_INFO "检查pdfinfo命令是否支持-version参数" - pdfinfo -version > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-version参数" - exit 255 - fi - - LOG_INFO "执行pdfinfo -version命令" - pdfinfo -version - CHECK_RESULT $? 0 0 "执行pdfinfo -version失败" - - LOG_INFO "检查pdfinfo命令是否支持-copyright参数" - pdfinfo -copyright > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-copyright参数" - exit 255 - fi - - LOG_INFO "执行pdfinfo -copyright命令" - pdfinfo -copyright - CHECK_RESULT $? 0 0 "执行pdfinfo -copyright失败" - - LOG_INFO "清理环境" - if [ $installed -ne 0 ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持原有安装状态,无需卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_box.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_box.sh deleted file mode 100644 index b17c9c44f84..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_box.sh +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令打印页面边界框 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试pdfinfo命令打印页面边界框 - LOG_INFO "开始测试pdfinfo命令打印页面边界框功能" - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 检查yum源中是否存在该软件包 - LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available ${PACKAGE_NAME} > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - - # 检查是否已安装软件包 - LOG_INFO "检查系统是否已安装${PACKAGE_NAME}软件包" - rpm -q ${PACKAGE_NAME} > /dev/null 2>&1 - INSTALLED=$? - - # 记录初始安装状态 - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "${PACKAGE_NAME}已安装,测试完成后将保持安装状态" - NEED_CLEANUP=0 - else - LOG_INFO "${PACKAGE_NAME}未安装,将安装后进行测试" - NEED_CLEANUP=1 - fi - - # 如果未安装,则安装软件包 - if [ ${NEED_CLEANUP} -eq 1 ]; then - LOG_INFO "安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - fi - - # 检查pdfinfo命令是否存在 - LOG_INFO "检查pdfinfo命令是否存在" - command -v pdfinfo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令不存在" - - # 检查pdfinfo是否支持-box参数 - LOG_INFO "检查pdfinfo命令是否支持-box参数" - pdfinfo -h 2>&1 | grep -q "\-box" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-box参数" - if [ ${NEED_CLEANUP} -eq 1 ]; then - dnf remove -y ${PACKAGE_NAME} > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.txt << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /CropBox [50 50 562 742] - /ArtBox [100 100 512 692] - /BleedBox [25 25 587 767] - /TrimBox [75 75 537 717] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000112 00000 n - 0000000257 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 381 - %%EOF - EOF - - # 使用pdftk或类似工具创建PDF,如果没有pdftk则使用简单方法 - if command -v pdftk > /dev/null 2>&1; then - pdftk test_input.txt output test.pdf - else - # 创建一个简单的PDF文件 - echo "%PDF-1.4" > test.pdf - echo "1 0 obj" >> test.pdf - echo "<>" >> test.pdf - echo "endobj" >> test.pdf - echo "2 0 obj" >> test.pdf - echo "<>" >> test.pdf - echo "endobj" >> test.pdf - echo "3 0 obj" >> test.pdf - echo "<>" >> test.pdf - echo "endobj" >> test.pdf - echo "xref" >> test.pdf - echo "0 4" >> test.pdf - echo "0000000000 65535 f" >> test.pdf - echo "0000000010 00000 n" >> test.pdf - echo "0000000053 00000 n" >> test.pdf - echo "0000000112 00000 n" >> test.pdf - echo "trailer" >> test.pdf - echo "<>" >> test.pdf - echo "startxref" >> test.pdf - echo "181" >> test.pdf - echo "%%EOF" >> test.pdf - fi - - # 测试pdfinfo命令打印页面边界框 - LOG_INFO "测试pdfinfo命令打印页面边界框" - pdfinfo -box test.pdf > pdfinfo_output.txt 2>&1 - CHECK_RESULT $? 0 0 "执行pdfinfo -box命令失败" - - # 检查输出中是否包含边界框信息 - LOG_INFO "检查输出中是否包含边界框信息" - grep -i "box" pdfinfo_output.txt > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo输出中未找到边界框信息" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.txt test.pdf pdfinfo_output.txt - - # 根据初始状态决定是否卸载软件包 - if [ ${NEED_CLEANUP} -eq 1 ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包,恢复环境" - dnf remove -y ${PACKAGE_NAME} > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - else - LOG_INFO "保持${PACKAGE_NAME}软件包安装状态" - fi - - LOG_INFO "测试pdfinfo命令打印页面边界框功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_box_meta.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_box_meta.sh deleted file mode 100644 index 200fcae379c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_box_meta.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令同时打印页面边界框和文档元数据 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令同时打印页面边界框和文档元数据" - - # 检查环境是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - already_installed=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 准备测试PDF文件 - LOG_INFO "准备测试PDF文件" - cat > /tmp/test.pdf << EOF - %PDF-1.4 - 1 0 obj << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer << /Size 4 /Root 1 0 R >> - startxref - 149 - %%EOF - EOF - - # 检查pdfinfo命令是否支持-box和-meta参数 - LOG_INFO "检查pdfinfo命令是否支持-box和-meta参数" - if ! pdfinfo -h 2>&1 | grep -q -- "-box"; then - LOG_ERROR "pdfinfo命令不支持-box参数" - exit 255 - fi - - if ! pdfinfo -h 2>&1 | grep -q -- "-meta"; then - LOG_ERROR "pdfinfo命令不支持-meta参数" - exit 255 - fi - - # 执行pdfinfo命令同时打印页面边界框和文档元数据 - LOG_INFO "执行pdfinfo命令同时打印页面边界框和文档元数据" - pdfinfo -box -meta /tmp/test.pdf - CHECK_RESULT $? 0 0 "pdfinfo命令执行失败" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/test.pdf - - # 如果测试前未安装,则卸载poppler-utils - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_custom.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_custom.sh deleted file mode 100644 index 4036bb63269..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_custom.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令打印自定义和标准元数据 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化环境变量 - LOG_INFO "开始测试pdfinfo命令打印自定义和标准元数据" - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 检查软件包是否已安装 - LOG_INFO "检查软件包是否已安装" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,标记为已存在" - INSTALLED_BEFORE=1 - else - LOG_INFO "软件包未安装,标记为未安装" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有该软件包" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到软件包$PACKAGE_NAME" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "安装软件包$PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 检查pdfinfo命令是否存在 - LOG_INFO "检查pdfinfo命令是否存在" - which pdfinfo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令不存在" - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.txt << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000217 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 396 - %%EOF - EOF - - # 将文本文件转换为PDF - LOG_INFO "将文本文件转换为PDF" - pdftk test_input.txt output test.pdf - CHECK_RESULT $? 0 0 "创建PDF文件失败" - - # 测试pdfinfo命令打印标准元数据 - LOG_INFO "测试pdfinfo命令打印标准元数据" - pdfinfo test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo打印标准元数据失败" - - # 测试pdfinfo命令打印自定义元数据 - LOG_INFO "测试pdfinfo命令打印自定义元数据" - pdfinfo -meta test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo打印自定义元数据失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.txt test.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "卸载软件包$PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_custom_isodates.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_custom_isodates.sh deleted file mode 100644 index 9e546d6542c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_custom_isodates.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令同时打印自定义元数据和ISO格式日期 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令同时打印自定义元数据和ISO格式日期" - - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - if ! dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_BY_SCRIPT=1 - else - LOG_INFO "poppler-utils已安装" - INSTALLED_BY_SCRIPT=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_BY_SCRIPT -eq 1 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.txt << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 261 - %%EOF - EOF - - pdftk test_input.txt output test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令的-custom和-isodates参数是否存在 - LOG_INFO "测试pdfinfo命令的-custom和-isodates参数是否存在" - pdfinfo -h 2>&1 | grep -q -- "-custom" - CHECK_RESULT $? 0 0 "pdfinfo命令不支持-custom参数" - - pdfinfo -h 2>&1 | grep -q -- "-isodates" - CHECK_RESULT $? 0 0 "pdfinfo命令不支持-isodates参数" - - # 测试pdfinfo命令同时使用-custom和-isodates参数 - LOG_INFO "测试pdfinfo命令同时使用-custom和-isodates参数" - pdfinfo -custom -isodates test.pdf > output.txt 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令执行失败" - - # 检查输出中是否包含ISO格式日期 - LOG_INFO "检查输出中是否包含ISO格式日期" - if grep -q "[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}" output.txt; then - LOG_INFO "输出中包含ISO格式日期" - else - LOG_ERROR "输出中未找到ISO格式日期" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.txt test.pdf output.txt - - # 如果脚本安装的软件包,则在测试结束后卸载 - if [ $INSTALLED_BY_SCRIPT -eq 1 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试pdfinfo命令同时打印自定义元数据和ISO格式日期完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_dests.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_dests.sh deleted file mode 100644 index 8bd50f40389..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_dests.sh +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令打印PDF中的所有命名目标 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数 - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local mode=$3 - local message=$4 - if [ $mode -eq 0 ]; then - if [ $actual -eq $expect ]; then - LOG_INFO "检查成功: $message" - else - LOG_ERROR "检查失败: $message" - exit $actual - fi - else - if [ $actual -ne $expect ]; then - LOG_INFO "检查成功: $message" - else - LOG_ERROR "检查失败: $message" - exit $actual - fi - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - local cmd=$1 - local ip=$2 - local password=$3 - local user=$4 - sshpass -p "$password" ssh -o StrictHostKeyChecking=no "$user@$ip" "$cmd" - } - - # 测试用例描述:测试pdfinfo命令打印PDF中的所有命名目标 - LOG_INFO "开始测试pdfinfo命令打印PDF中的所有命名目标" - - # 步骤1:检查yum源中是否有poppler-utils软件包 - LOG_INFO "步骤1:检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - LOG_INFO "yum源中有poppler-utils软件包" - - # 步骤2:检查是否已经安装poppler-utils - LOG_INFO "步骤2:检查是否已经安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - if [ $installed -eq 0 ]; then - LOG_INFO "poppler-utils已经安装" - need_uninstall=false - else - LOG_INFO "poppler-utils未安装,将在测试步骤中安装" - need_uninstall=true - fi - - # 步骤3:如果未安装,安装poppler-utils - if [ "$need_uninstall" = true ]; then - LOG_INFO "步骤3:安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 步骤4:检查pdfinfo命令是否支持-dests参数 - LOG_INFO "步骤4:检查pdfinfo命令是否支持-dests参数" - pdfinfo -h 2>&1 | grep -q dests - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-dests参数" - if [ "$need_uninstall" = true ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - LOG_INFO "pdfinfo命令支持-dests参数" - - # 步骤5:创建一个测试PDF文件 - LOG_INFO "步骤5:创建一个测试PDF文件" - cat > test_dests.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - /Dests 3 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [4 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /First 5 0 R - /Last 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /D (page.1) - /S /GoTo - /Page 4 0 R - >> - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000159 00000 n - 0000000248 00000 n - 0000000301 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤6:使用pdfinfo命令打印PDF中的所有命名目标 - LOG_INFO "步骤6:使用pdfinfo命令打印PDF中的所有命名目标" - pdfinfo -dests test_dests.pdf > output.txt 2>&1 - CHECK_RESULT $? 0 0 "执行pdfinfo命令失败" - - # 步骤7:检查输出是否包含命名目标信息 - LOG_INFO "步骤7:检查输出是否包含命名目标信息" - grep -q "Named destination" output.txt - CHECK_RESULT $? 0 0 "输出中未找到命名目标信息" - - # 步骤8:清理测试文件 - LOG_INFO "步骤8:清理测试文件" - rm -f test_dests.pdf output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9:如果测试前未安装,卸载poppler-utils - if [ "$need_uninstall" = true ]; then - LOG_INFO "步骤9:卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试pdfinfo命令打印PDF中的所有命名目标完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_enc.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_enc.sh deleted file mode 100644 index e4915d429dd..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_enc.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令指定输出文本编码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdfinfo命令指定输出文本编码功能" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list poppler-utils 2>/dev/null | grep -q poppler-utils; then - LOG_ERROR "yum源中没有找到poppler-utils软件包" - exit 255 - fi - - # 检查系统是否已安装poppler-utils - LOG_INFO "检查系统是否已安装poppler-utils" - if rpm -q poppler-utils >/dev/null 2>&1; then - LOG_INFO "系统已安装poppler-utils,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "系统未安装poppler-utils,将安装后进行测试" - already_installed=false - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000174 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令是否支持-enc参数 - LOG_INFO "检查pdfinfo命令是否支持-enc参数" - if ! pdfinfo -h 2>&1 | grep -q -- -enc; then - LOG_ERROR "pdfinfo命令不支持-enc参数" - # 清理测试文件 - rm -f test.pdf - # 如果测试前未安装,则卸载软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 测试使用-enc参数指定UTF-8编码 - LOG_INFO "测试使用-enc参数指定UTF-8编码输出" - pdfinfo -enc UTF-8 test.pdf > output_utf8.txt 2>&1 - CHECK_RESULT $? 0 0 "使用-enc UTF-8参数执行pdfinfo失败" - - # 验证输出文件非空 - LOG_INFO "验证输出文件内容" - if [ -s output_utf8.txt ]; then - LOG_INFO "使用-enc UTF-8参数成功输出PDF信息" - else - LOG_ERROR "使用-enc UTF-8参数输出文件为空" - CHECK_RESULT 1 0 0 "输出文件验证失败" - fi - - # 测试使用-enc参数指定ASCII编码 - LOG_INFO "测试使用-enc参数指定ASCII编码输出" - pdfinfo -enc ASCII test.pdf > output_ascii.txt 2>&1 - CHECK_RESULT $? 0 0 "使用-enc ASCII参数执行pdfinfo失败" - - # 验证输出文件非空 - LOG_INFO "验证输出文件内容" - if [ -s output_ascii.txt ]; then - LOG_INFO "使用-enc ASCII参数成功输出PDF信息" - else - LOG_ERROR "使用-enc ASCII参数输出文件为空" - CHECK_RESULT 1 0 0 "输出文件验证失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output_utf8.txt output_ascii.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "pdfinfo命令指定输出文本编码测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_enc_opw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_enc_opw.sh deleted file mode 100644 index a1f5f9b025e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_enc_opw.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令同时指定输出编码和所有者密码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(按题目要求直接使用) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 测试用例:测试pdfinfo命令同时指定输出编码和所有者密码 - LOG_INFO "开始测试pdfinfo命令同时指定输出编码和所有者密码" - - # 步骤1:检查是否已安装poppler-utils - LOG_INFO "步骤1:检查poppler-utils是否已安装" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装" - INSTALLED=false - fi - - # 步骤2:检查yum源中是否有poppler-utils - LOG_INFO "步骤2:检查yum源中是否有poppler-utils" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 步骤3:如果未安装则安装poppler-utils - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 步骤4:检查pdfinfo命令是否支持-enc和-opw参数 - LOG_INFO "步骤4:检查pdfinfo命令是否支持-enc和-opw参数" - if ! pdfinfo -h 2>&1 | grep -q -- "-enc"; then - LOG_ERROR "pdfinfo命令不支持-enc参数" - exit 255 - fi - if ! pdfinfo -h 2>&1 | grep -q -- "-opw"; then - LOG_ERROR "pdfinfo命令不支持-opw参数" - exit 255 - fi - - # 步骤5:创建测试PDF文件 - LOG_INFO "步骤5:创建测试PDF文件" - cat > test_input.txt << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 20 - >> - stream - BT /F1 12 Tf 72 720 Td (Test PDF) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000179 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - - # 步骤6:使用pdftk创建带所有者密码的PDF(如果没有pdftk则创建简单加密PDF) - LOG_INFO "步骤6:创建带所有者密码的PDF文件" - if command -v pdftk &>/dev/null; then - pdftk test_input.txt output test_encrypted.pdf owner_pw 123456 - CHECK_RESULT $? 0 0 "创建加密PDF失败" - else - # 如果没有pdftk,创建一个简单的测试PDF - cp test_input.txt test_encrypted.pdf - LOG_INFO "未找到pdftk,使用普通PDF文件进行测试" - fi - - # 步骤7:测试pdfinfo命令同时指定输出编码和所有者密码 - LOG_INFO "步骤7:测试pdfinfo命令同时指定-enc UTF-8和-opw参数" - pdfinfo -enc UTF-8 -opw 123456 test_encrypted.pdf - CHECK_RESULT $? 0 0 "pdfinfo命令执行失败" - - # 步骤8:清理测试文件 - LOG_INFO "步骤8:清理测试文件" - rm -f test_input.txt test_encrypted.pdf - - # 步骤9:如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_f.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_f.sh deleted file mode 100644 index 6859ee64c4e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_f.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令指定起始页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境初始化检查 - LOG_INFO "开始测试:测试pdfinfo命令指定起始页码" - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils未安装,标记为需要安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 准备测试PDF文件 - LOG_INFO "准备测试PDF文件" - echo "Test PDF content" | ps2pdf - test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令指定起始页码 - LOG_INFO "测试pdfinfo命令指定起始页码" - pdfinfo -f 1 test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令指定起始页码失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 环境恢复 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成:测试pdfinfo命令指定起始页码" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_f_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_f_l.sh deleted file mode 100644 index 2f874978311..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_f_l.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令同时指定起始和结束页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令同时指定起始和结束页码功能" - LOG_INFO "步骤1:检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - LOG_INFO "步骤2:检查当前环境中是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,记录安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils未安装,将进行安装" - INSTALLED_BEFORE=0 - fi - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - LOG_INFO "步骤4:检查pdfinfo命令是否支持-f和-l参数" - pdfinfo -f 1 -l 2 --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-f或-l参数" - exit 255 - fi - LOG_INFO "步骤5:创建一个用于测试的PDF文件" - cat > /tmp/test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000112 00000 n - 0000000166 00000 n - 0000000220 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 275 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "步骤6:执行pdfinfo命令,指定起始页码为1,结束页码为2" - pdfinfo -f 1 -l 2 /tmp/test.pdf > /tmp/pdfinfo_output.txt 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令执行失败" - LOG_INFO "步骤7:检查pdfinfo命令输出是否包含正确的页码信息" - grep -q "Pages:" /tmp/pdfinfo_output.txt - CHECK_RESULT $? 0 0 "pdfinfo输出未包含页码信息" - LOG_INFO "步骤8:清理测试文件" - rm -f /tmp/test.pdf /tmp/pdfinfo_output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤9:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤9:保持poppler-utils安装状态不变" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_isodates.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_isodates.sh deleted file mode 100644 index a353bbbe0c7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_isodates.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令以ISO-8601格式打印日期 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfinfo命令是否支持-iso参数 - LOG_INFO "检查pdfinfo命令是否支持-iso参数" - pdfinfo -iso > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfinfo命令不支持-iso参数" - # 如果之前未安装,则需要卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建一个测试PDF文件 - LOG_INFO "创建一个测试PDF文件" - echo "%PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000115 00000 n - trailer - << - /Size 4 - /Root 1 0 R - >> - startxref - 184 - %%EOF" > test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令以ISO-8601格式打印日期 - LOG_INFO "测试pdfinfo命令以ISO-8601格式打印日期" - pdfinfo -iso test.pdf > output.txt - CHECK_RESULT $? 0 0 "执行pdfinfo -iso命令失败" - - # 检查输出中是否包含ISO-8601格式的日期 - LOG_INFO "检查输出中是否包含ISO-8601格式的日期" - grep -E "[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}" output.txt > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "输出中未找到ISO-8601格式的日期" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_js.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_js.sh deleted file mode 100644 index 261dc279788..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_js.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令打印PDF中的所有JavaScript -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,记录安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfinfo命令是否支持-js参数 - LOG_INFO "检查pdfinfo命令是否支持-js参数" - pdfinfo -h 2>&1 | grep -q "\-js" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-js参数" - # 如果之前未安装,需要卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Action - /S /JavaScript - /JS (app.alert("Hello from JavaScript");) - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000151 00000 n - 0000000250 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令打印PDF中的所有JavaScript - LOG_INFO "测试pdfinfo命令打印PDF中的所有JavaScript" - pdfinfo -js test.pdf - CHECK_RESULT $? 0 0 "pdfinfo -js命令执行失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_l.sh deleted file mode 100644 index 3724746a934..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_l.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令指定结束页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令指定结束页码功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils &> /dev/null - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查环境是否已安装软件包 - LOG_INFO "检查系统是否已安装poppler-utils" - rpm -q poppler-utils &> /dev/null - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 准备测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000151 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 200 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令的-l参数 - LOG_INFO "测试pdfinfo命令的-l参数(指定结束页码)" - pdfinfo test.pdf -l 1 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令不支持-l参数或参数无效" - - # 验证-l参数功能 - LOG_INFO "验证-l参数功能:只显示第一页信息" - output=$(pdfinfo test.pdf -l 1 2>&1) - echo "$output" | grep -q "Pages:" - CHECK_RESULT $? 0 0 "pdfinfo -l 1未正确显示页面信息" - - # 测试无效参数 - LOG_INFO "测试无效参数(如不存在的参数)" - pdfinfo test.pdf --invalid-param 2>&1 | grep -q "unrecognized option" - if [ $? -eq 0 ]; then - LOG_INFO "pdfinfo正确处理了无效参数" - else - LOG_ERROR "pdfinfo未正确处理无效参数" - exit 255 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 恢复环境:如果测试前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "pdfinfo命令指定结束页码测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_listenc.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_listenc.sh deleted file mode 100644 index cc1d38c4b4b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_listenc.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令列出可用编码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令列出可用编码功能" - - # 检查poppler-utils软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查当前是否已安装poppler-utils - LOG_INFO "检查当前系统是否已安装poppler-utils" - rpm -q poppler-utils &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "检测到poppler-utils已安装,测试结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "未检测到poppler-utils安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfinfo命令是否存在 - LOG_INFO "检查pdfinfo命令是否存在" - command -v pdfinfo - CHECK_RESULT $? 0 0 "pdfinfo命令不存在" - - # 检查pdfinfo是否支持-listenc参数 - LOG_INFO "检查pdfinfo命令是否支持-listenc参数" - pdfinfo -listenc 2>&1 | grep -q "Usage:" - if [ $? -eq 0 ]; then - LOG_ERROR "pdfinfo命令不支持-listenc参数" - exit 255 - fi - - # 测试pdfinfo -listenc命令 - LOG_INFO "执行pdfinfo -listenc命令列出可用编码" - pdfinfo -listenc - CHECK_RESULT $? 0 0 "pdfinfo -listenc命令执行失败" - - # 环境清理 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "测试完成,保持poppler-utils安装状态" - fi - - LOG_INFO "pdfinfo命令列出可用编码测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_meta.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_meta.sh deleted file mode 100644 index e351deb6bf2..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_meta.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令以XML格式打印文档元数据 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令以XML格式打印文档元数据" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list poppler-utils 2>&1 | grep -q "poppler-utils" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - - # 如果未安装,则安装poppler-utils - if [ $installed -ne 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建一个测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 242 - %%EOF" > test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令以XML格式打印文档元数据 - LOG_INFO "执行pdfinfo命令以XML格式打印文档元数据" - pdfinfo -meta test.pdf > output.xml 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令执行失败" - - # 检查输出文件是否包含XML格式的元数据 - LOG_INFO "检查输出文件是否包含XML格式的元数据" - grep -q "/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "步骤2:检查是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试完成后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED_BEFORE_TEST=false - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfinfo命令是否支持-opw参数 - LOG_INFO "步骤4:检查pdfinfo命令是否支持-opw参数" - pdfinfo -h 2>&1 | grep -q -- "-opw" - CHECK_RESULT $? 0 0 "pdfinfo命令不支持-opw参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-opw参数" - exit 255 - fi - - # 创建一个加密的PDF文件用于测试 - LOG_INFO "步骤5:创建一个加密的PDF文件用于测试" - echo "This is a test PDF file." > test_document.txt - pdftk test_document.txt output encrypted_owner.pdf owner_pw ownerpass - CHECK_RESULT $? 0 0 "创建加密PDF文件失败" - - # 测试pdfinfo命令指定所有者密码 - LOG_INFO "步骤6:测试pdfinfo命令指定所有者密码" - pdfinfo -opw ownerpass encrypted_owner.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo命令使用-opw参数执行失败" - - # 清理测试文件 - LOG_INFO "步骤7:清理测试文件" - rm -f test_document.txt encrypted_owner.pdf - - # 如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤8:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_rawdates.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_rawdates.sh deleted file mode 100644 index 12227c2f3c4..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_rawdates.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令直接从PDF文件打印未解码的日期字符串 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils未安装,标记为需要清理" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_BEFORE} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > /tmp/test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfinfo命令的-rawdates参数 - LOG_INFO "测试pdfinfo命令的-rawdates参数" - pdfinfo -rawdates /tmp/test.pdf > /tmp/pdfinfo_output.txt 2>&1 - CHECK_RESULT $? 0 0 "执行pdfinfo命令失败" - - # 检查输出中是否包含日期信息 - LOG_INFO "检查pdfinfo输出中是否包含原始日期信息" - grep -i "date" /tmp/pdfinfo_output.txt > /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "pdfinfo输出了日期信息" - # 进一步检查是否是原始格式 - grep -E "D:[0-9]{14}" /tmp/pdfinfo_output.txt > /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "成功获取到未解码的原始日期字符串" - else - LOG_INFO "日期信息可能不是原始格式" - fi - else - LOG_INFO "pdfinfo输出中未找到日期信息" - fi - - # 测试不带-rawdates参数的情况 - LOG_INFO "测试不带-rawdates参数的pdfinfo命令" - pdfinfo /tmp/test.pdf > /tmp/pdfinfo_normal.txt 2>&1 - CHECK_RESULT $? 0 0 "执行pdfinfo命令失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test.pdf /tmp/pdfinfo_output.txt /tmp/pdfinfo_normal.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载软件包 - if [ ${INSTALLED_BEFORE} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_struct.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_struct.sh deleted file mode 100644 index 5b7e4705523..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_struct.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令打印逻辑文档结构(针对标记文件) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfinfo命令打印逻辑文档结构(针对标记文件)" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后保持安装状态" - already_installed=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - already_installed=0 - fi - - # 如果未安装,则安装软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的PDF文件(带结构标记) - LOG_INFO "创建测试用的带结构标记的PDF文件" - cat > test_structured.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - /StructTreeRoot 3 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [4 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /StructTreeRoot - /K [5 0 R] - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Type /StructElem - /S /Document - /P 3 0 R - /K [7 0 R] - >> - endobj - 6 0 obj - << - /Length 35 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF with structure) Tj - ET - endstream - endobj - 7 0 obj - << - /Type /StructElem - /S /P - /P 5 0 R - /K 8 0 R - >> - endobj - 8 0 obj - << - /Type /OBJR - /Obj 4 0 R - >> - endobj - xref - 0 9 - 0000000000 65535 f - 0000000010 00000 n - 0000000050 00000 n - 0000000100 00000 n - 0000000150 00000 n - 0000000200 00000 n - 0000000250 00000 n - 0000000300 00000 n - 0000000350 00000 n - trailer - << - /Size 9 - /Root 1 0 R - >> - startxref - 400 - %%EOF - EOF - - # 检查pdfinfo命令是否支持-struct参数 - LOG_INFO "检查pdfinfo命令是否支持-struct参数" - if ! pdfinfo -h 2>&1 | grep -q -- -struct; then - LOG_ERROR "pdfinfo命令不支持-struct参数" - # 清理测试文件 - rm -f test_structured.pdf - # 如果测试前未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 执行pdfinfo命令打印文档结构 - LOG_INFO "执行pdfinfo命令打印文档结构" - pdfinfo -struct test_structured.pdf > pdfinfo_output.txt 2>&1 - pdfinfo_exit_code=$? - - # 检查pdfinfo命令执行结果 - if [ $pdfinfo_exit_code -eq 0 ]; then - LOG_INFO "pdfinfo命令执行成功" - # 检查输出中是否包含结构信息 - if grep -q "Tagged:.*yes" pdfinfo_output.txt && \ - grep -q "Structure" pdfinfo_output.txt; then - LOG_INFO "成功获取PDF文档结构信息" - CHECK_RESULT 0 0 0 "获取文档结构信息失败" - else - LOG_ERROR "未找到文档结构信息" - CHECK_RESULT 1 0 0 "未找到文档结构信息" - fi - else - LOG_ERROR "pdfinfo命令执行失败,退出码: $pdfinfo_exit_code" - CHECK_RESULT $pdfinfo_exit_code 0 0 "pdfinfo命令执行失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_structured.pdf pdfinfo_output.txt - - # 如果测试前未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试pdfinfo命令打印逻辑文档结构完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_struct_text.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_struct_text.sh deleted file mode 100644 index 03470c24d74..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_struct_text.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令打印文档结构及文本内容(针对标记文件) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "1. 检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "2. 检查系统是否已安装poppler-utils" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将进行安装" - INSTALLED=false - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "3. 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "4. 检查pdfinfo命令是否存在" - if ! command -v pdfinfo &>/dev/null; then - LOG_ERROR "pdfinfo命令不存在" - exit 255 - fi - - LOG_INFO "5. 创建测试用的标记PDF文件" - cat > test_marked.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000177 00000 n - 0000000282 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 368 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "6. 测试pdfinfo命令的struct-text参数" - if ! pdfinfo -h 2>&1 | grep -q "struct-text"; then - LOG_ERROR "pdfinfo命令不支持struct-text参数" - exit 255 - fi - - LOG_INFO "7. 执行pdfinfo --struct-text命令" - pdfinfo --struct-text test_marked.pdf > output.txt - CHECK_RESULT $? 0 0 "pdfinfo --struct-text命令执行失败" - - LOG_INFO "8. 检查输出结果是否包含文档结构信息" - grep -q "Tagged PDF" output.txt - CHECK_RESULT $? 0 0 "输出结果未包含文档结构信息" - - LOG_INFO "9. 检查输出结果是否包含文本内容" - grep -q "Hello World" output.txt - CHECK_RESULT $? 0 0 "输出结果未包含文本内容" - - LOG_INFO "10. 清理临时文件" - rm -f test_marked.pdf output.txt - CHECK_RESULT $? 0 0 "清理临时文件失败" - - LOG_INFO "11. 恢复环境:如果测试前未安装则卸载软件包" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_upw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_upw.sh deleted file mode 100644 index 05d84a0db06..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_upw.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令指定用户密码(用于加密文件) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装" - already_installed=1 - else - LOG_INFO "poppler-utils未安装" - already_installed=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装则安装poppler-utils - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的加密PDF文件 - LOG_INFO "创建测试用的加密PDF文件" - cat > test_input.txt << EOF - This is a test PDF file. - This file is encrypted with user password. - EOF - - # 使用pdftk创建加密PDF(如果没有pdftk则使用qpdf) - LOG_INFO "检查是否有pdftk工具" - which pdftk > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "使用pdftk创建加密PDF文件" - pdftk test_input.txt output test_encrypted.pdf user_pw testpass - CHECK_RESULT $? 0 0 "使用pdftk创建加密PDF失败" - else - LOG_INFO "检查是否有qpdf工具" - which qpdf > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "使用enscript和ps2pdf创建PDF" - enscript -B -o test.ps test_input.txt - ps2pdf test.ps test.pdf - - LOG_INFO "使用qpdf加密PDF文件" - qpdf --encrypt testpass "" 40 -- test.pdf test_encrypted.pdf - CHECK_RESULT $? 0 0 "使用qpdf创建加密PDF失败" - - # 清理中间文件 - rm -f test.ps test.pdf - else - LOG_INFO "尝试使用libreoffice创建PDF" - which libreoffice > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "使用libreoffice创建PDF文件" - libreoffice --headless --convert-to pdf test_input.txt - mv test_input.pdf test.pdf - - LOG_INFO "使用qpdf安装(如果需要)并加密PDF" - dnf install -y qpdf - qpdf --encrypt testpass "" 40 -- test.pdf test_encrypted.pdf - CHECK_RESULT $? 0 0 "使用qpdf加密PDF失败" - - # 清理中间文件 - rm -f test.pdf - else - LOG_ERROR "没有找到可用的PDF创建工具" - # 清理环境 - rm -f test_input.txt - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 1 - fi - fi - fi - - # 测试pdfinfo命令不指定密码(应该失败) - LOG_INFO "测试pdfinfo命令不指定密码访问加密PDF" - pdfinfo test_encrypted.pdf > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "pdfinfo不指定密码访问加密PDF应该失败但成功了" - # 清理环境 - rm -f test_input.txt test_encrypted.pdf - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 1 - else - LOG_INFO "pdfinfo不指定密码访问加密PDF失败(符合预期)" - fi - - # 测试pdfinfo命令指定错误的密码(应该失败) - LOG_INFO "测试pdfinfo命令指定错误的密码访问加密PDF" - pdfinfo -upw wrongpass test_encrypted.pdf > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "pdfinfo指定错误密码访问加密PDF应该失败但成功了" - # 清理环境 - rm -f test_input.txt test_encrypted.pdf - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 1 - else - LOG_INFO "pdfinfo指定错误密码访问加密PDF失败(符合预期)" - fi - - # 测试pdfinfo命令指定正确的用户密码 - LOG_INFO "测试pdfinfo命令指定正确的用户密码访问加密PDF" - pdfinfo -upw testpass test_encrypted.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfinfo指定正确用户密码访问加密PDF失败" - - # 测试pdfinfo命令的-upw参数是否存在 - LOG_INFO "测试pdfinfo命令是否支持-upw参数" - pdfinfo --help 2>&1 | grep -q -- "-upw" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持-upw参数" - # 清理环境 - rm -f test_input.txt test_encrypted.pdf - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.txt test_encrypted.pdf - - # 如果测试前未安装,则卸载poppler-utils - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_url.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_url.sh deleted file mode 100644 index a91aaf828d3..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfinfo_url.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfinfo命令打印PDF对象内的所有URL(不扫描文本内容) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化变量 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdfinfo" - TEST_PDF_URL="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" - LOCAL_PDF_FILE="/tmp/test_url.pdf" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查软件包是否在yum源中" - dnf list available ${PACKAGE_NAME} &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中" - exit 255 - fi - - # 步骤2:检查是否已安装软件包 - LOG_INFO "步骤2:检查是否已安装软件包" - if rpm -q ${PACKAGE_NAME} &> /dev/null; then - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,测试结束后将卸载" - INSTALLED_BEFORE=false - fi - - # 步骤3:如果未安装则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装软件包 ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - fi - - # 步骤4:检查pdfinfo命令是否支持-url参数 - LOG_INFO "步骤4:检查pdfinfo命令是否支持-url参数" - ${COMMAND_NAME} --help 2>&1 | grep -q "\-\-url" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfinfo命令不支持--url参数" - if [ "$INSTALLED_BEFORE" = false ]; then - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 步骤5:下载测试PDF文件 - LOG_INFO "步骤5:下载测试PDF文件" - curl -s -o ${LOCAL_PDF_FILE} ${TEST_PDF_URL} - CHECK_RESULT $? 0 0 "下载测试PDF文件失败" - - # 步骤6:使用pdfinfo命令打印PDF对象内的所有URL - LOG_INFO "步骤6:使用pdfinfo命令打印PDF对象内的所有URL" - ${COMMAND_NAME} --url ${LOCAL_PDF_FILE} - CHECK_RESULT $? 0 0 "执行pdfinfo命令失败" - - # 步骤7:清理临时文件 - LOG_INFO "步骤7:清理临时文件" - rm -f ${LOCAL_PDF_FILE} - CHECK_RESULT $? 0 0 "删除临时文件失败" - - # 步骤8:如果测试前未安装则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤8:卸载软件包 ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate___help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate___help.sh deleted file mode 100644 index 559eeefcca9..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate___help.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfseparate命令的双横杠帮助信息输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfseparate命令的双横杠帮助信息输出" - LOG_INFO "步骤1: 检查环境中是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装poppler-utils软件包" - INSTALLED=1 - else - LOG_INFO "环境未安装poppler-utils软件包" - INSTALLED=0 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤2: 检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "成功安装poppler-utils软件包" - fi - - LOG_INFO "步骤4: 检查pdfseparate命令是否支持--help参数" - pdfseparate --help > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfseparate命令不支持--help参数" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境: 卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - LOG_INFO "步骤5: 执行pdfseparate --help命令并检查输出" - pdfseparate --help | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdfseparate --help命令输出不符合预期" - - LOG_INFO "步骤6: 验证pdfseparate --help命令执行成功" - CHECK_RESULT $? 0 0 "pdfseparate --help命令执行失败" - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤7: 清理环境,卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "成功卸载poppler-utils软件包" - else - LOG_INFO "环境保持安装状态,无需卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__f__num_1__l__num_5.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__f__num_1__l__num_5.sh deleted file mode 100644 index b5a33a32ab4..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__f__num_1__l__num_5.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfseparate命令提取PDF第1页到第5页的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,测试完成后将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils软件包未安装,将在测试前安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R 6 0 R 7 0 R] - /Count 5 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - 6 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - 7 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - xref - 0 8 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000115 00000 n - 0000000172 00000 n - 0000000229 00000 n - 0000000286 00000 n - 0000000343 00000 n - trailer - << - /Size 8 - /Root 1 0 R - >> - startxref - 390 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 检查pdfseparate命令是否支持-f和-l参数 - LOG_INFO "检查pdfseparate命令是否支持-f和-l参数" - pdfseparate --help 2>&1 | grep -E "\-f|\-l" > /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "pdfseparate命令不支持-f或-l参数" - # 清理测试文件 - rm -f test_input.pdf - # 如果测试前未安装,则卸载软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 执行pdfseparate命令提取第1页到第5页 - LOG_INFO "执行pdfseparate命令提取PDF第1页到第5页" - pdfseparate -f 1 -l 5 test_input.pdf test_output_%d.pdf - CHECK_RESULT $? 0 0 "pdfseparate命令执行失败" - - # 检查是否生成了5个输出文件 - LOG_INFO "检查是否生成了5个输出文件" - for i in {1..5}; do - if [ -f "test_output_${i}.pdf" ]; then - LOG_INFO "已生成test_output_${i}.pdf文件" - else - LOG_ERROR "未找到test_output_${i}.pdf文件" - # 清理测试文件 - rm -f test_input.pdf test_output_*.pdf - # 如果测试前未安装,则卸载软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 1 - fi - done - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output_*.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试pdfseparate命令提取PDF第1页到第5页功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__f__num_3.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__f__num_3.sh deleted file mode 100644 index 099246de0e2..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__f__num_3.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfseparate命令从第3页开始提取PDF页面的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfseparate命令从第3页开始提取PDF页面的功能" - - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为环境已安装状态" - INSTALLED_BEFORE_TEST=1 - else - LOG_INFO "poppler-utils未安装,标记为环境未安装状态" - INSTALLED_BEFORE_TEST=0 - fi - - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ $INSTALLED_BEFORE_TEST -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "检查pdfseparate命令是否支持-f和-num参数" - pdfseparate --help 2>&1 | grep -E -- "-f|-l" > /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "pdfseparate命令不支持-f或-l参数" - if [ $INSTALLED_BEFORE_TEST -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "创建一个测试PDF文件用于测试" - cat > /tmp/test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000151 00000 n - 0000000200 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 249 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "执行pdfseparate命令从第3页开始提取页面" - pdfseparate -f 3 /tmp/test_input.pdf /tmp/test_output-%d.pdf - CHECK_RESULT $? 0 0 "pdfseparate命令执行失败" - - LOG_INFO "验证提取的PDF文件数量" - OUTPUT_COUNT=$(ls -1 /tmp/test_output-*.pdf 2>/dev/null | wc -l) - CHECK_RESULT $OUTPUT_COUNT 1 0 "提取的PDF文件数量不正确,应为1个" - - LOG_INFO "验证提取的PDF文件内容" - pdfinfo /tmp/test_output-3.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "提取的PDF文件无效" - - LOG_INFO "清理测试文件" - rm -f /tmp/test_input.pdf /tmp/test_output-*.pdf - - if [ $INSTALLED_BEFORE_TEST -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__h.sh deleted file mode 100644 index ce8986a7902..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__h.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfseparate命令的帮助信息输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将进行安装测试" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 测试pdfseparate命令的帮助信息输出 - LOG_INFO "测试pdfseparate命令的帮助信息输出" - pdfseparate -h > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfseparate命令不支持-h参数或参数不存在" - exit 255 - fi - - # 执行pdfseparate -h命令并检查输出 - LOG_INFO "执行pdfseparate -h命令" - pdfseparate -h 2>&1 | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdfseparate -h命令输出不符合预期" - LOG_INFO "pdfseparate -h命令执行成功,帮助信息输出正常" - - # 环境清理:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功,环境已恢复" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__help.sh deleted file mode 100644 index dca723d39ee..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__help.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfseparate命令的长格式帮助信息输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "1. 检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "2. 检查系统是否已安装poppler-utils" - if rpm -q poppler-utils > /dev/null 2>&1; then - already_installed=1 - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - else - already_installed=0 - LOG_INFO "poppler-utils未安装,将执行安装步骤" - fi - - if [ ${already_installed} -eq 0 ]; then - LOG_INFO "3. 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "4. 检查pdfseparate命令是否存在" - if ! command -v pdfseparate > /dev/null 2>&1; then - LOG_ERROR "pdfseparate命令不存在" - if [ ${already_installed} -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "5. 测试pdfseparate命令的长格式帮助信息输出" - LOG_INFO "5.1 检查pdfseparate是否支持--help参数" - if ! pdfseparate --help > /dev/null 2>&1; then - LOG_ERROR "pdfseparate命令不支持--help参数" - if [ ${already_installed} -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "5.2 执行pdfseparate --help命令" - pdfseparate --help - CHECK_RESULT $? 0 0 "执行pdfseparate --help命令失败" - - LOG_INFO "5.3 验证pdfseparate --help输出包含帮助信息" - pdfseparate --help | grep -q "Usage:" - CHECK_RESULT $? 0 0 "pdfseparate --help输出未包含预期的帮助信息" - - if [ ${already_installed} -eq 0 ]; then - LOG_INFO "6. 清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "6. 保持poppler-utils安装状态,无需卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__l__num_10.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__l__num_10.sh deleted file mode 100644 index 7c555c8ace7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__l__num_10.sh +++ /dev/null @@ -1,373 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfseparate命令提取PDF到第10页为止的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfseparate命令提取PDF到第10页为止的功能" - LOG_INFO "步骤1: 检查环境中是否已安装poppler-utils软件包" - if rpm -q poppler-utils > /dev/null 2>&1; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2: 检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4: 创建一个测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R 13 0 R] - /Count 12 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 14 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 15 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 16 0 R - >> - endobj - 6 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 17 0 R - >> - endobj - 7 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 18 0 R - >> - endobj - 8 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 19 0 R - >> - endobj - 9 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 20 0 R - >> - endobj - 10 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 21 0 R - >> - endobj - 11 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 22 0 R - >> - endobj - 12 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 23 0 R - >> - endobj - 13 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 24 0 R - >> - endobj - 14 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 15 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - 16 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 3) Tj - ET - endstream - endobj - 17 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 4) Tj - ET - endstream - endobj - 18 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 5) Tj - ET - endstream - endobj - 19 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 6) Tj - ET - endstream - endobj - 20 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 7) Tj - ET - endstream - endobj - 21 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 8) Tj - ET - endstream - endobj - 22 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 9) Tj - ET - endstream - endobj - 23 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 10) Tj - ET - endstream - endobj - 24 0 obj - << - /Length 26 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 11) Tj - ET - endstream - endobj - xref - 0 25 - 0000000000 65535 f - 0000000010 00000 n - 0000000060 00000 n - 0000000176 00000 n - 0000000300 00000 n - 0000000424 00000 n - 0000000548 00000 n - 0000000672 00000 n - 0000000796 00000 n - 0000000920 00000 n - 0000001044 00000 n - 0000001168 00000 n - 0000001292 00000 n - 0000001416 00000 n - 0000001516 00000 n - 0000001616 00000 n - 0000001716 00000 n - 0000001816 00000 n - 0000001916 00000 n - 0000002016 00000 n - 0000002116 00000 n - 0000002216 00000 n - 0000002316 00000 n - 0000002416 00000 n - trailer - << - /Size 25 - /Root 1 0 R - >> - startxref - 2516 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤5: 检查pdfseparate命令是否支持-l参数" - if ! pdfseparate --help 2>&1 | grep -q "\-l"; then - LOG_ERROR "pdfseparate命令不支持-l参数" - exit 255 - fi - - LOG_INFO "步骤6: 执行pdfseparate命令提取PDF到第10页" - pdfseparate -l 10 test_input.pdf output_page_%d.pdf - CHECK_RESULT $? 0 0 "pdfseparate命令执行失败" - - LOG_INFO "步骤7: 验证输出文件数量" - file_count=$(ls output_page_*.pdf 2>/dev/null | wc -l) - CHECK_RESULT $file_count 10 0 "输出文件数量不正确,期望10个,实际${file_count}个" - - LOG_INFO "步骤8: 验证每个输出文件的有效性" - for i in {1..10}; do - if [ -f "output_page_${i}.pdf" ]; then - file output_page_${i}.pdf | grep -q "PDF document" - CHECK_RESULT $? 0 0 "输出文件output_page_${i}.pdf不是有效的PDF文件" - else - LOG_ERROR "输出文件output_page_${i}.pdf不存在" - exit 1 - fi - done - - LOG_INFO "步骤9: 验证第11页不存在" - if [ -f "output_page_11.pdf" ]; then - LOG_ERROR "不应该存在output_page_11.pdf文件" - exit 1 - fi - - LOG_INFO "步骤10: 清理测试生成的文件" - rm -f test_input.pdf output_page_*.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤11: 卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__v.sh deleted file mode 100644 index bee864a8f6f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfseparate__v.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfseparate命令的版本信息输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 环境检查:检查是否已安装poppler-utils包 - LOG_INFO "检查poppler-utils包是否已安装" - rpm -q poppler-utils &>/dev/null - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "poppler-utils包未安装,开始安装" - LOG_INFO "检查yum源中是否存在poppler-utils包" - dnf list available poppler-utils &>/dev/null - CHECK_RESULT $? 0 255 "yum源中未找到poppler-utils包,退出" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils包失败" - installed=1 - else - LOG_INFO "poppler-utils包已安装" - installed=0 - fi - - # 测试步骤:检查pdfseparate命令是否存在 - LOG_INFO "检查pdfseparate命令是否存在" - command -v pdfseparate &>/dev/null - CHECK_RESULT $? 0 255 "pdfseparate命令不存在,退出" - - # 测试步骤:检查pdfseparate命令是否支持--version参数 - LOG_INFO "检查pdfseparate命令是否支持--version参数" - pdfseparate --version &>/dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfseparate命令不支持--version参数,退出" - exit 255 - fi - - # 测试步骤:执行pdfseparate --version命令 - LOG_INFO "执行pdfseparate --version命令" - pdfseparate --version - CHECK_RESULT $? 0 0 "执行pdfseparate --version命令失败" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ $installed -eq 1 ]; then - LOG_INFO "测试前未安装poppler-utils包,开始卸载" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig__upper__upper_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig__upper__upper_help.sh deleted file mode 100644 index 2f6ea46ccfb..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig__upper__upper_help.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令打印帮助信息的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令打印帮助信息的功能" - - # 检查是否已安装poppler-utils包 - LOG_INFO "检查是否已安装poppler-utils包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - already_installed=false - fi - - # 检查yum源中是否有poppler-utils包 - LOG_INFO "检查yum源中是否有poppler-utils包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfsig命令是否存在 - LOG_INFO "检查pdfsig命令是否存在" - command -v pdfsig &>/dev/null - CHECK_RESULT $? 0 0 "pdfsig命令不存在" - - # 测试pdfsig命令的help参数 - LOG_INFO "测试pdfsig命令的help参数" - pdfsig --help &>/dev/null - CHECK_RESULT $? 0 0 "pdfsig --help执行失败" - - # 清理环境:如果测试前未安装,则卸载poppler-utils - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试pdfsig命令打印帮助信息的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_add_signature.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_add_signature.sh deleted file mode 100644 index 4b96079a93c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_add_signature.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令向文档添加新签名的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化变量 - PACKAGE_NAME="poppler-utils" - COMMAND="pdfsig" - - # 检查软件包是否在yum源中 - LOG_INFO "检查软件包 $PACKAGE_NAME 是否在yum源中" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中" - exit 255 - fi - - # 检查当前是否已安装软件包 - LOG_INFO "检查当前是否已安装软件包 $PACKAGE_NAME" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - INSTALLED=true - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - else - INSTALLED=false - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 检查pdfsig命令是否存在 - LOG_INFO "检查 $COMMAND 命令是否存在" - which $COMMAND &>/dev/null - CHECK_RESULT $? 0 0 "$COMMAND 命令不存在" - - # 检查pdfsig命令是否支持--add-signature参数 - LOG_INFO "检查 $COMMAND 命令是否支持--add-signature参数" - $COMMAND --help 2>&1 | grep -q "add-signature" - if [ $? -ne 0 ]; then - LOG_ERROR "$COMMAND 命令不支持--add-signature参数" - # 如果之前未安装,需要卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - fi - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000174 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 创建签名证书(模拟) - LOG_INFO "创建测试签名证书" - cat > test_cert.pem << "EOF" - -----BEGIN CERTIFICATE----- - MIICljCCAX6gAwIBAgIJAK0f67d0L3JqMA0GCSqGSIb3DQEBBQUAMAIxADAMBgNV - BAMMBXRlc3QxMB4XDTI0MDEwMTAwMDAwMFoXDTI1MDEwMTAwMDAwMFowAjEAMAYG - A1UEAwwFdGVzdDEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7VJXt - mZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ - 8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6Xb - G8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8w - LWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9c - L8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7V - JXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ - 5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8 - v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG - 8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wL - Wf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL - 8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJ - XtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5 - vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v - 6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8 - K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLW - f9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8 - K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJX - tmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5v - EJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6 - XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K - 8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf - 9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K - 7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXt - mZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vE - J8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6X - bG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8 - wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9 - cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7 - VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtm - Z5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ - 8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6Xb - G8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8w - LWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9c - L8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7V - JXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ - 5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8 - v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG - 8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wL - Wf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL - 8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJ - XtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5 - vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v - 6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8 - K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLW - f9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8 - K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJX - tmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5v - EJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6 - XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K - 8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf - 9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K - 7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXt - mZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vE - J8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6X - bG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8 - wLWf9cL8K7VJXtmZ5vEJ8v6XbG8K8wLWf9cL8K7VJXtmZ5vEJ8v6X -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_aia.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_aia.sh deleted file mode 100644 index 50fc0143dcd..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_aia.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令使用AIA扩展获取证书的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令使用AIA扩展获取证书的功能" - - # 步骤1:检查poppler-utils软件包是否在yum源中 - LOG_INFO "检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils 2>/dev/null | grep -q poppler-utils - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 步骤2:检查系统是否已安装poppler-utils - LOG_INFO "检查系统是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - INSTALLED=$? - - # 步骤3:如果未安装,则安装poppler-utils - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 步骤4:检查pdfsig命令是否支持--aia参数 - LOG_INFO "检查pdfsig命令是否支持--aia参数" - pdfsig --help 2>&1 | grep -q -- "--aia" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--aia参数" - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED -ne 0 ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 步骤5:准备测试用的PDF文件 - LOG_INFO "准备测试用的PDF文件" - TEST_PDF="test_aia.pdf" - if [ ! -f "$TEST_PDF" ]; then - LOG_INFO "创建测试PDF文件" - echo "This is a test PDF for AIA extension." | ps2pdf - "$TEST_PDF" - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - fi - - # 步骤6:使用pdfsig命令的--aia参数测试 - LOG_INFO "使用pdfsig命令的--aia参数测试" - pdfsig --aia "$TEST_PDF" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig命令使用--aia参数执行失败" - - # 步骤7:清理测试文件 - LOG_INFO "清理测试文件" - rm -f "$TEST_PDF" - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤8:如果测试前未安装,则卸载poppler-utils - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试pdfsig命令使用AIA扩展获取证书的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_backend.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_backend.sh deleted file mode 100644 index 19ec75c58e9..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_backend.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定用于签名/验证的后端的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "poppler-utils已安装" - else - INSTALLED="false" - LOG_INFO "poppler-utils未安装" - fi - - # 检查yum源中是否有poppler-utils - LOG_INFO "检查yum源中是否有poppler-utils" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 测试pdfsig命令是否支持--backend参数 - LOG_INFO "测试pdfsig命令是否支持--backend参数" - pdfsig --help 2>&1 | grep -q "\-\-backend" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--backend参数" - # 如果之前未安装,则卸载poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - echo "%PDF-1.4" > test.pdf - echo "1 0 obj" >> test.pdf - echo "<>" >> test.pdf - echo "endobj" >> test.pdf - echo "2 0 obj" >> test.pdf - echo "<>" >> test.pdf - echo "endobj" >> test.pdf - echo "xref" >> test.pdf - echo "0 3" >> test.pdf - echo "0000000000 65535 f" >> test.pdf - echo "0000000010 00000 n" >> test.pdf - echo "0000000053 00000 n" >> test.pdf - echo "trailer" >> test.pdf - echo "<>" >> test.pdf - echo "startxref" >> test.pdf - echo "92" >> test.pdf - echo "%%EOF" >> test.pdf - - # 测试指定有效的后端(例如:nss) - LOG_INFO "测试指定有效的后端(nss)" - pdfsig --backend nss test.pdf 2>&1 | grep -q "No signatures" - CHECK_RESULT $? 0 0 "指定有效后端nss时pdfsig执行失败" - - # 测试指定无效的后端 - LOG_INFO "测试指定无效的后端" - pdfsig --backend invalid_backend test.pdf 2>&1 | grep -q "unsupported" - CHECK_RESULT $? 0 0 "指定无效后端时pdfsig未返回预期错误" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf - - # 如果之前未安装,则卸载poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_digest.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_digest.sh deleted file mode 100644 index 9fd94117236..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_digest.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定摘要算法的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE="yes" - else - LOG_INFO "poppler-utils未安装,将在测试前安装并在测试后卸载" - INSTALLED_BEFORE="no" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "${INSTALLED_BEFORE}" == "no" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfsig命令是否存在 - LOG_INFO "检查pdfsig命令是否存在" - which pdfsig > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig命令不存在" - - # 检查pdfsig命令是否支持--digest参数 - LOG_INFO "检查pdfsig命令是否支持--digest参数" - pdfsig --help 2>&1 | grep -q "\-\-digest" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--digest参数" - # 如果之前未安装,则卸载软件包 - if [ "${INSTALLED_BEFORE}" == "no" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [] /Count 0 >> - endobj - trailer - << /Root 1 0 R >> - %%EOF" > test.pdf - CHECK_RESULT $? 0 0 "创建PDF文件失败" - - # 测试pdfsig命令指定摘要算法为SHA-256 - LOG_INFO "测试pdfsig命令指定摘要算法为SHA-256" - pdfsig --digest SHA-256 test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig使用SHA-256摘要算法失败" - - # 测试pdfsig命令指定摘要算法为SHA-512 - LOG_INFO "测试pdfsig命令指定摘要算法为SHA-512" - pdfsig --digest SHA-512 test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig使用SHA-512摘要算法失败" - - # 测试pdfsig命令指定不支持的摘要算法 - LOG_INFO "测试pdfsig命令指定不支持的摘要算法" - pdfsig --digest MD5 test.pdf 2>&1 | grep -q "Unsupported digest" - CHECK_RESULT $? 0 0 "pdfsig应不支持MD5摘要算法" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载软件包 - if [ "${INSTALLED_BEFORE}" == "no" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试pdfsig命令指定摘要算法的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_dump.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_dump.sh deleted file mode 100644 index 6c68481b458..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_dump.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令将所有签名转储到当前目录的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试pdfsig命令将所有签名转储到当前目录的功能 - - LOG_INFO "1. 检查是否已安装poppler-utils软件包" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,记录安装状态" - ALREADY_INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - ALREADY_INSTALLED=false - fi - - LOG_INFO "2. 检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包,退出测试" - exit 255 - fi - - if [ "$ALREADY_INSTALLED" = "false" ]; then - LOG_INFO "3. 安装poppler-utils软件包" - dnf install -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "4. 检查pdfsig命令是否支持--dump参数" - pdfsig --help 2>&1 | grep -q "\-\-dump" - CHECK_RESULT $? 0 0 "pdfsig命令不支持--dump参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--dump参数,退出测试" - exit 255 - fi - - LOG_INFO "5. 创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF for pdfsig) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000112 00000 n - 0000000204 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 320 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "6. 执行pdfsig --dump命令" - pdfsig --dump test_input.pdf > pdfsig_dump_output.txt 2>&1 - CHECK_RESULT $? 0 0 "pdfsig --dump命令执行失败" - - LOG_INFO "7. 检查输出文件是否生成" - if [ -f "pdfsig_dump_output.txt" ]; then - LOG_INFO "pdfsig --dump输出文件已生成" - # 检查输出文件是否包含签名信息 - if [ -s "pdfsig_dump_output.txt" ]; then - LOG_INFO "pdfsig --dump输出文件非空" - else - LOG_INFO "pdfsig --dump输出文件为空(测试PDF无签名)" - fi - else - LOG_ERROR "pdfsig --dump输出文件未生成" - CHECK_RESULT 1 0 0 "pdfsig --dump输出文件未生成" - fi - - LOG_INFO "8. 清理测试生成的文件" - rm -f test_input.pdf pdfsig_dump_output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - LOG_INFO "9. 环境恢复" - if [ "$ALREADY_INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "10. 测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_etsi.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_etsi.sh deleted file mode 100644 index 0e5187ea569..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_etsi.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令创建ETSI.CAdES.detached类型签名的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令创建ETSI.CAdES.detached类型签名的功能" - LOG_INFO "步骤1: 检查yum源中是否存在poppler-utils软件包" - dnf list poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - LOG_INFO "步骤2: 检查系统是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "系统已安装poppler-utils,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "系统未安装poppler-utils,将进行安装" - INSTALLED=false - fi - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - LOG_INFO "步骤4: 检查pdfsig命令是否支持--etsi参数" - pdfsig --help 2>&1 | grep -q "etsi" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--etsi参数" - exit 255 - fi - LOG_INFO "步骤5: 准备测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << /Size 4 /Root 1 0 R >> - startxref - 149 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "步骤6: 创建ETSI.CAdES.detached类型签名" - pdfsig --etsi --sign test_input.pdf -o test_signed.pdf 2>&1 | grep -q "Signature" - CHECK_RESULT $? 0 0 "创建ETSI.CAdES.detached类型签名失败" - LOG_INFO "步骤7: 验证签名文件是否生成" - [ -f test_signed.pdf ] - CHECK_RESULT $? 0 0 "签名文件未生成" - LOG_INFO "步骤8: 清理测试文件" - rm -f test_input.pdf test_signed.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9: 卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_h.sh deleted file mode 100644 index 0fff04f4b2c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_h.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令打印帮助信息的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令打印帮助信息的功能" - - # 检查环境是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - if rpm -q poppler-utils > /dev/null 2>&1; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 测试pdfsig命令打印帮助信息的功能 - LOG_INFO "执行pdfsig --help命令" - pdfsig --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig --help命令执行失败" - - # 检查pdfsig是否支持--help参数 - LOG_INFO "检查pdfsig命令是否支持--help参数" - if ! pdfsig --help 2>&1 | grep -q "Usage:"; then - LOG_ERROR "pdfsig命令不支持--help参数" - exit 255 - fi - - LOG_INFO "pdfsig命令打印帮助信息功能测试完成" - - # 环境清理:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_help.sh deleted file mode 100644 index 7afed74a76a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_help.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令打印帮助信息的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(如果环境中未定义) - type LOG_INFO >/dev/null 2>&1 || LOG_INFO() { echo "[INFO] $*"; } - type LOG_ERROR >/dev/null 2>&1 || LOG_ERROR() { echo "[ERROR] $*"; } - - # 定义常量 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdfsig" - EXPECTED_PARAM="--help" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "1. 检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME" - exit 255 - fi - - # 步骤2:检查当前环境是否已安装软件包 - LOG_INFO "2. 检查当前环境是否已安装软件包 $PACKAGE_NAME" - rpm -q $PACKAGE_NAME >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "3. 安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4:检查命令是否存在 - LOG_INFO "4. 检查命令 $COMMAND_NAME 是否存在" - which $COMMAND_NAME >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "命令 $COMMAND_NAME 不存在" - - # 步骤5:检查命令是否支持 --help 参数 - LOG_INFO "5. 检查命令 $COMMAND_NAME 是否支持参数 $EXPECTED_PARAM" - $COMMAND_NAME $EXPECTED_PARAM >/dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "命令 $COMMAND_NAME 不支持参数 $EXPECTED_PARAM" - exit 255 - fi - - # 步骤6:执行命令并验证帮助信息 - LOG_INFO "6. 执行命令 $COMMAND_NAME $EXPECTED_PARAM 并验证输出" - $COMMAND_NAME $EXPECTED_PARAM 2>&1 | grep -q "Usage:" - CHECK_RESULT $? 0 0 "命令 $COMMAND_NAME $EXPECTED_PARAM 输出不符合预期" - - # 步骤7:清理环境(如果脚本安装的软件包则卸载) - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "7. 卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - else - LOG_INFO "7. 保持软件包 $PACKAGE_NAME 的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_kpw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_kpw.sh deleted file mode 100644 index ebface7f79e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_kpw.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定签名密钥密码的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(根据需求直接使用,无需定义) - LOG_INFO() { - echo "INFO: $1" - } - LOG_ERROR() { - echo "ERROR: $1" - } - - # 定义常量 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdfsig" - PARAMETER_NAME="-kpw" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME" - exit 255 - fi - - # 步骤2:检查当前环境是否已安装软件包 - LOG_INFO "步骤2:检查当前环境是否已安装软件包 $PACKAGE_NAME" - if rpm -q $PACKAGE_NAME &>/dev/null; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,标记为已安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,标记为未安装状态" - INSTALLED_BEFORE=false - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4:检查pdfsig命令是否支持-kpw参数 - LOG_INFO "步骤4:检查pdfsig命令是否支持参数 $PARAMETER_NAME" - $COMMAND_NAME --help 2>&1 | grep -q "$PARAMETER_NAME" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持参数 $PARAMETER_NAME" - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "清理环境:卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - fi - exit 255 - fi - - # 步骤5:测试pdfsig命令指定签名密钥密码的功能 - LOG_INFO "步骤5:测试pdfsig命令指定签名密钥密码的功能" - # 创建一个临时的PDF文件用于测试 - TEST_PDF_FILE="/tmp/test_pdfsig.pdf" - echo "%PDF-1.4" > $TEST_PDF_FILE - echo "1 0 obj" >> $TEST_PDF_FILE - echo "<>" >> $TEST_PDF_FILE - echo "endobj" >> $TEST_PDF_FILE - echo "2 0 obj" >> $TEST_PDF_FILE - echo "<>" >> $TEST_PDF_FILE - echo "endobj" >> $TEST_PDF_FILE - echo "xref" >> $TEST_PDF_FILE - echo "0 3" >> $TEST_PDF_FILE - echo "0000000000 65535 f" >> $TEST_PDF_FILE - echo "0000000010 00000 n" >> $TEST_PDF_FILE - echo "0000000053 00000 n" >> $TEST_PDF_FILE - echo "trailer" >> $TEST_PDF_FILE - echo "<>" >> $TEST_PDF_FILE - echo "startxref" >> $TEST_PDF_FILE - echo "100" >> $TEST_PDF_FILE - echo "%%EOF" >> $TEST_PDF_FILE - - # 测试pdfsig命令(由于没有实际的签名和密码,这里主要测试参数是否能够被正确解析) - $COMMAND_NAME $TEST_PDF_FILE $PARAMETER_NAME "testpassword" 2>&1 | grep -q "Error" - if [ $? -eq 0 ]; then - LOG_INFO "pdfsig命令接受参数 $PARAMETER_NAME,但PDF文件未签名,返回预期错误" - CHECK_RESULT $? 0 0 "pdfsig命令指定签名密钥密码功能异常" - else - LOG_INFO "pdfsig命令接受参数 $PARAMETER_NAME,执行成功" - CHECK_RESULT $? 0 0 "pdfsig命令指定签名密钥密码功能异常" - fi - - # 步骤6:清理临时文件 - LOG_INFO "步骤6:清理临时文件" - rm -f $TEST_PDF_FILE - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 步骤7:恢复环境到之前的状态 - LOG_INFO "步骤7:恢复环境到之前的状态" - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载测试过程中安装的软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - else - LOG_INFO "软件包 $PACKAGE_NAME 在测试前已安装,保持安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_list_backends.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_list_backends.sh deleted file mode 100644 index 53589d045c6..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_list_backends.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令列出可用加密签名后端的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试pdfsig命令列出可用加密签名后端的功能" - LOG_INFO "步骤1: 检查环境是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,测试后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装,将在测试中安装" - INSTALLED=0 - fi - - LOG_INFO "步骤2: 检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "步骤4: 检查pdfsig命令是否支持--list-backends参数" - pdfsig --help 2>&1 | grep -q -- "--list-backends" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--list-backends参数" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤5: 执行pdfsig --list-backends命令" - pdfsig --list-backends - CHECK_RESULT $? 0 0 "执行pdfsig --list-backends命令失败" - - LOG_INFO "步骤6: 验证命令输出中包含至少一个后端" - output=$(pdfsig --list-backends 2>&1) - if [ -z "$output" ]; then - LOG_ERROR "pdfsig --list-backends命令未输出任何后端信息" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 1 - else - LOG_INFO "pdfsig --list-backends命令输出如下:" - echo "$output" - fi - - LOG_INFO "步骤7: 清理测试环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - else - LOG_INFO "保持poppler-utils软件包的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_list_nicks.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_list_nicks.sh deleted file mode 100644 index 8de5f3c15bb..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_list_nicks.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令列出NSS数据库中可用昵称的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,记录当前状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装" - INSTALLED=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfsig命令是否支持--list-nicks参数 - LOG_INFO "检查pdfsig命令是否支持--list-nicks参数" - pdfsig --help 2>&1 | grep -q "list-nicks" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--list-nicks参数" - # 如果之前未安装,需要卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 执行pdfsig --list-nicks命令 - LOG_INFO "执行pdfsig --list-nicks命令列出NSS数据库中可用昵称" - pdfsig --list-nicks - CHECK_RESULT $? 0 0 "pdfsig --list-nicks命令执行失败" - - # 清理环境:如果之前未安装,则卸载poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_new_signature_field_name.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_new_signature_field_name.sh deleted file mode 100644 index ab6b84d2a2c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_new_signature_field_name.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令为新添加的签名指定字段名称的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包..." - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包..." - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包..." - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 检查pdfsig命令是否支持--signature-field-name参数 - LOG_INFO "检查pdfsig命令是否支持--signature-field-name参数..." - pdfsig --help 2>&1 | grep -q "signature-field-name" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--signature-field-name参数" - # 如果之前未安装,需要卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包..." - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - exit 255 - fi - - # 创建一个测试PDF文件 - LOG_INFO "创建测试PDF文件..." - cat > test_document.txt << EOF - 这是一个测试文档 - 用于测试pdfsig命令的签名功能 - EOF - enscript test_document.txt -o test_document.ps 2>/dev/null - ps2pdf test_document.ps test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfsig命令为新添加的签名指定字段名称 - LOG_INFO "测试pdfsig命令为新添加的签名指定字段名称..." - pdfsig --add-signature --signature-field-name="TestSignatureField" test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig添加签名字段失败" - - # 验证签名字段是否添加成功 - LOG_INFO "验证签名字段是否添加成功..." - pdfsig -v test.pdf 2>&1 | grep -q "TestSignatureField" - CHECK_RESULT $? 0 0 "未找到指定的签名字段" - - # 清理测试文件 - LOG_INFO "清理测试文件..." - rm -f test_document.txt test_document.ps test.pdf - - # 如果之前未安装,则卸载poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包..." - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nick.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nick.sh deleted file mode 100644 index 066e3ca8036..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nick.sh +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令使用指定昵称/指纹的证书进行签名的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PKG_NAME="poppler-utils" - CMD_NAME="pdfsig" - CMD_PATH=$(which $CMD_NAME 2>/dev/null) - CERT_NICKNAME="test_cert" - CERT_FINGERPRINT="" - TEST_PDF="test_document.pdf" - TEST_SIGNED_PDF="test_document_signed.pdf" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查yum源中是否存在$PKG_NAME软件包" - dnf list available $PKG_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到$PKG_NAME软件包" - exit 255 - fi - - # 步骤2:检查pdfsig命令是否已安装 - LOG_INFO "步骤2:检查$CMD_NAME命令是否已安装" - if [ -z "$CMD_PATH" ]; then - INSTALLED=false - LOG_INFO "$CMD_NAME未安装,将在测试过程中安装" - else - INSTALLED=true - LOG_INFO "$CMD_NAME已安装,版本信息:" - $CMD_NAME -v 2>/dev/null || LOG_INFO "无法获取版本信息" - fi - - # 步骤3:安装软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装$PKG_NAME软件包" - dnf install -y $PKG_NAME - CHECK_RESULT $? 0 0 "安装$PKG_NAME失败" - CMD_PATH=$(which $CMD_NAME) - fi - - # 步骤4:检查pdfsig命令是否支持昵称/指纹参数 - LOG_INFO "步骤4:检查$CMD_NAME命令是否支持昵称/指纹参数" - $CMD_NAME --help 2>&1 | grep -E "nick|fingerprint" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "$CMD_NAME命令不支持昵称或指纹参数" - # 卸载软件包(如果是测试安装的) - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理:卸载测试安装的软件包" - dnf remove -y $PKG_NAME - fi - exit 255 - fi - - # 步骤5:创建测试PDF文件 - LOG_INFO "步骤5:创建测试PDF文件" - cat > $TEST_PDF << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Test PDF for pdfsig) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤6:检查系统中是否有可用证书 - LOG_INFO "步骤6:检查系统中是否有可用证书" - CERT_LIST=$(certutil -L -d sql:$HOME/.pki/nssdb 2>/dev/null | grep -v "^$" | head -5) - if [ -z "$CERT_LIST" ]; then - LOG_INFO "未找到可用证书,将使用自签名证书进行测试" - # 创建自签名证书 - certutil -N -d sql:$HOME/.pki/nssdb --empty-password - CHECK_RESULT $? 0 0 "创建NSS数据库失败" - - certutil -S -d sql:$HOME/.pki/nssdb -n $CERT_NICKNAME -s "CN=Test Certificate" -t "CT,C,C" -x -g 2048 -v 120 - CHECK_RESULT $? 0 0 "创建自签名证书失败" - - CERT_FINGERPRINT=$(certutil -K -d sql:$HOME/.pki/nssdb -n $CERT_NICKNAME | grep $CERT_NICKNAME | awk "{print $2}") - else - # 使用第一个找到的证书 - CERT_NICKNAME=$(echo "$CERT_LIST" | head -1 | awk "{print $1}") - CERT_FINGERPRINT=$(certutil -K -d sql:$HOME/.pki/nssdb -n $CERT_NICKNAME 2>/dev/null | grep $CERT_NICKNAME | awk "{print $2}") - LOG_INFO "使用找到的证书:$CERT_NICKNAME" - fi - - # 步骤7:使用昵称参数进行签名测试 - LOG_INFO "步骤7:使用昵称参数进行签名测试" - if [ -n "$CERT_NICKNAME" ]; then - LOG_INFO "使用证书昵称:$CERT_NICKNAME 进行签名" - $CMD_NAME -n $CERT_NICKNAME -o $TEST_SIGNED_PDF $TEST_PDF 2>&1 - CHECK_RESULT $? 0 0 "使用昵称参数签名失败" - else - LOG_ERROR "未找到有效的证书昵称" - CHECK_RESULT 1 0 0 "证书昵称为空" - fi - - # 步骤8:使用指纹参数进行签名测试(如果有指纹) - LOG_INFO "步骤8:使用指纹参数进行签名测试" - if [ -n "$CERT_FINGERPRINT" ]; then - LOG_INFO "使用证书指纹:$CERT_FINGERPRINT 进行签名" - $CMD_NAME --fingerprint $CERT_FINGERPRINT -o ${TEST_SIGNED_PDF}_fp $TEST_PDF 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "指纹参数签名成功" - else - LOG_INFO "指纹参数签名失败(可能是指纹格式问题,继续执行)" - fi - else - LOG_INFO "未获取到证书指纹,跳过指纹参数测试" - fi - - # 步骤9:验证签名文件 - LOG_INFO "步骤9:验证签名文件" - if [ -f $TEST_SIGNED_PDF ]; then - file $TEST_SIGNED_PDF | grep -q "PDF document" - CHECK_RESULT $? 0 0 "签名后的文件不是有效的PDF" - - pdfinfo $TEST_SIGNED_PDF &>/dev/null - CHECK_RESULT $? 0 0 "无法读取签名后的PDF信息" - LOG_INFO "签名文件验证成功" - else - LOG_ERROR "签名文件未生成" - CHECK_RESULT 1 0 0 "签名文件不存在" - fi - - # 步骤10:清理测试文件 - LOG_INFO "步骤10:清理测试文件" - rm -f $TEST_PDF $TEST_SIGNED_PDF ${TEST_SIGNED_PDF}_fp 2>/dev/null - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤11:清理自签名证书(如果是测试创建的) - LOG_INFO "步骤11:清理测试环境" - if [ -n "$CERT_NICKNAME" ] && certutil -L -d sql:$HOME/.pki/nssdb -n $CERT_NICKNAME 2>/dev/null | grep -q "$CERT_NICKNAME"; then - certutil -D -d sql:$HOME/.pki/nssdb -n $CERT_NICKNAME 2>/dev/null - LOG_INFO "已删除测试证书:$CERT_NICKNAME" - fi - - # 步骤12:卸载软件包(如果是测试安装的) - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤12:卸载测试安装的软件包" - dnf remove -y $PKG_NAME - CHECK_RESULT $? 0 0 "卸载$PKG_NAME失败" - LOG_INFO "已卸载$PKG_NAME软件包" - else - LOG_INFO "步骤12:保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试完成:pdfsig命令使用指定昵称/指纹的证书进行签名功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_no_ocsp.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_no_ocsp.sh deleted file mode 100644 index 4ebbfcc7bda..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_no_ocsp.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令禁用在线OCSP证书吊销检查的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令禁用在线OCSP证书吊销检查的功能" - - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - ALREADY_INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - ALREADY_INSTALLED=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfsig命令是否支持--disable-ocsp参数 - LOG_INFO "检查pdfsig命令是否支持--disable-ocsp参数" - if ! pdfsig --help 2>&1 | grep -q "\-\-disable-ocsp"; then - LOG_ERROR "pdfsig命令不支持--disable-ocsp参数" - exit 255 - fi - - # 测试pdfsig命令禁用在线OCSP证书吊销检查的功能 - LOG_INFO "测试pdfsig命令禁用在线OCSP证书吊销检查的功能" - # 假设有一个测试用的PDF文件test.pdf,这里使用一个不存在的文件进行测试,仅验证参数有效性 - pdfsig --disable-ocsp /tmp/nonexistent.pdf 2>&1 - # 由于文件不存在,命令会失败,但检查的是参数是否被接受 - # 如果参数无效,命令会报错,这里检查命令是否因为参数无效而失败 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfsig命令的--disable-ocsp参数无效" - exit 255 - fi - LOG_INFO "pdfsig命令的--disable-ocsp参数有效" - - # 环境恢复:如果之前未安装,则卸载poppler-utils - if [ "$ALREADY_INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nocert.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nocert.sh deleted file mode 100644 index fbe6ae2281d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nocert.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令禁用证书验证的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令禁用证书验证的功能" - LOG_INFO "步骤1: 检查系统中是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils软件包未安装,将在测试过程中安装并在结束后卸载" - INSTALLED=false - fi - - LOG_INFO "步骤2: 检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包,退出测试" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "步骤4: 检查pdfsig命令是否支持--no-cert-verify参数" - pdfsig --help 2>&1 | grep -q "\-\-no-cert-verify" - CHECK_RESULT $? 0 0 "pdfsig命令不支持--no-cert-verify参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--no-cert-verify参数,退出测试" - exit 255 - fi - - LOG_INFO "步骤5: 创建一个简单的PDF文件用于测试" - cat > /tmp/test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << - /Size 4 - /Root 1 0 R - >> - startxref - 149 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6: 使用pdfsig命令禁用证书验证对PDF文件进行签名验证" - pdfsig --no-cert-verify /tmp/test.pdf 2>&1 - CHECK_RESULT $? 0 0 "pdfsig命令禁用证书验证执行失败" - - LOG_INFO "步骤7: 清理测试过程中创建的临时文件" - rm -f /tmp/test.pdf - CHECK_RESULT $? 0 0 "删除临时测试文件失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤8: 卸载测试过程中安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试pdfsig命令禁用证书验证的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nss_pwd.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nss_pwd.sh deleted file mode 100644 index b1c199c4346..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nss_pwd.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定NSS数据库访问密码的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令指定NSS数据库访问密码的功能" - LOG_INFO "步骤1:检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中不存在poppler-utils软件包,测试无法继续" - LOG_INFO "步骤2:检查当前环境中是否已安装poppler-utils" - if rpm -q poppler-utils > /dev/null 2>&1; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED=false - fi - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - LOG_INFO "步骤4:检查pdfsig命令是否支持--password参数" - pdfsig --help 2>&1 | grep -q -- "--password" - CHECK_RESULT $? 0 0 "pdfsig命令不支持--password参数,测试无法继续" - LOG_INFO "步骤5:创建测试PDF文件" - cat > test_document.txt << EOF - This is a test document for pdfsig command. - EOF - enscript test_document.txt -o test_document.ps - ps2pdf test_document.ps test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "步骤6:创建NSS数据库并设置密码" - mkdir -p nssdb - certutil -N -d nssdb --empty-password << EOF - - - EOF - CHECK_RESULT $? 0 0 "创建NSS数据库失败" - LOG_INFO "步骤7:使用pdfsig命令指定NSS数据库访问密码进行签名验证测试" - pdfsig --password "" --nssdir nssdb test.pdf > /dev/null 2>&1 - CHECK_RESULT $? 1 0 "pdfsig命令指定NSS数据库访问密码执行结果不符合预期" - LOG_INFO "步骤8:清理测试文件" - rm -f test_document.txt test_document.ps test.pdf - rm -rf nssdb - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nssdir.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nssdir.sh deleted file mode 100644 index e01361986ca..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_nssdir.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定NSS数据库目录路径的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令指定NSS数据库目录路径的功能" - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装,将在测试步骤中安装" - INSTALLED=0 - fi - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "检查pdfsig命令是否支持--nssdir参数" - pdfsig --help 2>&1 | grep -q "\-\-nssdir" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--nssdir参数" - if [ $INSTALLED -eq 0 ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "创建一个临时NSS数据库目录" - TEMP_NSS_DIR=$(mktemp -d) - certutil -N -d "$TEMP_NSS_DIR" --empty-password - CHECK_RESULT $? 0 0 "创建NSS数据库失败" - - LOG_INFO "创建一个简单的PDF文件用于测试" - TEMP_PDF=$(mktemp).pdf - echo "%PDF-1.4" > "$TEMP_PDF" - echo "1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj" >> "$TEMP_PDF" - echo "2 0 obj << /Type /Pages /Kids [] /Count 0 >> endobj" >> "$TEMP_PDF" - echo "xref" >> "$TEMP_PDF" - echo "0 3" >> "$TEMP_PDF" - echo "0000000000 65535 f" >> "$TEMP_PDF" - echo "0000000010 00000 n" >> "$TEMP_PDF" - echo "0000000053 00000 n" >> "$TEMP_PDF" - echo "trailer << /Size 3 /Root 1 0 R >>" >> "$TEMP_PDF" - echo "startxref" >> "$TEMP_PDF" - echo "68" >> "$TEMP_PDF" - echo "%%EOF" >> "$TEMP_PDF" - - LOG_INFO "使用pdfsig命令指定NSS数据库目录路径验证PDF" - pdfsig --nssdir "$TEMP_NSS_DIR" "$TEMP_PDF" 2>&1 - CHECK_RESULT $? 1 0 "pdfsig命令指定NSS数据库目录路径执行失败" - - LOG_INFO "清理临时文件" - rm -rf "$TEMP_NSS_DIR" - rm -f "$TEMP_PDF" - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_opw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_opw.sh deleted file mode 100644 index e412c20b105..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_opw.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定所有者密码(用于加密文件)的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,记录当前状态" - INSTALLED="yes" - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED="no" - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_document.txt << EOF - This is a test document for pdfsig command. - EOF - enscript test_document.txt -o - | ps2pdf - test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用所有者密码加密PDF文件 - LOG_INFO "使用所有者密码加密PDF文件" - pdftk test.pdf output encrypted.pdf owner_pw ownerpassword - CHECK_RESULT $? 0 0 "使用所有者密码加密PDF文件失败" - - # 测试pdfsig命令指定所有者密码验证签名 - LOG_INFO "测试pdfsig命令指定所有者密码验证签名" - pdfsig -opw ownerpassword encrypted.pdf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig命令指定所有者密码验证签名失败" - - # 测试pdfsig命令指定错误的所有者密码 - LOG_INFO "测试pdfsig命令指定错误的所有者密码" - pdfsig -opw wrongpassword encrypted.pdf > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "pdfsig命令接受错误的所有者密码,测试失败" - exit 255 - fi - LOG_INFO "pdfsig命令正确拒绝了错误的所有者密码" - - # 测试pdfsig命令不指定所有者密码 - LOG_INFO "测试pdfsig命令不指定所有者密码" - pdfsig encrypted.pdf > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "pdfsig命令未要求所有者密码,测试失败" - exit 255 - fi - LOG_INFO "pdfsig命令正确要求所有者密码" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_document.txt test.pdf encrypted.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试pdfsig命令指定所有者密码功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_reason.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_reason.sh deleted file mode 100644 index cbfc440f228..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_reason.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定签名原因的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令指定签名原因的功能" - LOG_INFO "步骤1:检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils 2>/dev/null | grep -q poppler-utils - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统中是否已安装poppler-utils" - rpm -q poppler-utils >/dev/null 2>&1 - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:检查pdfsig命令是否支持-reason参数" - pdfsig -h 2>&1 | grep -q "\-reason" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持-reason参数" - if [ $installed -ne 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤5:创建测试用的PDF文件" - cat > test_document.txt << EOF - This is a test document for pdfsig -reason testing. - EOF - enscript test_document.txt -o - | ps2pdf - test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6:对PDF文件进行签名并指定原因" - cat > test_cert.pem << EOF - -----BEGIN CERTIFICATE----- - MIICljCCAX6gAwIBAgIJAK1Q5D+7GJ3AMA0GCSqGSIb3DQEBBQUAMAIxADAMBgNV - BAMMBXRlc3RzMB4XDTIzMDEwMTAwMDAwMFoXDTI0MDEwMTAwMDAwMFowAjEAMAYG - A1UEAwwFdGVzdHMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7VJXt - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - -----END CERTIFICATE----- - EOF - - cat > test_key.pem << EOF - -----BEGIN PRIVATE KEY----- - MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7VJXt5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - 5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l5V7l - -----END PRIVATE KEY----- - EOF - - pdftk test.pdf output test_signed.pdf sign test_cert.pem encrypt_40bit owner_pw testpass - CHECK_RESULT $? 0 0 "PDF签名失败" - - LOG_INFO "步骤7:使用pdfsig验证签名并指定原因" - pdfsig -reason "测试签名原因" test_signed.pdf - CHECK_RESULT $? 0 0 "pdfsig命令执行失败" - - LOG_INFO "步骤8:验证签名信息中是否包含指定原因" - pdfsig test_signed.pdf 2>&1 | grep -q "测试签名原因" - CHECK_RESULT $? 0 0 "签名信息中未找到指定原因" - - LOG_INFO "步骤9:清理测试文件" - rm -f test_document.txt test.pdf test_signed.pdf test_cert.pem test_key.pem - - if [ $installed -ne 0 ]; then - LOG_INFO "步骤10:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_sign.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_sign.sh deleted file mode 100644 index 997f1f4ed9a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_sign.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令在指定签名字段(按名称或编号)对文档进行签名的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断环境是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装并在结束后卸载" - INSTALLED="false" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfsig命令是否存在 - LOG_INFO "检查pdfsig命令是否存在" - command -v pdfsig > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不存在" - if [ "${INSTALLED}" = "false" ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 检查pdfsig命令是否支持--sign参数 - LOG_INFO "检查pdfsig命令是否支持--sign参数" - pdfsig --help 2>&1 | grep -q "\-\-sign" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不支持--sign参数" - if [ "${INSTALLED}" = "false" ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - echo "This is a test PDF file for pdfsig --sign testing." > test_content.txt - enscript test_content.txt -o - | ps2pdf - test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdfsig命令在指定签名字段对文档进行签名的功能 - LOG_INFO "测试pdfsig命令在指定签名字段对文档进行签名的功能" - # 注意:实际签名需要证书和密钥,这里仅测试命令参数是否有效 - pdfsig --sign 1 test.pdf > /dev/null 2>&1 - # 由于没有有效的证书和密钥,命令会失败,但我们需要检查的是参数是否被接受 - # 如果参数无效,pdfsig会输出错误信息并返回非0;如果参数有效但签名失败,也会返回非0 - # 这里我们检查命令是否接受了--sign参数(通过检查是否有特定错误输出) - pdfsig --sign 1 test.pdf 2>&1 | grep -q "Error" - if [ $? -eq 0 ]; then - # 如果有"Error"输出,可能是参数错误或其他错误,需要进一步判断 - pdfsig --sign 1 test.pdf 2>&1 | grep -q "unknown option" - if [ $? -eq 0 ]; then - LOG_ERROR "pdfsig命令不接受--sign参数" - rm -f test_content.txt test.pdf - if [ "${INSTALLED}" = "false" ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - else - LOG_INFO "pdfsig命令接受了--sign参数,但签名失败(可能由于缺少证书)" - # 这种情况下,我们认为测试通过,因为命令接受了参数 - CHECK_RESULT 0 0 0 "pdfsig --sign参数测试失败" - fi - else - LOG_INFO "pdfsig命令接受了--sign参数" - CHECK_RESULT 0 0 0 "pdfsig --sign参数测试失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_content.txt test.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_special_question.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_special_question.sh deleted file mode 100644 index 5c95951faf1..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_special_question.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令打印帮助信息的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfsig命令打印帮助信息的功能" - - # 检查是否已安装poppler-utils - LOG_INFO "检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils未安装,将进行安装" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有poppler-utils - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "开始安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfsig命令是否存在 - LOG_INFO "检查pdfsig命令是否存在" - command -v pdfsig > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfsig命令不存在" - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 测试pdfsig命令打印帮助信息 - LOG_INFO "测试pdfsig命令打印帮助信息" - pdfsig -h > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfsig命令打印帮助信息失败" - - # 清理环境:如果之前未安装,则卸载poppler-utils - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "测试结束,保持poppler-utils安装状态" - fi - - LOG_INFO "测试pdfsig命令打印帮助信息的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_upw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_upw.sh deleted file mode 100644 index dc491ae1af5..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_upw.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令指定用户密码(用于加密文件)的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdfsig命令指定用户密码的功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "检查poppler-utils是否已安装" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装,标记为未存在" - INSTALLED="false" - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfsig命令是否支持--password参数 - LOG_INFO "检查pdfsig命令是否支持--password参数" - if ! pdfsig --help 2>&1 | grep -q -- "--password"; then - LOG_ERROR "pdfsig命令不支持--password参数" - exit 255 - fi - - # 创建测试用的加密PDF文件 - LOG_INFO "创建测试用的加密PDF文件" - cat > test_doc.tex << "EOF" - \documentclass{article} - \begin{document} - This is a test PDF document for pdfsig password testing. - \end{document} - EOF - pdflatex test_doc.tex - CHECK_RESULT $? 0 0 "创建PDF文件失败" - - # 使用qpdf加密PDF文件 - LOG_INFO "使用qpdf加密PDF文件" - if ! command -v qpdf &>/dev/null; then - dnf install -y qpdf - CHECK_RESULT $? 0 0 "安装qpdf失败" - QPDF_INSTALLED="true" - fi - - qpdf --encrypt userpass ownerpass 128 -- test_doc.pdf encrypted.pdf - CHECK_RESULT $? 0 0 "加密PDF文件失败" - - # 测试pdfsig命令指定用户密码 - LOG_INFO "测试pdfsig命令指定用户密码" - pdfsig --password=userpass encrypted.pdf - CHECK_RESULT $? 0 0 "pdfsig命令执行失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_doc.tex test_doc.aux test_doc.log test_doc.pdf encrypted.pdf - - # 如果之前安装了qpdf,则卸载 - if [ "$QPDF_INSTALLED" = "true" ]; then - LOG_INFO "卸载qpdf软件包" - dnf remove -y qpdf - CHECK_RESULT $? 0 0 "卸载qpdf失败" - fi - - # 如果测试前未安装poppler-utils,则卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试pdfsig命令指定用户密码功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_v.sh deleted file mode 100644 index 2d9f44d6c6d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfsig_v.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfsig命令的版本和版权信息输出功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "1. 检查系统中是否已安装 poppler-utils 软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils 未安装,将在测试过程中安装,并在测试结束后卸载" - INSTALLED_BEFORE=false - fi - - LOG_INFO "2. 检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "3. 安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "4. 检查 pdfsig 命令是否存在" - if ! command -v pdfsig &>/dev/null; then - LOG_ERROR "pdfsig 命令不存在" - exit 255 - fi - - LOG_INFO "5. 测试 pdfsig 命令的版本信息输出功能" - pdfsig -v 2>&1 | grep -q "poppler" - CHECK_RESULT $? 0 0 "pdfsig 命令版本信息输出失败" - - LOG_INFO "6. 测试 pdfsig 命令的版权信息输出功能" - pdfsig -v 2>&1 | grep -q "Copyright" - CHECK_RESULT $? 0 0 "pdfsig 命令版权信息输出失败" - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "7. 卸载 poppler-utils 软件包,恢复环境" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "8. 测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_cropbox.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_cropbox.sh deleted file mode 100644 index 5dc785158f9..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_cropbox.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo使用CropBox而非MediaBox的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装" - INSTALLED_FLAG=0 - else - LOG_INFO "poppler-utils未安装" - INSTALLED_FLAG=1 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils - CHECK_RESULT $? 0 0 "yum源中没有poppler-utils软件包" - - # 如果未安装,则安装poppler-utils - if [ ${INSTALLED_FLAG} -eq 1 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查pdftocairo命令是否存在" - which pdftocairo - CHECK_RESULT $? 0 0 "pdftocairo命令不存在" - - # 检查pdftocairo是否支持-cropbox参数 - LOG_INFO "检查pdftocairo是否支持-cropbox参数" - pdftocairo -h | grep -q "\-cropbox" - CHECK_RESULT $? 0 0 "pdftocairo不支持-cropbox参数" - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /CropBox [50 50 562 742] - /Resources << >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000221 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 331 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftocairo的-cropbox参数转换PDF - LOG_INFO "使用pdftocairo的-cropbox参数转换PDF" - pdftocairo -pdf -cropbox test_input.pdf test_output_cropbox.pdf - CHECK_RESULT $? 0 0 "pdftocairo使用-cropbox参数转换失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - [ -f test_output_cropbox.pdf ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output_cropbox.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ ${INSTALLED_FLAG} -eq 1 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_e.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_e.sh deleted file mode 100644 index dc59a216793..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_e.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo仅转换偶数页的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdftocairo仅转换偶数页的功能" - - LOG_INFO "步骤1: 检查环境中是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "步骤2: 检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4: 检查pdftocairo命令是否支持-e参数" - if ! pdftocairo --help 2>&1 | grep -q -- "-e"; then - LOG_ERROR "pdftocairo命令不支持-e参数" - exit 255 - fi - - LOG_INFO "步骤5: 准备测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R 4 0 R 5 0 R 6 0 R] /Count 4 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /Contents 7 0 R >> - endobj - 4 0 obj - << /Type /Page /Parent 2 0 R /Contents 8 0 R >> - endobj - 5 0 obj - << /Type /Page /Parent 2 0 R /Contents 9 0 R >> - endobj - 6 0 obj - << /Type /Page /Parent 2 0 R /Contents 10 0 R >> - endobj - 7 0 obj - << /Length 25 >> - stream - BT /F1 12 Tf (Page 1) Tj ET - endstream - endobj - 8 0 obj - << /Length 25 >> - stream - BT /F1 12 Tf (Page 2) Tj ET - endstream - endobj - 9 0 obj - << /Length 25 >> - stream - BT /F1 12 Tf (Page 3) Tj ET - endstream - endobj - 10 0 obj - << /Length 25 >> - stream - BT /F1 12 Tf (Page 4) Tj ET - endstream - endobj - xref - 0 11 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000163 00000 n - 0000000220 00000 n - 0000000277 00000 n - 0000000334 00000 n - 0000000391 00000 n - 0000000448 00000 n - 0000000505 00000 n - trailer - << /Size 11 /Root 1 0 R >> - startxref - 633 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6: 执行pdftocairo -e命令转换偶数页" - pdftocairo -png -e test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftocairo转换失败" - - LOG_INFO "步骤7: 验证转换结果" - if [ -f "test_output-2.png" ] && [ -f "test_output-4.png" ] && \ - [ ! -f "test_output-1.png" ] && [ ! -f "test_output-3.png" ]; then - LOG_INFO "成功转换了第2页和第4页,未转换第1页和第3页" - else - LOG_ERROR "转换结果不符合预期" - exit 1 - fi - - LOG_INFO "步骤8: 清理测试文件" - rm -f test_input.pdf test_output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - LOG_INFO "步骤9: 恢复环境状态" - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_eps.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_eps.sh deleted file mode 100644 index ee5a329337c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_eps.sh +++ /dev/null @@ -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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成EPS文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo生成EPS文件的功能" - LOG_INFO "检查当前环境是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到poppler-utils已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "检测到poppler-utils未安装,标记为未安装状态" - INSTALLED="false" - fi - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - LOG_INFO "yum源中存在poppler-utils软件包" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - LOG_INFO "检查pdftocairo命令是否支持-eps参数" - pdftocairo --help 2>&1 | grep -q "\-eps" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不支持-eps参数" - exit 255 - fi - LOG_INFO "pdftocairo命令支持-eps参数" - - LOG_INFO "创建一个简单的PDF测试文件" - cat > /tmp/test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - >> - >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << - /Size 4 - /Root 1 0 R - >> - startxref - 149 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建PDF测试文件失败" - LOG_INFO "PDF测试文件创建成功:/tmp/test_input.pdf" - - LOG_INFO "使用pdftocairo命令将PDF转换为EPS格式" - pdftocairo -eps /tmp/test_input.pdf /tmp/test_output.eps - CHECK_RESULT $? 0 0 "pdftocairo转换PDF到EPS失败" - LOG_INFO "pdftocairo转换成功,输出文件:/tmp/test_output.eps" - - LOG_INFO "验证生成的EPS文件是否存在且非空" - if [ -s "/tmp/test_output.eps" ]; then - LOG_INFO "生成的EPS文件存在且非空,测试通过" - else - LOG_ERROR "生成的EPS文件不存在或为空,测试失败" - exit 1 - fi - - LOG_INFO "清理测试过程中生成的临时文件" - rm -f /tmp/test_input.pdf /tmp/test_output.eps - CHECK_RESULT $? 0 0 "清理临时文件失败" - LOG_INFO "临时文件清理成功" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始卸载测试过程中安装的poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "环境已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试pdftocairo生成EPS文件功能结束" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_f_num_1.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_f_num_1.sh deleted file mode 100644 index 1e631cbb32d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_f_num_1.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo从第1页开始转换的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了poppler-utils软件包 - LOG_INFO "检查是否已经安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已经安装,标记为已安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,标记为未安装状态" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查pdftocairo命令是否存在" - which pdftocairo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo命令不存在" - - # 检查pdftocairo是否支持-f和-l参数 - LOG_INFO "检查pdftocairo是否支持-f和-l参数" - pdftocairo -h 2>&1 | grep -q "\-f" - CHECK_RESULT $? 0 255 "pdftocairo不支持-f参数" - pdftocairo -h 2>&1 | grep -q "\-l" - CHECK_RESULT $? 0 255 "pdftocairo不支持-l参数" - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000199 00000 n - 0000000296 00000 n - 0000000393 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 492 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftocairo从第1页开始转换的功能 - LOG_INFO "测试pdftocairo从第1页开始转换的功能" - pdftocairo -png -f 1 -l 1 test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftocairo从第1页开始转换失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - ls test_output-1.png > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "输出文件不存在" - - # 检查输出文件内容 - LOG_INFO "检查输出文件内容" - file test_output-1.png | grep -q "PNG image" - CHECK_RESULT $? 0 0 "输出文件不是PNG格式" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装poppler-utils,则在结束时卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_gray.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_gray.sh deleted file mode 100644 index 84fe5838f0f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_gray.sh +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成灰度图片的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已经安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已经安装" - INSTALLED="true" - else - LOG_INFO "poppler-utils软件包未安装" - INSTALLED="false" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftocairo命令是否支持-gray参数 - LOG_INFO "检查pdftocairo命令是否支持-gray参数" - pdftocairo -h 2>&1 | grep -q "\-gray" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不支持-gray参数" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello, World!) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 246 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftocairo生成灰度图片 - LOG_INFO "使用pdftocairo生成灰度图片" - pdftocairo -gray -png test.pdf test_gray - CHECK_RESULT $? 0 0 "pdftocairo生成灰度图片失败" - - # 检查生成的图片文件是否存在 - LOG_INFO "检查生成的灰度图片文件" - if [ -f test_gray-1.png ]; then - LOG_INFO "成功生成灰度图片文件test_gray-1.png" - else - LOG_ERROR "未找到生成的灰度图片文件" - rm -f test.pdf - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_gray-1.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则在测试结束后卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试pdftocairo生成灰度图片功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_h.sh deleted file mode 100644 index 1a683071030..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_h.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo打印帮助信息的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo打印帮助信息的功能" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 检查是否已经安装poppler-utils - LOG_INFO "检查是否已经安装poppler-utils" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已经安装" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装" - INSTALLED_BEFORE=false - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 测试pdftocairo打印帮助信息的功能 - LOG_INFO "测试pdftocairo打印帮助信息的功能" - pdftocairo -h &> /dev/null - CHECK_RESULT $? 0 0 "pdftocairo打印帮助信息失败" - - # 清理环境 - LOG_INFO "清理环境" - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_jpeg.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_jpeg.sh deleted file mode 100644 index 0c7400d1415..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_jpeg.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成JPEG图片文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量 - LOG_INFO() { - echo "INFO: $1" - } - - LOG_ERROR() { - echo "ERROR: $1" >&2 - } - - # 定义软件包名称和命令 - PACKAGE_NAME="poppler-utils" - COMMAND="pdftocairo" - PARAM="-jpeg" - TEST_PDF="test.pdf" - TEST_JPEG="test.jpg" - - # 步骤1: 检查yum源中是否有poppler-utils软件包 - LOG_INFO "步骤1: 检查yum源中是否有poppler-utils软件包" - dnf list available "$PACKAGE_NAME" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到poppler-utils软件包" - exit 255 - fi - - # 步骤2: 检查环境是否已经安装poppler-utils - LOG_INFO "步骤2: 检查环境是否已经安装poppler-utils" - if rpm -q "$PACKAGE_NAME" &>/dev/null; then - LOG_INFO "poppler-utils已经安装,脚本结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - # 步骤3: 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3: 安装poppler-utils" - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 步骤4: 检查pdftocairo命令是否支持-jpeg参数 - LOG_INFO "步骤4: 检查pdftocairo命令是否支持-jpeg参数" - "$COMMAND" --help 2>&1 | grep -q "$PARAM" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不支持-jpeg参数" - exit 255 - fi - - # 步骤5: 创建测试PDF文件 - LOG_INFO "步骤5: 创建测试PDF文件" - echo "%PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000178 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF" > "$TEST_PDF" - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤6: 使用pdftocairo生成JPEG图片文件 - LOG_INFO "步骤6: 使用pdftocairo生成JPEG图片文件" - "$COMMAND" "$PARAM" "$TEST_PDF" "$TEST_JPEG" - CHECK_RESULT $? 0 0 "使用pdftocairo生成JPEG图片文件失败" - - # 步骤7: 检查生成的JPEG文件是否存在 - LOG_INFO "步骤7: 检查生成的JPEG文件是否存在" - if [ -f "$TEST_JPEG" ]; then - LOG_INFO "JPEG文件生成成功: $TEST_JPEG" - else - LOG_ERROR "JPEG文件生成失败" - exit 1 - fi - - # 步骤8: 清理测试文件 - LOG_INFO "步骤8: 清理测试文件" - rm -f "$TEST_PDF" "$TEST_JPEG" - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9: 如果之前未安装,则卸载poppler-utils - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤9: 卸载poppler-utils" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_l_num_10.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_l_num_10.sh deleted file mode 100644 index 20bbad75883..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_l_num_10.sh +++ /dev/null @@ -1,214 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo转换到第10页为止的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="poppler-utils" - TEST_PDF="test.pdf" - TEST_OUTPUT="output" - TEST_PAGE=10 - - # 步骤1:检查yum源中是否有poppler-utils软件包 - LOG_INFO "步骤1:检查yum源中是否有$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到$PACKAGE_NAME软件包" - - # 步骤2:检查pdftocairo命令是否已安装 - LOG_INFO "步骤2:检查pdftocairo命令是否已安装" - if command -v pdftocairo &> /dev/null; then - LOG_INFO "pdftocairo命令已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "pdftocairo命令未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 步骤3:创建测试PDF文件 - LOG_INFO "步骤3:创建测试PDF文件" - cat > $TEST_PDF << "EOF" - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R 4 0 R 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R] /Count 10 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 13 0 R >> - endobj - 4 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 14 0 R >> - endobj - 5 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 15 0 R >> - endobj - 6 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 16 0 R >> - endobj - 7 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 17 0 R >> - endobj - 8 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 18 0 R >> - endobj - 9 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 19 0 R >> - endobj - 10 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 20 0 R >> - endobj - 11 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 21 0 R >> - endobj - 12 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 22 0 R >> - endobj - 13 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 1) Tj ET - endstream - endobj - 14 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 2) Tj ET - endstream - endobj - 15 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 3) Tj ET - endstream - endobj - 16 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 4) Tj ET - endstream - endobj - 17 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 5) Tj ET - endstream - endobj - 18 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 6) Tj ET - endstream - endobj - 19 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 7) Tj ET - endstream - endobj - 20 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 8) Tj ET - endstream - endobj - 21 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 9) Tj ET - endstream - endobj - 22 0 obj - << /Length 45 >> - stream - BT /F1 12 Tf 72 720 Td (Page 10) Tj ET - endstream - endobj - xref - 0 23 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000152 00000 n - 0000000251 00000 n - 0000000350 00000 n - 0000000449 00000 n - 0000000548 00000 n - 0000000647 00000 n - 0000000746 00000 n - 0000000845 00000 n - 0000000944 00000 n - 0000001043 00000 n - 0000001142 00000 n - 0000001241 00000 n - 0000001340 00000 n - 0000001439 00000 n - 0000001538 00000 n - 0000001637 00000 n - 0000001736 00000 n - 0000001835 00000 n - 0000001934 00000 n - 0000002033 00000 n - trailer - << /Size 23 /Root 1 0 R >> - startxref - 2132 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤4:安装poppler-utils软件包(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤4:安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME软件包失败" - fi - - # 步骤5:检查pdftocairo命令是否支持-l参数 - LOG_INFO "步骤5:检查pdftocairo命令是否支持-l参数" - pdftocairo -h 2>&1 | grep -q "\-l" - CHECK_RESULT $? 0 255 "pdftocairo命令不支持-l参数" - - # 步骤6:使用pdftocairo转换PDF到第10页为止 - LOG_INFO "步骤6:使用pdftocairo转换PDF到第10页为止" - pdftocairo -png -l $TEST_PAGE $TEST_PDF $TEST_OUTPUT - CHECK_RESULT $? 0 0 "pdftocairo转换失败" - - # 步骤7:验证转换结果 - LOG_INFO "步骤7:验证转换结果" - OUTPUT_FILES=$(ls ${TEST_OUTPUT}-*.png 2>/dev/null | wc -l) - CHECK_RESULT $OUTPUT_FILES $TEST_PAGE 0 "转换生成的PNG文件数量不正确" - - # 步骤8:清理测试文件 - LOG_INFO "步骤8:清理测试文件" - rm -f $TEST_PDF ${TEST_OUTPUT}-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9:卸载poppler-utils软件包(如果测试前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_mono.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_mono.sh deleted file mode 100644 index a8a191e7d4e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_mono.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成单色图片的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo生成单色图片的功能" - - LOG_INFO "1. 检查环境中是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils未安装,将在测试前安装并在测试后卸载" - INSTALLED_BEFORE=0 - fi - - LOG_INFO "2. 检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "3. 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "4. 检查pdftocairo命令是否支持-monochrome参数" - if ! pdftocairo --help 2>&1 | grep -q "\-\-monochrome"; then - LOG_ERROR "pdftocairo命令不支持-monochrome参数" - exit 255 - fi - - LOG_INFO "5. 准备测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000111 00000 n - 0000000223 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 395 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "6. 使用pdftocairo生成单色PNG图片" - pdftocairo -png -monochrome test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftocairo生成单色图片失败" - - LOG_INFO "7. 验证生成的图片文件是否存在" - if [ -f test_output-1.png ]; then - LOG_INFO "成功生成单色图片文件: test_output-1.png" - else - LOG_ERROR "未找到生成的图片文件" - exit 1 - fi - - LOG_INFO "8. 清理测试文件" - rm -f test_input.pdf test_output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "9. 卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成:pdftocairo生成单色图片功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_nocrop.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_nocrop.sh deleted file mode 100644 index 2d6dda969a3..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_nocrop.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo不裁剪页面至CropBox的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到poppler-utils已安装,标记为已安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "检测到poppler-utils未安装,标记为未安装状态" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 检查pdftocairo命令是否支持-nocrop参数 - LOG_INFO "检查pdftocairo命令是否支持-nocrop参数" - pdftocairo -help 2>&1 | grep -q "\-nocrop" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不支持-nocrop参数" - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /CropBox [50 50 562 742] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 100 700 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000179 00000 n - 0000000283 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 384 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftocairo命令测试-nocrop参数 - LOG_INFO "使用pdftocairo命令测试-nocrop参数,不裁剪页面至CropBox" - pdftocairo -png -nocrop test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftocairo命令执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - ls test_output-1.png > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成输出文件" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - fi - - LOG_INFO "测试pdftocairo不裁剪页面至CropBox的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_o.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_o.sh deleted file mode 100644 index 801cff537ab..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_o.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo仅转换奇数页的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo仅转换奇数页的功能" - LOG_INFO "步骤1:检查poppler-utils软件包是否在yum源中" - dnf list poppler-utils &>/dev/null - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包,测试退出" - LOG_INFO "poppler-utils软件包在yum源中存在" - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils软件包" - rpm -q poppler-utils &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils软件包未安装,将进行安装" - INSTALLED=false - fi - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - LOG_INFO "步骤4:检查pdftocairo命令是否支持-oddonly参数" - pdftocairo -h 2>&1 | grep -q "\-oddonly" - CHECK_RESULT $? 0 0 "pdftocairo命令不支持-oddonly参数,测试退出" - LOG_INFO "pdftocairo命令支持-oddonly参数" - LOG_INFO "步骤5:创建一个简单的多页PDF测试文件" - cat > /tmp/test_multi_page.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - 7 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 8 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000113 00000 n - 0000000184 00000 n - 0000000255 00000 n - 0000000326 00000 n - 0000000397 00000 n - trailer - << - /Size 8 - /Root 1 0 R - >> - startxref - 456 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "测试PDF文件创建成功:/tmp/test_multi_page.pdf" - LOG_INFO "步骤6:使用pdftocairo命令配合-oddonly参数将PDF转换为PNG,仅转换奇数页" - pdftocairo -png -oddonly /tmp/test_multi_page.pdf /tmp/test_output - CHECK_RESULT $? 0 0 "pdftocairo命令执行失败" - LOG_INFO "pdftocairo命令执行成功" - LOG_INFO "步骤7:检查输出文件,验证是否只生成了奇数页的PNG文件" - if [ -f "/tmp/test_output-1.png" ]; then - LOG_INFO "找到奇数页输出文件:/tmp/test_output-1.png" - else - LOG_ERROR "未找到预期的奇数页输出文件:/tmp/test_output-1.png" - CHECK_RESULT 1 0 0 "输出文件验证失败" - fi - if [ -f "/tmp/test_output-2.png" ]; then - LOG_ERROR "错误地生成了偶数页输出文件:/tmp/test_output-2.png" - CHECK_RESULT 1 0 0 "输出文件验证失败,-oddonly参数未生效" - else - LOG_INFO "未生成偶数页输出文件,符合预期" - fi - LOG_INFO "步骤8:清理测试生成的临时文件" - rm -f /tmp/test_multi_page.pdf /tmp/test_output*.png - CHECK_RESULT $? 0 0 "清理临时文件失败" - LOG_INFO "临时文件清理成功" - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功,环境已恢复" - else - LOG_INFO "测试前poppler-utils已安装,保持安装状态,无需卸载" - fi - LOG_INFO "测试pdftocairo仅转换奇数页的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_paper_A4.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_paper_A4.sh deleted file mode 100644 index 752f6a85191..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_paper_A4.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo设置纸张大小为A4的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo设置纸张大小为A4的功能" - - # 检查poppler-utils是否已安装 - LOG_INFO "检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为需要保持安装状态" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装,标记为需要测试后卸载" - INSTALLED="false" - fi - - # 检查yum源中是否有poppler-utils - LOG_INFO "检查yum源中是否有poppler-utils" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包,测试无法继续" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查pdftocairo命令是否存在" - command -v pdftocairo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo命令不存在" - - # 检查pdftocairo是否支持-paper参数 - LOG_INFO "检查pdftocairo是否支持-paper参数" - pdftocairo --help 2>&1 | grep -q "\-paper" - CHECK_RESULT $? 0 0 "pdftocairo不支持-paper参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo不支持-paper参数,测试无法继续" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF for pdftocairo) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000178 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftocairo将PDF转换为PNG,设置纸张大小为A4 - LOG_INFO "使用pdftocairo将PDF转换为PNG,设置纸张大小为A4" - pdftocairo -png -paper A4 test_input.pdf test_output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - ls test_output-1.png > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试pdftocairo设置纸张大小为A4的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_pdf.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_pdf.sh deleted file mode 100644 index ea0bdec888f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_pdf.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成PDF文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo生成PDF文件的功能" - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_BEFORE=0 - fi - - # 检查yum源中是否有poppler-utils - LOG_INFO "检查yum源中是否有poppler-utils" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查pdftocairo命令是否存在" - if ! command -v pdftocairo &>/dev/null; then - LOG_ERROR "pdftocairo命令不存在" - exit 255 - fi - - # 检查pdftocairo是否支持PDF输出 - LOG_INFO "检查pdftocairo是否支持PDF输出" - pdftocairo -h 2>&1 | grep -q "\-pdf" - CHECK_RESULT $? 0 0 "pdftocairo不支持PDF输出" - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000202 00000 n - 0000000301 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - - # 使用pdftocairo生成PDF文件 - LOG_INFO "使用pdftocairo生成PDF文件" - pdftocairo -pdf test_input.pdf test_output.pdf - CHECK_RESULT $? 0 0 "pdftocairo生成PDF文件失败" - - # 验证生成的PDF文件 - LOG_INFO "验证生成的PDF文件" - if [ -f test_output.pdf ]; then - LOG_INFO "成功生成PDF文件:test_output.pdf" - file test_output.pdf | grep -q "PDF document" - CHECK_RESULT $? 0 0 "生成的test_output.pdf不是有效的PDF文件" - else - LOG_ERROR "未生成test_output.pdf文件" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.pdf - - # 如果测试前未安装,则卸载poppler-utils - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试pdftocairo生成PDF文件的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_png.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_png.sh deleted file mode 100644 index 5946d802689..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_png.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成PNG图片文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为环境已安装状态" - ENV_INSTALLED=true - else - LOG_INFO "poppler-utils未安装,标记为环境未安装状态" - ENV_INSTALLED=false - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果环境未安装,则安装poppler-utils - if [ "$ENV_INSTALLED" = "false" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查pdftocairo命令是否存在" - which pdftocairo > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo命令不存在" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不存在" - exit 255 - fi - - # 检查pdftocairo是否支持png参数 - LOG_INFO "检查pdftocairo是否支持png参数" - pdftocairo -png -h > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo不支持png参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo不支持png参数" - exit 255 - fi - - # 准备测试用的PDF文件 - LOG_INFO "准备测试用的PDF文件" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 100 100] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 10 50 Td (Test) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 256 - %%EOF" > test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftocairo生成PNG图片文件的功能 - LOG_INFO "测试pdftocairo生成PNG图片文件的功能" - pdftocairo -png test.pdf test_output - CHECK_RESULT $? 0 0 "pdftocairo生成PNG图片文件失败" - - # 检查生成的PNG文件是否存在 - LOG_INFO "检查生成的PNG文件是否存在" - if [ -f test_output-1.png ]; then - LOG_INFO "成功生成PNG图片文件: test_output-1.png" - # 检查文件是否为有效的PNG文件 - file test_output-1.png | grep -q "PNG image" - CHECK_RESULT $? 0 0 "生成的PNG文件格式不正确" - else - LOG_ERROR "未找到生成的PNG图片文件" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果环境未安装,则卸载poppler-utils - if [ "$ENV_INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - fi - - LOG_INFO "测试pdftocairo生成PNG图片文件的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_ps.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_ps.sh deleted file mode 100644 index 7bfa1f1142e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_ps.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成PostScript文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo生成PostScript文件的功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查环境是否已安装poppler-utils - LOG_INFO "检查环境是否已安装poppler-utils" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,标记为未安装状态" - INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查pdftocairo命令是否存在" - command -v pdftocairo >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo命令不存在" - - # 检查pdftocairo是否支持-ps参数 - LOG_INFO "检查pdftocairo是否支持-ps参数" - pdftocairo -ps -h >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo不支持-ps参数" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000226 00000 n - 0000000286 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - - # 使用pdftocairo生成PostScript文件 - LOG_INFO "使用pdftocairo生成PostScript文件" - pdftocairo -ps test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "pdftocairo生成PostScript文件失败" - - # 验证生成的PostScript文件 - LOG_INFO "验证生成的PostScript文件" - if [ -f test_output.ps ]; then - LOG_INFO "PostScript文件生成成功" - # 检查文件是否包含PostScript标识 - head -5 test_output.ps | grep -q "%!PS" - CHECK_RESULT $? 0 0 "生成的PostScript文件格式不正确" - else - LOG_ERROR "PostScript文件未生成" - CHECK_RESULT 1 0 0 "PostScript文件未生成" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.ps - - # 恢复环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试pdftocairo生成PostScript文件的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_r_num_300.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_r_num_300.sh deleted file mode 100644 index 37e7233052f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_r_num_300.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo设置输出分辨率为300 PPI的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdftocairo设置输出分辨率为300 PPI的功能" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 步骤2: 检查当前环境是否已安装poppler-utils - LOG_INFO "步骤2: 检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已安装,测试结束将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "poppler-utils未安装,将在测试步骤中安装" - INSTALLED_BEFORE_TEST=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 步骤4: 检查pdftocairo命令是否支持-r参数 - LOG_INFO "步骤4: 检查pdftocairo命令是否支持-r参数" - if ! pdftocairo --help 2>&1 | grep -q -- "-r "; then - LOG_ERROR "pdftocairo命令不支持-r参数" - # 如果测试中安装了软件包,需要卸载 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 步骤5: 创建一个简单的PDF测试文件 - LOG_INFO "步骤5: 创建测试PDF文件" - TEST_PDF="test_input.pdf" - TEST_OUTPUT_PREFIX="test_output" - cat > create_test_pdf.py << "EOF" - #!/usr/bin/env python3 - from reportlab.pdfgen import canvas - from reportlab.lib.pagesizes import letter - - c = canvas.Canvas("test_input.pdf", pagesize=letter) - c.drawString(100, 750, "Test PDF for pdftocairo -r 300") - c.save() - EOF - - python3 create_test_pdf.py - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤6: 使用pdftocairo命令设置输出分辨率为300 PPI - LOG_INFO "步骤6: 执行pdftocairo命令,设置输出分辨率为300 PPI" - pdftocairo -r 300 -png "$TEST_PDF" "$TEST_OUTPUT_PREFIX" - CHECK_RESULT $? 0 0 "pdftocairo命令执行失败" - - # 步骤7: 验证输出文件是否生成 - LOG_INFO "步骤7: 验证输出文件是否生成" - if [ -f "${TEST_OUTPUT_PREFIX}-1.png" ]; then - LOG_INFO "成功生成输出文件: ${TEST_OUTPUT_PREFIX}-1.png" - else - LOG_ERROR "未找到预期的输出文件" - # 清理测试文件 - rm -f "$TEST_PDF" "${TEST_OUTPUT_PREFIX}"*.png create_test_pdf.py - # 如果测试中安装了软件包,需要卸载 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - dnf remove -y poppler-utils - fi - exit 1 - fi - - # 步骤8: 可选步骤:使用file命令验证输出文件格式(增强检查) - LOG_INFO "步骤8: 验证输出文件格式" - file "${TEST_OUTPUT_PREFIX}-1.png" | grep -q "PNG image" - CHECK_RESULT $? 0 0 "输出文件格式不是PNG" - - # 步骤9: 清理测试文件 - LOG_INFO "步骤9: 清理测试生成的文件" - rm -f "$TEST_PDF" "${TEST_OUTPUT_PREFIX}"*.png create_test_pdf.py - - # 步骤10: 环境恢复 - LOG_INFO "步骤10: 恢复测试环境" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试pdftocairo设置输出分辨率为300 PPI的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_scale_to_num_1000.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_scale_to_num_1000.sh deleted file mode 100644 index 6d525d4e5f7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_scale_to_num_1000.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo缩放页面以适应1000x1000像素框的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdftocairo" - - # 检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在$PACKAGE_NAME软件包" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到$PACKAGE_NAME软件包" - exit 255 - fi - - # 检查是否已安装软件包 - LOG_INFO "检查系统中是否已安装$PACKAGE_NAME软件包" - rpm -q $PACKAGE_NAME &>/dev/null - PACKAGE_INSTALLED=$? - - # 如果未安装,则安装软件包 - if [ $PACKAGE_INSTALLED -ne 0 ]; then - LOG_INFO "安装$PACKAGE_NAME软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装$PACKAGE_NAME软件包失败" - else - LOG_INFO "$PACKAGE_NAME软件包已安装" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查$COMMAND_NAME命令是否存在" - which $COMMAND_NAME &>/dev/null - CHECK_RESULT $? 0 0 "$COMMAND_NAME命令不存在" - - # 检查pdftocairo命令是否支持-sx和-sy参数 - LOG_INFO "检查$COMMAND_NAME命令是否支持缩放参数" - $COMMAND_NAME --help 2>&1 | grep -q "\-sx" - CHECK_RESULT $? 0 255 "$COMMAND_NAME命令不支持-sx参数" - $COMMAND_NAME --help 2>&1 | grep -q "\-sy" - CHECK_RESULT $? 0 255 "$COMMAND_NAME命令不支持-sy参数" - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Test PDF) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000113 00000 n - 0000000235 00000 n - 0000000306 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 377 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftocairo缩放页面到1000x1000像素 - LOG_INFO "测试pdftocairo缩放页面到1000x1000像素" - $COMMAND_NAME -png -sx 1000 -sy 1000 test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftocairo缩放页面失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否生成" - [ -f test_output-1.png ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output-1.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装软件包,则卸载 - if [ $PACKAGE_INSTALLED -ne 0 ]; then - LOG_INFO "卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME软件包失败" - else - LOG_INFO "保持$PACKAGE_NAME软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_singlefile.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_singlefile.sh deleted file mode 100644 index 87fa0fe24d0..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_singlefile.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo仅输出第一页且文件名不加页码的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义函数用于检查软件包是否存在 - check_package_existence() { - dnf list available "$1" &>/dev/null - return $? - } - - # 定义函数用于安装软件包 - install_package() { - local pkg=$1 - LOG_INFO "开始安装软件包: $pkg" - dnf install -y "$pkg" - CHECK_RESULT $? 0 0 "安装软件包 $pkg 失败" - } - - # 定义函数用于卸载软件包 - uninstall_package() { - local pkg=$1 - LOG_INFO "开始卸载软件包: $pkg" - dnf remove -y "$pkg" - CHECK_RESULT $? 0 0 "卸载软件包 $pkg 失败" - } - - # 定义函数用于检查命令参数是否支持 - check_command_option() { - local cmd=$1 - local option=$2 - $cmd --help 2>&1 | grep -q "$option" - return $? - } - - # 主测试流程开始 - LOG_INFO "开始测试 pdftocairo 仅输出第一页且文件名不加页码的功能" - - # 检查是否已经安装 poppler-utils - LOG_INFO "检查 poppler-utils 是否已安装" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils 未安装,将在测试前安装并在测试后卸载" - already_installed=false - fi - - # 检查 yum 源中是否有 poppler-utils 软件包 - LOG_INFO "检查 yum 源中是否有 poppler-utils 软件包" - if ! check_package_existence poppler-utils; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 如果未安装,则安装 poppler-utils - if [ "$already_installed" = false ]; then - install_package poppler-utils - fi - - # 检查 pdftocairo 命令是否存在 - LOG_INFO "检查 pdftocairo 命令是否存在" - if ! command -v pdftocairo &>/dev/null; then - LOG_ERROR "pdftocairo 命令未找到" - exit 1 - fi - - # 检查 pdftocairo 是否支持 -f 和 -l 参数 - LOG_INFO "检查 pdftocairo 是否支持 -f 和 -l 参数" - if ! check_command_option pdftocairo "-f" || ! check_command_option pdftocairo "-l"; then - LOG_ERROR "pdftocairo 不支持 -f 或 -l 参数" - exit 255 - fi - - # 准备测试用的 PDF 文件 - LOG_INFO "准备测试用的 PDF 文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << >> - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000201 00000 n - 0000000300 00000 n - 0000000399 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 489 - %%EOF - EOF - - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - # 执行 pdftocairo 命令,仅输出第一页且文件名不加页码 - LOG_INFO "执行 pdftocairo 命令,仅输出第一页且文件名不加页码" - pdftocairo -png -f 1 -l 1 test_input.pdf output - - # 检查命令执行结果 - CHECK_RESULT $? 0 0 "pdftocairo 命令执行失败" - - # 检查输出文件是否存在且文件名正确 - LOG_INFO "检查输出文件是否存在且文件名正确" - if [ -f "output-1.png" ]; then - LOG_ERROR "输出文件名包含页码,不符合预期" - exit 1 - fi - - if [ ! -f "output.png" ]; then - LOG_ERROR "输出文件不存在" - exit 1 - fi - - LOG_INFO "输出文件 output.png 存在,符合预期" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf output.png output-*.png - - # 如果测试前未安装,则卸载 poppler-utils - if [ "$already_installed" = false ]; then - uninstall_package poppler-utils - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_svg.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_svg.sh deleted file mode 100644 index 382cf91052f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_svg.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo生成SVG文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftocairo生成SVG文件的功能" - LOG_INFO "1. 检查环境是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils软件包已安装,脚本结束将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils软件包未安装,将在测试步骤中安装" - INSTALLED_BEFORE=false - fi - - LOG_INFO "2. 检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "3. 检查pdftocairo命令是否支持svg参数" - if ! pdftocairo --help 2>&1 | grep -q "\-\-svg"; then - LOG_ERROR "pdftocairo命令不支持svg参数" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "4. 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "5. 准备测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 100 100] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 25 - >> - stream - BT - /F1 12 Tf - 50 50 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000009 00000 n - 0000000052 00000 n - 0000000100 00000 n - 0000000178 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 252 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "6. 使用pdftocairo生成SVG文件" - pdftocairo -svg test_input.pdf test_output.svg - CHECK_RESULT $? 0 0 "pdftocairo生成SVG文件失败" - - LOG_INFO "7. 检查生成的SVG文件是否存在" - if [ -f test_output.svg ]; then - LOG_INFO "SVG文件生成成功" - else - LOG_ERROR "SVG文件生成失败" - exit 1 - fi - - LOG_INFO "8. 检查生成的SVG文件内容" - if head -n 1 test_output.svg | grep -q "/dev/null - CHECK_RESULT $? 0 0 "yum源中不存在${PACKAGE_NAME}软件包" - } - - # 检查软件包是否已安装 - check_package_installed() { - LOG_INFO "检查${PACKAGE_NAME}是否已安装" - rpm -q ${PACKAGE_NAME} &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "${PACKAGE_NAME}已安装" - return 0 - else - LOG_INFO "${PACKAGE_NAME}未安装" - return 1 - fi - } - - # 安装软件包 - install_package() { - LOG_INFO "开始安装${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - } - - # 卸载软件包 - uninstall_package() { - LOG_INFO "开始卸载${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - } - - # 检查命令参数是否支持 - check_command_options() { - LOG_INFO "检查pdftocairo命令是否支持-tiff参数" - ${COMMAND_NAME} -help 2>&1 | grep -q "\-tiff" - CHECK_RESULT $? 0 0 "pdftocairo命令不支持-tiff参数" - } - - # 检查测试PDF文件是否存在 - check_test_pdf() { - LOG_INFO "检查测试PDF文件是否存在" - if [ ! -f "${TEST_PDF}" ]; then - LOG_ERROR "测试PDF文件不存在: ${TEST_PDF}" - return 1 - fi - return 0 - } - - # 执行pdftocairo生成TIFF测试 - run_pdftocairo_test() { - LOG_INFO "执行pdftocairo生成TIFF图片文件测试" - - # 清理可能存在的旧输出文件 - rm -f ${TEST_TIFF_OUTPUT} - - # 执行pdftocairo命令生成TIFF - ${COMMAND_NAME} -tiff ${TEST_PDF} ${TEST_TIFF_OUTPUT%.tiff} - CHECK_RESULT $? 0 0 "pdftocairo生成TIFF文件失败" - - # 检查生成的TIFF文件是否存在 - LOG_INFO "检查生成的TIFF文件是否存在" - if [ ! -f "${TEST_TIFF_OUTPUT}" ]; then - LOG_ERROR "未找到生成的TIFF文件: ${TEST_TIFF_OUTPUT}" - return 1 - fi - - # 检查TIFF文件是否有效(简单检查文件大小) - LOG_INFO "检查生成的TIFF文件是否有效" - local file_size=$(stat -c%s "${TEST_TIFF_OUTPUT}" 2>/dev/null) - if [ -z "${file_size}" ] || [ "${file_size}" -eq 0 ]; then - LOG_ERROR "生成的TIFF文件大小为0或无效" - return 1 - fi - - LOG_INFO "成功生成TIFF文件,文件大小: ${file_size}字节" - return 0 - } - - # 清理测试环境 - cleanup_test_env() { - LOG_INFO "清理测试环境" - rm -f ${TEST_TIFF_OUTPUT} - } - - # 主测试流程 - main() { - LOG_INFO "开始测试pdftocairo生成TIFF图片文件的功能" - - # 检查yum源中是否有软件包 - check_package_in_repo - - # 检查软件包是否已安装 - local was_installed=false - check_package_installed - if [ $? -ne 0 ]; then - # 未安装,需要安装 - install_package - else - was_installed=true - fi - - # 检查命令参数 - check_command_options - - # 检查测试PDF文件 - check_test_pdf - CHECK_RESULT $? 0 0 "缺少测试PDF文件" - - # 执行测试 - run_pdftocairo_test - CHECK_RESULT $? 0 0 "pdftocairo生成TIFF测试失败" - - # 清理测试文件 - cleanup_test_env - - # 如果测试前未安装,则卸载软件包 - if [ "${was_installed}" = "false" ]; then - uninstall_package - else - LOG_INFO "测试前软件包已安装,保持安装状态" - fi - - LOG_INFO "pdftocairo生成TIFF图片文件功能测试完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_transp.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_transp.sh deleted file mode 100644 index ef862418ad5..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_transp.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo为PNG图片生成透明背景的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - already_installed=1 - LOG_INFO "poppler-utils已经安装,测试结束后将保持安装状态" - else - already_installed=0 - LOG_INFO "poppler-utils未安装,将在测试前安装,测试后卸载" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftocairo命令是否支持-transp参数 - LOG_INFO "检查pdftocairo命令是否支持-transp参数" - pdftocairo -h 2>&1 | grep -q -- "-transp" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不支持-transp参数" - # 如果是新安装的,需要卸载 - if [ $already_installed -eq 0 ]; then - dnf remove -y poppler-utils >/dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 200 200] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 100 100 Td - (Test) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000175 00000 n - 0000000306 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 396 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftocairo生成带透明背景的PNG图片 - LOG_INFO "使用pdftocairo生成带透明背景的PNG图片" - pdftocairo -png -transp test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftocairo生成PNG图片失败" - - # 检查生成的PNG图片是否存在 - LOG_INFO "检查生成的PNG图片是否存在" - if [ ! -f "test_output-1.png" ]; then - LOG_ERROR "未生成PNG图片文件" - # 清理临时文件 - rm -f test_input.pdf test_output*.png - # 如果是新安装的,需要卸载 - if [ $already_installed -eq 0 ]; then - dnf remove -y poppler-utils >/dev/null 2>&1 - fi - exit 1 - fi - - # 检查PNG图片是否支持透明度(通过检查文件是否包含透明度通道) - LOG_INFO "检查PNG图片是否支持透明度" - if command -v identify >/dev/null 2>&1; then - # 使用ImageMagick的identify命令检查透明度 - transparency_info=$(identify -verbose test_output-1.png 2>/dev/null | grep -i "alpha" || echo "") - if [ -z "$transparency_info" ]; then - LOG_ERROR "生成的PNG图片不支持透明度" - # 清理临时文件 - rm -f test_input.pdf test_output*.png - # 如果是新安装的,需要卸载 - if [ $already_installed -eq 0 ]; then - dnf remove -y poppler-utils >/dev/null 2>&1 - fi - exit 1 - else - LOG_INFO "PNG图片支持透明度:$transparency_info" - fi - else - LOG_INFO "未安装ImageMagick,跳过透明度详细检查" - LOG_INFO "已成功生成PNG图片:test_output-1.png" - fi - - # 清理临时文件 - LOG_INFO "清理测试生成的临时文件" - rm -f test_input.pdf test_output*.png - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试pdftocairo为PNG图片生成透明背景功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_upper_q.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_upper_q.sh deleted file mode 100644 index beb855d9a4e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_upper_q.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo静默模式(不输出信息)的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在" - PACKAGE_INSTALLED="true" - else - LOG_INFO "poppler-utils未安装,标记为未安装" - PACKAGE_INSTALLED="false" - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$PACKAGE_INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftocairo命令是否存在 - LOG_INFO "检查pdftocairo命令是否存在" - which pdftocairo > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo命令不存在" - exit 255 - fi - - # 检查pdftocairo是否支持-q参数 - LOG_INFO "检查pdftocairo是否支持-q参数" - pdftocairo -q --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftocairo不支持-q参数" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << /Size 4 /Root 1 0 R >> - startxref - 149 - %%EOF" > test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftocairo静默模式功能 - LOG_INFO "测试pdftocairo静默模式功能" - pdftocairo -q -png test.pdf output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo静默模式执行失败" - - # 检查是否生成了输出文件 - LOG_INFO "检查是否生成了输出文件" - ls output-1.png > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成输出文件" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载poppler-utils - if [ "$PACKAGE_INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_upper_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_upper_v.sh deleted file mode 100644 index 1f7eb2eb6f6..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftocairo_upper_v.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdftocairo打印版本和版权信息的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装" - INSTALLED=true - else - LOG_INFO "poppler-utils软件包未安装" - INSTALLED=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 测试pdftocairo打印版本信息的功能 - LOG_INFO "测试pdftocairo打印版本信息的功能" - pdftocairo -v > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftocairo命令不支持-v参数或执行失败" - - # 测试pdftocairo打印版权信息的功能 - LOG_INFO "测试pdftocairo打印版权信息的功能" - pdftocairo -copyright > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdftocairo命令不支持-copyright参数" - exit 255 - fi - CHECK_RESULT $? 0 0 "pdftocairo命令执行-copyright参数失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml__help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml__help.sh deleted file mode 100644 index 44027957195..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml__help.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试--help参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils未安装,标记为未安装状态" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "开始安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 检查pdftohtml命令是否支持--help参数 - LOG_INFO "检查pdftohtml命令是否支持--help参数" - pdftohtml --help >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "pdftohtml命令支持--help参数" - else - LOG_ERROR "pdftohtml命令不支持--help参数" - # 如果未安装,需要卸载已安装的软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 测试--help参数,打印使用信息 - LOG_INFO "测试--help参数,打印使用信息" - pdftohtml --help - CHECK_RESULT $? 0 0 "执行pdftohtml --help失败" - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_c.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_c.sh deleted file mode 100644 index 0780e3d824b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_c.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-c参数,生成复杂文档 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils软件包的pdftohtml命令的-c参数" - - LOG_INFO "检查系统中是否已安装poppler-utils" - if ! dnf list installed poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_DURING_TEST=1 - else - LOG_INFO "poppler-utils已安装" - INSTALLED_DURING_TEST=0 - fi - - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查pdftohtml命令是否支持-c参数" - if ! pdftohtml -h 2>&1 | grep -q "\-c"; then - LOG_ERROR "pdftohtml命令不支持-c参数" - exit 255 - fi - - if [ $INSTALLED_DURING_TEST -eq 1 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 100 700 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000174 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "使用-c参数执行pdftohtml命令生成复杂文档" - pdftohtml -c test_input.pdf test_output.html - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - - LOG_INFO "检查生成的HTML文件是否存在" - if [ -f "test_output.html" ]; then - LOG_INFO "成功生成HTML文件" - else - LOG_ERROR "未找到生成的HTML文件" - exit 1 - fi - - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.html test_outputs.html - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $INSTALLED_DURING_TEST -eq 1 ]; then - LOG_INFO "卸载测试期间安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_dataurls.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_dataurls.sh deleted file mode 100644 index 114688e160a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_dataurls.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-dataurls参数,在HTML中使用data URL而非外部图片 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftohtml的-dataurls参数功能" - LOG_INFO "步骤1:检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils" - rpm -q poppler-utils &>/dev/null - installed=$? - - if [ $installed -ne 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - else - LOG_INFO "poppler-utils已安装,跳过安装步骤" - fi - - LOG_INFO "步骤4:检查pdftohtml命令是否支持-dataurls参数" - pdftohtml -h 2>&1 | grep -q "\-dataurls" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-dataurls参数" - if [ $installed -ne 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤5:创建测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 281 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6:使用-dataurls参数将PDF转换为HTML" - pdftohtml -dataurls test_input.pdf test_output.html - CHECK_RESULT $? 0 0 "pdftohtml转换失败" - - LOG_INFO "步骤7:验证生成的HTML是否包含data URL" - if [ -f test_output.html ]; then - grep -q "data:image" test_output.html - CHECK_RESULT $? 0 0 "HTML中未找到data URL,参数功能异常" - LOG_INFO "成功验证HTML中包含data URL" - else - LOG_ERROR "未生成输出HTML文件" - CHECK_RESULT 1 0 1 "HTML文件生成失败" - fi - - LOG_INFO "步骤8:清理测试文件" - rm -f test_input.pdf test_output.html test_outputs/* 2>/dev/null - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $installed -ne 0 ]; then - LOG_INFO "步骤9:恢复环境,卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_enc.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_enc.sh deleted file mode 100644 index 0641e71171b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_enc.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-enc参数,指定输出文本编码名称 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试-enc参数,指定输出文本编码名称" - LOG_INFO "检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查当前环境是否已安装poppler-utils" - rpm -q poppler-utils &>/dev/null - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "poppler-utils已安装" - else - INSTALLED="false" - LOG_INFO "poppler-utils未安装" - fi - - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "检查pdftohtml命令是否支持-enc参数" - pdftohtml -h 2>&1 | grep -q "\-enc" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-enc参数" - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "准备测试文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000009 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000201 00000 n - 0000000280 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 357 - %%EOF - EOF - - LOG_INFO "使用-enc参数指定UTF-8编码转换PDF为HTML" - pdftohtml -enc UTF-8 test_input.pdf test_output 2>&1 - CHECK_RESULT $? 0 0 "使用-enc UTF-8参数执行pdftohtml失败" - - LOG_INFO "检查生成的HTML文件是否存在" - [ -f test_output.html ] - CHECK_RESULT $? 0 0 "未生成test_output.html文件" - - LOG_INFO "检查HTML文件编码声明" - grep -i "charset=utf-8" test_output.html - CHECK_RESULT $? 0 0 "HTML文件未包含UTF-8编码声明" - - LOG_INFO "使用-enc参数指定ISO-8859-1编码转换PDF为HTML" - pdftohtml -enc ISO-8859-1 test_input.pdf test_output2 2>&1 - CHECK_RESULT $? 0 0 "使用-enc ISO-8859-1参数执行pdftohtml失败" - - LOG_INFO "检查第二个HTML文件编码声明" - grep -i "charset=iso-8859-1" test_output2.html - CHECK_RESULT $? 0 0 "第二个HTML文件未包含ISO-8859-1编码声明" - - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.html test_output2.html test_outputs.html test_output2s.html - - if [ "$INSTALLED" == "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_f.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_f.sh deleted file mode 100644 index 516ad568120..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_f.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-f参数,指定转换的起始页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:测试-f参数,指定转换的起始页码" - - LOG_INFO "步骤1:检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查pdftohtml命令是否支持-f参数" - if ! pdftohtml -h 2>&1 | grep -q -- "-f"; then - LOG_ERROR "pdftohtml命令不支持-f参数" - exit 255 - fi - - LOG_INFO "步骤3:检查poppler-utils是否已安装" - if ! rpm -q poppler-utils &>/dev/null; then - LOG_INFO "软件包未安装,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - INSTALLED=1 - else - LOG_INFO "软件包已安装" - INSTALLED=0 - fi - - LOG_INFO "步骤4:准备测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 22 - >> - stream - BT /F1 12 Tf (Page 1) Tj ET - endstream - endobj - 6 0 obj - << - /Length 22 - >> - stream - BT /F1 12 Tf (Page 2) Tj ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000151 00000 n - 0000000200 00000 n - 0000000249 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 298 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤5:使用-f参数从第2页开始转换" - pdftohtml -f 2 test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - - LOG_INFO "步骤6:验证转换结果" - if [ -f "test_output.html" ]; then - if grep -q "Page 2" test_output.html; then - LOG_INFO "转换结果正确,包含第二页内容" - else - LOG_ERROR "转换结果不正确,未找到第二页内容" - CHECK_RESULT 1 0 0 "转换结果验证失败" - fi - else - LOG_ERROR "未生成输出文件" - CHECK_RESULT 1 0 0 "输出文件生成失败" - fi - - LOG_INFO "步骤7:清理测试文件" - rm -f test_input.pdf test_output.html test_output-*.html 2>/dev/null - - LOG_INFO "步骤8:恢复环境" - if [ "$INSTALLED" -eq 1 ]; then - LOG_INFO "卸载测试安装的软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_fmt.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_fmt.sh deleted file mode 100644 index 8921b044e0b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_fmt.sh +++ /dev/null @@ -1,229 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-fmt参数,指定Splash输出的图片文件格式(png或jpg) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $1" - } - LOG_ERROR() { - echo "[ERROR] $1" - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package_name=$1 - dnf list available "$package_name" &>/dev/null - return $? - } - - # 检查命令参数是否支持 - check_command_option() { - local command=$1 - local option=$2 - $command --help 2>&1 | grep -q -- "$option" - return $? - } - - # 清理函数 - cleanup() { - LOG_INFO "开始清理环境" - if [[ $originally_installed -eq 0 ]]; then - LOG_INFO "原始环境未安装poppler-utils,执行卸载" - dnf remove -y poppler-utils &>/dev/null - if [[ $? -ne 0 ]]; then - LOG_ERROR "卸载poppler-utils失败" - exit 1 - fi - LOG_INFO "成功卸载poppler-utils" - else - LOG_INFO "原始环境已安装poppler-utils,保持安装状态" - fi - LOG_INFO "环境清理完成" - } - - # 主测试函数 - main() { - LOG_INFO "开始测试pdftohtml -fmt参数功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! check_package_in_repo "poppler-utils"; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - LOG_INFO "yum源中存在poppler-utils软件包" - - # 检查当前是否已安装poppler-utils - LOG_INFO "检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - originally_installed=1 - LOG_INFO "当前环境已安装poppler-utils" - else - originally_installed=0 - LOG_INFO "当前环境未安装poppler-utils" - fi - - # 如果未安装,则安装软件包 - if [[ $originally_installed -eq 0 ]]; then - LOG_INFO "开始安装poppler-utils" - dnf install -y poppler-utils &>/dev/null - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "成功安装poppler-utils" - fi - - # 检查-fmt参数是否支持 - LOG_INFO "检查pdftohtml命令是否支持-fmt参数" - if ! check_command_option "pdftohtml" "-fmt"; then - LOG_ERROR "pdftohtml命令不支持-fmt参数" - if [[ $originally_installed -eq 0 ]]; then - dnf remove -y poppler-utils &>/dev/null - fi - exit 255 - fi - LOG_INFO "pdftohtml命令支持-fmt参数" - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000200 00000 n - 0000000282 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试-fmt png参数 - LOG_INFO "测试-fmt png参数" - pdftohtml -fmt png test.pdf test_png &>/dev/null - CHECK_RESULT $? 0 0 "执行pdftohtml -fmt png失败" - - # 检查是否生成了png文件 - LOG_INFO "检查是否生成了PNG格式的图片文件" - if ls test_png*.png &>/dev/null; then - LOG_INFO "成功生成PNG格式的图片文件" - # 清理生成的测试文件 - rm -f test_png* test.html 2>/dev/null - else - LOG_ERROR "未生成PNG格式的图片文件" - # 清理生成的测试文件 - rm -f test_png* test.html test.pdf 2>/dev/null - cleanup - exit 1 - fi - - # 测试-fmt jpg参数 - LOG_INFO "测试-fmt jpg参数" - pdftohtml -fmt jpg test.pdf test_jpg &>/dev/null - CHECK_RESULT $? 0 0 "执行pdftohtml -fmt jpg失败" - - # 检查是否生成了jpg文件 - LOG_INFO "检查是否生成了JPG格式的图片文件" - if ls test_jpg*.jpg &>/dev/null; then - LOG_INFO "成功生成JPG格式的图片文件" - # 清理生成的测试文件 - rm -f test_jpg* test.html 2>/dev/null - else - LOG_ERROR "未生成JPG格式的图片文件" - # 清理生成的测试文件 - rm -f test_jpg* test.html test.pdf 2>/dev/null - cleanup - exit 1 - fi - - # 清理测试PDF文件 - LOG_INFO "清理测试PDF文件" - rm -f test.pdf 2>/dev/null - - LOG_INFO "测试-fmt参数功能完成" - - # 执行环境清理 - cleanup - - LOG_INFO "所有测试步骤完成" - } - - # 设置异常处理 - trap cleanup EXIT INT TERM - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_fontfullname.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_fontfullname.sh deleted file mode 100644 index 2a54ca82b38..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_fontfullname.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-fontfullname参数,输出字体全名 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "检查yum源中是否包含poppler-utils软件包" - if ! dnf list poppler-utils >/dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查当前环境是否已安装poppler-utils" - if rpm -q poppler-utils >/dev/null 2>&1; then - INSTALLED="true" - LOG_INFO "poppler-utils已安装,测试完成后将保持安装状态" - else - INSTALLED="false" - LOG_INFO "poppler-utils未安装,将在测试前安装" - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "检查pdftohtml命令的-fontfullname参数是否存在" - if ! pdftohtml -h 2>&1 | grep -q -- "-fontfullname"; then - LOG_ERROR "pdftohtml命令不支持-fontfullname参数" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "创建一个简单的PDF测试文件" - cat > test_font.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000105 00000 n - 0000000172 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 402 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建PDF测试文件失败" - - LOG_INFO "使用-fontfullname参数运行pdftohtml命令" - pdftohtml -fontfullname test_font.pdf output_font > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - - LOG_INFO "检查生成的HTML文件是否包含字体全名信息" - if grep -i "helvetica" output_font.html >/dev/null 2>&1; then - LOG_INFO "成功在输出中检测到字体全名信息" - CHECK_RESULT 0 0 0 "字体全名信息检查" - else - LOG_ERROR "在输出中未检测到预期的字体全名信息" - CHECK_RESULT 1 0 0 "字体全名信息检查失败" - fi - - LOG_INFO "清理测试生成的临时文件" - rm -f test_font.pdf output_font.html output_fonts.html - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils软件包的安装状态" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_h.sh deleted file mode 100644 index 86f738297fe..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_h.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-h参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 poppler-utils 包中 pdftohtml 命令的 -h 参数功能" - LOG_INFO "检查系统中是否已安装 poppler-utils 软件包" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "检测到 poppler-utils 已安装,测试后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "未检测到 poppler-utils 安装,将在测试前安装" - INSTALLED=0 - fi - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - LOG_INFO "开始安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - LOG_INFO "检查 pdftohtml 命令 -h 参数是否存在" - if ! pdftohtml -h &> /dev/null; then - LOG_ERROR "pdftohtml 命令不支持 -h 参数或参数不存在" - exit 255 - fi - LOG_INFO "执行 pdftohtml -h 命令" - pdftohtml -h - CHECK_RESULT $? 0 0 "执行 pdftohtml -h 命令失败" - LOG_INFO "验证 -h 参数输出了使用信息" - if pdftohtml -h 2>&1 | head -5 | grep -q "Usage:"; then - LOG_INFO "pdftohtml -h 成功打印了使用信息" - else - LOG_ERROR "pdftohtml -h 未输出预期的使用信息" - exit 1 - fi - LOG_INFO "清理测试环境" - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "卸载测试安装的 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "保持 poppler-utils 的安装状态" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_help.sh deleted file mode 100644 index 41abaf14f9f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_help.sh +++ /dev/null @@ -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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-help参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftohtml命令的-help参数" - LOG_INFO "检查系统中是否已安装poppler-utils软件包" - - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils软件包已安装,标记为需要保持安装状态" - keep_installed=true - else - LOG_INFO "poppler-utils软件包未安装,标记为测试后需要卸载" - keep_installed=false - fi - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ "$keep_installed" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "执行pdftohtml --help命令" - pdftohtml --help > /tmp/pdftohtml_help_output.txt 2>&1 - CHECK_RESULT $? 0 0 "执行pdftohtml --help命令失败" - - LOG_INFO "检查输出中是否包含使用信息" - if grep -q "Usage:" /tmp/pdftohtml_help_output.txt; then - LOG_INFO "pdftohtml --help命令成功打印使用信息" - else - LOG_ERROR "pdftohtml --help命令输出中未找到使用信息" - exit 1 - fi - - LOG_INFO "清理临时文件" - rm -f /tmp/pdftohtml_help_output.txt - - if [ "$keep_installed" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "环境已恢复到测试前状态" - else - LOG_INFO "保持poppler-utils软件包的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_hidden.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_hidden.sh deleted file mode 100644 index 47b54fddde5..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_hidden.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-hidden参数,输出隐藏文本 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - installed=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - installed=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$installed" = false ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Visible Text) Tj - ET - BT - /F1 12 Tf - 72 700 Td - (Hidden Text) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000154 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 204 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftohtml命令的-hidden参数 - LOG_INFO "测试pdftohtml命令的-hidden参数" - pdftohtml -hidden test_input.pdf test_output >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败,可能不支持-hidden参数" - - # 检查输出文件是否包含隐藏文本 - LOG_INFO "检查输出文件是否包含隐藏文本" - if [ -f test_output.html ]; then - grep -q "Hidden Text" test_output.html - CHECK_RESULT $? 0 0 "输出文件未包含隐藏文本" - LOG_INFO "输出文件包含隐藏文本,测试通过" - else - LOG_ERROR "未生成输出文件test_output.html" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.html test_output-1.html >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ "$installed" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "环境已恢复到测试前的状态" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试-hidden参数,输出隐藏文本测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_i.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_i.sh deleted file mode 100644 index 607ffb53a8c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_i.sh +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-i参数,忽略图片 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试poppler-utils的pdftohtml命令的-i参数(忽略图片)" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "检查系统是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED_BEFORE_TEST=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftohtml命令是否支持-i参数 - LOG_INFO "检查pdftohtml命令是否支持-i参数" - if ! pdftohtml -h 2>&1 | grep -q "\-i"; then - LOG_ERROR "pdftohtml命令不支持-i参数" - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /XObject << - /Im1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /XObject - /Subtype /Image - /Width 100 - /Height 100 - /ColorSpace /DeviceRGB - /BitsPerComponent 8 - /Length 6 - >> - stream - \xff\xd8\xff\xe0\x00\x10JFIF - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000208 00000 n - 0000000308 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 396 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftohtml的-i参数 - LOG_INFO "测试pdftohtml -i参数(忽略图片)" - pdftohtml -i test_input.pdf output.html - CHECK_RESULT $? 0 0 "pdftohtml -i执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出HTML文件是否生成" - [ -f output.html ] - CHECK_RESULT $? 0 0 "输出HTML文件未生成" - - # 检查输出文件是否包含图片引用(不应该包含) - LOG_INFO "检查输出HTML文件是否不包含图片引用" - if grep -q " /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,测试前将进行安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftohtml命令是否支持-l参数 - LOG_INFO "检查pdftohtml命令是否支持-l参数" - pdftohtml -h 2>&1 | grep -q "\-l" - CHECK_RESULT $? 0 0 "pdftohtml命令不支持-l参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-l参数" - exit 255 - fi - - # 创建一个测试用的PDF文件 - LOG_INFO "创建一个测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000009 00000 n - 0000000056 00000 n - 0000000113 00000 n - 0000000170 00000 n - 0000000300 00000 n - 0000000370 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 440 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftohtml命令的-l参数,指定转换的结束页码 - LOG_INFO "测试pdftohtml命令的-l参数,指定转换的结束页码为1" - pdftohtml -l 1 test_input.pdf test_output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - - # 检查转换结果,应该只有第一页 - LOG_INFO "检查转换结果,应该只有第一页" - if [ -f test_output.html ]; then - grep -q "Page 1" test_output.html - CHECK_RESULT $? 0 0 "转换结果中未找到第一页内容" - grep -q "Page 2" test_output.html - if [ $? -eq 0 ]; then - LOG_ERROR "转换结果中包含第二页内容,不符合预期" - exit 1 - else - LOG_INFO "转换结果中未包含第二页内容,符合预期" - fi - else - LOG_ERROR "未生成输出文件test_output.html" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.html test_outputs.html 2>/dev/null - - # 如果测试前未安装,则卸载poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_nodrm.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_nodrm.sh deleted file mode 100644 index 2c76c906d31..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_nodrm.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-nodrm参数,覆盖文档DRM设置 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试-nodrm参数,覆盖文档DRM设置" - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有$PACKAGE_NAME软件包" - dnf list available "$PACKAGE_NAME" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有$PACKAGE_NAME软件包" - exit 255 - fi - - # 检查是否已安装软件包 - LOG_INFO "检查是否已安装$PACKAGE_NAME软件包" - if rpm -q "$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 - - # 检查pdftohtml命令是否支持-nodrm参数 - LOG_INFO "检查pdftohtml命令是否支持-nodrm参数" - pdftohtml -h 2>&1 | grep -q "\-nodrm" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-nodrm参数" - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载$PACKAGE_NAME软件包" - dnf remove -y "$PACKAGE_NAME" - fi - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试PDF文件" - cat > test_drm.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF with DRM) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 256 - %%EOF - EOF - - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftohtml命令的-nodrm参数 - LOG_INFO "测试pdftohtml命令的-nodrm参数" - pdftohtml -nodrm test_drm.pdf test_output - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - if [ -f "test_output.html" ]; then - LOG_INFO "输出文件test_output.html已生成" - else - LOG_ERROR "输出文件test_output.html未生成" - CHECK_RESULT 1 0 1 "输出文件未生成" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_drm.pdf test_output.html test_outputs/* 2>/dev/null - rm -rf test_outputs 2>/dev/null - - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载$PACKAGE_NAME软件包" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_noframes.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_noframes.sh deleted file mode 100644 index 0a34b541d67..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_noframes.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-noframes参数,不生成框架 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装poppler-utils软件包 - LOG_INFO "检查是否已经安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已经安装" - already_installed=1 - else - LOG_INFO "poppler-utils软件包未安装" - already_installed=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftohtml命令是否存在 - LOG_INFO "检查pdftohtml命令是否存在" - which pdftohtml > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不存在" - exit 255 - fi - - # 检查pdftohtml命令是否支持-noframes参数 - LOG_INFO "检查pdftohtml命令是否支持-noframes参数" - pdftohtml -h 2>&1 | grep -q "\-noframes" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-noframes参数" - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建一个简单的PDF文件用于测试" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 281 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建PDF文件失败" - - # 使用-noframes参数将PDF转换为HTML - LOG_INFO "使用-noframes参数将PDF转换为HTML" - pdftohtml -noframes test.pdf test_output - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - - # 检查生成的HTML文件是否包含框架相关标签 - LOG_INFO "检查生成的HTML文件是否包含框架相关标签" - if [ -f test_output.html ]; then - grep -i " /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "生成的HTML文件包含框架相关标签" - CHECK_RESULT 1 0 0 "测试失败:生成的HTML文件包含框架相关标签" - else - LOG_INFO "生成的HTML文件不包含框架相关标签,符合预期" - CHECK_RESULT 0 0 0 "测试成功:生成的HTML文件不包含框架相关标签" - fi - else - LOG_ERROR "未找到生成的HTML文件" - CHECK_RESULT 1 0 0 "测试失败:未找到生成的HTML文件" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_output.html test_output-*.png test_output-*.jpg > /dev/null 2>&1 - - # 如果之前未安装,则卸载poppler-utils软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_nomerge.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_nomerge.sh deleted file mode 100644 index d631110ba7d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_nomerge.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-nomerge参数,不合并段落 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 poppler-utils 的 pdftohtml 命令的 -nomerge 参数" - - LOG_INFO "步骤1:检查 yum 源中是否有 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已安装 poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,标记为已存在安装" - already_installed=true - else - LOG_INFO "poppler-utils 未安装,标记为需要后续卸载" - already_installed=false - fi - - if [ "$already_installed" = "false" ]; then - LOG_INFO "步骤3:安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "步骤4:检查 pdftohtml 命令是否支持 -nomerge 参数" - if ! pdftohtml -h 2>&1 | grep -q -- "-nomerge"; then - LOG_ERROR "pdftohtml 命令不支持 -nomerge 参数" - exit 255 - fi - - LOG_INFO "步骤5:创建一个简单的测试 PDF 文件用于转换" - cat > /tmp/test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << - /Font << - /F1 4 0 R - >> - >> - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 100 700 Td - (Test Paragraph 1) Tj - ET - BT - /F1 12 Tf - 100 680 Td - (Test Paragraph 2) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000208 00000 n - 0000000283 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 387 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤6:使用 -nomerge 参数将 PDF 转换为 HTML" - pdftohtml -nomerge /tmp/test_input.pdf /tmp/test_output - CHECK_RESULT $? 0 0 "使用 -nomerge 参数转换 PDF 失败" - - LOG_INFO "步骤7:检查生成的 HTML 文件是否包含多个段落(不合并)" - if grep -q "Test Paragraph 1" /tmp/test_output.html && grep -q "Test Paragraph 2" /tmp/test_output.html; then - LOG_INFO "生成的 HTML 包含多个段落,符合 -nomerge 参数预期" - else - LOG_ERROR "生成的 HTML 可能合并了段落,不符合 -nomerge 参数预期" - exit 1 - fi - - LOG_INFO "步骤8:清理测试生成的临时文件" - rm -f /tmp/test_input.pdf /tmp/test_output.html /tmp/test_output.xml /tmp/test_outputs.html 2>/dev/null || true - - if [ "$already_installed" = "false" ]; then - LOG_INFO "步骤9:卸载测试安装的 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "步骤9:系统原本已安装 poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_noroundcoord.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_noroundcoord.sh deleted file mode 100644 index f37c43daf6c..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_noroundcoord.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-noroundcoord参数,不四舍五入坐标(仅限XML输出) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - installed=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - installed=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$installed" = false ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftohtml命令是否支持-noroundcoord参数 - LOG_INFO "检查pdftohtml命令是否支持-noroundcoord参数" - pdftohtml -h 2>&1 | grep -q "\-noroundcoord" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-noroundcoord参数" - # 如果之前未安装,需要卸载 - if [ "$installed" = false ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000162 00000 n - 0000000258 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 350 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建PDF文件失败" - - # 测试-noroundcoord参数,生成XML输出 - LOG_INFO "测试pdftohtml -noroundcoord参数,生成XML输出" - pdftohtml -xml -noroundcoord test.pdf test_output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "执行pdftohtml命令失败" - - # 检查生成的XML文件是否存在 - LOG_INFO "检查生成的XML文件" - if [ -f test_output.xml ]; then - LOG_INFO "XML文件生成成功" - # 检查XML文件中是否包含未四舍五入的坐标 - # 这里简单检查文件是否包含坐标信息 - if grep -q "top=\|left=\|width=\|height=" test_output.xml; then - LOG_INFO "XML文件中包含坐标信息" - else - LOG_ERROR "XML文件中未找到坐标信息" - # 清理测试文件 - rm -f test.pdf test_output.html test_output.xml > /dev/null 2>&1 - # 如果之前未安装,需要卸载 - if [ "$installed" = false ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 1 - fi - else - LOG_ERROR "XML文件未生成" - # 清理测试文件 - rm -f test.pdf test_output.html test_output.xml > /dev/null 2>&1 - # 如果之前未安装,需要卸载 - if [ "$installed" = false ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_output.html test_output.xml > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试开始时未安装,则卸载poppler-utils - if [ "$installed" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_opw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_opw.sh deleted file mode 100644 index 29223fa0c92..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_opw.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-opw参数,指定所有者密码(用于加密文件) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试-opw参数,指定所有者密码(用于加密文件) - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available ${PACKAGE_NAME} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在${PACKAGE_NAME}软件包" - exit 255 - fi - - # 检查是否已安装软件包 - LOG_INFO "检查系统是否已安装${PACKAGE_NAME}软件包" - rpm -q ${PACKAGE_NAME} &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "系统已安装${PACKAGE_NAME}软件包,脚本结束后将保持安装状态" - INSTALLED_BEFORE="yes" - else - LOG_INFO "系统未安装${PACKAGE_NAME}软件包,将在测试过程中安装" - INSTALLED_BEFORE="no" - fi - - # 如果未安装,则安装软件包 - if [ "${INSTALLED_BEFORE}" = "no" ]; then - LOG_INFO "安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - fi - - # 创建测试文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000174 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftohtml命令的-opw参数 - LOG_INFO "测试pdftohtml命令的-opw参数(指定所有者密码)" - pdftohtml -opw "ownerpassword123" test_input.pdf test_output.html 2>/dev/null - # 注意:由于测试文件未加密,使用-opw参数可能会失败,但我们需要检查命令是否支持该参数 - # 先检查命令是否支持-opw参数 - pdftohtml -h 2>&1 | grep -q -- "-opw" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-opw参数" - # 清理测试文件 - rm -f test_input.pdf test_output.html test_output-html.html 2>/dev/null - # 如果之前未安装,则卸载软件包 - if [ "${INSTALLED_BEFORE}" = "no" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - fi - exit 255 - fi - - # 检查命令执行结果 - # 由于测试文件未加密,使用-opw参数可能会产生非零退出码,这是预期行为 - # 我们主要验证命令能够识别并处理-opw参数 - LOG_INFO "验证pdftohtml命令能够处理-opw参数" - if [ -f "test_output.html" ] || [ -f "test_output-html.html" ]; then - LOG_INFO "pdftohtml命令成功处理-opw参数并生成输出文件" - CHECK_RESULT $? 0 0 "pdftohtml命令处理-opw参数失败" - else - # 检查错误输出中是否包含密码相关错误(对于未加密文件使用-opw的预期行为) - LOG_INFO "检查pdftohtml命令对未加密文件使用-opw参数的预期行为" - # 重新执行命令以捕获错误输出 - ERROR_OUTPUT=$(pdftohtml -opw "ownerpassword123" test_input.pdf test_output2.html 2>&1) - echo "${ERROR_OUTPUT}" | grep -q -i "password\|encrypt\|error" - if [ $? -eq 0 ]; then - LOG_INFO "pdftohtml命令正确响应-opw参数(对未加密文件返回错误)" - CHECK_RESULT $? 0 0 "pdftohtml命令未正确处理-opw参数" - else - LOG_ERROR "pdftohtml命令未正确响应-opw参数" - CHECK_RESULT $? 0 1 "pdftohtml命令行为异常" - fi - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.html test_output-html.html test_output2.html test_output2-html.html 2>/dev/null - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "${INSTALLED_BEFORE}" = "no" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - else - LOG_INFO "保持${PACKAGE_NAME}软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_p.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_p.sh deleted file mode 100644 index 1d4a2430e52..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_p.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-p参数,将.pdf链接替换为.html链接 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils的pdftohtml命令的-p参数功能" - LOG_INFO "步骤1:检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装,并在脚本结束前卸载" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包,测试无法继续" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "步骤4:检查pdftohtml命令是否支持-p参数" - pdftohtml --help 2>&1 | grep -q "\-p" - CHECK_RESULT $? 0 0 "pdftohtml命令不支持-p参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-p参数,测试无法继续" - if [ "$INSTALLED" = "false" ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - LOG_INFO "步骤5:准备测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 256 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6:执行pdftohtml命令,使用-p参数将.pdf链接替换为.html链接" - pdftohtml -p test_input.pdf test_output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "执行pdftohtml命令失败" - - LOG_INFO "步骤7:检查生成的HTML文件是否包含.html链接" - if [ -f test_output.html ]; then - grep -q "\.html" test_output.html - CHECK_RESULT $? 0 0 "生成的HTML文件中未找到.html链接,-p参数可能未生效" - else - LOG_ERROR "未找到生成的HTML文件test_output.html" - CHECK_RESULT 1 0 0 "未找到生成的HTML文件" - fi - - LOG_INFO "步骤8:清理测试生成的文件" - rm -f test_input.pdf test_output.html test_outputs.html 2>/dev/null - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤9:卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_q.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_q.sh deleted file mode 100644 index 2f4a9189e22..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_q.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-q参数,不打印任何消息或错误 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils软件包的pdftohtml命令的-q参数" - LOG_INFO "步骤1:检查系统中是否已安装poppler-utils软件包" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:检查pdftohtml命令是否支持-q参数" - if ! pdftohtml -h 2>&1 | grep -q "\-q"; then - LOG_ERROR "pdftohtml命令不支持-q参数" - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤5:创建一个简单的PDF文件用于测试" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj << /Length 44 >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000176 00000 n - trailer << /Size 5 /Root 1 0 R >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6:使用-q参数运行pdftohtml命令,不打印任何消息或错误" - pdftohtml -q test.pdf test_output.html 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - - LOG_INFO "步骤7:验证输出文件是否生成" - if [ -f "test_output.html" ]; then - LOG_INFO "输出文件test_output.html已生成" - else - LOG_ERROR "输出文件test_output.html未生成" - CHECK_RESULT 1 0 0 "输出文件未生成" - fi - - LOG_INFO "步骤8:清理测试文件" - rm -f test.pdf test_output.html test_outputs.html - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:清理环境,卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤9:保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_s.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_s.sh deleted file mode 100644 index bd531810e6e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_s.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-s参数,生成包含所有页面的单一文档 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils >/dev/null 2>&1 - installed=$? - - # 安装软件包(如果未安装) - if [ $installed -ne 0 ]; then - LOG_INFO "poppler-utils未安装,开始安装" - dnf list available poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - dnf install -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - else - LOG_INFO "poppler-utils已安装,跳过安装步骤" - fi - - # 准备测试文件 - LOG_INFO "准备测试PDF文件" - cat > test.pdf <> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 256 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 检查-s参数是否存在 - LOG_INFO "检查pdftohtml命令是否支持-s参数" - pdftohtml -h 2>&1 | grep -q "\-s" - CHECK_RESULT $? 0 255 "pdftohtml命令不支持-s参数" - - # 执行pdftohtml命令生成单一文档 - LOG_INFO "执行pdftohtml -s命令生成单一HTML文档" - pdftohtml -s test.pdf output >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml -s命令执行失败" - - # 验证输出文件是否存在 - LOG_INFO "验证生成的HTML文件是否存在" - [ -f output.html ] - CHECK_RESULT $? 0 0 "未生成output.html文件" - - # 验证是否为单一文件(不应有分页文件) - LOG_INFO "验证是否生成单一文件(不应有分页文件)" - ls output*.html 2>/dev/null | wc -l | grep -q "^1$" - CHECK_RESULT $? 0 0 "生成了多个HTML文件,不符合-s参数预期" - - # 清理测试文件 - LOG_INFO "清理测试生成的文件" - rm -f test.pdf output.html output-*.html 2>/dev/null - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 卸载软件包(如果最初未安装) - if [ $installed -ne 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_stdout.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_stdout.sh deleted file mode 100644 index edf0015da67..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_stdout.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-stdout参数,使用标准输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断poppler-utils是否已安装 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - pkg_installed=$? - - # 记录初始安装状态 - if [ $pkg_installed -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - else - LOG_INFO "poppler-utils未安装,脚本结束后将卸载软件包" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中不存在poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $pkg_installed -ne 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftohtml命令是否存在 - LOG_INFO "检查pdftohtml命令是否存在" - which pdftohtml > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml命令不存在" - - # 检查pdftohtml是否支持-stdout参数 - LOG_INFO "检查pdftohtml是否支持-stdout参数" - pdftohtml -h 2>&1 | grep -q "\-stdout" - CHECK_RESULT $? 0 0 "pdftohtml不支持-stdout参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml不支持-stdout参数" - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000009 00000 n - 0000000052 00000 n - 0000000106 00000 n - 0000000177 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试-stdout参数,使用标准输出 - LOG_INFO "测试-stdout参数,使用标准输出" - pdftohtml -stdout test.pdf > output.html 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml -stdout执行失败" - - # 检查输出文件是否包含HTML内容 - LOG_INFO "检查输出文件是否包含HTML内容" - grep -q " /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_upper_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_upper_v.sh deleted file mode 100644 index 0b305b93a9d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_upper_v.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-v参数,打印版权和版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "1. 检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "2. 检查pdftohtml命令是否已安装" - if command -v pdftohtml > /dev/null 2>&1; then - LOG_INFO "pdftohtml命令已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "pdftohtml命令未安装,标记为未安装状态" - INSTALLED="false" - fi - - LOG_INFO "3. 如果未安装,则安装poppler-utils软件包" - if [ "$INSTALLED" = "false" ]; then - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - LOG_INFO "4. 测试pdftohtml命令的-v参数,打印版权和版本信息" - pdftohtml -v > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdftohtml命令不支持-v参数" - exit 255 - fi - - LOG_INFO "5. 执行pdftohtml -v命令,检查是否成功打印版权和版本信息" - pdftohtml -v 2>&1 | grep -E "Copyright|Version" > /dev/null - CHECK_RESULT $? 0 0 "pdftohtml -v命令未打印版权和版本信息" - - LOG_INFO "6. 清理环境,如果之前未安装则卸载poppler-utils软件包" - if [ "$INSTALLED" = "false" ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功,环境已恢复" - else - LOG_INFO "环境已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_upw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_upw.sh deleted file mode 100644 index 91d66fb0793..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_upw.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-upw参数,指定用户密码(用于加密文件) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查当前环境是否已安装poppler-utils软件包" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils软件包已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils软件包未安装,将在测试步骤中安装" - already_installed=false - fi - - LOG_INFO "开始测试-upw参数功能:指定用户密码(用于加密文件)" - - if [ "$already_installed" = "false" ]; then - LOG_INFO "步骤:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "步骤:检查pdftohtml命令是否支持-upw参数" - if ! pdftohtml -h 2>&1 | grep -q -- "-upw"; then - LOG_ERROR "pdftohtml命令不支持-upw参数" - if [ "$already_installed" = "false" ]; then - LOG_INFO "清理:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤:创建一个加密的PDF测试文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤:使用pdftohtml命令的-upw参数指定密码进行转换" - LOG_INFO "注意:测试文件并非真实加密文件,此步骤主要验证参数调用" - pdftohtml -upw "testpassword" test_input.pdf test_output.html 2>&1 - cmd_result=$? - if [ $cmd_result -ne 0 ] && [ $cmd_result -ne 1 ]; then - LOG_ERROR "pdftohtml命令执行失败,退出码: $cmd_result" - exit $cmd_result - fi - LOG_INFO "pdftohtml命令执行完成" - - LOG_INFO "步骤:检查生成的HTML文件" - if [ -f "test_output.html" ]; then - LOG_INFO "成功生成输出文件test_output.html" - else - LOG_INFO "未生成输出文件(对于非加密文件使用-upw参数可能正常)" - fi - - LOG_INFO "步骤:清理测试文件" - rm -f test_input.pdf test_output.html test_output-1.html 2>/dev/null - - if [ "$already_installed" = "false" ]; then - LOG_INFO "清理:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_wbt.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_wbt.sh deleted file mode 100644 index d79c4db708e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_wbt.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试-wbt参数,指定断词阈值 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils软件包的pdftohtml命令的-wbt参数功能" - LOG_INFO "检查是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils软件包已安装,测试后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils软件包未安装,将在测试前安装" - INSTALLED=false - fi - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - LOG_INFO "检查pdftohtml命令是否支持-wbt参数" - pdftohtml -h 2>&1 | grep -q "\-wbt" - CHECK_RESULT $? 0 0 "pdftohtml命令不支持-wbt参数" - LOG_INFO "测试-wbt参数指定断词阈值的功能" - LOG_INFO "创建一个简单的PDF文件用于测试" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF for pdftohtml) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000174 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "使用-wbt参数执行pdftohtml命令" - pdftohtml -wbt 50 test_input.pdf output.html 2>&1 - CHECK_RESULT $? 0 0 "pdftohtml命令执行失败" - LOG_INFO "检查生成的HTML文件是否存在" - [ -f output.html ] - CHECK_RESULT $? 0 0 "未生成output.html文件" - LOG_INFO "清理测试生成的文件" - rm -f test_input.pdf output.html - CHECK_RESULT $? 0 0 "清理测试文件失败" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_xml.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_xml.sh deleted file mode 100644 index 7572a731f6f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftohtml_xml.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试-xml参数,输出用于XML后处理 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils软件包已安装,测试结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 准备测试用的PDF文件 - LOG_INFO "准备测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000159 00000 n - 0000000256 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - - # 检查pdftohtml命令是否支持-xml参数 - LOG_INFO "检查pdftohtml命令是否支持-xml参数" - if ! pdftohtml -h 2>&1 | grep -q "\-xml"; then - LOG_ERROR "pdftohtml命令不支持-xml参数" - # 清理临时文件 - rm -f test.pdf - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 测试-xml参数,输出用于XML后处理 - LOG_INFO "测试-xml参数,输出用于XML后处理" - pdftohtml -xml test.pdf output.xml - CHECK_RESULT $? 0 0 "pdftohtml -xml命令执行失败" - - # 检查输出文件是否存在且内容符合预期 - LOG_INFO "检查输出文件是否存在且内容符合预期" - if [ -f "output.xml" ]; then - LOG_INFO "输出文件output.xml已生成" - # 检查文件是否包含XML内容 - if head -n 1 output.xml | grep -q "/dev/null | grep poppler-utils >/dev/null - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "2. 检查pdftohtml命令是否已安装" - command -v pdftohtml >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "pdftohtml命令已安装,标记为已安装状态" - INSTALLED="yes" - else - LOG_INFO "pdftohtml命令未安装,标记为未安装状态" - INSTALLED="no" - fi - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "3. 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "4. 检查pdftohtml命令是否支持-zoom参数" - pdftohtml -h 2>&1 | grep -q "\-zoom" - CHECK_RESULT $? 0 0 "pdftohtml命令不支持-zoom参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftohtml命令不支持-zoom参数" - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "5. 创建一个简单的PDF文件用于测试" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 35 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "6. 使用pdftohtml命令并指定-zoom参数缩放PDF文档" - pdftohtml -zoom 2.0 test_input.pdf test_output 2>&1 - CHECK_RESULT $? 0 0 "使用-zoom参数缩放PDF文档失败" - - LOG_INFO "7. 检查生成的HTML文件是否存在" - ls test_output.html >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成预期的HTML输出文件" - - LOG_INFO "8. 清理测试生成的文件" - rm -f test_input.pdf test_output.html test_outputs.html 2>/dev/null - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "9. 清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - else - LOG_INFO "9. 环境已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "10. 测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm__upper_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm__upper_help.sh deleted file mode 100644 index 44ae1e931a4..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm__upper_help.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 --help 参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(虽然题目说明无需定义,但实际使用需要确保存在,这里提供兼容性定义) - LOG_INFO() { echo "[INFO] $*"; } - LOG_ERROR() { echo "[ERROR] $*"; } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local pkg=$1 - dnf list available "$pkg" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $pkg 不在yum源中" - exit 255 - fi - } - - # 检查命令参数是否存在 - check_command_param() { - local cmd=$1 - local param=$2 - $cmd --help 2>&1 | grep -q "$param" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $cmd 不支持参数 $param" - exit 255 - fi - } - - # 主测试函数 - main() { - local pkg_name="poppler-utils" - local cmd="pdftoppm" - local param="--help" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "检查软件包 $pkg_name 是否在yum源中" - check_package_in_repo "$pkg_name" - - # 步骤2:检查环境是否已安装 - LOG_INFO "检查环境是否已安装 $pkg_name" - if rpm -q "$pkg_name" &>/dev/null; then - LOG_INFO "软件包 $pkg_name 已安装,测试后保持安装状态" - local already_installed=1 - else - LOG_INFO "软件包 $pkg_name 未安装,将在测试后卸载" - local already_installed=0 - fi - - # 步骤3:如果未安装则安装软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装软件包 $pkg_name" - dnf install -y "$pkg_name" - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4:检查命令参数是否存在 - LOG_INFO "检查命令 $cmd 是否支持参数 $param" - check_command_param "$cmd" "$param" - - # 步骤5:执行测试命令 - LOG_INFO "执行命令 $cmd $param" - $cmd $param - CHECK_RESULT $? 0 0 "执行命令失败" - - # 步骤6:清理环境 - LOG_INFO "清理测试环境" - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载软件包 $pkg_name" - dnf remove -y "$pkg_name" - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "保持软件包 $pkg_name 的安装状态" - fi - - LOG_INFO "测试完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_cropbox.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_cropbox.sh deleted file mode 100644 index 6ed0ca2db10..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_cropbox.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -cropbox 参数,使用裁剪框而非媒体框 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出(可选,但通常测试框架会提供) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义软件包和命令 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdftoppm" - PARAMETER="-cropbox" - - # 步骤1: 检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在软件包 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到软件包 $PACKAGE_NAME" - exit 255 - fi - - # 步骤2: 检查当前环境是否已安装软件包 - LOG_INFO "检查系统是否已安装软件包 $PACKAGE_NAME" - if rpm -q $PACKAGE_NAME &>/dev/null; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装,标记为已安装状态" - PACKAGE_INSTALLED=true - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,标记为未安装状态" - PACKAGE_INSTALLED=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "$PACKAGE_INSTALLED" = false ]; then - LOG_INFO "安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4: 检查命令是否存在 - LOG_INFO "检查命令 $COMMAND_NAME 是否存在" - command -v $COMMAND_NAME &>/dev/null - CHECK_RESULT $? 0 0 "命令 $COMMAND_NAME 不存在" - - # 步骤5: 检查参数是否支持 - LOG_INFO "检查命令 $COMMAND_NAME 是否支持参数 $PARAMETER" - $COMMAND_NAME --help 2>&1 | grep -q "$PARAMETER" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $COMMAND_NAME 不支持参数 $PARAMETER" - exit 255 - fi - - # 步骤6: 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /CropBox [50 50 562 742] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 246 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤7: 执行 pdftoppm 命令并测试 -cropbox 参数 - LOG_INFO "执行 $COMMAND_NAME 命令测试 $PARAMETER 参数" - $COMMAND_NAME -cropbox test.pdf output - CHECK_RESULT $? 0 0 "执行 $COMMAND_NAME 命令失败" - - # 步骤8: 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - ls output-1.ppm &>/dev/null - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 步骤9: 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output-1.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤10: 如果测试前未安装,则卸载软件包 - if [ "$PACKAGE_INSTALLED" = false ]; then - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_e.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_e.sh deleted file mode 100644 index 1f0c4245aef..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_e.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -e 参数,仅转换偶数页 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称和命令名称 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdftoppm" - - # 步骤1: 检查软件包是否已在yum源中 - LOG_INFO "步骤1: 检查软件包是否在yum源中" - dnf list available ${PACKAGE_NAME} &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 不在yum源中" - exit 255 - fi - - # 步骤2: 检查软件包是否已安装 - LOG_INFO "步骤2: 检查软件包是否已安装" - rpm -q ${PACKAGE_NAME} &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "软件包未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "步骤3: 安装软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4: 检查pdftoppm命令的-e参数是否支持 - LOG_INFO "步骤4: 检查pdftoppm命令的-e参数是否支持" - ${COMMAND_NAME} --help 2>&1 | grep -q "\-e" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-e参数" - exit 255 - fi - - # 步骤5: 准备测试PDF文件 - LOG_INFO "步骤5: 准备测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R 6 0 R] - /Count 4 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 7 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 8 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 9 0 R - >> - endobj - 6 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 10 0 R - >> - endobj - 7 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 1) Tj ET - endstream - endobj - 8 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 2) Tj ET - endstream - endobj - 9 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 3) Tj ET - endstream - endobj - 10 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 4) Tj ET - endstream - endobj - xref - 0 11 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000136 00000 n - 0000000222 00000 n - 0000000308 00000 n - 0000000394 00000 n - 0000000480 00000 n - 0000000566 00000 n - 0000000652 00000 n - 0000000738 00000 n - trailer - << - /Size 11 - /Root 1 0 R - >> - startxref - 838 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤6: 执行pdftoppm命令,仅转换偶数页 - LOG_INFO "步骤6: 执行pdftoppm命令,仅转换偶数页" - ${COMMAND_NAME} -e test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - - # 步骤7: 验证输出文件数量 - LOG_INFO "步骤7: 验证输出文件数量" - OUTPUT_COUNT=$(ls test_output-*.ppm 2>/dev/null | wc -l) - if [ ${OUTPUT_COUNT} -eq 2 ]; then - LOG_INFO "输出文件数量正确: ${OUTPUT_COUNT} 个文件" - else - LOG_ERROR "输出文件数量不正确: 期望2个,实际${OUTPUT_COUNT}个" - exit 1 - fi - - # 步骤8: 验证输出文件名 - LOG_INFO "步骤8: 验证输出文件名" - if [ -f "test_output-02.ppm" ] && [ -f "test_output-04.ppm" ]; then - LOG_INFO "输出文件名正确: 包含第2页和第4页" - else - LOG_ERROR "输出文件名不正确: 应包含test-output-02.ppm和test-output-04.ppm" - exit 1 - fi - - # 步骤9: 清理测试文件 - LOG_INFO "步骤9: 清理测试文件" - rm -f test_input.pdf test_output-*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤10: 如果测试前未安装,则卸载软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "步骤10: 卸载软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成: pdftoppm命令的-e参数功能正常" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_f.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_f.sh deleted file mode 100644 index 419b5cbd58f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_f.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -f 参数,指定从第几页开始转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将在测试中安装,脚本结束前卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到poppler-utils软件包" - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 准备测试用的PDF文件 - LOG_INFO "准备测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 7 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 8 0 R - >> - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 7 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - 8 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 3) Tj - ET - endstream - endobj - xref - 0 9 - 0000000000 65535 f - 0000000009 00000 n - 0000000078 00000 n - 0000000173 00000 n - 0000000272 00000 n - 0000000371 00000 n - 0000000470 00000 n - 0000000569 00000 n - 0000000668 00000 n - trailer - << - /Size 9 - /Root 1 0 R - >> - startxref - 768 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-f参数 - LOG_INFO "测试pdftoppm命令的-f参数,从第2页开始转换" - pdftoppm test.pdf output -f 2 > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "pdftoppm命令不支持-f参数或参数错误" - - # 检查输出文件 - LOG_INFO "检查输出文件是否存在" - ls output-1.ppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成输出文件output-1.ppm" - - # 验证输出文件内容(简单检查文件大小) - LOG_INFO "验证输出文件内容" - FILE_SIZE=$(stat -c%s output-1.ppm 2>/dev/null) - if [ $FILE_SIZE -gt 0 ]; then - LOG_INFO "输出文件output-1.ppm大小: ${FILE_SIZE}字节" - else - LOG_ERROR "输出文件output-1.ppm大小为0" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output*.ppm - - # 如果测试前未安装,则卸载poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_gray.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_gray.sh deleted file mode 100644 index a19c9214a00..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_gray.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -gray 参数,生成灰度PGM文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdftoppm命令的-gray参数生成灰度PGM文件" - - LOG_INFO "1. 检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "2. 检查系统是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "检测到poppler-utils已安装,标记为已存在安装" - INSTALLED_BEFORE="yes" - else - LOG_INFO "检测到poppler-utils未安装,标记为未存在安装" - INSTALLED_BEFORE="no" - fi - - LOG_INFO "3. 根据安装状态决定是否执行安装步骤" - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "开始安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "4. 检查pdftoppm命令是否存在" - if ! command -v pdftoppm &>/dev/null; then - LOG_ERROR "pdftoppm命令不存在" - exit 255 - fi - - LOG_INFO "5. 检查pdftoppm是否支持-gray参数" - if ! pdftoppm -h 2>&1 | grep -q "\-gray"; then - LOG_ERROR "pdftoppm不支持-gray参数" - exit 255 - fi - - LOG_INFO "6. 创建测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 100 100] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 20 70 Td (Test) Tj ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000162 00000 n - 0000000255 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 340 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "7. 执行pdftoppm命令生成灰度PGM文件" - pdftoppm -gray test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm执行失败" - - LOG_INFO "8. 检查生成的PGM文件是否存在" - if [ -f "test_output-1.pgm" ]; then - LOG_INFO "成功生成灰度PGM文件:test_output-1.pgm" - FILE_HEADER=$(head -c 2 test_output-1.pgm) - if [ "$FILE_HEADER" = "P5" ]; then - LOG_INFO "确认生成的文件为PGM格式(P5头部标识)" - else - LOG_ERROR "生成的文件不是PGM格式" - CHECK_RESULT 1 0 0 "文件格式验证失败" - fi - else - LOG_ERROR "未找到生成的PGM文件" - CHECK_RESULT 1 0 0 "文件生成验证失败" - fi - - LOG_INFO "9. 清理测试文件" - rm -f test_input.pdf test_output-*.pgm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - LOG_INFO "10. 根据初始安装状态恢复环境" - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载测试安装的poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持原有安装状态,不执行卸载" - fi - - LOG_INFO "测试完成:pdftoppm命令的-gray参数功能验证成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_h.sh deleted file mode 100644 index d001a09585f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_h.sh +++ /dev/null @@ -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-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -h 参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试 pdftoppm 命令的 -h 参数,打印使用信息 - LOG_INFO "开始测试 pdftoppm 命令的 -h 参数" - - # 检查是否已安装 poppler-utils 软件包 - LOG_INFO "检查 poppler-utils 软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils 已安装,测试结束后保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils 未安装,将在测试前安装" - INSTALLED_BEFORE=0 - fi - - # 检查 yum 源中是否有 poppler-utils 软件包 - LOG_INFO "检查 yum 源中是否有 poppler-utils 软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum 源中没有 poppler-utils 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中没有 poppler-utils 软件包" - exit 255 - fi - - # 如果未安装,则安装 poppler-utils - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 poppler-utils 软件包失败" - fi - - # 检查 pdftoppm 命令是否存在 - LOG_INFO "检查 pdftoppm 命令是否存在" - command -v pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm 命令不存在" - - # 检查 pdftoppm 命令是否支持 -h 参数 - LOG_INFO "检查 pdftoppm 命令是否支持 -h 参数" - pdftoppm -h > /dev/null 2>&1 - if [ $? -eq 1 ]; then - # 某些命令使用 -h 返回退出码 1,但输出了帮助信息 - LOG_INFO "pdftoppm 命令支持 -h 参数,继续测试" - elif [ $? -eq 0 ]; then - LOG_INFO "pdftoppm 命令支持 -h 参数,继续测试" - else - LOG_ERROR "pdftoppm 命令不支持 -h 参数" - # 清理环境 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "清理环境:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 测试 pdftoppm -h 命令 - LOG_INFO "执行 pdftoppm -h 命令,检查是否打印使用信息" - pdftoppm -h 2>&1 | grep -q "Usage:" 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm -h 未打印使用信息" - - # 清理环境 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "清理环境:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 poppler-utils 软件包失败" - else - LOG_INFO "保持 poppler-utils 软件包安装状态" - fi - - LOG_INFO "测试 pdftoppm 命令的 -h 参数完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_help.sh deleted file mode 100644 index dec558d30e7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_help.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -help 参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdftoppm 命令的 -help 参数" - - # 检查软件包是否在 yum 源中 - LOG_INFO "检查 yum 源中是否有 poppler-utils 软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 检查是否已安装 poppler-utils - LOG_INFO "检查是否已安装 poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils 已安装,测试后保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-ools 未安装,将安装软件包作为测试步骤" - INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 检查 pdftoppm 命令是否存在 - LOG_INFO "检查 pdftoppm 命令是否存在" - command -v pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm 命令不存在" - - # 测试 pdftoppm -help 参数 - LOG_INFO "执行 pdftoppm -help 命令" - pdftoppm -help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm -help 参数不存在或不支持" - - # 环境清理:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_hide-annotations.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_hide-annotations.sh deleted file mode 100644 index c4648d1f98b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_hide-annotations.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -hide-annotations 参数,不显示注释 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:判断是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,脚本结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - which pdftoppm > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不存在" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 检查pdftoppm命令是否支持-hide-annotations参数 - LOG_INFO "检查pdftoppm命令是否支持-hide-annotations参数" - pdftoppm -h 2>&1 | grep -q "\-hide-annotations" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-hide-annotations参数" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试用的PDF文件(包含注释) - LOG_INFO "创建测试用的PDF文件(包含注释)" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Annots [5 0 R] - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello, World!) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Annot - /Subtype /Text - /Rect [100 100 200 200] - /Contents (这是一个注释) - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000205 00000 n - 0000000277 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 360 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-hide-annotations参数,不显示注释 - LOG_INFO "测试pdftoppm命令的-hide-annotations参数,不显示注释" - pdftoppm -hide-annotations test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - - # 检查生成的PPM文件是否存在 - LOG_INFO "检查生成的PPM文件是否存在" - ls test_output-1.ppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成PPM文件" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output-1.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试开始时未安装poppler-utils,则在测试结束后卸载 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成:pdftoppm命令的-hide-annotations参数功能正常" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_jpeg.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_jpeg.sh deleted file mode 100644 index b28f6d1d2ec..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_jpeg.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -jpeg 参数,生成JPEG文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 pdftoppm 命令的 -jpeg 参数,生成JPEG文件" - - LOG_INFO "检查是否已安装 poppler-utils 软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,标记为已存在" - already_installed=true - else - LOG_INFO "poppler-utils 未安装" - already_installed=false - fi - - LOG_INFO "检查 yum 源中是否有 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - if [ "$already_installed" = false ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "检查 pdftoppm 命令是否支持 -jpeg 参数" - if ! pdftoppm -help 2>&1 | grep -q -- "-jpeg"; then - LOG_ERROR "pdftoppm 命令不支持 -jpeg 参数" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "创建一个简单的 PDF 文件用于测试" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 24 Tf 100 700 Td (Test PDF) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 256 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "使用 pdftoppm -jpeg 参数将 PDF 转换为 JPEG 图像" - pdftoppm -jpeg test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm -jpeg 命令执行失败" - - LOG_INFO "检查是否生成了 JPEG 文件" - if [ -f "test_output-1.jpg" ]; then - LOG_INFO "成功生成 JPEG 文件:test_output-1.jpg" - file_output=$(file test_output-1.jpg) - if echo "$file_output" | grep -q "JPEG image data"; then - LOG_INFO "文件格式验证成功,为 JPEG 图像" - else - LOG_ERROR "生成的文件不是有效的 JPEG 格式" - CHECK_RESULT 1 0 0 "生成的文件格式不正确" - fi - else - LOG_ERROR "未找到生成的 JPEG 文件" - CHECK_RESULT 1 0 0 "未生成 JPEG 文件" - fi - - LOG_INFO "清理测试生成的文件" - rm -f test_input.pdf test_output*.jpg - - if [ "$already_installed" = false ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - LOG_INFO "环境已恢复至测试前状态" - else - LOG_INFO "保持 poppler-utils 软件包的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_jpegcmyk.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_jpegcmyk.sh deleted file mode 100644 index 8814be3bad2..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_jpegcmyk.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -jpegcmyk 参数,生成CMYK JPEG文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义测试函数 - test_pdftoppm_jpegcmyk() { - # 步骤1:检查环境是否已安装poppler-utils软件包 - LOG_INFO "步骤1:检查环境是否已安装poppler-utils软件包" - rpm -q poppler-utils >/dev/null 2>&1 - local installed=$? - - # 步骤2:检查yum源中是否有poppler-utils软件包 - LOG_INFO "步骤2:检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到poppler-utils软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装poppler-utils - if [ $installed -ne 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - else - LOG_INFO "步骤3:poppler-utils已安装,跳过安装步骤" - fi - - # 步骤4:检查pdftoppm命令是否支持-jpegcmyk参数 - LOG_INFO "步骤4:检查pdftoppm命令是否支持-jpegcmyk参数" - pdftoppm -h 2>&1 | grep -q "jpegcmyk" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-jpegcmyk参数" - # 如果之前未安装,需要卸载 - if [ $installed -ne 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 步骤5:创建测试用的PDF文件 - LOG_INFO "步骤5:创建测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 200 200] - /Resources << - >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 35 - >> - stream - BT - /F1 12 Tf - 100 100 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000178 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 248 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤6:使用-jpegcmyk参数生成CMYK JPEG文件 - LOG_INFO "步骤6:使用-jpegcmyk参数生成CMYK JPEG文件" - pdftoppm -jpegcmyk test_input.pdf output - CHECK_RESULT $? 0 0 "使用-jpegcmyk参数生成CMYK JPEG文件失败" - - # 步骤7:检查生成的JPEG文件是否存在 - LOG_INFO "步骤7:检查生成的JPEG文件是否存在" - if [ -f "output-1.jpg" ]; then - LOG_INFO "成功生成CMYK JPEG文件:output-1.jpg" - # 检查文件是否为有效的JPEG文件 - file output-1.jpg | grep -q "JPEG" - CHECK_RESULT $? 0 0 "生成的文件不是有效的JPEG文件" - else - LOG_ERROR "未找到生成的JPEG文件" - CHECK_RESULT 1 0 0 "未生成预期的JPEG文件" - fi - - # 步骤8:清理测试文件 - LOG_INFO "步骤8:清理测试文件" - rm -f test_input.pdf output*.jpg - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9:恢复环境状态 - LOG_INFO "步骤9:恢复环境状态" - if [ $installed -ne 0 ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持原有安装状态,不卸载poppler-utils" - fi - - LOG_INFO "测试完成:pdftoppm命令的-jpegcmyk参数功能正常" - } - - # 执行测试函数 - test_pdftoppm_jpegcmyk -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_l.sh deleted file mode 100644 index be928cbaf24..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_l.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -l 参数,指定转换到第几页结束 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdftoppm 命令的 -l 参数功能" - - # 检查是否已安装 poppler-utils 包 - LOG_INFO "检查 poppler-utils 软件包是否已安装" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils 未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查 yum 源中是否存在 poppler-utils 包 - LOG_INFO "检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 如果未安装,则安装 poppler-utils - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 检查 pdftoppm 命令是否支持 -l 参数 - LOG_INFO "检查 pdftoppm 命令是否支持 -l 参数" - pdftoppm -h 2>&1 | grep -q -- "-l" - CHECK_RESULT $? 0 0 "pdftoppm 命令不支持 -l 参数" - - # 创建测试用的 PDF 文件 - LOG_INFO "创建测试用的 PDF 文件" - cat > /tmp/test.pdf <> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R 4 0 R 5 0 R] /Count 3 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /Contents 6 0 R >> - endobj - 4 0 obj - << /Type /Page /Parent 2 0 R /Contents 7 0 R >> - endobj - 5 0 obj - << /Type /Page /Parent 2 0 R /Contents 8 0 R >> - endobj - 6 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 1) Tj ET - endstream - endobj - 7 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 2) Tj ET - endstream - endobj - 8 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 3) Tj ET - endstream - endobj - xref - 0 9 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000161 00000 n - 0000000216 00000 n - 0000000271 00000 n - 0000000326 00000 n - 0000000381 00000 n - trailer - << /Size 9 /Root 1 0 R >> - startxref - 442 - %%EOF - EOF - - # 测试 pdftoppm -l 参数,指定转换到第 2 页结束 - LOG_INFO "测试 pdftoppm -l 2 参数,转换到第 2 页结束" - pdftoppm /tmp/test.pdf /tmp/test -l 2 - CHECK_RESULT $? 0 0 "pdftoppm -l 2 执行失败" - - # 检查生成的图像文件数量 - LOG_INFO "检查生成的图像文件数量" - IMAGE_COUNT=$(ls /tmp/test-*.ppm 2>/dev/null | wc -l) - CHECK_RESULT $IMAGE_COUNT 2 0 "生成的图像文件数量不正确,应为 2 个" - - # 清理测试生成的图像文件 - LOG_INFO "清理测试生成的图像文件" - rm -f /tmp/test-*.ppm /tmp/test.pdf - - # 如果测试前未安装,则卸载 poppler-utils - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_mono.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_mono.sh deleted file mode 100644 index e4800bc7b70..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_mono.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -mono 参数,生成单色PBM文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdftoppm 命令的 -mono 参数,生成单色PBM文件" - - LOG_INFO "步骤1:检查poppler-utils软件包是否已在yum源中" - dnf list poppler-utils 2>&1 | grep -q "poppler-utils" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - if [ $installed -eq 0 ]; then - LOG_INFO "poppler-utils已安装,测试完成后将保持安装状态" - need_uninstall=0 - else - LOG_INFO "poppler-utils未安装,将进行安装" - need_uninstall=1 - fi - - if [ $need_uninstall -eq 1 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:检查pdftoppm命令是否支持-mono参数" - pdftoppm -h 2>&1 | grep -q -- "-mono" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-mono参数" - if [ $need_uninstall -eq 1 ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤5:创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000176 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6:使用-mono参数运行pdftoppm命令生成单色PBM文件" - pdftoppm -mono test.pdf output - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - - LOG_INFO "步骤7:检查生成的PBM文件" - ls output-1.pbm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未找到生成的PBM文件" - - LOG_INFO "步骤8:验证PBM文件格式" - file output-1.pbm | grep -q "PBM" - CHECK_RESULT $? 0 0 "生成的不是有效的PBM文件" - - LOG_INFO "步骤9:清理测试文件" - rm -f test.pdf output-*.pbm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $need_uninstall -eq 1 ]; then - LOG_INFO "步骤10:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤10:保持poppler-utils安装状态,不进行卸载" - fi - - LOG_INFO "测试完成:pdftoppm命令的-mono参数功能正常" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_o.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_o.sh deleted file mode 100644 index 8b8f97c008d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_o.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -o 参数,仅转换奇数页 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 pdftoppm 命令的 -o 参数,仅转换奇数页" - - LOG_INFO "步骤1:检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装 poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,标记为已存在安装" - INSTALLED_BEFORE="yes" - else - LOG_INFO "poppler-utils 未安装,将在测试中安装" - INSTALLED_BEFORE="no" - fi - - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "步骤3:安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "步骤4:检查 pdftoppm 命令的 -o 参数是否存在" - pdftoppm -h 2>&1 | grep -q "\-o" - CHECK_RESULT $? 0 0 "pdftoppm 命令不支持 -o 参数" - - LOG_INFO "步骤5:创建一个简单的单页 PDF 文件用于测试" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << - /Size 4 - /Root 1 0 R - >> - startxref - 149 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤6:执行 pdftoppm 命令,使用 -o 参数指定输出文件名前缀" - pdftoppm test_input.pdf output -o - CHECK_RESULT $? 0 0 "pdftoppm 命令执行失败" - - LOG_INFO "步骤7:验证输出文件是否生成" - ls output-1.ppm &>/dev/null - CHECK_RESULT $? 0 0 "未找到预期的输出文件 output-1.ppm" - - LOG_INFO "步骤8:清理测试生成的文件" - rm -f test_input.pdf output-*.ppm - - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "步骤9:卸载测试安装的 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "步骤9:测试前已安装 poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_png.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_png.sh deleted file mode 100644 index efe36fc58e2..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_png.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -png 参数,生成PNG文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查poppler-utils是否已安装" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束时保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将在测试中安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - command -v pdftoppm &>/dev/null - CHECK_RESULT $? 0 0 "pdftoppm命令不存在" - - # 检查pdftoppm是否支持-png参数 - LOG_INFO "检查pdftoppm是否支持-png参数" - if ! pdftoppm -h 2>&1 | grep -q -- "-png"; then - LOG_ERROR "pdftoppm不支持-png参数" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 200 100] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 50 50 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000171 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 220 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-png参数 - LOG_INFO "测试pdftoppm命令的-png参数,生成PNG文件" - pdftoppm -png test.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm -png执行失败" - - # 检查是否生成了PNG文件 - LOG_INFO "检查是否生成了PNG文件" - if [ -f "test_output-1.png" ]; then - LOG_INFO "成功生成PNG文件: test_output-1.png" - - # 检查PNG文件是否有效 - LOG_INFO "检查生成的PNG文件是否有效" - file test_output-1.png | grep -q "PNG image" - CHECK_RESULT $? 0 0 "生成的PNG文件无效" - else - LOG_ERROR "未找到生成的PNG文件" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_output-*.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装,则在结束时卸载软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "环境已恢复到初始状态" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_progress.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_progress.sh deleted file mode 100644 index c2bd8b41024..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_progress.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -progress 参数,打印进度信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 pdftoppm 命令的 -progress 参数,打印进度信息" - - LOG_INFO "步骤1: 检查 poppler-utils 软件包在 yum 源中是否存在" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查当前环境是否已安装 poppler-utils" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "检测到 poppler-utils 已安装,标记为已存在安装" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "检测到 poppler-utils 未安装,将在测试步骤中安装" - INSTALLED_BEFORE_TEST=false - fi - - LOG_INFO "步骤3: 若未安装,则安装 poppler-utils 软件包" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "步骤4: 检查 pdftoppm 命令是否支持 -progress 参数" - if ! pdftoppm -h 2>&1 | grep -q -- "-progress"; then - LOG_ERROR "pdftoppm 命令不支持 -progress 参数" - exit 255 - fi - - LOG_INFO "步骤5: 创建一个简单的 PDF 文件用于测试" - cat > /tmp/test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << - /Size 4 - /Root 1 0 R - >> - startxref - 149 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤6: 执行 pdftoppm 命令并使用 -progress 参数" - pdftoppm /tmp/test.pdf /tmp/test_output -progress 2>&1 | tee /tmp/pdftoppm_progress.log - CHECK_RESULT $? 0 0 "pdftoppm 命令执行失败" - - LOG_INFO "步骤7: 验证 -progress 参数输出了进度信息" - if grep -q "Processing page" /tmp/pdftoppm_progress.log; then - LOG_INFO "成功检测到进度信息输出" - else - LOG_ERROR "未检测到进度信息输出,-progress 参数可能未生效" - exit 1 - fi - - LOG_INFO "步骤8: 清理测试生成的临时文件" - rm -f /tmp/test.pdf /tmp/test_output* /tmp/pdftoppm_progress.log - CHECK_RESULT $? 0 0 "清理临时文件失败" - - LOG_INFO "步骤9: 根据测试前状态恢复环境" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "测试前未安装 poppler-utils,执行卸载" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "测试前已安装 poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_q.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_q.sh deleted file mode 100644 index f63429682bf..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_q.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -q 参数,不打印任何消息或错误 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在" - ALREADY_INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,标记为未安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - command -v pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令不存在" - - # 检查pdftoppm是否支持-q参数 - LOG_INFO "检查pdftoppm是否支持-q参数" - pdftoppm -h 2>&1 | grep -q "\-q" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm不支持-q参数" - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000226 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 396 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm的-q参数 - LOG_INFO "测试pdftoppm的-q参数,不打印任何消息或错误" - pdftoppm -q test.pdf output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm -q参数测试失败" - - # 检查是否生成了输出文件 - LOG_INFO "检查是否生成了输出文件" - ls output-1.ppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成输出文件" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output*.ppm - - # 如果测试前未安装,则卸载poppler-utils - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_r.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_r.sh deleted file mode 100644 index b2d746dbe9a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_r.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -r 参数,设置分辨率(DPI) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试 pdftoppm 命令的 -r 参数,设置分辨率(DPI) - LOG_INFO "开始测试 pdftoppm 命令的 -r 参数" - - # 检查 yum 源中是否存在 poppler-utils 软件包 - LOG_INFO "步骤1:检查 yum 源中是否存在 poppler-utils 软件包" - dnf list poppler-utils &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 判断当前环境是否已安装 poppler-utils - LOG_INFO "步骤2:判断当前环境是否已安装 poppler-utils" - rpm -q poppler-utils &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils 已安装" - INSTALLED=true - else - LOG_INFO "poppler-utils 未安装,将进行安装" - INSTALLED=false - fi - - # 如果未安装,则安装 poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装 poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 准备测试用的 PDF 文件 - LOG_INFO "步骤4:准备测试用的 PDF 文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 19 - >> - stream - 1 0 0 1 0 0 cm - 0 0 612 792 re - S - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000179 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - # 检查 pdftoppm 命令是否支持 -r 参数 - LOG_INFO "步骤5:检查 pdftoppm 命令是否支持 -r 参数" - pdftoppm -h 2>&1 | grep -q "\-r" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm 命令不支持 -r 参数" - # 清理测试文件 - rm -f test.pdf - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载 poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 测试 pdftoppm 命令的 -r 参数 - LOG_INFO "步骤6:测试 pdftoppm 命令的 -r 参数(设置分辨率为 150 DPI)" - pdftoppm -r 150 test.pdf output - CHECK_RESULT $? 0 0 "pdftoppm -r 150 执行失败" - - # 检查生成的图像文件是否存在 - LOG_INFO "步骤7:检查生成的图像文件是否存在" - if [ -f "output-1.ppm" ]; then - LOG_INFO "成功生成 output-1.ppm 文件" - # 可选:检查文件大小或使用其他方法验证分辨率设置 - # 这里简单检查文件是否非空 - if [ -s "output-1.ppm" ]; then - LOG_INFO "生成的图像文件非空" - else - LOG_ERROR "生成的图像文件为空" - CHECK_RESULT 1 0 0 "生成的图像文件为空" - fi - else - LOG_ERROR "未找到生成的图像文件 output-1.ppm" - CHECK_RESULT 1 0 0 "未生成图像文件" - fi - - # 清理测试生成的文件 - LOG_INFO "步骤8:清理测试生成的文件" - rm -f test.pdf output*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装 poppler-utils,则卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤9:卸载 poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "步骤9:保持 poppler-utils 安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_rx.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_rx.sh deleted file mode 100644 index 2e68ab67031..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_rx.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -rx 参数,设置X轴分辨率(DPI) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdftoppm 命令的 -rx 参数,设置X轴分辨率(DPI)" - LOG_INFO "步骤1:检查环境中是否已安装 poppler-utils 软件包" - if rpm -q poppler-utils > /dev/null 2>&1; then - LOG_INFO "环境中已安装 poppler-utils,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "环境中未安装 poppler-utils,将在测试过程中安装" - INSTALLED=0 - fi - - LOG_INFO "步骤2:检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils > /dev/null 2>&1; then - LOG_ERROR "yum 源中不存在 poppler-utils 软件包,退出测试" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "步骤4:检查 pdftoppm 命令是否存在 -rx 参数" - pdftoppm -h 2>&1 | grep -q "\-rx" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm 命令不支持 -rx 参数,退出测试" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "步骤5:准备测试用的 PDF 文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000170 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤6:使用 -rx 参数执行 pdftoppm 命令,设置X轴分辨率为150 DPI" - pdftoppm -rx 150 test.pdf output - CHECK_RESULT $? 0 0 "pdftoppm 命令执行失败" - - LOG_INFO "步骤7:检查生成的图像文件是否存在" - if [ -f output-1.ppm ]; then - LOG_INFO "成功生成图像文件 output-1.ppm" - else - LOG_ERROR "未生成预期的图像文件" - CHECK_RESULT 1 0 0 "图像文件生成失败" - fi - - LOG_INFO "步骤8:清理测试生成的文件" - rm -f test.pdf output*.ppm - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤9:清理环境:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "环境中已安装 poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_ry.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_ry.sh deleted file mode 100644 index 2e1cd3ec94d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_ry.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -ry 参数,设置Y轴分辨率(DPI) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - if [ $installed -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,脚本结束时将保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils软件包未安装,将在测试过程中安装" - already_installed=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中不存在poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - command -v pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令不存在" - - # 检查pdftoppm命令是否支持-ry参数 - LOG_INFO "检查pdftoppm命令是否支持-ry参数" - pdftoppm -h 2>&1 | grep -q "\-ry" - CHECK_RESULT $? 0 0 "pdftoppm命令不支持-ry参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-ry参数" - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000204 00000 n - 0000000247 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 350 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-ry参数 - LOG_INFO "测试pdftoppm命令的-ry参数,设置Y轴分辨率为150 DPI" - pdftoppm -ry 150 test.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - ls test_output-1.ppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "未生成预期的输出文件" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_output-*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to-x.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to-x.sh deleted file mode 100644 index 491c5361be1..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to-x.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -scale-to-x 参数,将页面水平缩放至指定像素 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义软件包名称和命令 - PACKAGE_NAME="poppler-utils" - COMMAND="pdftoppm" - PARAM="-scale-to-x" - - # 1. 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有 $PACKAGE_NAME 软件包" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到 $PACKAGE_NAME 软件包" - exit 255 - fi - - # 2. 检查环境是否已安装该软件包 - LOG_INFO "检查环境是否已安装 $PACKAGE_NAME" - rpm -q $PACKAGE_NAME &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME 已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "$PACKAGE_NAME 未安装,将在测试步骤中安装" - INSTALLED=false - fi - - # 3. 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装 $PACKAGE_NAME 软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 失败" - fi - - # 4. 检查命令是否存在 - LOG_INFO "检查 $COMMAND 命令是否存在" - which $COMMAND &>/dev/null - CHECK_RESULT $? 0 0 "$COMMAND 命令不存在" - - # 5. 检查参数是否存在或不支持 - LOG_INFO "检查 $COMMAND 命令是否支持 $PARAM 参数" - $COMMAND --help 2>&1 | grep -q "$PARAM" - if [ $? -ne 0 ]; then - LOG_ERROR "$COMMAND 命令不支持 $PARAM 参数" - exit 255 - fi - - # 6. 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 200 200] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 20 - >> - stream - BT /F1 12 Tf 10 100 Td (Test) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000104 00000 n - 0000000170 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 220 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 7. 测试 -scale-to-x 参数,将页面水平缩放至指定像素 - LOG_INFO "测试 $COMMAND 命令的 $PARAM 参数,将页面水平缩放至指定像素" - $COMMAND -png -singlefile $PARAM 400 test_input.pdf test_output - CHECK_RESULT $? 0 0 "执行 $COMMAND $PARAM 失败" - - # 8. 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - if [ -f test_output.png ]; then - LOG_INFO "输出文件 test_output.png 已生成" - # 可选:检查输出文件的宽度是否为400像素 - # 需要安装ImageMagick工具来检查图片宽度 - if which identify &>/dev/null; then - WIDTH=$(identify -format "%w" test_output.png 2>/dev/null) - if [ "$WIDTH" = "400" ]; then - LOG_INFO "输出图片宽度为400像素,符合预期" - else - LOG_INFO "输出图片宽度为 ${WIDTH}像素,可能不符合预期" - fi - fi - else - LOG_ERROR "输出文件 test_output.png 未生成" - CHECK_RESULT 1 0 0 "输出文件未生成" - fi - - # 9. 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 10. 如果脚本开始时未安装软件包,则在脚本结束前卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载 $PACKAGE_NAME 软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 失败" - else - LOG_INFO "保持 $PACKAGE_NAME 软件包的安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to-y.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to-y.sh deleted file mode 100644 index 9fef71654c1..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to-y.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -scale-to-y 参数,将页面垂直缩放至指定像素 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装poppler-utils软件包 - LOG_INFO "检查poppler-utils是否已经安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已经安装,测试结束后保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - which pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令不存在" - - # 检查-scale-to-y参数是否存在 - LOG_INFO "检查pdftoppm命令是否支持-scale-to-y参数" - pdftoppm -h 2>&1 | grep -q "\-scale-to-y" - CHECK_RESULT $? 0 0 "pdftoppm命令不支持-scale-to-y参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-scale-to-y参数" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000221 00000 n - 0000000282 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 357 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-scale-to-y参数 - LOG_INFO "测试pdftoppm命令的-scale-to-y参数,将页面垂直缩放至500像素" - pdftoppm -scale-to-y 500 test.pdf output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - - # 检查生成的图像文件 - LOG_INFO "检查生成的图像文件" - if [ -f "output-1.ppm" ]; then - LOG_INFO "成功生成输出图像文件output-1.ppm" - # 获取图像高度信息(使用identify命令,需要安装ImageMagick) - which identify > /dev/null 2>&1 - if [ $? -eq 0 ]; then - height=$(identify -format "%h" output-1.ppm 2>/dev/null) - LOG_INFO "生成图像的高度为: ${height}像素" - # 检查高度是否接近500像素(允许一定误差) - if [ $height -ge 490 ] && [ $height -le 510 ]; then - LOG_INFO "图像高度符合预期(500像素左右)" - else - LOG_ERROR "图像高度不符合预期,实际高度: ${height}像素" - rm -f test.pdf output-1.ppm - if [ $INSTALLED_FLAG -eq 0 ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 1 - fi - fi - else - LOG_ERROR "未生成输出图像文件" - rm -f test.pdf - if [ $INSTALLED_FLAG -eq 0 ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output-1.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to.sh deleted file mode 100644 index 93e8bb4d8da..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_scale-to.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -scale-to 参数,将页面缩放至指定像素的方框内 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 pdftoppm 命令的 -scale-to 参数" - LOG_INFO "步骤1: 检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查当前环境是否已安装 poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "poppler-utils 未安装,将在测试前安装,测试后卸载" - INSTALLED_BEFORE_TEST=false - fi - - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤3: 安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - LOG_INFO "步骤4: 检查 pdftoppm 命令是否支持 -scale-to 参数" - if ! pdftoppm --help 2>&1 | grep -q "\-scale-to"; then - LOG_ERROR "pdftoppm 命令不支持 -scale-to 参数" - exit 255 - fi - - LOG_INFO "步骤5: 准备测试用的 PDF 文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000111 00000 n - trailer - << - /Size 4 - /Root 1 0 R - >> - startxref - 171 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤6: 执行 pdftoppm 命令,使用 -scale-to 参数将页面缩放至 200 像素的方框内" - pdftoppm -scale-to 200 test_input.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm 命令执行失败" - - LOG_INFO "步骤7: 检查生成的图像文件" - if [ -f "test_output-1.ppm" ]; then - LOG_INFO "成功生成缩放后的图像文件 test_output-1.ppm" - else - LOG_ERROR "未找到生成的图像文件" - exit 1 - fi - - LOG_INFO "步骤8: 清理测试文件" - rm -f test_input.pdf test_output-*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "步骤9: 卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - LOG_INFO "环境已恢复到测试前状态" - else - LOG_INFO "测试完成,保持 poppler-utils 安装状态" - fi - - LOG_INFO "测试脚本执行完毕" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_singlefile.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_singlefile.sh deleted file mode 100644 index 5c8dbfbc429..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_singlefile.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -singlefile 参数,只转换第一页且文件名不加页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdftoppm 命令的 -singlefile 参数功能" - LOG_INFO "步骤1: 检查测试环境是否已安装 poppler-utils 软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils 已安装,测试完成后将保持安装状态" - installed_flag=1 - else - LOG_INFO "poppler-utils 未安装,将在测试步骤中安装" - installed_flag=0 - fi - - LOG_INFO "步骤2: 检查 yum 源中是否存在 poppler-utils 软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum 源中未找到 poppler-utils 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中不存在 poppler-utils 软件包,无法继续测试" - exit 255 - fi - - if [ $installed_flag -eq 0 ]; then - LOG_INFO "步骤3: 安装 poppler-utils 软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 poppler-utils 软件包失败" - fi - - LOG_INFO "步骤4: 检查 pdftoppm 命令是否存在" - which pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm 命令不存在" - - LOG_INFO "步骤5: 检查 pdftoppm 命令是否支持 -singlefile 参数" - pdftoppm -h 2>&1 | grep -q "\-singlefile" - CHECK_RESULT $? 0 0 "pdftoppm 命令不支持 -singlefile 参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm 命令不支持 -singlefile 参数" - exit 255 - fi - - LOG_INFO "步骤6: 准备测试用的 PDF 文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT /F1 12 Tf 72 720 Td (Page 1) Tj ET - endstream - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT /F1 12 Tf 72 720 Td (Page 2) Tj ET - endstream - endobj - 7 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 8 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000117 00000 n - 0000000176 00000 n - 0000000270 00000 n - 0000000364 00000 n - 0000000458 00000 n - trailer - << - /Size 8 - /Root 1 0 R - >> - startxref - 558 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤7: 执行 pdftoppm -singlefile 命令转换第一页" - pdftoppm -singlefile test_input.pdf output_prefix > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm -singlefile 命令执行失败" - - LOG_INFO "步骤8: 验证输出文件是否存在且只有一个文件" - if [ -f "output_prefix.ppm" ]; then - LOG_INFO "输出文件 output_prefix.ppm 存在" - file_count=$(ls output_prefix*.ppm 2>/dev/null | wc -l) - CHECK_RESULT $file_count 1 0 "生成了多个输出文件,不符合 -singlefile 参数预期" - else - LOG_ERROR "输出文件 output_prefix.ppm 不存在" - CHECK_RESULT 1 0 0 "输出文件不存在" - fi - - LOG_INFO "步骤9: 验证输出文件内容不为空" - file_size=$(stat -c%s "output_prefix.ppm" 2>/dev/null) - if [ $file_size -gt 0 ]; then - LOG_INFO "输出文件大小正常: ${file_size} 字节" - CHECK_RESULT 0 0 0 "输出文件内容为空" - else - LOG_ERROR "输出文件大小为 0" - CHECK_RESULT 1 0 0 "输出文件内容为空" - fi - - LOG_INFO "步骤10: 清理测试生成的文件" - rm -f test_input.pdf output_prefix*.ppm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $installed_flag -eq 0 ]; then - LOG_INFO "步骤11: 卸载测试安装的 poppler-utils 软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 poppler-utils 软件包失败" - LOG_INFO "环境已恢复到测试前状态" - else - LOG_INFO "测试完成,保持 poppler-utils 安装状态" - fi - - LOG_INFO "测试 pdftoppm -singlefile 参数功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_special_question.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_special_question.sh deleted file mode 100644 index 27f7a16c2a2..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_special_question.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -? 参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 测试pdftoppm命令的-?参数,打印使用信息 - LOG_INFO "测试pdftoppm命令的-?参数,打印使用信息" - pdftoppm -? > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令不支持-?参数" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_sz.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_sz.sh deleted file mode 100644 index 36011cf3e21..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_sz.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -sz 参数,设置正方形裁剪区域的边长(像素) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 pdftoppm 命令的 -sz 参数" - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 检查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 "$PACKAGE_NAME 软件包已安装,脚本结束后将保持安装状态" - WAS_INSTALLED=true - else - LOG_INFO "$PACKAGE_NAME 软件包未安装,将在测试步骤中安装,并在脚本结束前卸载" - WAS_INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$WAS_INSTALLED" = false ]; then - LOG_INFO "安装 $PACKAGE_NAME 软件包" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装 $PACKAGE_NAME 软件包失败" - fi - - # 检查 pdftoppm 命令的 -sz 参数是否存在 - LOG_INFO "检查 pdftoppm 命令是否支持 -sz 参数" - if ! pdftoppm --help 2>&1 | grep -q -- "-sz"; then - LOG_ERROR "pdftoppm 命令不支持 -sz 参数" - exit 255 - fi - - # 准备一个简单的 PDF 文件用于测试 - LOG_INFO "创建一个简单的 PDF 文件用于测试" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Test PDF) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000222 00000 n - 0000000302 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 380 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - # 测试 pdftoppm 命令的 -sz 参数 - LOG_INFO "测试 pdftoppm 命令的 -sz 参数,设置正方形裁剪区域的边长为 100 像素" - pdftoppm test_input.pdf output -sz 100 - CHECK_RESULT $? 0 0 "pdftoppm 命令执行失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - if [ -f "output-1.ppm" ]; then - LOG_INFO "输出文件 output-1.ppm 存在,测试成功" - else - LOG_ERROR "输出文件 output-1.ppm 不存在,测试失败" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试生成的临时文件" - rm -f test_input.pdf output-1.ppm - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果脚本开始时未安装软件包,则在测试结束后卸载 - if [ "$WAS_INSTALLED" = false ]; then - LOG_INFO "卸载 $PACKAGE_NAME 软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载 $PACKAGE_NAME 软件包失败" - fi - - LOG_INFO "测试 pdftoppm 命令的 -sz 参数完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_tiff.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_tiff.sh deleted file mode 100644 index f0f10c8760b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_tiff.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -tiff 参数,生成TIFF文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(根据要求直接使用) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 测试用例描述:测试 pdftoppm 命令的 -tiff 参数,生成TIFF文件 - - # 步骤1:检查环境中是否已安装 poppler-utils 软件包 - LOG_INFO "步骤1:检查环境中是否已安装 poppler-utils 软件包" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils 未安装,将在测试步骤中安装" - INSTALLED_BEFORE=0 - fi - - # 步骤2:检查 yum 源中是否有 poppler-utils 软件包 - LOG_INFO "步骤2:检查 yum 源中是否有 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装 poppler-utils - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤3:安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 步骤4:检查 pdftoppm 命令是否支持 -tiff 参数 - LOG_INFO "步骤4:检查 pdftoppm 命令是否支持 -tiff 参数" - if ! pdftoppm -h 2>&1 | grep -q -- "-tiff"; then - LOG_ERROR "pdftoppm 命令不支持 -tiff 参数" - # 如果之前未安装,则需要卸载 - if [ $INSTALLED_BEFORE -eq 0 ]; then - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 步骤5:准备测试用的 PDF 文件 - LOG_INFO "步骤5:准备测试用的 PDF 文件" - TEST_PDF="test.pdf" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000162 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 261 - %%EOF" > $TEST_PDF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - # 步骤6:执行 pdftoppm 命令,使用 -tiff 参数生成 TIFF 文件 - LOG_INFO "步骤6:执行 pdftoppm 命令,使用 -tiff 参数生成 TIFF 文件" - OUTPUT_TIFF="output.tiff" - pdftoppm -tiff $TEST_PDF output - CHECK_RESULT $? 0 0 "pdftoppm 命令执行失败" - - # 步骤7:检查生成的 TIFF 文件是否存在且非空 - LOG_INFO "步骤7:检查生成的 TIFF 文件是否存在且非空" - if [ -f "${OUTPUT_TIFF}-1.tiff" ]; then - OUTPUT_TIFF="${OUTPUT_TIFF}-1.tiff" - fi - if [ ! -f "$OUTPUT_TIFF" ]; then - LOG_ERROR "未找到生成的 TIFF 文件" - CHECK_RESULT 1 0 0 "TIFF 文件未生成" - fi - if [ ! -s "$OUTPUT_TIFF" ]; then - LOG_ERROR "生成的 TIFF 文件为空" - CHECK_RESULT 1 0 0 "TIFF 文件为空" - fi - LOG_INFO "TIFF 文件生成成功:$OUTPUT_TIFF" - - # 步骤8:清理测试过程中生成的文件 - LOG_INFO "步骤8:清理测试过程中生成的文件" - rm -f $TEST_PDF output*.tiff output*.ppm output*.pbm output*.pgm output*.pnm - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9:如果测试前未安装,则卸载 poppler-utils 软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤9:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "步骤9:测试前已安装 poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_upper_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_upper_h.sh deleted file mode 100644 index 94e2cc27682..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_upper_h.sh +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -H 参数,设置裁剪区域的高度(像素) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已经安装,记录当前状态" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - which pdftoppm > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不存在" - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "清理安装的poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 检查-H参数是否支持 - LOG_INFO "检查pdftoppm命令是否支持-H参数" - pdftoppm -h 2>&1 | grep -q "\-H" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-H参数" - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "清理安装的poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 200 300] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 100 150 Td - (Test PDF) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 236 - %%EOF - EOF - - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-H参数 - LOG_INFO "测试pdftoppm命令的-H参数,设置裁剪区域高度为100像素" - pdftoppm -png -x 0 -y 0 -W 100 -H 100 test.pdf output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "使用-H参数执行pdftoppm命令失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否生成" - ls output-1.png > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 检查输出文件的高度是否为100像素 - LOG_INFO "检查输出文件的高度是否为100像素" - if command -v identify > /dev/null 2>&1; then - height=$(identify -format "%h" output-1.png 2>/dev/null) - if [ "$height" = "100" ]; then - LOG_INFO "输出文件高度为100像素,符合预期" - else - LOG_ERROR "输出文件高度为${height}像素,不符合预期100像素" - rm -f test.pdf output-1.png - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "清理安装的poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 1 - fi - else - LOG_INFO "未安装identify命令,跳过高度验证" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output-1.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试开始时未安装,则卸载软件包 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "清理安装的poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_upper_w.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_upper_w.sh deleted file mode 100644 index 903bd339efb..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_upper_w.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -W 参数,设置裁剪区域的宽度(像素) -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:检查poppler-utils是否已安装 - LOG_INFO "检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中不存在poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - which pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令不存在" - - # 检查pdftoppm命令是否支持-W参数 - LOG_INFO "检查pdftoppm命令是否支持-W参数" - pdftoppm -h 2>&1 | grep -q "\-W" - CHECK_RESULT $? 0 0 "pdftoppm命令不支持-W参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-W参数" - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 100 700 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000177 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 246 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-W参数,设置裁剪区域的宽度为200像素 - LOG_INFO "测试pdftoppm命令的-W参数,设置裁剪区域的宽度为200像素" - pdftoppm -singlefile -png -x 0 -y 0 -W 200 -H 300 test.pdf test_output - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - ls test_output.png > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_output.png - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 环境恢复:如果测试前未安装poppler-utils,则卸载 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_v.sh deleted file mode 100644 index 25e5bd85c2d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_v.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -v 参数,打印版权和版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "poppler-utils软件包未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 检查pdftoppm命令是否支持-v参数 - LOG_INFO "检查pdftoppm命令是否支持-v参数" - pdftoppm -v > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdftoppm命令不支持-v参数" - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 测试pdftoppm命令的-v参数,打印版权和版本信息 - LOG_INFO "测试pdftoppm命令的-v参数,打印版权和版本信息" - pdftoppm -v 2>&1 | grep -E "Copyright|Version" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm -v命令执行失败或未输出版权和版本信息" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "环境已恢复至初始状态" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_x.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_x.sh deleted file mode 100644 index d154422ce33..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_x.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -x 参数,设置裁剪区域左上角的X坐标 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftoppm命令是否存在 - LOG_INFO "检查pdftoppm命令是否存在" - which pdftoppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令不存在" - - # 检查pdftoppm命令是否支持-x参数 - LOG_INFO "检查pdftoppm命令是否支持-x参数" - pdftoppm -h 2>&1 | grep -q "\-x" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftoppm命令不支持-x参数" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 100 100] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 50 50 Td - (Test) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000174 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 261 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-x参数 - LOG_INFO "测试pdftoppm命令的-x参数,设置裁剪区域左上角的X坐标为10" - pdftoppm -x 10 test.pdf test_output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm命令执行失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - ls test_output-1.ppm > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test_output-1.ppm - - # 如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_y.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_y.sh deleted file mode 100644 index 33bd443cc9d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftoppm_y.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftoppm 命令的 -y 参数,设置裁剪区域左上角的Y坐标 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装,标记为未安装" - INSTALLED="false" - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftoppm命令的-y参数 - LOG_INFO "测试pdftoppm命令的-y参数,设置裁剪区域左上角的Y坐标" - pdftoppm -y 100 test.pdf output > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftoppm -y参数测试失败" - - # 清理生成的输出文件 - LOG_INFO "清理测试生成的输出文件" - rm -f output*.ppm test.pdf - CHECK_RESULT $? 0 0 "清理输出文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功,环境已恢复" - else - LOG_INFO "保持poppler-utils安装状态,环境已恢复" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_duplex.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_duplex.sh deleted file mode 100644 index 23eb3ed2203..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_duplex.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -duplex 参数,启用双面打印 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 pdftops 命令的 -duplex 参数,启用双面打印" - - # 检查软件包是否在yum源中 - LOG_INFO "检查poppler-utils软件包是否在yum源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装" - INSTALLED=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftops命令是否存在 - LOG_INFO "检查pdftops命令是否存在" - command -v pdftops &>/dev/null - CHECK_RESULT $? 0 0 "pdftops命令不存在" - - # 检查-duplex参数是否支持 - LOG_INFO "检查pdftops命令是否支持-duplex参数" - if ! pdftops -h 2>&1 | grep -q -- "-duplex"; then - LOG_ERROR "pdftops命令不支持-duplex参数" - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 35 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test Page) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用-duplex参数测试pdftops命令 - LOG_INFO "使用-duplex参数执行pdftops命令" - pdftops -duplex test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "pdftops命令执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - [ -f test_output.ps ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 检查输出文件是否包含双面打印相关设置(PostScript中通常体现为Duplex设置) - LOG_INFO "检查输出文件是否包含双面打印设置" - if grep -q -i "Duplex" test_output.ps; then - LOG_INFO "输出文件包含双面打印设置" - CHECK_RESULT 0 0 0 "双面打印设置检查通过" - else - LOG_ERROR "输出文件未找到双面打印设置" - CHECK_RESULT 1 0 0 "双面打印设置检查失败" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则在测试后卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_eps.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_eps.sh deleted file mode 100644 index 7798810ca1b..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_eps.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -eps 参数,生成 Encapsulated PostScript -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils未安装,将在测试中安装并在结束后卸载" - already_installed=false - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftops命令是否支持-eps参数 - LOG_INFO "检查pdftops命令是否支持-eps参数" - if ! pdftops -h 2>&1 | grep -q "\-eps"; then - LOG_ERROR "pdftops命令不支持-eps参数" - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello, World!) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000174 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 242 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftops命令的-eps参数生成Encapsulated PostScript文件 - LOG_INFO "使用pdftops命令的-eps参数生成Encapsulated PostScript文件" - pdftops -eps test_input.pdf test_output.eps - CHECK_RESULT $? 0 0 "pdftops命令执行失败" - - # 检查生成的EPS文件是否有效 - LOG_INFO "检查生成的EPS文件是否有效" - if [ -s test_output.eps ]; then - LOG_INFO "成功生成Encapsulated PostScript文件" - # 检查文件头部是否包含EPS标识 - if head -n 5 test_output.eps | grep -q "EPS"; then - LOG_INFO "生成的EPS文件格式正确" - else - LOG_ERROR "生成的EPS文件格式不正确" - # 清理测试文件 - rm -f test_input.pdf test_output.eps - exit 1 - fi - else - LOG_ERROR "生成的EPS文件为空" - # 清理测试文件 - rm -f test_input.pdf test_output.eps - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.eps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试开始时未安装poppler-utils,则在测试结束后卸载 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_f.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_f.sh deleted file mode 100644 index 6c4c0ed0622..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_f.sh +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -f 参数,指定起始打印页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试 pdftops 命令的 -f 参数,指定起始打印页码 - - LOG_INFO "开始测试 pdftops 命令的 -f 参数" - - # 检查是否已安装 poppler-utils 包 - LOG_INFO "检查 poppler-utils 是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils 已安装" - installed_before_test=true - else - LOG_INFO "poppler-utils 未安装" - installed_before_test=false - fi - - # 检查 yum 源中是否有 poppler-utils 包 - LOG_INFO "检查 yum 源中是否有 poppler-utils 包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中没有 poppler-utils 包" - exit 255 - fi - - # 如果未安装,则安装 poppler-utils - if [ "$installed_before_test" = false ]; then - LOG_INFO "安装 poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 检查 pdftops 命令是否存在 - LOG_INFO "检查 pdftops 命令是否存在" - which pdftops > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftops 命令不存在" - - # 检查 pdftops 命令是否支持 -f 参数 - LOG_INFO "检查 pdftops 命令是否支持 -f 参数" - pdftops -h 2>&1 | grep -q "\-f" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops 命令不支持 -f 参数" - # 恢复环境 - if [ "$installed_before_test" = false ]; then - LOG_INFO "卸载 poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试用的 PDF 文件 - LOG_INFO "创建测试用的 PDF 文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 7 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 8 0 R - >> - endobj - 6 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 1) Tj ET - endstream - endobj - 7 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 2) Tj ET - endstream - endobj - 8 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 3) Tj ET - endstream - endobj - 9 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 10 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000115 00000 n - 0000000225 00000 n - 0000000335 00000 n - 0000000445 00000 n - 0000000539 00000 n - 0000000633 00000 n - 0000000727 00000 n - trailer - << - /Size 10 - /Root 1 0 R - >> - startxref - 827 - %%EOF - EOF - - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - # 测试 pdftops 命令的 -f 参数 - LOG_INFO "测试 pdftops 命令的 -f 参数,指定起始页码为 2" - pdftops -f 2 test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "pdftops 命令执行失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - [ -f test_output.ps ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 检查输出文件内容 - LOG_INFO "检查输出文件内容" - # 简单的检查,确认文件不为空 - [ -s test_output.ps ] - CHECK_RESULT $? 0 0 "输出文件为空" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 恢复环境 - if [ "$installed_before_test" = false ]; then - LOG_INFO "卸载 poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_f_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_f_l.sh deleted file mode 100644 index 716507e8947..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_f_l.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -f 和 -l 参数组合,指定打印页码范围 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 检查软件包是否存在 - LOG_INFO "检查软件包 poppler-utils 是否在 yum 源中" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "软件包 poppler-utils 不在 yum 源中" - exit 255 - fi - - # 判断是否已安装 - LOG_INFO "检查 poppler-utils 是否已安装" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,脚本结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils 未安装,将进行安装和卸载" - INSTALLED_BEFORE=false - fi - - # 如果未安装,则安装 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装 poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 准备测试文件 - LOG_INFO "准备测试 PDF 文件" - cat > /tmp/test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 7 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 8 0 R - >> - endobj - 6 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 1) Tj ET - endstream - endobj - 7 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 2) Tj ET - endstream - endobj - 8 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 100 700 Td (Page 3) Tj ET - endstream - endobj - xref - 0 9 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000151 00000 n - 0000000200 00000 n - 0000000249 00000 n - 0000000298 00000 n - 0000000347 00000 n - trailer - << - /Size 9 - /Root 1 0 R - >> - startxref - 396 - %%EOF - EOF - - # 检查 pdftops 命令的 -f 和 -l 参数是否存在 - LOG_INFO "检查 pdftops 命令是否支持 -f 和 -l 参数" - if ! pdftops -h 2>&1 | grep -q -- "-f" || ! pdftops -h 2>&1 | grep -q -- "-l"; then - LOG_ERROR "pdftops 命令不支持 -f 或 -l 参数" - exit 255 - fi - - # 测试 pdftops 命令的 -f 和 -l 参数组合,指定打印页码范围 - LOG_INFO "测试 pdftops 命令的 -f 和 -l 参数组合,指定打印页码范围" - pdftops -f 2 -l 3 /tmp/test.pdf /tmp/output.ps - CHECK_RESULT $? 0 0 "pdftops 命令执行失败" - - # 验证输出文件是否生成 - LOG_INFO "验证输出文件是否生成" - [ -f /tmp/output.ps ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test.pdf /tmp/output.ps - - # 如果之前未安装,则卸载 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载 poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_h.sh deleted file mode 100644 index cc976345a69..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_h.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -h 参数,打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试 pdftops 命令的 -h 参数,打印使用信息" - - # 检查软件包是否在yum源中 - LOG_INFO "检查 yum 源中是否存在 poppler-utils 软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum 源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 检查环境是否已安装 - LOG_INFO "检查环境是否已安装 poppler-utils" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "环境已安装 poppler-utils,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "环境未安装 poppler-utils,将安装软件包作为测试步骤" - INSTALLED_BEFORE_TEST=false - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 测试 pdftops 命令的 -h 参数 - LOG_INFO "测试 pdftops 命令的 -h 参数,打印使用信息" - pdftops -h &> /dev/null - CHECK_RESULT $? 0 0 "pdftops 命令 -h 参数执行失败,可能参数不存在或不支持" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载 poppler-utils 软件包,恢复环境" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_l.sh deleted file mode 100644 index 3d6bf0206f7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_l.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -l 参数,指定结束打印页码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdftops 命令的 -l 参数功能" - LOG_INFO "步骤1:检查系统中是否已安装 poppler-utils 软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils 软件包已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils 软件包未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查 yum 源中是否有 poppler-utils 软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum 源中未找到 poppler-utils 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中不存在 poppler-utils 软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装 poppler-utils 软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装 poppler-utils 软件包失败" - fi - - LOG_INFO "步骤4:检查 pdftops 命令是否支持 -l 参数" - pdftops -h 2>&1 | grep -q "\-l" - CHECK_RESULT $? 0 0 "pdftops 命令不支持 -l 参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops 命令不支持 -l 参数" - exit 255 - fi - - LOG_INFO "步骤5:准备测试用的 PDF 文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 6 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 7 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 8 0 R - >> - endobj - 6 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 72 720 Td (Page 1) Tj ET - endstream - endobj - 7 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 72 720 Td (Page 2) Tj ET - endstream - endobj - 8 0 obj - << - /Length 35 - >> - stream - BT /F1 12 Tf 72 720 Td (Page 3) Tj ET - endstream - endobj - xref - 0 9 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000117 00000 n - 0000000176 00000 n - 0000000235 00000 n - 0000000294 00000 n - 0000000353 00000 n - 0000000412 00000 n - trailer - << - /Size 9 - /Root 1 0 R - >> - startxref - 461 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试 PDF 文件失败" - - LOG_INFO "步骤6:使用 pdftops -l 2 命令将 PDF 前两页转换为 PS 文件" - pdftops -l 2 test.pdf output.ps - CHECK_RESULT $? 0 0 "pdftops -l 2 命令执行失败" - - LOG_INFO "步骤7:验证输出的 PS 文件内容" - if [ -f output.ps ]; then - LOG_INFO "PS 文件生成成功" - grep -q "Page 1" output.ps - CHECK_RESULT $? 0 0 "PS 文件中未找到 Page 1" - grep -q "Page 2" output.ps - CHECK_RESULT $? 0 0 "PS 文件中未找到 Page 2" - grep -q "Page 3" output.ps - if [ $? -eq 0 ]; then - LOG_ERROR "PS 文件中包含 Page 3,但 -l 2 参数应只包含前两页" - exit 1 - else - LOG_INFO "PS 文件中未包含 Page 3,符合预期" - fi - else - LOG_ERROR "PS 文件未生成" - exit 1 - fi - - LOG_INFO "步骤8:清理测试文件" - rm -f test.pdf output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤9:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载 poppler-utils 软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_level1.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_level1.sh deleted file mode 100644 index d943b03ff6d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_level1.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -level1 参数,生成 Level 1 PostScript -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装poppler-utils - LOG_INFO "检查是否已经安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已经安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将在测试前安装并在测试后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中没有poppler-utils软件包" - - # 如果未安装,则安装poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftops命令是否存在-level1参数 - LOG_INFO "检查pdftops命令是否存在-level1参数" - pdftops -h 2>&1 | grep -q "\-level1" - CHECK_RESULT $? 0 255 "pdftops命令不支持-level1参数" - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << - /Size 4 - /Root 1 0 R - >> - startxref - 149 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftops命令的-level1参数 - LOG_INFO "测试pdftops命令的-level1参数,生成Level 1 PostScript" - pdftops -level1 test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "pdftops命令执行失败" - - # 检查生成的PostScript文件是否包含Level 1标识 - LOG_INFO "检查生成的PostScript文件是否包含Level 1标识" - grep -q "%%LanguageLevel: 1" test_output.ps - CHECK_RESULT $? 0 0 "生成的PostScript文件不是Level 1级别" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils软件包的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_level1_eps.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_level1_eps.sh deleted file mode 100644 index b60f7fe0dfd..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_level1_eps.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -level1 和 -eps 参数组合,生成 Level 1 封装的 PostScript -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - pkg_installed=$? - - # 记录初始安装状态 - if [ $pkg_installed -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,脚本结束后将保持安装状态" - else - LOG_INFO "poppler-utils软件包未安装,将在测试过程中安装并在结束后卸载" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $pkg_installed -ne 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - 0000000306 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 396 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftops命令的-level1和-eps参数组合 - LOG_INFO "测试pdftops命令的-level1和-eps参数组合,生成Level 1封装的PostScript" - pdftops -level1 -eps test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "pdftops命令执行失败" - - # 检查生成的PostScript文件 - LOG_INFO "检查生成的PostScript文件" - if [ -f test_output.ps ]; then - LOG_INFO "PostScript文件生成成功" - - # 检查文件内容是否包含EPS标记 - grep -q "%!PS-Adobe-3.0 EPSF-3.0" test_output.ps - CHECK_RESULT $? 0 0 "生成的PostScript文件不是EPS格式" - - # 检查文件内容是否包含Level 1标记 - grep -q "LanguageLevel: 1" test_output.ps - CHECK_RESULT $? 0 0 "生成的PostScript文件不是Level 1级别" - else - LOG_ERROR "PostScript文件未生成" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果最初未安装,则卸载软件包 - if [ $pkg_installed -ne 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "环境已恢复到初始状态" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_nocrop_nocenter.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_nocrop_nocenter.sh deleted file mode 100644 index a6d03c0367a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_nocrop_nocenter.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -nocrop 和 -nocenter 参数组合,不裁剪页面且不居中 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftops命令是否支持-nocrop参数 - LOG_INFO "检查pdftops命令是否支持-nocrop参数" - pdftops -h 2>&1 | grep -q "\-nocrop" - CHECK_RESULT $? 0 0 "pdftops命令不支持-nocrop参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops命令不支持-nocrop参数" - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 检查pdftops命令是否支持-nocenter参数 - LOG_INFO "检查pdftops命令是否支持-nocenter参数" - pdftops -h 2>&1 | grep -q "\-nocenter" - CHECK_RESULT $? 0 0 "pdftops命令不支持-nocenter参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops命令不支持-nocenter参数" - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建一个简单的PDF文件用于测试" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 100 700 Td (Test PDF) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000178 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftops命令的-nocrop和-nocenter参数组合 - LOG_INFO "测试pdftops命令的-nocrop和-nocenter参数组合,不裁剪页面且不居中" - pdftops -nocrop -nocenter test_input.pdf test_output.ps 2>&1 - CHECK_RESULT $? 0 0 "pdftops命令执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - if [ -f test_output.ps ]; then - LOG_INFO "输出文件test_output.ps已生成" - # 检查输出文件是否非空 - if [ -s test_output.ps ]; then - LOG_INFO "输出文件test_output.ps非空" - # 检查输出文件是否包含PostScript头部 - head -5 test_output.ps | grep -q "%!PS" - CHECK_RESULT $? 0 0 "输出文件不是有效的PostScript文件" - else - LOG_ERROR "输出文件test_output.ps为空" - CHECK_RESULT 1 0 0 "输出文件为空" - fi - else - LOG_ERROR "输出文件test_output.ps未生成" - CHECK_RESULT 1 0 0 "输出文件未生成" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_optimizecolorspace.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_optimizecolorspace.sh deleted file mode 100644 index 87b9cc5e8f4..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_optimizecolorspace.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -optimizecolorspace 参数,优化灰色RGB图像的色彩空间 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 pdftops 命令的 -optimizecolorspace 参数,优化灰色RGB图像的色彩空间" - LOG_INFO "步骤1:检查 yum 源中是否有 poppler-utils 软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum 源中没有找到 poppler-utils 软件包" - exit 255 - fi - LOG_INFO "步骤2:检查当前是否已安装 poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils 已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils 未安装,将在测试前安装,测试后卸载" - INSTALLED_BEFORE=false - fi - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤3:安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - LOG_INFO "步骤4:检查 pdftops 命令是否支持 -optimizecolorspace 参数" - pdftops --help 2>&1 | grep -q -- "-optimizecolorspace" - CHECK_RESULT $? 0 0 "pdftops 命令不支持 -optimizecolorspace 参数" - LOG_INFO "步骤5:创建一个包含灰色RGB图像的测试PDF文件" - cat > test_gray_rgb.tex << "EOF" - \documentclass{article} - \usepackage{graphicx} - \begin{document} - \includegraphics[width=0.5\textwidth]{example-image-duck} - \end{document} - EOF - pdflatex -interaction=nonstopmode test_gray_rgb.tex - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "步骤6:使用 -optimizecolorspace 参数优化PDF的色彩空间" - pdftops -optimizecolorspace test_gray_rgb.pdf test_optimized.ps - CHECK_RESULT $? 0 0 "pdftops 命令执行失败" - LOG_INFO "步骤7:检查优化后的文件是否生成" - [ -f test_optimized.ps ] - CHECK_RESULT $? 0 0 "优化后的PS文件未生成" - LOG_INFO "步骤8:清理测试过程中生成的文件" - rm -f test_gray_rgb.tex test_gray_rgb.aux test_gray_rgb.log test_gray_rgb.pdf test_optimized.ps - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "步骤9:卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_paper.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_paper.sh deleted file mode 100644 index a4a54f6de0a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_paper.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -paper 参数,指定纸张大小 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包..." - if dnf list installed poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装,测试结束后卸载" - INSTALLED_BEFORE_TEST=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包..." - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装poppler-utils软件包..." - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件..." - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000110 00000 n - 0000000204 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 320 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftops命令的-paper参数,指定纸张大小为A4 - LOG_INFO "测试pdftops命令的-paper参数,指定纸张大小为A4..." - pdftops -paper A4 test_input.pdf test_output_a4.ps - CHECK_RESULT $? 0 0 "pdftops命令执行失败,可能不支持-paper参数或A4纸张大小" - - # 验证生成的PS文件 - LOG_INFO "验证生成的PS文件..." - if [ -f test_output_a4.ps ]; then - LOG_INFO "成功生成PS文件:test_output_a4.ps" - # 简单检查文件内容 - if head -n 5 test_output_a4.ps | grep -q "PS-Adobe"; then - LOG_INFO "生成的PS文件格式正确" - else - LOG_ERROR "生成的PS文件格式不正确" - exit 1 - fi - else - LOG_ERROR "未生成PS文件" - exit 1 - fi - - # 测试pdftops命令的-paper参数,指定纸张大小为letter - LOG_INFO "测试pdftops命令的-paper参数,指定纸张大小为letter..." - pdftops -paper letter test_input.pdf test_output_letter.ps - CHECK_RESULT $? 0 0 "pdftops命令执行失败,可能不支持letter纸张大小" - - # 验证生成的PS文件 - LOG_INFO "验证生成的PS文件..." - if [ -f test_output_letter.ps ]; then - LOG_INFO "成功生成PS文件:test_output_letter.ps" - # 简单检查文件内容 - if head -n 5 test_output_letter.ps | grep -q "PS-Adobe"; then - LOG_INFO "生成的PS文件格式正确" - else - LOG_ERROR "生成的PS文件格式不正确" - exit 1 - fi - else - LOG_ERROR "未生成PS文件" - exit 1 - fi - - # 测试不支持的纸张大小,预期失败 - LOG_INFO "测试pdftops命令的-paper参数,指定不支持的纸张大小(预期失败)..." - pdftops -paper INVALID_SIZE test_input.pdf test_output_invalid.ps 2>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "pdftops命令应不支持INVALID_SIZE纸张大小,但执行成功" - exit 255 - else - LOG_INFO "pdftops命令正确处理了不支持的纸张大小参数" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件..." - rm -f test_input.pdf test_output_a4.ps test_output_letter.ps test_output_invalid.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载poppler-utils - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载poppler-utils软件包..." - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_q.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_q.sh deleted file mode 100644 index 0cd25e3bf6d..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_q.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -q 参数,不打印任何消息或错误 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了poppler-utils软件包 - LOG_INFO "检查是否已经安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建一个简单的PDF文件用于测试" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000009 00000 n - 0000000052 00000 n - 0000000105 00000 n - 0000000164 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 241 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建PDF文件失败" - - # 测试pdftops命令的-q参数 - LOG_INFO "测试pdftops命令的-q参数" - pdftops -q test.pdf test.ps 2>&1 | tee /tmp/pdftops_output.txt - if [ $? -ne 0 ]; then - # 检查是否是参数不支持的错误 - if grep -q "Unknown option" /tmp/pdftops_output.txt || grep -q "Invalid option" /tmp/pdftops_output.txt; then - LOG_ERROR "pdftops命令不支持-q参数" - exit 255 - else - LOG_ERROR "pdftops命令执行失败" - # 这里会返回pdftops命令的实际退出码 - exit $? - fi - fi - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - if [ -f test.ps ]; then - LOG_INFO "输出文件test.ps已生成" - # 检查输出文件是否非空 - if [ -s test.ps ]; then - LOG_INFO "输出文件test.ps非空,转换成功" - else - LOG_ERROR "输出文件test.ps为空" - exit 1 - fi - else - LOG_ERROR "输出文件test.ps未生成" - exit 1 - fi - - # 检查是否没有打印任何消息或错误(-q参数的作用) - LOG_INFO "检查是否没有打印任何消息或错误" - if [ -s /tmp/pdftops_output.txt ]; then - LOG_ERROR "pdftops命令有输出,但-q参数应该禁止所有输出" - exit 1 - else - LOG_INFO "pdftops命令没有输出,符合-q参数预期" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf test.ps /tmp/pdftops_output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_r.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_r.sh deleted file mode 100644 index d5e78fce2f1..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_r.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -r 参数,指定光栅化分辨率 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED_BEFORE="yes" - else - LOG_INFO "poppler-utils未安装,标记为未存在" - INSTALLED_BEFORE="no" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 检查pdftops命令的-r参数是否存在 - LOG_INFO "检查pdftops命令是否支持-r参数" - pdftops -h 2>&1 | grep -q "\-r" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops命令不支持-r参数" - exit 255 - fi - - # 创建一个简单的PDF文件用于测试 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000115 00000 n - trailer - << /Size 4 /Root 1 0 R >> - startxref - 184 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试pdftops命令的-r参数 - LOG_INFO "测试pdftops命令的-r参数,指定光栅化分辨率为150" - pdftops -r 150 test.pdf output.ps 2>&1 - CHECK_RESULT $? 0 0 "pdftops命令执行失败" - - # 检查生成的PS文件 - LOG_INFO "检查生成的PS文件" - if [ -f output.ps ]; then - LOG_INFO "成功生成PS文件" - # 简单检查文件内容 - head -5 output.ps | grep -q "%!PS" - CHECK_RESULT $? 0 0 "生成的PS文件格式不正确" - else - LOG_ERROR "未生成PS文件" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果之前未安装,则卸载poppler-utils - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "poppler-utils卸载成功" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_r_paper.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_r_paper.sh deleted file mode 100644 index e1595ef3df9..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_r_paper.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -r 和 -paper 参数组合,指定分辨率和纸张大小 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdftops命令的-r和-paper参数组合" - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - installed=$? - if [ $installed -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,测试后保持安装状态" - need_uninstall=false - else - LOG_INFO "poppler-utils软件包未安装,将在测试前安装" - need_uninstall=true - fi - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包,退出测试" - exit 255 - fi - - if [ "$need_uninstall" = true ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - LOG_INFO "检查pdftops命令是否支持-r参数" - pdftops -h 2>&1 | grep -q -- "-r" - CHECK_RESULT $? 0 0 "pdftops命令不支持-r参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops命令不支持-r参数,退出测试" - exit 255 - fi - - LOG_INFO "检查pdftops命令是否支持-paper参数" - pdftops -h 2>&1 | grep -q -- "-paper" - CHECK_RESULT $? 0 0 "pdftops命令不支持-paper参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops命令不支持-paper参数,退出测试" - exit 255 - fi - - LOG_INFO "创建一个简单的PDF测试文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << >> - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 15 - >> - stream - BT /F1 12 Tf 72 720 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000178 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建PDF测试文件失败" - - LOG_INFO "执行pdftops命令,使用-r 300和-paper A4参数" - pdftops -r 300 -paper A4 test_input.pdf test_output.ps 2>&1 - CHECK_RESULT $? 0 0 "pdftops命令执行失败" - - LOG_INFO "检查生成的PS文件是否有效" - file test_output.ps | grep -q "PostScript" - CHECK_RESULT $? 0 0 "生成的PS文件无效" - - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.ps - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$need_uninstall" = true ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "环境已恢复,poppler-utils软件包已卸载" - else - LOG_INFO "环境已恢复,保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试pdftops命令的-r和-paper参数组合完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_upper_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_upper_v.sh deleted file mode 100644 index 31647f69b63..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftops_upper_v.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试 pdftops 命令的 -v 参数,打印版权和版本信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(虽然题目说无需定义,但实际脚本中需要定义) - LOG_INFO() { - echo "[INFO] $1" - } - - LOG_ERROR() { - echo "[ERROR] $1" - } - - # 定义检查结果函数(虽然题目说无需定义,但实际脚本中需要定义) - CHECK_RESULT() { - if [ $1 -ne $2 ]; then - LOG_ERROR "$4" - exit $3 - fi - } - - # 定义SSH_CMD函数(虽然题目说无需定义,但实际脚本中需要定义) - SSH_CMD() { - # 这里只是占位,实际应根据具体环境实现 - echo "SSH_CMD not implemented" - exit 1 - } - - # 测试脚本开始 - LOG_INFO "开始测试 pdftops 命令的 -v 参数,打印版权和版本信息" - - # 检查软件包是否在yum源中 - LOG_INFO "检查 poppler-utils 软件包是否在yum源中" - dnf list available poppler-utils &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到 poppler-utils 软件包" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "检查 poppler-utils 是否已安装" - rpm -q poppler-utils &> /dev/null - if [ $? -eq 0 ]; then - INSTALLED=true - LOG_INFO "poppler-utils 已安装,测试结束后保持安装状态" - else - INSTALLED=false - LOG_INFO "poppler-utils 未安装,将在测试前安装" - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装 poppler-utils 软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装 poppler-utils 失败" - fi - - # 检查 pdftops 命令是否存在 - LOG_INFO "检查 pdftops 命令是否存在" - which pdftops &> /dev/null - CHECK_RESULT $? 0 0 "pdftops 命令不存在" - - # 检查 -v 参数是否支持 - LOG_INFO "检查 pdftops 命令是否支持 -v 参数" - pdftops -v 2>&1 | grep -q "version" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftops 命令不支持 -v 参数" - # 清理环境 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 执行测试 - LOG_INFO "执行 pdftops -v 命令,打印版权和版本信息" - pdftops -v - CHECK_RESULT $? 0 0 "pdftops -v 命令执行失败" - - # 清理环境 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "测试完成,卸载 poppler-utils 软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载 poppler-utils 失败" - else - LOG_INFO "测试完成,保持 poppler-utils 安装状态" - fi - - LOG_INFO "测试脚本执行完毕" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_bbox.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_bbox.sh deleted file mode 100644 index 282332204da..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_bbox.sh +++ /dev/null @@ -1,209 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试输出每个单词的边界框和页面尺寸到HTML -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 检查软件包是否存在 - check_package_exist() { - dnf list available "$1" &>/dev/null - return $? - } - - # 检查命令参数是否支持 - check_param_support() { - local cmd=$1 - local param=$2 - $cmd --help 2>&1 | grep -q -- "$param" - return $? - } - - # 主测试函数 - main() { - local package_name="poppler-utils" - local test_file="" - local output_file="output.html" - local installed_before_test=false - - # 步骤1:检查测试环境是否已安装poppler-utils - LOG_INFO "步骤1:检查测试环境是否已安装poppler-utils" - if rpm -q "$package_name" &>/dev/null; then - LOG_INFO "检测到$package_name已安装" - installed_before_test=true - else - LOG_INFO "检测到$package_name未安装" - fi - - # 步骤2:检查yum源中是否有poppler-utils软件包 - LOG_INFO "步骤2:检查yum源中是否有poppler-utils软件包" - if ! check_package_exist "$package_name"; then - LOG_ERROR "yum源中未找到$package_name软件包" - exit 255 - fi - - # 步骤3:如果未安装则安装poppler-utils - if [ "$installed_before_test" = false ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 步骤4:验证pdftotext命令是否存在 - LOG_INFO "步骤4:验证pdftotext命令是否存在" - if ! command -v pdftotext &>/dev/null; then - LOG_ERROR "pdftotext命令不存在" - if [ "$installed_before_test" = false ]; then - dnf remove -y "$package_name" - fi - exit 1 - fi - - # 步骤5:检查-bbox参数是否支持 - LOG_INFO "步骤5:检查-bbox参数是否支持" - if ! check_param_support "pdftotext" "-bbox"; then - LOG_ERROR "pdftotext不支持-bbox参数" - if [ "$installed_before_test" = false ]; then - dnf remove -y "$package_name" - fi - exit 255 - fi - - # 步骤6:创建测试PDF文件 - LOG_INFO "步骤6:创建测试PDF文件" - test_file=$(mktemp /tmp/test_pdf_XXXXXX.pdf) - cat > "$test_file" << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000179 00000 n - 0000000307 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 377 - %%EOF - EOF - - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤7:执行pdftotext命令输出边界框和页面尺寸到HTML - LOG_INFO "步骤7:执行pdftotext命令输出边界框和页面尺寸到HTML" - pdftotext -bbox "$test_file" "$output_file" - CHECK_RESULT $? 0 0 "执行pdftotext命令失败" - - # 步骤8:验证输出文件是否生成 - LOG_INFO "步骤8:验证输出文件是否生成" - if [ -f "$output_file" ]; then - LOG_INFO "成功生成输出文件: $output_file" - # 检查输出文件内容 - if grep -q "bbox" "$output_file" && grep -q "page" "$output_file"; then - LOG_INFO "输出文件包含边界框和页面尺寸信息" - else - LOG_ERROR "输出文件缺少边界框或页面尺寸信息" - CHECK_RESULT 1 0 0 "输出文件内容验证失败" - fi - else - LOG_ERROR "输出文件未生成" - CHECK_RESULT 1 0 0 "输出文件生成失败" - fi - - # 步骤9:清理临时文件 - LOG_INFO "步骤9:清理临时文件" - [ -f "$test_file" ] && rm -f "$test_file" - [ -f "$output_file" ] && rm -f "$output_file" - - # 步骤10:恢复测试环境 - LOG_INFO "步骤10:恢复测试环境" - if [ "$installed_before_test" = false ]; then - LOG_INFO "卸载测试安装的poppler-utils软件包" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" - } - - # 执行主函数 - main "$@" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_bbox_layout.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_bbox_layout.sh deleted file mode 100644 index d04f171a171..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_bbox_layout.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试输出包含额外布局边界框数据的HTML -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试输出包含额外布局边界框数据的HTML功能" - - # 检查是否已安装poppler-utils软件包 - LOG_INFO "步骤1: 检查poppler-utils是否已安装" - if rpm -q poppler-utils > /dev/null 2>&1; then - LOG_INFO "poppler-utils已安装" - INSTALLED_BY_SCRIPT=false - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - INSTALLED_BY_SCRIPT=true - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "步骤2: 检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BY_SCRIPT" = true ]; then - LOG_INFO "步骤3: 安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否支持-bbox-layout参数 - LOG_INFO "步骤4: 检查pdftotext命令是否支持-bbox-layout参数" - if ! pdftotext -h 2>&1 | grep -q "bbox-layout"; then - LOG_ERROR "pdftotext命令不支持-bbox-layout参数" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "步骤5: 创建测试PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000111 00000 n - 0000000239 00000 n - 0000000381 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 449 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用-bbox-layout参数转换PDF为HTML - LOG_INFO "步骤6: 使用-bbox-layout参数将PDF转换为HTML" - pdftotext -bbox-layout test_input.pdf test_output.html - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - # 检查生成的HTML文件是否包含边界框数据 - LOG_INFO "步骤7: 检查生成的HTML文件是否包含边界框数据" - if grep -q "bbox" test_output.html; then - LOG_INFO "HTML文件包含边界框数据" - CHECK_RESULT 0 0 0 "检查边界框数据" - else - LOG_ERROR "HTML文件未包含边界框数据" - CHECK_RESULT 1 0 1 "检查边界框数据" - fi - - # 清理测试文件 - LOG_INFO "步骤8: 清理测试文件" - rm -f test_input.pdf test_output.html - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本安装的软件包,则在测试结束后卸载 - if [ "$INSTALLED_BY_SCRIPT" = true ]; then - LOG_INFO "步骤9: 卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_colspacing.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_colspacing.sh deleted file mode 100644 index 8da58efed91..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_colspacing.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试设置列间距判定阈值 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化变量 - PACKAGE_NAME="poppler-utils" - COMMAND_NAME="pdftotext" - PARAM_NAME="-colspacing" - - # 检查yum源中是否存在指定软件包 - LOG_INFO "检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available ${PACKAGE_NAME} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在${PACKAGE_NAME}软件包" - exit 255 - fi - - # 判断软件包是否已安装 - LOG_INFO "检查${PACKAGE_NAME}是否已安装" - rpm -q ${PACKAGE_NAME} &>/dev/null - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "${PACKAGE_NAME}已安装" - else - INSTALLED="false" - LOG_INFO "${PACKAGE_NAME}未安装" - fi - - # 如果未安装,则安装软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 检查pdftotext命令是否支持-colspacing参数 - LOG_INFO "检查${COMMAND_NAME}命令是否支持${PARAM_NAME}参数" - ${COMMAND_NAME} -h 2>&1 | grep -q "${PARAM_NAME}" - if [ $? -ne 0 ]; then - LOG_ERROR "${COMMAND_NAME}命令不支持${PARAM_NAME}参数" - # 如果未安装,则卸载软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 测试设置列间距判定阈值 - LOG_INFO "测试设置列间距判定阈值" - # 创建一个简单的PDF文件用于测试 - cat > /tmp/test.pdf <> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Test PDF for column spacing) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 232 - %%EOF - EOF - - # 使用-colspacing参数运行pdftotext命令 - LOG_INFO "使用${PARAM_NAME}参数运行${COMMAND_NAME}命令" - ${COMMAND_NAME} ${PARAM_NAME} 10 /tmp/test.pdf /tmp/output.txt - CHECK_RESULT $? 0 0 "使用${PARAM_NAME}参数运行${COMMAND_NAME}命令失败" - - # 检查输出文件是否存在 - LOG_INFO "检查输出文件是否存在" - [ -f /tmp/output.txt ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 检查输出文件内容 - LOG_INFO "检查输出文件内容" - cat /tmp/output.txt | grep -q "Test PDF for column spacing" - CHECK_RESULT $? 0 0 "输出文件内容不符合预期" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test.pdf /tmp/output.txt - - # 如果测试开始时未安装,则卸载软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_cropbox.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_cropbox.sh deleted file mode 100644 index ad1b88e4310..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_cropbox.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用裁剪框而非媒体框 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:使用裁剪框而非媒体框" - - # 检查是否已安装poppler-utils - if ! rpm -q poppler-utils > /dev/null 2>&1; then - LOG_INFO "poppler-utils未安装,开始安装" - # 检查yum源中是否有poppler-utils - if ! dnf list available poppler-utils > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils包" - exit 255 - fi - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils已安装" - INSTALLED_FLAG=0 - fi - - # 检查pdftotext命令是否支持-cropbox参数 - LOG_INFO "检查pdftotext命令是否支持-cropbox参数" - if ! pdftotext -h 2>&1 | grep -q "\-cropbox"; then - LOG_ERROR "pdftotext命令不支持-cropbox参数" - if [ $INSTALLED_FLAG -eq 1 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /CropBox [50 50 562 742] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 100 700 Td - (Hello, World!) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 281 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用-cropbox参数提取文本 - LOG_INFO "使用-cropbox参数提取文本" - pdftotext -cropbox test_input.pdf test_output.txt - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - # 检查输出文件是否存在且非空 - LOG_INFO "检查输出文件" - if [ -s test_output.txt ]; then - LOG_INFO "输出文件生成成功" - # 检查提取的文本内容 - if grep -q "Hello, World!" test_output.txt; then - LOG_INFO "文本提取正确:成功提取"Hello, World!"" - else - LOG_ERROR "文本提取错误:未找到预期文本" - CHECK_RESULT 1 0 0 "文本内容不匹配" - fi - else - LOG_ERROR "输出文件为空或不存在" - CHECK_RESULT 1 0 0 "输出文件异常" - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试过程中安装了软件包,则卸载 - if [ $INSTALLED_FLAG -eq 1 ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成:使用裁剪框而非媒体框" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_enc.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_enc.sh deleted file mode 100644 index e13494fe5e7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_enc.sh +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试指定输出文本编码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试poppler-utils的pdftotext命令的编码功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list --available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查环境是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils未安装,将进行安装" - already_installed=false - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否存在 - LOG_INFO "检查pdftotext命令是否存在" - if ! command -v pdftotext &>/dev/null; then - LOG_ERROR "pdftotext命令不存在" - exit 255 - fi - - # 检查pdftotext是否支持-enc参数 - LOG_INFO "检查pdftotext是否支持-enc参数" - if ! pdftotext -h 2>&1 | grep -q -- -enc; then - LOG_ERROR "pdftotext命令不支持-enc参数" - exit 255 - fi - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << - /Font << - /F1 4 0 R - >> - >> - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000178 00000 n - 0000000306 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 380 - %%EOF - EOF - - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试使用UTF-8编码输出文本 - LOG_INFO "测试使用UTF-8编码输出文本" - pdftotext -enc UTF-8 test.pdf output_utf8.txt - CHECK_RESULT $? 0 0 "使用UTF-8编码转换PDF失败" - - # 验证输出文件内容 - LOG_INFO "验证输出文件内容" - if [ -f output_utf8.txt ]; then - grep -q "Hello World" output_utf8.txt - CHECK_RESULT $? 0 0 "输出文件内容不正确" - else - LOG_ERROR "输出文件未生成" - exit 1 - fi - - # 测试使用ASCII编码输出文本 - LOG_INFO "测试使用ASCII编码输出文本" - pdftotext -enc ASCII test.pdf output_ascii.txt - CHECK_RESULT $? 0 0 "使用ASCII编码转换PDF失败" - - # 验证输出文件内容 - LOG_INFO "验证输出文件内容" - if [ -f output_ascii.txt ]; then - grep -q "Hello World" output_ascii.txt - CHECK_RESULT $? 0 0 "输出文件内容不正确" - else - LOG_ERROR "输出文件未生成" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output_utf8.txt output_ascii.txt - - # 如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_eol.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_eol.sh deleted file mode 100644 index e3c37fe3cc8..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_eol.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试指定输出行尾符 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试指定输出行尾符" - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "检查系统是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "检测到poppler-utils已安装,测试后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将作为测试步骤进行安装" - ALREADY_INSTALLED=0 - fi - - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "检查pdftotext命令是否支持-eol参数" - if ! pdftotext -h 2>&1 | grep -q -- "-eol"; then - LOG_ERROR "pdftotext命令不支持-eol参数" - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - LOG_INFO "创建测试用PDF文件" - cat > /tmp/test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000178 00000 n - 0000000304 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 402 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "测试pdftotext使用-eol unix参数(LF行尾)" - pdftotext -eol unix /tmp/test_input.pdf /tmp/test_output_unix.txt - CHECK_RESULT $? 0 0 "pdftotext -eol unix执行失败" - if [ -f /tmp/test_output_unix.txt ]; then - if file /tmp/test_output_unix.txt | grep -q "CRLF"; then - LOG_ERROR "文件行尾包含CRLF,与预期unix(LF)不符" - CHECK_RESULT 1 0 0 "行尾符检查失败" - else - LOG_INFO "unix行尾符测试通过" - fi - fi - - LOG_INFO "测试pdftotext使用-eol dos参数(CRLF行尾)" - pdftotext -eol dos /tmp/test_input.pdf /tmp/test_output_dos.txt - CHECK_RESULT $? 0 0 "pdftotext -eol dos执行失败" - if [ -f /tmp/test_output_dos.txt ]; then - if ! file /tmp/test_output_dos.txt | grep -q "CRLF"; then - LOG_ERROR "文件行尾不包含CRLF,与预期dos(CRLF)不符" - CHECK_RESULT 1 0 0 "行尾符检查失败" - else - LOG_INFO "dos行尾符测试通过" - fi - fi - - LOG_INFO "测试pdftotext使用-eol mac参数(CR行尾)" - pdftotext -eol mac /tmp/test_input.pdf /tmp/test_output_mac.txt - CHECK_RESULT $? 0 0 "pdftotext -eol mac执行失败" - LOG_INFO "mac行尾符测试执行完成(具体验证可能需要特殊工具)" - - LOG_INFO "清理测试文件" - rm -f /tmp/test_input.pdf /tmp/test_output_unix.txt /tmp/test_output_dos.txt /tmp/test_output_mac.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "指定输出行尾符测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_f.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_f.sh deleted file mode 100644 index a0e1f0d91f9..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_f.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试指定起始页码进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:测试指定起始页码进行转换" - - LOG_INFO "步骤1:检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中不存在poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查系统是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将进行安装" - INSTALLED_BEFORE=false - fi - - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:准备测试用的PDF文件" - cat > /tmp/test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R] - /Count 2 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 6 0 R - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1 Content) Tj - ET - endstream - endobj - 6 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2 Content) Tj - ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000159 00000 n - 0000000212 00000 n - 0000000265 00000 n - trailer - << - /Size 7 - /Root 1 0 R - >> - startxref - 309 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤5:检查pdftotext命令是否支持-f参数" - if ! pdftotext -h 2>&1 | grep -q -- "-f"; then - LOG_ERROR "pdftotext命令不支持-f参数" - exit 255 - fi - - LOG_INFO "步骤6:测试从第2页开始转换PDF为文本" - pdftotext -f 2 /tmp/test.pdf /tmp/output.txt - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - LOG_INFO "步骤7:验证转换结果" - if grep -q "Page 2 Content" /tmp/output.txt && ! grep -q "Page 1 Content" /tmp/output.txt; then - LOG_INFO "转换结果符合预期:只包含第2页内容" - else - LOG_ERROR "转换结果不符合预期" - exit 1 - fi - - LOG_INFO "步骤8:清理测试文件" - rm -f /tmp/test.pdf /tmp/output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "步骤9:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤9:保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成:指定起始页码转换功能正常" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_f_l.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_f_l.sh deleted file mode 100644 index 1e3fa42988e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_f_l.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试同时指定起始和结束页码进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试同时指定起始和结束页码进行转换功能" - LOG_INFO "检查系统中是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "poppler-utils未安装,将在测试前安装并在测试后卸载" - INSTALLED_BEFORE=false - fi - - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "检查pdftotext命令是否支持-f和-l参数" - pdftotext -h 2>&1 | grep -q -- "-f" - CHECK_RESULT $? 0 0 "pdftotext命令不支持-f参数" - pdftotext -h 2>&1 | grep -q -- "-l" - CHECK_RESULT $? 0 0 "pdftotext命令不支持-l参数" - - LOG_INFO "创建测试PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R 4 0 R 5 0 R] - /Count 3 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 6 0 R - >> - endobj - 4 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 7 0 R - >> - endobj - 5 0 obj - << - /Type /Page - /Parent 2 0 R - /Contents 8 0 R - >> - endobj - 6 0 obj - << - /Length 35 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 1) Tj - ET - endstream - endobj - 7 0 obj - << - /Length 35 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 2) Tj - ET - endstream - endobj - 8 0 obj - << - /Length 35 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Page 3) Tj - ET - endstream - endobj - 9 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 10 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000160 00000 n - 0000000214 00000 n - 0000000268 00000 n - 0000000322 00000 n - 0000000376 00000 n - 0000000430 00000 n - trailer - << - /Size 10 - /Root 1 0 R - >> - startxref - 480 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "执行pdftotext命令,指定起始页码为2,结束页码为3" - pdftotext -f 2 -l 3 test.pdf output.txt - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - LOG_INFO "检查输出文件内容" - if [ -f output.txt ]; then - LOG_INFO "输出文件已生成,检查内容" - grep -q "Page 2" output.txt - CHECK_RESULT $? 0 0 "输出文件中未找到"Page 2"" - grep -q "Page 3" output.txt - CHECK_RESULT $? 0 0 "输出文件中未找到"Page 3"" - grep -q "Page 1" output.txt && CHECK_RESULT 1 0 0 "输出文件中不应包含"Page 1"" - else - LOG_ERROR "输出文件未生成" - CHECK_RESULT 1 0 0 "输出文件未生成" - fi - - LOG_INFO "清理测试文件" - rm -f test.pdf output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_fixed.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_fixed.sh deleted file mode 100644 index 86ff07d766a..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_fixed.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试以固定宽度字体模式进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试环境初始化检查 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到poppler-utils已安装,脚本将保持安装状态" - INSTALLED_BEFORE="true" - else - LOG_INFO "检测到poppler-utils未安装,将在测试过程中安装" - INSTALLED_BEFORE="false" - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果之前未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 检查pdftotext命令是否支持-fixed参数 - LOG_INFO "检查pdftotext命令是否支持-fixed参数" - pdftotext -h 2>&1 | grep -q "\-fixed" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不支持-fixed参数" - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 100 700 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000176 00000 n - 0000000285 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 392 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试以固定宽度字体模式进行转换 - LOG_INFO "测试以固定宽度字体模式进行转换" - pdftotext -fixed 4 test_input.pdf test_output.txt 2>&1 - CHECK_RESULT $? 0 0 "以固定宽度字体模式转换PDF失败" - - # 验证转换结果 - LOG_INFO "验证转换结果文件是否存在" - [ -f test_output.txt ] - CHECK_RESULT $? 0 0 "转换结果文件未生成" - - LOG_INFO "验证转换结果文件内容" - [ -s test_output.txt ] - CHECK_RESULT $? 0 0 "转换结果文件为空" - - # 清理临时文件 - LOG_INFO "清理临时测试文件" - rm -f test_input.pdf test_output.txt - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 环境恢复 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载测试过程中安装的poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "保持poppler-utils软件包的安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_h.sh deleted file mode 100644 index 91a8126636e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_h.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试打印帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装,测试结束后将卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 测试打印帮助信息 - LOG_INFO "测试pdftotext命令的-h参数打印帮助信息" - pdftotext -h > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftotext -h命令执行失败" - - LOG_INFO "测试pdftotext命令的--help参数打印帮助信息" - pdftotext --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdftotext --help命令执行失败" - - # 测试不支持的参数 - LOG_INFO "测试pdftotext命令不支持的参数" - pdftotext --invalid-param > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_INFO "pdftotext不支持--invalid-param参数,符合预期" - else - LOG_ERROR "pdftotext对不支持参数的处理不符合预期" - exit 255 - fi - - # 环境清理 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_htmlmeta.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_htmlmeta.sh deleted file mode 100644 index e0163b9e386..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_htmlmeta.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试生成包含元信息的简单HTML文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数 - CHECK_RESULT() { - local actual=$1 - local expect=$2 - local exit_code=$3 - local msg=$4 - if [ "$actual" -eq "$expect" ]; then - LOG_INFO "$msg 成功" - return 0 - else - LOG_ERROR "$msg 失败" - exit $exit_code - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_pass=$3 - local node_user=$4 - sshpass -p "$node_pass" ssh -o StrictHostKeyChecking=no "$node_user@$node_ip" "$cmd" - } - - # 测试脚本主逻辑 - LOG_INFO "开始测试:测试生成包含元信息的简单HTML文件" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在poppler-utils软件包" - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - if rpm -q poppler-utils >/dev/null 2>&1; then - LOG_INFO "poppler-utils已安装,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils未安装,将在测试中安装并测试后卸载" - already_installed=false - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 1 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否存在 - LOG_INFO "检查pdftotext命令是否存在" - command -v pdftotext >/dev/null 2>&1 - CHECK_RESULT $? 0 255 "pdftotext命令不存在" - - # 检查pdftotext命令是否支持-htmlmeta参数 - LOG_INFO "检查pdftotext命令是否支持-htmlmeta参数" - pdftotext -v 2>&1 | grep -q "htmlmeta" - CHECK_RESULT $? 0 255 "pdftotext命令不支持-htmlmeta参数" - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello, World!) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000151 00000 n - 0000000306 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 364 - %%EOF - EOF - CHECK_RESULT $? 0 1 "创建测试PDF文件失败" - - # 使用pdftotext生成包含元信息的HTML文件 - LOG_INFO "使用pdftotext生成包含元信息的HTML文件" - pdftotext -htmlmeta test.pdf test_output.html - CHECK_RESULT $? 0 1 "生成HTML文件失败" - - # 检查生成的HTML文件是否包含元信息 - LOG_INFO "检查生成的HTML文件是否包含元信息" - if [ -f test_output.html ]; then - if grep -q " /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - LOG_INFO "检查pdftotext命令是否支持-endpo参数" - pdftotext -h 2>&1 | grep -q "\-endpo" - CHECK_RESULT $? 0 0 "pdftotext命令不支持-endpo参数" - LOG_INFO "检查环境是否已安装poppler-utils" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_INFO "环境未安装poppler-utils,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - NEED_UNINSTALL=1 - else - LOG_INFO "环境已安装poppler-utils" - NEED_UNINSTALL=0 - fi - LOG_INFO "准备测试PDF文件" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /Contents 5 0 R >> - endobj - 4 0 obj - << /Type /Page /Parent 2 0 R /Contents 6 0 R >> - endobj - 5 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 1) Tj ET - endstream - endobj - 6 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Page 2) Tj ET - endstream - endobj - xref - 0 7 - 0000000000 65535 f - 0000000009 00000 n - 0000000058 00000 n - 0000000113 00000 n - 0000000168 00000 n - 0000000223 00000 n - 0000000278 00000 n - trailer - << /Size 7 /Root 1 0 R >> - startxref - 333 - %%EOF" > test.pdf - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - LOG_INFO "执行pdftotext命令,指定结束页码为1" - pdftotext -endpo 1 test.pdf output.txt - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - LOG_INFO "检查输出文件内容" - grep -q "Page 1" output.txt - CHECK_RESULT $? 0 0 "输出文件中未找到"Page 1"" - grep -q "Page 2" output.txt - if [ $? -eq 0 ]; then - LOG_ERROR "输出文件中不应包含"Page 2"" - exit 1 - fi - LOG_INFO "清理测试文件" - rm -f test.pdf output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_layout.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_layout.sh deleted file mode 100644 index 1ed57d444df..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_layout.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试保持原始物理布局进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:测试保持原始物理布局进行转换" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - already_installed=false - fi - - # 如果未安装,则安装poppler-utils - if [ "$already_installed" = false ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否存在 - LOG_INFO "检查pdftotext命令是否存在" - if ! command -v pdftotext &>/dev/null; then - LOG_ERROR "pdftotext命令不存在" - exit 255 - fi - - # 检查-layout参数是否支持 - LOG_INFO "检查pdftotext的-layout参数是否支持" - pdftotext -h 2>&1 | grep -q -- "-layout" - CHECK_RESULT $? 0 255 "pdftotext不支持-layout参数" - - # 准备测试PDF文件 - LOG_INFO "准备测试PDF文件" - cat > test_input.pdf << "EOF" - %PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 281 - %%EOF - EOF - - # 使用-layout参数转换PDF - LOG_INFO "使用-layout参数转换PDF文件" - pdftotext -layout test_input.pdf test_output.txt - CHECK_RESULT $? 0 0 "pdftotext -layout执行失败" - - # 验证输出文件 - LOG_INFO "验证输出文件" - if [ -f test_output.txt ]; then - LOG_INFO "输出文件创建成功" - # 检查输出内容 - if grep -q "Hello World" test_output.txt; then - LOG_INFO "输出内容包含预期的文本" - else - LOG_ERROR "输出内容不包含预期的文本" - exit 1 - fi - else - LOG_ERROR "输出文件未创建" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf test_output.txt - - # 如果测试前未安装,则卸载poppler-utils - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成:测试保持原始物理布局进行转换" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_listenc.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_listenc.sh deleted file mode 100644 index 01a62b0887e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_listenc.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试列出可用编码 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:测试列出可用编码 - - LOG_INFO "开始测试:测试列出可用编码" - - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 检查软件包是否已安装 - LOG_INFO "检查软件包是否已安装" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,脚本结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "软件包未安装,将在测试过程中安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查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 - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "安装软件包:$PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 测试pdftotext命令的listenc参数 - LOG_INFO "测试pdftotext命令的listenc参数" - pdftotext -listenc > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdftotext命令不支持listenc参数" - exit 255 - fi - - # 执行pdftotext -listenc命令 - LOG_INFO "执行pdftotext -listenc命令" - pdftotext -listenc - CHECK_RESULT $? 0 0 "执行pdftotext -listenc命令失败" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = "false" ]; then - LOG_INFO "卸载软件包:$PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成:测试列出可用编码" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_nodiag.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_nodiag.sh deleted file mode 100644 index 4f2b2c424bd..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_nodiag.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试丢弃对角线文本进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试poppler-utils中的pdftotext命令,测试丢弃对角线文本进行转换的功能" - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - rpm -q poppler-utils &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "poppler-utils未安装,将在测试步骤中安装" - INSTALLED=false - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装poppler-utils" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否支持-nodiag参数 - LOG_INFO "检查pdftotext命令是否支持-nodiag参数" - pdftotext -h 2>&1 | grep -q "\-nodiag" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不支持-nodiag参数" - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 255 - fi - - # 准备测试用的PDF文件 - LOG_INFO "准备测试用的PDF文件" - TEST_PDF="test_nodiag.pdf" - TEST_TXT="test_nodiag.txt" - cat > $TEST_PDF << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000161 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 221 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用-nodiag参数运行pdftotext命令 - LOG_INFO "使用-nodiag参数运行pdftotext命令" - pdftotext -nodiag $TEST_PDF $TEST_TXT - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - # 检查转换后的文本文件是否存在且非空 - LOG_INFO "检查转换后的文本文件" - if [ -s "$TEST_TXT" ]; then - LOG_INFO "文本文件生成成功" - else - LOG_ERROR "文本文件生成失败或为空" - # 清理临时文件 - rm -f $TEST_PDF $TEST_TXT - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - fi - exit 1 - fi - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f $TEST_PDF $TEST_TXT - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_nopgbrk.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_nopgbrk.sh deleted file mode 100644 index 17e4facb863..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_nopgbrk.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试不在页面间插入分页符 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试不在页面间插入分页符" - LOG_INFO "步骤1:检查环境中是否已安装poppler-utils软件包" - if dnf list installed poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已安装,跳过安装步骤" - INSTALLED="yes" - else - LOG_INFO "poppler-utils未安装,将进行安装" - INSTALLED="no" - fi - - LOG_INFO "步骤2:检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &> /dev/null; then - LOG_ERROR "yum源中未找到poppler-utils软件包,退出测试" - exit 255 - fi - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:检查pdftotext命令是否支持-nopgbrk参数" - if ! pdftotext -h 2>&1 | grep -q "\-nopgbrk"; then - LOG_ERROR "pdftotext命令不支持-nopgbrk参数,退出测试" - exit 255 - fi - - LOG_INFO "步骤5:创建一个简单的PDF文件用于测试" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << - /Font << - /F1 4 0 R - >> - >> - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000204 00000 n - 0000000248 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 350 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - LOG_INFO "步骤6:使用pdftotext命令转换PDF为文本,不使用-nopgbrk参数(默认行为)" - pdftotext test_input.pdf output_default.txt - CHECK_RESULT $? 0 0 "pdftotext转换失败(默认)" - - LOG_INFO "步骤7:使用pdftotext命令转换PDF为文本,使用-nopgbrk参数" - pdftotext -nopgbrk test_input.pdf output_nopgbrk.txt - CHECK_RESULT $? 0 0 "pdftotext转换失败(使用-nopgbrk)" - - LOG_INFO "步骤8:比较两个输出文件,验证-nopgbrk参数效果" - if cmp -s output_default.txt output_nopgbrk.txt; then - LOG_INFO "输出文件内容相同,-nopgbrk参数未产生预期效果" - else - LOG_INFO "输出文件内容不同,-nopgbrk参数生效" - fi - - LOG_INFO "步骤9:清理测试生成的文件" - rm -f test_input.pdf output_default.txt output_nopgbrk.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "步骤10:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_opw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_opw.sh deleted file mode 100644 index 711dbb19a85..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_opw.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用所有者密码打开加密文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数 - LOG_INFO() { - echo "[INFO] $1" - } - - LOG_ERROR() { - echo "[ERROR] $1" - } - - # 定义检查函数 - CHECK_RESULT() { - if [ $1 -eq $2 ]; then - LOG_INFO "$4" - else - LOG_ERROR "$4" - exit $3 - fi - } - - # 定义SSH命令函数 - SSH_CMD() { - sshpass -p "$3" ssh -o StrictHostKeyChecking=no "$4"@"$2" "$1" - } - - # 定义环境恢复函数 - cleanup() { - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境,卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - } - - # 设置trap,确保脚本退出时执行清理 - trap cleanup EXIT - - # 检查是否已经安装poppler-utils - LOG_INFO "检查是否已经安装poppler-utils" - if rpm -q poppler-utils &> /dev/null; then - LOG_INFO "poppler-utils已经安装" - INSTALLED="true" - else - LOG_INFO "poppler-utils未安装" - INSTALLED="false" - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if dnf list available poppler-utils &> /dev/null; then - LOG_INFO "yum源中有poppler-utils软件包" - else - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 255 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否支持-owner-password参数 - LOG_INFO "检查pdftotext命令是否支持-owner-password参数" - pdftotext -h 2>&1 | grep -q -- "-owner-password" - CHECK_RESULT $? 0 255 "pdftotext命令不支持-owner-password参数" - - # 准备测试文件 - LOG_INFO "准备测试文件" - echo "这是一个加密的PDF文件测试内容" > test_input.txt - CHECK_RESULT $? 0 1 "创建测试输入文件失败" - - # 创建加密的PDF文件 - LOG_INFO "创建加密的PDF文件" - pdftk test_input.txt output encrypted.pdf owner_pw 123456 - CHECK_RESULT $? 0 1 "创建加密PDF文件失败" - - # 测试使用所有者密码打开加密文件 - LOG_INFO "测试使用所有者密码打开加密文件" - pdftotext -owner-password 123456 encrypted.pdf output.txt - CHECK_RESULT $? 0 1 "使用所有者密码打开加密文件失败" - - # 验证输出文件内容 - LOG_INFO "验证输出文件内容" - grep -q "这是一个加密的PDF文件测试内容" output.txt - CHECK_RESULT $? 0 1 "输出文件内容不符合预期" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.txt encrypted.pdf output.txt - CHECK_RESULT $? 0 1 "清理测试文件失败" - - LOG_INFO "测试使用所有者密码打开加密文件成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_q.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_q.sh deleted file mode 100644 index f1ca8cdad73..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_q.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试静默模式,不打印任何信息或错误 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,记录当前状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdftotext命令是否支持-q参数 - LOG_INFO "检查pdftotext命令是否支持-q参数" - pdftotext -h 2>&1 | grep -q "\-q" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不支持-q参数" - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /Resources << - /Font << - /F1 4 0 R - >> - >> - /MediaBox [0 0 612 792] - /Contents 5 0 R - >> - endobj - 4 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - 5 0 obj - << - /Length 44 - >> - stream - BT - /F1 24 Tf - 100 700 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000204 00000 n - 0000000248 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 350 - %%EOF - EOF - - # 测试静默模式,不打印任何信息或错误 - LOG_INFO "测试静默模式,不打印任何信息或错误" - pdftotext -q test.pdf output.txt 2>&1 - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - [ -f output.txt ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 检查输出文件内容 - LOG_INFO "检查输出文件内容" - grep -q "Hello World" output.txt - CHECK_RESULT $? 0 0 "输出文件内容不正确" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output.txt - - # 如果之前未安装,则卸载poppler-utils软件包 - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_r.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_r.sh deleted file mode 100644 index 2a2710b0b1f..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_r.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试设置分辨率进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试设置分辨率进行转换 - LOG_INFO "开始测试:测试设置分辨率进行转换" - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "步骤1:检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils 2>/dev/null | grep poppler-utils - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "步骤2:检查是否已安装poppler-utils" - rpm -q poppler-utils - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装" - INSTALLED_BEFORE=1 - else - LOG_INFO "poppler-utils未安装" - INSTALLED_BEFORE=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否存在 - LOG_INFO "步骤4:检查pdftotext命令是否存在" - command -v pdftotext - CHECK_RESULT $? 0 0 "pdftotext命令不存在" - - # 检查-r参数是否支持 - LOG_INFO "步骤5:检查-r参数是否支持" - pdftotext -h 2>&1 | grep -q "\-r" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不支持-r参数" - exit 255 - fi - - # 创建测试PDF文件(使用简单文本生成PDF) - LOG_INFO "步骤6:创建测试PDF文件" - cat > /tmp/test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - 0000000151 00000 n - 0000000248 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 300 - %%EOF - EOF - - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试设置分辨率进行转换 - LOG_INFO "步骤7:测试设置分辨率进行转换" - pdftotext -r 150 /tmp/test_input.pdf /tmp/test_output.txt - CHECK_RESULT $? 0 0 "设置分辨率转换失败" - - # 检查转换后的文件 - LOG_INFO "步骤8:检查转换后的文件" - if [ -f /tmp/test_output.txt ]; then - LOG_INFO "成功生成文本文件" - # 检查文件内容 - cat /tmp/test_output.txt - CHECK_RESULT $? 0 0 "读取转换后的文件失败" - else - LOG_ERROR "未生成转换后的文本文件" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "步骤9:清理测试文件" - rm -f /tmp/test_input.pdf /tmp/test_output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "步骤10:卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤10:保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成:测试设置分辨率进行转换" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_raw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_raw.sh deleted file mode 100644 index a4b67626962..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_raw.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试保持内容流顺序进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="poppler-utils" - - # 步骤1:检查yum源中是否存在指定软件包 - LOG_INFO "步骤1:检查yum源中是否存在软件包 ${PACKAGE_NAME}" - dnf list available ${PACKAGE_NAME} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在软件包 ${PACKAGE_NAME}" - exit 255 - fi - - # 步骤2:检查系统是否已安装指定软件包 - LOG_INFO "步骤2:检查系统是否已安装软件包 ${PACKAGE_NAME}" - INSTALLED=0 - rpm -q ${PACKAGE_NAME} &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装" - INSTALLED=1 - else - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装" - 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:检查pdftotext命令是否存在并支持所需参数 - LOG_INFO "步骤4:检查pdftotext命令及其参数支持" - command -v pdftotext &>/dev/null - CHECK_RESULT $? 0 0 "pdftotext命令不存在" - - # 检查参数支持 - pdftotext -h 2>&1 | grep -q "\-raw" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不支持-raw参数" - exit 255 - fi - - # 步骤5:创建测试PDF文件 - LOG_INFO "步骤5:创建测试PDF文件" - TEST_PDF="test_document.pdf" - TEST_TXT="test_output.txt" - cat > ${TEST_PDF} << "EOF" - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World!) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 256 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 步骤6:测试保持内容流顺序进行转换 - LOG_INFO "步骤6:测试保持内容流顺序进行转换" - pdftotext -raw ${TEST_PDF} ${TEST_TXT} - CHECK_RESULT $? 0 0 "pdftotext命令执行失败" - - # 步骤7:验证输出文件内容 - LOG_INFO "步骤7:验证输出文件内容" - if [ -f "${TEST_TXT}" ]; then - LOG_INFO "输出文件 ${TEST_TXT} 创建成功" - cat ${TEST_TXT} - else - LOG_ERROR "输出文件 ${TEST_TXT} 未创建" - exit 1 - fi - - # 步骤8:清理测试文件 - LOG_INFO "步骤8:清理测试文件" - rm -f ${TEST_PDF} ${TEST_TXT} - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9:如果测试前未安装,则卸载软件包 - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "步骤9:卸载软件包 ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - else - LOG_INFO "步骤9:保持软件包 ${PACKAGE_NAME} 的安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_tsv.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_tsv.sh deleted file mode 100644 index 165dd114a53..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_tsv.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试生成包含边界框元信息的简单TSV文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - if dnf list installed poppler-utils > /dev/null 2>&1; then - LOG_INFO "poppler-utils已安装" - already_installed=1 - else - LOG_INFO "poppler-utils未安装" - already_installed=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - LOG_INFO "yum源中有poppler-utils软件包" - - # 如果未安装则安装 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdftotext命令是否支持-tsv参数 - LOG_INFO "检查pdftotext命令是否支持-tsv参数" - pdftotext -h 2>&1 | grep -q "\-tsv" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不支持-tsv参数" - exit 255 - fi - LOG_INFO "pdftotext命令支持-tsv参数" - - # 创建测试PDF文件 - LOG_INFO "创建测试PDF文件" - cat > test_input.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - /Resources << - /Font << - /F1 5 0 R - >> - >> - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - 5 0 obj - << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - endobj - xref - 0 6 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000220 00000 n - 0000000324 00000 n - trailer - << - /Size 6 - /Root 1 0 R - >> - startxref - 396 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 使用pdftotext生成TSV文件 - LOG_INFO "使用pdftotext生成TSV文件" - pdftotext -tsv test_input.pdf output.tsv - CHECK_RESULT $? 0 0 "生成TSV文件失败" - - # 检查生成的TSV文件 - LOG_INFO "检查生成的TSV文件" - if [ ! -f output.tsv ]; then - LOG_ERROR "未生成output.tsv文件" - exit 1 - fi - - LOG_INFO "检查TSV文件内容" - tsv_content=$(cat output.tsv) - if [ -z "$tsv_content" ]; then - LOG_ERROR "TSV文件内容为空" - exit 1 - fi - - LOG_INFO "验证TSV文件格式" - # 检查文件是否包含制表符分隔的列 - if head -n 1 output.tsv | grep -q $"\t"; then - LOG_INFO "TSV文件格式正确(包含制表符分隔)" - else - LOG_ERROR "TSV文件格式不正确(不包含制表符分隔)" - exit 1 - fi - - # 检查文件是否包含边界框信息 - if grep -q "bbox" output.tsv || grep -q "[0-9]\+[[:space:]]\+[0-9]\+[[:space:]]\+[0-9]\+[[:space:]]\+[0-9]\+" output.tsv; then - LOG_INFO "TSV文件包含边界框信息" - else - LOG_ERROR "TSV文件不包含边界框信息" - exit 1 - fi - - LOG_INFO "测试生成包含边界框元信息的简单TSV文件成功" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_input.pdf output.tsv - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_upw.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_upw.sh deleted file mode 100644 index 5349bd18efe..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_upw.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试使用用户密码打开加密文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:使用用户密码打开加密PDF文件" - LOG_INFO "步骤1:检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束时将保持安装状态" - already_installed=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - already_installed=0 - fi - LOG_INFO "步骤2:检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包,退出测试" - exit 255 - fi - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - LOG_INFO "步骤4:检查pdftotext命令是否支持-upw参数" - pdftotext -h 2>&1 | grep -q "\-upw" - CHECK_RESULT $? 0 0 "pdftotext命令不支持-upw参数" - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不支持-upw参数,退出测试" - exit 255 - fi - LOG_INFO "步骤5:创建测试用的加密PDF文件" - echo "This is a test PDF file." > test_input.txt - echo "userpass" > password.txt - enscript test_input.txt -o test_input.ps > /dev/null 2>&1 - ps2pdf test_input.ps test_encrypted.pdf > /dev/null 2>&1 - pdftk test_encrypted.pdf output test_encrypted_protected.pdf user_pw userpass > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "创建加密PDF文件失败" - LOG_INFO "步骤6:使用正确的密码打开加密PDF文件" - pdftotext -upw userpass test_encrypted_protected.pdf output.txt - CHECK_RESULT $? 0 0 "使用正确密码打开加密PDF文件失败" - LOG_INFO "步骤7:验证提取的文本内容" - grep -q "This is a test PDF file." output.txt - CHECK_RESULT $? 0 0 "提取的文本内容不正确" - LOG_INFO "步骤8:清理测试过程中生成的文件" - rm -f test_input.txt test_input.ps test_encrypted.pdf test_encrypted_protected.pdf output.txt password.txt - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤9:卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "步骤9:保持poppler-utils软件包安装状态,无需卸载" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_v.sh deleted file mode 100644 index 75e7553fb27..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_v.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试打印版本和版权信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为保持安装状态" - KEEP_INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,标记为测试后卸载" - KEEP_INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - LOG_INFO "poppler-utils安装成功" - fi - - # 检查pdftotext命令是否存在 - LOG_INFO "检查pdftotext命令是否存在" - command -v pdftotext > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext命令不存在" - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 检查pdftotext是否支持-version参数 - LOG_INFO "检查pdftotext是否支持-version参数" - pdftotext -version > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdftotext不支持-version参数" - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - fi - exit 255 - fi - - # 测试打印版本信息 - LOG_INFO "测试打印pdftotext版本信息" - pdftotext -version 2>&1 | grep -i "pdftotext" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "打印版本信息失败" - - # 测试打印版权信息 - LOG_INFO "测试打印pdftotext版权信息" - pdftotext -v 2>&1 | grep -i "copyright" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "打印版权信息失败" - - # 清理环境 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - LOG_INFO "环境清理完成" - else - LOG_INFO "保持poppler-utils安装状态" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_x_y_upper_w_upper_h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_x_y_upper_w_upper_h.sh deleted file mode 100644 index fbe6754e490..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdftotext_x_y_upper_w_upper_h.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试指定裁剪区域进行转换 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在安装" - installed=true - else - LOG_INFO "poppler-utils未安装,标记为需要安装" - installed=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到poppler-utils软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - cat > test.pdf << EOF - %PDF-1.4 - 1 0 obj - << - /Type /Catalog - /Pages 2 0 R - >> - endobj - 2 0 obj - << - /Type /Pages - /Kids [3 0 R] - /Count 1 - >> - endobj - 3 0 obj - << - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Contents 4 0 R - >> - endobj - 4 0 obj - << - /Length 44 - >> - stream - BT - /F1 12 Tf - 72 720 Td - (Hello World) Tj - ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000106 00000 n - 0000000172 00000 n - trailer - << - /Size 5 - /Root 1 0 R - >> - startxref - 233 - %%EOF - EOF - CHECK_RESULT $? 0 0 "创建测试PDF文件失败" - - # 测试指定裁剪区域进行转换 - LOG_INFO "测试指定裁剪区域进行转换" - pdftotext -x 50 -y 50 -W 200 -H 100 test.pdf output.txt 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdftotext命令不支持指定的裁剪区域参数" - exit 255 - fi - CHECK_RESULT $? 0 0 "指定裁剪区域转换失败" - - # 检查转换结果 - LOG_INFO "检查转换结果" - if [ -f output.txt ]; then - LOG_INFO "转换成功,输出文件已生成" - # 检查输出文件内容 - grep -q "Hello World" output.txt - CHECK_RESULT $? 0 0 "转换结果不符合预期" - else - LOG_ERROR "转换失败,输出文件未生成" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test.pdf output.txt - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包卸载成功" - else - LOG_INFO "保持poppler-utils软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite___help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite___help.sh deleted file mode 100644 index b8400679cc7..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite___help.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfunite命令的--help参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装了poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,脚本结束后将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "poppler-utils软件包未安装,将在测试过程中安装并在结束后卸载" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在poppler-utils软件包 - LOG_INFO "检查yum源中是否存在poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 测试pdfunite命令的--help参数 - LOG_INFO "测试pdfunite命令的--help参数,用于打印使用信息" - pdfunite --help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "pdfunite命令支持--help参数" - else - LOG_ERROR "pdfunite命令不支持--help参数或参数不存在" - # 清理环境 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - exit 255 - fi - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite__h.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite__h.sh deleted file mode 100644 index 5a2544eee11..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite__h.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfunite命令的-h参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,脚本结束前将保持安装状态" - installed_flag=1 - else - LOG_INFO "poppler-utils未安装,将在测试过程中安装" - installed_flag=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils - if [ $installed_flag -eq 0 ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - # 检查pdfunite命令是否存在 - LOG_INFO "检查pdfunite命令是否存在" - command -v pdfunite > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfunite命令不存在" - - # 测试pdfunite命令的-h参数 - LOG_INFO "测试pdfunite命令的-h参数" - pdfunite -h > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "pdfunite -h执行成功" - # 检查输出是否包含使用信息 - pdfunite -h 2>&1 | grep -i "usage" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfunite -h未显示使用信息" - else - # 检查是否因为参数不存在而失败 - pdfunite --help > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "pdfunite不支持-h参数,请使用--help" - exit 255 - else - LOG_ERROR "pdfunite命令执行失败" - exit 1 - fi - fi - - # 环境清理:如果测试前未安装,则卸载软件包 - if [ $installed_flag -eq 0 ]; then - LOG_INFO "清理环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite__v.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite__v.sh deleted file mode 100644 index 30c05d90cbd..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite__v.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfunite命令的-v参数,用于打印版本和版权信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查是否已安装poppler-utils软件包" - rpm -q poppler-utils >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装,标记为已安装状态" - INSTALLED=1 - else - LOG_INFO "poppler-utils软件包未安装,标记为未安装状态" - INSTALLED=0 - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装poppler-utils软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装poppler-utils软件包" - dnf install -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - LOG_INFO "poppler-utils软件包安装成功" - fi - - # 检查pdfunite命令是否支持-v参数 - LOG_INFO "检查pdfunite命令是否支持-v参数" - pdfunite -v >/dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "pdfunite命令不支持-v参数" - # 恢复环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "恢复环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - exit 255 - fi - - # 测试pdfunite命令的-v参数 - LOG_INFO "测试pdfunite命令的-v参数,用于打印版本和版权信息" - pdfunite -v 2>&1 | grep -E "poppler|version|copyright" >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "pdfunite -v命令执行失败或未输出版本和版权信息" - - # 恢复环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "恢复环境:卸载poppler-utils软件包" - dnf remove -y poppler-utils >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - LOG_INFO "环境已恢复:poppler-utils软件包已卸载" - else - LOG_INFO "环境保持原状:poppler-utils软件包保持安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_help.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_help.sh deleted file mode 100644 index 06ae85d474e..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_help.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfunite命令的-help参数,用于打印使用信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试pdfunite命令的-help参数" - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - if ! dnf list available poppler-utils &>/dev/null; then - LOG_ERROR "yum源中没有poppler-utils软件包" - exit 255 - fi - - # 检查是否已安装poppler-utils - LOG_INFO "检查是否已安装poppler-utils" - if rpm -q poppler-utils &>/dev/null; then - LOG_INFO "poppler-utils已安装,测试后保持安装状态" - already_installed=true - else - LOG_INFO "poppler-utils未安装,开始安装" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - already_installed=false - fi - - # 测试pdfunite命令的-help参数 - LOG_INFO "测试pdfunite命令的-help参数" - pdfunite --help &>/dev/null - CHECK_RESULT $? 0 0 "pdfunite命令不支持--help参数" - - # 清理环境 - LOG_INFO "清理环境" - if [ "$already_installed" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "保持poppler-utils安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_merge_multiple_pdfs.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_merge_multiple_pdfs.sh deleted file mode 100644 index 72d4a2145ab..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_merge_multiple_pdfs.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfunite命令合并多个PDF源文件到一个目标PDF文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装poppler-utils软件包 - LOG_INFO "检查poppler-utils软件包是否已安装" - rpm -q poppler-utils > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils软件包已安装" - INSTALLED=true - else - LOG_INFO "poppler-utils软件包未安装" - INSTALLED=false - fi - - # 检查yum源中是否有poppler-utils软件包 - LOG_INFO "检查yum源中是否有poppler-utils软件包" - dnf list available poppler-utils > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils软件包失败" - fi - - # 检查pdfunite命令是否存在 - LOG_INFO "检查pdfunite命令是否存在" - command -v pdfunite > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "pdfunite命令不存在" - exit 255 - fi - - # 检查pdfunite命令是否支持合并功能 - LOG_INFO "检查pdfunite命令是否支持合并功能" - pdfunite --help 2>&1 | grep -q "merge" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfunite命令不支持合并功能" - exit 255 - fi - - # 创建测试用的PDF文件 - LOG_INFO "创建测试用的PDF文件" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Hello World) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 246 - %%EOF" > test1.pdf - - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >> - endobj - 4 0 obj - << /Length 44 >> - stream - BT /F1 12 Tf 72 720 Td (Test Page 2) Tj ET - endstream - endobj - xref - 0 5 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000101 00000 n - 0000000176 00000 n - trailer - << /Size 5 /Root 1 0 R >> - startxref - 246 - %%EOF" > test2.pdf - - # 测试pdfunite命令合并多个PDF文件 - LOG_INFO "测试pdfunite命令合并多个PDF文件" - pdfunite test1.pdf test2.pdf merged.pdf - CHECK_RESULT $? 0 0 "pdfunite命令合并PDF文件失败" - - # 检查合并后的PDF文件是否存在 - LOG_INFO "检查合并后的PDF文件是否存在" - [ -f merged.pdf ] - CHECK_RESULT $? 0 0 "合并后的PDF文件不存在" - - # 检查合并后的PDF文件是否有效 - LOG_INFO "检查合并后的PDF文件是否有效" - file merged.pdf | grep -q "PDF document" - CHECK_RESULT $? 0 0 "合并后的PDF文件无效" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test1.pdf test2.pdf merged.pdf - - # 如果脚本开始时未安装软件包,则在结束时卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_merge_two_pdfs.sh b/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_merge_two_pdfs.sh deleted file mode 100644 index 5dcd0e51d02..00000000000 --- a/testcases/function_test/pkg_test/poppler/poppler-utils/test_poppler-utils_pdfunite_merge_two_pdfs.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-17 -# @License : Mulan PSL v2 -# @Desc : 测试pdfunite命令合并两个PDF源文件到一个目标PDF文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试pdfunite命令合并两个PDF源文件到一个目标PDF文件" - LOG_INFO "步骤1:检查poppler-utils软件包是否在yum源中" - dnf list available poppler-utils &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到poppler-utils软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装poppler-utils" - rpm -q poppler-utils &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "poppler-utils已安装,标记为已存在" - INSTALLED=1 - else - LOG_INFO "poppler-utils未安装,将进行安装" - INSTALLED=0 - LOG_INFO "步骤3:安装poppler-utils软件包" - dnf install -y poppler-utils - CHECK_RESULT $? 0 0 "安装poppler-utils失败" - fi - - LOG_INFO "步骤4:创建两个测试PDF文件" - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << /Size 4 /Root 1 0 R >> - startxref - 149 - %%EOF" > test1.pdf - - echo "%PDF-1.4 - 1 0 obj - << /Type /Catalog /Pages 2 0 R >> - endobj - 2 0 obj - << /Type /Pages /Kids [3 0 R] /Count 1 >> - endobj - 3 0 obj - << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >> - endobj - xref - 0 4 - 0000000000 65535 f - 0000000010 00000 n - 0000000053 00000 n - 0000000102 00000 n - trailer - << /Size 4 /Root 1 0 R >> - startxref - 149 - %%EOF" > test2.pdf - - LOG_INFO "步骤5:检查pdfunite命令是否支持合并参数" - pdfunite --help 2>&1 | grep -q "merge" - if [ $? -ne 0 ]; then - LOG_ERROR "pdfunite命令不支持合并参数" - exit 255 - fi - - LOG_INFO "步骤6:使用pdfunite合并两个PDF文件" - pdfunite test1.pdf test2.pdf merged.pdf - CHECK_RESULT $? 0 0 "pdfunite合并PDF文件失败" - - LOG_INFO "步骤7:验证合并后的PDF文件是否存在且非空" - if [ -s merged.pdf ]; then - LOG_INFO "合并后的PDF文件创建成功" - else - LOG_ERROR "合并后的PDF文件创建失败" - exit 1 - fi - - LOG_INFO "步骤8:清理测试文件" - rm -f test1.pdf test2.pdf merged.pdf - - LOG_INFO "步骤9:恢复环境,如果测试前未安装则卸载poppler-utils" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载poppler-utils软件包" - dnf remove -y poppler-utils - CHECK_RESULT $? 0 0 "卸载poppler-utils失败" - else - LOG_INFO "测试前已安装poppler-utils,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-docker-pycreds/python3-docker-pycreds/test_python3-docker-pycreds_function_auth.sh b/testcases/function_test/pkg_test/python-docker-pycreds/python3-docker-pycreds/test_python3-docker-pycreds_function_auth.sh deleted file mode 100644 index 518322d0155..00000000000 --- a/testcases/function_test/pkg_test/python-docker-pycreds/python3-docker-pycreds/test_python3-docker-pycreds_function_auth.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-12 -# @License : Mulan PSL v2 -# @Desc : Test authentication functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-docker-pycreds - LOG_INFO "检查是否已安装python3-docker-pycreds" - if dnf list installed python3-docker-pycreds &>/dev/null; then - LOG_INFO "python3-docker-pycreds已安装" - installed=true - else - LOG_INFO "python3-docker-pycreds未安装" - installed=false - fi - - # 检查yum源中是否有python3-docker-pycreds软件包 - LOG_INFO "检查yum源中是否有python3-docker-pycreds软件包" - if ! dnf list available python3-docker-pycreds &>/dev/null; then - LOG_ERROR "yum源中未找到python3-docker-pycreds软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "开始安装python3-docker-pycreds" - dnf install -y python3-docker-pycreds - CHECK_RESULT $? 0 0 "安装python3-docker-pycreds失败" - fi - - # 测试认证功能 - LOG_INFO "测试python3-docker-pycreds的认证功能" - output=$(python3 -c "import dockerpycreds; print("认证功能测试通过")" 2>&1) - CHECK_RESULT $? 0 0 "python3-docker-pycreds认证功能测试失败" - - # 检查输出是否符合预期 - if [[ "$output" != "认证功能测试通过" ]]; then - LOG_ERROR "认证功能输出不符合预期: $output" - exit 1 - else - LOG_INFO "认证功能输出符合预期: $output" - fi - - # 如果脚本开始时未安装,则在结束时卸载软件包以恢复环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-docker-pycreds以恢复环境" - dnf remove -y python3-docker-pycreds - CHECK_RESULT $? 0 0 "卸载python3-docker-pycreds失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api.sh deleted file mode 100644 index 26d20ee3e87..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试API接口功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-hug_function_api软件包 - LOG_INFO "检查是否已安装python3-hug_function_api软件包" - dnf list installed python3-hug_function_api >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_function_api已安装,脚本结束时保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug_function_api未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-hug_function_api软件包 - LOG_INFO "检查yum源中是否有python3-hug_function_api软件包" - dnf list available python3-hug_function_api >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_function_api软件包" - exit 255 - fi - - # 安装python3-hug_function_api软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python3-hug_function_api软件包" - dnf install -y python3-hug_function_api - CHECK_RESULT $? 0 0 "安装python3-hug_function_api失败" - fi - - # 测试API接口功能 - LOG_INFO "测试API接口功能" - hug_function_api_test_command --test-param valid_value - CHECK_RESULT $? 0 0 "API接口功能测试失败" - - # 检查无效参数 - LOG_INFO "检查无效参数" - hug_function_api_test_command --invalid-param - if [ $? -ne 255 ]; then - LOG_ERROR "无效参数未被正确处理" - exit 255 - fi - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-hug_function_api软件包" - dnf remove -y python3-hug_function_api - CHECK_RESULT $? 0 0 "卸载python3-hug_function_api失败" - - # 确认卸载成功,避免残留 - dnf list installed python3-hug_function_api >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "卸载python3-hug_function_api失败,仍有残留" - exit 1 - fi - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api_cli.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api_cli.sh deleted file mode 100644 index 83c12a96ed1..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api_cli.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试API命令行接口 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试API命令行接口" - LOG_INFO "步骤1:检查是否已安装python3-hug_function_api_cli软件包" - rpm -q python3-hug_function_api_cli > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,记录安装状态" - INSTALLED="yes" - else - LOG_INFO "软件包未安装,记录未安装状态" - INSTALLED="no" - fi - - LOG_INFO "步骤2:检查yum源中是否存在python3-hug_function_api_cli软件包" - dnf list available python3-hug_function_api_cli > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_function_api_cli软件包" - exit 255 - fi - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "步骤3:安装python3-hug_function_api_cli软件包" - dnf install -y python3-hug_function_api_cli - CHECK_RESULT $? 0 0 "安装python3-hug_function_api_cli失败" - fi - - LOG_INFO "步骤4:检查API命令行接口基本命令是否存在" - hug_function_api_cli --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "API命令行接口基本命令不可用" - - LOG_INFO "步骤5:测试API命令行接口的版本参数" - hug_function_api_cli --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "版本参数测试失败" - - LOG_INFO "步骤6:测试不支持的参数" - hug_function_api_cli --invalid-param > /dev/null 2>&1 - if [ $? -ne 255 ]; then - LOG_ERROR "不支持的参数未正确返回退出码255" - exit 255 - fi - - LOG_INFO "步骤7:测试API命令行接口列表功能" - hug_function_api_cli list > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "列表功能测试失败" - - LOG_INFO "步骤8:清理环境" - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "卸载测试安装的python3-hug_function_api_cli软件包" - dnf remove -y python3-hug_function_api_cli - CHECK_RESULT $? 0 0 "卸载python3-hug_function_api_cli失败" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "API命令行接口测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api_http.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api_http.sh deleted file mode 100644 index 8dff4a9eb36..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_api_http.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试API HTTP接口 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:测试API HTTP接口 - # 测试环境:OpenEuler - - # 步骤1:检查环境是否已安装python3-hug包 - LOG_INFO "检查是否已安装python3-hug包" - rpm -q python3-hug - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug包已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug包未安装,将在测试前安装,并在测试结束后卸载" - INSTALLED=false - fi - - # 步骤2:检查yum源中是否有python3-hug包 - LOG_INFO "检查yum源中是否有python3-hug包" - dnf list available python3-hug 2>/dev/null | grep -q python3-hug - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug包" - exit 255 - fi - - # 步骤3:如果未安装,则安装python3-hug包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python3-hug包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug包失败" - fi - - # 步骤4:检查hug命令是否支持http参数 - LOG_INFO "检查hug命令是否支持http参数" - hug --help 2>&1 | grep -q "\-\-http" - if [ $? -ne 0 ]; then - LOG_ERROR "hug命令不支持http参数" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-hug包" - dnf remove -y python3-hug - fi - exit 255 - fi - - # 步骤5:编写一个简单的hug API应用 - LOG_INFO "创建测试用的hug API应用" - cat > /tmp/test_api.py << "EOF" - import hug - - @hug.get("/hello") - def hello(): - return {"message": "Hello, World!"} - - if __name__ == "__main__": - hug.API(__name__).http.serve() - EOF - - # 步骤6:在后台启动hug API服务 - LOG_INFO "启动hug API服务" - python3 /tmp/test_api.py --http=localhost:8080 > /tmp/hug_api.log 2>&1 & - HUG_PID=$! - sleep 3 - - # 步骤7:检查hug API服务是否启动成功 - LOG_INFO "检查hug API服务进程" - ps -p $HUG_PID > /dev/null - CHECK_RESULT $? 0 0 "hug API服务启动失败" - - # 步骤8:测试API HTTP接口 - LOG_INFO "测试API HTTP接口" - curl -s http://localhost:8080/hello | grep -q "Hello, World" - CHECK_RESULT $? 0 0 "API HTTP接口测试失败" - - # 步骤9:停止hug API服务 - LOG_INFO "停止hug API服务" - kill $HUG_PID - wait $HUG_PID 2>/dev/null - - # 步骤10:清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/test_api.py /tmp/hug_api.log - - # 步骤11:如果测试前未安装,则卸载python3-hug包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-hug包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug包失败" - fi - - LOG_INFO "API HTTP接口测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_basic_api.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_basic_api.sh deleted file mode 100644 index 25ad9c33ab5..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_basic_api.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试创建基础API -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试创建基础API" - - # 检查是否已安装python3-hug软件包 - LOG_INFO "检查python3-hug是否已安装" - if rpm -q python3-hug &>/dev/null; then - LOG_INFO "python3-hug已安装,测试结束后保持安装状态" - installed=true - else - LOG_INFO "python3-hug未安装,将在测试过程中安装" - installed=false - fi - - # 检查yum源中是否有python3-hug软件包 - LOG_INFO "检查yum源中是否有python3-hug软件包" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 测试创建基础API - LOG_INFO "测试创建基础API功能" - # 这里假设有一个测试创建基础API的命令或脚本,例如:test_create_basic_api - # 如果命令不存在或不支持,则退出 - if ! command -v test_create_basic_api &>/dev/null; then - LOG_ERROR "test_create_basic_api命令不存在或不支持" - exit 255 - fi - - # 执行测试命令 - test_create_basic_api - CHECK_RESULT $? 0 0 "创建基础API测试失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-hug软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - fi - - LOG_INFO "测试创建基础API完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_import.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_import.sh deleted file mode 100644 index b03e63cad8a..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_import.sh +++ /dev/null @@ -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 : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试导入hug模块 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装python3-hug - LOG_INFO "检查是否已安装python3-hug" - rpm -q python3-hug >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug已安装" - INSTALLED=1 - else - LOG_INFO "python3-hug未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有python3-hug软件包 - LOG_INFO "检查yum源中是否有python3-hug软件包" - dnf list available python3-hug >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中不存在python3-hug软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在python3-hug软件包" - exit 255 - fi - - # 如果未安装,则安装python3-hug - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-hug" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 测试导入hug模块 - LOG_INFO "测试导入hug模块" - python3 -c "import hug" - CHECK_RESULT $? 0 0 "导入hug模块失败" - - # 环境恢复 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-hug" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_install.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_install.sh deleted file mode 100644 index 3a1459b0534..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_install.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试软件包安装功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试软件包安装功能" - - # 1. 检查yum源中是否存在python3-hug软件包 - LOG_INFO "1. 检查yum源中是否存在python3-hug软件包" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - # 2. 检查是否已安装python3-hug - LOG_INFO "2. 检查是否已安装python3-hug" - if dnf list installed python3-hug &>/dev/null; then - LOG_INFO "检测到python3-hug已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "未检测到python3-hug安装,将在测试结束后卸载" - already_installed=false - fi - - # 3. 测试安装功能(如果未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "3. 执行安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 4. 验证安装结果 - LOG_INFO "4. 验证python3-hug是否安装成功" - dnf list installed python3-hug &>/dev/null - CHECK_RESULT $? 0 0 "验证python3-hug安装失败" - - # 5. 测试软件包基本功能 - LOG_INFO "5. 测试python3-hug基本功能" - python3 -c "import hug; print("hug version:", hug.__version__)" 2>/dev/null - CHECK_RESULT $? 0 0 "python3-hug基本功能测试失败" - - # 6. 清理环境(如果测试前未安装) - if [ "$already_installed" = false ]; then - LOG_INFO "6. 清理环境:卸载python3-hug软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - - # 验证卸载结果 - LOG_INFO "验证python3-hug是否已卸载" - if dnf list installed python3-hug &>/dev/null; then - LOG_ERROR "python3-hug卸载失败" - exit 1 - else - LOG_INFO "python3-hug已成功卸载" - fi - else - LOG_INFO "6. 保持python3-hug安装状态,无需清理" - fi - - LOG_INFO "软件包安装功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_uninstall.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_uninstall.sh deleted file mode 100644 index b642c7d5823..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_uninstall.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试软件包卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查环境是否已安装python3-hug软件包 - LOG_INFO "检查环境是否已安装python3-hug软件包" - rpm -q python3-hug &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装python3-hug软件包,脚本结束时将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "环境未安装python3-hug软件包,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 检查yum源中是否有python3-hug软件包 - LOG_INFO "检查yum源中是否有python3-hug软件包" - dnf list available python3-hug &> /dev/null - CHECK_RESULT $? 0 0 "yum源中未找到python3-hug软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - # 如果未安装,则安装python3-hug软件包 - if [ $ALREADY_INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug软件包失败" - fi - - # 验证python3-hug软件包是否安装成功 - LOG_INFO "验证python3-hug软件包是否安装成功" - rpm -q python3-hug - CHECK_RESULT $? 0 0 "python3-hug软件包未正确安装" - - # 测试卸载功能 - LOG_INFO "测试卸载python3-hug软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug软件包失败" - - # 验证软件包是否已卸载 - LOG_INFO "验证python3-hug软件包是否已卸载" - rpm -q python3-hug - if [ $? -eq 0 ]; then - LOG_ERROR "python3-hug软件包卸载失败" - exit 1 - else - LOG_INFO "python3-hug软件包卸载成功" - fi - - # 环境恢复:如果测试前未安装,则不需要重新安装;如果测试前已安装,则重新安装 - if [ $ALREADY_INSTALLED -eq 1 ]; then - LOG_INFO "恢复环境:重新安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "重新安装python3-hug软件包失败" - LOG_INFO "环境已恢复到初始安装状态" - else - LOG_INFO "环境已恢复,未安装python3-hug软件包" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_version.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_version.sh deleted file mode 100644 index 660383fae10..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_function_version.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试获取hug版本号 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试获取hug版本号" - LOG_INFO "步骤1:检查yum源中是否存在python3-hug软件包" - dnf list available python3-hug 2>/dev/null | grep -q python3-hug - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装python3-hug" - rpm -q python3-hug >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug已安装,标记为已存在安装" - INSTALLED_FLAG=1 - else - LOG_INFO "python3-hug未安装,标记为需要安装" - INSTALLED_FLAG=0 - fi - - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "步骤3:安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - LOG_INFO "步骤4:执行hug命令获取版本号" - hug --version - CHECK_RESULT $? 0 0 "获取hug版本号失败" - - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "步骤5:卸载python3-hug软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - fi - - LOG_INFO "测试完成:测试获取hug版本号" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__c_command.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__c_command.sh deleted file mode 100644 index 7a7d32ece39..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__c_command.sh +++ /dev/null @@ -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-02 -# @License : Mulan PSL v2 -# @Desc : 测试指定命令参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查软件包是否已安装 - if dnf list installed python3-hug_hug-3__c_command &>/dev/null; then - LOG_INFO "软件包 python3-hug_hug-3__c_command 已安装" - INSTALLED=true - else - LOG_INFO "软件包 python3-hug_hug-3__c_command 未安装" - INSTALLED=false - fi - - # 检查yum源中是否有该软件包 - if ! dnf list available python3-hug_hug-3__c_command &>/dev/null; then - LOG_ERROR "yum源中未找到软件包 python3-hug_hug-3__c_command" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装软件包 python3-hug_hug-3__c_command" - dnf install -y python3-hug_hug-3__c_command - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 测试指定命令参数 - LOG_INFO "测试指定命令参数" - python3-hug_hug-3__c_command --test-param - CHECK_RESULT $? 0 0 "命令参数测试失败" - - # 如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载软件包 python3-hug_hug-3__c_command" - dnf remove -y python3-hug_hug-3__c_command - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试脚本执行完毕" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f.sh deleted file mode 100644 index 1b233cd6462..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定API文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:测试指定API文件" - - # 检查软件包是否在yum源中 - LOG_INFO "检查yum源中是否存在python3-hug软件包" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - # 检查是否已安装 - LOG_INFO "检查python3-hug是否已安装" - if rpm -q python3-hug &>/dev/null; then - LOG_INFO "python3-hug已安装,测试结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "python3-hug未安装,将在测试前安装" - INSTALLED="false" - fi - - # 如果未安装,则安装 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 测试指定API文件 - LOG_INFO "测试指定API文件" - # 这里假设测试命令是 hug -f ,请根据实际测试需求替换 - # 如果参数不存在或不支持,退出码为255 - if ! hug --help | grep -q "\-f"; then - LOG_ERROR "hug命令不支持-f参数" - exit 255 - fi - - # 执行测试命令,这里假设测试文件为test_api.py,请根据实际测试需求替换 - hug -f test_api.py - CHECK_RESULT $? 0 0 "测试指定API文件失败" - - # 清理环境:如果测试前未安装,则卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-hug软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f__ho__p.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f__ho__p.sh deleted file mode 100644 index 4f493f7562a..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f__ho__p.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试组合指定文件、主机和端口启动服务器 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试组合指定文件、主机和端口启动服务器" - - # 检查是否已安装 python3-hug_hug-3__f__ho__p 软件包 - if dnf list installed python3-hug_hug-3__f__ho__p &>/dev/null; then - LOG_INFO "软件包已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "软件包未安装,将进行安装测试" - INSTALLED=0 - fi - - # 检查 yum 源中是否存在该软件包 - LOG_INFO "检查 yum 源中是否存在 python3-hug_hug-3__f__ho__p 软件包" - if ! dnf list available python3-hug_hug-3__f__ho__p &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-hug_hug-3__f__ho__p 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装 python3-hug_hug-3__f__ho__p 软件包" - dnf install -y python3-hug_hug-3__f__ho__p - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 检查 hug 命令是否支持指定参数 - LOG_INFO "检查 hug 命令是否支持 -f、-ho、-p 参数" - hug --help | grep -q -- "-f" - CHECK_RESULT $? 0 0 "hug 命令不支持 -f 参数" - hug --help | grep -q -- "-ho" - CHECK_RESULT $? 0 0 "hug 命令不支持 -ho 参数" - hug --help | grep -q -- "-p" - CHECK_RESULT $? 0 0 "hug 命令不支持 -p 参数" - - # 测试组合指定文件、主机和端口启动服务器 - LOG_INFO "测试组合指定文件、主机和端口启动服务器" - hug -f test_file.py -ho 127.0.0.1 -p 8080 & - PID=$! - sleep 2 - - # 检查服务器是否成功启动 - LOG_INFO "检查服务器是否成功启动" - netstat -tlnp | grep -q ":8080" - CHECK_RESULT $? 0 0 "服务器启动失败" - - # 停止测试服务器 - LOG_INFO "停止测试服务器" - kill $PID - CHECK_RESULT $? 0 0 "停止服务器失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载 python3-hug_hug-3__f__ho__p 软件包" - dnf remove -y python3-hug_hug-3__f__ho__p - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f_file.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f_file.sh deleted file mode 100644 index 83f2751051c..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__f_file.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试指定文件参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-hug_hug-3__f_file软件包 - LOG_INFO "检查是否已安装python3-hug_hug-3__f_file软件包" - rpm -q python3-hug_hug-3__f_file > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug-3__f_file已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "python3-hug_hug-3__f_file未安装,将在测试结束后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-hug_hug-3__f_file软件包" - dnf list available python3-hug_hug-3__f_file > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__f_file软件包" - exit 255 - fi - - # 若未安装则进行安装 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-hug_hug-3__f_file软件包" - dnf install -y python3-hug_hug-3__f_file - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__f_file失败" - fi - - # 测试指定文件参数 - LOG_INFO "测试指定文件参数" - hugo --file testfile > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "参数--file不存在或不支持" - exit 255 - fi - CHECK_RESULT $? 0 0 "测试指定文件参数失败" - - # 环境恢复:若脚本开始时未安装则卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-hugo_ugo-5.x86_64" - dnf remove -y python3-hugo_ugo-5.x86_64 - CHECK_RESULT $? 0 0 "卸载python.8hugo_ugo失败" - fi - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__h.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__h.sh deleted file mode 100644 index ee91bd18ac7..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__h.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试显示帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试:测试显示帮助信息" - - # 检查是否已安装python3-hug_hug-3__h - LOG_INFO "检查是否已安装python3-hug_hug-3__h" - if dnf list installed python3-hug_hug-3__h &>/dev/null; then - LOG_INFO "python3-hug_hug-3__h已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "python3-hug_hug-3__h未安装,准备安装" - INSTALLED=false - fi - - # 检查yum源中是否有python3-hug_hug-3__h - LOG_INFO "检查yum源中是否有python3-hug_hug-3__h" - if ! dnf list available python3-hug_hug-3__h &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__h" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装python3-hug_hug-3__h" - dnf install -y python3-hug_hug-3__h - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__h失败" - fi - - # 测试显示帮助信息 - LOG_INFO "测试显示帮助信息" - python3-hug_hub-4.2.3 --help &>/dev/null - CHECK_RESULT $? 0 0 "显示帮助信息失败" - - # 恢复环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python1.1.1" - dnf remove -y python3-hug_hug_4.2.2 - CHECK_RESULT $? 0 0 "卸载python1.1.1失败" - fi - - LOG_INFO "测试完成:测试显示帮助信息" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ho.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ho.sh deleted file mode 100644 index 0723824fc38..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ho.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定服务器监听主机 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试指定服务器监听主机" - - # 检查是否已安装python3-hug_hug-3__ho - LOG_INFO "检查python3-hug_hug-3__ho是否已安装" - rpm -q python3-hug_hug-3__ho - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug-3__ho已安装,测试结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "python3-hug_hug-3__ho未安装,将在测试前安装" - INSTALLED="false" - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-hug_hug-3__ho软件包" - dnf list available python3-hug_hug-3__ho - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__ho软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装python3-hug_hug-3__ho软件包" - dnf install -y python3-hug_hug-3__ho - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__ho失败" - fi - - # 测试指定服务器监听主机 - LOG_INFO "测试指定服务器监听主机" - # 假设测试命令为test_listen,参数为--host - # 检查参数是否存在或不支持 - LOG_INFO "检查参数--host是否存在" - test_listen --help | grep -q "\-\-host" - if [ $? -ne 0 ]; then - LOG_ERROR "参数--host不存在或不支持" - exit 255 - fi - - # 执行测试命令 - LOG_INFO "执行测试命令:test_listen --host 127.0.0.1" - test_listen --host 127.0.0.1 - CHECK_RESULT $? 0 0 "测试指定服务器监听主机失败" - - # 清理环境 - LOG_INFO "清理测试环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-hug_hug-3__ho软件包" - dnf remove -y python3-hug_hug-3__ho - CHECK_RESULT $? 0 0 "卸载python3-hug_hug-3__ho失败" - else - LOG_INFO "测试前已安装python3-hug_hug-3__ho,保持安装状态" - fi - - LOG_INFO "测试指定服务器监听主机完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ho_host.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ho_host.sh deleted file mode 100644 index 9820758cc34..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ho_host.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试指定主机参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试指定主机参数" - - # 检查是否已安装python3-hug_hug-3__ho_host - LOG_INFO "检查是否已安装python3-hug_hug-3__ho_host" - if dnf list installed python3-hug_hug-3__ho_host &>/dev/null; then - LOG_INFO "python3-hug_hug-3__ho_host已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug_hug-3__ho_host未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-hug_hug-3__ho_host - LOG_INFO "检查yum源中是否有python3-hug_hug-3__ho_host" - if ! dnf list available python3-hug_hug-3__ho_host &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__ho_host软件包" - exit 255 - fi - - # 安装python3-hug_hug-3__ho_host(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python3-hug_hug-3__ho_host" - dnf install -y python3-hug_hug-3__ho_host - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__ho_host失败" - fi - - # 测试指定主机参数 - LOG_INFO "测试指定主机参数" - if ! python -c "import hug; print(hug.__version__)" &>/dev/null; then - LOG_ERROR ""hog"参数不存在或不支持" - exit 255 - fi - - CHECK_RESULT $? 0 0 "测试指定主机参数失败" - - # 清理环境(如果之前未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-hug_hug-3__ho_host" - dnf remove -y python3-hug_hug-3__ho_host - CHECK_RESULT $? 0 0 "卸载python3-hug_hug-3__ho_host失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__i.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__i.sh deleted file mode 100644 index c72a8c8dbb4..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__i.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定自动重载间隔 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:测试指定自动重载间隔" - - # 检查是否已经安装了python3-hug包 - LOG_INFO "检查python3-hug是否已安装" - if rpm -q python3-hug &>/dev/null; then - LOG_INFO "python3-hug已安装,测试结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "python3-hug未安装,将在测试前安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有python3-hug包 - LOG_INFO "检查yum源中是否有python3-hug包" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug包" - exit 255 - fi - - # 如果未安装,则安装python3-hug - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "安装python3-hug" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 检查hug命令是否支持--auto-reload-interval参数 - LOG_INFO "检查hug命令是否支持--auto-reload-interval参数" - hug --help | grep -q -- "--auto-reload-interval" - CHECK_RESULT $? 0 0 "hug命令不支持--auto-reload-interval参数" - - # 测试指定自动重载间隔为5秒 - LOG_INFO "测试指定自动重载间隔为5秒" - hug --auto-reload-interval 5 --version - CHECK_RESULT $? 0 0 "指定自动重载间隔为5秒执行失败" - - # 测试指定自动重载间隔为10秒 - LOG_INFO "测试指定自动重载间隔为10秒" - hug --auto-reload-interval 10 --version - CHECK_RESULT $? 0 0 "指定自动重载间隔为10秒执行失败" - - # 测试指定自动重载间隔为无效值(如0秒) - LOG_INFO "测试指定自动重载间隔为无效值(0秒)" - hug --auto-reload-interval 0 --version - if [ $? -eq 0 ]; then - LOG_ERROR "指定自动重载间隔为0秒应该失败但实际成功" - exit 1 - else - LOG_INFO "指定自动重载间隔为0秒执行失败,符合预期" - fi - - # 环境恢复:如果测试前未安装,则卸载python3-hug - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "卸载python3-hug" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - fi - - LOG_INFO "测试完成:测试指定自动重载间隔" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__i_interval.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__i_interval.sh deleted file mode 100644 index cf66f0a0326..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__i_interval.sh +++ /dev/null @@ -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 : 测试指定间隔参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-hug_hug-3__i_interval - LOG_INFO "检查是否已安装python3-hug_hug-3__i_interval" - if dnf list installed python3-hug_hug-3__i_interval &>/dev/null; then - LOG_INFO "python3-hug_hug-3__i_interval已安装" - installed=true - else - LOG_INFO "python3-hug_hug-3__i_interval未安装" - installed=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-hug_hug-3__i_interval" - if ! dnf list available python3-hug_hug-3__i_interval &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__i_interval" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装python3-hug_hug-3__i_interval" - dnf install -y python3-hug_hug-3__i_interval - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__i_interval失败" - fi - - # 测试指定间隔参数 - LOG_INFO "测试指定间隔参数" - python_output=$(python -c "import hug; print(hug.__version__)" 2>&1) - CHECK_RESULT $? 0 0 "执行Python命令失败" - - # 检查输出是否符合预期(假设预期输出包含特定版本号) - LOG_INFO "检查Python输出是否符合预期" - if [[ "$python_output" != *"hug"* ]]; then - LOG_ERROR "Python输出不符合预期: $python_output" - exit 1 - fi - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-hug_hug-3__i_interval" - dnf remove -y python3-hubgub-33_i-interval || { - LOG_ERROR “卸载python33hubgub33i-interval失败” - exit $? - } - fi - - LOG_INFO “测试脚本执行完毕” - exit O -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__m.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__m.sh deleted file mode 100644 index 2c71d5adccd..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__m.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定API模块 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="python3-hug_hug-3" - LOG_INFO "开始测试指定API模块功能" - LOG_INFO "步骤1: 检查yum源中是否存在软件包$PACKAGE_NAME" - # 检查软件包是否在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源中存在" - LOG_INFO "步骤2: 检查当前是否已安装软件包$PACKAGE_NAME" - # 检查软件包是否已安装 - rpm -q "$PACKAGE_NAME" &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包$PACKAGE_NAME已安装,测试后保持安装状态" - INSTALLED_BEFORE=1 - else - LOG_INFO "软件包$PACKAGE_NAME未安装,将在测试后卸载" - INSTALLED_BEFORE=0 - fi - LOG_INFO "步骤3: 安装软件包$PACKAGE_NAME" - if [ $INSTALLED_BEFORE -eq 0 ]; then - dnf install -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "安装软件包$PACKAGE_NAME失败" - fi - LOG_INFO "步骤4: 测试指定API模块" - # 假设测试命令为python3 -m hug --help,实际命令根据测试用例描述调整 - TEST_COMMAND="python3 -m hug --help" - LOG_INFO "执行测试命令: $TEST_COMMAND" - $TEST_COMMAND - CHECK_RESULT $? 0 0 "测试指定API模块失败" - LOG_INFO "步骤5: 清理环境" - if [ $INSTALLED_BEFORE -eq 0 ]; then - LOG_INFO "卸载软件包$PACKAGE_NAME" - dnf remove -y "$PACKAGE_NAME" - CHECK_RESULT $? 0 0 "卸载软件包$PACKAGE_NAME失败" - else - LOG_INFO "保持软件包$PACKAGE_NAME安装状态" - fi - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__m_module.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__m_module.sh deleted file mode 100644 index 05e4ee4dc0b..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__m_module.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试指定模块参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试指定模块参数" - - # 检查是否已安装python3-hug_hug-3__m_module - if dnf list installed python3-hug_hug-3__m_module &>/dev/null; then - LOG_INFO "python3-hug_hug-3__m_module 已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug_hug-3__m_module 未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否存在python3-hug_hug-3__m_module" - if ! dnf list available python3-hug_hug-3__m_module &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__m_module,退出测试" - exit 255 - fi - - # 安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装python3-hug_hug-3__m_module" - dnf install -y python3-hug_hug-3__m_module - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__m_module失败" - fi - - # 测试指定模块参数 - LOG_INFO "测试指定模块参数" - python -c "import hug; print(hug.__version__)" &>/dev/null - CHECK_RESULT $? 0 0 "测试模块参数失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-hug_hug-3__m_module" - dnf remove -y python3-hug_hug-3__m_module - CHECK_RESULT $? 0 0 "卸载python3-hug_hug-3__m_module失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ma.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ma.sh deleted file mode 100644 index a3eca0e1c7e..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__ma.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试手动重载参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试手动重载参数" - - # 检查是否已安装python3-hug_hug-3__ma - if dnf list installed python3-hug_hug-3__ma &>/dev/null; then - LOG_INFO "python3-hug_hug-3__ma 已安装" - installed=true - else - LOG_INFO "python3-hug_hug-3__ma 未安装" - installed=false - fi - - # 检查yum源中是否有该软件包 - if ! dnf list available python3-hug_hug-3__ma &>/dev/null; then - LOG_ERROR "yum源中未找到 python3-hug_hug-3__ma" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "开始安装 python3-hug_hug-3__ma" - dnf install -y python3-hug_hug-3__ma - CHECK_RESULT $? 0 0 "安装 python3-hug_hug-3__ma 失败" - fi - - # 测试手动重载参数 - LOG_INFO "测试手动重载参数" - python3 -c "import hug; hug.reload()" - CHECK_RESULT $? 0 0 "手动重载参数失败" - - # 如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载 python3-hug_hug-3__ma" - dnf remove -y python3-hug_hug-3__ma - CHECK_RESULT $? 0 0 "卸载 python3-hug_hug-3__ma 失败" - fi - - LOG_INFO "测试手动重载参数完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__n.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__n.sh deleted file mode 100644 index 562b92fecf5..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__n.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试禁用404文档参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在指定的软件包 - check_package_existence() { - dnf list available "$1" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $1 在yum源中不存在" - exit 255 - fi - } - - # 检查命令参数是否支持 - check_command_option() { - if ! "$@" --help | grep -q "$2"; then - LOG_ERROR "命令 $1 不支持参数 $2" - exit 255 - fi - } - - # 主测试逻辑 - main() { - LOG_INFO "开始测试禁用404文档参数" - - # 检查是否已安装python3-hug_hug-3__n - if rpm -q python3-hug_hug-3__n &>/dev/null; then - LOG_INFO "检测到 python3-hug_hug-3__n 已安装,跳过安装步骤" - else - LOG_INFO "未检测到 python3-hug_hug-3__n,开始安装" - check_package_existence "python3-hug_hug-3__n" - dnf install -y python3-hug_hug-3__n - CHECK_RESULT $? 0 0 "安装 python3-hug_hug-3__n 失败" - fi - - # 测试禁用404文档参数功能 - LOG_INFO "测试禁用404文档参数" - check_command_option "hug" "--disable-404-doc" - - # 执行命令并验证结果 - hug --disable-404-doc - CHECK_RESULT $? 0 0 "禁用404文档参数失败" - - # 环境恢复:如果之前未安装则卸载 - if ! rpm -q python3-hug_hug-3__n &>/dev/null; then - LOG_INFO "卸载 python3-hug_hug-3__n" - dnf remove -y python3-hug_hug-3__n - CHECK_RESULT $? 0 0 "卸载 python3-hug_hug-3__n 失败" - else - LOG_INFO "保持 python3-hug_hug-3__n 安装状态" - fi - - LOG_INFO "测试完成" - } - - main - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__p.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__p.sh deleted file mode 100644 index 950fb6f31d5..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__p.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定服务器监听端口 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试指定服务器监听端口功能" - - # 检查yum源中是否存在python3-hug_hug-3包 - LOG_INFO "检查yum源中是否存在python3-hug_hug-3包" - dnf list available python3-hug_hug-3 &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug-3包" - exit 255 - fi - - # 判断软件包是否已安装 - LOG_INFO "判断python3-hug_hug-3包是否已安装" - rpm -q python3-hug_hug-3 &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug-3已安装,标记为已安装状态" - INSTALLED=1 - else - LOG_INFO "python3-hug_hug-3未安装,标记为未安装状态" - INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-hug_hug-3包" - dnf install -y python3-hug_hug-3 - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3包失败" - fi - - # 检查hug命令是否存在并获取帮助信息 - LOG_INFO "检查hug命令是否存在并获取帮助信息" - hug --help &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "hug命令不存在或不支持" - exit 255 - fi - - # 测试指定服务器监听端口功能 - LOG_INFO "启动hug服务监听指定端口" - hug -f your_script.py -p 8080 & - HUG_PID=$! - sleep 2 - - LOG_INFO "检查hug服务进程是否运行" - ps -p $HUG_PID &>/dev/null - CHECK_RESULT $? 0 0 "hug服务进程未正常运行" - - LOG_INFO "检查hug服务是否在监听8080端口" - netstat -tlnp | grep :8080 | grep $HUG_PID - CHECK_RESULT $? 0 0 "hug服务未在8080端口监听" - - LOG_INFO "停止hug服务" - kill $HUG_PID - wait $HUG_PID 2>/dev/null - - # 清理环境 - LOG_INFO "清理测试环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-hug_hug-3包" - dnf remove -y python3-hug_hug-3 - CHECK_RESULT $? 0 0 "卸载python3-hug_hug-3包失败" - else - LOG_INFO "保持python3-hug_hug-3包安装状态" - fi - - LOG_INFO "测试指定服务器监听端口功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__p_port.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__p_port.sh deleted file mode 100644 index 219228e66fb..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__p_port.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试指定端口参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试指定端口参数功能" - - # 检查是否已安装python3-hug_hug-3__p_port - LOG_INFO "检查是否已安装python3-hug_hug-3__p_port" - if dnf list installed python3-hug_hug-3__p_port &>/dev/null; then - LOG_INFO "python3-hug_hug-3__p_port已安装" - installed=true - else - LOG_INFO "python3-hug_hug-3__p_port未安装" - installed=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-hug_hug-3__p_port" - if ! dnf list available python3-hug_hug-3__p_port &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__p_port" - exit 255 - fi - - # 如果未安装,则安装 - if [ "$installed" = false ]; then - LOG_INFO "安装python3-hug_hug-3__p_port" - dnf install -y python3-hug_hug-3__p_port - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__p_port失败" - fi - - # 测试指定端口参数 - LOG_INFO "测试指定端口参数" - hugo server --port 8080 &>/dev/null & - pid=$! - sleep 2 - - CHECK_RESULT $? 0 0 "启动hugo server失败" - - # 检查端口是否监听 - LOG_INFO "检查端口8080是否监听" - netstat -tuln | grep -q 8080 - CHECK_RESULT $? 0 0 "端口8080未监听" - - # 停止hugo server - LOG_INFO "停止hugo server" - kill $pid - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-hug_hug-3__p_port" - dnf remove -y python3-hug_hug-3__p_port - CHECK_RESULT $? 0 0 "卸载python3-hug_hug-3__p_port失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__s.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__s.sh deleted file mode 100644 index e23ada9640c..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__s.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试静默模式参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试静默模式参数" - - # 检查是否已安装python3-hug_hug-3__s - LOG_INFO "检查是否已安装python3-hug_hug-3__s" - if dnf list installed python3-hug_hug-3__s &>/dev/null; then - LOG_INFO "python3-hug_hug-3__s已安装" - installed=true - else - LOG_INFO "python3-hug_hug-3__s未安装" - installed=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-hug_hug-3__s" - if ! dnf list available python3-hug_hug-3__s &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__s" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装python3-hug_hug-3__s" - dnf install -y python3-hug_hug-3__s - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__s失败" - fi - - # 测试静默模式参数 - LOG_INFO "测试静默模式参数" - python3-hug_hug-3__s --silent &>/dev/null - CHECK_RESULT $? 0 0 "静默模式参数测试失败" - - # 如果之前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载python3-hug_hug-3__s" - dnf remove -y python3-hug_hug-3__s - CHECK_RESULT $? 0 0 "卸载python3-hug_hug-3__s失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__v.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__v.sh deleted file mode 100644 index 0f19538f50f..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug-3__v.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试显示程序版本号 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试显示程序版本号 - LOG_INFO "开始测试:显示程序版本号" - - # 检查是否已安装python3-hug_hug-3__v - LOG_INFO "检查是否已安装python3-hug_hug-3__v" - rpm -q python3-hug_hug-3__v &> /dev/null - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug-3__v已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "python3-hug_hug-3__v未安装,准备安装" - INSTALLED=false - fi - - # 检查yum源中是否有python3-hug_hug-3__v - if [ "$INSTALLED" = false ]; then - LOG_INFO "检查yum源中是否有python3-hug_hug-3__v" - dnf list available python3-hug_hug-3__v &> /dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug-3__v,退出测试" - exit 255 - fi - - # 安装python3-hug_hug-3__v - LOG_INFO "开始安装python3-hug_hug-3__v" - dnf install -y python3-hug_hug-3__v &> /dev/null - CHECK_RESULT $? 0 0 "安装python3-hug_hug-3__v失败" - fi - - # 测试显示版本号 - LOG_INFO "测试显示python3-hug_hug-3__v版本号" - hugo version &> /dev/null - CHECK_RESULT $? 0 0 "显示版本号失败" - - # 清理环境:如果脚本开始时未安装,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载python3-hug_hug-3__v" - dnf remove -y python4.8.5 &> /dev/null - CHECK_RESULT $? 0 0 "卸载python3-hug_hug-3__v失败" - fi - - LOG_INFO "测试完成:显示程序版本号" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__c_command.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__c_command.sh deleted file mode 100644 index d37b24f0c62..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__c_command.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -c 参数,指定命令 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试 hug 命令的 -c 参数,指定命令" - - # 检查是否已安装 python3-hug 包 - LOG_INFO "检查是否已安装 python3-hug 包" - if dnf list installed python3-hug &>/dev/null; then - LOG_INFO "python3-hug 已安装,测试完成后将保持安装状态" - installed=true - else - LOG_INFO "python3-hug 未安装,将在测试完成后卸载" - installed=false - fi - - # 检查 yum 源中是否有 python3-hug 包 - LOG_INFO "检查 yum 源中是否有 python3-hug 包" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-hug 包" - exit 255 - fi - - # 如果未安装,则安装 python3-hug 包 - if [ "$installed" = false ]; then - LOG_INFO "安装 python3-hug 包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 包失败" - fi - - # 测试 hug -c 命令 - LOG_INFO "测试 hug -c 命令" - hug -c "echo "test command"" > /tmp/hug_test_output 2>&1 - CHECK_RESULT $? 0 0 "hug -c "echo test command"执行失败" - - # 验证输出是否符合预期 - LOG_INFO "验证 hug -c "echo test command"的输出结果" - grep -q "test command" /tmp/hug_test_output - CHECK_RESULT $? 0 0 "hug -c "echo test command"输出不符合预期" - - # 清理临时文件 - rm -f /tmp/hug_test_output - - # 如果测试前未安装,则卸载 python3-hug - if [ "$installed" = false ]; then - LOG_INFO "卸载 python3-hug " - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载 python3-hubg失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__f_file.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__f_file.sh deleted file mode 100644 index 5f7239c89fe..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__f_file.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -f 参数,指定文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试 hug 命令的 -f 参数,指定文件 - - # 检查软件包是否已安装 - if ! rpm -q python3-hug &>/dev/null; then - LOG_INFO "检查到 python3-hug 未安装,开始安装..." - # 检查 yum 源中是否有该软件包 - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-hug 软件包" - exit 255 - fi - # 安装软件包 - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 失败" - # 标记为测试安装,需要在脚本结束时卸载 - TEST_INSTALLED=1 - else - LOG_INFO "python3-hug 已安装,跳过安装步骤" - TEST_INSTALLED=0 - fi - - # 测试 hug 命令的 -f 参数 - LOG_INFO "测试 hug 命令的 -f 参数,指定文件" - # 创建一个临时测试文件 - TEST_FILE=$(mktemp) - echo "test content" > "$TEST_FILE" - CHECK_RESULT $? 0 0 "创建临时测试文件失败" - - # 执行 hug 命令并检查结果 - hug -f "$TEST_FILE" - CHECK_RESULT $? 0 0 "hug -f 命令执行失败" - - # 清理临时文件 - rm -f "$TEST_FILE" - CHECK_RESULT $? 0 0 "删除临时测试文件失败" - - # 恢复环境 - if [ "$TEST_INSTALLED" -eq 1 ]; then - LOG_INFO "卸载测试安装的 python3-hug 软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载 python3-hug 失败" - fi - - LOG_INFO "测试脚本执行完毕" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__ho_host.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__ho_host.sh deleted file mode 100644 index c0dc12e547a..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__ho_host.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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 : 测试 hug 命令的 -ho 参数,指定主机 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试 hug 命令的 -ho 参数,指定主机" - - # 检查是否已安装 python3-hug 包 - if ! dnf list installed python3-hug &>/dev/null; then - LOG_INFO "python3-hug 未安装,开始安装" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-hug 包" - exit 255 - fi - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 失败" - INSTALLED=1 - else - LOG_INFO "python3-hug 已安装" - INSTALLED=0 - fi - - # 测试 hug -ho 参数 - LOG_INFO "测试 hug -ho 参数,指定主机" - hug -ho example.com - CHECK_RESULT $? 0 0 "hug -ho example.com 执行失败" - - # 清理环境 - if [ $INSTALLED -eq 1 ]; then - LOG_INFO "卸载 python3-hug" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载 python3-hug 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__i_interval.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__i_interval.sh deleted file mode 100644 index dbc577c10c7..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__i_interval.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -i 参数,指定间隔时间 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 hug 命令的 -i 参数,指定间隔时间" - - # 检查软件包是否已安装 - LOG_INFO "检查是否已安装 python3-hug 软件包" - if ! dnf list installed python3-hug &>/dev/null; then - LOG_INFO "python3-hug 未安装,将进行安装" - INSTALLED=false - else - LOG_INFO "python3-hug 已安装" - INSTALLED=true - fi - - # 检查 yum 源中是否有 python3-hug 软件包 - LOG_INFO "检查 yum 源中是否有 python3-hug 软件包" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-hug 软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装 python3-hug 软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 失败" - fi - - # 测试 hug 命令的 -i 参数 - LOG_INFO "测试 hug 命令的 -i 参数" - hug -i 5 - CHECK_RESULT $? 0 0 "hug 命令 -i 参数测试失败" - - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载 python3-hug 软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载 python3-hug 失败" - fi - - LOG_INFO "测试 hug 命令的 -i 参数完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__m_module.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__m_module.sh deleted file mode 100644 index add8b0b33ac..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__m_module.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -m 参数,指定模块 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试 hug 命令的 -m 参数,指定模块 - - # 步骤1:检查是否已安装 python3-hug 模块 - LOG_INFO "检查是否已安装 python3-hug 模块" - rpm -q python3-hug > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug 模块已安装" - INSTALLED=true - else - LOG_INFO "python3-hug 模块未安装" - INSTALLED=false - fi - - # 步骤2:检查 yum 源中是否有 python3-hug 模块 - LOG_INFO "检查 yum 源中是否有 python3-hug 模块" - dnf list available python3-hug > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 python3-hug 模块" - exit 255 - fi - - # 步骤3:如果未安装,则安装 python3-hug 模块 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装 python3-hug 模块" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 模块失败" - fi - - # 步骤4:测试 hug 命令的 -m 参数,指定模块 - LOG_INFO "测试 hug -m 参数" - hug -m hug_test_module > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "hug -m hug_test_module 执行失败" - - #步骤5:清理环境(如果最初未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载 python3-hug 模块" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python-3h ug模块失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__ma.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__ma.sh deleted file mode 100644 index 3d6d5727514..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__ma.sh +++ /dev/null @@ -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-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -ma 参数,手动重载 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试 hug 命令的 -ma 参数,手动重载" - - # 检查是否已安装 python3-hug 软件包 - if ! dnf list installed python3-hug &>/dev/null; then - LOG_INFO "环境未安装 python3-hug,将进行安装" - # 检查 yum 源中是否有该软件包 - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-hug 软件包" - exit 255 - fi - # 安装软件包 - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 失败" - # 标记需要卸载 - UNINSTALL_NEEDED=1 - else - LOG_INFO "环境已安装 python3-hug,无需重新安装" - fi - - # 测试 hug 命令的 -ma 参数 - LOG_INFO "测试 hug -ma 参数" - hug -ma &>/dev/null - CHECK_RESULT $? 0 0 "hug -ma 参数不支持或执行失败" - - # 清理环境(如果之前未安装) - if [[ $UNINSTALL_NEEDED -eq 1 ]]; then - LOG_INFO "卸载 python3-hug 软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载 python3-hug 失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__n.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__n.sh deleted file mode 100644 index bafcc316d17..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__n.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -n 参数,禁用 404 文档 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-hug软件包 - LOG_INFO "检查是否已安装python3-hug软件包" - rpm -q python3-hug > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug已安装,脚本结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-hug软件包 - LOG_INFO "检查yum源中是否有python3-hug软件包" - dnf list available python3-hug > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - # 安装python3-hug软件包(如果未安装) - if ! $INSTALLED; then - LOG_INFO "安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 测试hug命令的-n参数 - LOG_INFO "测试hug命令的-n参数,禁用404文档" - hug -n > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "hug命令不支持-n参数" - exit 255 - fi - - # 检查-n参数是否禁用404文档(假设通过特定输出验证) - LOG_INFO "验证-n参数是否禁用404文档" - output=$(hug -n 2>&1) - echo "$output" | grep -q "404 documentation disabled" - CHECK_RESULT $? 0 0 "-n参数未禁用404文档" - - # 清理环境(如果之前未安装) - if ! $INSTALLED; then - LOG_INFO "卸载python3-hug软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hugo失败" - fi - - LOG_INFO "测试脚本执行完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__p_port.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__p_port.sh deleted file mode 100644 index f8c0ed4b587..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__p_port.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -p 参数,指定端口号 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试 hug 命令的 -p 参数,指定端口号" - - # 检查是否已安装 python3-hug - if ! dnf list installed python3-hug &>/dev/null; then - LOG_INFO "环境未安装 python3-hug,将进行安装" - # 检查 yum 源中是否有该软件包 - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum 源中未找到 python3-hug 软件包" - exit 255 - fi - # 安装软件包 - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 失败" - # 标记为需要卸载 - NEED_UNINSTALL=1 - else - LOG_INFO "环境已安装 python3-hug" - fi - - # 测试 hug -p 参数 - LOG_INFO "测试 hug -p 参数指定端口号" - hug -p 8080 &>/dev/null - CHECK_RESULT $? 0 0 "hug -p 8080 执行失败" - - # 测试不支持的参数(如 -x) - LOG_INFO "测试不支持的参数(如 -x)" - hug -x &>/dev/null - if [ $? -ne 255 ]; then - LOG_ERROR "hug 不支持 -x 参数但未返回退出码 255" - exit 255 - fi - - #清理环境 - if [ "$NEED_UNINSTALL" -eq 1 ]; then - LOG_INFO "卸载 python3-hug" - dnf remove -y python3-hug - CHECK_RESULT $?  0   "卸载python- hug失败" - fi - - LOG_INFO “测试完成” - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__s.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__s.sh deleted file mode 100644 index f92e1f0e81a..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug__s.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-02 -# @License : Mulan PSL v2 -# @Desc : 测试 hug 命令的 -s 参数,静默模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装python3-hug包 - LOG_INFO "检查是否已安装python3-hug包" - if dnf list installed python3-hug &>/dev/null; then - LOG_INFO "python3-hug已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-hug包 - LOG_INFO "检查yum源中是否有python3-hug包" - if ! dnf list available python3-hug &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug包" - exit 255 - fi - - # 如果未安装,则安装python3-hug包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装python3-hug包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug包失败" - fi - - # 测试hug命令的-s参数(静默模式) - LOG_INFO "测试hug命令的-s参数(静默模式)" - hug -s - CHECK_RESULT $? 0 0 "hug命令的-s参数测试失败" - - # 如果测试前未安装,则卸载python3-hug包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-hug包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug包失败" - fi - - LOG_INFO "测试脚本执行完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_c.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_c.sh deleted file mode 100644 index cfffb9a4c81..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_c.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定启动命令 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试指定启动命令" - LOG_INFO "步骤1:检查系统中是否已安装python3-hug_hug_c软件包" - rpm -q python3-hug_hug_c > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "系统中已安装python3-hug_hug_c软件包,测试结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "系统中未安装python3-hug_hug_c软件包,将在测试前安装并在测试后卸载" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有python3-hug_hug_c软件包" - dnf list available python3-hug_hug_c > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug_c软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-hug_hug_c软件包" - dnf install -y python3-hug_hug_c - CHECK_RESULT $? 0 0 "安装python3-hug_hug_c软件包失败" - fi - - LOG_INFO "步骤4:检查指定启动命令的参数" - python3-hug_hug_c --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "python3-hug_hug_c命令不支持--help参数" - exit 255 - fi - - LOG_INFO "步骤5:执行指定的启动命令" - python3-hug_hug_c start - CHECK_RESULT $? 0 0 "执行python3-hug_hug_c start命令失败" - - LOG_INFO "步骤6:停止服务" - python3-hug_hug_c stop - CHECK_RESULT $? 0 0 "执行python3-hug_hug_c stop命令失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤7:卸载python3-hug_hug_c软件包" - dnf remove -y python3-hug_hug_c - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_c软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f.sh deleted file mode 100644 index e29f3830eee..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定文件启动 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试指定文件启动" - - # 检查软件包是否在yum源中 - LOG_INFO "步骤1:检查yum源中是否存在python3-hug_hug_f软件包" - if ! dnf list available python3-hug_hug_f &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug_f软件包" - exit 255 - fi - - # 判断环境是否已安装 - LOG_INFO "步骤2:检查环境是否已安装python3-hug_hug_f" - if rpm -q python3-hug_hug_f &>/dev/null; then - LOG_INFO "环境已安装python3-hug_hug_f,测试结束后保持安装状态" - already_installed=1 - else - LOG_INFO "环境未安装python3-hug_hug_f,将进行安装" - already_installed=0 - fi - - # 如果未安装,则安装软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤3:安装python3-hug_hug_f软件包" - dnf install -y python3-hug_hug_f - CHECK_RESULT $? 0 0 "安装python3-hug_hug_f失败" - fi - - # 测试指定文件启动 - LOG_INFO "步骤4:测试指定文件启动" - # 假设启动命令为 hug_f_start,具体命令根据实际软件包调整 - if ! command -v hug_f_start &>/dev/null; then - LOG_ERROR "命令hug_f_start不存在或不支持" - exit 255 - fi - - # 执行启动命令,这里假设启动命令需要指定配置文件,例如 hug_f_start /etc/hug_f.conf - CONFIG_FILE="/etc/hug_f.conf" - if [ ! -f "$CONFIG_FILE" ]; then - LOG_ERROR "配置文件 $CONFIG_FILE 不存在" - exit 255 - fi - - hug_f_start "$CONFIG_FILE" - CHECK_RESULT $? 0 0 "启动指定文件失败" - - # 如果需要多个服务器并在第二个服务器上执行命令,使用SSH_CMD - # 例如:SSH_CMD "ls" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "步骤5:清理环境,卸载python3-hug_hug_f软件包" - dnf remove -y python3-hug_hug_f - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_f失败" - fi - - LOG_INFO "测试完成:测试指定文件启动成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f_ho_p.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f_ho_p.sh deleted file mode 100644 index 6fb136a64d0..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f_ho_p.sh +++ /dev/null @@ -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 : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试同时指定文件、主机和端口 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:同时指定文件、主机和端口" - LOG_INFO "步骤1:检查yum源中是否存在python3-hug软件包" - dnf list available python3-hug 2>/dev/null | grep -q python3-hug - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - LOG_INFO "python3-hug软件包在yum源中存在" - - LOG_INFO "步骤2:检查系统是否已安装python3-hug" - rpm -q python3-hug >/dev/null 2>&1 - already_installed=$? - if [ $already_installed -eq 0 ]; then - LOG_INFO "python3-hug已安装,测试结束后将保持安装状态" - else - LOG_INFO "python3-hug未安装,将进行安装" - fi - - LOG_INFO "步骤3:执行测试命令,同时指定文件、主机和端口" - LOG_INFO "尝试执行命令:hug -f test_file -h localhost -p 8080" - hug -f test_file -h localhost -p 8080 2>&1 - command_result=$? - if [ $command_result -eq 255 ]; then - LOG_ERROR "命令参数不存在或不支持" - exit 255 - fi - LOG_INFO "命令执行完成,退出码:$command_result" - CHECK_RESULT $command_result 0 0 "命令执行失败" - - LOG_INFO "步骤4:环境恢复" - if [ $already_installed -ne 0 ]; then - LOG_INFO "卸载测试安装的python3-hug软件包" - dnf remove -y python3-hug >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - LOG_INFO "python3-hug卸载成功" - else - LOG_INFO "系统原本已安装python3-hug,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f_m.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f_m.sh deleted file mode 100644 index b264c425ba2..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_f_m.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试同时指定文件和模块 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试同时指定文件和模块功能" - LOG_INFO "步骤1:检查环境中是否已安装python3-hug_hug_f_m软件包" - if dnf list installed python3-hug_hug_f_m &>/dev/null; then - LOG_INFO "python3-hug_hug_f_m已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug_hug_f_m未安装,将在测试步骤中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在python3-hug_hug_f_m软件包" - if ! dnf list available python3-hug_hug_f_m &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug_f_m软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-hug_hug_f_m软件包" - dnf install -y python3-hug_hug_f_m - CHECK_RESULT $? 0 0 "安装python3-hug_hug_f_m失败" - fi - - LOG_INFO "步骤4:测试同时指定文件和模块功能" - LOG_INFO "执行命令:python3-hug_hug_f_m --file test_file --module test_module" - python3-hug_hug_f_m --file test_file --module test_module - CHECK_RESULT $? 0 0 "同时指定文件和模块功能测试失败" - - LOG_INFO "步骤5:清理测试环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载python3-hug_hug_f_m软件包" - dnf remove -y python3-hug_hug_f_m - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_f_m失败" - else - LOG_INFO "保持python3-hug_hug_f_m安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_h.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_h.sh deleted file mode 100644 index e884f14f680..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_h.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试显示帮助信息 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:测试显示帮助信息" - - # 检查是否已安装python3-hug_hug_h - LOG_INFO "步骤1:检查python3-hug_hug_h是否已安装" - rpm -q python3-hug_hug_h - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug_h已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "python3-hug_hug_h未安装,将在测试前安装并在测试后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否有python3-hug_hug_h软件包" - dnf list available python3-hug_hug_h - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有找到python3-hug_hug_h软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装python3-hug_hug_h软件包" - dnf install -y python3-hug_hug_h - CHECK_RESULT $? 0 0 "安装python3-hug_hug_h失败" - fi - - # 测试显示帮助信息 - LOG_INFO "步骤4:执行命令显示帮助信息" - python3-hug_hug_h --help - CHECK_RESULT $? 0 0 "显示帮助信息失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤5:卸载python3-hug_hug_h软件包" - dnf remove -y python3-hug_hug_h - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_h失败" - fi - - LOG_INFO "测试结束:测试显示帮助信息完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ho.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ho.sh deleted file mode 100644 index f3abde4f6b7..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ho.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定主机地址 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试指定主机地址 - LOG_INFO "开始测试指定主机地址功能" - - # 检查是否已安装python3-hug_hug_ho包 - LOG_INFO "检查python3-hug_hug_ho包是否已安装" - dnf list installed python3-hug_hug_ho > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug_ho包已安装,测试结束后保持安装状态" - INSTALLED="true" - else - LOG_INFO "python3-hug_hug_ho包未安装,测试过程中将进行安装" - INSTALLED="false" - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-hug_hug_ho包" - dnf list available python3-hug_hug_ho > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug_ho包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装python3-hug_hug_ho包" - dnf install -y python3-hug_hug_ho - CHECK_RESULT $? 0 0 "安装python3-hug_hug_ho包失败" - fi - - # 测试指定主机地址功能 - LOG_INFO "测试指定主机地址功能" - # 假设python3-hug_hug_ho包中有一个命令用于测试指定主机地址,这里用示例命令代替 - # 实际应根据软件包的实际命令进行调整 - python3 -c "import hug_hug_ho; print("测试指定主机地址功能")" > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "执行指定主机地址测试失败" - - # 测试指定主机地址的参数 - LOG_INFO "测试指定主机地址参数" - # 假设命令为test_host,参数为--host - # 检查参数是否存在 - test_host --help 2>&1 | grep -q "\-\-host" - if [ $? -ne 0 ]; then - LOG_ERROR "指定主机地址参数不存在或不支持" - exit 255 - fi - - # 执行带参数的测试 - LOG_INFO "执行带主机地址参数的测试" - # 假设使用127.0.0.1作为测试主机地址 - test_host --host 127.0.0.1 > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "带主机地址参数的测试执行失败" - - # 在第二个服务器上执行测试(如果需要) - if [ -n "$NODE2_IPV4" ] && [ -n "$NODE2_PASSWORD" ] && [ -n "$NODE2_USER" ]; then - LOG_INFO "在第二个服务器上执行指定主机地址测试" - SSH_CMD "test_host --host 127.0.0.1" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "在第二个服务器上执行指定主机地址测试失败" - fi - - # 清理环境 - LOG_INFO "清理测试环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-hug_hug_ho包" - dnf remove -y python3-hug_hug_ho - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_ho包失败" - else - LOG_INFO "保持python3-hug_hug_ho包安装状态" - fi - - LOG_INFO "指定主机地址功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ho_p.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ho_p.sh deleted file mode 100644 index 142ca7b2174..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ho_p.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试同时指定主机和端口 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装了python3-hug_hug_ho_p软件包 - LOG_INFO "检查是否已安装python3-hug_hug_ho_p软件包" - rpm -q python3-hug_hug_ho_p > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug_ho_p已安装,标记为已安装状态" - already_installed=true - else - LOG_INFO "python3-hug_hug_ho_p未安装,标记为未安装状态" - already_installed=false - fi - - # 检查yum源中是否存在python3-hug_hug_ho_p软件包 - LOG_INFO "检查yum源中是否存在python3-hug_hug_ho_p软件包" - dnf list available python3-hug_hug_ho_p > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug_ho_p软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$already_installed" = "false" ]; then - LOG_INFO "开始安装python3-hug_hug_ho_p软件包" - dnf install -y python3-hug_hug_ho_p - CHECK_RESULT $? 0 0 "安装python3-hug_hug_ho_p失败" - LOG_INFO "python3-hug_hug_ho_p软件包安装成功" - fi - - # 测试同时指定主机和端口 - LOG_INFO "测试同时指定主机和端口功能" - # 这里假设python3-hug_hug_ho_p有一个命令可以同时指定主机和端口,例如:hug_ho_p --host 127.0.0.1 --port 8080 - # 检查命令是否支持--host和--port参数 - LOG_INFO "检查命令是否支持--host和--port参数" - hug_ho_p --help | grep -q -- "--host" - host_supported=$? - hug_ho_p --help | grep -q -- "--port" - port_supported=$? - - if [ $host_supported -ne 0 ] || [ $port_supported -ne 0 ]; then - LOG_ERROR "命令不支持--host或--port参数" - exit 255 - fi - - # 执行测试命令 - LOG_INFO "执行测试命令:hug_ho_p --host 127.0.0.1 --port 8080" - hug_ho_p --host 127.0.0.1 --port 8080 - CHECK_RESULT $? 0 0 "同时指定主机和端口执行失败" - - LOG_INFO "测试同时指定主机和端口功能成功" - - # 环境清理 - LOG_INFO "开始环境清理" - if [ "$already_installed" = "false" ]; then - LOG_INFO "卸载python3-hug_hug_ho_p软件包" - dnf remove -y python3-hug_hug_ho_p - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_ho_p失败" - LOG_INFO "python3-hug_hug_ho_p软件包卸载成功" - else - LOG_INFO "保持python3-hug_hug_ho_p软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_i.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_i.sh deleted file mode 100644 index 9fa721ea53e..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_i.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定轮询间隔 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="python3-hug_hug_i" - TEST_COMMAND="hug_i" - TEST_PARAM="--interval" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查软件包是否在yum源中" - dnf list available $PACKAGE_NAME 2>/dev/null | grep -q $PACKAGE_NAME - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 $PACKAGE_NAME 不在yum源中" - exit 255 - fi - - # 步骤2: 检查是否已安装软件包 - LOG_INFO "步骤2: 检查是否已安装软件包" - rpm -q $PACKAGE_NAME >/dev/null 2>&1 - if [ $? -eq 0 ]; then - INSTALLED="true" - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - else - INSTALLED="false" - LOG_INFO "软件包 $PACKAGE_NAME 未安装" - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3: 安装软件包 $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败" - fi - - # 步骤4: 检查命令参数是否支持 - LOG_INFO "步骤4: 检查命令参数是否支持" - $TEST_COMMAND --help 2>&1 | grep -q "$TEST_PARAM" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $TEST_COMMAND 不支持参数 $TEST_PARAM" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境: 卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - fi - exit 255 - fi - - # 步骤5: 测试指定轮询间隔 - LOG_INFO "步骤5: 测试指定轮询间隔" - $TEST_COMMAND $TEST_PARAM 5 - CHECK_RESULT $? 0 0 "执行命令 $TEST_COMMAND $TEST_PARAM 5 失败" - - # 步骤6: 清理环境 - LOG_INFO "步骤6: 清理环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载软件包 $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败" - else - LOG_INFO "保持软件包 $PACKAGE_NAME 安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_i_c.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_i_c.sh deleted file mode 100644 index fe5fe94dc2e..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_i_c.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试同时指定轮询间隔和启动命令 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试同时指定轮询间隔和启动命令" - - LOG_INFO "检查系统中是否已安装 python3-hug 软件包" - if rpm -q python3-hug &>/dev/null; then - LOG_INFO "python3-hug 已安装,测试结束后将保持安装状态" - installed=true - else - LOG_INFO "python3-hug 未安装,将在测试过程中安装并在测试结束后卸载" - installed=false - fi - - LOG_INFO "检查 yum 源中是否有 python3-hug 软件包" - dnf list python3-hug &>/dev/null - CHECK_RESULT $? 0 0 "yum 源中未找到 python3-hug 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 python3-hug 软件包,退出测试" - exit 255 - fi - - if [ "$installed" = "false" ]; then - LOG_INFO "安装 python3-hug 软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装 python3-hug 软件包失败" - fi - - LOG_INFO "测试同时指定轮询间隔和启动命令" - hug --interval 5 --command "echo "Test command"" &>/dev/null - CHECK_RESULT $? 0 0 "同时指定轮询间隔和启动命令失败" - - LOG_INFO "检查命令参数是否存在或不支持" - hug --invalid-parameter &>/dev/null - if [ $? -eq 255 ]; then - LOG_ERROR "指定的参数不存在或不支持,退出测试" - exit 255 - fi - - if [ "$installed" = "false" ]; then - LOG_INFO "卸载 python3-hug 软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载 python3-hug 软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_m.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_m.sh deleted file mode 100644 index 7f312ba6061..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_m.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定模块启动 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试指定模块启动 - - # 判断是否已安装python3-hug包 - LOG_INFO "检查python3-hug是否已安装" - rpm -q python3-hug > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug已安装,标记为已存在" - already_installed=1 - else - LOG_INFO "python3-hug未安装,标记为未安装" - already_installed=0 - fi - - # 检查yum源中是否有python3-hug包 - LOG_INFO "检查yum源中是否有python3-hug包" - dnf list available python3-hug > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug包" - exit 255 - fi - - # 如果未安装,则安装python3-hug包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装python3-hug包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 测试指定模块启动 - LOG_INFO "测试指定模块启动" - python3 -c "import hug; print("hug模块导入成功")" - CHECK_RESULT $? 0 0 "hug模块导入失败" - - # 测试hug的简单功能 - LOG_INFO "测试hug的简单功能" - cat > /tmp/test_hug.py << "EOF" - import hug - - @hug.get("/hello") - def hello(): - return "Hello, World!" - - if __name__ == "__main__": - print("hug模块功能测试通过") - EOF - - python3 /tmp/test_hug.py - CHECK_RESULT $? 0 0 "hug模块功能测试失败" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/test_hug.py - - # 如果测试前未安装,则卸载python3-hug包 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载python3-hug包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_m_i_s.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_m_i_s.sh deleted file mode 100644 index a2ebf3f2f08..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_m_i_s.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试同时指定模块、轮询间隔和静默模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试同时指定模块、轮询间隔和静默模式" - LOG_INFO "步骤1:检查环境是否已安装python3-hug_hug_m_i_s软件包" - rpm -q python3-hug_hug_m_i_s >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "检测到python3-hug_hug_m_i_s已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "未检测到python3-hug_hug_m_i_s安装,将在测试中安装并最终卸载" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在python3-hug_hug_m_i_s软件包" - dnf list available python3-hug_hug_m_i_s >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到python3-hug_hug_m_i_s软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在python3-hug_hug_m_i_s软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装python3-hug_hug_m_i_s软件包" - dnf install -y python3-hug_hug_m_i_s - CHECK_RESULT $? 0 0 "安装python3-hug_hug_m_i_s失败" - fi - - LOG_INFO "步骤4:检查命令是否支持指定模块、轮询间隔和静默模式参数" - python3-hug_hug_m_i_s --help 2>&1 | grep -q -- "--module" - CHECK_RESULT $? 0 0 "命令不支持--module参数" - python3-hug_hug_m_i_s --help 2>&1 | grep -q -- "--poll-interval" - CHECK_RESULT $? 0 0 "命令不支持--poll-interval参数" - python3-hug_hug_m_i_s --help 2>&1 | grep -q -- "--silent" - CHECK_RESULT $? 0 0 "命令不支持--silent参数" - - LOG_INFO "步骤5:执行命令,同时指定模块、轮询间隔和静默模式" - python3-hug_hug_m_i_s --module test_module --poll-interval 5 --silent - CHECK_RESULT $? 0 0 "执行命令失败" - - LOG_INFO "步骤6:清理环境" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-hug_hug_m_i_s软件包" - dnf remove -y python3-hug_hug_m_i_s - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_m_i_s失败" - else - LOG_INFO "保持python3-hug_hug_m_i_s安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ma.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ma.sh deleted file mode 100644 index 7c66c3f9edc..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_ma.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试手动重载模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试手动重载模式" - LOG_INFO "步骤1:检查yum源中是否存在python3-hug_hug_ma软件包" - if ! dnf list available python3-hug_hug_ma &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug_ma软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查是否已安装python3-hug_hug_ma软件包" - if rpm -q python3-hug_hug_ma &>/dev/null; then - LOG_INFO "软件包已安装,测试完成后保持安装状态" - INSTALLED=true - else - LOG_INFO "软件包未安装,将执行安装步骤" - INSTALLED=false - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-hug_hug_ma软件包" - dnf install -y python3-hug_hug_ma - CHECK_RESULT $? 0 0 "安装python3-hug_hug_ma失败" - fi - - LOG_INFO "步骤4:检查手动重载模式命令参数" - if ! hug --help | grep -q "reload"; then - LOG_ERROR "手动重载模式参数不存在或不支持" - exit 255 - fi - - LOG_INFO "步骤5:执行手动重载模式命令" - hug --reload - CHECK_RESULT $? 0 0 "执行手动重载模式命令失败" - - LOG_INFO "步骤6:验证手动重载模式执行结果" - # 根据实际测试需求添加验证步骤,例如检查服务状态或日志输出 - # 示例:检查服务是否正在运行 - systemctl is-active hug_service &>/dev/null - CHECK_RESULT $? 0 0 "手动重载模式后服务未正常运行" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤7:卸载python3-hug_hug_ma软件包" - dnf remove -y python3-hug_hug_ma - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_ma失败" - else - LOG_INFO "步骤7:保持python3-hug_hug_ma软件包安装状态" - fi - - LOG_INFO "测试手动重载模式完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_n.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_n.sh deleted file mode 100644 index e6fd107fac0..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_n.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试禁用404文档 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试禁用404文档" - - # 检查yum源中是否有python3-hug软件包 - LOG_INFO "检查yum源中是否有python3-hug软件包" - dnf list available python3-hug 2>/dev/null | grep -q python3-hug - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - # 检查是否已安装python3-hug - LOG_INFO "检查是否已安装python3-hug" - if rpm -q python3-hug >/dev/null 2>&1; then - LOG_INFO "python3-hug已安装,测试结束后保持安装状态" - already_installed=1 - else - LOG_INFO "python3-hug未安装,将进行安装测试" - already_installed=0 - fi - - # 如果未安装,则安装python3-hug - if [ $already_installed -eq 0 ]; then - LOG_INFO "安装python3-hug" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 测试禁用404文档功能 - LOG_INFO "测试禁用404文档功能" - # 这里假设python3-hug有--disable-404参数,实际参数需要根据软件包文档确定 - # 如果参数不存在或不支持,则退出码为255 - python3 -m hug --help 2>&1 | grep -q "\-\-disable\-404" - if [ $? -ne 0 ]; then - LOG_ERROR "python3-hug不支持--disable-404参数" - # 清理环境 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载python3-hug" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - fi - exit 255 - fi - - # 执行禁用404文档的命令 - LOG_INFO "执行禁用404文档的命令" - python3 -m hug --disable-404 --version - CHECK_RESULT $? 0 0 "禁用404文档功能测试失败" - - # 清理环境 - if [ $already_installed -eq 0 ]; then - LOG_INFO "卸载python3-hug" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - else - LOG_INFO "保持python3-hug安装状态" - fi - - LOG_INFO "测试完成:测试禁用404文档" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_n_ma.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_n_ma.sh deleted file mode 100644 index 838e2f7ba9b..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_n_ma.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试同时禁用404文档并启用手动重载 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试同时禁用404文档并启用手动重载" - LOG_INFO "步骤1:检查python3-hug_hug_n_ma软件包是否在yum源中" - dnf list available python3-hug_hug_n_ma - if [ $? -ne 0 ]; then - LOG_ERROR "python3-hug_hug_n_ma软件包不在yum源中" - exit 255 - fi - - LOG_INFO "步骤2:检查环境是否已经安装python3-hug_hug_n_ma" - rpm -q python3-hug_hug_n_ma - if [ $? -eq 0 ]; then - already_installed=true - LOG_INFO "环境已安装python3-hug_hug_n_ma,测试结束后保持安装状态" - else - already_installed=false - LOG_INFO "环境未安装python3-hug_hug_n_ma,将在测试步骤中安装" - fi - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装python3-hug_hug_n_ma软件包" - dnf install -y python3-hug_hug_n_ma - CHECK_RESULT $? 0 0 "安装python3-hug_hug_n_ma失败" - fi - - LOG_INFO "步骤4:检查指定命令参数是否存在" - command_to_test="hug_n_ma_command" - if ! $command_to_test --help 2>&1 | grep -q "disable-404-doc"; then - LOG_ERROR "参数--disable-404-doc不存在或不支持" - exit 255 - fi - if ! $command_to_test --help 2>&1 | grep -q "enable-manual-reload"; then - LOG_ERROR "参数--enable-manual-reload不存在或不支持" - exit 255 - fi - - LOG_INFO "步骤5:执行命令同时禁用404文档并启用手动重载" - $command_to_test --disable-404-doc --enable-manual-reload - CHECK_RESULT $? 0 0 "执行命令失败" - - LOG_INFO "步骤6:验证命令执行效果" - # 此处根据实际命令执行后的验证逻辑编写,例如检查配置文件或服务状态 - # 假设验证命令为check_hug_n_ma_status - check_hug_n_ma_status --verify-options - CHECK_RESULT $? 0 0 "验证命令执行效果失败" - - if [ "$already_installed" = false ]; then - LOG_INFO "步骤7:卸载python3-hug_hug_n_ma软件包" - dnf remove -y python3-hug_hug_n_ma - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_n_ma失败" - fi - - LOG_INFO "测试完成:测试同时禁用404文档并启用手动重载" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_p.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_p.sh deleted file mode 100644 index 8f7db243c08..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_p.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试指定端口号 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-hug_hug_p软件包指定端口号功能" - - # 检查软件包是否已在yum源中 - LOG_INFO "检查yum源中是否存在python3-hug_hug_p软件包" - if ! dnf list available python3-hug_hug_p &>/dev/null; then - LOG_ERROR "yum源中未找到python3-hug_hug_p软件包" - exit 255 - fi - - # 检查软件包是否已安装 - LOG_INFO "检查python3-hug_hug_p是否已安装" - if rpm -q python3-hug_hug_p &>/dev/null; then - LOG_INFO "python3-hug_hug_p已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "python3-hug_hug_p未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装python3-hug_hug_p软件包" - dnf install -y python3-hug_hug_p - CHECK_RESULT $? 0 0 "安装python3-hug_hug_p失败" - fi - - # 测试指定端口号功能 - LOG_INFO "测试指定端口号功能" - # 假设软件包提供了命令 "hug_server" 并支持 "-p" 参数指定端口 - if ! hug_server --help 2>&1 | grep -q "\-p"; then - LOG_ERROR "hug_server命令不支持-p参数" - exit 255 - fi - - LOG_INFO "启动hug_server并指定端口号为8080" - hug_server -p 8080 & - SERVER_PID=$! - sleep 2 - - LOG_INFO "检查hug_server是否在端口8080上运行" - netstat -tlnp | grep ":8080" - CHECK_RESULT $? 0 0 "hug_server未在端口8080上启动" - - LOG_INFO "停止hug_server进程" - kill $SERVER_PID - wait $SERVER_PID 2>/dev/null - - # 清理环境 - LOG_INFO "清理测试环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-hug_hug_p软件包" - dnf remove -y python3-hug_hug_p - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_p失败" - else - LOG_INFO "保持python3-hug_hug_p安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_s.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_s.sh deleted file mode 100644 index f2337ad7082..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_s.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试静默模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装python3-hug_hug_s软件包 - LOG_INFO "检查python3-hug_hug_s软件包是否已安装" - rpm -q python3-hug_hug_s >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug_hug_s软件包已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-hug_hug_s软件包未安装,测试结束后将卸载" - INSTALLED=false - fi - - # 检查yum源中是否有python3-hug_hug_s软件包 - LOG_INFO "检查yum源中是否有python3-hug_hug_s软件包" - dnf list available python3-hug_hug_s >/dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug_hug_s软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装python3-hug_hug_s软件包" - dnf install -y python3-hug_hug_s >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装python3-hug_hug_s软件包失败" - LOG_INFO "python3-hug_hug_s软件包安装成功" - fi - - # 测试静默模式 - LOG_INFO "开始测试静默模式" - # 假设python3-hug_hug_s命令支持--silent参数进行静默模式测试 - # 检查命令是否支持--silent参数 - LOG_INFO "检查python3-hug_hug_s命令是否支持--silent参数" - python3-hug_hug_s --help 2>&1 | grep -q "\-\-silent" - if [ $? -ne 0 ]; then - LOG_ERROR "python3-hug_hug_s命令不支持--silent参数" - # 如果未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - dnf remove -y python3-hug_hug_s >/dev/null 2>&1 - fi - exit 255 - fi - - # 执行静默模式测试 - LOG_INFO "执行python3-hug_hug_s --silent命令" - python3-hug_hug_s --silent >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "python3-hug_hug_s --silent命令执行失败" - - LOG_INFO "静默模式测试成功" - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-hug_hug_s软件包" - dnf remove -y python3-hug_hug_s >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载python3-hug_hug_s软件包失败" - LOG_INFO "python3-hug_hug_s软件包卸载成功" - else - LOG_INFO "保持python3-hug_hug_s软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_s_n.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_s_n.sh deleted file mode 100644 index ae974f6c5bd..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_s_n.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试同时启用静默模式和禁用404文档 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装python3-hug - LOG_INFO "检查是否已安装python3-hug软件包" - rpm -q python3-hug > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug已安装,标记为已安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "python3-hug未安装,标记为未安装状态" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有python3-hug软件包 - LOG_INFO "检查yum源中是否有python3-hug软件包" - dnf list available python3-hug > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中没有python3-hug软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到python3-hug软件包" - exit 255 - fi - - # 如果未安装,则安装python3-hug - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装python3-hug软件包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug失败" - fi - - # 测试同时启用静默模式和禁用404文档 - LOG_INFO "测试同时启用静默模式和禁用404文档" - python3 -m hug -f -s -q -n > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "启用静默模式和禁用404文档失败" - - # 清理环境 - LOG_INFO "清理环境" - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载python3-hug软件包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug失败" - else - LOG_INFO "保持python3-hug安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_v.sh b/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_v.sh deleted file mode 100644 index ac5ee012439..00000000000 --- a/testcases/function_test/pkg_test/python-hug/python3-hug/test_python3-hug_hug_v.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-26 -# @License : Mulan PSL v2 -# @Desc : 测试显示程序版本号 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装python3-hug包 - LOG_INFO "检查是否已安装python3-hug包" - rpm -q python3-hug &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "python3-hug已安装" - INSTALLED=1 - else - LOG_INFO "python3-hug未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有python3-hug包 - LOG_INFO "检查yum源中是否有python3-hug包" - dnf list available python3-hug &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有python3-hug包" - exit 255 - fi - - # 如果未安装,则安装python3-hug包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装python3-hug包" - dnf install -y python3-hug - CHECK_RESULT $? 0 0 "安装python3-hug包失败" - fi - - # 测试显示程序版本号 - LOG_INFO "测试显示程序版本号" - hug --version - CHECK_RESULT $? 0 0 "显示版本号失败" - - # 如果之前未安装,则卸载python3-hug包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载python3-hug包" - dnf remove -y python3-hug - CHECK_RESULT $? 0 0 "卸载python3-hug包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_args.sh b/testcases/function_test/pkg_test/python-logutils/help/test_help_function_args.sh deleted file mode 100644 index 364c05a0ec5..00000000000 --- a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_args.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-11 -# @License : Mulan PSL v2 -# @Desc : Test help with arguments -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装指定软件包 - check_package_installed() { - local package=$1 - if rpm -q "$package" &>/dev/null; then - LOG_INFO "软件包 $package 已安装" - return 0 - else - LOG_INFO "软件包 $package 未安装" - return 1 - fi - } - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package=$1 - if dnf list available "$package" &>/dev/null; then - LOG_INFO "软件包 $package 在yum源中可用" - return 0 - else - LOG_ERROR "软件包 $package 不在yum源中" - exit 255 - fi - } - - # 安装软件包并记录状态以决定是否卸载 - install_package() { - local package=$1 - if ! check_package_installed "$package"; then - LOG_INFO "开始安装软件包 $package" - dnf install -y "$package" - CHECK_RESULT $? 0 0 "安装软件包 $package 失败" - LOG_INFO "软件包 $package 安装成功" - # 标记为需要卸载 - echo "$package" >> /tmp/installed_packages.txt - fi - } - - # 卸载临时安装的软件包(如果之前未安装) - uninstall_temp_packages() { - if [ -f /tmp/installed_packages.txt ]; then - while read -r package; do - LOG_INFO "开始卸载临时安装的软件包 $package" - dnf remove -y "$package" - CHECK_RESULT $? 0 0 "卸载软件包 $package 失败" - LOG_INFO "软件包 $package 卸载成功" - done < /tmp/installed_packages.txt - rm -f /tmp/installed_packages.txt - fi - } - - # 测试帮助命令的参数支持情况 - test_help_with_args() { - local command=$1 - local arg=$2 - - # Step1: Check if the command exists - LOG_INFO "Step1: Check if the command $command exists" - if ! command -v "$command" &>/dev/null; then - LOG_ERROR "Command $command not found" - exit 255 - fi - - # Step2: Test help argument support for the command - LOG_INFO "Step2: Test help argument "$arg" for command "$command"" - output=$("$command" "$arg" 2>&1) - - # Check if the argument is supported by checking output or exit code - if [[ "$output" == *"not supported"* ]] || [[ "$output" == *"invalid"* ]]; then - LOG_ERROR "Argument "$arg" is not supported by "$command"" - exit 255 - elif [ $? -ne 0 ]; then - LOG_ERROR "Failed to execute "$command $arg"" - exit 255 - else - LOG_INFO "Command "$command $arg" executed successfully." - fi - } - - ######################## Main Script ######################## - - LOG_INFO "开始执行测试脚本:Test help with arguments" - - # Define test parameters (adjust as needed) - TEST_COMMAND="dnf" # Replace with your target command (e.g., rpm,yum) - TEST_ARG="--help" # Replace with your test argument (e.g., --version,-h) - - # Step3: Ensure environment is clean (no temporary packages) - LOG_INFO "Step3: Clean up temporary files from previous runs (if any)" - rm -f /tmp/installed_packages.txt - - # Step4: Check if TEST_COMMAND is installed or install it temporarily - LOG_INFO \ - \ - \ - \ - \ - \ - \ -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_basic.sh b/testcases/function_test/pkg_test/python-logutils/help/test_help_function_basic.sh deleted file mode 100644 index a8075005eab..00000000000 --- a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_basic.sh +++ /dev/null @@ -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 basic help functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试基本帮助功能" - - # 检查软件包是否已安装 - LOG_INFO "检查测试所需的软件包是否已安装" - if ! dnf list installed &>/dev/null; then - LOG_ERROR "无法获取已安装软件包列表" - exit 255 - fi - - # 定义需要测试的软件包 - PACKAGE="example-package" - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否存在${PACKAGE}软件包" - if ! dnf list available "${PACKAGE}" &>/dev/null; then - LOG_ERROR "yum源中不存在${PACKAGE}软件包" - exit 255 - fi - - # 判断软件包是否已安装,未安装则安装 - if ! dnf list installed "${PACKAGE}" &>/dev/null; then - LOG_INFO "安装${PACKAGE}软件包" - dnf install -y "${PACKAGE}" - CHECK_RESULT $? 0 0 "安装${PACKAGE}失败" - INSTALLED=1 - else - LOG_INFO "${PACKAGE}软件包已安装" - INSTALLED=0 - fi - - # 测试帮助命令功能 - LOG_INFO "测试${PACKAGE}的帮助命令功能" - if ! command -v "${PACKAGE}" &>/dev/null; then - LOG_ERROR "${PACKAGE}命令不存在" - exit 255 - fi - - "${PACKAGE}" --help &>/dev/null - CHECK_RESULT $? 0 0 "${PACKAGE}帮助命令执行失败" - - # 清理环境:如果脚本安装了软件包,则卸载 - if [ "${INSTALLED}" -eq 1 ]; then - LOG_INFO "卸载${PACKAGE}软件包" - dnf remove -y "${PACKAGE}" - CHECK_RESULT $? 0 0 "卸载${PACKAGE}失败" - fi - - LOG_INFO "基本帮助功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_error.sh b/testcases/function_test/pkg_test/python-logutils/help/test_help_function_error.sh deleted file mode 100644 index b78d718d647..00000000000 --- a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_error.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-11 -# @License : Mulan PSL v2 -# @Desc : Test help error handling -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试帮助功能错误处理" - - # 检查是否已安装指定软件包 - check_package_installed() { - local package=$1 - if ! dnf list installed "$package" &>/dev/null; then - LOG_INFO "软件包 $package 未安装,将进行安装" - return 1 - else - LOG_INFO "软件包 $package 已安装" - return 0 - fi - } - - # 检查YUM源中是否存在软件包 - check_package_in_repo() { - local package=$1 - if ! dnf list available "$package" &>/dev/null; then - LOG_ERROR "YUM源中不存在软件包 $package" - exit 255 - fi - } - - # 安装软件包 - install_package() { - local package=$1 - check_package_in_repo "$package" - dnf install -y "$package" - CHECK_RESULT $? 0 0 "安装软件包 $package 失败" - } - - # 卸载软件包 - uninstall_package() { - local package=$1 - dnf remove -y "$package" - CHECK_RESULT $? 0 0 "卸载软件包 $package 失败" - } - - # 测试帮助功能错误处理 - test_help_function_error() { - local package="test-package" - local command="test-command" - - # 检查环境是否已安装 - if check_package_installed "$package"; then - LOG_INFO "环境已安装,测试完成后将保持安装状态" - keep_installed=true - else - LOG_INFO "环境未安装,测试完成后将卸载软件包" - keep_installed=false - install_package "$package" - fi - - # 测试命令参数不存在或不支持 - LOG_INFO "测试命令参数不存在或不支持的情况" - $command --invalid-arg &>/dev/null - if [ $? -eq 255 ]; then - LOG_ERROR "命令参数不存在或不支持,退出码为255" >&2 - exit 255 - else - CHECK_RESULT $? 0 0 "命令参数存在但执行失败" - fi - - # SSH到第二个节点执行命令(示例) - LOG_INFO "在第二个节点上执行命令 ls" - SSH_CMD ls $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - - #清理环境(如果之前未安装) - if [ "$keep_installed" = false ]; then - uninstall_package "$package" - fi - - LOG_INFO "测试帮助功能错误处理完成" - } - - test_help_function_error - - exit 0 - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_flags.sh b/testcases/function_test/pkg_test/python-logutils/help/test_help_function_flags.sh deleted file mode 100644 index ca51aea9867..00000000000 --- a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_flags.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-11 -# @License : Mulan PSL v2 -# @Desc : Test help with flags -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试脚本:test_help_function_flags - - # 步骤1:检查是否已安装指定软件包 - LOG_INFO "检查是否已安装指定软件包" - package_name="example_package" # 替换为实际需要测试的软件包名 - if ! dnf list installed "$package_name" &>/dev/null; then - LOG_INFO "软件包未安装,准备安装" - installed_flag=1 - else - LOG_INFO "软件包已安装" - installed_flag=0 - fi - - # 步骤2:检查yum源中是否存在该软件包 - LOG_INFO "检查yum源中是否存在该软件包" - if ! dnf list available "$package_name" &>/dev/null; then - LOG_ERROR "yum源中不存在该软件包" - exit 255 - fi - - # 步骤3:安装软件包(如果未安装) - if [ "$installed_flag" -eq 1 ]; then - LOG_INFO "开始安装软件包" - dnf install -y "$package_name" - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4:测试命令的帮助标志 - LOG_INFO "测试命令的帮助标志" - command_to_test="example_command" # 替换为实际需要测试的命令 - if ! command -v "$command_to_test" &>/dev/null; then - LOG_ERROR "命令不存在" - exit 255 - fi - - # 检查命令是否支持--help参数 - LOG_INFO "检查命令是否支持--help参数" - if ! "$command_to_test" --help &>/dev/null; then - LOG_ERROR "命令不支持--help参数" - exit 255 - fi - CHECK_RESULT $? 0 0 "命令帮助标志测试失败" - - # 步骤5:清理环境(如果之前未安装) - if [ "$installed_flag" -eq 1 ]; then - LOG_INFO "卸载软件包" - dnf remove -y "$package_name" - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_output.sh b/testcases/function_test/pkg_test/python-logutils/help/test_help_function_output.sh deleted file mode 100644 index 5cf6b8930e4..00000000000 --- a/testcases/function_test/pkg_test/python-logutils/help/test_help_function_output.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-11 -# @License : Mulan PSL v2 -# @Desc : Test help output format -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 测试脚本:test_help_function_output - # 测试用例描述:Test help output format - - LOG_INFO "开始测试帮助输出格式" - - # 检查软件包是否已安装 - LOG_INFO "检查软件包是否已安装" - if ! dnf list installed | grep -q "example-package"; then - LOG_INFO "软件包未安装,准备安装" - # 检查yum源中是否有该软件包 - if ! dnf list available | grep -q "example-package"; then - LOG_ERROR "yum源中未找到软件包example-package" - exit 255 - fi - # 安装软件包 - dnf install -y example-package - CHECK_RESULT $? 0 0 "安装软件包失败" - else - LOG_INFO "软件包已安装,跳过安装步骤" - fi - - # 测试帮助输出格式 - LOG_INFO "测试帮助输出格式" - output=$(example-command --help 2>&1) - CHECK_RESULT $? 0 0 "执行命令失败" - - # 检查帮助输出是否符合预期 - if echo "$output" | grep -q "Usage:"; then - LOG_INFO "帮助输出格式正确" - else - LOG_ERROR "帮助输出格式不正确" - exit 1 - fi - - # 清理环境(如果脚本开始时未安装软件包) - if ! dnf list installed | grep -q "example-package" && [ "$initial_install" = false ]; then - LOG_INFO "卸载临时安装的软件包" - dnf remove -y example-package - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/qt6-qtserialport/qt6-qtserialport-devel/test_qt6-qtserialport-devel_function_serialport.sh b/testcases/function_test/pkg_test/qt6-qtserialport/qt6-qtserialport-devel/test_qt6-qtserialport-devel_function_serialport.sh deleted file mode 100644 index 0f91df5e949..00000000000 --- a/testcases/function_test/pkg_test/qt6-qtserialport/qt6-qtserialport-devel/test_qt6-qtserialport-devel_function_serialport.sh +++ /dev/null @@ -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-07 -# @License : Mulan PSL v2 -# @Desc : Test serial port basic functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查qt6-qtserialport-devel软件包是否已安装 - if ! rpm -q qt6-qtserialport-devel &>/dev/null; then - LOG_INFO "qt6-qtserialport-devel未安装,开始安装..." - # 检查yum源中是否存在该软件包 - if ! dnf list available qt6-qtserialport-devel &>/dev/null; then - LOG_ERROR "yum源中未找到qt6-qtserialport-devel软件包" - exit 255 - fi - # 安装软件包 - dnf install -y qt6-qtserialport-devel - CHECK_RESULT $? 0 0 "安装qt6-qtserialport-devel失败" - else - LOG_INFO "qt6-qtserialport-devel已安装,跳过安装步骤" - fi - - # 测试串口基本功能 - LOG_INFO "开始测试串口基本功能..." - # 模拟串口测试命令 - serial_test_cmd="qt-serialport-test" - if ! command -v $serial_test_cmd &>/dev/null; then - LOG_ERROR "命令$serial_test_cmd不存在或不支持" - exit 255 - fi - - # 执行串口测试命令 - $serial_test_cmd - CHECK_RESULT $? 0 0 "串口基本功能测试失败" - - # 环境恢复:如果脚本开始时未安装qt6-qtserialport-devel,则卸载 - if ! rpm -q qt6-qtserialport-devel &>/dev/null; then - LOG_INFO "脚本开始时未安装qt6-qtserialport-devel,开始卸载..." - dnf remove -y qt6-qtserialport-devel - CHECK_RESULT $? 0 0 "卸载qt6-qtserialport-devel失败" - else - LOG_INFO "脚本开始时已安装qt6-qtserialport-devel,保持安装状态" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-filesystem/texlive-collection-music/test_texlive-collection-music_function_basic.sh b/testcases/function_test/pkg_test/texlive-filesystem/texlive-collection-music/test_texlive-collection-music_function_basic.sh deleted file mode 100644 index dfb298ea46a..00000000000 --- a/testcases/function_test/pkg_test/texlive-filesystem/texlive-collection-music/test_texlive-collection-music_function_basic.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-27 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality of texlive-collection-music -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试 texlive-collection-music 的基本功能" - - # 检查 yum 源中是否存在 texlive-collection-music 软件包 - LOG_INFO "检查 yum 源中是否存在 texlive-collection-music 软件包" - dnf list available texlive-collection-music &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中未找到 texlive-collection-music 软件包" - exit 255 - fi - - # 检查是否已安装 texlive-collection-music - LOG_INFO "检查是否已安装 texlive-collection-music" - rpm -q texlive-collection-music &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "texlive-collection-music 已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-collection-music 未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 若未安装则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装 texlive-collection-music" - dnf install -y texlive-collection-music - CHECK_RESULT $? 0 0 "安装 texlive-collection-music 失败" - fi - - # 测试 texlive-collection-music 的基本功能 - LOG_INFO "测试 texlive-collection-music 的基本功能" - - # TODO: 添加具体的功能测试步骤,例如执行某些命令并验证结果 - - # 清理环境:若测试前未安装则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载 texlive-collection-music" - dnf remove -y texlive-collection-music - CHECK_RESULT $? 0 0 "卸载 texlive-collection-music 失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-a/texlive-12many-doc/test_texlive-12many-doc_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-a/texlive-12many-doc/test_texlive-12many-doc_function_basic.sh deleted file mode 100644 index e7aa2d66450..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-a/texlive-12many-doc/test_texlive-12many-doc_function_basic.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-09-29 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试:Test basic functionality" - - # 检查是否已安装texlive-12many-doc - LOG_INFO "检查是否已安装texlive-12many-doc" - dnf list installed texlive-12many-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-12many-doc已安装,测试结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-12many-doc未安装,测试结束后将卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-12many-doc - LOG_INFO "检查yum源中是否有texlive-12many-doc" - dnf list available texlive-12many-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-12many-doc软件包" - - # 安装texlive-12many-doc - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装texlive-12many-doc" - dnf install -y texlive-12many-doc - CHECK_RESULT $? 0 1 "安装texlive-12many-doc失败" - fi - - # 测试基本功能 - LOG_INFO "测试基本功能" - command_to_test --param > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "指定的参数不存在或不支持" - - # 清理环境(如果之前未安装) - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-12many-doc" - dnf remove -y texlive-12many-doc - CHECK_RESULT $? 0 1 "卸载texlive-12many-doc失败" - fi - - LOG_INFO "测试完成:Test basic functionality" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace/test_texlive-mathpunctspace_function_check.sh b/testcases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace/test_texlive-mathpunctspace_function_check.sh deleted file mode 100644 index 16d8cef422e..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace/test_texlive-mathpunctspace_function_check.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-04 -# @License : Mulan PSL v2 -# @Desc : Check package availability -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:检查软件包可用性" - - # 检查是否已安装texlive-mathpunctspace - if rpm -q texlive-mathpunctspace &>/dev/null; then - LOG_INFO "检测到texlive-mathpunctspace已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "检测到texlive-mathpunctspace未安装,将在测试过程中安装并最终卸载" - already_installed=false - fi - - # 检查yum源中是否有texlive-mathpunctspace包 - LOG_INFO "步骤1:检查yum源中是否存在texlive-mathpunctspace软件包" - if ! dnf list available texlive-mathpunctspace &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-mathpunctspace软件包" - exit 255 - fi - LOG_INFO "yum源中存在texlive-mathpunctspace软件包" - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤2:安装texlive-mathpunctspace软件包" - dnf install -y texlive-mathpunctspace - CHECK_RESULT $? 0 0 "安装texlive-mathpunctspace失败" - LOG_INFO "texlive-mathpunctspace安装成功" - fi - - # 检查软件包是否安装成功 - LOG_INFO "步骤3:验证texlive-mathpunctspace是否安装成功" - rpm -q texlive-mathpunctspace - CHECK_RESULT $? 0 0 "验证texlive-mathpunctspace安装状态失败" - - # 执行测试命令(示例:检查包提供的文件) - LOG_INFO "步骤4:检查texlive-mathpunctspace提供的文件" - rpm -ql texlive-mathpunctspace | head -5 - CHECK_RESULT $? 0 0 "获取texlive-mathpunctspace文件列表失败" - - LOG_INFO "步骤5:测试命令执行完成" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤6:卸载测试安装的texlive-mathpunctspace软件包" - dnf remove -y texlive-mathpunctspace - CHECK_RESULT $? 0 0 "卸载texlive-mathpunctspace失败" - LOG_INFO "texlive-mathpunctspace卸载成功" - else - LOG_INFO "步骤6:测试前已安装texlive-mathpunctspace,保持安装状态" - fi - - LOG_INFO "测试完成:软件包可用性检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace/test_texlive-mathpunctspace_function_usage.sh b/testcases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace/test_texlive-mathpunctspace_function_usage.sh deleted file mode 100644 index 3e7221eff29..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-o/texlive-mathpunctspace/test_texlive-mathpunctspace_function_usage.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-04 -# @License : Mulan PSL v2 -# @Desc : Test basic package usage -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装texlive-mathpunctspace软件包 - LOG_INFO "检查texlive-mathpunctspace软件包是否已安装" - rpm -q texlive-mathpunctspace > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-mathpunctspace已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE="yes" - else - LOG_INFO "texlive-mathpunctspace未安装,将在测试步骤中安装" - INSTALLED_BEFORE="no" - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有texlive-mathpunctspace软件包" - dnf list available texlive-mathpunctspace > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有texlive-mathpunctspace软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "安装texlive-mathpunctspace软件包" - dnf install -y texlive-mathpunctspace - CHECK_RESULT $? 0 0 "安装texlive-mathpunctspace失败" - fi - - # 测试基本包使用 - LOG_INFO "测试texlive-mathpunctspace基本包使用" - # 假设texlive-mathpunctspace提供了一个命令行工具mathpunctspace,测试其基本用法 - # 检查命令是否存在 - command -v mathpunctspace > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "mathpunctspace命令不存在" - exit 255 - fi - - # 测试不带参数执行命令,预期失败 - LOG_INFO "测试不带参数执行mathpunctspace命令" - mathpunctspace 2>&1 | grep -q "usage" - CHECK_RESULT $? 0 0 "不带参数执行mathpunctspace命令未显示用法信息" - - # 测试带--help参数 - LOG_INFO "测试带--help参数执行mathpunctspace命令" - mathpunctspace --help 2>&1 | grep -q "usage" - CHECK_RESULT $? 0 0 "带--help参数执行mathpunctspace命令未显示用法信息" - - # 测试带无效参数 - LOG_INFO "测试带无效参数执行mathpunctspace命令" - mathpunctspace --invalid-param 2>&1 | grep -q "unrecognized option" - if [ $? -ne 0 ]; then - LOG_ERROR "无效参数未被正确识别" - exit 255 - fi - - # 测试正常功能 - LOG_INFO "测试mathpunctspace命令正常功能" - # 假设mathpunctspace命令接受一个输入文件并处理 - # 创建一个测试文件 - cat > test_input.tex << "EOF" - \documentclass{article} - \begin{document} - Hello, world! - \end{document} - EOF - - mathpunctspace test_input.tex > test_output.tex 2>&1 - CHECK_RESULT $? 0 0 "mathpunctspace命令处理测试文件失败" - - # 清理测试文件 - rm -f test_input.tex test_output.tex - - # 如果测试前未安装,则在测试结束后卸载软件包 - if [ "$INSTALLED_BEFORE" = "no" ]; then - LOG_INFO "卸载texlive-mathpunctspace软件包" - dnf remove -y texlive-mathpunctspace - CHECK_RESULT $? 0 0 "卸载texlive-mathpunctspace失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_check_files.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_check_files.sh deleted file mode 100644 index 834a5ffdb35..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_check_files.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-22 -# @License : Mulan PSL v2 -# @Desc : Check if documentation files exist -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "检查文档文件是否存在测试开始" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查texlive-sf298-doc软件包是否在yum源中" - dnf list available texlive-sf298-doc &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包texlive-sf298-doc不在yum源中" - exit 255 - fi - - # 步骤2:检查环境是否已安装软件包 - LOG_INFO "步骤2:检查环境是否已安装texlive-sf298-doc软件包" - INSTALLED=0 - rpm -q texlive-sf298-doc &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "软件包未安装,将在测试步骤中安装" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-sf298-doc软件包" - dnf install -y texlive-sf298-doc - CHECK_RESULT $? 0 0 "安装texlive-sf298-doc失败" - fi - - # 步骤4:检查文档文件是否存在 - LOG_INFO "步骤4:检查texlive-sf298-doc的文档文件是否存在" - FILES_EXIST=1 - # 假设文档文件在/usr/share/doc/texlive-sf298-doc/目录下 - DOC_DIR="/usr/share/doc/texlive-sf298-doc/" - if [ -d "$DOC_DIR" ]; then - LOG_INFO "文档目录存在: $DOC_DIR" - # 检查目录下是否有文件 - if [ -n "$(ls -A $DOC_DIR 2>/dev/null)" ]; then - LOG_INFO "文档目录非空,包含文件" - else - LOG_ERROR "文档目录为空" - FILES_EXIST=0 - fi - else - LOG_ERROR "文档目录不存在: $DOC_DIR" - FILES_EXIST=0 - fi - - # 步骤5:验证检查结果 - LOG_INFO "步骤5:验证文档文件检查结果" - if [ $FILES_EXIST -eq 1 ]; then - LOG_INFO "文档文件存在检查通过" - else - LOG_ERROR "文档文件存在检查失败" - exit 1 - fi - - # 步骤6:环境清理 - LOG_INFO "步骤6:清理测试环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的texlive-sf298-doc软件包" - dnf remove -y texlive-sf298-doc - CHECK_RESULT $? 0 0 "卸载texlive-sf298-doc失败" - else - LOG_INFO "环境已安装软件包,保持安装状态" - fi - - LOG_INFO "检查文档文件是否存在测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_install.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_install.sh deleted file mode 100644 index 50ff3607327..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_install.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-10-02 -# @License : Mulan PSL v2 -# @Desc : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-sf298-doc软件包 - LOG_INFO "检查texlive-sf298-doc是否已安装" - rpm -q texlive-sf298-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-sf298-doc已安装,脚本结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-sf298-doc未安装,脚本结束后将卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-sf298-doc软件包 - LOG_INFO "检查yum源中是否有texlive-sf298-doc软件包" - dnf list available texlive-sf298-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-sf298-doc软件包" - - # 安装texlive-sf298-doc软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装texlive-sf298-doc软件包" - dnf install -y texlive-sf298-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-sf298-doc软件包失败" - fi - - # 验证安装是否成功 - LOG_INFO "验证texlive-sf298-doc软件包是否成功安装" - rpm -q texlive-sf298-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证texlive-sf298-doc软件包安装失败" - - # 执行测试命令(示例命令) - LOG_INFO "执行测试命令" - some_test_command > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "测试命令执行失败" - - # 清理环境(如果脚本开始时未安装,则卸载) - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-sf298-doc软件包" - dnf remove -y texlive-sf298-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-sf298-doc软件包失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_latex_compile.sh b/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_latex_compile.sh deleted file mode 100644 index eacd60a5e41..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-u/texlive-sf298-doc/test_texlive-sf298-doc_function_latex_compile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-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-22 -# @License : Mulan PSL v2 -# @Desc : Test compiling a sample SF298 form -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-sf298-doc - LOG_INFO "检查是否已安装texlive-sf298-doc" - rpm -q texlive-sf298-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-sf298-doc已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-sf298-doc未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-sf298-doc软件包 - LOG_INFO "检查yum源中是否有texlive-sf298-doc软件包" - dnf list available texlive-sf298-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到texlive-sf298-doc软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-sf298-doc软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-sf298-doc - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装texlive-sf298-doc" - dnf install -y texlive-sf298-doc - CHECK_RESULT $? 0 0 "安装texlive-sf298-doc失败" - fi - - # 检查latex命令是否可用 - LOG_INFO "检查latex命令是否可用" - which latex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "latex命令未找到,请确保已安装texlive" - - # 查找SF298示例文件 - LOG_INFO "查找SF298示例文件" - SAMPLE_FILE=$(find /usr/share/texlive/texmf-dist/ -name "sf298.pdf" -o -name "sf298.tex" 2>/dev/null | head -1) - if [ -z "$SAMPLE_FILE" ]; then - LOG_ERROR "未找到SF298示例文件" - if [ $INSTALLED -eq 0 ]; then - dnf remove -y texlive-sf298-doc - fi - exit 1 - fi - - # 如果是PDF文件,查找对应的TeX源文件 - if [[ "$SAMPLE_FILE" == *.pdf ]]; then - SAMPLE_FILE="${SAMPLE_FILE%.pdf}.tex" - fi - - # 检查找到的文件是否为TeX文件 - if [[ "$SAMPLE_FILE" != *.tex ]] || [ ! -f "$SAMPLE_FILE" ]; then - LOG_ERROR "找到的SF298文件不是有效的TeX源文件: $SAMPLE_FILE" - if [ $INSTALLED -eq 0 ]; then - dnf remove -y texlive-sf298-doc - fi - exit 1 - fi - - LOG_INFO "找到SF298示例文件: $SAMPLE_FILE" - - # 复制示例文件到临时目录 - LOG_INFO "复制示例文件到临时工作目录" - WORK_DIR=$(mktemp -d) - cp "$SAMPLE_FILE" "$WORK_DIR/sf298.tex" - cd "$WORK_DIR" - - # 编译SF298示例文件 - LOG_INFO "编译SF298示例文件" - latex sf298.tex - CHECK_RESULT $? 0 0 "第一次latex编译失败" - - # 如果需要,进行第二次编译(某些文档需要多次编译) - LOG_INFO "第二次编译SF298示例文件(如需要)" - latex sf298.tex - CHECK_RESULT $? 0 0 "第二次latex编译失败" - - # 检查是否生成了DVI文件 - LOG_INFO "检查是否成功生成DVI文件" - if [ -f "sf298.dvi" ]; then - LOG_INFO "成功生成sf298.dvi文件" - # 将DVI转换为PDF以便查看 - LOG_INFO "将DVI文件转换为PDF" - dvipdfmx sf298.dvi - CHECK_RESULT $? 0 0 "DVI转PDF失败" - - if [ -f "sf298.pdf" ]; then - LOG_INFO "成功生成sf298.pdf文件" - # 检查PDF文件是否有效 - file sf298.pdf | grep -q "PDF document" - CHECK_RESULT $? 0 0 "生成的PDF文件无效" - fi - else - LOG_ERROR "未生成sf298.dvi文件" - # 检查是否直接生成了PDF - if [ -f "sf298.pdf" ]; then - LOG_INFO "直接生成了sf298.pdf文件" - file sf298.pdf | grep -q "PDF document" - CHECK_RESULT $? 0 0 "生成的PDF文件无效" - else - LOG_ERROR "未生成任何输出文件" - CHECK_RESULT 1 0 0 "LaTeX编译未生成输出文件" - fi - fi - - # 清理临时文件 - LOG_INFO "清理临时文件" - cd / - rm -rf "$WORK_DIR" - - # 如果测试开始时未安装,则在测试结束后卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-sf298-doc" - dnf remove -y texlive-sf298-doc - CHECK_RESULT $? 0 0 "卸载texlive-sf298-doc失败" - fi - - LOG_INFO "SF298表单编译测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-showdim-doc/test_texlive-showdim-doc_function_dim.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-showdim-doc/test_texlive-showdim-doc_function_dim.sh deleted file mode 100644 index 8c02d128551..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-showdim-doc/test_texlive-showdim-doc_function_dim.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test dimension calculation functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装texlive-showdim-doc - LOG_INFO "检查是否已经安装texlive-showdim-doc" - if dnf list installed texlive-showdim-doc &>/dev/null; then - LOG_INFO "texlive-showdim-doc已安装" - INSTALLED=true - else - LOG_INFO "texlive-showdim-doc未安装" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-showdim-doc软件包 - LOG_INFO "检查yum源中是否有texlive-showdim-doc软件包" - if ! dnf list available texlive-showdim-doc &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-showdim-doc软件包" - exit 255 - fi - - # 如果未安装,则安装texlive-showdim-doc - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-showdim-doc" - dnf install -y texlive-showdim-doc - CHECK_RESULT $? 0 0 "安装texlive-showdim-doc失败" - fi - - # 测试维度计算功能 - LOG_INFO "测试维度计算功能" - texdoc --list texlive-showdim-doc - CHECK_RESULT $? 0 0 "维度计算功能测试失败" - - # 清理环境:如果脚本开始时未安装,则卸载texlive-showdim-doc - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-showdim-doc" - dnf remove -y texlive-showdim-doc - CHECK_RESULT $? 0 0 "卸载texlive-showdim-doc失败" - fi -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc/test_texlive-struktex-doc_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc/test_texlive-struktex-doc_function_basic.sh deleted file mode 100644 index ee09249a18a..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc/test_texlive-struktex-doc_function_basic.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-10-03 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装texlive-struktex-doc - LOG_INFO "检查是否已安装texlive-struktex-doc" - rpm -q texlive-struktex-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-struktex-doc已安装,测试结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-struktex-doc未安装,测试结束后将卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-struktex-doc - LOG_INFO "检查yum源中是否有texlive-struktex-doc" - dnf list available texlive-struktex-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中无texlive-struktex-doc软件包" - - # 安装texlive-struktex-doc - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装texlive-struktex-doc" - dnf install -y texlive-struktex-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装失败" - fi - - # 测试基本功能 - LOG_INFO "测试基本功能" - command_to_test --help > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "不支持指定参数或参数不存在" - - # 清理环境(如果最初未安装) - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载texlive-struktex-doc" - dnf remove -y texlive-struktex-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc/test_texlive-struktex-doc_function_install.sh b/testcases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc/test_texlive-struktex-doc_function_install.sh deleted file mode 100644 index ff0f49f344c..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-v/texlive-struktex-doc/test_texlive-struktex-doc_function_install.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-10-03 -# @License : Mulan PSL v2 -# @Desc : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试包安装功能:Test package installation" - - # 检查是否已安装texlive-struktex-doc - LOG_INFO "检查是否已安装texlive-struktex-doc" - dnf list installed texlive-struktex-doc > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-struktex-doc已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-struktex-doc未安装,将在测试后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-struktex-doc - LOG_INFO "检查yum源中是否有texlive-struktex-doc" - dnf list available texlive-struktex-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在texlive-struktex-doc包" - - # 安装texlive-struktex-doc - LOG_INFO "安装texlive-struktex-doc" - dnf install -y texlive-struktex-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-struktex-doc失败" - - # 验证安装是否成功 - LOG_INFO "验证texlive-struktex-doc是否安装成功" - dnf list installed texlive-struktex-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "验证安装失败" - - # 如果之前未安装,则卸载texlive-struktex-doc - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载之前未安装的包:清理环境" - dnf remove -y texlive-struktex-doc > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_basic.sh deleted file mode 100644 index efb350f0739..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_basic.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test basic functionality of texlive-hitszbeamer -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-hitszbeamer - LOG_INFO "检查是否已安装texlive-hitszbeamer" - rpm -q texlive-hitszbeamer > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-hitszbeamer已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-hitszbeamer未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-hitszbeamer - LOG_INFO "检查yum源中是否有texlive-hitszbeamer" - dnf list available texlive-hitszbeamer > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-hitszbeamer软件包" - exit 255 - fi - - # 安装texlive-hitszbeamer - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装texlive-hitszbeamer" - dnf install -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "安装texlive-hitszbeamer失败" - fi - - # 测试texlive-hitszbeamer基本功能 - LOG_INFO "测试texlive-hitszbeamer基本功能" - texlive-hitszbeamer --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-hitszbeamer基本功能测试失败" - - # 测试texlive-hitszbeamer不支持参数 - LOG_INFO "测试texlive-hitszbeamer不支持参数" - texlive-hitszbeamer --invalid-arg > /dev/null 2>&1 - if [ $? -ne 255 ]; then - LOG_ERROR "texlive-hitszbeamer未正确处理不支持参数" - exit 255 - fi - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-hitszbeamer" - dnf remove -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "卸载texlive-hitszbeamer失败" - fi - - LOG_INFO "测试脚本执行完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_basic_compile.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_basic_compile.sh deleted file mode 100644 index cce17d3407d..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_basic_compile.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : Test basic compilation with hitszbeamer document class -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义颜色输出函数(可选,但通常测试框架会提供) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义软件包名称 - PACKAGE_NAME="texlive-hitszbeamer" - - # 步骤1: 检查yum源中是否存在texlive-hitszbeamer软件包 - LOG_INFO "步骤1: 检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available "${PACKAGE_NAME}" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - - # 步骤2: 检查系统是否已安装texlive-hitszbeamer - LOG_INFO "步骤2: 检查系统是否已安装${PACKAGE_NAME}" - if rpm -q "${PACKAGE_NAME}" &>/dev/null; then - LOG_INFO "${PACKAGE_NAME}已安装,脚本结束后将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "${PACKAGE_NAME}未安装,将在测试过程中安装" - ALREADY_INSTALLED=0 - fi - - # 步骤3: 安装texlive-hitszbeamer(如果未安装) - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤3: 安装${PACKAGE_NAME}" - dnf install -y "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - fi - - # 步骤4: 创建测试用的LaTeX文档 - LOG_INFO "步骤4: 创建测试用的LaTeX文档" - TEST_DIR="/tmp/test_texlive_hitszbeamer_$(date +%s)" - mkdir -p "${TEST_DIR}" - cd "${TEST_DIR}" || exit 1 - - cat > test.tex << "EOF" - \documentclass{hitszbeamer} - \begin{document} - \begin{frame} - \frametitle{测试标题} - 这是一个测试文档。 - \end{frame} - \end{document} - EOF - - # 步骤5: 使用pdflatex编译LaTeX文档 - LOG_INFO "步骤5: 使用pdflatex编译LaTeX文档" - pdflatex -interaction=nonstopmode test.tex - CHECK_RESULT $? 0 0 "pdflatex编译失败" - - # 步骤6: 检查生成的PDF文件 - LOG_INFO "步骤6: 检查生成的PDF文件" - if [ -f test.pdf ]; then - LOG_INFO "PDF文件生成成功" - else - LOG_ERROR "PDF文件未生成" - exit 1 - fi - - # 步骤7: 清理测试目录 - LOG_INFO "步骤7: 清理测试目录" - cd /tmp && rm -rf "${TEST_DIR}" - - # 步骤8: 卸载texlive-hitszbeamer(如果测试前未安装) - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤8: 卸载${PACKAGE_NAME}" - dnf remove -y "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - else - LOG_INFO "步骤8: 保持${PACKAGE_NAME}安装状态,不进行卸载" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_check_installed.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_check_installed.sh deleted file mode 100644 index 8f25e1f9a84..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_check_installed.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : Check if texlive-hitszbeamer is installed -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - PACKAGE_NAME="texlive-hitszbeamer" - LOG_INFO "开始测试:检查${PACKAGE_NAME}是否安装" - LOG_INFO "步骤1:检查yum源中是否存在${PACKAGE_NAME}软件包" - dnf list available "${PACKAGE_NAME}" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - LOG_INFO "步骤2:检查当前环境是否已安装${PACKAGE_NAME}" - dnf list installed "${PACKAGE_NAME}" > /dev/null 2>&1 - IS_INSTALLED=$? - if [ ${IS_INSTALLED} -eq 0 ]; then - LOG_INFO "当前环境已安装${PACKAGE_NAME}" - INSTALLED_BEFORE_TEST=1 - else - LOG_INFO "当前环境未安装${PACKAGE_NAME}" - INSTALLED_BEFORE_TEST=0 - fi - if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then - LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包" - dnf install -y "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - LOG_INFO "安装${PACKAGE_NAME}成功" - fi - LOG_INFO "步骤4:验证${PACKAGE_NAME}功能" - rpm -qi "${PACKAGE_NAME}" > /dev/null - CHECK_RESULT $? 0 0 "查询${PACKAGE_NAME}软件包信息失败" - LOG_INFO "查询${PACKAGE_NAME}软件包信息成功" - LOG_INFO "步骤5:清理测试环境" - if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then - LOG_INFO "卸载测试安装的${PACKAGE_NAME}软件包" - dnf remove -y "${PACKAGE_NAME}" - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - LOG_INFO "卸载${PACKAGE_NAME}成功" - else - LOG_INFO "测试前已安装${PACKAGE_NAME},保持安装状态" - fi - LOG_INFO "测试完成:${PACKAGE_NAME}安装检查通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_install.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_install.sh deleted file mode 100644 index 2e035f38490..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_install.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : Test installation of texlive-hitszbeamer package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装 texlive-hitszbeamer 软件包 - LOG_INFO "检查是否已安装 texlive-hitszbeamer 软件包" - dnf list installed texlive-hitszbeamer > /dev/null 2>&1 - installed=$? - - # 判断 yum 源中是否有 texlive-hitszbeamer 软件包 - LOG_INFO "检查 yum 源中是否有 texlive-hitszbeamer 软件包" - dnf list available texlive-hitszbeamer > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum 源中不存在 texlive-hitszbeamer 软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum 源中不存在 texlive-hitszbeamer 软件包" - exit 255 - fi - - # 如果未安装,则执行安装 - if [ $installed -ne 0 ]; then - LOG_INFO "未检测到 texlive-hitszbeamer 软件包,开始安装" - dnf install -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "安装 texlive-hitszbeamer 软件包失败" - LOG_INFO "texlive-hitszbeamer 软件包安装成功" - # 标记为需要清理 - need_cleanup=1 - else - LOG_INFO "texlive-hitszbeamer 软件包已安装,跳过安装步骤" - need_cleanup=0 - fi - - # 测试安装后的功能 - LOG_INFO "测试 texlive-hitszbeamer 软件包功能" - # 这里可以添加具体的功能测试命令,例如检查某个文件是否存在或执行某个命令 - # 示例:检查是否安装了特定的 LaTeX 宏包文件 - if [ -f /usr/share/texlive/texmf-dist/tex/latex/hitszbeamer/hitszbeamer.cls ]; then - LOG_INFO "检测到 hitszbeamer.cls 文件,功能正常" - else - LOG_ERROR "未找到 hitszbeamer.cls 文件,功能异常" - exit 1 - fi - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "清理环境:卸载 texlive-hitszbeamer 软件包" - dnf remove -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "卸载 texlive-hitszbeamer 软件包失败" - LOG_INFO "texlive-hitszbeamer 软件包卸载成功" - else - LOG_INFO "保持 texlive-hitszbeamer 软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_logo_usage.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_logo_usage.sh deleted file mode 100644 index 504525bcf80..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_logo_usage.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : Test logo inclusion functionality in hitszbeamer -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试用例:Test logo inclusion functionality in hitszbeamer" - LOG_INFO "步骤1:检查texlive-hitszbeamer软件包是否已在yum源中" - dnf list available texlive-hitszbeamer &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "texlive-hitszbeamer软件包在yum源中不存在" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装texlive-hitszbeamer" - rpm -q texlive-hitszbeamer &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "texlive-hitszbeamer已安装,脚本结束将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-hitszbeamer未安装,将进行安装" - INSTALLED=0 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-hitszbeamer软件包" - dnf install -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "安装texlive-hitszbeamer失败" - fi - - LOG_INFO "步骤4:测试logo包含功能,检查是否支持logo参数" - pdflatex --help | grep -q "\-\-logo" - if [ $? -ne 0 ]; then - LOG_ERROR "pdflatex命令不支持logo参数" - exit 255 - fi - - LOG_INFO "步骤5:创建一个简单的测试LaTeX文档以验证logo功能" - cat > test_logo.tex << "EOF" - \documentclass{hitszbeamer} - \logo{\includegraphics[height=0.5cm]{example-image}} - \begin{document} - \begin{frame} - \frametitle{Test Frame} - This is a test frame with logo. - \end{frame} - \end{document} - EOF - - LOG_INFO "步骤6:使用pdflatex编译测试文档,并指定logo参数" - pdflatex --logo test_logo.tex - CHECK_RESULT $? 0 0 "pdflatex编译失败,logo功能可能存在问题" - - LOG_INFO "步骤7:检查生成的PDF文件是否存在" - if [ -f test_logo.pdf ]; then - LOG_INFO "PDF文件生成成功,logo功能正常" - else - LOG_ERROR "PDF文件未生成,logo功能可能存在问题" - exit 1 - fi - - LOG_INFO "步骤8:清理生成的临时文件" - rm -f test_logo.aux test_logo.log test_logo.nav test_logo.out test_logo.snm test_logo.toc test_logo.pdf test_logo.tex - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤9:卸载texlive-hitszbeamer软件包" - dnf remove -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "卸载texlive-hitszbeamer失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_theme_options.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_theme_options.sh deleted file mode 100644 index 544f7f0b07f..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_theme_options.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : Test applying different theme options in hitszbeamer -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试hitszbeamer主题选项的应用" - LOG_INFO "步骤1: 检查环境是否已安装hitszbeamer" - if dnf list installed | grep -q "hitszbeamer"; then - LOG_INFO "hitszbeamer已安装,测试后保持安装状态" - INSTALLED=true - else - LOG_INFO "hitszbeamer未安装,将在测试中安装" - INSTALLED=false - fi - LOG_INFO "步骤2: 检查yum源中是否有hitszbeamer软件包" - if ! dnf search hitszbeamer | grep -q "hitszbeamer"; then - LOG_ERROR "yum源中未找到hitszbeamer软件包" - exit 255 - fi - LOG_INFO "步骤3: 安装hitszbeamer(如果未安装)" - if [ "$INSTALLED" = false ]; then - dnf install -y hitszbeamer - CHECK_RESULT $? 0 0 "安装hitszbeamer失败" - LOG_INFO "hitszbeamer安装成功" - fi - LOG_INFO "步骤4: 测试应用不同主题选项" - LOG_INFO "测试应用主题选项:theme=dark" - hitszbeamer --theme=dark - CHECK_RESULT $? 0 0 "应用dark主题失败" - LOG_INFO "测试应用主题选项:theme=light" - hitszbeamer --theme=light - CHECK_RESULT $? 0 0 "应用light主题失败" - LOG_INFO "测试应用主题选项:theme=colorful" - hitszbeamer --theme=colorful - CHECK_RESULT $? 0 0 "应用colorful主题失败" - LOG_INFO "步骤5: 测试不支持的参数" - LOG_INFO "测试不支持的参数:theme=invalid" - hitszbeamer --theme=invalid - if [ $? -eq 255 ]; then - LOG_INFO "不支持的主题参数已正确处理" - else - LOG_ERROR "未正确处理不支持的主题参数" - exit 255 - fi - LOG_INFO "步骤6: 清理环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载hitszbeamer" - dnf remove -y hitszbeamer - CHECK_RESULT $? 0 0 "卸载hitszbeamer失败" - LOG_INFO "hitszbeamer卸载成功" - else - LOG_INFO "保持hitszbeamer安装状态" - fi - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_uninstall.sh b/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_uninstall.sh deleted file mode 100644 index 17b168a9ab5..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-y/texlive-hitszbeamer/test_texlive-hitszbeamer_function_uninstall.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : Test uninstallation of texlive-hitszbeamer package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否以root用户运行 - if [[ $EUID -ne 0 ]]; then - LOG_ERROR "请以root用户运行此脚本" - exit 1 - fi - - LOG_INFO "开始测试卸载texlive-hitszbeamer包" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查yum源中是否存在texlive-hitszbeamer包" - dnf list available texlive-hitszbeamer > /dev/null 2>&1 - if [[ $? -ne 0 ]]; then - LOG_ERROR "yum源中未找到texlive-hitszbeamer包" - exit 255 - fi - - # 步骤2:检查当前是否已安装 - LOG_INFO "步骤2:检查当前是否已安装texlive-hitszbeamer包" - dnf list installed texlive-hitszbeamer > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - LOG_INFO "检测到texlive-hitszbeamer已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE="yes" - else - LOG_INFO "未检测到texlive-hitszbeamer安装,将先安装再卸载" - INSTALLED_BEFORE="no" - fi - - # 步骤3:如果未安装,则先安装 - if [[ "$INSTALLED_BEFORE" == "no" ]]; then - LOG_INFO "步骤3:安装texlive-hitszbeamer包" - dnf install -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "安装texlive-hitszbeamer失败" - fi - - # 步骤4:验证安装成功 - LOG_INFO "步骤4:验证texlive-hitszbeamer包安装成功" - dnf list installed texlive-hitszbeamer > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-hitszbeamer包未正确安装" - - # 步骤5:卸载软件包 - LOG_INFO "步骤5:卸载texlive-hitszbeamer包" - dnf remove -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "卸载texlive-hitszbeamer包失败" - - # 步骤6:验证卸载成功 - LOG_INFO "步骤6:验证texlive-hitszbeamer包已卸载" - dnf list installed texlive-hitszbeamer > /dev/null 2>&1 - if [[ $? -eq 0 ]]; then - LOG_ERROR "texlive-hitszbeamer包卸载后仍然存在" - exit 1 - fi - LOG_INFO "texlive-hitszbeamer包已成功卸载" - - # 步骤7:环境恢复 - LOG_INFO "步骤7:恢复测试环境" - if [[ "$INSTALLED_BEFORE" == "yes" ]]; then - LOG_INFO "重新安装texlive-hitszbeamer包以恢复到初始状态" - dnf install -y texlive-hitszbeamer - CHECK_RESULT $? 0 0 "重新安装texlive-hitszbeamer包失败" - LOG_INFO "环境已恢复到初始安装状态" - else - LOG_INFO "环境已恢复到初始未安装状态" - fi - - LOG_INFO "测试完成:texlive-hitszbeamer包卸载功能测试成功" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-z/texlive-xtab/test_texlive-xtab_function_install.sh b/testcases/function_test/pkg_test/texlive-split-z/texlive-xtab/test_texlive-xtab_function_install.sh deleted file mode 100644 index b6992ea38d4..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-z/texlive-xtab/test_texlive-xtab_function_install.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-10-05 -# @License : Mulan PSL v2 -# @Desc : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:test_texlive-xtab_function_install - - LOG_INFO "开始测试:Test package installation" - - # 检查是否已安装texlive-xtab - LOG_INFO "检查texlive-xtab是否已安装" - rpm -q texlive-xtab > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-xtab已安装,跳过安装步骤" - installed=true - else - installed=false - fi - - # 检查yum源中是否有texlive-xtab软件包 - LOG_INFO "检查yum源中是否有texlive-xtab软件包" - dnf list available texlive-xtab > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-xtab软件包" - - # 安装texlive-xtab - if [ "$installed" = false ]; then - LOG_INFO "开始安装texlive-xtab" - dnf install -y texlive-xtab > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-xtab失败" - fi - - # 测试命令功能 - LOG_INFO "测试texlive-xtab功能" - some_command_related_to_texlive_xtab > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "命令参数不支持或不存在" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-xtab" - dnf remove -y texlive-xtab > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-xtab失败" - fi - - LOG_INFO "测试完成:Test package installation" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_compile.sh b/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_compile.sh deleted file mode 100644 index 3f557334eb9..00000000000 --- a/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_compile.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-02 -# @License : Mulan PSL v2 -# @Desc : Test basic compile and link with library -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:Test basic compile and link with library" - - LOG_INFO "步骤1:检查系统中是否已安装utf8proc-devel软件包" - if rpm -q utf8proc-devel &> /dev/null; then - LOG_INFO "检测到utf8proc-devel已安装,将在测试结束后保持安装状态。" - INSTALLED_BEFORE="yes" - else - LOG_INFO "未检测到utf8proc-devel安装,将在测试过程中安装。" - INSTALLED_BEFORE="no" - fi - - LOG_INFO "步骤2:检查yum源中是否存在utf8proc-devel软件包" - if ! dnf list available utf8proc-devel &> /dev/null; then - LOG_ERROR "yum源中未找到utf8proc-devel软件包。" - exit 255 - fi - - if [[ "$INSTALLED_BEFORE" == "no" ]]; then - LOG_INFO "步骤3:安装utf8proc-devel软件包" - dnf install -y utf8proc-devel - CHECK_RESULT $? 0 0 "安装utf8proc-devel失败" - fi - - LOG_INFO "步骤4:编写一个简单的C测试程序以验证编译和链接功能" - cat > /tmp/test_utf8proc.c << "EOF" - #include - #include - int main() { - const char *input = "Hello, 世界!"; - utf8proc_int32_t buffer[256]; - utf8proc_option_t options = UTF8PROC_NULLTERM | UTF8PROC_STABLE | UTF8PROC_DECOMPOSE; - utf8proc_ssize_t len = utf8proc_decompose((const utf8proc_uint8_t *)input, -1, buffer, 256, options); - if (len < 0) { - printf("Decomposition failed with error: %s\n", utf8proc_errmsg(len)); - return 1; - } - printf("Decomposition successful, length: %ld\n", (long)len); - return 0; - } - EOF - - LOG_INFO "步骤5:使用gcc编译测试程序,链接utf8proc库" - gcc -o /tmp/test_utf8proc /tmp/test_utf8proc.c -lutf8proc - CHECK_RESULT $? 0 0 "编译链接测试程序失败" - - LOG_INFO "步骤6:运行编译好的测试程序" - /tmp/test_utf8proc - CHECK_RESULT $? 0 0 "运行测试程序失败" - - LOG_INFO "步骤7:清理临时文件" - rm -f /tmp/test_utf8proc.c /tmp/test_utf8proc - - LOG_INFO "步骤8:根据初始状态决定是否卸载utf8proc-devel软件包" - if [[ "$INSTALLED_BEFORE" == "no" ]]; then - LOG_INFO "测试前未安装utf8proc-devel,现在将其卸载以恢复环境。" - dnf remove -y utf8proc-devel - CHECK_RESULT $? 0 0 "卸载utf8proc-devel失败" - else - LOG_INFO "测试前已安装utf8proc-devel,保持其安装状态。" - fi - - LOG_INFO "测试完成:Test basic compile and link with library" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_install.sh b/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_install.sh deleted file mode 100644 index eb6f6f6aa58..00000000000 --- a/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_install.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-10-05 -# @License : Mulan PSL v2 -# @Desc : Test installation of utf8proc-devel package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test installation of utf8proc-devel package" - - # 检查软件包是否已安装 - LOG_INFO "检查utf8proc-devel是否已安装" - rpm -q utf8proc-devel > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "utf8proc-devel已安装,测试将保持安装状态" - installed=true - else - LOG_INFO "utf8proc-devel未安装,将在测试结束后卸载" - installed=false - fi - - # 检查yum源中是否存在utf8proc-devel软件包 - LOG_INFO "检查yum源中是否存在utf8proc-devel软件包" - dnf list available utf8proc-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中不存在utf8proc-devel软件包" - - # 安装utf8proc-devel软件包 - if [ "$installed" = false ]; then - LOG_INFO "开始安装utf8proc-devel软件包" - dnf install -y utf8proc-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装utf8proc-devel软件包失败" - fi - - # 测试utf8proc-devel功能 - LOG_INFO "测试utf8proc-devel功能" - command_to_test="some_utf8proc_command" # 替换为实际的测试命令 - $command_to_test > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "测试命令失败或参数不支持" - - # 清理环境(如果之前未安装) - if [ "$installed" = false ]; then - LOG_INFO "卸载utf8proc-devel软件包" - dnf remove -y utf8proc-devel > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载utf8proc-devel软件包失败" - fi - - LOG_INFO "测试完成:Test installation of utf8proc-devel package" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_pkgconfig.sh b/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_pkgconfig.sh deleted file mode 100644 index 4acffc013a9..00000000000 --- a/testcases/function_test/pkg_test/utf8proc/utf8proc-devel/test_utf8proc-devel_function_pkgconfig.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-02 -# @License : Mulan PSL v2 -# @Desc : Test pkg-config file availability -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试pkg-config文件可用性 - - LOG_INFO "开始测试pkg-config文件可用性" - - # 定义软件包名称 - PACKAGE_NAME="utf8proc-devel" - PKGCONFIG_FILE="utf8proc.pc" - - # 检查软件包是否已安装 - LOG_INFO "步骤1:检查${PACKAGE_NAME}软件包是否已安装" - if rpm -q ${PACKAGE_NAME} &>/dev/null; then - LOG_INFO "${PACKAGE_NAME}软件包已安装,脚本结束时将保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "${PACKAGE_NAME}软件包未安装" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否有${PACKAGE_NAME}软件包" - if ! dnf list available ${PACKAGE_NAME} &>/dev/null; then - LOG_ERROR "yum源中未找到${PACKAGE_NAME}软件包" - exit 255 - fi - LOG_INFO "yum源中存在${PACKAGE_NAME}软件包" - - # 如果未安装,则安装软件包 - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - LOG_INFO "成功安装${PACKAGE_NAME}软件包" - fi - - # 检查pkg-config命令是否存在 - LOG_INFO "步骤4:检查pkg-config命令是否可用" - if ! command -v pkg-config &>/dev/null; then - LOG_ERROR "pkg-config命令不存在" - exit 255 - fi - LOG_INFO "pkg-config命令可用" - - # 检查pkg-config是否支持--exists参数 - LOG_INFO "步骤5:检查pkg-config命令是否支持--exists参数" - if ! pkg-config --help 2>&1 | grep -q "\-\-exists"; then - LOG_ERROR "pkg-config命令不支持--exists参数" - exit 255 - fi - LOG_INFO "pkg-config命令支持--exists参数" - - # 测试pkg-config文件可用性 - LOG_INFO "步骤6:测试${PKGCONFIG_FILE}文件是否可通过pkg-config访问" - pkg-config --exists ${PKGCONFIG_FILE} - CHECK_RESULT $? 0 0 "pkg-config无法找到${PKGCONFIG_FILE}文件" - - # 获取pkg-config信息 - LOG_INFO "步骤7:获取${PKGCONFIG_FILE}文件的pkg-config信息" - PKG_VERSION=$(pkg-config --modversion ${PKGCONFIG_FILE} 2>/dev/null) - CHECK_RESULT $? 0 0 "获取${PKGCONFIG_FILE}版本信息失败" - LOG_INFO "${PKGCONFIG_FILE}版本为:${PKG_VERSION}" - - PKG_CFLAGS=$(pkg-config --cflags ${PKGCONFIG_FILE} 2>/dev/null) - CHECK_RESULT $? 0 0 "获取${PKGCONFIG_FILE}编译标志失败" - LOG_INFO "${PKGCONFIG_FILE}编译标志为:${PKG_CFLAGS}" - - PKG_LIBS=$(pkg-config --libs ${PKGCONFIG_FILE} 2>/dev/null) - CHECK_RESULT $? 0 0 "获取${PKGCONFIG_FILE}链接库失败" - LOG_INFO "${PKGCONFIG_FILE}链接库为:${PKG_LIBS}" - - # 清理环境 - LOG_INFO "步骤8:清理测试环境" - if [ "${INSTALLED_BEFORE}" = "false" ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - LOG_INFO "成功卸载${PACKAGE_NAME}软件包" - else - LOG_INFO "测试前${PACKAGE_NAME}已安装,保持安装状态" - fi - - LOG_INFO "测试pkg-config文件可用性完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/xstream/xstream-javadoc/test_xstream-javadoc_function_parse.sh b/testcases/function_test/pkg_test/xstream/xstream-javadoc/test_xstream-javadoc_function_parse.sh deleted file mode 100644 index f17eebab2a6..00000000000 --- a/testcases/function_test/pkg_test/xstream/xstream-javadoc/test_xstream-javadoc_function_parse.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-11-29 -# @License : Mulan PSL v2 -# @Desc : Test parsing functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试xstream-javadoc的解析功能" - - # 检查是否已安装xstream-javadoc - LOG_INFO "检查xstream-javadoc是否已安装" - if dnf list installed xstream-javadoc &>/dev/null; then - LOG_INFO "xstream-javadoc已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "xstream-javadoc未安装,准备安装" - INSTALLED=false - fi - - # 检查yum源中是否有xstream-javadoc - LOG_INFO "检查yum源中是否有xstream-javadoc" - if ! dnf list available xstream-javadoc &>/dev/null; then - LOG_ERROR "yum源中未找到xstream-javadoc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装xstream-javadoc" - dnf install -y xstream-javadoc - CHECK_RESULT $? 0 0 "安装xstream-javadoc失败" - fi - - # 测试解析功能 - LOG_INFO "测试解析功能" - java -jar /usr/share/xstream-javadoc/xstream-javadoc.jar parse --input test.xml --output test.json - CHECK_RESULT $? 0 0 "解析功能测试失败" - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载xstream-javadoc" - dnf remove -y xstream-javadoc - CHECK_RESULT $? 0 0 "卸载xstream-javadoc失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/xstream/xstream-javadoc/test_xstream-javadoc_function_serialize.sh b/testcases/function_test/pkg_test/xstream/xstream-javadoc/test_xstream-javadoc_function_serialize.sh deleted file mode 100644 index 8cb7027ea8b..00000000000 --- a/testcases/function_test/pkg_test/xstream/xstream-javadoc/test_xstream-javadoc_function_serialize.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-09 -# @License : Mulan PSL v2 -# @Desc : Test serialization functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试序列化功能" - - # 检查是否已安装xstream-javadoc软件包 - LOG_INFO "检查xstream-javadoc是否已安装" - if dnf list installed xstream-javadoc &>/dev/null; then - LOG_INFO "xstream-javadoc已安装,跳过安装步骤" - installed=true - else - LOG_INFO "xstream-javadoc未安装,准备安装" - installed=false - fi - - # 检查yum源中是否有xstream-javadoc软件包 - LOG_INFO "检查yum源中是否有xstream-javadoc" - if ! dnf list available xstream-javadoc &>/dev/null; then - LOG_ERROR "yum源中未找到xstream-javadoc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装xstream-javadoc" - dnf install -y xstream-javadoc - CHECK_RESULT $? 0 0 "安装xstream-javadoc失败" - fi - - # 测试序列化功能 - LOG_INFO "测试序列化功能" - java -cp /usr/share/java/xstream.jar com.thoughtworks.xstream.XStream - CHECK_RESULT $? 0 0 "序列化功能测试失败" - - # 清理环境 - if [ "$installed" = false ]; then - LOG_INFO "卸载xstream-javadoc" - dnf remove -y xstream-javadoc - CHECK_RESULT $? 0 0 "卸载xstream-javadoc失败" - fi - - LOG_INFO "测试序列化功能完成" -} - -main "$@" \ No newline at end of file