diff --git a/suite2cases/function_test/pkg_test/abrt/abrt-addon-upload-watch.json b/suite2cases/function_test/pkg_test/abrt/abrt-addon-upload-watch.json index 68a27435860..af1cd0f43d6 100644 --- a/suite2cases/function_test/pkg_test/abrt/abrt-addon-upload-watch.json +++ b/suite2cases/function_test/pkg_test/abrt/abrt-addon-upload-watch.json @@ -2,26 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/abrt/abrt-addon-upload-watch", "machine num": 1, "cases": [ - { - "name": "test_abrt-addon-upload-watch_function_package_install", - "desc": "测试软件包abrt-addon-upload-watch能否被成功安装" - }, - { - "name": "test_abrt-addon-upload-watch_function_package_remove", - "desc": "测试软件包abrt-addon-upload-watch能否被成功卸载" - }, - { - "name": "test_abrt-addon-upload-watch_function_service_enable", - "desc": "测试abrt-upload-watch服务能否被启用并设置为开机启动" - }, - { - "name": "test_abrt-addon-upload-watch_function_service_start", - "desc": "测试abrt-upload-watch服务能否被成功启动" - }, - { - "name": "test_abrt-addon-upload-watch_function_service_status", - "desc": "测试abrt-upload-watch服务运行状态检查功能" - }, { "name": "test_abrt-addon-upload-watch_function_config_check", "desc": "测试软件包主配置文件/etc/abrt/abrt-action-save-package-data.conf是否存在且有效" diff --git a/suite2cases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime.json b/suite2cases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime.json index f46a53353b3..45682899eb3 100644 --- a/suite2cases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime.json +++ b/suite2cases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime.json @@ -7,57 +7,9 @@ "desc": "测试eclipse-emf-runtime软件包的安装功能", "machine num": 1 }, - { - "name": "test_eclipse-emf-runtime_function_model", - "desc": "测试eclipse-emf-runtime的模型功能" - }, - { - "name": "test_eclipse-emf-runtime_function_validation", - "desc": "测试eclipse-emf-runtime的验证功能" - }, - { - "name": "test_eclipse-emf-runtime_function_codegen", - "desc": "测试eclipse-emf-runtime的代码生成功能" - }, - { - "name": "test_eclipse-emf-runtime_function_serialization", - "desc": "测试eclipse-emf-runtime的序列化功能" - }, - { - "name": "test_eclipse-emf-runtime_uninstall", - "desc": "测试eclipse-emf-runtime软件包的卸载功能" - }, { "name": "test_eclipse-emf-runtime_version", "desc": "测试检查eclipse-emf-runtime版本信息" - }, - { - "name": "test_eclipse-emf-runtime_model", - "desc": "测试EMF模型创建与加载" - }, - { - "name": "test_eclipse-emf-runtime_edit", - "desc": "测试EMF模型编辑器功能" - }, - { - "name": "test_eclipse-emf-runtime_validation", - "desc": "测试EMF模型验证功能" - }, - { - "name": "test_eclipse-emf-runtime_serialize", - "desc": "测试EMF模型序列化与反序列化" - }, - { - "name": "test_eclipse-emf-runtime_codegen", - "desc": "测试EMF代码生成功能" - }, - { - "name": "test_eclipse-emf-runtime_registry", - "desc": "测试EMF资源集与注册表" - }, - { - "name": "test_eclipse-emf-runtime_adapter", - "desc": "测试EMF适配器与通知机制" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/grub2/grub2-tools.json b/suite2cases/function_test/pkg_test/grub2/grub2-tools.json index 7f0f3edd7c9..305e1d20d36 100644 --- a/suite2cases/function_test/pkg_test/grub2/grub2-tools.json +++ b/suite2cases/function_test/pkg_test/grub2/grub2-tools.json @@ -359,54 +359,10 @@ "name": "test_grub2-tools_grub2-file_is-x86-multiboot2", "desc": "测试grub2-file命令的--is-x86-multiboot2参数,验证是否能检查文件是否可作为x86 multiboot2内核使用" }, - { - "name": "test_grub2-tools_grub2-file_is-arm-linux", - "desc": "测试grub2-file命令的--is-arm-linux参数,验证是否能检查文件是否为ARM Linux内核" - }, - { - "name": "test_grub2-tools_grub2-file_is-arm64-linux", - "desc": "测试grub2-file命令的--is-arm64-linux参数,验证是否能检查文件是否为ARM64 Linux内核" - }, - { - "name": "test_grub2-tools_grub2-file_is-mipsel-linux", - "desc": "测试grub2-file命令的--is-mipsel-linux参数,验证是否能检查文件是否为MIPSEL Linux内核" - }, - { - "name": "test_grub2-tools_grub2-file_is-x86-linux", - "desc": "测试grub2-file命令的--is-x86-linux参数,验证是否能检查文件是否为x86 Linux内核" - }, { "name": "test_grub2-tools_grub2-file_is-i386-kfreebsd", "desc": "测试grub2-file命令的--is-i386-kfreebsd参数,验证是否能检查文件是否为i386 kFreeBSD内核" }, - { - "name": "test_grub2-tools_grub2-file_is-x86_64-kfreebsd", - "desc": "测试grub2-file命令的--is-x86_64-kfreebsd参数,验证是否能检查文件是否为x86_64 kFreeBSD内核" - }, - { - "name": "test_grub2-tools_grub2-file_is-x86-knetbsd", - "desc": "测试grub2-file命令的--is-x86-knetbsd参数,验证是否能检查文件是否为x86 kNetBSD内核" - }, - { - "name": "test_grub2-tools_grub2-file_is-i386-knetbsd", - "desc": "测试grub2-file命令的--is-i386-knetbsd参数,验证是否能检查文件是否为i386 kNetBSD内核" - }, - { - "name": "test_grub2-tools_grub2-file_is-x86_64-knetbsd", - "desc": "测试grub2-file命令的--is-x86_64-knetbsd参数,验证是否能检查文件是否为x86_64 kNetBSD内核" - }, - { - "name": "test_grub2-tools_grub2-file_is-i386-efi", - "desc": "测试grub2-file命令的--is-i386-efi参数,验证是否能检查文件是否为i386 EFI文件" - }, - { - "name": "test_grub2-tools_grub2-file_is-x86_64-efi", - "desc": "测试grub2-file命令的--is-x86_64-efi参数,验证是否能检查文件是否为x86_64 EFI文件" - }, - { - "name": "test_grub2-tools_grub2-file_is-ia64-efi", - "desc": "测试grub2-file命令的--is-ia64-efi参数,验证是否能检查文件是否为IA64 EFI文件" - }, { "name": "test_grub2-tools_grub2-file_is-arm-efi", "desc": "测试grub2-file命令的--is-arm-efi参数,验证是否能检查文件是否为ARM EFI文件" @@ -415,126 +371,14 @@ "name": "test_grub2-tools_grub2-file_is-riscv32-efi", "desc": "测试grub2-file命令的--is-riscv32-efi参数,验证是否能检查文件是否为RISC-V 32位 EFI文件" }, - { - "name": "test_grub2-tools_grub2-file_is-xnu-hibr", - "desc": "测试grub2-file命令的--is-xnu-hibr参数,验证是否能检查文件是否为XNU (Mac OS X内核)休眠镜像" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__3", - "desc": "测试指定32位输入文件的功能" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__6", - "desc": "测试指定64位输入文件的功能" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__o", - "desc": "测试指定输出文件的功能" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__v", - "desc": "测试启用详细输出模式的功能" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__upper_v", - "desc": "测试显示程序版本信息的功能" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__3__6__o", - "desc": "测试组合使用32位输入、64位输入和输出文件参数的功能" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__3__6__v", - "desc": "测试组合使用32位输入、64位输入和详细输出参数的功能" - }, - { - "name": "test_grub2-tools_grub2-glue-efi__3__6__o__v", - "desc": "测试组合使用32位输入、64位输入、输出文件和详细输出参数的功能" - }, - { - "name": "test_grub2-tools_grub2-menulst2cfg_infile", - "desc": "测试仅指定输入文件参数" - }, - { - "name": "test_grub2-tools_grub2-menulst2cfg_infile_outfile", - "desc": "测试指定输入文件和输出文件参数" - }, - { - "name": "test_grub2-tools_grub2-mkimage__v", - "desc": "测试grub2-mkimage的详细输出模式" - }, - { - "name": "test_grub2-tools_grub2-mkimage__upper_h", - "desc": "测试grub2-mkimage的帮助信息输出" - }, - { - "name": "test_grub2-tools_grub2-mkimage__c", - "desc": "测试grub2-mkimage嵌入早期配置文件" - }, - { - "name": "test_grub2-tools_grub2-mkimage__upper_c", - "desc": "测试grub2-mkimage指定核心镜像压缩方式" - }, - { - "name": "test_grub2-tools_grub2-mkimage__d", - "desc": "测试grub2-mkimage指定模块和镜像目录" - }, - { - "name": "test_grub2-tools_grub2-mkimage__upper_d", - "desc": "测试grub2-mkimage嵌入设备树文件" - }, - { - "name": "test_grub2-tools_grub2-mkimage__k", - "desc": "测试grub2-mkimage嵌入PGP公钥文件" - }, - { - "name": "test_grub2-tools_grub2-mkimage__n", - "desc": "测试grub2-mkimage为CHRP IEEE1275添加NOTE段" - }, - { - "name": "test_grub2-tools_grub2-mkimage__upper_o", - "desc": "测试grub2-mkimage指定输出镜像格式" - }, { "name": "test_grub2-tools_grub2-mkimage__p", "desc": "测试grub2-mkimage设置前缀目录" }, - { - "name": "test_grub2-tools_grub2-mkimage__s", - "desc": "测试grub2-mkimage嵌入SBAT元数据文件" - }, - { - "name": "test_grub2-tools_grub2-mkimage__upper_s", - "desc": "测试grub2-mkimage为附加签名预留空间" - }, - { - "name": "test_grub2-tools_grub2-mkimage__x", - "desc": "测试grub2-mkimage嵌入x509证书文件" - }, - { - "name": "test_grub2-tools_grub2-mkimage__c__o", - "desc": "测试grub2-mkimage同时使用配置文件和输出文件参数" - }, - { - "name": "test_grub2-tools_grub2-mkimage__d__upper_o", - "desc": "测试grub2-mkimage同时使用目录和格式参数" - }, - { - "name": "test_grub2-tools_grub2-mkimage__upper_c_none__upper_o_x86_64_efi", - "desc": "测试grub2-mkimage指定不压缩并生成x86_64-efi格式镜像" - }, - { - "name": "test_grub2-tools_grub2-mkimage__m__p", - "desc": "测试grub2-mkimage同时使用内存磁盘和前缀参数" - }, { "name": "test_grub2-tools_grub2-mkrelpath_question", "desc": "测试使用 -? 参数,获取命令帮助信息" }, - { - "name": "test_grub2-tools_grub2-mkrelpath_relative", - "desc": "测试使用 --relative 参数,在btrfs上使用相对路径" - }, { "name": "test_grub2-tools_grub2-mkrelpath_noarg", "desc": "测试不带任何参数,仅提供PATH参数进行转换" @@ -547,29 +391,9 @@ "name": "test_grub2-tools_grub2-mkrelpath_question_upper_v", "desc": "测试组合使用 -? 和 -V 参数,获取帮助并打印版本" }, - { - "name": "test_grub2-tools_grub2-script-check_v", - "desc": "使用-v参数,检查脚本配置文件语法错误并打印详细消息。" - }, { "name": "test_grub2-tools_grub2-script-check_upper_v", "desc": "使用-V参数,打印程序版本信息。" - }, - { - "name": "test_grub2-tools_grub2-script-check_no_args", - "desc": "不带任何参数,检查指定路径的GRUB脚本配置文件语法错误。" - }, - { - "name": "test_grub2-tools_function_uninstall", - "desc": "测试软件包的卸载功能,确保卸载过程正确无误" - }, - { - "name": "test_grub2-tools_function_install_boot", - "desc": "测试grub2-install命令安装引导程序" - }, - { - "name": "test_grub2-tools_function_file_check", - "desc": "测试grub2-file命令检查文件类型" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/hwloc/hwloc.json b/suite2cases/function_test/pkg_test/hwloc/hwloc.json index 8326b6e3ed3..2f50423403c 100644 --- a/suite2cases/function_test/pkg_test/hwloc/hwloc.json +++ b/suite2cases/function_test/pkg_test/hwloc/hwloc.json @@ -506,10 +506,6 @@ "name": "test_hwloc_lstopo_append_legend", "desc": "测试使用--append-legend选项在图例底部追加一行新文本" }, - { - "name": "test_hwloc_lstopo_logical_index_prefix", - "desc": "测试使用--logical-index-prefix选项设置逻辑索引的前缀" - }, { "name": "test_hwloc_lstopo_ps", "desc": "测试使用--ps选项在层次结构中显示进程" diff --git a/suite2cases/function_test/pkg_test/jaf/jakarta-activation.json b/suite2cases/function_test/pkg_test/jaf/jakarta-activation.json index a3338e8646c..d70d25107ee 100644 --- a/suite2cases/function_test/pkg_test/jaf/jakarta-activation.json +++ b/suite2cases/function_test/pkg_test/jaf/jakarta-activation.json @@ -9,10 +9,6 @@ { "name": "test_jakarta-activation_function_uninstall", "desc": "Test package uninstallation" - }, - { - "name": "test_jakarta-activation_function_validate", - "desc": "Test package validation functionality" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/libvirt/libvirt-daemon-driver-storage-disk.json b/suite2cases/function_test/pkg_test/libvirt/libvirt-daemon-driver-storage-disk.json index d463a1db07d..c893b801ae0 100644 --- a/suite2cases/function_test/pkg_test/libvirt/libvirt-daemon-driver-storage-disk.json +++ b/suite2cases/function_test/pkg_test/libvirt/libvirt-daemon-driver-storage-disk.json @@ -6,26 +6,6 @@ "name": "test_libvirt-daemon-driver-storage-disk_install", "desc": "测试libvirt-daemon-driver-storage-disk软件包的安装功能,验证安装过程是否正常完成", "machine num": 1 - }, - { - "name": "test_libvirt-daemon-driver-storage-disk_function_install", - "desc": "测试软件包的安装功能,验证是否能成功安装并正确配置" - }, - { - "name": "test_libvirt-daemon-driver-storage-disk_function_uninstall", - "desc": "测试软件包的卸载功能,验证是否能完全移除且不影响其他组件" - }, - { - "name": "test_libvirt-daemon-driver-storage-disk_function_disk_pool", - "desc": "测试通过virsh命令创建和管理基于磁盘的存储池" - }, - { - "name": "test_libvirt-daemon-driver-storage-disk_function_disk_volume", - "desc": "测试在磁盘存储池中创建、删除和查询存储卷" - }, - { - "name": "test_libvirt-daemon-driver-storage-disk_function_vm_attach", - "desc": "测试将磁盘存储卷成功附加到虚拟机并验证其可用性" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/mtd-utils/mtd-utils-ubifs.json b/suite2cases/function_test/pkg_test/mtd-utils/mtd-utils-ubifs.json deleted file mode 100644 index 05259b95e56..00000000000 --- a/suite2cases/function_test/pkg_test/mtd-utils/mtd-utils-ubifs.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/mtd-utils/mtd-utils-ubifs", - "machine num": 1, - "cases": [ - { - "name": "test_mtd-utils-ubifs_function_flash", - "desc": "Test flash operations" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion.json b/suite2cases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion.json deleted file mode 100644 index 71f1dde20cb..00000000000 --- a/suite2cases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion", - "machine num": 1, - "cases": [ - { - "name": "test_open-vm-tools-salt-minion_function_install", - "desc": "Verify the installation of open-vm-tools-salt-minion package" - }, - { - "name": "test_open-vm-tools-salt-minion_function_config", - "desc": "Check the configuration file for correctness" - }, - { - "name": "test_open-vm-tools-salt-minion_function_service", - "desc": "Ensure the service starts and stops properly" - }, - { - "name": "test_open-vm-tools-salt-minion_function_comm", - "desc": "Test communication with salt master" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/python-imagesize/python3-imagesize.json b/suite2cases/function_test/pkg_test/python-imagesize/python3-imagesize.json index faad85fb67b..26dadeff1c0 100644 --- a/suite2cases/function_test/pkg_test/python-imagesize/python3-imagesize.json +++ b/suite2cases/function_test/pkg_test/python-imagesize/python3-imagesize.json @@ -6,10 +6,6 @@ "name": "test_python3-imagesize_install", "desc": "测试python3-imagesize软件包的安装功能", "machine num": 1 - }, - { - "name": "test_python3-imagesize_function_getsize", - "desc": "测试python3-imagesize获取图片尺寸功能" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp.json b/suite2cases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp.json index 0d9cb6e49e9..b979b18a1c4 100644 --- a/suite2cases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp.json +++ b/suite2cases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp.json @@ -5,26 +5,6 @@ { "name": "test_python3-requests-ftp_function_install", "desc": "Test package installation" - }, - { - "name": "test_python3-requests-ftp_function_uninstall", - "desc": "Test package removal" - }, - { - "name": "test_python3-requests-ftp_function_import", - "desc": "Test basic module import" - }, - { - "name": "test_python3-requests-ftp_function_listdir", - "desc": "Test FTP LIST command" - }, - { - "name": "test_python3-requests-ftp_function_retrieve", - "desc": "Test file download via FTP" - }, - { - "name": "test_python3-requests-ftp_function_upload", - "desc": "Test file upload via FTP" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collcell.json b/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collcell.json deleted file mode 100644 index 38fd54d42db..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-e/texlive-collcell.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-e/texlive-collcell", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-collcell_function_install", - "desc": "Test package installation" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-l/texlive-includernw.json b/suite2cases/function_test/pkg_test/texlive-split-l/texlive-includernw.json deleted file mode 100644 index 962e694808f..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-l/texlive-includernw.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-l/texlive-includernw", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-includernw_function_basic", - "desc": "Basic functionality test for texlive-includernw" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-n/texlive-llncsconf.json b/suite2cases/function_test/pkg_test/texlive-split-n/texlive-llncsconf.json index 87de0965342..c54cfd858b8 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-n/texlive-llncsconf.json +++ b/suite2cases/function_test/pkg_test/texlive-split-n/texlive-llncsconf.json @@ -13,10 +13,6 @@ { "name": "test_texlive-llncsconf_function_check", "desc": "Check if package is installed" - }, - { - "name": "test_texlive-llncsconf_function_use", - "desc": "Test basic document compilation" } ] } \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-r/texlive-pdfpages-doc.json b/suite2cases/function_test/pkg_test/texlive-split-r/texlive-pdfpages-doc.json deleted file mode 100644 index e6be8228dfe..00000000000 --- a/suite2cases/function_test/pkg_test/texlive-split-r/texlive-pdfpages-doc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-r/texlive-pdfpages-doc", - "machine num": 1, - "cases": [ - { - "name": "test_texlive-pdfpages-doc_function_basic", - "desc": "Verify basic functionality of texlive-pdfpages-doc" - } - ] -} \ No newline at end of file diff --git a/suite2cases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline.json b/suite2cases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline.json index eae6394affd..153d3974ea6 100644 --- a/suite2cases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline.json +++ b/suite2cases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline.json @@ -2,10 +2,6 @@ "path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline", "machine num": 1, "cases": [ - { - "name": "test_texlive-pst-bspline_function_draw", - "desc": "Test drawing B-spline curves" - }, { "name": "test_texlive-pst-bspline_function_install", "desc": "Test installation of texlive-pst-bspline package" @@ -17,22 +13,6 @@ { "name": "test_texlive-pst-bspline_function_check_installed", "desc": "Test checking if texlive-pst-bspline is installed" - }, - { - "name": "test_texlive-pst-bspline_function_basic_usage", - "desc": "Test basic usage to draw a B-spline curve" - }, - { - "name": "test_texlive-pst-bspline_function_open_close", - "desc": "Test drawing open and closed B-spline curves" - }, - { - "name": "test_texlive-pst-bspline_function_control_points", - "desc": "Test B-spline with different control points" - }, - { - "name": "test_texlive-pst-bspline_function_degree", - "desc": "Test B-spline curves of different degrees" } ] } \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_adapter.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_adapter.sh deleted file mode 100644 index 62d5bbd0a2d..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_adapter.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试EMF适配器与通知机制 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="eclipse-emf-runtime_adapter" - - # 步骤1: 检查是否已安装软件包 - LOG_INFO "步骤1: 检查是否已安装 $PACKAGE_NAME" - rpm -q $PACKAGE_NAME - if [ $? -eq 0 ]; then - LOG_INFO "$PACKAGE_NAME 已安装,脚本结束时将保持安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "$PACKAGE_NAME 未安装,将在测试后卸载" - ALREADY_INSTALLED=0 - fi - - # 步骤2: 检查yum源中是否存在该软件包 - LOG_INFO "步骤2: 检查yum源中是否存在 $PACKAGE_NAME" - dnf list available $PACKAGE_NAME - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到 $PACKAGE_NAME 软件包" - exit 255 - 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: 验证EMF适配器基本功能 - LOG_INFO "步骤4: 验证EMF适配器基本功能" - # 这里假设有一个命令可以验证EMF适配器,例如检查服务状态或运行一个简单测试 - # 示例命令: systemctl status emf-adapter 或执行一个测试命令 - # 由于实际命令未知,这里使用一个示例,实际应根据具体软件调整 - if systemctl list-unit-files | grep -q "emf-adapter"; then - systemctl status emf-adapter --no-pager - CHECK_RESULT $? 0 0 "EMF适配器服务状态检查失败" - else - LOG_INFO "未找到emf-adapter服务,跳过服务状态检查" - # 可以执行其他验证命令,例如运行一个测试程序 - # test_emf_adapter_command - # CHECK_RESULT $? 0 0 "EMF适配器功能测试失败" - fi - - # 步骤5: 测试通知机制 - LOG_INFO "步骤5: 测试EMF适配器的通知机制" - # 这里假设有一个命令可以触发通知并验证,例如发送一个测试通知 - # 示例命令: send-notification-test 或检查日志中是否有特定通知 - # 由于实际命令未知,这里使用一个示例,实际应根据具体软件调整 - # trigger_notification_test - # CHECK_RESULT $? 0 0 "通知机制测试失败" - LOG_INFO "通知机制测试暂未实现具体命令,跳过此步骤" - - # 步骤6: 清理环境 - LOG_INFO "步骤6: 清理测试环境" - 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 "测试完成: EMF适配器与通知机制测试结束" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_codegen.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_codegen.sh deleted file mode 100644 index c07a00cd4f1..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_codegen.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试EMF代码生成功能 -# ############################################ - -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 "检查软件包 $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源中" - } - - # 检查命令参数是否支持 - check_command_option() { - local command=$1 - local option=$2 - LOG_INFO "检查命令 $command 是否支持参数 $option" - $command --help 2>&1 | grep -q "$option" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $command 不支持参数 $option" - exit 255 - fi - LOG_INFO "命令 $command 支持参数 $option" - } - - # 检查软件包是否已安装 - check_package_installed() { - local package_name=$1 - rpm -q $package_name &>/dev/null - return $? - } - - # 主测试函数 - test_emf_codegen() { - local test_package="eclipse-emf-runtime" - local need_cleanup=0 - - LOG_INFO "开始测试EMF代码生成功能" - - # 检查测试软件包是否已安装 - LOG_INFO "检查软件包 $test_package 是否已安装" - if check_package_installed $test_package; then - LOG_INFO "软件包 $test_package 已安装,测试结束后保持安装状态" - need_cleanup=0 - else - LOG_INFO "软件包 $test_package 未安装,将在测试前安装" - need_cleanup=1 - - # 检查软件包是否在yum源中 - check_package_in_repo $test_package - - # 安装软件包 - LOG_INFO "安装软件包 $test_package" - dnf install -y $test_package - CHECK_RESULT $? 0 0 "安装软件包 $test_package 失败" - fi - - # 检查EMF代码生成命令是否可用 - LOG_INFO "检查EMF代码生成命令是否可用" - which emf &>/dev/null - if [ $? -ne 0 ]; then - # 尝试其他可能的命令 - LOG_INFO "尝试查找其他EMF相关命令" - find /usr -name "*emf*" -type f -executable 2>/dev/null | head -5 - CHECK_RESULT $? 0 0 "未找到EMF代码生成命令" - fi - - # 测试基本的EMF代码生成功能 - LOG_INFO "测试基本的EMF代码生成功能" - - # 创建测试目录 - local test_dir="/tmp/emf_test_$$" - LOG_INFO "创建测试目录: $test_dir" - mkdir -p $test_dir - CHECK_RESULT $? 0 0 "创建测试目录失败" - - # 创建简单的EMF模型文件示例(这里使用一个简单的示例) - LOG_INFO "创建测试EMF模型文件" - cat > $test_dir/sample.ecore << "EOF" - - - - - - - - EOF - CHECK_RESULT $? 0 0 "创建EMF模型文件失败" - - # 尝试使用EMF代码生成工具(这里使用通用方法,因为具体命令可能因安装方式不同而异) - LOG_INFO "尝试执行EMF代码生成" - - # 方法1:尝试使用eclipse命令 - LOG_INFO "方法1:尝试使用eclipse EMF工具" - if command -v eclipse &>/dev/null; then - LOG_INFO "找到eclipse命令,尝试生成代码" - # 这里只是示例,实际使用时需要根据具体命令调整 - echo "EMF代码生成测试通过(模拟)" > $test_dir/generated.txt - CHECK_RESULT $? 0 0 "EMF代码生成失败" - else - # 方法2:查找其他EMF工具 - LOG_INFO "方法2:查找其他EMF相关工具" - local emf_tools=$(find /usr -path "*emf*" -name "*.jar" 2>/dev/null | head -3) - if [ -n "$emf_tools" ]; then - LOG_INFO "找到EMF相关JAR文件,模拟代码生成测试" - echo "找到EMF工具: $emf_tools" > $test_dir/generated.txt - echo "EMF代码生成功能测试通过" >> $test_dir/generated.txt - CHECK_RESULT $? 0 0 "EMF代码生成测试失败" - else - # 方法3:检查基本的EMF运行时功能 - LOG_INFO "方法3:检查EMF运行时基本功能" - LOG_INFO "检查EMF运行时库文件" - local emf_libs=$(rpm -ql $test_package | grep -E "\.jar$" | head -5) - if [ -n "$emf_libs" ]; then - LOG_INFO "EMF运行时库文件存在: $(echo $emf_libs | tr "\n" " ")" - echo "EMF运行时安装正确,代码生成功能可用" > $test_dir/generated.txt - CHECK_RESULT $? 0 0 "EMF运行时检查失败" - else - LOG_ERROR "未找到EMF运行时库文件" - CHECK_RESULT 1 0 0 "EMF运行时库文件不存在" - fi - fi - fi - - # 验证生成的代码 - LOG_INFO "验证EMF代码生成结果" - if [ -f "$test_dir/generated.txt" ]; then - LOG_INFO "代码生成测试文件存在,内容如下:" - cat $test_dir/generated.txt - CHECK_RESULT $? 0 0 "读取生成的代码文件失败" - else - LOG_INFO "检查EMF模型文件是否创建成功" - if [ -f "$test_dir/sample.ecore" ]; then - LOG_INFO "EMF模型文件创建成功,大小: $(wc -l < $test_dir/sample.ecore) 行" - CHECK_RESULT $? 0 0 "EMF模型文件检查失败" - else - LOG_ERROR "未找到任何测试输出文件" - CHECK_RESULT 1 0 0 "测试输出验证失败" - fi - fi - - # 清理测试目录 - LOG_INFO "清理测试目录" - rm -rf $test_dir - CHECK_RESULT $? 0 0 "清理测试目录失败" - - # 如果需要清理,卸载软件包 - if [ $need_cleanup -eq 1 ]; then - LOG_INFO "测试完成,卸载软件包 $test_package" - dnf remove -y $test_package - CHECK_RESULT $? 0 0 "卸载软件包 $test_package 失败" - LOG_INFO "软件包 $test_package 已卸载,环境已恢复" - else - LOG_INFO "测试完成,保持软件包 $test_package 的安装状态" - fi - - LOG_INFO "EMF代码生成功能测试完成" - } - - # 执行测试 - main() { - LOG_INFO "开始执行EMF代码生成功能测试" - - # 检查dnf工具是否可用 - LOG_INFO "检查dnf工具是否可用" - command -v dnf &>/dev/null - CHECK_RESULT $? 0 0 "dnf工具不可用" - - # 执行测试 - test_emf_codegen - - LOG_INFO "所有测试步骤完成" - } - - # 捕获信号,确保环境清理 - trap "LOG_ERROR "测试被中断,执行清理操作"; exit 1" INT TERM - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_edit.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_edit.sh deleted file mode 100644 index 0f98c6351ae..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_edit.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试EMF模型编辑器功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装eclipse-emf-runtime-edit软件包 - LOG_INFO "检查是否已安装eclipse-emf-runtime-edit软件包" - rpm -q eclipse-emf-runtime-edit > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "eclipse-emf-runtime-edit软件包已安装" - INSTALLED=1 - else - LOG_INFO "eclipse-emf-runtime-edit软件包未安装" - INSTALLED=0 - fi - - # 检查yum源中是否有eclipse-emf-runtime-edit软件包 - LOG_INFO "检查yum源中是否有eclipse-emf-runtime-edit软件包" - dnf list available eclipse-emf-runtime-edit > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有eclipse-emf-runtime-edit软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "开始安装eclipse-emf-runtime-edit软件包" - dnf install -y eclipse-emf-runtime-edit > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime-edit软件包失败" - LOG_INFO "eclipse-emf-runtime-edit软件包安装成功" - fi - - # 测试EMF模型编辑器功能 - LOG_INFO "测试EMF模型编辑器功能" - # 检查eclipse-emf-runtime-edit软件包提供的命令或功能 - # 假设软件包提供了emf-edit命令进行测试 - command -v emf-edit > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "emf-edit命令不存在" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载eclipse-emf-runtime-edit软件包" - dnf remove -y eclipse-emf-runtime-edit > /dev/null 2>&1 - fi - exit 255 - fi - - # 测试emf-edit命令的基本功能 - LOG_INFO "测试emf-edit命令的基本功能" - emf-edit --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "emf-edit命令执行失败" - - # 测试emf-edit命令的特定参数(假设--version参数存在) - LOG_INFO "测试emf-edit命令的版本参数" - emf-edit --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "emf-edit --version命令执行失败" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载eclipse-emf-runtime-edit软件包" - dnf remove -y eclipse-emf-runtime-edit > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载eclipse-emf-runtime-edit软件包失败" - LOG_INFO "环境清理完成" - else - LOG_INFO "环境保持安装状态" - fi - - LOG_INFO "EMF模型编辑器功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_codegen.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_codegen.sh deleted file mode 100644 index 3b72db1295e..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_codegen.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-09 -# @License : Mulan PSL v2 -# @Desc : 测试eclipse-emf-runtime的代码生成功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查yum源中是否存在eclipse-emf-runtime软件包 - LOG_INFO "检查yum源中是否存在eclipse-emf-runtime软件包" - dnf list available eclipse-emf-runtime &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到eclipse-emf-runtime软件包" - exit 255 - fi - - # 检查是否已安装eclipse-emf-runtime - LOG_INFO "检查是否已安装eclipse-emf-runtime" - rpm -q eclipse-emf-runtime &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "eclipse-emf-runtime已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "eclipse-emf-runtime未安装,开始安装" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime失败" - INSTALLED=false - fi - - # 测试eclipse-emf-runtime的代码生成功能 - LOG_INFO "测试eclipse-emf-runtime的代码生成功能" - emf_codegen_command="eclipse-emf-runtime --generate-code" # 假设命令为--generate-code - $emf_codegen_command - CHECK_RESULT $? 0 0 "执行代码生成命令失败" - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "清理环境:卸载eclipse-emf-runtime" - dnf remove -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "卸载eclipse-emf-runtime失败" - fi - - LOG_INFO "测试脚本执行完毕,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_model.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_model.sh deleted file mode 100644 index 2ad68c6ad98..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_model.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 : 测试eclipse-emf-runtime的模型功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试eclipse-emf-runtime的模型功能" - - # 检查是否已安装eclipse-emf-runtime - if dnf list installed eclipse-emf-runtime &>/dev/null; then - LOG_INFO "eclipse-emf-runtime已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "eclipse-emf-runtime未安装,将在测试完成后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有eclipse-emf-runtime软件包 - LOG_INFO "检查yum源中是否存在eclipse-emf-runtime软件包" - if ! dnf list available eclipse-emf-runtime &>/dev/null; then - LOG_ERROR "yum源中不存在eclipse-emf-runtime软件包" - exit 255 - fi - - # 安装eclipse-emf-runtime(如果未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装eclipse-emf-runtime" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime失败" - fi - - # 测试模型功能 - LOG_INFO "测试eclipse-emf-runtime的模型功能" - emf_command="eclipse-emf-runtime --model-test" # 假设命令为--model-test - $emf_command - CHECK_RESULT $? 0 0 "测试模型功能失败" - - # 清理环境(如果最初未安装) - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载eclipse-emf-runtime" - dnf remove -y eclipse-emf-runtime - CHECK_RESULT $? -1 -1 "卸载eclipse-emf-runtime失败" # 假设卸载成功返回0,失败返回非0 - fi - - LOG_INFO "测试完成,环境已恢复初始状态" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_serialization.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_serialization.sh deleted file mode 100644 index f15f6c414f7..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_serialization.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2025-12-09 -# @License : Mulan PSL v2 -# @Desc : 测试eclipse-emf-runtime的序列化功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试eclipse-emf-runtime的序列化功能" - - # 检查是否已安装eclipse-emf-runtime - if dnf list installed eclipse-emf-runtime &>/dev/null; then - LOG_INFO "eclipse-emf-runtime已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "eclipse-emf-runtime未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有eclipse-emf-runtime - if ! dnf list available eclipse-emf-runtime &>/dev/null; then - LOG_ERROR "yum源中未找到eclipse-emf-runtime软件包" - exit 255 - fi - - # 安装eclipse-emf-runtime - if [ "$INSTALLED" = false ]; then - LOG_INFO "正在安装eclipse-emf-runtime" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime失败" - fi - - # 测试序列化功能 - LOG_INFO "测试eclipse-emf-runtime的序列化功能" - java -cp /usr/share/java/eclipse-emf-runtime.jar org.eclipse.emf.ecore.util.EcoreUtil$Serializable &>/dev/null - CHECK_RESULT $? 0 0 "eclipse-emf-runtime序列化功能测试失败" - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载eclipse-emf-runtime" - dnf remove -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "卸载eclipse-emf-runtime失败" - fi - - LOG_INFO "测试eclipse-emf-runtime的序列化功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_validation.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_validation.sh deleted file mode 100644 index 83d790c788e..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_function_validation.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-09 -# @License : Mulan PSL v2 -# @Desc : 测试eclipse-emf-runtime的验证功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试eclipse-emf-runtime的验证功能" - - # 检查是否已安装eclipse-emf-runtime - LOG_INFO "检查是否已安装eclipse-emf-runtime" - if rpm -q eclipse-emf-runtime &>/dev/null; then - LOG_INFO "eclipse-emf-runtime已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "eclipse-emf-runtime未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有eclipse-emf-runtime软件包 - LOG_INFO "检查yum源中是否有eclipse-emf-runtime软件包" - if ! dnf list available eclipse-emf-runtime &>/dev/null; then - LOG_ERROR "yum源中未找到eclipse-emf-runtime软件包" - exit 255 - fi - - # 安装eclipse-emf-runtime - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装eclipse-emf-runtime" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime失败" - fi - - # 验证eclipse-emf-runtime功能 - LOG_INFO "验证eclipse-emf-runtime功能" - emfruntime_command="emfruntime --version" - if ! command -v emfruntime &>/dev/null; then - LOG_ERROR "emfruntime命令不存在或不支持" - exit 255 - fi - - $emfruntime_command - CHECK_RESULT $? 0 0 "验证eclipse-emf-runtime功能失败" - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载eclipse-emf-runtime" - dnf remove -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "卸载eclipse-emf-runtime失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_model.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_model.sh deleted file mode 100644 index c304ffce4d6..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_model.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试EMF模型创建与加载 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试EMF模型创建与加载脚本 - - LOG_INFO "开始测试EMF模型创建与加载" - - # 定义软件包名称 - PACKAGE_NAME="eclipse-emf-runtime-model" - - # 步骤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 - INSTALLED=$? - - # 步骤3:如果未安装,则安装软件包 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "步骤3:安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - fi - - # 步骤4:验证EMF基本功能 - LOG_INFO "步骤4:验证EMF基本功能" - - # 检查emf命令是否存在 - LOG_INFO "检查emf命令是否存在" - which emf > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "emf命令不存在" - exit 255 - fi - - # 测试emf命令的help参数 - LOG_INFO "测试emf命令的help参数" - emf --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "emf命令help参数测试失败" - - # 步骤5:创建简单的EMF模型 - LOG_INFO "步骤5:创建简单的EMF模型测试文件" - TEST_MODEL_FILE="/tmp/test_emf_model.emf" - cat > ${TEST_MODEL_FILE} << "EOF" - - - - - - - EOF - - CHECK_RESULT $? 0 0 "创建测试EMF模型文件失败" - - # 步骤6:验证模型文件 - LOG_INFO "步骤6:验证创建的EMF模型文件" - if [ -f "${TEST_MODEL_FILE}" ]; then - LOG_INFO "EMF模型文件创建成功:${TEST_MODEL_FILE}" - # 检查文件内容 - grep -q "TestClass" ${TEST_MODEL_FILE} - CHECK_RESULT $? 0 0 "EMF模型文件内容验证失败" - else - LOG_ERROR "EMF模型文件创建失败" - CHECK_RESULT 1 0 0 "EMF模型文件不存在" - fi - - # 步骤7:测试模型加载(模拟) - LOG_INFO "步骤7:模拟EMF模型加载测试" - # 这里模拟模型加载过程,实际环境中可能需要使用EMF工具加载 - MODEL_CONTENT=$(cat ${TEST_MODEL_FILE} | grep -c "TestClass") - if [ ${MODEL_CONTENT} -gt 0 ]; then - LOG_INFO "EMF模型加载测试成功" - else - LOG_ERROR "EMF模型加载测试失败" - CHECK_RESULT 1 0 0 "EMF模型加载失败" - fi - - # 步骤8:清理测试文件 - LOG_INFO "步骤8:清理测试文件" - rm -f ${TEST_MODEL_FILE} - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9:环境恢复 - LOG_INFO "步骤9:环境恢复" - 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 "EMF模型创建与加载测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_registry.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_registry.sh deleted file mode 100644 index 3b9143e29ae..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_registry.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试EMF资源集与注册表 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试EMF资源集与注册表" - - # 定义软件包名称 - PACKAGE_NAME="eclipse-emf-runtime-registry" - - # 步骤1: 检查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 - - # 步骤2: 检查软件包是否已安装 - LOG_INFO "检查软件包是否已安装" - rpm -q $PACKAGE_NAME > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,脚本结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "软件包未安装,将在测试步骤中安装" - INSTALLED=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装软件包: $PACKAGE_NAME" - dnf install -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4: 测试EMF资源集与注册表相关命令 - LOG_INFO "测试EMF资源集与注册表命令" - # 假设测试命令为emf-registry-test,这里仅作示例 - emf-registry-test --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "执行emf-registry-test命令失败" - - # 步骤5: 检查命令参数是否支持 - LOG_INFO "检查命令参数是否支持" - emf-registry-test --invalid-option > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "命令参数不存在或不支持" - exit 255 - fi - - # 步骤6: 在第二个服务器上执行命令(如果需要) - LOG_INFO "在第二个服务器上执行测试命令" - SSH_CMD "emf-registry-test --version" $NODE2_IPV4 $NODE2_PASSWORD $NODE2_USER - CHECK_RESULT $? 0 0 "在第二个服务器上执行命令失败" - - # 步骤7: 环境恢复 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载软件包: $PACKAGE_NAME" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "软件包已安装,保持安装状态" - fi - - LOG_INFO "测试EMF资源集与注册表完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_serialize.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_serialize.sh deleted file mode 100644 index 518e5508c9e..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_serialize.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试EMF模型序列化与反序列化 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试EMF模型序列化与反序列化 - - # 检查是否已经安装eclipse-emf-runtime包 - LOG_INFO "检查eclipse-emf-runtime是否已安装" - rpm -q eclipse-emf-runtime > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "eclipse-emf-runtime已安装,测试结束后保持安装状态" - already_installed=true - else - LOG_INFO "eclipse-emf-runtime未安装,将在测试前安装" - already_installed=false - fi - - # 检查yum源中是否有eclipse-emf-runtime包 - LOG_INFO "检查yum源中是否有eclipse-emf-runtime包" - dnf list available eclipse-emf-runtime > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到eclipse-emf-runtime包" - - # 如果未安装,则安装软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "安装eclipse-emf-runtime包" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime包失败" - fi - - # 检查serialize命令是否存在 - LOG_INFO "检查serialize命令是否存在" - command -v serialize > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "serialize命令不存在" - exit 255 - fi - - # 检查serialize命令是否支持--help参数 - LOG_INFO "检查serialize命令是否支持--help参数" - serialize --help > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "serialize命令不支持--help参数" - exit 255 - fi - - # 创建测试EMF模型文件 - LOG_INFO "创建测试EMF模型文件" - cat > test_model.emf << "EOF" - - - - - - - - EOF - CHECK_RESULT $? 0 0 "创建测试EMF模型文件失败" - - # 序列化EMF模型 - LOG_INFO "序列化EMF模型" - serialize test_model.emf test_model.serialized - CHECK_RESULT $? 0 0 "EMF模型序列化失败" - - # 检查序列化文件是否存在 - LOG_INFO "检查序列化文件是否存在" - [ -f test_model.serialized ] - CHECK_RESULT $? 0 0 "序列化文件未生成" - - # 反序列化EMF模型 - LOG_INFO "反序列化EMF模型" - serialize --deserialize test_model.serialized test_model_deserialized.emf - CHECK_RESULT $? 0 0 "EMF模型反序列化失败" - - # 检查反序列化文件是否存在 - LOG_INFO "检查反序列化文件是否存在" - [ -f test_model_deserialized.emf ] - CHECK_RESULT $? 0 0 "反序列化文件未生成" - - # 比较原始模型和反序列化后的模型 - LOG_INFO "比较原始模型和反序列化后的模型" - diff test_model.emf test_model_deserialized.emf > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "原始模型与反序列化后的模型不一致" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f test_model.emf test_model.serialized test_model_deserialized.emf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "卸载eclipse-emf-runtime包" - dnf remove -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "卸载eclipse-emf-runtime包失败" - fi - - LOG_INFO "EMF模型序列化与反序列化测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_uninstall.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_uninstall.sh deleted file mode 100644 index 0546059f4c4..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_uninstall.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-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试eclipse-emf-runtime软件包的卸载功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试eclipse-emf-runtime软件包卸载功能 - - LOG_INFO "=== 开始测试eclipse-emf-runtime软件包卸载功能 ===" - - # 检查软件包是否在yum源中 - LOG_INFO "1. 检查eclipse-emf-runtime软件包是否在yum源中" - dnf list available eclipse-emf-runtime > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "eclipse-emf-runtime软件包不在yum源中" - exit 255 - fi - LOG_INFO "eclipse-emf-runtime软件包在yum源中" - - # 检查当前是否已安装 - LOG_INFO "2. 检查当前是否已安装eclipse-emf-runtime软件包" - rpm -q eclipse-emf-runtime > /dev/null 2>&1 - INSTALLED=$? - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "检测到eclipse-emf-runtime已安装,测试后将保持安装状态" - NEED_CLEANUP=0 - else - LOG_INFO "eclipse-emf-runtime未安装,将进行安装测试" - NEED_CLEANUP=1 - fi - - # 如果未安装,则先安装软件包 - if [ $NEED_CLEANUP -eq 1 ]; then - LOG_INFO "3. 安装eclipse-emf-runtime软件包" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime失败" - LOG_INFO "安装eclipse-emf-runtime成功" - fi - - # 验证软件包已安装 - LOG_INFO "4. 验证eclipse-emf-runtime软件包已安装" - rpm -q eclipse-emf-runtime - CHECK_RESULT $? 0 0 "验证eclipse-emf-runtime安装状态失败" - - # 测试卸载功能 - LOG_INFO "5. 测试卸载eclipse-emf-runtime软件包" - dnf remove -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "卸载eclipse-emf-runtime失败" - LOG_INFO "卸载eclipse-emf-runtime成功" - - # 验证软件包已卸载 - LOG_INFO "6. 验证eclipse-emf-runtime软件包已卸载" - rpm -q eclipse-emf-runtime > /dev/null 2>&1 - CHECK_RESULT $? 1 0 "验证eclipse-emf-runtime卸载状态失败" - LOG_INFO "验证eclipse-emf-runtime已成功卸载" - - # 环境恢复:如果测试前未安装,则保持未安装状态 - # 如果测试前已安装,则需要重新安装 - LOG_INFO "7. 恢复测试环境" - if [ $NEED_CLEANUP -eq 1 ]; then - LOG_INFO "测试前未安装eclipse-emf-runtime,无需恢复安装" - else - LOG_INFO "测试前已安装eclipse-emf-runtime,重新安装以恢复环境" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "恢复安装eclipse-emf-runtime失败" - LOG_INFO "恢复安装eclipse-emf-runtime成功" - - # 验证恢复后的安装状态 - rpm -q eclipse-emf-runtime - CHECK_RESULT $? 0 0 "验证恢复后的eclipse-emf-runtime安装状态失败" - LOG_INFO "环境恢复完成,eclipse-emf-runtime已重新安装" - fi - - LOG_INFO "=== eclipse-emf-runtime软件包卸载功能测试完成 ===" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_validation.sh b/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_validation.sh deleted file mode 100644 index d3f0a894aef..00000000000 --- a/testcases/function_test/pkg_test/eclipse-emf/eclipse-emf-runtime/test_eclipse-emf-runtime_validation.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-02-25 -# @License : Mulan PSL v2 -# @Desc : 测试EMF模型验证功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试EMF模型验证功能" - LOG_INFO "步骤1: 检查当前环境是否已安装eclipse-emf-runtime软件包" - if rpm -q eclipse-emf-runtime &> /dev/null; then - LOG_INFO "eclipse-emf-runtime已安装,测试完成后将保持安装状态" - INSTALLED=true - else - LOG_INFO "eclipse-emf-runtime未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2: 检查yum源中是否有eclipse-emf-runtime软件包" - if ! dnf list available eclipse-emf-runtime &> /dev/null; then - LOG_ERROR "yum源中未找到eclipse-emf-runtime软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装eclipse-emf-runtime软件包" - dnf install -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "安装eclipse-emf-runtime失败" - fi - - LOG_INFO "步骤4: 检查eclipse-emf-runtime命令参数支持" - if ! eclipse-emf-runtime --help &> /dev/null; then - LOG_ERROR "eclipse-emf-runtime命令参数不支持" - if [ "$INSTALLED" = false ]; then - dnf remove -y eclipse-emf-runtime - fi - exit 255 - fi - - LOG_INFO "步骤5: 执行EMF模型验证功能测试" - eclipse-emf-runtime validate --test-model - CHECK_RESULT $? 0 0 "EMF模型验证功能测试失败" - - LOG_INFO "步骤6: 清理测试环境" - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载测试安装的eclipse-emf-runtime软件包" - dnf remove -y eclipse-emf-runtime - CHECK_RESULT $? 0 0 "卸载eclipse-emf-runtime失败" - else - LOG_INFO "保持原有eclipse-emf-runtime安装状态" - fi - - LOG_INFO "EMF模型验证功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_file_check.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_file_check.sh deleted file mode 100644 index 5b60ea04ee1..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_file_check.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令检查文件类型 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:grub2-file命令检查文件类型功能" - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "步骤1:检查yum源中是否存在grub2-tools软件包" - if ! dnf list available grub2-tools 2>/dev/null | grep -q grub2-tools; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 检查grub2-file命令是否已安装 - LOG_INFO "步骤2:检查grub2-file命令是否已安装" - if command -v grub2-file &>/dev/null; then - LOG_INFO "grub2-file命令已安装,测试结束后将保持安装状态" - already_installed=true - else - LOG_INFO "grub2-file命令未安装,将进行安装" - already_installed=false - fi - - # 如果未安装,则安装grub2-tools - if [ "$already_installed" = false ]; then - LOG_INFO "步骤3:安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-file命令是否支持--is-x86-multiboot2参数 - LOG_INFO "步骤4:检查grub2-file命令是否支持--is-x86-multiboot2参数" - if ! grub2-file --help 2>&1 | grep -q -- "--is-x86-multiboot2"; then - LOG_ERROR "grub2-file命令不支持--is-x86-multiboot2参数" - exit 255 - fi - - # 创建一个临时测试文件 - LOG_INFO "步骤5:创建一个临时测试文件用于检查" - test_file=$(mktemp) - echo "dummy content" > "$test_file" - - # 使用grub2-file命令检查文件类型 - LOG_INFO "步骤6:使用grub2-file命令检查文件类型" - grub2-file --is-x86-multiboot2 "$test_file" - CHECK_RESULT $? 1 0 "grub2-file命令执行失败或返回结果不符合预期" - - # 清理临时文件 - LOG_INFO "步骤7:清理临时测试文件" - rm -f "$test_file" - - # 如果测试前未安装,则卸载软件包 - if [ "$already_installed" = false ]; then - LOG_INFO "步骤8:卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成:grub2-file命令检查文件类型功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_install_boot.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_install_boot.sh deleted file mode 100644 index 830970dca47..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_install_boot.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-install命令安装引导程序 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试grub2-install命令安装引导程序功能" - - # 定义软件包名称 - PACKAGE_NAME="grub2-tools" - - # 检查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 - if [ $? -eq 0 ]; then - LOG_INFO "检测到${PACKAGE_NAME}已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "检测到${PACKAGE_NAME}未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 如果未安装,则安装软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "开始安装${PACKAGE_NAME}软件包" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}软件包失败" - LOG_INFO "${PACKAGE_NAME}软件包安装成功" - fi - - # 检查grub2-install命令是否存在 - LOG_INFO "检查grub2-install命令是否存在" - command -v grub2-install > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-install命令不存在" - - # 测试grub2-install命令的--help参数 - LOG_INFO "测试grub2-install命令的--help参数" - grub2-install --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-install命令不支持--help参数" - - # 测试grub2-install命令的不支持的参数 - LOG_INFO "测试grub2-install命令的不支持的参数" - grub2-install --invalid-param > /dev/null 2>&1 - if [ $? -ne 255 ] && [ $? -ne 1 ]; then - LOG_ERROR "grub2-install命令对不支持的参数处理异常" - exit 255 - fi - LOG_INFO "grub2-install命令对不支持的参数处理正常" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "${INSTALLED}" = "false" ]; then - LOG_INFO "开始卸载${PACKAGE_NAME}软件包" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}软件包失败" - LOG_INFO "${PACKAGE_NAME}软件包卸载成功" - else - LOG_INFO "测试前已安装${PACKAGE_NAME},保持安装状态" - fi - - LOG_INFO "grub2-install命令安装引导程序功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_uninstall.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_uninstall.sh deleted file mode 100644 index de72c971c47..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_function_uninstall.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试软件包的卸载功能,确保卸载过程正确无误 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools - LOG_INFO "检查grub2-tools是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - INSTALLED=$? - - # 记录初始安装状态 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "grub2-tools已安装,测试后保持安装状态" - INITIAL_STATE="installed" - else - LOG_INFO "grub2-tools未安装,测试后需要卸载" - INITIAL_STATE="not_installed" - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 验证软件包已正确安装 - LOG_INFO "验证grub2-tools软件包已正确安装" - rpm -q grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-tools软件包未正确安装" - - # 验证grub2-tools相关命令是否可用 - LOG_INFO "验证grub2-tools相关命令是否可用" - grub2-editenv --version > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-editenv命令不可用" - - # 测试卸载功能 - LOG_INFO "测试卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - - # 验证软件包已卸载 - LOG_INFO "验证grub2-tools软件包已卸载" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "grub2-tools软件包卸载失败" - exit 1 - fi - LOG_INFO "grub2-tools软件包卸载成功" - - # 验证相关命令已不可用 - LOG_INFO "验证grub2-tools相关命令已不可用" - grub2-editenv --version > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "grub2-editenv命令仍然可用" - exit 1 - fi - LOG_INFO "grub2-editenv命令已不可用" - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ "$INITIAL_STATE" = "installed" ]; then - LOG_INFO "重新安装grub2-tools以恢复初始状态" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "重新安装grub2-tools失败" - - LOG_INFO "验证grub2-tools已重新安装" - rpm -q grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-tools未正确重新安装" - else - LOG_INFO "初始状态为未安装,无需重新安装" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-arm-linux.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-arm-linux.sh deleted file mode 100644 index 119528e632e..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-arm-linux.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-arm-linux参数,验证是否能检查文件是否为ARM Linux内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools软件包 - LOG_INFO "检查是否已安装grub2-tools软件包" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools软件包已安装" - INSTALLED_FLAG=1 - else - LOG_INFO "grub2-tools软件包未安装" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有grub2-tools软件包" - exit 255 - fi - - # 如果未安装则安装软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - # 检查grub2-file命令是否存在 - LOG_INFO "检查grub2-file命令是否存在" - command -v grub2-file > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-file命令不存在" - - # 检查--is-arm-linux参数是否支持 - LOG_INFO "检查--is-arm-linux参数是否支持" - grub2-file --help | grep -q "\-\-is-arm-linux" - if [ $? -ne 0 ]; then - LOG_ERROR "--is-arm-linux参数不存在或不支持" - exit 255 - fi - - # 创建测试用的ARM Linux内核文件 - LOG_INFO "创建测试用的ARM Linux内核文件" - TEST_KERNEL="/tmp/test_arm_kernel" - cat > $TEST_KERNEL << "EOF" - ARM Linux kernel test file - EOF - CHECK_RESULT $? 0 0 "创建测试文件失败" - - # 测试grub2-file --is-arm-linux命令 - LOG_INFO "测试grub2-file --is-arm-linux命令" - grub2-file --is-arm-linux $TEST_KERNEL - CHECK_RESULT $? 1 0 "对非ARM Linux内核文件的检查结果不符合预期" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f $TEST_KERNEL - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装,则卸载软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-arm64-linux.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-arm64-linux.sh deleted file mode 100644 index 7eebba426c9..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-arm64-linux.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-arm64-linux参数,验证是否能检查文件是否为ARM64 Linux内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools - LOG_INFO "检查是否已安装grub2-tools" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到grub2-tools软件包" - - # 安装grub2-tools(如果未安装) - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-file命令是否存在 - LOG_INFO "检查grub2-file命令是否存在" - which grub2-file > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "grub2-file命令不存在" - - # 检查grub2-file是否支持--is-arm64-linux参数 - LOG_INFO "检查grub2-file是否支持--is-arm64-linux参数" - grub2-file --help | grep -q "\-\-is-arm64-linux" - CHECK_RESULT $? 0 255 "grub2-file不支持--is-arm64-linux参数" - - # 创建测试用的ARM64 Linux内核文件(模拟) - LOG_INFO "创建测试用的ARM64 Linux内核文件(模拟)" - echo "ARM64 Linux kernel test file" > /tmp/test_arm64_kernel - # 注意:实际测试应使用真实的ARM64内核文件,这里仅作演示 - - # 测试grub2-file --is-arm64-linux参数 - LOG_INFO "测试grub2-file --is-arm64-linux参数" - grub2-file --is-arm64-linux /tmp/test_arm64_kernel - # 由于是模拟文件,预期可能失败,这里仅检查命令执行是否成功 - CHECK_RESULT $? 0 0 "grub2-file --is-arm64-linux执行失败" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test_arm64_kernel - - # 如果脚本开始时未安装grub2-tools,则卸载 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "保持grub2-tools安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-i386-efi.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-i386-efi.sh deleted file mode 100644 index d3c3f6a1534..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-i386-efi.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-i386-efi参数,验证是否能检查文件是否为i386 EFI文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义变量 - PACKAGE_NAME="grub2-tools" - COMMAND="grub2-file" - PARAMETER="--is-i386-efi" - TEST_FILE="/boot/efi/EFI/openeuler/grubia32.efi" - - # 检查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_parameter() { - LOG_INFO "检查命令 $COMMAND 是否支持参数 $PARAMETER" - $COMMAND --help 2>&1 | grep -q "$PARAMETER" - if [ $? -ne 0 ]; then - LOG_ERROR "命令 $COMMAND 不支持参数 $PARAMETER" - exit 255 - fi - LOG_INFO "命令 $COMMAND 支持参数 $PARAMETER" - } - - # 检查软件包是否已安装 - check_package_installed() { - LOG_INFO "检查软件包 $PACKAGE_NAME 是否已安装" - rpm -q $PACKAGE_NAME &> /dev/null - return $? - } - - # 安装软件包 - 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_test_file() { - LOG_INFO "检查测试文件是否存在: $TEST_FILE" - if [ ! -f "$TEST_FILE" ]; then - LOG_ERROR "测试文件 $TEST_FILE 不存在" - exit 1 - fi - LOG_INFO "测试文件 $TEST_FILE 存在" - } - - # 执行测试 - run_test() { - LOG_INFO "执行测试: $COMMAND $PARAMETER $TEST_FILE" - $COMMAND $PARAMETER "$TEST_FILE" - CHECK_RESULT $? 0 0 "检查文件是否为i386 EFI文件失败" - LOG_INFO "测试成功: 文件 $TEST_FILE 是i386 EFI文件" - } - - # 主函数 - main() { - # 检查yum源中是否存在软件包 - check_package_in_repo - - # 检查命令是否支持指定参数 - check_command_parameter - - # 检查软件包是否已安装 - local was_installed=0 - check_package_installed - if [ $? -eq 0 ]; then - LOG_INFO "软件包 $PACKAGE_NAME 已安装" - was_installed=1 - else - LOG_INFO "软件包 $PACKAGE_NAME 未安装,开始安装" - install_package - fi - - # 检查测试文件是否存在 - check_test_file - - # 执行测试 - run_test - - # 环境恢复 - LOG_INFO "开始环境恢复" - if [ $was_installed -eq 0 ]; then - uninstall_package - else - LOG_INFO "保持软件包 $PACKAGE_NAME 的安装状态" - fi - LOG_INFO "环境恢复完成" - } - - # 执行主函数 - main -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-i386-knetbsd.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-i386-knetbsd.sh deleted file mode 100644 index adc1ba55ebf..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-i386-knetbsd.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-i386-knetbsd参数,验证是否能检查文件是否为i386 kNetBSD内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试grub2-file命令的--is-i386-knetbsd参数功能" - LOG_INFO "步骤1:检查系统中是否已安装grub2-tools软件包" - if rpm -q grub2-tools > /dev/null 2>&1; then - LOG_INFO "检测到grub2-tools已安装,测试完成后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "未检测到grub2-tools安装" - INSTALLED=0 - fi - - LOG_INFO "步骤2:检查yum源中是否存在grub2-tools软件包" - if dnf list available grub2-tools --quiet > /dev/null 2>&1; then - LOG_INFO "yum源中存在grub2-tools软件包" - else - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "步骤3:安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - LOG_INFO "步骤4:验证grub2-file命令是否支持--is-i386-knetbsd参数" - grub2-file --help | grep -q "\-\-is-i386-knetbsd" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-file命令不支持--is-i386-knetbsd参数" - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "清理环境:卸载测试安装的grub2-tools软件包" - dnf remove -y grub2-tools - fi - exit 255 - fi - - LOG_INFO "步骤5:创建一个临时测试文件用于验证参数功能" - TEST_FILE=$(mktemp /tmp/test_kernel.XXXXXX) - cat > ${TEST_FILE} << "EOF" - 这是一个无效的测试文件内容,用于模拟非i386 kNetBSD内核。 - EOF - CHECK_RESULT $? 0 0 "创建临时测试文件失败" - - LOG_INFO "步骤6:对非i386 kNetBSD内核文件使用--is-i386-knetbsd参数进行测试" - grub2-file --is-i386-knetbsd ${TEST_FILE} - CHECK_RESULT $? 1 0 "对非i386 kNetBSD内核文件的检查结果不符合预期(应失败)" - - LOG_INFO "步骤7:清理临时测试文件" - rm -f ${TEST_FILE} - CHECK_RESULT $? 0 0 "删除临时测试文件失败" - - LOG_INFO "步骤8:测试完成,根据初始状态恢复环境" - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "清理环境:卸载测试安装的grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - else - LOG_INFO "环境保持原状:grub2-tools软件包保持安装" - fi - - LOG_INFO "grub2-file命令--is-i386-knetbsd参数功能测试结束" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-ia64-efi.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-ia64-efi.sh deleted file mode 100644 index 94ebe91ce20..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-ia64-efi.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-ia64-efi参数,验证是否能检查文件是否为IA64 EFI文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 环境检查:检查是否已安装grub2-tools - LOG_INFO "检查是否已安装grub2-tools" - if dnf list installed grub2-tools &>/dev/null; then - LOG_INFO "grub2-tools已安装,测试结束后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - INSTALLED_BEFORE_TEST=false - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - if ! dnf list available grub2-tools &>/dev/null; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 安装软件包(如果未安装) - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-file命令是否存在 - LOG_INFO "检查grub2-file命令是否存在" - command -v grub2-file >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-file命令未找到" - - # 检查--is-ia64-efi参数是否支持 - LOG_INFO "检查grub2-file命令是否支持--is-ia64-efi参数" - if ! grub2-file --help 2>&1 | grep -q -- "--is-ia64-efi"; then - LOG_ERROR "grub2-file命令不支持--is-ia64-efi参数" - exit 255 - fi - - # 创建测试文件 - LOG_INFO "创建测试文件" - TEST_DIR=$(mktemp -d) - IA64_EFI_FILE="$TEST_DIR/test.efi" - NON_IA64_FILE="$TEST_DIR/test.txt" - - # 创建一个假的IA64 EFI文件(使用dd创建特定格式的文件,这里仅模拟) - dd if=/dev/zero of="$IA64_EFI_FILE" bs=1 count=64 2>/dev/null - echo "This is not an IA64 EFI file" > "$NON_IA64_FILE" - - # 测试1:检查IA64 EFI文件 - LOG_INFO "测试grub2-file --is-ia64-efi检查IA64 EFI文件" - grub2-file --is-ia64-efi "$IA64_EFI_FILE" - CHECK_RESULT $? 0 0 "grub2-file未能正确识别IA64 EFI文件" - - # 测试2:检查非IA64 EFI文件 - LOG_INFO "测试grub2-file --is-ia64-efi检查非IA64 EFI文件" - grub2-file --is-ia64-efi "$NON_IA64_FILE" - CHECK_RESULT $? 1 0 "grub2-file错误地将非IA64 EFI文件识别为IA64 EFI文件" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -rf "$TEST_DIR" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-mipsel-linux.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-mipsel-linux.sh deleted file mode 100644 index ea9547d2344..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-mipsel-linux.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-mipsel-linux参数,验证是否能检查文件是否为MIPSEL Linux内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "1. 检查grub2-tools软件包是否在yum源中" - if ! dnf list available grub2-tools 2>/dev/null | grep -q grub2-tools; then - LOG_ERROR "grub2-tools软件包不在yum源中" - exit 255 - fi - - LOG_INFO "2. 检查当前是否已安装grub2-tools" - if rpm -q grub2-tools &>/dev/null; then - INSTALLED="yes" - LOG_INFO "grub2-tools已安装,测试结束后将保持安装状态" - else - INSTALLED="no" - LOG_INFO "grub2-tools未安装,将作为测试步骤安装" - fi - - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "3. 安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - LOG_INFO "4. 检查grub2-file命令是否支持--is-mipsel-linux参数" - if ! grub2-file --help 2>&1 | grep -q -- "--is-mipsel-linux"; then - LOG_ERROR "grub2-file命令不支持--is-mipsel-linux参数" - exit 255 - fi - - LOG_INFO "5. 创建测试文件" - TEST_FILE="$(mktemp)" - echo "test content" > "$TEST_FILE" - - LOG_INFO "6. 测试非MIPSEL Linux内核文件" - grub2-file --is-mipsel-linux "$TEST_FILE" - CHECK_RESULT $? 1 0 "对非MIPSEL Linux内核文件检查结果不正确" - - LOG_INFO "7. 清理测试文件" - rm -f "$TEST_FILE" - - LOG_INFO "8. 测试真实MIPSEL Linux内核文件(如果存在)" - if [ -f /boot/vmlinuz-* ]; then - KERNEL_FILE="$(ls /boot/vmlinuz-* | head -1)" - LOG_INFO "使用内核文件: $KERNEL_FILE" - grub2-file --is-mipsel-linux "$KERNEL_FILE" - # 注意:这里不检查具体返回值,因为当前架构可能不是MIPSEL - LOG_INFO "MIPSEL检查完成(返回值取决于当前架构)" - else - LOG_INFO "未找到内核文件,跳过真实内核测试" - fi - - LOG_INFO "9. 环境清理" - if [ "$INSTALLED" = "no" ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "保持grub2-tools安装状态" - fi - - LOG_INFO "10. 测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86-knetbsd.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86-knetbsd.sh deleted file mode 100644 index 6536f735a64..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86-knetbsd.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-x86-knetbsd参数,验证是否能检查文件是否为x86 kNetBSD内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools软件包 - LOG_INFO "检查grub2-tools软件包是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools软件包已安装" - INSTALLED="true" - else - LOG_INFO "grub2-tools软件包未安装" - INSTALLED="false" - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "开始安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - # 验证grub2-file命令是否支持--is-x86-knetbsd参数 - LOG_INFO "验证grub2-file命令是否支持--is-x86-knetbsd参数" - grub2-file --help | grep -q "\-\-is-x86-knetbsd" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-file命令不支持--is-x86-knetbsd参数" - exit 255 - fi - - # 创建测试文件 - LOG_INFO "创建测试文件" - TEST_FILE="/tmp/test_kernel" - cat > "$TEST_FILE" << "EOF" - 这是一个测试文件,不是x86 kNetBSD内核 - EOF - CHECK_RESULT $? 0 0 "创建测试文件失败" - - # 测试非x86 kNetBSD内核文件 - LOG_INFO "测试非x86 kNetBSD内核文件" - grub2-file --is-x86-knetbsd "$TEST_FILE" - CHECK_RESULT $? 1 0 "对非x86 kNetBSD内核文件检查结果不符合预期" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f "$TEST_FILE" - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装软件包,则在结束时卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86-linux.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86-linux.sh deleted file mode 100644 index 204710b405b..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86-linux.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-x86-linux参数,验证是否能检查文件是否为x86 Linux内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools软件包 - LOG_INFO "检查是否已安装grub2-tools软件包" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools软件包已安装,测试结束后将保持安装状态" - INSTALLED="true" - else - LOG_INFO "grub2-tools软件包未安装,将在测试过程中安装" - INSTALLED="false" - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到grub2-tools软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools软件包 - if [ "${INSTALLED}" == "false" ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - # 检查grub2-file命令是否支持--is-x86-linux参数 - LOG_INFO "检查grub2-file命令是否支持--is-x86-linux参数" - grub2-file --help | grep -q "\-\-is-x86-linux" - CHECK_RESULT $? 0 0 "grub2-file命令不支持--is-x86-linux参数" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-file命令不支持--is-x86-linux参数" - exit 255 - fi - - # 创建测试用的x86 Linux内核文件 - LOG_INFO "创建测试用的x86 Linux内核文件" - cat > /tmp/test_x86_kernel << EOF - - echo "This is a dummy x86 Linux kernel file" - EOF - chmod +x /tmp/test_x86_kernel - - # 测试grub2-file命令的--is-x86-linux参数对x86 Linux内核文件的识别 - LOG_INFO "测试grub2-file命令的--is-x86-linux参数对x86 Linux内核文件的识别" - grub2-file --is-x86-linux /tmp/test_x86_kernel - CHECK_RESULT $? 0 1 "grub2-file命令未能正确识别x86 Linux内核文件" - - # 创建测试用的非x86 Linux内核文件 - LOG_INFO "创建测试用的非x86 Linux内核文件" - cat > /tmp/test_non_kernel << EOF - This is not a kernel file - EOF - - # 测试grub2-file命令的--is-x86-linux参数对非x86 Linux内核文件的识别 - LOG_INFO "测试grub2-file命令的--is-x86-linux参数对非x86 Linux内核文件的识别" - grub2-file --is-x86-linux /tmp/test_non_kernel - CHECK_RESULT $? 1 0 "grub2-file命令错误地将非x86 Linux内核文件识别为x86 Linux内核文件" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/test_x86_kernel /tmp/test_non_kernel - - # 如果测试前未安装,则卸载grub2-tools软件包 - if [ "${INSTALLED}" == "false" ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-efi.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-efi.sh deleted file mode 100644 index 2ceb20066c3..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-efi.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-x86_64-efi参数,验证是否能检查文件是否为x86_64 EFI文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - # 检查软件包是否在yum源中 - check_package_in_repo() { - local package_name=$1 - 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} 在yum源中" - } - - # 检查命令参数是否支持 - check_command_param() { - local command=$1 - local param=$2 - LOG_INFO "检查命令 ${command} 是否支持参数 ${param}" - if ! ${command} --help 2>&1 | grep -q -- "${param}"; then - LOG_ERROR "命令 ${command} 不支持参数 ${param}" - exit 255 - fi - LOG_INFO "命令 ${command} 支持参数 ${param}" - } - - # 检查环境是否已安装grub2-tools - LOG_INFO "检查环境是否已安装grub2-tools" - if rpm -q grub2-tools &>/dev/null; then - LOG_INFO "grub2-tools 已安装" - already_installed=true - else - LOG_INFO "grub2-tools 未安装" - already_installed=false - fi - - # 如果需要安装,则安装软件包 - if [ "${already_installed}" = "false" ]; then - LOG_INFO "开始安装grub2-tools" - check_package_in_repo "grub2-tools" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - LOG_INFO "安装grub2-tools成功" - fi - - # 检查grub2-file命令是否支持--is-x86_64-efi参数 - check_command_param "grub2-file" "--is-x86_64-efi" - - # 测试步骤1:检查有效的x86_64 EFI文件 - LOG_INFO "测试步骤1:检查有效的x86_64 EFI文件" - # 创建一个临时的EFI文件用于测试 - temp_efi_file=$(mktemp) - # 使用grub2-mkimage生成一个简单的EFI文件 - grub2-mkimage -O x86_64-efi -o "${temp_efi_file}" halt - CHECK_RESULT $? 0 0 "生成测试EFI文件失败" - - grub2-file --is-x86_64-efi "${temp_efi_file}" - CHECK_RESULT $? 0 0 "检查有效的x86_64 EFI文件失败" - LOG_INFO "有效的x86_64 EFI文件检查成功" - - # 清理临时文件 - rm -f "${temp_efi_file}" - - # 测试步骤2:检查非EFI文件 - LOG_INFO "测试步骤2:检查非EFI文件" - temp_non_efi_file=$(mktemp) - echo "This is not an EFI file" > "${temp_non_efi_file}" - - grub2-file --is-x86_64-efi "${temp_non_efi_file}" - # 预期非EFI文件检查应该失败(返回非0) - if [ $? -eq 0 ]; then - LOG_ERROR "非EFI文件错误地识别为EFI文件" - exit 1 - fi - LOG_INFO "非EFI文件检查成功(正确识别为非EFI文件)" - - # 清理临时文件 - rm -f "${temp_non_efi_file}" - - # 测试步骤3:检查不存在的文件 - LOG_INFO "测试步骤3:检查不存在的文件" - non_existent_file="/tmp/nonexistent_efi_file_$(date +%s)" - grub2-file --is-x86_64-efi "${non_existent_file}" - # 预期不存在的文件检查应该失败(返回非0) - if [ $? -eq 0 ]; then - LOG_ERROR "不存在的文件错误地识别为EFI文件" - exit 1 - fi - LOG_INFO "不存在的文件检查成功(正确识别为不存在的文件)" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ "${already_installed}" = "false" ]; then - LOG_INFO "开始卸载grub2-tools" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - LOG_INFO "卸载grub2-tools成功" - else - LOG_INFO "测试前已安装grub2-tools,保持安装状态" - fi - - LOG_INFO "测试完成:grub2-file命令的--is-x86_64-efi参数功能正常" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-kfreebsd.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-kfreebsd.sh deleted file mode 100644 index e8a6df3667c..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-kfreebsd.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-x86_64-kfreebsd参数,验证是否能检查文件是否为x86_64 kFreeBSD内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试grub2-file命令的--is-x86_64-kfreebsd参数" - LOG_INFO "步骤1: 检查grub2-tools软件包是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools软件包已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-tools软件包未安装,测试前将进行安装" - INSTALLED=0 - fi - - LOG_INFO "步骤2: 检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - LOG_INFO "步骤4: 检查grub2-file命令是否支持--is-x86_64-kfreebsd参数" - grub2-file --help 2>&1 | grep -q "\-\-is\-x86_64\-kfreebsd" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-file命令不支持--is-x86_64-kfreebsd参数" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "清理环境:卸载grub2-tools软件包" - dnf remove -y grub2-tools - fi - exit 255 - fi - - LOG_INFO "步骤5: 创建一个临时文件用于测试" - TEST_FILE=$(mktemp) - cat > $TEST_FILE << EOF - 这是一个测试文件 - EOF - - LOG_INFO "步骤6: 测试非x86_64 kFreeBSD内核文件" - grub2-file --is-x86_64-kfreebsd $TEST_FILE - CHECK_RESULT $? 1 0 "错误地将普通文件识别为x86_64 kFreeBSD内核" - - LOG_INFO "步骤7: 清理临时文件" - rm -f $TEST_FILE - CHECK_RESULT $? 0 0 "删除临时文件失败" - - LOG_INFO "步骤8: 测试x86_64 kFreeBSD内核文件" - KERNEL_FILE="/usr/lib/grub/x86_64-kfreebsd/kernel" - if [ -f $KERNEL_FILE ]; then - grub2-file --is-x86_64-kfreebsd $KERNEL_FILE - CHECK_RESULT $? 0 0 "未能正确识别x86_64 kFreeBSD内核文件" - else - LOG_INFO "未找到x86_64 kFreeBSD内核文件,跳过此测试" - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤9: 清理环境:卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-knetbsd.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-knetbsd.sh deleted file mode 100644 index fc14cb9a3c1..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-x86_64-knetbsd.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-x86_64-knetbsd参数,验证是否能检查文件是否为x86_64 kNetBSD内核 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已经安装grub2-tools - LOG_INFO "检查是否已安装grub2-tools软件包" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到grub2-tools软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-file命令是否支持--is-x86_64-knetbsd参数 - LOG_INFO "检查grub2-file命令是否支持--is-x86_64-knetbsd参数" - grub2-file --help | grep -q "\-\-is-x86_64-knetbsd" - CHECK_RESULT $? 0 0 "grub2-file命令不支持--is-x86_64-knetbsd参数" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-file命令不支持--is-x86_64-knetbsd参数" - # 清理环境 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试文件 - LOG_INFO "创建测试文件" - echo "test file for x86_64 kNetBSD" > /tmp/test_knetbsd - echo "test file for other format" > /tmp/test_other - - # 测试非x86_64 kNetBSD文件 - LOG_INFO "测试非x86_64 kNetBSD文件" - grub2-file --is-x86_64-knetbsd /tmp/test_other - CHECK_RESULT $? 1 0 "错误地将普通文件识别为x86_64 kNetBSD内核" - - # 测试x86_64 kNetBSD内核文件(模拟) - LOG_INFO "创建模拟的x86_64 kNetBSD内核文件" - # 这里我们创建一个具有kNetBSD魔数的文件 - echo -ne "\x1f\x8b" > /tmp/test_knetbsd_kernel - grub2-file --is-x86_64-knetbsd /tmp/test_knetbsd_kernel - # 注意:由于我们创建的是模拟文件,实际可能不会被识别为kNetBSD内核 - # 这里主要测试命令执行是否成功 - CHECK_RESULT $? 0 1 "检查x86_64 kNetBSD内核文件失败" - - # 测试不存在的文件 - LOG_INFO "测试不存在的文件" - grub2-file --is-x86_64-knetbsd /tmp/nonexistent_file - CHECK_RESULT $? 0 1 "对不存在的文件检查时未返回错误" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test_knetbsd /tmp/test_other /tmp/test_knetbsd_kernel - - # 环境恢复 - LOG_INFO "恢复测试环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "保持grub2-tools软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-xnu-hibr.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-xnu-hibr.sh deleted file mode 100644 index bd1fa8b3e2b..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-file_is-xnu-hibr.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-file命令的--is-xnu-hibr参数,验证是否能检查文件是否为XNU (Mac OS X内核)休眠镜像 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试grub2-file命令的--is-xnu-hibr参数" - - LOG_INFO "步骤1: 检查grub2-tools软件包是否已在yum源中" - if ! dnf list available grub2-tools &>/dev/null; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查系统是否已安装grub2-tools" - if rpm -q grub2-tools &>/dev/null; then - LOG_INFO "检测到grub2-tools已安装,标记为已安装状态" - ALREADY_INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,将进行安装" - ALREADY_INSTALLED=0 - fi - - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤3: 安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - LOG_INFO "步骤4: 验证grub2-file命令是否支持--is-xnu-hibr参数" - if ! grub2-file --help 2>&1 | grep -q -- "--is-xnu-hibr"; then - LOG_ERROR "grub2-file命令不支持--is-xnu-hibr参数" - exit 255 - fi - - LOG_INFO "步骤5: 创建一个非XNU休眠镜像的测试文件" - TEST_FILE_NON_XNU=$(mktemp) - echo "This is not an XNU hibernation image" > "${TEST_FILE_NON_XNU}" - - LOG_INFO "步骤6: 对非XNU休眠镜像文件使用--is-xnu-hibr参数,预期应识别为非XNU镜像" - grub2-file --is-xnu-hibr "${TEST_FILE_NON_XNU}" - CHECK_RESULT $? 1 0 "对非XNU休眠镜像文件检查结果不符合预期" - - LOG_INFO "步骤7: 清理临时测试文件" - rm -f "${TEST_FILE_NON_XNU}" - CHECK_RESULT $? 0 0 "清理临时文件失败" - - LOG_INFO "步骤8: 创建一个模拟的XNU休眠镜像文件头" - TEST_FILE_XNU=$(mktemp) - echo -ne "\x78\x68\x79\x70" > "${TEST_FILE_XNU}" - dd if=/dev/zero bs=1 count=4092 >> "${TEST_FILE_XNU}" 2>/dev/null - - LOG_INFO "步骤9: 对模拟的XNU休眠镜像文件使用--is-xnu-hibr参数,预期应识别为XNU镜像" - grub2-file --is-xnu-hibr "${TEST_FILE_XNU}" - CHECK_RESULT $? 0 0 "对模拟XNU休眠镜像文件检查结果不符合预期" - - LOG_INFO "步骤10: 清理模拟的XNU休眠镜像文件" - rm -f "${TEST_FILE_XNU}" - CHECK_RESULT $? 0 0 "清理XNU测试文件失败" - - if [ ${ALREADY_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤11: 卸载测试安装的grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "步骤11: 系统原本已安装grub2-tools,保持安装状态" - fi - - LOG_INFO "grub2-file命令--is-xnu-hibr参数测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3.sh deleted file mode 100644 index aaba583c45c..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试指定32位输入文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试指定32位输入文件的功能" - - LOG_INFO "检查grub2-tools和grub2-glue-efi软件包是否在yum源中" - dnf list available grub2-tools grub2-glue-efi &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中缺少grub2-tools或grub2-glue-efi软件包" - exit 255 - fi - - LOG_INFO "检查系统是否已安装grub2-tools和grub2-glue-efi" - rpm -q grub2-tools grub2-glue-efi &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,测试完成后保持安装状态" - INSTALLED="true" - else - LOG_INFO "软件包未安装,将在测试前安装" - INSTALLED="false" - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装grub2-tools和grub2-glue-efi软件包" - dnf install -y grub2-tools grub2-glue-efi - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - LOG_INFO "检查grub2-glue-efi命令是否支持32位输入文件参数" - grub2-glue-efi --help 2>&1 | grep -q "32" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-glue-efi命令不支持32位输入文件参数" - exit 255 - fi - - LOG_INFO "创建测试用的32位输入文件" - cat > test_input_32.txt << EOF - This is a test file for 32-bit input. - EOF - CHECK_RESULT $? 0 0 "创建测试文件失败" - - LOG_INFO "执行grub2-glue-efi命令,指定32位输入文件" - grub2-glue-efi --input32 test_input_32.txt --output test_output.efi 2>&1 - CHECK_RESULT $? 0 0 "grub2-glue-efi命令执行失败" - - LOG_INFO "检查输出文件是否生成" - [ -f test_output.efi ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - LOG_INFO "清理测试文件" - rm -f test_input_32.txt test_output.efi - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载grub2-tools和grub2-glue-efi软件包" - dnf remove -y grub2-tools grub2-glue-efi - CHECK_RESULT $? 0 0 "卸载软件包失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__o.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__o.sh deleted file mode 100644 index 67f075f6ef0..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__o.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 : 测试组合使用32位输入、64位输入和输出文件参数的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试grub2-glue-efi命令的参数组合功能" - LOG_INFO "步骤1:检查环境中是否已安装grub2-tools软件包" - if rpm -q grub2-tools; then - LOG_INFO "grub2-tools已安装,测试结束后将保持安装状态" - installed=true - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装并在结束后卸载" - installed=false - fi - - LOG_INFO "步骤2:检查yum源中是否存在grub2-tools软件包" - if ! dnf list available grub2-tools --quiet; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - if [ "$installed" = "false" ]; then - LOG_INFO "步骤3:安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - LOG_INFO "步骤4:检查grub2-glue-efi命令是否支持所需参数" - if ! grub2-glue-efi --help | grep -q "\-\-32"; then - LOG_ERROR "grub2-glue-efi命令不支持--32参数" - exit 255 - fi - if ! grub2-glue-efi --help | grep -q "\-\-64"; then - LOG_ERROR "grub2-glue-efi命令不支持--64参数" - exit 255 - fi - if ! grub2-glue-efi --help | grep -q "\-\-output"; then - LOG_ERROR "grub2-glue-efi命令不支持--output参数" - exit 255 - fi - - LOG_INFO "步骤5:创建测试所需的输入文件" - echo "32-bit EFI stub" > /tmp/grub2_32_input - echo "64-bit EFI stub" > /tmp/grub2_64_input - output_file="/tmp/grub2_combined_output" - - LOG_INFO "步骤6:执行grub2-glue-efi命令,组合32位和64位输入文件" - grub2-glue-efi --32 /tmp/grub2_32_input --64 /tmp/grub2_64_input --output "$output_file" - CHECK_RESULT $? 0 0 "grub2-glue-efi命令执行失败" - - LOG_INFO "步骤7:验证输出文件是否成功生成" - if [ -f "$output_file" ]; then - LOG_INFO "输出文件已成功生成" - else - LOG_ERROR "输出文件未生成" - exit 1 - fi - - LOG_INFO "步骤8:清理测试过程中创建的临时文件" - rm -f /tmp/grub2_32_input /tmp/grub2_64_input "$output_file" - - if [ "$installed" = "false" ]; then - LOG_INFO "步骤9:卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__o__v.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__o__v.sh deleted file mode 100644 index f6c20f0743f..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__o__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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试组合使用32位输入、64位输入、输出文件和详细输出参数的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 初始化变量 - GRUB2_GLUE_EFI_CMD="grub2-glue-efi" - PACKAGE_NAME="grub2-tools" - INSTALLED_FLAG=0 - - # 检查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_FLAG=1 - LOG_INFO "检测到${PACKAGE_NAME}已安装" - else - LOG_INFO "检测到${PACKAGE_NAME}未安装,开始安装..." - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败" - INSTALLED_FLAG=0 - fi - - # 检查grub2-glue-efi命令是否存在 - LOG_INFO "检查${GRUB2_GLUE_EFI_CMD}命令是否存在..." - which ${GRUB2_GLUE_EFI_CMD} &>/dev/null - CHECK_RESULT $? 0 0 "${GRUB2_GLUE_EFI_CMD}命令不存在" - - # 测试组合使用32位输入、64位输入、输出文件和详细输出参数的功能 - LOG_INFO "测试组合使用32位输入、64位输入、输出文件和详细输出参数的功能..." - - # 创建测试用的临时文件 - LOG_INFO "创建测试用的临时文件..." - TEMP_DIR=$(mktemp -d) - EFI32_INPUT="${TEMP_DIR}/test32.efi" - EFI64_INPUT="${TEMP_DIR}/test64.efi" - OUTPUT_FILE="${TEMP_DIR}/output.efi" - - # 生成测试用的EFI文件(模拟文件) - dd if=/dev/zero of=${EFI32_INPUT} bs=1K count=1 2>/dev/null - dd if=/dev/zero of=${EFI64_INPUT} bs=1K count=1 2>/dev/null - - # 检查参数是否存在 - LOG_INFO "检查grub2-glue-efi命令参数支持情况..." - ${GRUB2_GLUE_EFI_CMD} --help 2>&1 | grep -q "\-\-verbose" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-glue-efi命令不支持--verbose参数" - # 清理临时文件 - rm -rf ${TEMP_DIR} - # 根据安装状态决定是否卸载 - if [ ${INSTALLED_FLAG} -eq 0 ]; then - LOG_INFO "卸载${PACKAGE_NAME}软件包..." - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败" - fi - exit 255 - fi - - # 执行组合参数测试 - LOG_INFO "执行grub2-glue-efi组合参数测试..." - ${GRUB2_GLUE_EFI_CMD} --verbose ${EFI32_INPUT} ${EFI64_INPUT} ${OUTPUT_FILE} - CHECK_RESULT $? 0 0 "grub2-glue-efi组合参数测试失败" - - # 验证输出文件是否生成 - LOG_INFO "验证输出文件是否生成..." - [ -f ${OUTPUT_FILE} ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理临时文件 - LOG_INFO "清理临时文件..." - rm -rf ${TEMP_DIR} - - # 环境恢复 - LOG_INFO "开始环境恢复..." - if [ ${INSTALLED_FLAG} -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/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__v.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__v.sh deleted file mode 100644 index 3faec06415e..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__3__6__v.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试组合使用32位输入、64位输入和详细输出参数的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试grub2-glue-efi工具的组合参数功能" - - # 检查软件包是否在yum源中 - LOG_INFO "检查grub2-tools软件包是否在yum源中" - dnf list grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 检查当前环境是否已安装grub2-tools - LOG_INFO "检查当前环境是否已安装grub2-tools" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - INSTALLED=true - LOG_INFO "grub2-tools已安装,测试结束后保持安装状态" - else - INSTALLED=false - LOG_INFO "grub2-tools未安装,将在测试前安装" - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 创建测试用的临时文件 - LOG_INFO "创建测试用的临时文件" - TEMP_32BIT=$(mktemp) - TEMP_64BIT=$(mktemp) - TEMP_OUTPUT=$(mktemp) - - # 生成测试数据 - echo "32位测试数据" > "$TEMP_32BIT" - echo "64位测试数据" > "$TEMP_64BIT" - - # 测试组合使用32位输入、64位输入和详细输出参数的功能 - LOG_INFO "测试组合使用32位输入、64位输入和详细输出参数的功能" - grub2-glue-efi --verbose --32 "$TEMP_32BIT" --64 "$TEMP_64BIT" --output "$TEMP_OUTPUT" - CHECK_RESULT $? 0 0 "grub2-glue-efi命令执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - [ -f "$TEMP_OUTPUT" ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f "$TEMP_32BIT" "$TEMP_64BIT" "$TEMP_OUTPUT" - - # 如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__6.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__6.sh deleted file mode 100644 index 0db3be24345..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__6.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试指定64位输入文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试指定64位输入文件的功能" - - # 定义软件包名称 - PACKAGE_NAME="grub2-tools" - COMMAND_NAME="grub2-glue-efi" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查软件包 ${PACKAGE_NAME} 是否在yum源中" - 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} 已安装,标记为保持安装状态" - KEEP_INSTALLED=1 - else - LOG_INFO "软件包 ${PACKAGE_NAME} 未安装,将在测试中安装" - KEEP_INSTALLED=0 - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ ${KEEP_INSTALLED} -eq 0 ]; then - LOG_INFO "步骤3: 安装软件包 ${PACKAGE_NAME}" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "安装软件包 ${PACKAGE_NAME} 失败" - fi - - # 步骤4: 检查命令是否存在 - LOG_INFO "步骤4: 检查命令 ${COMMAND_NAME} 是否存在" - if ! command -v ${COMMAND_NAME} &>/dev/null; then - LOG_ERROR "命令 ${COMMAND_NAME} 不存在" - # 如果未安装,则卸载已安装的软件包 - if [ ${KEEP_INSTALLED} -eq 0 ]; then - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 步骤5: 检查命令是否支持 --help 参数 - LOG_INFO "步骤5: 检查命令 ${COMMAND_NAME} 是否支持 --help 参数" - if ! ${COMMAND_NAME} --help &>/dev/null; then - LOG_ERROR "命令 ${COMMAND_NAME} 不支持 --help 参数" - # 如果未安装,则卸载已安装的软件包 - if [ ${KEEP_INSTALLED} -eq 0 ]; then - dnf remove -y ${PACKAGE_NAME} - fi - exit 255 - fi - - # 步骤6: 测试指定64位输入文件的功能 - LOG_INFO "步骤6: 测试指定64位输入文件的功能" - # 创建一个临时的64位输入文件用于测试 - TEST_INPUT_FILE=$(mktemp) - TEST_OUTPUT_FILE=$(mktemp) - # 生成一些测试数据 - dd if=/dev/urandom of=${TEST_INPUT_FILE} bs=1M count=1 &>/dev/null - - # 执行 grub2-glue-efi 命令,指定输入文件 - ${COMMAND_NAME} --input64=${TEST_INPUT_FILE} --output=${TEST_OUTPUT_FILE} - CHECK_RESULT $? 0 0 "执行 grub2-glue-efi 命令失败" - - # 检查输出文件是否生成且非空 - if [ -s "${TEST_OUTPUT_FILE}" ]; then - LOG_INFO "输出文件生成成功" - else - LOG_ERROR "输出文件未生成或为空" - # 清理临时文件 - rm -f ${TEST_INPUT_FILE} ${TEST_OUTPUT_FILE} - # 如果未安装,则卸载已安装的软件包 - if [ ${KEEP_INSTALLED} -eq 0 ]; then - dnf remove -y ${PACKAGE_NAME} - fi - exit 1 - fi - - # 步骤7: 清理临时文件 - LOG_INFO "步骤7: 清理临时文件" - rm -f ${TEST_INPUT_FILE} ${TEST_OUTPUT_FILE} - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 步骤8: 环境恢复 - LOG_INFO "步骤8: 环境恢复" - if [ ${KEEP_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 "测试指定64位输入文件的功能完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__o.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__o.sh deleted file mode 100644 index 85c807bdbc4..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__o.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试指定输出文件的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:测试指定输出文件的功能 - - # 步骤1:检查当前环境是否已安装grub2-glue-efi软件包 - LOG_INFO "检查grub2-glue-efi软件包是否已安装" - rpm -q grub2-glue-efi - if [ $? -eq 0 ]; then - LOG_INFO "grub2-glue-efi已安装,测试完成后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-glue-efi未安装,将在测试前安装并在测试后卸载" - INSTALLED=0 - fi - - # 步骤2:检查yum源中是否有grub2-glue-efi软件包 - LOG_INFO "检查yum源中是否有grub2-glue-efi软件包" - dnf list available grub2-glue-efi &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-glue-efi软件包" - exit 255 - fi - - # 步骤3:如果未安装,则安装grub2-glue-efi软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装grub2-glue-efi软件包" - dnf install -y grub2-glue-efi - CHECK_RESULT $? 0 0 "安装grub2-glue-efi失败" - fi - - # 步骤4:检查grub2-glue-efi命令是否存在 - LOG_INFO "检查grub2-glue-efi命令是否存在" - command -v grub2-glue-efi &>/dev/null - CHECK_RESULT $? 0 0 "grub2-glue-efi命令不存在" - - # 步骤5:测试指定输出文件的功能 - LOG_INFO "测试指定输出文件的功能" - # 创建一个临时输出文件 - OUTPUT_FILE=$(mktemp) - LOG_INFO "输出文件路径:$OUTPUT_FILE" - - # 执行grub2-glue-efi命令并指定输出文件 - grub2-glue-efi --output "$OUTPUT_FILE" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-glue-efi命令执行失败" - # 清理临时文件 - rm -f "$OUTPUT_FILE" - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-glue-efi软件包" - dnf remove -y grub2-glue-efi - fi - exit 1 - fi - - # 步骤6:检查输出文件是否创建成功 - LOG_INFO "检查输出文件是否创建成功" - if [ -f "$OUTPUT_FILE" ]; then - LOG_INFO "输出文件创建成功" - # 检查文件大小是否大于0 - FILE_SIZE=$(stat -c%s "$OUTPUT_FILE") - if [ $FILE_SIZE -gt 0 ]; then - LOG_INFO "输出文件大小:$FILE_SIZE 字节" - else - LOG_ERROR "输出文件大小为0" - rm -f "$OUTPUT_FILE" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-glue-efi软件包" - dnf remove -y grub2-glue-efi - fi - exit 1 - fi - else - LOG_ERROR "输出文件创建失败" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-glue-efi软件包" - dnf remove -y grub2-glue-efi - fi - exit 1 - fi - - # 步骤7:清理临时文件 - LOG_INFO "清理临时文件" - rm -f "$OUTPUT_FILE" - - # 步骤8:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-glue-efi软件包" - dnf remove -y grub2-glue-efi - CHECK_RESULT $? 0 0 "卸载grub2-glue-efi失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__upper_v.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__upper_v.sh deleted file mode 100644 index 0af54fadd61..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__upper_v.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试显示程序版本信息的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试显示程序版本信息的功能" - - # 检查系统是否已安装grub2-tools和grub2-glue-efi - LOG_INFO "检查软件包是否已安装" - rpm -q grub2-tools grub2-glue-efi >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,测试结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "软件包未安装,将在测试过程中安装并在结束后卸载" - INSTALLED=0 - fi - - # 检查yum源中是否有grub2-tools和grub2-glue-efi软件包 - LOG_INFO "检查yum源中是否存在grub2-tools和grub2-glue-efi软件包" - dnf list available grub2-tools grub2-glue-efi >/dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中缺少grub2-tools或grub2-glue-efi软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中缺少grub2-tools或grub2-glue-efi软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装grub2-tools和grub2-glue-efi软件包" - dnf install -y grub2-tools grub2-glue-efi - CHECK_RESULT $? 0 0 "安装grub2-tools和grub2-glue-efi失败" - fi - - # 测试grub2-glue-efi命令的版本显示功能 - LOG_INFO "测试grub2-glue-efi命令的版本显示功能" - grub2-glue-efi --version >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-glue-efi支持--version参数" - grub2-glue-efi --version - CHECK_RESULT $? 0 0 "grub2-glue-efi --version命令执行失败" - else - LOG_INFO "grub2-glue-efi不支持--version参数,尝试-v参数" - grub2-glue-efi -v >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-glue-efi支持-v参数" - grub2-glue-efi -v - CHECK_RESULT $? 0 0 "grub2-glue-efi -v命令执行失败" - else - LOG_ERROR "grub2-glue-efi不支持--version或-v参数" - exit 255 - fi - fi - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-tools和grub2-glue-efi软件包" - dnf remove -y grub2-tools grub2-glue-efi - CHECK_RESULT $? 0 0 "卸载grub2-tools和grub2-glue-efi失败" - else - LOG_INFO "测试前软件包已安装,保持安装状态" - fi - - LOG_INFO "测试完成:测试显示程序版本信息的功能" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__v.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__v.sh deleted file mode 100644 index 98b2f26050d..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-glue-efi__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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试启用详细输出模式的功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试启用详细输出模式的功能" - - LOG_INFO "步骤1:检查grub2-tools和grub2-glue-efi软件包是否在yum源中" - dnf list available grub2-tools grub2-glue-efi > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-tools或grub2-glue-efi软件包不在yum源中" - exit 255 - fi - - LOG_INFO "步骤2:检查当前环境是否已安装grub2-tools和grub2-glue-efi" - INSTALLED=0 - rpm -q grub2-tools grub2-glue-efi > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "软件包已安装,脚本结束将保持安装状态" - INSTALLED=1 - else - LOG_INFO "软件包未安装,将作为测试步骤安装" - dnf install -y grub2-tools grub2-glue-efi - CHECK_RESULT $? 0 0 "安装grub2-tools和grub2-glue-efi失败" - fi - - LOG_INFO "步骤3:检查grub2-glue-efi命令是否支持--verbose参数" - grub2-glue-efi --help 2>&1 | grep -q "\-\-verbose" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-glue-efi命令不支持--verbose参数" - exit 255 - fi - - LOG_INFO "步骤4:测试启用详细输出模式" - grub2-glue-efi --verbose --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "启用详细输出模式失败" - - LOG_INFO "步骤5:清理环境" - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载测试安装的软件包" - dnf remove -y grub2-tools grub2-glue-efi - CHECK_RESULT $? 0 0 "卸载grub2-tools和grub2-glue-efi失败" - else - LOG_INFO "保持原有安装状态,不卸载软件包" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-menulst2cfg_infile.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-menulst2cfg_infile.sh deleted file mode 100644 index 233caf58a3a..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-menulst2cfg_infile.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试仅指定输入文件参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(根据题目要求直接使用) - LOG_INFO() { - echo "[INFO] $*" - } - LOG_ERROR() { - echo "[ERROR] $*" - } - - # 定义检查结果函数(根据题目要求直接使用) - CHECK_RESULT() { - if [ $# -lt 4 ]; then - LOG_ERROR "CHECK_RESULT 参数不足" - exit 255 - fi - local actual=$1 - local expect=$2 - local exit_code=$3 - local msg=$4 - if [ $actual -ne $expect ]; then - LOG_ERROR "$msg" - exit $exit_code - fi - } - - # 定义SSH_CMD函数(根据题目要求直接使用) - SSH_CMD() { - local cmd=$1 - local node_ip=$2 - local node_password=$3 - local node_user=$4 - # 这里只是占位,实际使用时会根据环境实现 - echo "SSH_CMD: $cmd on $node_ip" - } - - # 测试用例描述:测试仅指定输入文件参数 - LOG_INFO "开始测试:测试仅指定输入文件参数" - - # 检查grub2-tools软件包是否在yum源中 - LOG_INFO "步骤1:检查grub2-tools软件包是否在yum源中" - dnf list available grub2-tools 2>/dev/null | grep -q grub2-tools - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-tools软件包不在yum源中" - exit 255 - fi - - # 检查是否已安装grub2-tools - LOG_INFO "步骤2:检查是否已安装grub2-tools" - rpm -q grub2-tools >/dev/null 2>&1 - installed=$? - - # 如果未安装,则安装grub2-tools - if [ $installed -ne 0 ]; then - LOG_INFO "步骤3:安装grub2-tools" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 创建测试用的输入文件 - LOG_INFO "步骤4:创建测试用的输入文件" - cat > /tmp/test_grub.cfg << EOF - menuentry "Test Entry" { - linux /vmlinuz root=/dev/sda1 - initrd /initrd.img - } - EOF - CHECK_RESULT $? 0 0 "创建测试输入文件失败" - - # 测试仅指定输入文件参数 - LOG_INFO "步骤5:测试仅指定输入文件参数" - grub2-menulst2cfg /tmp/test_grub.cfg - CHECK_RESULT $? 0 0 "grub2-menulst2cfg命令执行失败" - - # 清理测试文件 - LOG_INFO "步骤6:清理测试文件" - rm -f /tmp/test_grub.cfg - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ $installed -ne 0 ]; then - LOG_INFO "步骤7:卸载grub2-tools" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成:测试仅指定输入文件参数" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-menulst2cfg_infile_outfile.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-menulst2cfg_infile_outfile.sh deleted file mode 100644 index 814adc67595..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-menulst2cfg_infile_outfile.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试指定输入文件和输出文件参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试grub2-tools软件包中的grub2-menulst2cfg命令指定输入文件和输出文件参数功能" - - LOG_INFO "步骤1: 检查grub2-tools软件包是否已在yum源中" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - LOG_INFO "步骤2: 检查当前环境是否已安装grub2-tools" - rpm -q grub2-tools > /dev/null 2>&1 - INSTALLED=$? - - LOG_INFO "步骤3: 准备测试文件" - TEST_INPUT_FILE="/tmp/test_grub2_menulst2cfg_input.txt" - TEST_OUTPUT_FILE="/tmp/test_grub2_menulst2cfg_output.txt" - cat > $TEST_INPUT_FILE << EOF - default=0 - timeout=5 - title Test Entry - root (hd0,0) - kernel /vmlinuz root=/dev/sda1 - EOF - - LOG_INFO "步骤4: 执行grub2-menulst2cfg命令,指定输入文件和输出文件参数" - grub2-menulst2cfg --infile=$TEST_INPUT_FILE --outfile=$TEST_OUTPUT_FILE - CHECK_RESULT $? 0 0 "执行grub2-menulst2cfg命令失败" - - LOG_INFO "步骤5: 检查输出文件是否生成" - if [ ! -f "$TEST_OUTPUT_FILE" ]; then - LOG_ERROR "输出文件未生成" - exit 1 - fi - - LOG_INFO "步骤6: 检查输出文件内容是否符合预期" - EXPECTED_CONTENT="set default="0" - set timeout="5" - menuentry "Test Entry" { - set root="hd0,0" - linux /vmlinuz root=/dev/sda1 - }" - ACTUAL_CONTENT=$(cat $TEST_OUTPUT_FILE) - if [ "$ACTUAL_CONTENT" != "$EXPECTED_CONTENT" ]; then - LOG_ERROR "输出文件内容不符合预期" - LOG_ERROR "期望内容: $EXPECTED_CONTENT" - LOG_ERROR "实际内容: $ACTUAL_CONTENT" - exit 1 - fi - - LOG_INFO "步骤7: 清理测试文件" - rm -f $TEST_INPUT_FILE $TEST_OUTPUT_FILE - - LOG_INFO "步骤8: 恢复环境" - if [ $INSTALLED -ne 0 ]; then - LOG_INFO "测试前未安装grub2-tools,执行卸载操作" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - else - LOG_INFO "测试前已安装grub2-tools,保持安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__c.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__c.sh deleted file mode 100644 index 8dda1d114b9..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__c.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage嵌入早期配置文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已安装grub2-tools - LOG_INFO "检查grub2-tools是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 创建测试用的早期配置文件 - LOG_INFO "创建测试用的早期配置文件" - cat > /tmp/early_cfg.txt << EOF - set default=0 - set timeout=5 - EOF - CHECK_RESULT $? 0 0 "创建早期配置文件失败" - - # 测试grub2-mkimage嵌入早期配置文件 - LOG_INFO "测试grub2-mkimage嵌入早期配置文件" - grub2-mkimage -c /tmp/early_cfg.txt -o /tmp/test_image.img -O x86_64-efi normal - CHECK_RESULT $? 0 0 "grub2-mkimage嵌入早期配置文件失败" - - # 验证生成的镜像文件 - LOG_INFO "验证生成的镜像文件" - file /tmp/test_image.img | grep -q "EFI application" - CHECK_RESULT $? 0 0 "生成的镜像文件不是EFI应用程序" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/early_cfg.txt /tmp/test_image.img - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果测试前未安装,则卸载grub2-tools - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__c__o.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__c__o.sh deleted file mode 100644 index d8f891ac477..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__c__o.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage同时使用配置文件和输出文件参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools软件包 - LOG_INFO "检查是否已安装grub2-tools软件包" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,标记为保持安装状态" - KEEP_INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,标记为需要清理" - KEEP_INSTALLED=0 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools软件包 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 创建测试用的配置文件 - LOG_INFO "创建测试用的配置文件" - cat > /tmp/test_grub.cfg << EOF - set default=0 - set timeout=5 - menuentry "Test Entry" { - echo "Hello from GRUB2" - } - EOF - CHECK_RESULT $? 0 0 "创建配置文件失败" - - # 测试grub2-mkimage同时使用配置文件和输出文件参数 - LOG_INFO "测试grub2-mkimage同时使用配置文件和输出文件参数" - grub2-mkimage -c /tmp/test_grub.cfg -o /tmp/test_grub.img > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-mkimage执行失败" - - # 检查输出文件是否生成 - LOG_INFO "检查输出文件是否生成" - [ -f /tmp/test_grub.img ] - CHECK_RESULT $? 0 0 "输出文件未生成" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/test_grub.cfg /tmp/test_grub.img - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 如果之前未安装,则卸载grub2-tools软件包 - if [ $KEEP_INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__d.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__d.sh deleted file mode 100644 index e9eb0a4f749..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__d.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage指定模块和镜像目录 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools - LOG_INFO "检查是否已安装grub2-tools" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到grub2-tools软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-mkimage命令是否存在 - LOG_INFO "检查grub2-mkimage命令是否存在" - which grub2-mkimage > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-mkimage命令不存在" - - # 测试grub2-mkimage指定模块和镜像目录 - LOG_INFO "测试grub2-mkimage指定模块和镜像目录" - MODULES="normal echo linux" - OUTPUT_IMAGE="/tmp/test_grub2_image" - OUTPUT_DIR="/tmp/grub2_test_dir" - - # 创建输出目录 - mkdir -p $OUTPUT_DIR - CHECK_RESULT $? 0 0 "创建输出目录失败" - - # 检查-d参数是否存在 - LOG_INFO "检查grub2-mkimage是否支持-d参数" - grub2-mkimage --help | grep -q "\-d" - CHECK_RESULT $? 0 0 "grub2-mkimage不支持-d参数" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage不支持-d参数" - exit 255 - fi - - # 执行grub2-mkimage命令 - LOG_INFO "执行grub2-mkimage命令,指定模块和镜像目录" - grub2-mkimage -d $OUTPUT_DIR -o $OUTPUT_IMAGE $MODULES - CHECK_RESULT $? 0 0 "grub2-mkimage命令执行失败" - - # 检查生成的镜像文件是否存在 - LOG_INFO "检查生成的镜像文件是否存在" - [ -f $OUTPUT_IMAGE ] - CHECK_RESULT $? 0 0 "未生成镜像文件" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f $OUTPUT_IMAGE - rm -rf $OUTPUT_DIR - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装,则卸载grub2-tools - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__d__upper_o.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__d__upper_o.sh deleted file mode 100644 index 48fcc9bfc02..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__d__upper_o.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage同时使用目录和格式参数 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量 - LOG_INFO="echo" - LOG_ERROR="echo" - CHECK_RESULT="check_result_function" - SSH_CMD="ssh_cmd_function" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查grub2-tools软件包是否在yum源中" - dnf list available grub2-tools 2>/dev/null | grep -q grub2-tools - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-tools软件包不在yum源中" - exit 255 - fi - - # 步骤2:检查当前是否已安装grub2-tools - LOG_INFO "步骤2:检查当前是否已安装grub2-tools" - rpm -q grub2-tools >/dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,标记为已安装状态" - INSTALLED="true" - else - LOG_INFO "grub2-tools未安装,标记为未安装状态" - INSTALLED="false" - fi - - # 步骤3:如果未安装,则安装grub2-tools - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 步骤4:测试grub2-mkimage同时使用目录和格式参数 - LOG_INFO "步骤4:测试grub2-mkimage同时使用目录和格式参数" - # 创建测试目录 - TEST_DIR="/tmp/test_grub2_mkimage" - mkdir -p $TEST_DIR - CHECK_RESULT $? 0 0 "创建测试目录失败" - - # 检查grub2-mkimage命令是否支持-d和-o参数 - LOG_INFO "检查grub2-mkimage命令参数支持情况" - grub2-mkimage --help 2>&1 | grep -q "\-d" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage不支持-d参数" - exit 255 - fi - - grub2-mkimage --help 2>&1 | grep -q "\-o" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage不支持-o参数" - exit 255 - fi - - # 执行grub2-mkimage命令 - LOG_INFO "执行grub2-mkimage命令" - grub2-mkimage -d /usr/lib/grub/x86_64-efi -o $TEST_DIR/test_image.efi -O x86_64-efi normal - CHECK_RESULT $? 0 0 "grub2-mkimage命令执行失败" - - # 步骤5:验证生成的镜像文件 - LOG_INFO "步骤5:验证生成的镜像文件" - if [ -f "$TEST_DIR/test_image.efi" ]; then - LOG_INFO "成功生成镜像文件:$TEST_DIR/test_image.efi" - file $TEST_DIR/test_image.efi | grep -q "EFI application" - CHECK_RESULT $? 0 0 "生成的镜像文件格式不正确" - else - LOG_ERROR "未找到生成的镜像文件" - CHECK_RESULT 1 0 0 "镜像文件生成失败" - fi - - # 步骤6:清理测试文件 - LOG_INFO "步骤6:清理测试文件" - rm -rf $TEST_DIR - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤7:如果测试前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "步骤7:卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "步骤7:保持grub2-tools安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__k.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__k.sh deleted file mode 100644 index 851e511f3fd..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__k.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage嵌入PGP公钥文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "1. 检查环境中是否已安装grub2-tools软件包" - if dnf list installed grub2-tools &>/dev/null; then - LOG_INFO "grub2-tools已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "grub2-tools未安装,将在测试步骤中安装" - INSTALLED=false - fi - - LOG_INFO "2. 检查yum源中是否存在grub2-tools软件包" - if ! dnf list available grub2-tools &>/dev/null; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "3. 安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - LOG_INFO "4. 检查grub2-mkimage命令是否支持--pubkey参数" - if ! grub2-mkimage --help 2>&1 | grep -q -- "--pubkey"; then - LOG_ERROR "grub2-mkimage命令不支持--pubkey参数" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载grub2-tools" - dnf remove -y grub2-tools - fi - exit 255 - fi - - LOG_INFO "5. 创建临时PGP公钥文件用于测试" - TEMP_KEYFILE=$(mktemp) - cat > "$TEMP_KEYFILE" </dev/null; then - LOG_INFO "grub2-tools已安装,脚本结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "grub2-tools未安装,将在测试步骤中安装" - INSTALLED=false - fi - - LOG_INFO "2. 检查yum源中是否有grub2-tools软件包" - if ! dnf list available grub2-tools &>/dev/null; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "3. 安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - LOG_INFO "4. 检查grub2-mkimage命令是否支持-m和-p参数" - grub2-mkimage --help | grep -E "(-m|--memdisk)|(-p|--prefix)" &>/dev/null - CHECK_RESULT $? 0 255 "grub2-mkimage命令不支持-m或-p参数" - - LOG_INFO "5. 创建测试用的内存磁盘文件" - echo "test content" > /tmp/test_memdisk.txt - CHECK_RESULT $? 0 0 "创建内存磁盘文件失败" - - LOG_INFO "6. 执行grub2-mkimage命令同时使用-m和-p参数" - grub2-mkimage -o /tmp/test_image.img -O x86_64-efi -m /tmp/test_memdisk.txt -p /test_prefix linux - CHECK_RESULT $? 0 0 "grub2-mkimage命令执行失败" - - LOG_INFO "7. 验证生成的镜像文件" - if [ -f /tmp/test_image.img ]; then - LOG_INFO "镜像文件生成成功" - else - LOG_ERROR "镜像文件生成失败" - exit 1 - fi - - LOG_INFO "8. 清理测试文件" - rm -f /tmp/test_memdisk.txt /tmp/test_image.img - CHECK_RESULT $? 0 0 "清理测试文件失败" - - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "9. 卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__n.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__n.sh deleted file mode 100644 index 378a6758adb..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__n.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage为CHRP IEEE1275添加NOTE段 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查与准备工作 - LOG_INFO "检查系统是否已安装grub2-tools软件包" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,记录当前状态" - INSTALLED_FLAG=1 - else - LOG_INFO "grub2-tools未安装,设置未安装标志" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在grub2-tools软件包 - LOG_INFO "检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-mkimage命令是否支持--note参数 - LOG_INFO "检查grub2-mkimage是否支持--note参数" - grub2-mkimage --help 2>&1 | grep -q "\-\-note" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage不支持--note参数" - # 清理环境:如果之前未安装,则卸载软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "清理环境:卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建测试输出目录 - LOG_INFO "创建测试输出目录" - TEST_DIR="/tmp/grub2_test_$$" - mkdir -p $TEST_DIR - CHECK_RESULT $? 0 0 "创建测试目录失败" - - # 测试grub2-mkimage为CHRP IEEE1275添加NOTE段 - LOG_INFO "执行测试:使用grub2-mkimage为CHRP IEEE1275添加NOTE段" - grub2-mkimage -O powerpc-ieee1275 -o $TEST_DIR/test.image --note \ - -p "(ieee1275)/test" -c $TEST_DIR/test.cfg normal > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-mkimage执行失败" - - # 验证生成的镜像文件是否包含NOTE段 - LOG_INFO "验证生成的镜像文件是否包含NOTE段" - readelf -S $TEST_DIR/test.image 2>/dev/null | grep -q "\.note" - CHECK_RESULT $? 0 0 "生成的镜像文件未找到NOTE段" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -rf $TEST_DIR - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 环境恢复:如果测试前未安装,则卸载软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "恢复环境:卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "保持grub2-tools软件包的安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__s.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__s.sh deleted file mode 100644 index dddb6c25fe1..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__s.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage嵌入SBAT元数据文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断是否已经安装grub2-tools - LOG_INFO "检查grub2-tools是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - is_installed=$? - - # 如果未安装,则尝试安装 - if [ $is_installed -ne 0 ]; then - LOG_INFO "grub2-tools未安装,开始安装" - - # 检查yum源中是否有grub2-tools包 - LOG_INFO "检查yum源中是否有grub2-tools包" - dnf list available grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中没有grub2-tools包" - - # 安装grub2-tools - LOG_INFO "安装grub2-tools" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-mkimage命令是否支持--sbat参数 - LOG_INFO "检查grub2-mkimage是否支持--sbat参数" - grub2-mkimage --help | grep -q "\-\-sbat" - CHECK_RESULT $? 0 255 "grub2-mkimage不支持--sbat参数" - - # 创建测试用的SBAT元数据文件 - LOG_INFO "创建测试用的SBAT元数据文件" - cat > /tmp/test_sbat.csv << EOF - sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md - grub,1,Free Software Foundation,grub,2.06,https://www.gnu.org/software/grub/ - EOF - CHECK_RESULT $? 0 0 "创建SBAT元数据文件失败" - - # 使用grub2-mkimage嵌入SBAT元数据文件 - LOG_INFO "测试grub2-mkimage嵌入SBAT元数据文件" - grub2-mkimage -O x86_64-efi -p /boot/efi/EFI/openEuler -o /tmp/test_grub.efi --sbat /tmp/test_sbat.csv part_gpt part_msdos - CHECK_RESULT $? 0 0 "grub2-mkimage嵌入SBAT元数据文件失败" - - # 验证生成的EFI文件是否包含SBAT数据 - LOG_INFO "验证生成的EFI文件是否包含SBAT数据" - strings /tmp/test_grub.efi | grep -q "sbat,1,SBAT Version" - CHECK_RESULT $? 0 0 "生成的EFI文件不包含SBAT数据" - - # 清理测试文件 - LOG_INFO "清理测试文件" - rm -f /tmp/test_sbat.csv /tmp/test_grub.efi - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果脚本开始时未安装,则卸载软件包 - if [ $is_installed -ne 0 ]; then - LOG_INFO "卸载grub2-tools" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_c.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_c.sh deleted file mode 100644 index 6753b0191a9..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_c.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage指定核心镜像压缩方式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试grub2-mkimage指定核心镜像压缩方式" - - # 检查yum源中是否存在grub2-tools软件包 - LOG_INFO "步骤1:检查yum源中是否存在grub2-tools软件包" - if ! dnf list available grub2-tools 2>/dev/null | grep -q grub2-tools; then - LOG_ERROR "yum源中不存在grub2-tools软件包" - exit 255 - fi - - # 检查当前环境是否已安装grub2-tools - LOG_INFO "步骤2:检查当前环境是否已安装grub2-tools" - if rpm -q grub2-tools >/dev/null 2>&1; then - LOG_INFO "grub2-tools已安装,标记为保持安装状态" - KEEP_INSTALLED=true - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - KEEP_INSTALLED=false - fi - - # 如果未安装,则安装grub2-tools - if [ "$KEEP_INSTALLED" = "false" ]; then - LOG_INFO "步骤3:安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 测试grub2-mkimage支持的核心镜像压缩方式参数 - LOG_INFO "步骤4:测试grub2-mkimage支持的核心镜像压缩方式参数" - - # 检查grub2-mkimage是否支持--compression参数 - LOG_INFO "检查grub2-mkimage是否支持--compression参数" - if ! grub2-mkimage --help 2>&1 | grep -q -- "--compression"; then - LOG_ERROR "grub2-mkimage不支持--compression参数" - if [ "$KEEP_INSTALLED" = "false" ]; then - LOG_INFO "清理环境:卸载grub2-tools" - dnf remove -y grub2-tools - fi - exit 255 - fi - - # 测试有效的压缩方式(以xz为例) - LOG_INFO "测试有效的压缩方式:xz" - grub2-mkimage -O x86_64-efi -o /tmp/test.img --compression=xz normal - CHECK_RESULT $? 0 0 "使用--compression=xz执行grub2-mkimage失败" - - # 测试无效的压缩方式 - LOG_INFO "测试无效的压缩方式:invalid_compression" - grub2-mkimage -O x86_64-efi -o /tmp/test.img --compression=invalid_compression normal 2>/dev/null - if [ $? -eq 0 ]; then - LOG_ERROR "使用无效的--compression参数应该失败但实际成功" - CHECK_RESULT 1 0 0 "无效压缩方式测试失败" - else - LOG_INFO "无效压缩方式测试通过(如预期失败)" - CHECK_RESULT $? 1 0 "无效压缩方式测试结果不符合预期" - fi - - # 清理临时文件 - LOG_INFO "步骤5:清理临时文件" - rm -f /tmp/test.img - - # 环境恢复 - LOG_INFO "步骤6:环境恢复" - if [ "$KEEP_INSTALLED" = "false" ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "保持grub2-tools安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_d.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_d.sh deleted file mode 100644 index 578d51170ab..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_d.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage嵌入设备树文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 设置环境变量 - LOG_INFO "开始测试grub2-mkimage嵌入设备树文件功能" - - # 定义软件包名称 - PACKAGE_NAME="grub2-tools" - COMMAND_NAME="grub2-mkimage" - - # 步骤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_INFO "软件包 ${PACKAGE_NAME} 在yum源中可用" - else - LOG_ERROR "软件包 ${PACKAGE_NAME} 在yum源中不可用" - 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:检查grub2-mkimage命令是否存在 - LOG_INFO "步骤4:检查grub2-mkimage命令是否存在" - if command -v ${COMMAND_NAME} > /dev/null 2>&1; then - LOG_INFO "命令 ${COMMAND_NAME} 存在" - else - LOG_ERROR "命令 ${COMMAND_NAME} 不存在" - exit 255 - fi - - # 步骤5:检查grub2-mkimage是否支持-d参数 - LOG_INFO "步骤5:检查grub2-mkimage是否支持-d参数" - ${COMMAND_NAME} --help | grep -q "\-d" - CHECK_RESULT $? 0 0 "命令 ${COMMAND_NAME} 不支持-d参数" - - # 步骤6:创建一个临时设备树文件用于测试 - LOG_INFO "步骤6:创建一个临时设备树文件用于测试" - DTB_FILE="/tmp/test.dtb" - cat > ${DTB_FILE} << EOF - /dts-v1/; - / { - compatible = "test,device"; - }; - EOF - CHECK_RESULT $? 0 0 "创建临时设备树文件失败" - - # 步骤7:使用grub2-mkimage嵌入设备树文件 - LOG_INFO "步骤7:使用grub2-mkimage嵌入设备树文件" - OUTPUT_FILE="/tmp/grub2_test_image" - ${COMMAND_NAME} -o ${OUTPUT_FILE} -O arm64-efi -d ${DTB_FILE} -p /test test - CHECK_RESULT $? 0 0 "grub2-mkimage嵌入设备树文件失败" - - # 步骤8:检查生成的镜像文件是否存在 - LOG_INFO "步骤8:检查生成的镜像文件是否存在" - if [ -f ${OUTPUT_FILE} ]; then - LOG_INFO "镜像文件生成成功" - else - LOG_ERROR "镜像文件生成失败" - exit 1 - fi - - # 步骤9:清理临时文件 - LOG_INFO "步骤9:清理临时文件" - rm -f ${DTB_FILE} ${OUTPUT_FILE} - 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/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_h.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_h.sh deleted file mode 100644 index a0420f77feb..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_h.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 : 测试grub2-mkimage的帮助信息输出 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools - LOG_INFO "检查grub2-tools软件包是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - pkg_installed=$? - - # 记录初始安装状态 - if [ $pkg_installed -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束后将保持安装状态" - need_uninstall=0 - else - LOG_INFO "grub2-tools未安装,将在测试后卸载" - need_uninstall=1 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools --quiet > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到grub2-tools软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在grub2-tools软件包" - exit 255 - fi - - # 如果未安装则安装软件包 - if [ $need_uninstall -eq 1 ]; then - LOG_INFO "开始安装grub2-tools软件包" - dnf install -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - if [ $? -ne 0 ]; then - LOG_ERROR "安装grub2-tools软件包失败" - exit 1 - fi - LOG_INFO "grub2-tools软件包安装成功" - fi - - # 测试grub2-mkimage命令是否存在 - LOG_INFO "检查grub2-mkimage命令是否存在" - which grub2-mkimage > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-mkimage命令不存在" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage命令不存在" - exit 1 - fi - - # 测试grub2-mkimage的帮助信息输出 - LOG_INFO "测试grub2-mkimage的帮助信息输出" - grub2-mkimage --help > /tmp/grub2-mkimage_help.txt 2>&1 - CHECK_RESULT $? 0 0 "执行grub2-mkimage --help命令失败" - if [ $? -ne 0 ]; then - LOG_ERROR "执行grub2-mkimage --help命令失败" - # 清理临时文件 - rm -f /tmp/grub2-mkimage_help.txt - # 环境恢复 - if [ $need_uninstall -eq 1 ]; then - LOG_INFO "清理环境:卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - LOG_INFO "环境清理完成" - fi - exit 1 - fi - - # 检查帮助信息是否包含关键内容 - LOG_INFO "验证帮助信息内容" - grep -q "Usage:" /tmp/grub2-mkimage_help.txt - CHECK_RESULT $? 0 0 "帮助信息中未找到Usage信息" - grep -q "Options:" /tmp/grub2-mkimage_help.txt - CHECK_RESULT $? 0 0 "帮助信息中未找到Options信息" - - LOG_INFO "grub2-mkimage帮助信息测试通过" - - # 清理临时文件 - rm -f /tmp/grub2-mkimage_help.txt - - # 环境恢复 - if [ $need_uninstall -eq 1 ]; then - LOG_INFO "清理环境:卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - LOG_INFO "环境清理完成" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_o.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_o.sh deleted file mode 100644 index 1946e250631..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_o.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage指定输出镜像格式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 判断环境是否已安装grub2-tools - LOG_INFO "检查是否已安装grub2-tools软件包" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,测试结束后保持安装状态" - INSTALLED_FLAG=0 - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - INSTALLED_FLAG=1 - fi - - # 检查yum源中是否存在grub2-tools软件包 - LOG_INFO "检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ ${INSTALLED_FLAG} -eq 1 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 测试grub2-mkimage指定输出镜像格式功能 - LOG_INFO "测试grub2-mkimage指定输出镜像格式功能" - - # 创建临时目录用于测试 - LOG_INFO "创建临时测试目录" - TEMP_DIR=$(mktemp -d) - cd ${TEMP_DIR} - - # 测试grub2-mkimage -o参数是否存在 - LOG_INFO "检查grub2-mkimage是否支持-o参数" - grub2-mkimage --help | grep -q "\-o" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage不支持-o参数" - # 清理临时目录 - cd /tmp - rm -rf ${TEMP_DIR} - - # 如果测试过程中安装了软件包,则卸载 - if [ ${INSTALLED_FLAG} -eq 1 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - fi - exit 255 - fi - - # 测试指定输出镜像格式为x86_64-efi - LOG_INFO "测试指定输出镜像格式为x86_64-efi" - grub2-mkimage -o test_x86_64_efi.img -O x86_64-efi -p /boot/grub2 normal - CHECK_RESULT $? 0 0 "创建x86_64-efi格式镜像失败" - - # 验证生成的镜像文件 - LOG_INFO "验证生成的x86_64-efi镜像文件" - if [ -f "test_x86_64_efi.img" ]; then - LOG_INFO "成功创建x86_64-efi格式镜像文件" - file test_x86_64_efi.img | grep -q "EFI" - CHECK_RESULT $? 0 0 "镜像文件格式验证失败" - else - LOG_ERROR "未找到生成的镜像文件" - CHECK_RESULT 1 0 0 "镜像文件生成失败" - fi - - # 测试指定输出镜像格式为i386-pc - LOG_INFO "测试指定输出镜像格式为i386-pc" - grub2-mkimage -o test_i386_pc.img -O i386-pc -p /boot/grub2 normal - CHECK_RESULT $? 0 0 "创建i386-pc格式镜像失败" - - # 验证生成的镜像文件 - LOG_INFO "验证生成的i386-pc镜像文件" - if [ -f "test_i386_pc.img" ]; then - LOG_INFO "成功创建i386-pc格式镜像文件" - file test_i386_pc.img | grep -q "DOS/MBR" - CHECK_RESULT $? 0 0 "镜像文件格式验证失败" - else - LOG_ERROR "未找到生成的镜像文件" - CHECK_RESULT 1 0 0 "镜像文件生成失败" - fi - - # 测试指定不支持的输出镜像格式 - LOG_INFO "测试指定不支持的输出镜像格式" - grub2-mkimage -o test_invalid.img -O invalid-format -p /boot/grub2 normal 2>&1 | grep -q "unrecognized" - CHECK_RESULT $? 0 0 "未正确识别不支持的镜像格式" - - # 清理临时文件 - LOG_INFO "清理临时测试文件" - cd /tmp - rm -rf ${TEMP_DIR} - - # 如果测试过程中安装了软件包,则卸载 - if [ ${INSTALLED_FLAG} -eq 1 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_s.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_s.sh deleted file mode 100644 index ec550accd8e..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__upper_s.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage为附加签名预留空间 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:测试grub2-mkimage为附加签名预留空间" - LOG_INFO "步骤1:检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - LOG_INFO "步骤2:检查环境是否已安装grub2-tools" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束时将保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,将进行安装" - INSTALLED=0 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - LOG_INFO "步骤4:检查grub2-mkimage命令是否支持--sbat参数" - grub2-mkimage --help 2>&1 | grep -q -- "--sbat" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage命令不支持--sbat参数" - if [ $INSTALLED -eq 0 ]; then - dnf remove -y grub2-tools - fi - exit 255 - fi - - LOG_INFO "步骤5:创建测试用的SBAT文件" - cat > /tmp/test.sbat << EOF - sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md - grub,1,Free Software Foundation,grub,2.06,https://www.gnu.org/software/grub/ - EOF - CHECK_RESULT $? 0 0 "创建SBAT文件失败" - - LOG_INFO "步骤6:使用grub2-mkimage生成带SBAT信息的EFI镜像" - grub2-mkimage -O x86_64-efi -o /tmp/grubtest.efi --sbat /tmp/test.sbat part_gpt part_msdos - CHECK_RESULT $? 0 0 "生成带SBAT的EFI镜像失败" - - LOG_INFO "步骤7:验证生成的EFI镜像是否包含SBAT信息" - objdump -j .sbat -s /tmp/grubtest.efi 2>&1 | grep -q "SBAT" - CHECK_RESULT $? 0 0 "EFI镜像中未找到SBAT信息" - - LOG_INFO "步骤8:清理临时文件" - rm -f /tmp/test.sbat /tmp/grubtest.efi - CHECK_RESULT $? 0 0 "清理临时文件失败" - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤9:卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - fi - - LOG_INFO "测试完成:grub2-mkimage成功为附加签名预留空间" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__v.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__v.sh deleted file mode 100644 index f3a0245e1c0..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__v.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 : 测试grub2-mkimage的详细输出模式 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试grub2-mkimage的详细输出模式" - - # 检查环境是否已安装grub2-tools软件包 - LOG_INFO "检查grub2-tools软件包是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools软件包已安装,测试结束后将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "grub2-tools软件包未安装,将在测试前安装并在测试后卸载" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - # 检查grub2-mkimage命令是否存在 - LOG_INFO "检查grub2-mkimage命令是否存在" - command -v grub2-mkimage > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "grub2-mkimage命令不存在" - - # 检查grub2-mkimage命令是否支持--verbose参数 - LOG_INFO "检查grub2-mkimage命令是否支持--verbose参数" - grub2-mkimage --help 2>&1 | grep -q -- "--verbose" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkimage命令不支持--verbose参数" - exit 255 - fi - - # 测试grub2-mkimage的详细输出模式 - LOG_INFO "执行grub2-mkimage --verbose命令" - grub2-mkimage --verbose -o /tmp/test_image.img -O x86_64-efi part_gpt part_msdos - CHECK_RESULT $? 0 0 "执行grub2-mkimage --verbose命令失败" - - # 验证生成的映像文件是否存在 - LOG_INFO "验证生成的映像文件是否存在" - [ -f /tmp/test_image.img ] - CHECK_RESULT $? 0 0 "生成的映像文件不存在" - - # 清理生成的临时文件 - LOG_INFO "清理生成的临时文件" - rm -f /tmp/test_image.img - - # 如果测试前未安装,则卸载grub2-tools软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - fi - - LOG_INFO "测试grub2-mkimage的详细输出模式完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__x.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__x.sh deleted file mode 100644 index f4b06f793b9..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkimage__x.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试grub2-mkimage嵌入x509证书文件 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试grub2-mkimage嵌入x509证书文件功能" - LOG_INFO "步骤1:检查grub2-tools软件包是否已在系统中安装" - rpm -q grub2-tools - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装" - INSTALLED=0 - fi - - LOG_INFO "步骤2:检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到grub2-tools软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包,退出测试" - exit 255 - fi - - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - LOG_INFO "步骤4:创建一个用于测试的x509证书文件" - cat > /tmp/test_cert.crt << EOF - -----BEGIN CERTIFICATE----- - MIIDXTCCAkWgAwIBAgIJAKL1a1Y2b3c4MA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV - BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX - aWRnaXRzIFB0eSBMdGQwHhcNMTUwMTAxMDAwMDAwWhcNMTYwMTAxMDAwMDAwWjBF - MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 - ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB - CgKCAQEAw2e6vQ5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g - 5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5g5 -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkrelpath_relative.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkrelpath_relative.sh deleted file mode 100644 index 5573b3c2896..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-mkrelpath_relative.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 测试使用 --relative 参数,在btrfs上使用相对路径 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装grub2-tools软件包 - LOG_INFO "检查是否已安装grub2-tools软件包" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools软件包已安装,标记为已安装状态" - INSTALLED=true - else - LOG_INFO "grub2-tools软件包未安装,标记为未安装状态" - INSTALLED=false - fi - - # 检查yum源中是否有grub2-tools软件包 - LOG_INFO "检查yum源中是否有grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中没有grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools - CHECK_RESULT $? 0 0 "安装grub2-tools软件包失败" - fi - - # 检查grub2-mkrelpath命令是否支持--relative参数 - LOG_INFO "检查grub2-mkrelpath命令是否支持--relative参数" - grub2-mkrelpath --help 2>&1 | grep -q -- "--relative" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-mkrelpath命令不支持--relative参数" - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - fi - exit 255 - fi - - # 创建btrfs文件系统测试环境 - LOG_INFO "创建测试用的btrfs文件系统环境" - dd if=/dev/zero of=/tmp/test_btrfs.img bs=1M count=100 - CHECK_RESULT $? 0 0 "创建测试镜像文件失败" - mkfs.btrfs /tmp/test_btrfs.img - CHECK_RESULT $? 0 0 "创建btrfs文件系统失败" - mkdir -p /mnt/test_btrfs - mount -o loop /tmp/test_btrfs.img /mnt/test_btrfs - CHECK_RESULT $? 0 0 "挂载btrfs文件系统失败" - - # 在btrfs文件系统上创建测试目录结构 - LOG_INFO "在btrfs文件系统上创建测试目录结构" - mkdir -p /mnt/test_btrfs/boot/grub2 - cd /mnt/test_btrfs - - # 测试使用--relative参数在btrfs上使用相对路径 - LOG_INFO "测试使用--relative参数在btrfs上使用相对路径" - grub2-mkrelpath --relative /boot/grub2 > /tmp/grub2_result.txt 2>&1 - CHECK_RESULT $? 0 0 "grub2-mkrelpath命令执行失败" - - # 检查命令输出结果 - LOG_INFO "检查grub2-mkrelpath命令输出结果" - if [ -s /tmp/grub2_result.txt ]; then - LOG_INFO "grub2-mkrelpath命令执行成功,输出结果: $(cat /tmp/grub2_result.txt)" - else - LOG_ERROR "grub2-mkrelpath命令没有输出结果" - # 清理测试环境 - cd / - umount /mnt/test_btrfs - rm -rf /mnt/test_btrfs /tmp/test_btrfs.img /tmp/grub2_result.txt - # 如果之前未安装,则卸载软件包 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools - fi - exit 1 - fi - - # 清理测试环境 - LOG_INFO "清理测试环境" - cd / - umount /mnt/test_btrfs - CHECK_RESULT $? 0 0 "卸载btrfs文件系统失败" - rm -rf /mnt/test_btrfs /tmp/test_btrfs.img /tmp/grub2_result.txt - - # 如果测试开始时未安装软件包,则在测试结束后卸载 - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "测试完成,卸载grub2-tools软件包" - dnf remove -y grub2-tools - CHECK_RESULT $? 0 0 "卸载grub2-tools软件包失败" - else - LOG_INFO "测试完成,保持grub2-tools软件包安装状态" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-script-check_no_args.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-script-check_no_args.sh deleted file mode 100644 index 7b549e277e3..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-script-check_no_args.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 不带任何参数,检查指定路径的GRUB脚本配置文件语法错误。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:不带任何参数,检查指定路径的GRUB脚本配置文件语法错误 - - # 定义变量 - PACKAGE_NAME="grub2-tools" - COMMAND="grub2-script-check" - TEST_FILE="/boot/grub2/grub.cfg" - LOG_INFO "开始测试:不带任何参数执行$COMMAND命令检查GRUB脚本语法" - - # 步骤1:检查软件包是否已在yum源中 - LOG_INFO "步骤1:检查$PACKAGE_NAME软件包是否在yum源中" - dnf list available $PACKAGE_NAME &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "错误:yum源中未找到$PACKAGE_NAME软件包" - exit 255 - fi - LOG_INFO "软件包$PACKAGE_NAME在yum源中存在" - - # 步骤2:检查当前是否已安装软件包 - LOG_INFO "步骤2:检查$PACKAGE_NAME软件包是否已安装" - rpm -q $PACKAGE_NAME &>/dev/null - PACKAGE_INSTALLED=$? - if [ $PACKAGE_INSTALLED -eq 0 ]; then - LOG_INFO "软件包$PACKAGE_NAME已安装,测试后保持安装状态" - NEED_UNINSTALL=0 - else - LOG_INFO "软件包$PACKAGE_NAME未安装,将在测试后卸载" - NEED_UNINSTALL=1 - fi - - # 步骤3:如果未安装,则安装软件包 - if [ $PACKAGE_INSTALLED -ne 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:检查测试文件$TEST_FILE是否存在" - if [ ! -f "$TEST_FILE" ]; then - LOG_ERROR "错误:测试文件$TEST_FILE不存在" - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "清理环境:卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - fi - exit 1 - fi - LOG_INFO "测试文件$TEST_FILE存在" - - # 步骤5:测试不带参数执行命令 - LOG_INFO "步骤5:测试不带任何参数执行$COMMAND命令" - $COMMAND - COMMAND_EXIT_CODE=$? - - # 步骤6:检查命令执行结果 - LOG_INFO "步骤6:检查命令执行结果" - if [ $COMMAND_EXIT_CODE -eq 0 ]; then - LOG_INFO "命令执行成功:$COMMAND检查GRUB脚本语法正常" - elif [ $COMMAND_EXIT_CODE -eq 1 ]; then - LOG_INFO "命令执行成功:$COMMAND检查到GRUB脚本语法错误" - else - LOG_ERROR "错误:$COMMAND命令执行失败,退出码:$COMMAND_EXIT_CODE" - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "清理环境:卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - fi - exit $COMMAND_EXIT_CODE - fi - - # 步骤7:清理环境 - LOG_INFO "步骤7:清理测试环境" - if [ $NEED_UNINSTALL -eq 1 ]; then - LOG_INFO "卸载$PACKAGE_NAME软件包" - dnf remove -y $PACKAGE_NAME - CHECK_RESULT $? 0 0 "卸载$PACKAGE_NAME软件包失败" - LOG_INFO "成功卸载$PACKAGE_NAME软件包" - else - LOG_INFO "保持$PACKAGE_NAME软件包安装状态" - fi - - LOG_INFO "测试完成:不带任何参数执行$COMMAND命令检查GRUB脚本语法测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-script-check_v.sh b/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-script-check_v.sh deleted file mode 100644 index fc820ed3d88..00000000000 --- a/testcases/function_test/pkg_test/grub2/grub2-tools/test_grub2-tools_grub2-script-check_v.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-04-01 -# @License : Mulan PSL v2 -# @Desc : 使用-v参数,检查脚本配置文件语法错误并打印详细消息。 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 环境检查:判断grub2-tools是否已安装 - LOG_INFO "检查grub2-tools软件包是否已安装" - rpm -q grub2-tools > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "grub2-tools已安装,脚本结束时将保持安装状态" - INSTALLED_FLAG=1 - else - LOG_INFO "grub2-tools未安装,将在测试过程中安装,测试结束后卸载" - INSTALLED_FLAG=0 - fi - - # 检查yum源中是否存在grub2-tools软件包 - LOG_INFO "检查yum源中是否存在grub2-tools软件包" - dnf list available grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "yum源中未找到grub2-tools软件包" - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到grub2-tools软件包" - exit 255 - fi - - # 如果未安装,则安装grub2-tools - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "安装grub2-tools软件包" - dnf install -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装grub2-tools失败" - fi - - # 检查grub2-script-check命令是否支持-v参数 - LOG_INFO "检查grub2-script-check命令是否支持-v参数" - grub2-script-check --help 2>&1 | grep -q "\-v" - CHECK_RESULT $? 0 0 "grub2-script-check命令不支持-v参数" - if [ $? -ne 0 ]; then - LOG_ERROR "grub2-script-check命令不支持-v参数" - # 如果之前未安装,则卸载软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - fi - exit 255 - fi - - # 创建一个测试用的grub脚本文件 - LOG_INFO "创建测试用的grub脚本文件" - cat > /tmp/test_grub_script.grub << EOF - menuentry "Test Entry" { - linux /vmlinuz root=/dev/sda1 - initrd /initrd.img - } - EOF - CHECK_RESULT $? 0 0 "创建grub脚本文件失败" - - # 使用-v参数检查脚本配置文件语法错误并打印详细消息 - LOG_INFO "使用-v参数检查脚本配置文件语法错误并打印详细消息" - grub2-script-check -v /tmp/test_grub_script.grub > /tmp/grub_check_output.txt 2>&1 - CHECK_RESULT $? 0 0 "grub2-script-check命令执行失败" - - # 验证输出中是否包含详细消息 - LOG_INFO "验证输出中是否包含详细消息" - grep -q "详细" /tmp/grub_check_output.txt || grep -q "detailed" /tmp/grub_check_output.txt - CHECK_RESULT $? 0 0 "输出中未找到详细消息" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f /tmp/test_grub_script.grub /tmp/grub_check_output.txt - CHECK_RESULT $? 0 0 "清理临时文件失败" - - # 环境恢复:如果之前未安装,则卸载软件包 - if [ $INSTALLED_FLAG -eq 0 ]; then - LOG_INFO "卸载grub2-tools软件包" - dnf remove -y grub2-tools > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载grub2-tools失败" - else - LOG_INFO "保持grub2-tools软件包安装状态" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/hwloc/hwloc/test_hwloc_lstopo_logical_index_prefix.sh b/testcases/function_test/pkg_test/hwloc/hwloc/test_hwloc_lstopo_logical_index_prefix.sh deleted file mode 100644 index 3553072db19..00000000000 --- a/testcases/function_test/pkg_test/hwloc/hwloc/test_hwloc_lstopo_logical_index_prefix.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-02-10 -# @License : Mulan PSL v2 -# @Desc : 测试使用--logical-index-prefix选项设置逻辑索引的前缀 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试hwloc的lstopo命令的--logical-index-prefix选项" - LOG_INFO "检查hwloc软件包是否在yum源中可用" - if ! dnf list available hwloc 2>/dev/null | grep -q hwloc; then - LOG_ERROR "yum源中没有hwloc软件包" - exit 255 - fi - LOG_INFO "检查系统是否已安装hwloc" - if rpm -q hwloc >/dev/null 2>&1; then - LOG_INFO "hwloc已安装,测试后将保持安装状态" - INSTALLED_BEFORE_TEST=true - else - LOG_INFO "hwloc未安装,将在测试中安装" - INSTALLED_BEFORE_TEST=false - fi - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "安装hwloc软件包" - dnf install -y hwloc - CHECK_RESULT $? 0 0 "hwloc安装失败" - fi - LOG_INFO "验证lstopo命令是否支持--logical-index-prefix选项" - if ! lstopo --help 2>&1 | grep -q "\-\-logical-index-prefix"; then - LOG_ERROR "lstopo命令不支持--logical-index-prefix选项" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "清理环境,卸载hwloc" - dnf remove -y hwloc - fi - exit 255 - fi - LOG_INFO "执行lstopo命令,使用--logical-index-prefix选项设置逻辑索引前缀为"TEST_"" - lstopo --logical-index-prefix TEST_ --of txt - 2>&1 | head -20 > /tmp/lstopo_output.txt - CHECK_RESULT $? 0 0 "执行lstopo命令失败" - LOG_INFO "检查输出中是否包含设置的逻辑索引前缀" - if grep -q "TEST_" /tmp/lstopo_output.txt; then - LOG_INFO "测试成功:输出中包含指定的逻辑索引前缀"TEST_"" - else - LOG_ERROR "测试失败:输出中未找到指定的逻辑索引前缀"TEST_"" - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "清理环境,卸载hwloc" - dnf remove -y hwloc - fi - exit 1 - fi - if [ "$INSTALLED_BEFORE_TEST" = false ]; then - LOG_INFO "清理环境,卸载hwloc" - dnf remove -y hwloc - CHECK_RESULT $? 0 0 "hwloc卸载失败" - fi - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/jaf/jakarta-activation/test_jakarta-activation_function_validate.sh b/testcases/function_test/pkg_test/jaf/jakarta-activation/test_jakarta-activation_function_validate.sh deleted file mode 100644 index 65c977e61d7..00000000000 --- a/testcases/function_test/pkg_test/jaf/jakarta-activation/test_jakarta-activation_function_validate.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-08 -# @License : Mulan PSL v2 -# @Desc : Test package validation functionality -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - LOG_INFO "开始测试jakarta-activation功能验证" - - # 检查软件包是否已安装 - if rpm -q jakarta-activation &>/dev/null; then - LOG_INFO "jakarta-activation已安装,测试完成后将保持安装状态" - installed=true - else - LOG_INFO "jakarta-activation未安装,将在测试完成后卸载" - installed=false - fi - - # 检查yum源中是否有jakarta-activation软件包 - LOG_INFO "检查yum源中是否存在jakarta-activation软件包" - dnf list available jakarta-activation &>/dev/null - CHECK_RESULT $? 0 255 "yum源中未找到jakarta-activation软件包" - - # 安装jakarta-activation软件包 - LOG_INFO "安装jakarta-activation软件包" - dnf install -y jakarta-activation &>/dev/null - CHECK_RESULT $? 0 255 "安装jakarta-activation失败" - - # 验证jakarta-activation功能 - LOG_INFO "验证jakarta-activation功能" - command_to_validate="jakarta-activation-validate" - if ! command -v $command_to_validate &>/dev/null; then - LOG_ERROR "$command_to_validate命令不存在或不支持" - exit 255 - fi - - $command_to_validate --test-param - CHECK_RESULT $? 0 0 "$command_to_validate功能验证失败" - - # 清理环境:如果测试前未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载jakarta-activation软件包" - dnf remove -y jakarta-activation &>/dev/null - CHECK_RESULT $? 0 0 "卸载jakarta-activation失败" - fi - - LOG_INFO "jakarta-activation功能验证测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/mtd-utils/mtd-utils-ubifs/test_mtd-utils-ubifs_function_flash.sh b/testcases/function_test/pkg_test/mtd-utils/mtd-utils-ubifs/test_mtd-utils-ubifs_function_flash.sh deleted file mode 100644 index 22f92717b5c..00000000000 --- a/testcases/function_test/pkg_test/mtd-utils/mtd-utils-ubifs/test_mtd-utils-ubifs_function_flash.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-06 -# @License : Mulan PSL v2 -# @Desc : Test flash operations -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test flash operations" - - # 检查是否已安装mtd-utils-ubifs软件包 - LOG_INFO "检查是否已安装mtd-utils-ubifs软件包" - if rpm -q mtd-utils-ubifs &>/dev/null; then - LOG_INFO "mtd-utils-ubifs已安装" - INSTALLED=true - else - LOG_INFO "mtd-utils-ubifs未安装" - INSTALLED=false - fi - - # 检查yum源中是否有mtd-utils-ubifs软件包 - LOG_INFO "检查yum源中是否有mtd-utils-ubifs软件包" - if ! dnf list available mtd-utils-ubifs &>/dev/null; then - LOG_ERROR "yum源中未找到mtd-utils-ubifs软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "安装mtd-utils-ubifs软件包" - dnf install -y mtd-utils-ubifs - CHECK_RESULT $? 0 0 "安装mtd-utils-ubifs失败" - fi - - # 测试flash操作 - LOG_INFO "测试flash操作" - flash_erase /dev/mtd0 0 0 &>/dev/null - CHECK_RESULT $? 0 0 "flash_erase命令执行失败" - - ubiattach /dev/ubi_ctrl -m 0 &>/dev/null - CHECK_RESULT $? 0 0 "ubiattach命令执行失败" - - # 检查参数是否存在或不支持 - LOG_INFO "检查参数是否存在或不支持" - if ! flash_erase --invalid-option &>/dev/null; then - LOG_ERROR "flash_erase不支持--invalid-option参数" - exit 255 - fi - - # 清理环境,恢复到之前的状态 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载mtd-utils-ubifs软件包" - dnf remove -y mtd-utils-ubifs - CHECK_RESULT $? 0 0 "卸载mtd-utils-ubifs失败" - fi - - LOG_INFO "测试完成:Test flash operations" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_comm.sh b/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_comm.sh deleted file mode 100644 index 36828d2634a..00000000000 --- a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_comm.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 communication with salt master -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 检查是否已安装open-vm-tools-salt-minion - LOG_INFO "检查是否已安装open-vm-tools-salt-minion" - if dnf list installed open-vm-tools-salt-minion &>/dev/null; then - LOG_INFO "open-vm-tools-salt-minion已安装" - installed=true - else - LOG_INFO "open-vm-tools-salt-minion未安装" - installed=false - fi - - # 检查yum源中是否存在open-vm-tools-salt-minion - LOG_INFO "检查yum源中是否存在open-vm-tools-salt-minion" - if ! dnf list available open-vm-tools-salt-minion &>/dev/null; then - LOG_ERROR "yum源中不存在open-vm-tools-salt-minion" - exit 255 - fi - - # 如果未安装,则安装open-vm-tools-salt-minion - if [ "$installed" = false ]; then - LOG_INFO "开始安装open-vm-tools-salt-minion" - dnf install -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "安装open-vm-tools-salt-minion失败" - fi - - # 测试与salt master的通信 - LOG_INFO "测试与salt master的通信" - salt-call test.ping --local - CHECK_RESULT $? 0 0 "与salt master通信测试失败" - - # 如果之前未安装,则在测试完成后卸载open-vm-tools-salt-minion - if [ "$installed" = false ]; then - LOG_INFO "卸载open-vm-tools-salt-minion" - dnf remove -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "卸载open-vm-tools-salt-minion失败" - fi - - LOG_INFO "测试脚本执行完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_config.sh b/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_config.sh deleted file mode 100644 index edc7b12fab3..00000000000 --- a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_config.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 : Check the configuration file for correctness -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试配置文件正确性检查" - - # 检查是否已安装open-vm-tools-salt-minion - LOG_INFO "检查是否已安装open-vm-tools-salt-minion" - if dnf list installed open-vm-tools-salt-minion &>/dev/null; then - LOG_INFO "open-vm-tools-salt-minion已安装" - INSTALLED=true - else - LOG_INFO "open-vm-tools-salt-minion未安装" - INSTALLED=false - fi - - # 检查yum源中是否有open-vm-tools-salt-minion软件包 - LOG_INFO "检查yum源中是否有open-vm-tools-salt-minion软件包" - if ! dnf list available open-vm-tools-salt-minion &>/dev/null; then - LOG_ERROR "yum源中未找到open-vm-tools-salt-minion软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装open-vm-tools-salt-minion" - dnf install -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "安装open-vm-tools-salt-minion失败" - fi - - # 检查配置文件是否正确 - LOG_INFO "检查配置文件是否正确" - if [ -f /etc/salt/minion ]; then - LOG_INFO "配置文件存在,开始检查内容" - grep -q "master:" /etc/salt/minion - CHECK_RESULT $? 0 0 "配置文件中未找到master配置" - else - LOG_ERROR "配置文件/etc/salt/minion不存在" - exit 1 - fi - - # 清理环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载open-vm-tools-salt-minion" - dnf remove -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "卸载open-vm-tools-salt-minion失败" - fi - - LOG_INFO "测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_install.sh b/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_install.sh deleted file mode 100644 index 4941ceddc07..00000000000 --- a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_install.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-08 -# @License : Mulan PSL v2 -# @Desc : Verify the installation of open-vm-tools-salt-minion package -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:验证 open-vm-tools-salt-minion 软件包的安装功能" - - # 检查是否已安装 open-vm-tools-salt-minion - LOG_INFO "检查是否已安装 open-vm-tools-salt-minion" - if rpm -q open-vm-tools-salt-minion &>/dev/null; then - LOG_INFO "open-vm-tools-salt-minion 已安装,跳过安装步骤" - installed=true - else - LOG_INFO "open-vm-tools-salt-minion 未安装,准备进行安装测试" - installed=false - fi - - # 检查 yum 源中是否存在 open-vm-tools-salt-minion 软件包 - LOG_INFO "检查 yum 源中是否存在 open-vm-tools-salt-minion" - if ! dnf list available open-vm-tools-salt-minion &>/dev/null; then - LOG_ERROR "yum 源中未找到 open-vm-tools-salt-minion 软件包" - exit 255 - fi - - # 安装 open-vm-tools-salt-minion - if [ "$installed" = false ]; then - LOG_INFO "开始安装 open-vm-tools-salt-minion" - dnf install -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "安装 open-vm-tools-salt-minion 失败" - fi - - # 验证软件包是否成功安装 - LOG_INFO "验证 open-vm-tools-salt-minion 是否成功安装" - rpm -q open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "open-vm-tools-salt-minion 未正确安装" - - # 执行一个简单的命令验证功能(假设 salt-call --version 是验证命令) - LOG_INFO "验证 salt-call 命令是否可用" - salt-call --version - CHECK_RESULT $? 0 0 "salt-call 命令执行失败" - - # 如果脚本开始时未安装,则在测试完成后卸载 - if [ "$installed" = false ]; then - LOG_INFO "清理环境:卸载 open-vm-tools-salt-minion" - dnf remove -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "卸载 open-vm-tools-salt-minion失败" - fi - - LOG_INFO "测试完成:open-vm-tools-salt-minion的安装功能已验证" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_service.sh b/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_service.sh deleted file mode 100644 index 8852adc794c..00000000000 --- a/testcases/function_test/pkg_test/open-vm-tools/open-vm-tools-salt-minion/test_open-vm-tools-salt-minion_function_service.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 : 2025-12-08 -# @License : Mulan PSL v2 -# @Desc : Ensure the service starts and stops properly -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:确保服务能够正常启动和停止" - - # 检查是否已安装open-vm-tools-salt-minion - LOG_INFO "检查是否已安装open-vm-tools-salt-minion" - if dnf list installed open-vm-tools-salt-minion &>/dev/null; then - LOG_INFO "open-vm-tools-salt-minion已安装,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "open-vm-tools-salt-minion未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在open-vm-tools-salt-minion - LOG_INFO "检查yum源中是否存在open-vm-tools-salt-minion" - if ! dnf list available open-vm-tools-salt-minion &>/dev/null; then - LOG_ERROR "yum源中未找到open-vm-tools-salt-minion软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装open-vm-tools-salt-minion" - dnf install -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "安装open-vm-tools-salt-minion失败" - fi - - # 检查服务是否存在 - LOG_INFO "检查服务是否存在" - systemctl list-unit-files | grep -q open-vm-tools-salt-minion.service - CHECK_RESULT $? 0 0 "服务open-vm-tools-salt-minion.service不存在" - - # 启动服务 - LOG_INFO "启动服务open-vm-tools-salt-minion.service" - systemctl start open-vm-tools-salt-minion.service - CHECK_RESULT $? 0 0 "启动服务失败" - - # 检查服务状态 - LOG_INFO "检查服务状态是否为active" - systemctl is-active --quiet open-vm-tools-salt-minion.service - CHECK_RESULT $? 0 0 "服务未运行" - - # 停止服务 - LOG_INFO "停止服务open-vm-tools-salt-minion.service" - systemctl stop open-vm-tools-salt-minion.service - CHECK_RESULT $? 0 0 "停止服务失败" - - # 检查服务状态 - LOG_INFO "检查服务状态是否为inactive" - systemctl is-active --quiet open-vm-tools-salt-minion.service && { LOG_ERROR "服务仍在运行"; exit 1; } - CHECK_RESULT $? 1 0 "服务仍在运行" - - # 如果最初未安装,则卸载软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载open-vm-tools-salt-minion" - dnf remove -y open-vm-tools-salt-minion - CHECK_RESULT $? 0 0 "卸载open-vm-tools-salt-minion失败" - fi - - LOG_INFO "测试完成:确保服务能够正常启动和停止" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-imagesize/python3-imagesize/test_python3-imagesize_function_getsize.sh b/testcases/function_test/pkg_test/python-imagesize/python3-imagesize/test_python3-imagesize_function_getsize.sh deleted file mode 100644 index 94c0daf58b6..00000000000 --- a/testcases/function_test/pkg_test/python-imagesize/python3-imagesize/test_python3-imagesize_function_getsize.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-09 -# @License : Mulan PSL v2 -# @Desc : 测试python3-imagesize获取图片尺寸功能 -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试python3-imagesize获取图片尺寸功能" - - # 检查是否已安装python3-imagesize - LOG_INFO "检查是否已安装python3-imagesize" - if ! dnf list installed python3-imagesize &>/dev/null; then - LOG_INFO "未安装python3-imagesize,准备安装" - # 检查yum源中是否有该软件包 - if ! dnf list available python3-imagesize &>/dev/null; then - LOG_ERROR "yum源中未找到python3-imagesize软件包" - exit 255 - fi - # 安装软件包 - dnf install -y python3-imagesize - CHECK_RESULT $? 0 0 "安装python3-imagesize失败" - INSTALLED=1 - else - LOG_INFO "python3-imagesize已安装" - INSTALLED=0 - fi - - # 测试获取图片尺寸功能 - LOG_INFO "测试获取图片尺寸功能" - TEST_IMAGE="test.png" - if [ ! -f "$TEST_IMAGE" ]; then - LOG_ERROR "测试图片$TEST_IMAGE不存在" - exit 255 - fi - - # 使用python3-imagesize获取图片尺寸 - LOG_INFO "执行python3-imagesize命令获取图片尺寸" - output=$(python3 -m imagesize "$TEST_IMAGE" 2>&1) - CHECK_RESULT $? 0 0 "获取图片尺寸失败" - - # 检查输出是否符合预期 - expected_output="1920 1080" # 假设预期输出为1920x1080 - if [[ "$output" != "$expected_output" ]]; then - LOG_ERROR "实际输出与预期不符: $output" - exit 1 - else - LOG_INFO "获取图片尺寸成功: $output" - fi - - # 清理环境,如果之前未安装则卸载软件包 - if [ "$INSTALLED" -eq 1 ]; then - LOG_INFO "卸载python3-imagesize" - dnf remove -y python3-imagesize - CHECK_RESULT $? 0 0 "卸载python3-imagesize失败" - fi - - LOG_INFO "测试完成,环境已恢复" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_import.sh b/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_import.sh deleted file mode 100644 index cd2b45b0c5e..00000000000 --- a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_import.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-25 -# @License : Mulan PSL v2 -# @Desc : Test basic module import -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic module import" - LOG_INFO "检查环境是否已安装python3-requests-ftp软件包" - - # 检查软件包是否已安装 - if dnf list installed python3-requests-ftp > /dev/null 2>&1; then - LOG_INFO "环境已安装python3-requests-ftp软件包,脚本结束后保持安装状态" - INSTALLED_BEFORE=true - else - LOG_INFO "环境未安装python3-requests-ftp软件包" - INSTALLED_BEFORE=false - fi - - # 检查yum源中是否有该软件包 - LOG_INFO "检查yum源中是否有python3-requests-ftp软件包" - if ! dnf list available python3-requests-ftp > /dev/null 2>&1; then - LOG_ERROR "yum源中未找到python3-requests-ftp软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "开始安装python3-requests-ftp软件包" - dnf install -y python3-requests-ftp - CHECK_RESULT $? 0 0 "安装python3-requests-ftp软件包失败" - LOG_INFO "成功安装python3-requests-ftp软件包" - fi - - # 测试导入模块 - LOG_INFO "测试导入requests-ftp模块" - python3 -c "import requests_ftp" - CHECK_RESULT $? 0 0 "导入requests-ftp模块失败" - - # 清理环境:如果之前未安装,则卸载软件包 - if [ "$INSTALLED_BEFORE" = false ]; then - LOG_INFO "清理环境:卸载python3-requests-ftp软件包" - dnf remove -y python3-requests-ftp - CHECK_RESULT $? 0 0 "卸载python3-requests-ftp软件包失败" - LOG_INFO "成功卸载python3-requests-ftp软件包" - fi - - LOG_INFO "测试完成:Test basic module import" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_listdir.sh b/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_listdir.sh deleted file mode 100644 index 167fcc3355e..00000000000 --- a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_listdir.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-02-25 -# @License : Mulan PSL v2 -# @Desc : Test FTP LIST command -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test FTP LIST command" - - LOG_INFO "步骤1:检查系统中是否已安装python3-requests-ftp软件包" - if rpm -q python3-requests-ftp &> /dev/null; then - LOG_INFO "python3-requests-ftp已安装,测试结束后将保持安装状态" - INSTALLED=true - else - LOG_INFO "python3-requests-ftp未安装,将在测试过程中安装" - INSTALLED=false - fi - - LOG_INFO "步骤2:检查yum源中是否有python3-requests-ftp软件包" - if ! dnf list available python3-requests-ftp &> /dev/null; then - LOG_ERROR "yum源中未找到python3-requests-ftp软件包" - exit 255 - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装python3-requests-ftp软件包" - dnf install -y python3-requests-ftp - CHECK_RESULT $? 0 0 "安装python3-requests-ftp失败" - fi - - LOG_INFO "步骤4:测试FTP LIST命令功能" - LOG_INFO "步骤4.1:启动FTP服务器" - systemctl start vsftpd - CHECK_RESULT $? 0 0 "启动FTP服务器失败" - - LOG_INFO "步骤4.2:创建测试目录和文件" - mkdir -p /tmp/ftp_test - echo "test file" > /tmp/ftp_test/test.txt - CHECK_RESULT $? 0 0 "创建测试文件失败" - - LOG_INFO "步骤4.3:使用python3-requests-ftp测试LIST命令" - python3 -c " - import ftplib - ftp = ftplib.FTP("localhost") - ftp.login() - files = [] - ftp.retrlines("LIST", files.append) - print("Files in FTP root:", files) - if len(files) > 0: - print("LIST command successful") - else: - print("LIST command failed") - exit(1) - ftp.quit() - " - CHECK_RESULT $? 0 0 "FTP LIST命令测试失败" - - LOG_INFO "步骤5:清理测试环境" - LOG_INFO "步骤5.1:删除测试文件" - rm -rf /tmp/ftp_test - CHECK_RESULT $? 0 0 "删除测试文件失败" - - LOG_INFO "步骤5.2:停止FTP服务器" - systemctl stop vsftpd - CHECK_RESULT $? 0 0 "停止FTP服务器失败" - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤6:卸载python3-requests-ftp软件包" - dnf remove -y python3-requests-ftp - CHECK_RESULT $? 0 0 "卸载python3-requests-ftp失败" - else - LOG_INFO "步骤6:保持python3-requests-ftp安装状态" - fi - - LOG_INFO "测试完成:Test FTP LIST command" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_retrieve.sh b/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_retrieve.sh deleted file mode 100644 index 6b0be178f9d..00000000000 --- a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_retrieve.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-02-25 -# @License : Mulan PSL v2 -# @Desc : Test file download via FTP -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 测试脚本:Test file download via FTP - - # 定义变量 - PYTHON3_REQUESTS_FTP_PACKAGE="python3-requests-ftp" - TEST_FILE_URL="ftp://ftp.gnu.org/gnu/wget/wget-1.21.1.tar.gz" - TEST_FILE_NAME="wget-1.21.1.tar.gz" - LOCAL_DOWNLOAD_PATH="/tmp/${TEST_FILE_NAME}" - - # 步骤1:检查软件包是否在yum源中 - LOG_INFO "步骤1:检查软件包是否在yum源中" - dnf list available ${PYTHON3_REQUESTS_FTP_PACKAGE} &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "软件包 ${PYTHON3_REQUESTS_FTP_PACKAGE} 不在yum源中" - exit 255 - fi - - # 步骤2:检查环境是否已安装指定软件包 - LOG_INFO "步骤2:检查环境是否已安装指定软件包" - rpm -q ${PYTHON3_REQUESTS_FTP_PACKAGE} &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "软件包 ${PYTHON3_REQUESTS_FTP_PACKAGE} 已安装,标记为已安装状态" - PACKAGE_INSTALLED="true" - else - LOG_INFO "软件包 ${PYTHON3_REQUESTS_FTP_PACKAGE} 未安装,标记为未安装状态" - PACKAGE_INSTALLED="false" - fi - - # 步骤3:如果未安装,则安装软件包 - if [ "${PACKAGE_INSTALLED}" = "false" ]; then - LOG_INFO "步骤3:安装软件包 ${PYTHON3_REQUESTS_FTP_PACKAGE}" - dnf install -y ${PYTHON3_REQUESTS_FTP_PACKAGE} - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4:检查python3命令是否支持requests-ftp模块 - LOG_INFO "步骤4:检查python3命令是否支持requests-ftp模块" - python3 -c "import requests_ftp" &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "python3不支持requests-ftp模块" - exit 255 - fi - - # 步骤5:创建Python脚本用于测试FTP文件下载 - LOG_INFO "步骤5:创建Python脚本用于测试FTP文件下载" - cat > /tmp/test_ftp_download.py << "EOF" - import sys - import os - from requests_ftp.ftp import FTPSession - - def download_file_via_ftp(url, local_path): - try: - session = FTPSession() - response = session.get(url) - with open(local_path, "wb") as f: - f.write(response.content) - print(f"文件下载成功: {local_path}") - return True - except Exception as e: - print(f"文件下载失败: {e}") - return False - - if __name__ == "__main__": - if len(sys.argv) != 3: - print("用法: python3 test_ftp_download.py ") - sys.exit(1) - - ftp_url = sys.argv[1] - local_path = sys.argv[2] - - if download_file_via_ftp(ftp_url, local_path): - sys.exit(0) - else: - sys.exit(1) - EOF - - # 步骤6:执行Python脚本测试FTP文件下载 - LOG_INFO "步骤6:执行Python脚本测试FTP文件下载" - python3 /tmp/test_ftp_download.py "${TEST_FILE_URL}" "${LOCAL_DOWNLOAD_PATH}" - CHECK_RESULT $? 0 0 "FTP文件下载失败" - - # 步骤7:验证下载的文件是否存在且非空 - LOG_INFO "步骤7:验证下载的文件是否存在且非空" - if [ -f "${LOCAL_DOWNLOAD_PATH}" ] && [ -s "${LOCAL_DOWNLOAD_PATH}" ]; then - LOG_INFO "文件下载成功,文件大小: $(stat -c%s "${LOCAL_DOWNLOAD_PATH}") 字节" - else - LOG_ERROR "文件下载失败或文件为空" - CHECK_RESULT 1 0 0 "文件下载验证失败" - fi - - # 步骤8:清理下载的测试文件 - LOG_INFO "步骤8:清理下载的测试文件" - rm -f "${LOCAL_DOWNLOAD_PATH}" - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 步骤9:清理Python测试脚本 - LOG_INFO "步骤9:清理Python测试脚本" - rm -f /tmp/test_ftp_download.py - CHECK_RESULT $? 0 0 "清理Python测试脚本失败" - - # 步骤10:如果测试前未安装软件包,则卸载软件包 - if [ "${PACKAGE_INSTALLED}" = "false" ]; then - LOG_INFO "步骤10:卸载软件包 ${PYTHON3_REQUESTS_FTP_PACKAGE}" - dnf remove -y ${PYTHON3_REQUESTS_FTP_PACKAGE} - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "步骤10:保持软件包安装状态" - fi - - LOG_INFO "FTP文件下载功能测试完成" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_uninstall.sh b/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_uninstall.sh deleted file mode 100644 index 995510ba10c..00000000000 --- a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_uninstall.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-25 -# @License : Mulan PSL v2 -# @Desc : Test package removal -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义软件包名称 - PACKAGE_NAME="python3-requests-ftp" - - # 步骤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=1 - LOG_INFO "软件包 ${PACKAGE_NAME} 已安装" - else - INSTALLED=0 - 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:验证软件包安装成功 - LOG_INFO "步骤4:验证软件包安装成功" - rpm -q ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "验证软件包 ${PACKAGE_NAME} 安装失败" - - # 步骤5:测试卸载软件包 - LOG_INFO "步骤5:测试卸载软件包 ${PACKAGE_NAME}" - dnf remove -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "卸载软件包 ${PACKAGE_NAME} 失败" - - # 步骤6:验证软件包已卸载 - LOG_INFO "步骤6:验证软件包已卸载" - rpm -q ${PACKAGE_NAME} - if [ $? -eq 0 ]; then - LOG_ERROR "软件包 ${PACKAGE_NAME} 卸载后仍然存在" - exit 1 - else - LOG_INFO "软件包 ${PACKAGE_NAME} 已成功卸载" - fi - - # 步骤7:环境恢复 - LOG_INFO "步骤7:环境恢复" - if [ ${INSTALLED} -eq 0 ]; then - LOG_INFO "原始环境未安装软件包,无需重新安装" - else - LOG_INFO "重新安装软件包以恢复到原始状态" - dnf install -y ${PACKAGE_NAME} - CHECK_RESULT $? 0 0 "重新安装软件包 ${PACKAGE_NAME} 失败" - LOG_INFO "环境已恢复到原始安装状态" - fi - - LOG_INFO "测试完成:软件包 ${PACKAGE_NAME} 卸载功能测试通过" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_upload.sh b/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_upload.sh deleted file mode 100644 index 219e6e1d5ca..00000000000 --- a/testcases/function_test/pkg_test/python-requests-ftp/python3-requests-ftp/test_python3-requests-ftp_function_upload.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-25 -# @License : Mulan PSL v2 -# @Desc : Test file upload via FTP -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:通过FTP上传文件" - LOG_INFO "检查环境是否已安装python3-requests-ftp软件包" - rpm -q python3-requests-ftp - if [ $? -eq 0 ]; then - LOG_INFO "环境已安装python3-requests-ftp,测试结束后保持安装状态" - INSTALLED=true - else - LOG_INFO "环境未安装python3-requests-ftp,将作为测试步骤安装" - INSTALLED=false - fi - LOG_INFO "检查yum源中是否存在python3-requests-ftp软件包" - dnf list available python3-requests-ftp - CHECK_RESULT $? 0 255 "yum源中不存在python3-requests-ftp软件包" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "安装python3-requests-ftp软件包" - dnf install -y python3-requests-ftp - CHECK_RESULT $? 0 0 "安装python3-requests-ftp失败" - fi - LOG_INFO "检查python3是否支持requests-ftp模块" - python3 -c "import requests_ftp" - CHECK_RESULT $? 0 0 "python3不支持requests-ftp模块" - LOG_INFO "准备测试文件" - echo "This is a test file for FTP upload." > test_upload.txt - CHECK_RESULT $? 0 0 "创建测试文件失败" - LOG_INFO "检查FTP服务器参数" - if [ -z "$FTP_SERVER" ] || [ -z "$FTP_USER" ] || [ -z "$FTP_PASSWORD" ]; then - LOG_ERROR "FTP服务器参数未设置" - exit 255 - fi - LOG_INFO "编写Python脚本进行FTP文件上传" - cat > ftp_upload_test.py << "EOF" - import sys - import os - from requests_ftp import ftp - import requests - FTP_SERVER = os.environ.get("FTP_SERVER") - FTP_USER = os.environ.get("FTP_USER") - FTP_PASSWORD = os.environ.get("FTP_PASSWORD") - if not FTP_SERVER or not FTP_USER or not FTP_PASSWORD: - print("FTP参数未设置") - sys.exit(255) - try: - session = requests.Session() - session.mount("ftp://", ftp.FTPAdapter()) - url = f"ftp://{FTP_SERVER}/test_upload.txt" - with open("test_upload.txt", "rb") as f: - response = session.put(url, data=f, auth=(FTP_USER, FTP_PASSWORD)) - if response.status_code == 226: - print("FTP文件上传成功") - sys.exit(0) - else: - print(f"FTP文件上传失败,状态码:{response.status_code}") - sys.exit(1) - except Exception as e: - print(f"FTP文件上传异常:{e}") - sys.exit(1) - EOF - CHECK_RESULT $? 0 0 "创建Python脚本失败" - LOG_INFO "执行Python脚本进行FTP文件上传" - python3 ftp_upload_test.py - CHECK_RESULT $? 0 0 "FTP文件上传测试失败" - LOG_INFO "清理测试文件" - rm -f test_upload.txt ftp_upload_test.py - CHECK_RESULT $? 0 0 "清理测试文件失败" - if [ "$INSTALLED" = "false" ]; then - LOG_INFO "卸载python3-requests-ftp软件包" - dnf remove -y python3-requests-ftp - CHECK_RESULT $? 0 0 "卸载python3-requests-ftp失败" - fi - LOG_INFO "测试完成:通过FTP上传文件" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-e/texlive-collcell/test_texlive-collcell_function_install.sh b/testcases/function_test/pkg_test/texlive-split-e/texlive-collcell/test_texlive-collcell_function_install.sh deleted file mode 100644 index 5ded053528a..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-e/texlive-collcell/test_texlive-collcell_function_install.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-10-06 -# @License : Mulan PSL v2 -# @Desc : Test package installation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查texlive-collcell软件包是否已安装 - LOG_INFO "检查texlive-collcell软件包是否已安装" - rpm -q texlive-collcell > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-collcell软件包已安装,脚本结束时将保持安装状态" - installed=true - else - installed=false - LOG_INFO "texlive-collcell软件包未安装,将在测试结束后卸载" - fi - - # 检查yum源中是否有texlive-collcell软件包 - LOG_INFO "检查yum源中是否有texlive-collcell软件包" - dnf list available texlive-collcell > /dev/null 2>&1 - CHECK_RESULT $? 0 255 "yum源中未找到texlive-collcell软件包" - - # 安装texlive-collcell软件包 - LOG_INFO "安装texlive-collcell软件包" - dnf install -y texlive-collcell > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "安装texlive-collcell软件包失败" - - # 验证texlive-collcell软件包是否成功安装 - LOG_INFO "验证texlive-collcell软件包是否成功安装" - rpm -q texlive-collcell > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-collcell软件包未成功安装" - - # 测试命令参数是否存在或不支持 - LOG_INFO "测试命令参数是否存在或不支持" - test_command="texlive-collcell --invalid-arg" - $test_command > /dev/null 2>&1 - if [ $? -eq 255 ]; then - LOG_ERROR "命令参数不存在或不支持" - exit 255 - fi - - # 清理环境:如果脚本开始时未安装,则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "清理环境:卸载texlive-collcell软件包" - dnf remove -y texlive-collcell > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "卸载texlive-collcell软件包失败" - - # 验证软件包是否已卸载 - rpm -q texlive-collcell > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_ERROR "未能成功卸载texlive-collcell软件包" - exit 1 - else - LOG_INFO "成功卸载texlive-collcell软件包,环境已恢复" - fi - else - LOG_INFO "脚本开始时已安装texlive-collcell软件包,无需卸载" - fi - - LOG_INFO "测试完成,环境已恢复" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-l/texlive-includernw/test_texlive-includernw_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-l/texlive-includernw/test_texlive-includernw_function_basic.sh deleted file mode 100644 index a00495f52ce..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-l/texlive-includernw/test_texlive-includernw_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-26 -# @License : Mulan PSL v2 -# @Desc : Basic functionality test for texlive-includernw -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-includernw - LOG_INFO "检查是否已安装texlive-includernw" - rpm -q texlive-includernw > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-includernw已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-includernw未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否存在texlive-includernw软件包 - LOG_INFO "检查yum源中是否存在texlive-includernw软件包" - dnf list available texlive-includernw > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中不存在texlive-includernw软件包" - exit 255 - fi - - # 安装texlive-includernw - if ! $INSTALLED; then - LOG_INFO "安装texlive-includernw" - dnf install -y texlive-includernw - CHECK_RESULT $? 0 0 "安装texlive-includernw失败" - fi - - # 测试基本功能 - LOG_INFO "测试texlive-includernw基本功能" - texlive-includernw --help > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "texlive-includernw命令不支持--help参数" - - # 清理环境 - if ! $INSTALLED; then - LOG_INFO "卸载texlive-includernw" - dnf remove -y texlive-includernw - CHECK_RESULT $? 0 0 "卸载texlive-includernw失败" - fi - - LOG_INFO "测试完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-n/texlive-llncsconf/test_texlive-llncsconf_function_use.sh b/testcases/function_test/pkg_test/texlive-split-n/texlive-llncsconf/test_texlive-llncsconf_function_use.sh deleted file mode 100644 index 77e54d0f5f1..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-n/texlive-llncsconf/test_texlive-llncsconf_function_use.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-29 -# @License : Mulan PSL v2 -# @Desc : Test basic document compilation -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - set -e - - LOG_INFO "开始测试:Test basic document compilation" - - LOG_INFO "步骤1:检查texlive-llncsconf软件包是否在yum源中" - if ! dnf list available texlive-llncsconf 2>/dev/null | grep -q texlive-llncsconf; then - LOG_ERROR "texlive-llncsconf软件包不在yum源中" - exit 255 - fi - - LOG_INFO "步骤2:检查是否已安装texlive-llncsconf" - if rpm -q texlive-llncsconf >/dev/null 2>&1; then - LOG_INFO "texlive-llncsconf已安装,测试后将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-llncsconf未安装,将在测试中安装" - INSTALLED=false - fi - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3:安装texlive-llncsconf软件包" - dnf install -y texlive-llncsconf - CHECK_RESULT $? 0 0 "安装texlive-llncsconf失败" - fi - - LOG_INFO "步骤4:创建测试LaTeX文档" - cat > test_llncs.tex << "EOF" - \documentclass{llncs} - \begin{document} - \title{Test Document} - \author{Test Author} - \institute{Test Institute} - \maketitle - \begin{abstract} - This is a test abstract. - \end{abstract} - \section{Introduction} - This is a test document for LLNCS class. - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试文档失败" - - LOG_INFO "步骤5:使用latex命令编译文档(第一次编译)" - latex test_llncs.tex - CHECK_RESULT $? 0 0 "latex第一次编译失败" - - LOG_INFO "步骤6:使用latex命令编译文档(第二次编译)" - latex test_llncs.tex - CHECK_RESULT $? 0 0 "latex第二次编译失败" - - LOG_INFO "步骤7:检查生成的DVI文件" - if [ -f test_llncs.dvi ]; then - LOG_INFO "DVI文件生成成功" - else - LOG_ERROR "DVI文件未生成" - exit 1 - fi - - LOG_INFO "步骤8:清理生成的临时文件" - rm -f test_llncs.aux test_llncs.log test_llncs.out test_llncs.dvi test_llncs.tex - - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9:卸载texlive-llncsconf软件包" - dnf remove -y texlive-llncsconf - CHECK_RESULT $? 0 0 "卸载texlive-llncsconf失败" - fi - - LOG_INFO "测试完成:Test basic document compilation" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-r/texlive-pdfpages-doc/test_texlive-pdfpages-doc_function_basic.sh b/testcases/function_test/pkg_test/texlive-split-r/texlive-pdfpages-doc/test_texlive-pdfpages-doc_function_basic.sh deleted file mode 100644 index 3e567438850..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-r/texlive-pdfpages-doc/test_texlive-pdfpages-doc_function_basic.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-11-26 -# @License : Mulan PSL v2 -# @Desc : Verify basic functionality of texlive-pdfpages-doc -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Verify basic functionality of texlive-pdfpages-doc" - - # 检查是否已安装texlive-pdfpages-doc - LOG_INFO "检查是否已安装texlive-pdfpages-doc" - if dnf list installed texlive-pdfpages-doc &> /dev/null; then - LOG_INFO "texlive-pdfpages-doc已安装,脚本结束时将保持安装状态" - INSTALLED=true - else - LOG_INFO "texlive-pdfpages-doc未安装,将在测试结束后卸载" - INSTALLED=false - fi - - # 检查yum源中是否有texlive-pdfpages-doc软件包 - LOG_INFO "检查yum源中是否有texlive-pdfpages-doc软件包" - if ! dnf list available texlive-pdfpages-doc &> /dev/null; then - LOG_ERROR "yum源中未找到texlive-pdfpages-doc软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "开始安装texlive-pdfpages-doc" - dnf install -y texlive-pdfpages-doc - CHECK_RESULT $? 0 0 "安装texlive-pdfpages-doc失败" - fi - - # 测试基本功能 - LOG_INFO "测试texlive-pdfpages-doc基本功能" - command_to_test="some_texlive_command --help" # 替换为实际命令和参数 - if ! $command_to_test &> /dev/null; then - LOG_ERROR "命令参数不支持或不存在" - exit 255 - fi - - # 检查命令执行结果 - CHECK_RESULT $? 0 0 "测试基本功能失败" - - # 恢复环境 - if [ "$INSTALLED" = false ]; then - LOG_INFO "卸载texlive-pdfpages-doc" - dnf remove -y texlive-pdfpages-doc - CHECK_RESULT $? 0 0 "卸载texlive-pdfpages-doc失败" - fi - - LOG_INFO "测试完成:Verify basic functionality of texlive-pdfpages-doc" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_basic_usage.sh b/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_basic_usage.sh deleted file mode 100644 index 90bdf86add3..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_basic_usage.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-29 -# @License : Mulan PSL v2 -# @Desc : Test basic usage to draw a B-spline curve -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试:Test basic usage to draw a B-spline curve" - - # 检查环境是否已安装texlive-pst-bspline软件包 - LOG_INFO "步骤1:检查texlive-pst-bspline是否已安装" - if dnf list installed texlive-pst-bspline &>/dev/null; then - LOG_INFO "texlive-pst-bspline已安装,测试结束后保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-pst-bspline未安装,将在测试中安装" - INSTALLED=0 - fi - - # 检查yum源中是否有texlive-pst-bspline软件包 - LOG_INFO "步骤2:检查yum源中是否有texlive-pst-bspline软件包" - if ! dnf list available texlive-pst-bspline &>/dev/null; then - LOG_ERROR "yum源中未找到texlive-pst-bspline软件包" - exit 255 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3:安装texlive-pst-bspline软件包" - dnf install -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "安装texlive-pst-bspline失败" - fi - - # 创建测试LaTeX文件 - LOG_INFO "步骤4:创建测试LaTeX文件" - cat > test_bspline.tex << "EOF" - \documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-1,-1)(4,4) - \psBspline(0,0)(1,2)(2,1)(3,3) - \end{pspicture} - \end{document} - EOF - CHECK_RESULT $? 0 0 "创建测试LaTeX文件失败" - - # 编译LaTeX文件生成B-spline曲线图 - LOG_INFO "步骤5:编译LaTeX文件生成B-spline曲线图" - pdflatex -interaction=nonstopmode test_bspline.tex - CHECK_RESULT $? 0 0 "编译LaTeX文件失败" - - # 检查生成的PDF文件是否存在 - LOG_INFO "步骤6:检查生成的PDF文件是否存在" - if [ -f test_bspline.pdf ]; then - LOG_INFO "成功生成B-spline曲线图" - else - LOG_ERROR "未生成B-spline曲线图" - exit 1 - fi - - # 清理测试文件 - LOG_INFO "步骤7:清理测试文件" - rm -f test_bspline.tex test_bspline.log test_bspline.aux test_bspline.pdf - CHECK_RESULT $? 0 0 "清理测试文件失败" - - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤8:卸载texlive-pst-bspline软件包" - dnf remove -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "卸载texlive-pst-bspline失败" - fi - - LOG_INFO "测试完成:Test basic usage to draw a B-spline curve" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_control_points.sh b/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_control_points.sh deleted file mode 100644 index a52deaa4a0f..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_control_points.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-29 -# @License : Mulan PSL v2 -# @Desc : Test B-spline with different control points -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - # 定义日志函数(虽然题目说不需要定义,但实际使用时需要定义) - LOG_INFO() { - echo "[INFO] $*" - } - - LOG_ERROR() { - echo "[ERROR] $*" >&2 - } - - # 定义检查结果函数 - CHECK_RESULT() { - local actual_ret=$1 - local expect_ret=$2 - local expect_status=$3 - local error_msg=$4 - - if [ $actual_ret -eq $expect_ret ]; then - if [ $expect_status -eq 0 ]; then - LOG_INFO "检查通过" - else - LOG_ERROR "$error_msg" - exit 255 - fi - else - LOG_ERROR "$error_msg" - exit 255 - 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" - } - - # 主测试函数 - test_texlive_pst_bspline_function_control_points() { - local pkg_name="texlive-pst-bspline" - local installed_before=false - - # 步骤1:检查软件包是否已安装 - LOG_INFO "步骤1:检查系统是否已安装 $pkg_name" - if rpm -q $pkg_name &>/dev/null; then - LOG_INFO "$pkg_name 已安装" - installed_before=true - else - LOG_INFO "$pkg_name 未安装" - fi - - # 步骤2:检查yum源中是否有该软件包 - LOG_INFO "步骤2:检查yum源中是否有 $pkg_name 软件包" - if ! dnf list available $pkg_name &>/dev/null; then - LOG_ERROR "yum源中未找到 $pkg_name 软件包" - exit 255 - fi - LOG_INFO "yum源中存在 $pkg_name 软件包" - - # 步骤3:如果未安装,则安装软件包 - if [ "$installed_before" = false ]; then - LOG_INFO "步骤3:安装 $pkg_name 软件包" - dnf install -y $pkg_name - CHECK_RESULT $? 0 0 "安装 $pkg_name 失败" - LOG_INFO "安装 $pkg_name 成功" - fi - - # 步骤4:测试B-spline with different control points功能 - LOG_INFO "步骤4:测试B-spline with different control points功能" - - # 创建测试LaTeX文件 - cat > test_bspline.tex << "EOF" - \documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-2,-2)(2,2) - % 测试不同的控制点 - \psBspline[linecolor=red]{B}(0,0)(1,1)(2,0)(1,-1)(0,0) - \psBspline[linecolor=blue]{B}(-1,0)(0,1)(1,0)(0,-1)(-1,0) - \end{pspicture} - \end{document} - EOF - - # 编译测试文件 - LOG_INFO "编译测试LaTeX文件" - pdflatex test_bspline.tex - CHECK_RESULT $? 0 0 "编译LaTeX文件失败" - - # 检查是否生成PDF文件 - if [ -f test_bspline.pdf ]; then - LOG_INFO "成功生成PDF文件,B-spline功能正常" - # 检查PDF文件大小 - local pdf_size=$(stat -c%s test_bspline.pdf 2>/dev/null || stat -f%z test_bspline.pdf 2>/dev/null) - if [ $pdf_size -gt 0 ]; then - LOG_INFO "PDF文件大小: ${pdf_size}字节" - else - LOG_ERROR "生成的PDF文件为空" - exit 1 - fi - else - LOG_ERROR "未生成PDF文件" - exit 1 - fi - - # 步骤5:测试不同控制点数量的情况 - LOG_INFO "步骤5:测试不同控制点数量的B-spline" - - # 测试最少控制点(3个) - cat > test_min_points.tex << "EOF" - \documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-1,-1)(2,2) - \psBspline[linecolor=green]{B}(0,0)(1,1)(2,0) - \end{pspicture} - \end{document} - EOF - - pdflatex test_min_points.tex - if [ $? -eq 0 ] && [ -f test_min_points.pdf ]; then - LOG_INFO "3个控制点的B-spline测试通过" - else - LOG_ERROR "3个控制点的B-spline测试失败" - exit 1 - fi - - # 测试更多控制点 - cat > test_more_points.tex << "EOF" - \documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-2,-2)(3,3) - \psBspline[linecolor=purple]{B}(0,0)(0.5,1)(1.5,1.5)(2,1)(2.5,0)(2,-1)(1,-1.5)(0,-1)(-0.5,0) - \end{pspicture} - \end{document} - EOF - - pdflatex test_more_points.tex - if [ $? -eq 0 ] && [ -f test_more_points.pdf ]; then - LOG_INFO "多个控制点的B-spline测试通过" - else - LOG_ERROR "多个控制点的B-spline测试失败" - exit 1 - fi - - # 步骤6:清理测试文件 - LOG_INFO "步骤6:清理测试文件" - rm -f test_bspline.* test_min_points.* test_more_points.* - - # 步骤7:如果测试前未安装,则卸载软件包 - if [ "$installed_before" = false ]; then - LOG_INFO "步骤7:卸载 $pkg_name 软件包" - dnf remove -y $pkg_name - CHECK_RESULT $? 0 0 "卸载 $pkg_name 失败" - LOG_INFO "卸载 $pkg_name 成功" - else - LOG_INFO "步骤7:保持 $pkg_name 安装状态" - fi - - LOG_INFO "测试完成:B-spline with different control points 测试通过" - } - - # 执行测试 - test_texlive_pst_bspline_function_control_points -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_degree.sh b/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_degree.sh deleted file mode 100644 index 6ef4fbb2422..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_degree.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/bash - -# Copyright (c) 2024 ISCAS .ALL rights reserved. -# This program is licensed under Mulan PSL v2. -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ############################################# -# @Author : honghua -# @Contact : honghua@iscas.ac.cn -# @Date : 2026-03-29 -# @License : Mulan PSL v2 -# @Desc : Test B-spline curves of different degrees -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "测试开始:Test B-spline curves of different degrees" - - # 检查yum源中是否有texlive-pst-bspline软件包 - LOG_INFO "步骤1: 检查yum源中是否有texlive-pst-bspline软件包" - dnf list available texlive-pst-bspline &>/dev/null - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-pst-bspline软件包" - exit 255 - fi - - # 检查是否已安装texlive-pst-bspline - LOG_INFO "步骤2: 检查是否已安装texlive-pst-bspline" - rpm -q texlive-pst-bspline &>/dev/null - if [ $? -eq 0 ]; then - LOG_INFO "texlive-pst-bspline已安装,测试后将保持安装状态" - INSTALLED=1 - else - LOG_INFO "texlive-pst-bspline未安装,测试后将卸载" - INSTALLED=0 - fi - - # 如果未安装,则安装软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤3: 安装texlive-pst-bspline软件包" - dnf install -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "安装texlive-pst-bspline失败" - fi - - # 验证pst-bspline命令是否存在 - LOG_INFO "步骤4: 验证pst-bspline命令是否存在" - command -v pst-bspline &>/dev/null - CHECK_RESULT $? 0 0 "pst-bspline命令不存在" - - # 测试不同阶数的B样条曲线 - LOG_INFO "步骤5: 测试不同阶数的B样条曲线" - - # 测试一阶B样条曲线 - LOG_INFO "测试一阶B样条曲线" - echo "\documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-2,-2)(2,2) - \psBspline[showframe=true]{B}(-1,0)(0,1)(1,0) - \end{pspicture} - \end{document}" > test_degree1.tex - pst-bspline test_degree1.tex - CHECK_RESULT $? 0 0 "一阶B样条曲线测试失败" - - # 测试二阶B样条曲线 - LOG_INFO "测试二阶B样条曲线" - echo "\documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-2,-2)(2,2) - \psBspline[showframe=true,degree=2]{B}(-1,0)(0,1)(1,0)(0,-1) - \end{pspicture} - \end{document}" > test_degree2.tex - pst-bspline test_degree2.tex - CHECK_RESULT $? 0 0 "二阶B样条曲线测试失败" - - # 测试三阶B样条曲线 - LOG_INFO "测试三阶B样条曲线" - echo "\documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-2,-2)(2,2) - \psBspline[showframe=true,degree=3]{B}(-1,0)(0,1)(1,0)(0,-1)(-1,0) - \end{pspicture} - \end{document}" > test_degree3.tex - pst-bspline test_degree3.tex - CHECK_RESULT $? 0 0 "三阶B样条曲线测试失败" - - # 清理测试文件 - LOG_INFO "步骤6: 清理测试文件" - rm -f test_degree1.tex test_degree2.tex test_degree3.tex test_degree1.dvi test_degree2.dvi test_degree3.dvi - - # 如果测试前未安装,则卸载软件包 - if [ $INSTALLED -eq 0 ]; then - LOG_INFO "步骤7: 卸载texlive-pst-bspline软件包" - dnf remove -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "卸载texlive-pst-bspline失败" - fi - - LOG_INFO "测试完成:Test B-spline curves of different degrees" -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_draw.sh b/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_draw.sh deleted file mode 100644 index 86e4ce6376b..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_draw.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 : 2025-11-26 -# @License : Mulan PSL v2 -# @Desc : Test drawing B-spline curves -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - - # 检查是否已安装texlive-pst-bspline - LOG_INFO "检查是否已安装texlive-pst-bspline" - rpm -q texlive-pst-bspline > /dev/null 2>&1 - if [ $? -eq 0 ]; then - LOG_INFO "texlive-pst-bspline已安装,脚本结束时保持安装状态" - installed=true - else - installed=false - fi - - # 检查yum源中是否有texlive-pst-bspline软件包 - LOG_INFO "检查yum源中是否有texlive-pst-bspline软件包" - dnf list available texlive-pst-bspline > /dev/null 2>&1 - if [ $? -ne 0 ]; then - LOG_ERROR "yum源中未找到texlive-pst-bspline软件包" - exit 255 - fi - - # 若未安装则安装软件包 - if [ "$installed" = false ]; then - LOG_INFO "安装texlive-pst-bspline软件包" - dnf install -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "安装texlive-pst-bspline失败" - fi - - # 测试绘制B样条曲线 - LOG_INFO "测试绘制B样条曲线" - cat < test.tex - \documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \psset{unit=1cm} - \begin{pspicture}(-1,-1)(5,5) - \psBsplineNodes[linecolor=red]{B}{}(0,0)(1,2)(2,1)(3,3)(4,2) - \end{pspicture} - \end{document} - EOF - - latex test.tex > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "latex命令执行失败" - dvips test.dvi > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "dvips命令执行失败" - ps2pdf test.ps > /dev/null 2>&1 - CHECK_RESULT $? 0 0 "ps2pdf命令执行失败" - - # 清理临时文件 - LOG_INFO "清理临时文件" - rm -f test.tex test.aux test.log test.dvi test.ps test.pdf - - # 若脚本开始时未安装则卸载软件包 - if [ "$installed" = false ]; then - LOG_INFO "卸载texlive-pst-bspline软件包" - dnf remove -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "卸载texlive-pst-bspline失败" - fi - - LOG_INFO "测试脚本执行完成" - -} - -main "$@" \ No newline at end of file diff --git a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_open_close.sh b/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_open_close.sh deleted file mode 100644 index 0e0a2ea9c49..00000000000 --- a/testcases/function_test/pkg_test/texlive-split-s/texlive-pst-bspline/test_texlive-pst-bspline_function_open_close.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-29 -# @License : Mulan PSL v2 -# @Desc : Test drawing open and closed B-spline curves -# ############################################ - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -function run_test() { - LOG_INFO "开始测试: Test drawing open and closed B-spline curves" - - # 步骤1: 检查软件包是否在yum源中 - LOG_INFO "步骤1: 检查软件包texlive-pst-bspline是否在yum源中" - if ! dnf list available texlive-pst-bspline &>/dev/null; then - LOG_ERROR "软件包texlive-pst-bspline不在yum源中" - exit 255 - fi - - # 步骤2: 检查环境是否已安装软件包 - LOG_INFO "步骤2: 检查环境是否已安装texlive-pst-bspline" - if rpm -q texlive-pst-bspline &>/dev/null; then - LOG_INFO "软件包已安装,跳过安装步骤" - INSTALLED=true - else - LOG_INFO "软件包未安装,将执行安装" - INSTALLED=false - fi - - # 步骤3: 如果未安装,则安装软件包 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤3: 安装软件包texlive-pst-bspline" - dnf install -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "安装软件包失败" - fi - - # 步骤4: 验证软件包安装成功 - LOG_INFO "步骤4: 验证软件包安装成功" - rpm -q texlive-pst-bspline - CHECK_RESULT $? 0 0 "软件包未正确安装" - - # 步骤5: 测试绘制开放B样条曲线 - LOG_INFO "步骤5: 测试绘制开放B样条曲线" - cat > test_open.tex << "EOF" - \documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-1,-1)(5,5) - \psBspline[showframe=true]{B}(0,0)(1,2)(2,1)(3,3)(4,2) - \end{pspicture} - \end{document} - EOF - pdflatex -interaction=nonstopmode test_open.tex - CHECK_RESULT $? 0 0 "绘制开放B样条曲线失败" - - # 步骤6: 测试绘制闭合B样条曲线 - LOG_INFO "步骤6: 测试绘制闭合B样条曲线" - cat > test_closed.tex << "EOF" - \documentclass{article} - \usepackage{pst-bspline} - \begin{document} - \begin{pspicture}(-1,-1)(5,5) - \psBspline[showframe=true]{CB}(0,0)(1,2)(2,1)(3,3)(4,2) - \end{pspicture} - \end{document} - EOF - pdflatex -interaction=nonstopmode test_closed.tex - CHECK_RESULT $? 0 0 "绘制闭合B样条曲线失败" - - # 步骤7: 检查生成的文件 - LOG_INFO "步骤7: 检查生成的PDF文件" - ls -la test_open.pdf test_closed.pdf - CHECK_RESULT $? 0 0 "PDF文件未生成" - - # 步骤8: 清理测试文件 - LOG_INFO "步骤8: 清理测试文件" - rm -f test_open.tex test_open.pdf test_open.log test_open.aux test_open.out - rm -f test_closed.tex test_closed.pdf test_closed.log test_closed.aux test_closed.out - - # 步骤9: 如果脚本安装的软件包,则卸载 - if [ "$INSTALLED" = false ]; then - LOG_INFO "步骤9: 卸载软件包texlive-pst-bspline" - dnf remove -y texlive-pst-bspline - CHECK_RESULT $? 0 0 "卸载软件包失败" - else - LOG_INFO "步骤9: 保持软件包安装状态,不执行卸载" - fi - - LOG_INFO "测试完成: Test drawing open and closed B-spline curves" -} - -main "$@" \ No newline at end of file