Merge branch 'pkg' of http://10.30.190.190:54866/redrsoe2100/os-autotest into pkg
This commit is contained in:
@@ -14,10 +14,6 @@
|
||||
"name": "test_SDL_sound_playsound__channels_num_1",
|
||||
"desc": "测试 playsound 命令设置单声道播放"
|
||||
},
|
||||
{
|
||||
"name": "test_SDL_sound_playsound__channels_num_2",
|
||||
"desc": "测试 playsound 命令设置立体声播放"
|
||||
},
|
||||
{
|
||||
"name": "test_SDL_sound_playsound__volume_num_0_5",
|
||||
"desc": "测试 playsound 命令设置播放音量为0.5倍"
|
||||
@@ -30,10 +26,6 @@
|
||||
"name": "test_SDL_sound_playsound_simple_upper_v",
|
||||
"desc": "执行playsound_simple命令,使用-V参数,预期显示软件的版本信息"
|
||||
},
|
||||
{
|
||||
"name": "test_SDL_sound_install_package",
|
||||
"desc": "测试SDL_sound软件包的安装功能"
|
||||
},
|
||||
{
|
||||
"name": "test_SDL_sound_check_installed",
|
||||
"desc": "检查SDL_sound软件包是否已正确安装"
|
||||
|
||||
@@ -7,17 +7,9 @@
|
||||
"desc": "测试 fence-agents-wti 软件包的安装功能,验证是否能够成功安装。",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-wti_function_config",
|
||||
"desc": "测试 fence-agents-wti 软件包的配置功能,验证配置文件是否正确生成。"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-wti_function_connect",
|
||||
"desc": "测试 fence-agents-wti 的连接功能,验证与设备的通信是否正常。"
|
||||
},
|
||||
{
|
||||
"name": "test_fence-agents-wti_function_power",
|
||||
"desc": "测试 fence-agents-wti 的电源管理功能,验证电源操作是否有效。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,38 +13,6 @@
|
||||
{
|
||||
"name": "test_gdb-headless_function_remove",
|
||||
"desc": "Test removal of gdb-headless"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-headless_function_version",
|
||||
"desc": "Test checking gdb version"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-headless_function_debug_core",
|
||||
"desc": "Test debugging core dump"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-headless_function_debug_attach",
|
||||
"desc": "Test attach to process"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-headless_function_run_program",
|
||||
"desc": "Test run program in gdb"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-headless_function_breakpoint",
|
||||
"desc": "Test set breakpoint"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-headless_function_backtrace",
|
||||
"desc": "Test backtrace command"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-headless_function_examine_mem",
|
||||
"desc": "Test examine memory"
|
||||
},
|
||||
{
|
||||
"name": "test_gdb-add-index_no_args",
|
||||
"desc": "测试不带任何参数执行gdb-add-index命令"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/lucene/lucene-benchmark",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_lucene-benchmark_function_index",
|
||||
"desc": "Test indexing performance and accuracy"
|
||||
},
|
||||
{
|
||||
"name": "test_lucene-benchmark_function_search",
|
||||
"desc": "Test search performance and results"
|
||||
},
|
||||
{
|
||||
"name": "test_lucene-benchmark_function_analyze",
|
||||
"desc": "Test text analysis functionality"
|
||||
},
|
||||
{
|
||||
"name": "test_lucene-benchmark_function_query",
|
||||
"desc": "Test query parsing and execution"
|
||||
},
|
||||
{
|
||||
"name": "test_lucene-benchmark_function_merge",
|
||||
"desc": "Test index merging performance"
|
||||
},
|
||||
{
|
||||
"name": "test_lucene-benchmark_function_io",
|
||||
"desc": "Test input/output operations performance"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/malcontent/malcontent-ui-devel",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_malcontent-ui-devel_install",
|
||||
"desc": "测试 malcontent-ui-devel 软件包的安装功能是否正常",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_malcontent-ui-devel_function_launch",
|
||||
"desc": "测试 malcontent-ui-devel 软件包的启动功能是否正常"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,22 +2,6 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/mongo-c-driver/libbson",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_libbson_function_init",
|
||||
"desc": "Test initialization of libbson"
|
||||
},
|
||||
{
|
||||
"name": "test_libbson_function_parse",
|
||||
"desc": "Test parsing of libbson"
|
||||
},
|
||||
{
|
||||
"name": "test_libbson_function_append",
|
||||
"desc": "Test appending to libbson"
|
||||
},
|
||||
{
|
||||
"name": "test_libbson_function_iter",
|
||||
"desc": "Test iteration in libbson"
|
||||
},
|
||||
{
|
||||
"name": "test_libbson_function_compare",
|
||||
"desc": "Test comparison in libbson"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/nagios-plugins/nagios-plugins-overcr",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_nagios-plugins-overcr_function_check",
|
||||
"desc": "Test the basic check functionality"
|
||||
},
|
||||
{
|
||||
"name": "test_nagios-plugins-overcr_function_threshold",
|
||||
"desc": "Test threshold validation"
|
||||
},
|
||||
{
|
||||
"name": "test_nagios-plugins-overcr_function_output",
|
||||
"desc": "Test output format"
|
||||
},
|
||||
{
|
||||
"name": "test_nagios-plugins-overcr_function_perfdata",
|
||||
"desc": "Test performance data collection"
|
||||
},
|
||||
{
|
||||
"name": "test_nagios-plugins-overcr_function_dependency",
|
||||
"desc": "Test dependency library integration"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,10 +7,6 @@
|
||||
"desc": "测试 plexus-velocity-javadoc 软件包的回滚功能",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_plexus-velocity-javadoc_function_parse",
|
||||
"desc": "测试 plexus-velocity-javadoc 软件包的解析功能"
|
||||
},
|
||||
{
|
||||
"name": "test_plexus-velocity-javadoc_function_install",
|
||||
"desc": "测试 plexus-velocity-javadoc 软件包的安装功能"
|
||||
@@ -19,10 +15,6 @@
|
||||
"name": "test_plexus-velocity-javadoc_function_uninstall",
|
||||
"desc": "测试 plexus-velocity-javadoc 软件包的卸载功能"
|
||||
},
|
||||
{
|
||||
"name": "test_plexus-velocity-javadoc_function_check_installed",
|
||||
"desc": "测试检查 plexus-velocity-javadoc 软件包是否已安装"
|
||||
},
|
||||
{
|
||||
"name": "test_plexus-velocity-javadoc_function_query_info",
|
||||
"desc": "测试查询 plexus-velocity-javadoc 软件包信息"
|
||||
|
||||
@@ -5,18 +5,6 @@
|
||||
{
|
||||
"name": "test_python3-cryptography_vectors_function_install",
|
||||
"desc": "测试python3-cryptography-vectors软件包能否正常安装"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-cryptography_vectors_function_import",
|
||||
"desc": "测试能否成功导入cryptography.vectors模块"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-cryptography_vectors_function_verify",
|
||||
"desc": "测试使用vectors模块验证加密算法"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-cryptography_vectors_function_uninstall",
|
||||
"desc": "测试python3-cryptography-vectors软件包能否正常卸载"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,10 +6,6 @@
|
||||
"name": "test_python-pika-help_install",
|
||||
"desc": "测试python-pika-help软件包的安装功能,验证安装过程是否成功。",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_python-pika-help_function_basic",
|
||||
"desc": "测试python-pika-help基础功能,验证是否能正常导入和使用。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,25 +2,9 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/python-ruamel-yaml-clib/python3-ruamel-yaml-clib",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_python3-ruamel-yaml-clib_function_load",
|
||||
"desc": "Test loading YAML content"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-ruamel-yaml-clib_function_dump",
|
||||
"desc": "Test dumping YAML content"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-ruamel-yaml-clib_function_parse",
|
||||
"desc": "Test parsing YAML content"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-ruamel-yaml-clib_function_roundtrip",
|
||||
"desc": "Test roundtrip YAML"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-ruamel-yaml-clib_function_validate",
|
||||
"desc": "Test YAML validation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/python-webob/python3-webob",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_python3-webob_function_request",
|
||||
"desc": "Test basic request handling"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,270 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/python-xmlschema/python3-xmlschema",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__v",
|
||||
"desc": "测试增加输出详细信息的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__schema",
|
||||
"desc": "测试指定XSD schema路径或URL的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__version",
|
||||
"desc": "测试指定XSD schema验证器版本的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__upper_l",
|
||||
"desc": "测试schema位置提示覆盖的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__converter",
|
||||
"desc": "测试使用不同XML到JSON转换器的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__indent",
|
||||
"desc": "测试指定XML输出缩进的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__o",
|
||||
"desc": "测试指定输出XML文件路径的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml__f",
|
||||
"desc": "测试不提示直接覆盖文件的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate__v",
|
||||
"desc": "测试增加输出详细信息的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate__schema",
|
||||
"desc": "测试指定XSD schema路径或URL的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate__version",
|
||||
"desc": "测试指定XSD schema验证器版本的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate__upper_l",
|
||||
"desc": "测试指定schema位置提示覆盖的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate__lazy",
|
||||
"desc": "测试使用懒惰验证模式的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate__defuse",
|
||||
"desc": "测试指定何时解除XML数据的参数"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__v",
|
||||
"desc": "测试增加输出详细程度的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__schema",
|
||||
"desc": "测试指定XSD架构路径或URL的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__version",
|
||||
"desc": "测试指定XSD架构验证器版本的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__upper_l",
|
||||
"desc": "测试架构位置提示覆盖的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__converter",
|
||||
"desc": "测试使用不同XML到JSON转换约定的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__indent",
|
||||
"desc": "测试为JSON输出设置缩进的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__lazy",
|
||||
"desc": "测试使用懒惰解码模式的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__defuse",
|
||||
"desc": "测试设置何时解除XML数据的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__o",
|
||||
"desc": "测试指定输出文件路径的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json__f",
|
||||
"desc": "测试不提示直接覆盖的选项"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_function_validate",
|
||||
"desc": "测试基本XML验证功能"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_help",
|
||||
"desc": "测试显示帮助信息"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_v",
|
||||
"desc": "测试增加输出详细程度"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_schema",
|
||||
"desc": "测试指定XSD模式文件的路径或URL"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_version",
|
||||
"desc": "测试指定使用的XSD模式验证器版本"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_upper_l",
|
||||
"desc": "测试指定模式位置提示覆盖"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_converter",
|
||||
"desc": "测试使用不同的XML到JSON转换约定"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_indent",
|
||||
"desc": "测试指定XML输出的缩进"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_o",
|
||||
"desc": "测试指定编码后XML文件的输出目录"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_f",
|
||||
"desc": "测试在覆盖文件时不进行提示"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_json_file",
|
||||
"desc": "测试指定JSON文件进行编码"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_schema_json_file",
|
||||
"desc": "测试同时指定模式文件和JSON文件"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_v_json_file",
|
||||
"desc": "测试以详细模式编码JSON文件"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_schema_o_json_file",
|
||||
"desc": "测试指定模式、输出目录并编码JSON文件"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_converter_indent_json_file",
|
||||
"desc": "测试使用特定转换器和缩进编码JSON文件"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-json2xml_f_o_json_file",
|
||||
"desc": "测试强制覆盖并指定输出目录编码JSON文件"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_schema",
|
||||
"desc": "测试使用--schema参数指定XSD文件路径来验证XML文件。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_v",
|
||||
"desc": "测试使用-v参数增加输出详细程度。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_version",
|
||||
"desc": "测试使用--version参数指定XSD模式版本(例如1.0或1.1)。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_upper_l",
|
||||
"desc": "测试使用-L参数提供模式位置提示覆盖。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_lazy",
|
||||
"desc": "测试使用--lazy参数启用延迟验证模式。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_defuse",
|
||||
"desc": "测试使用--defuse参数指定何时解除XML数据(例如always, remote, never)。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_schema_v",
|
||||
"desc": "测试同时使用--schema和-v参数来验证XML并获取详细输出。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_schema_lazy",
|
||||
"desc": "测试同时使用--schema和--lazy参数进行延迟模式验证。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_schema_version",
|
||||
"desc": "测试同时使用--schema和--version参数指定模式和版本进行验证。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_schema_upper_l",
|
||||
"desc": "测试同时使用--schema和-L参数,在指定模式的同时提供位置提示。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-validate_schema_defuse",
|
||||
"desc": "测试同时使用--schema和--defuse参数,在指定模式的同时设置解除选项。"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_v",
|
||||
"desc": "测试使用 -v 参数增加输出详细程度"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_schema",
|
||||
"desc": "测试使用 --schema 参数指定XSD模式文件的路径"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_version",
|
||||
"desc": "测试使用 --version 参数指定XSD模式验证器版本"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_upper_l",
|
||||
"desc": "测试使用 -L 参数提供模式位置提示覆盖"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_converter",
|
||||
"desc": "测试使用 --converter 参数指定不同的XML到JSON转换约定"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_indent",
|
||||
"desc": "测试使用 --indent 参数设置JSON输出的缩进"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_lazy",
|
||||
"desc": "测试使用 --lazy 参数启用惰性解码模式"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_defuse",
|
||||
"desc": "测试使用 --defuse 参数指定何时对XML数据进行无害化处理"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_o",
|
||||
"desc": "测试使用 -o 参数指定输出文件的位置"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_xmlschema-xml2json_f",
|
||||
"desc": "测试使用 -f 参数强制覆盖输出文件而不提示"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_function_install",
|
||||
"desc": "测试软件包安装功能"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_function_uninstall",
|
||||
"desc": "测试软件包卸载功能"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_function_import",
|
||||
"desc": "测试导入xmlschema模块"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_function_to_dict",
|
||||
"desc": "测试XML转JSON字典"
|
||||
},
|
||||
{
|
||||
"name": "test_python3-xmlschema_function_from_dict",
|
||||
"desc": "测试JSON字典转XML"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,10 +5,6 @@
|
||||
{
|
||||
"name": "test_signpost-commonshttp4_function_httpget",
|
||||
"desc": "Test HTTP GET request functionality"
|
||||
},
|
||||
{
|
||||
"name": "test_signpost-commonshttp4_function_httppost",
|
||||
"desc": "Test HTTP POST request functionality"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-l/texlive-hyphen-english",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-hyphen-english_function_hyphenation",
|
||||
"desc": "Test hyphenation functionality for English words"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,17 +6,9 @@
|
||||
"name": "test_texlive-iitem-doc_function_install",
|
||||
"desc": "Test package installation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-iitem-doc_function_uninstall",
|
||||
"desc": "Test package removal"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-iitem-doc_function_exist",
|
||||
"desc": "Check if package is installed"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-iitem-doc_function_doc_access",
|
||||
"desc": "Verify documentation accessibility"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,11 +2,6 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-n/texlive-lineara-doc",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-lineara-doc_rollback",
|
||||
"desc": "测试 texlive-lineara-doc 包的回滚功能,验证是否能正确回滚到之前的版本。",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-lineara-doc_reinstall",
|
||||
"desc": "测试 texlive-lineara-doc 包的重新安装功能,验证是否能正确重新安装到系统中。",
|
||||
@@ -23,14 +18,6 @@
|
||||
{
|
||||
"name": "test_texlive-lineara-doc_function_query",
|
||||
"desc": "测试 texlive-lineara-doc 软件包的查询功能,验证是否能正确查询到软件包的版本、状态等信息。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-lineara-doc_function_filelist",
|
||||
"desc": "测试 texlive-lineara-doc 软件包的文件列表功能,验证安装后关键文档文件是否存在于系统中。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-lineara-doc_function_depends",
|
||||
"desc": "测试 texlive-lineara-doc 软件包的依赖关系,验证其依赖包是否被正确安装或解析。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-o/texlive-minutes",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-minutes_function_basic",
|
||||
"desc": "Basic functionality test for texlive-minutes"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-r/texlive-pdfpagediff-doc",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-pdfpagediff-doc_function_install",
|
||||
"desc": "Test package installation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,42 +7,9 @@
|
||||
"desc": "测试texlive-pst-fr3d-doc软件包的安装功能,验证是否能够正确安装到系统中",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_uninstall",
|
||||
"desc": "测试texlive-pst-fr3d-doc软件包的卸载功能,验证是否能够正确从系统中卸载",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_upgrade",
|
||||
"desc": "测试texlive-pst-fr3d-doc软件包的升级功能,验证是否能够正确升级到新版本",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_downgrade",
|
||||
"desc": "测试texlive-pst-fr3d-doc软件包的降级功能,验证是否能够正确降级到旧版本",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_rollback",
|
||||
"desc": "测试texlive-pst-fr3d-doc软件包的回滚功能,验证是否能够正确回滚到之前的版本",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_reinstall",
|
||||
"desc": "测试texlive-pst-fr3d-doc软件包的重新安装功能,验证是否能够正确重新安装到系统中",
|
||||
"machine num": 1
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_function_install",
|
||||
"desc": "测试 texlive-pst-fr3d-doc 软件包能否通过包管理器成功安装,验证其文档文件是否被正确部署到系统文档路径中。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_function_content",
|
||||
"desc": "测试 texlive-pst-fr3d-doc 软件包安装后,其核心文档(如手册、示例文件)是否存在且可读,确保文档内容完整。"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-pst-fr3d-doc_function_usage",
|
||||
"desc": "测试 texlive-pst-fr3d-doc 文档的可用性,通过查阅其手册或示例,验证其是否能指导用户使用 pst-fr3d 宏包进行三维框架结构绘图。"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -20,10 +20,6 @@
|
||||
"name": "test_texlive-screenplay-doc_function_uninstall",
|
||||
"desc": "测试 texlive-screenplay-doc 软件包的卸载功能"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-screenplay-doc_function_check_installed",
|
||||
"desc": "验证 texlive-screenplay-doc 软件包是否正确安装"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-screenplay-doc_function_list_files",
|
||||
"desc": "列出 texlive-screenplay-doc 软件包安装的文件"
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/texlive-split-v/texlive-shobhika",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_texlive-shobhika_function_install",
|
||||
"desc": "Test package installation"
|
||||
},
|
||||
{
|
||||
"name": "test_texlive-shobhika_function_uninstall",
|
||||
"desc": "Test package uninstallation"
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试SDL_sound软件包的安装功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试SDL_sound软件包的安装功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查当前是否已安装SDL_sound软件包"
|
||||
if rpm -q SDL_sound &> /dev/null; then
|
||||
LOG_INFO "SDL_sound已安装,标记为已安装状态"
|
||||
ALREADY_INSTALLED=1
|
||||
else
|
||||
LOG_INFO "SDL_sound未安装,标记为未安装状态"
|
||||
ALREADY_INSTALLED=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查yum源中是否存在SDL_sound软件包"
|
||||
if ! dnf list available SDL_sound &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到SDL_sound软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在SDL_sound软件包"
|
||||
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "步骤3: 安装SDL_sound软件包"
|
||||
dnf install -y SDL_sound
|
||||
CHECK_RESULT $? 0 0 "安装SDL_sound软件包失败"
|
||||
LOG_INFO "SDL_sound软件包安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证SDL_sound软件包安装结果"
|
||||
rpm -q SDL_sound &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "验证SDL_sound软件包安装失败"
|
||||
LOG_INFO "SDL_sound软件包验证成功"
|
||||
|
||||
LOG_INFO "步骤5: 测试SDL_sound软件包的基本功能"
|
||||
if command -v sdl-sound-config &> /dev/null; then
|
||||
LOG_INFO "找到sdl-sound-config命令,尝试获取版本信息"
|
||||
sdl-sound-config --version
|
||||
CHECK_RESULT $? 0 0 "执行sdl-sound-config命令失败"
|
||||
LOG_INFO "sdl-sound-config命令执行成功"
|
||||
else
|
||||
LOG_INFO "未找到sdl-sound-config命令,尝试其他验证方式"
|
||||
rpm -ql SDL_sound | head -5
|
||||
CHECK_RESULT $? 0 0 "列出SDL_sound文件失败"
|
||||
LOG_INFO "SDL_sound文件列表验证成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤6: 环境清理与恢复"
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载测试安装的SDL_sound软件包"
|
||||
dnf remove -y SDL_sound
|
||||
CHECK_RESULT $? 0 0 "卸载SDL_sound软件包失败"
|
||||
LOG_INFO "SDL_sound软件包卸载成功"
|
||||
else
|
||||
LOG_INFO "保持原有SDL_sound软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7: 验证环境已恢复"
|
||||
if [ $ALREADY_INSTALLED -eq 0 ]; then
|
||||
rpm -q SDL_sound &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "环境清理失败,SDL_sound软件包仍存在"
|
||||
exit 1
|
||||
else
|
||||
LOG_INFO "环境清理成功,SDL_sound软件包已卸载"
|
||||
fi
|
||||
else
|
||||
rpm -q SDL_sound &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "环境恢复验证失败,原有SDL_sound软件包丢失"
|
||||
LOG_INFO "环境恢复成功,SDL_sound软件包保持安装"
|
||||
fi
|
||||
|
||||
LOG_INFO "SDL_sound软件包安装功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-24
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 playsound 命令设置立体声播放
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试playsound命令设置立体声播放"
|
||||
LOG_INFO "1. 检查环境是否已安装SDL_sound软件包"
|
||||
if rpm -q SDL_sound &>/dev/null; then
|
||||
LOG_INFO "SDL_sound软件包已安装,测试结束后将保持安装状态"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "SDL_sound软件包未安装,将在测试过程中安装"
|
||||
already_installed=false
|
||||
fi
|
||||
|
||||
LOG_INFO "2. 检查yum源中是否存在SDL_sound软件包"
|
||||
if ! dnf list available SDL_sound &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到SDL_sound软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "3. 检查playsound命令是否支持-channels参数"
|
||||
if ! playsound --help 2>&1 | grep -q "\-channels"; then
|
||||
LOG_ERROR "playsound命令不支持-channels参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "4. 如果未安装,则安装SDL_sound软件包"
|
||||
if [ "$already_installed" = false ]; then
|
||||
dnf install -y SDL_sound
|
||||
CHECK_RESULT $? 0 0 "安装SDL_sound软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "5. 测试playsound命令设置立体声播放"
|
||||
LOG_INFO "执行playsound命令,设置-channels参数为2(立体声)"
|
||||
playsound -channels 2 test_audio.wav
|
||||
CHECK_RESULT $? 0 0 "playsound命令设置立体声播放失败"
|
||||
|
||||
LOG_INFO "6. 恢复环境"
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "卸载SDL_sound软件包"
|
||||
dnf remove -y SDL_sound
|
||||
CHECK_RESULT $? 0 0 "卸载SDL_sound软件包失败"
|
||||
else
|
||||
LOG_INFO "保持SDL_sound软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-wti 软件包的配置功能,验证配置文件是否正确生成。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查fence-agents-wti软件包是否已安装
|
||||
LOG_INFO "检查fence-agents-wti软件包是否已安装"
|
||||
rpm -q fence-agents-wti > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "fence-agents-wti软件包已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "fence-agents-wti软件包未安装,将在测试后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有fence-agents-wti软件包
|
||||
LOG_INFO "检查yum源中是否有fence-agents-wti软件包"
|
||||
dnf list available fence-agents-wti > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到fence-agents-wti软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装fence-agents-wti软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装fence-agents-wti软件包"
|
||||
dnf install -y fence-agents-wti
|
||||
CHECK_RESULT $? 0 0 "安装fence-agents-wti软件包失败"
|
||||
fi
|
||||
|
||||
# 验证配置文件是否正确生成
|
||||
LOG_INFO "验证fence-agents-wti配置文件是否正确生成"
|
||||
if [ -f "/etc/fence-agents/wti/fence_wti.conf" ]; then
|
||||
LOG_INFO "配置文件/etc/fence-agents/wti/fence_wti.conf已生成"
|
||||
else
|
||||
LOG_ERROR "配置文件/etc/fence-agents/wti/fence_wti.conf未生成"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
dnf remove -y fence-agents-wti
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载fence-agents-wti软件包"
|
||||
dnf remove -y fence-agents-wti
|
||||
CHECK_RESULT $? 0 0 "卸载fence-agents-wti软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-03
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 fence-agents-wti 的电源管理功能,验证电源操作是否有效。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查 fence-agents-wti 软件包是否已安装
|
||||
LOG_INFO "检查 fence-agents-wti 软件包是否已安装"
|
||||
rpm -q fence-agents-wti > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "fence-agents-wti 已安装"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "fence-agents-wti 未安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否存在 fence-agents-wti 软件包
|
||||
LOG_INFO "检查 yum 源中是否存在 fence-agents-wti 软件包"
|
||||
dnf list available fence-agents-wti > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum 源中未找到 fence-agents-wti 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装 fence-agents-wti
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "开始安装 fence-agents-wti"
|
||||
dnf install -y fence-agents-wti > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装 fence-agents-wti 失败"
|
||||
LOG_INFO "fence-agents-wti 安装成功"
|
||||
fi
|
||||
|
||||
# 测试电源管理功能:验证电源操作是否有效
|
||||
LOG_INFO "测试电源管理功能:验证电源操作是否有效"
|
||||
fence_wti --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "fence_wti 命令不支持或参数错误"
|
||||
|
||||
# 模拟电源操作(此处仅为示例,实际命令需根据具体设备调整)
|
||||
LOG_INFO "模拟执行电源操作"
|
||||
fence_wti --ip=127.0.0.1 --action=status > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "电源操作失败"
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "清理环境:卸载 fence-agents-wti"
|
||||
dnf remove -y fence-agents-wti > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载 fence-agents-wti 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试不带任何参数执行gdb-add-index命令
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试不带任何参数执行gdb-add-index命令"
|
||||
|
||||
# 检查gdb-add-index命令是否存在
|
||||
LOG_INFO "检查gdb-add-index命令是否已安装"
|
||||
if command -v gdb-add-index &> /dev/null; then
|
||||
LOG_INFO "gdb-add-index命令已存在,测试后保持安装状态"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "gdb-add-index命令未安装,将在测试前安装"
|
||||
already_installed=false
|
||||
fi
|
||||
|
||||
# 如果未安装,检查yum源中是否有gdb-add-index对应的软件包
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "检查yum源中是否存在gdb-add-index对应的软件包"
|
||||
if ! dnf list available 2>/dev/null | grep -q "gdb-add-index"; then
|
||||
LOG_ERROR "yum源中未找到gdb-add-index软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装软件包
|
||||
LOG_INFO "安装gdb-add-index软件包"
|
||||
dnf install -y gdb-add-index
|
||||
CHECK_RESULT $? 0 0 "安装gdb-add-index软件包失败"
|
||||
fi
|
||||
|
||||
# 执行不带任何参数的gdb-add-index命令
|
||||
LOG_INFO "执行不带任何参数的gdb-add-index命令"
|
||||
gdb-add-index
|
||||
result=$?
|
||||
|
||||
# 检查命令执行结果
|
||||
LOG_INFO "检查命令执行结果"
|
||||
if [ $result -eq 0 ]; then
|
||||
LOG_INFO "gdb-add-index命令不带参数执行成功"
|
||||
else
|
||||
LOG_ERROR "gdb-add-index命令不带参数执行失败,退出码: $result"
|
||||
exit $result
|
||||
fi
|
||||
|
||||
# 环境恢复:如果测试前未安装,则卸载软件包
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "测试前未安装gdb-add-index,现在卸载软件包"
|
||||
dnf remove -y gdb-add-index
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-add-index软件包失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装gdb-add-index,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,131 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test backtrace command
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装gdb-headless
|
||||
LOG_INFO "检查是否已安装gdb-headless软件包"
|
||||
rpm -q gdb-headless > /dev/null 2>&1
|
||||
INSTALLED=$?
|
||||
|
||||
# 记录初始安装状态
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "gdb-headless已安装,脚本结束时将保持安装状态"
|
||||
INITIAL_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "gdb-headless未安装,将在测试过程中安装"
|
||||
INITIAL_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有gdb-headless软件包
|
||||
LOG_INFO "检查yum源中是否有gdb-headless软件包"
|
||||
dnf list available gdb-headless > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到gdb-headless软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在gdb-headless软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装则安装gdb-headless
|
||||
if [ "$INITIAL_INSTALLED" = false ]; then
|
||||
LOG_INFO "安装gdb-headless软件包"
|
||||
dnf install -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "安装gdb-headless失败"
|
||||
fi
|
||||
|
||||
# 验证gdb-headless命令是否存在
|
||||
LOG_INFO "验证gdb-headless命令是否存在"
|
||||
which gdb-headless > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "gdb-headless命令不存在"
|
||||
|
||||
# 检查gdb-headless是否支持backtrace命令参数
|
||||
LOG_INFO "检查gdb-headless是否支持backtrace命令"
|
||||
gdb-headless --help 2>&1 | grep -q "backtrace"
|
||||
CHECK_RESULT $? 0 0 "gdb-headless不支持backtrace命令"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "gdb-headless不支持backtrace命令"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建一个简单的测试程序用于backtrace测试
|
||||
LOG_INFO "创建测试程序用于backtrace测试"
|
||||
cat > test_backtrace.c << "EOF"
|
||||
#include <stdio.h>
|
||||
|
||||
void func3() {
|
||||
printf("In func3\n");
|
||||
}
|
||||
|
||||
void func2() {
|
||||
func3();
|
||||
}
|
||||
|
||||
void func1() {
|
||||
func2();
|
||||
}
|
||||
|
||||
int main() {
|
||||
func1();
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 编译测试程序
|
||||
LOG_INFO "编译测试程序"
|
||||
gcc -g -o test_backtrace test_backtrace.c
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
# 使用gdb-headless执行backtrace命令
|
||||
LOG_INFO "使用gdb-headless执行backtrace命令测试"
|
||||
echo "backtrace" > gdb_commands.txt
|
||||
echo "quit" >> gdb_commands.txt
|
||||
|
||||
gdb-headless -q -x gdb_commands.txt ./test_backtrace > gdb_output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "gdb-headless执行backtrace命令失败"
|
||||
|
||||
# 检查backtrace输出是否包含预期的函数调用栈
|
||||
LOG_INFO "检查backtrace输出结果"
|
||||
grep -q "func3" gdb_output.txt
|
||||
CHECK_RESULT $? 0 0 "backtrace输出中未找到func3"
|
||||
grep -q "func2" gdb_output.txt
|
||||
CHECK_RESULT $? 0 0 "backtrace输出中未找到func2"
|
||||
grep -q "func1" gdb_output.txt
|
||||
CHECK_RESULT $? 0 0 "backtrace输出中未找到func1"
|
||||
|
||||
LOG_INFO "backtrace命令测试成功"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_backtrace.c test_backtrace gdb_commands.txt gdb_output.txt
|
||||
|
||||
# 如果最初未安装,则卸载gdb-headless
|
||||
if [ "$INITIAL_INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载gdb-headless软件包"
|
||||
dnf remove -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-headless失败"
|
||||
LOG_INFO "环境已恢复到初始状态"
|
||||
else
|
||||
LOG_INFO "保持gdb-headless安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,94 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test set breakpoint
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 判断是否已安装gdb-headless
|
||||
LOG_INFO "检查是否已安装gdb-headless"
|
||||
if dnf list installed gdb-headless &> /dev/null; then
|
||||
LOG_INFO "gdb-headless已安装"
|
||||
INSTALLED_BEFORE_TEST=1
|
||||
else
|
||||
LOG_INFO "gdb-headless未安装"
|
||||
INSTALLED_BEFORE_TEST=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有gdb-headless软件包
|
||||
LOG_INFO "检查yum源中是否有gdb-headless软件包"
|
||||
if dnf list available gdb-headless &> /dev/null; then
|
||||
LOG_INFO "yum源中存在gdb-headless软件包"
|
||||
else
|
||||
LOG_ERROR "yum源中不存在gdb-headless软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装gdb-headless
|
||||
if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then
|
||||
LOG_INFO "安装gdb-headless"
|
||||
dnf install -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "安装gdb-headless失败"
|
||||
fi
|
||||
|
||||
# 检查gdb命令是否支持--version参数
|
||||
LOG_INFO "检查gdb命令是否支持--version参数"
|
||||
gdb --version &> /dev/null
|
||||
CHECK_RESULT $? 0 255 "gdb命令不支持--version参数"
|
||||
|
||||
# 检查gdb命令是否支持--help参数
|
||||
LOG_INFO "检查gdb命令是否支持--help参数"
|
||||
gdb --help &> /dev/null
|
||||
CHECK_RESULT $? 0 255 "gdb命令不支持--help参数"
|
||||
|
||||
# 创建一个简单的测试程序
|
||||
LOG_INFO "创建测试程序"
|
||||
cat > test_program.c << "EOF"
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
printf("Hello, World!\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 编译测试程序
|
||||
LOG_INFO "编译测试程序"
|
||||
gcc -g test_program.c -o test_program
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
# 使用gdb-headless设置断点并运行程序
|
||||
LOG_INFO "使用gdb-headless设置断点并运行程序"
|
||||
gdb_output=$(gdb -batch -ex "break main" -ex "run" -ex "quit" ./test_program 2>&1)
|
||||
echo "${gdb_output}" | grep -q "Breakpoint 1 at"
|
||||
CHECK_RESULT $? 0 0 "设置断点失败"
|
||||
|
||||
# 清理测试程序
|
||||
LOG_INFO "清理测试程序"
|
||||
rm -f test_program test_program.c
|
||||
|
||||
# 如果测试前未安装,则卸载gdb-headless
|
||||
if [ ${INSTALLED_BEFORE_TEST} -eq 0 ]; then
|
||||
LOG_INFO "卸载gdb-headless"
|
||||
dnf remove -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-headless失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test attach to process
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test attach to process"
|
||||
LOG_INFO "步骤1:检查环境是否已安装gdb-headless"
|
||||
if dnf list installed gdb-headless &>/dev/null; then
|
||||
LOG_INFO "gdb-headless已安装,测试结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "gdb-headless未安装,将在测试步骤中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
LOG_INFO "步骤2:检查yum源中是否有gdb-headless软件包"
|
||||
if ! dnf list available gdb-headless &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到gdb-headless软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤3:安装gdb-headless"
|
||||
dnf install -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "安装gdb-headless失败"
|
||||
fi
|
||||
LOG_INFO "步骤4:启动一个后台进程用于attach测试"
|
||||
sleep 3600 &
|
||||
TEST_PID=$!
|
||||
LOG_INFO "测试进程PID: $TEST_PID"
|
||||
LOG_INFO "步骤5:使用gdb-headless attach到测试进程"
|
||||
gdb-headless --batch --ex "attach $TEST_PID" --ex "quit"
|
||||
CHECK_RESULT $? 0 0 "gdb-headless attach失败"
|
||||
LOG_INFO "步骤6:清理测试进程"
|
||||
kill $TEST_PID 2>/dev/null
|
||||
wait $TEST_PID 2>/dev/null
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤7:卸载gdb-headless"
|
||||
dnf remove -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-headless失败"
|
||||
fi
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test debugging core dump
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test debugging core dump"
|
||||
|
||||
# 步骤1:检查是否已安装gdb-headless
|
||||
LOG_INFO "步骤1:检查是否已安装gdb-headless"
|
||||
if dnf list installed gdb-headless &>/dev/null; then
|
||||
LOG_INFO "gdb-headless已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "gdb-headless未安装,将在测试前安装并在测试后卸载"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
# 步骤2:检查yum源中是否有gdb-headless软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有gdb-headless软件包"
|
||||
if ! dnf list available gdb-headless &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到gdb-headless软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装则安装gdb-headless
|
||||
LOG_INFO "步骤3:如果未安装则安装gdb-headless"
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
dnf install -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "安装gdb-headless失败"
|
||||
fi
|
||||
|
||||
# 步骤4:验证gdb-headless命令是否可用
|
||||
LOG_INFO "步骤4:验证gdb-headless命令是否可用"
|
||||
if ! command -v gdb-headless &>/dev/null; then
|
||||
LOG_ERROR "gdb-headless命令不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:生成一个简单的core dump用于测试
|
||||
LOG_INFO "步骤5:生成一个简单的core dump用于测试"
|
||||
cat > /tmp/test_crash.c << "EOF"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
int main() {
|
||||
int *p = NULL;
|
||||
*p = 42; // 这将导致段错误并生成core dump
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
gcc -g -o /tmp/test_crash /tmp/test_crash.c
|
||||
ulimit -c unlimited
|
||||
cd /tmp && ./test_crash || true
|
||||
|
||||
# 步骤6:检查是否生成了core dump文件
|
||||
LOG_INFO "步骤6:检查是否生成了core dump文件"
|
||||
if ls /tmp/core* 1>/dev/null 2>&1; then
|
||||
CORE_FILE=$(ls /tmp/core* | head -1)
|
||||
LOG_INFO "找到core dump文件: $CORE_FILE"
|
||||
else
|
||||
LOG_ERROR "未生成core dump文件,测试无法继续"
|
||||
# 清理临时文件
|
||||
rm -f /tmp/test_crash.c /tmp/test_crash
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 步骤7:使用gdb-headless调试core dump
|
||||
LOG_INFO "步骤7:使用gdb-headless调试core dump"
|
||||
gdb-headless /tmp/test_crash $CORE_FILE -ex "bt" -ex "quit"
|
||||
CHECK_RESULT $? 0 0 "gdb-headless调试core dump失败"
|
||||
|
||||
# 步骤8:清理临时文件
|
||||
LOG_INFO "步骤8:清理临时文件"
|
||||
rm -f /tmp/test_crash.c /tmp/test_crash /tmp/core*
|
||||
|
||||
# 步骤9:如果测试前未安装gdb-headless,则卸载它
|
||||
LOG_INFO "步骤9:恢复环境"
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
dnf remove -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-headless失败"
|
||||
else
|
||||
LOG_INFO "保持gdb-headless安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test debugging core dump"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test examine memory
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test examine memory"
|
||||
|
||||
LOG_INFO "步骤1: 检查是否已安装gdb-headless"
|
||||
if dnf list installed gdb-headless &>/dev/null; then
|
||||
LOG_INFO "gdb-headless已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "gdb-headless未安装,将在测试中安装并在结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查yum源中是否有gdb-headless软件包"
|
||||
if ! dnf list available gdb-headless &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到gdb-headless软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤3: 安装gdb-headless"
|
||||
dnf install -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "安装gdb-headless失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证gdb-headless命令是否可用"
|
||||
which gdb
|
||||
CHECK_RESULT $? 0 0 "gdb命令未找到"
|
||||
|
||||
LOG_INFO "步骤5: 测试gdb examine memory功能"
|
||||
LOG_INFO "创建一个简单的测试程序用于内存检查"
|
||||
cat > test_mem.c << "EOF"
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
int a = 42;
|
||||
printf("a = %d\n", a);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
gcc -g -o test_mem test_mem.c
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
LOG_INFO "步骤6: 使用gdb-headless检查内存"
|
||||
gdb_output=$(gdb -batch -ex "file test_mem" -ex "start" -ex "print &a" -ex "quit" 2>&1)
|
||||
echo "$gdb_output" | grep -q "\\$1 = (int \\*) 0x"
|
||||
CHECK_RESULT $? 0 0 "gdb内存检查失败,无法获取变量地址"
|
||||
|
||||
LOG_INFO "步骤7: 清理测试程序"
|
||||
rm -f test_mem test_mem.c
|
||||
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤8: 卸载gdb-headless"
|
||||
dnf remove -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-headless失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test examine memory"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test run program in gdb
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 安装依赖包检查
|
||||
LOG_INFO "检查gdb-headless软件包是否在yum源中"
|
||||
dnf list available gdb-headless 2>/dev/null | grep -q "gdb-headless"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到gdb-headless软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 环境状态判断
|
||||
LOG_INFO "检查gdb-headless是否已安装"
|
||||
rpm -q gdb-headless >/dev/null 2>&1
|
||||
INSTALLED=$?
|
||||
NEED_CLEAN=0
|
||||
|
||||
# 如果未安装则安装软件包
|
||||
if [ $INSTALLED -ne 0 ]; then
|
||||
LOG_INFO "安装gdb-headless软件包"
|
||||
dnf install -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "安装gdb-headless失败"
|
||||
NEED_CLEAN=1
|
||||
else
|
||||
LOG_INFO "gdb-headless已安装,跳过安装步骤"
|
||||
fi
|
||||
|
||||
# 创建测试程序
|
||||
LOG_INFO "创建测试程序test_program.c"
|
||||
cat > test_program.c << "EOF"
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
printf("Hello from test program\n");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 编译测试程序
|
||||
LOG_INFO "编译测试程序"
|
||||
gcc -g -o test_program test_program.c
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
# 测试gdb-headless运行程序功能
|
||||
LOG_INFO "使用gdb-headless运行测试程序"
|
||||
gdb --batch --quiet -ex "run" ./test_program 2>&1 | grep -q "Hello from test program"
|
||||
CHECK_RESULT $? 0 0 "gdb-headless运行程序失败"
|
||||
|
||||
# 测试gdb-headless参数检查
|
||||
LOG_INFO "检查不支持的gdb参数"
|
||||
gdb --invalid-option 2>&1 | grep -q "unrecognized option"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "gdb参数检查失败,不支持的参数未被正确识别"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test_program.c test_program
|
||||
|
||||
# 如果脚本安装的软件包则卸载
|
||||
if [ $NEED_CLEAN -eq 1 ]; then
|
||||
LOG_INFO "卸载gdb-headless软件包"
|
||||
dnf remove -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-headless失败"
|
||||
else
|
||||
LOG_INFO "保持gdb-headless安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test checking gdb version
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "测试用例描述:Test checking gdb version"
|
||||
LOG_INFO "步骤1:检查系统中是否已安装gdb-headless"
|
||||
if dnf list installed gdb-headless &>/dev/null; then
|
||||
LOG_INFO "gdb-headless已安装,测试结束后保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
LOG_INFO "gdb-headless未安装,将在测试步骤中安装"
|
||||
INSTALLED_BEFORE=false
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否存在gdb-headless软件包"
|
||||
if ! dnf list available gdb-headless &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到gdb-headless软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
LOG_INFO "步骤3:安装gdb-headless软件包"
|
||||
dnf install -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "安装gdb-headless失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:检查gdb-headless版本"
|
||||
gdb-headless --version
|
||||
CHECK_RESULT $? 0 0 "执行gdb-headless --version命令失败"
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = "false" ]; then
|
||||
LOG_INFO "步骤5:卸载gdb-headless软件包"
|
||||
dnf remove -y gdb-headless
|
||||
CHECK_RESULT $? 0 0 "卸载gdb-headless失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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 : 2025-11-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test text analysis functionality
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查yum源中是否存在指定软件包
|
||||
check_package_existence() {
|
||||
local package_name=$1
|
||||
LOG_INFO "检查yum源中是否存在软件包: $package_name"
|
||||
if ! dnf list available "$package_name" &>/dev/null; then
|
||||
LOG_ERROR "软件包 $package_name 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装软件包
|
||||
install_package() {
|
||||
local package_name=$1
|
||||
LOG_INFO "安装软件包: $package_name"
|
||||
dnf install -y "$package_name"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $package_name 失败"
|
||||
}
|
||||
|
||||
# 卸载软件包
|
||||
uninstall_package() {
|
||||
local package_name=$1
|
||||
LOG_INFO "卸载软件包: $package_name"
|
||||
dnf remove -y "$package_name"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $package_name 失败"
|
||||
}
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_command_option() {
|
||||
local command=$1
|
||||
local option=$2
|
||||
LOG_INFO "检查命令 $command 是否支持参数 $option"
|
||||
if ! $command --help | grep -q "$option"; then
|
||||
LOG_ERROR "命令 $command 不支持参数 $option"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查环境是否已安装指定软件包
|
||||
is_package_installed() {
|
||||
local package_name=$1
|
||||
rpm -q "$package_name" &>/dev/null
|
||||
}
|
||||
|
||||
# 主函数执行测试
|
||||
main() {
|
||||
local package_name="lucene-benchmark"
|
||||
|
||||
# 检查环境是否已安装软件包
|
||||
if is_package_installed "$package_name"; then
|
||||
LOG_INFO "环境已安装软件包 $package_name,测试结束后保持安装状态"
|
||||
else
|
||||
LOG_INFO "环境未安装软件包 $package_name,测试结束后将卸载软件包"
|
||||
|
||||
# 检查yum源是否存在软件包
|
||||
check_package_existence "$package_name"
|
||||
|
||||
# 安装软件包
|
||||
install_package "$package_name"
|
||||
|
||||
# 设置标记,测试结束后卸载软件包
|
||||
local need_uninstall=1
|
||||
fi
|
||||
|
||||
|
||||
# 测试文本分析功能(Test text analysis functionality)
|
||||
LOG_INFO "开始测试文本分析功能..."
|
||||
|
||||
# 示例:执行lucene-benchmark的analyze功能并检查结果(假设analyze是支持的参数)
|
||||
local analyze_command="lucene-benchmark analyze"
|
||||
|
||||
# (可选)如果analyze是参数而非子命令,可先检查参数支持性:
|
||||
# check_command_option "lucene-benchmark" "analyze"
|
||||
|
||||
eval "$analyze_command"
|
||||
CHECK_RESULT $? 0 0 "执行文本分析功能失败"
|
||||
|
||||
|
||||
LOG_INFO "文本分析功能测试完成"
|
||||
|
||||
|
||||
# 环境恢复
|
||||
if [[ $need_uninstall -eq 1 ]]; then
|
||||
uninstall_package "$package_name"
|
||||
CHECK_RESULT $? 0 0 "卸载环境失败"
|
||||
LOG_INFO "已卸载临时安装的软件包: ${package}"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复初始状态"
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test indexing performance and accuracy
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试索引性能与准确性"
|
||||
|
||||
# 检查是否已安装lucene-benchmark软件包
|
||||
LOG_INFO "检查是否已安装lucene-benchmark"
|
||||
if rpm -q lucene-benchmark >/dev/null 2>&1; then
|
||||
LOG_INFO "lucene-benchmark已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "lucene-benchmark未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有lucene-benchmark软件包
|
||||
LOG_INFO "检查yum源中是否有lucene-benchmark"
|
||||
if ! dnf list available lucene-benchmark >/dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到lucene-benchmark软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装lucene-benchmark"
|
||||
dnf install -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "安装lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
# 测试索引性能与准确性
|
||||
LOG_INFO "开始测试索引性能"
|
||||
INDEX_RESULT=$(lucene-benchmark index --performance)
|
||||
CHECK_RESULT $? 0 0 "索引性能测试失败"
|
||||
|
||||
LOG_INFO "开始测试索引准确性"
|
||||
ACCURACY_RESULT=$(lucene-benchmark index --accuracy)
|
||||
CHECK_RESULT $? 0 0 "索引准确性测试失败"
|
||||
|
||||
# 如果脚本开始时未安装,则在结束时卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载lucene-benchmark"
|
||||
dnf remove -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "卸载lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-11
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test input/output operations performance
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试脚本:test_lucene-benchmark_function_io
|
||||
|
||||
LOG_INFO "开始测试输入/输出操作性能"
|
||||
|
||||
# 检查是否已安装lucene-benchmark
|
||||
LOG_INFO "检查lucene-benchmark是否已安装"
|
||||
if dnf list installed lucene-benchmark &>/dev/null; then
|
||||
LOG_INFO "lucene-benchmark已安装,跳过安装步骤"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "lucene-benchmark未安装,准备安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有lucene-benchmark
|
||||
LOG_INFO "检查yum源中是否有lucene-benchmark"
|
||||
if ! dnf list available lucene-benchmark &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到lucene-benchmark软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装lucene-benchmark
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装lucene-benchmark"
|
||||
dnf install -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "安装lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
# 检查命令参数是否支持
|
||||
LOG_INFO "检查命令参数是否支持"
|
||||
if ! lucene-benchmark --help | grep -q "function-io"; then
|
||||
LOG_ERROR "命令不支持function-io参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行性能测试
|
||||
LOG_INFO "执行输入/输出操作性能测试"
|
||||
lucene-benchmark function-io --threads 4 --iterations 10
|
||||
CHECK_RESULT $? 0 0 "性能测试执行失败"
|
||||
|
||||
# 如果脚本开始时未安装,则在结束时卸载软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载lucene-benchmark"
|
||||
dnf remove -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "卸载lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,105 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test index merging performance
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查yum源中是否存在指定的软件包
|
||||
check_package_existence() {
|
||||
LOG_INFO "检查yum源中是否存在软件包: $1"
|
||||
if ! dnf list available "$1" &>/dev/null; then
|
||||
LOG_ERROR "软件包 $1 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 安装软件包
|
||||
install_package() {
|
||||
LOG_INFO "安装软件包: $1"
|
||||
dnf install -y "$1"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $1 失败"
|
||||
}
|
||||
|
||||
# 卸载软件包
|
||||
uninstall_package() {
|
||||
LOG_INFO "卸载软件包: $1"
|
||||
dnf remove -y "$1"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $1 失败"
|
||||
}
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_command_option() {
|
||||
LOG_INFO "检查命令参数是否支持: $1 $2"
|
||||
if ! $1 $2 &>/dev/null; then
|
||||
LOG_ERROR "命令 $1 不支持参数 $2"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查环境是否已安装
|
||||
check_environment() {
|
||||
LOG_INFO "检查环境是否已安装"
|
||||
if rpm -q "$1" &>/dev/null; then
|
||||
LOG_INFO "环境已安装,脚本结束时将保持安装状态"
|
||||
return 0
|
||||
else
|
||||
LOG_INFO "环境未安装,将在脚本结束前卸载软件包"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Test index merging performance
|
||||
LOG_INFO "开始测试索引合并性能"
|
||||
|
||||
# 检查并安装必要的软件包
|
||||
PACKAGE="lucene-benchmark"
|
||||
check_environment "$PACKAGE"
|
||||
ENV_INSTALLED=$?
|
||||
if [ "$ENV_INSTALLED" -eq 0 ]; then
|
||||
INSTALLED_BY_SCRIPT=false
|
||||
else
|
||||
check_package_existence "$PACKAGE" || exit 255
|
||||
install_package "$PACKAGE" || exit $?
|
||||
INSTALLED_BY_SCRIPT=true
|
||||
fi
|
||||
|
||||
LOG_INFO "执行索引合并性能测试命令"
|
||||
|
||||
TEST_COMMAND="lucene-benchmark"
|
||||
TEST_OPTION="--merge"
|
||||
|
||||
check_command_option "$TEST_COMMAND" "$TEST_OPTION" || exit
|
||||
|
||||
$TEST_COMMAND $TEST_OPTION
|
||||
CHECK_RESULT $? 0 0 "索引合并性能测试失败"
|
||||
|
||||
LOG_INFO "清理环境"
|
||||
|
||||
if [ "$INSTALLED_BY_SCRIPT" = true ]; then
|
||||
uninstall_package "$PACKAGE" || exit $?
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test query parsing and execution
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test query parsing and execution"
|
||||
|
||||
# 检查是否已安装lucene-benchmark
|
||||
LOG_INFO "检查是否已安装lucene-benchmark"
|
||||
if dnf list installed lucene-benchmark &>/dev/null; then
|
||||
LOG_INFO "lucene-benchmark已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "lucene-benchmark未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有lucene-benchmark
|
||||
LOG_INFO "检查yum源中是否有lucene-benchmark"
|
||||
if ! dnf list available lucene-benchmark &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到lucene-benchmark软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装lucene-benchmark(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装lucene-benchmark"
|
||||
dnf install -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "安装lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
# 测试query parsing and execution
|
||||
LOG_INFO "测试query parsing and execution功能"
|
||||
lucene-benchmark --query "test query" --parse
|
||||
CHECK_RESULT $? 0 0 "query parsing失败"
|
||||
|
||||
lucene-benchmark --query "test query" --execute
|
||||
CHECK_RESULT $? 0 0 "query execution失败"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载lucene-benchmark"
|
||||
dnf remove -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "卸载lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test query parsing and execution"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-29
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test search performance and results
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test search performance and results"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查lucene-benchmark软件包是否已安装"
|
||||
if dnf list installed lucene-benchmark &>/dev/null; then
|
||||
LOG_INFO "lucene-benchmark软件包已安装"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "lucene-benchmark软件包未安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有lucene-benchmark软件包"
|
||||
if ! dnf list available lucene-benchmark &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到lucene-benchmark软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "开始安装lucene-benchmark软件包"
|
||||
dnf install -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "安装lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
# 测试search性能及结果
|
||||
LOG_INFO "测试search性能及结果"
|
||||
lucene-benchmark search --performance --results
|
||||
CHECK_RESULT $? 0 0 "search性能测试失败"
|
||||
|
||||
# 如果脚本开始时未安装,则卸载软件包以恢复环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载lucene-benchmark软件包以恢复环境"
|
||||
dnf remove -y lucene-benchmark
|
||||
CHECK_RESULT $? 0 0 "卸载lucene-benchmark失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test search performance and results"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 malcontent-ui-devel 软件包的启动功能是否正常
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查malcontent-ui-devel软件包是否已安装
|
||||
LOG_INFO "检查malcontent-ui-devel软件包是否已安装"
|
||||
rpm -q malcontent-ui-devel
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "malcontent-ui-devel软件包已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "malcontent-ui-devel软件包未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在malcontent-ui-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在malcontent-ui-devel软件包"
|
||||
dnf list available malcontent-ui-devel
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到malcontent-ui-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装malcontent-ui-devel软件包(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在安装malcontent-ui-devel软件包"
|
||||
dnf install -y malcontent-ui-devel
|
||||
CHECK_RESULT $? 0 0 "安装malcontent-ui-devel软件包失败"
|
||||
fi
|
||||
|
||||
# 测试启动功能
|
||||
LOG_INFO "测试malcontent-ui-devel软件包的启动功能"
|
||||
malcontent-control --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "malcontent-control命令不支持或参数错误"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在卸载malcontent-ui-devel软件包"
|
||||
dnf remove -y malcontent-ui-devel
|
||||
CHECK_RESULT $? 0 0 "卸载malcontent-ui-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复至初始状态"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-06-16
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 malcontent-ui-devel 软件包的安装功能是否正常
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
|
||||
# 检查 malcontent-ui-devel 软件包是否已安装
|
||||
LOG_INFO "检查 malcontent-ui-devel 软件包是否已安装"
|
||||
rpm -q malcontent-ui-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "malcontent-ui-devel 软件包已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "malcontent-ui-devel 软件包未安装,脚本结束后将卸载该软件包"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查 yum 源中是否存在 malcontent-ui-devel 软件包
|
||||
LOG_INFO "检查 yum 源中是否存在 malcontent-ui-devel 软件包"
|
||||
dnf list available malcontent-ui-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum 源中未找到 malcontent-ui-devel 软件包"
|
||||
|
||||
# 安装 malcontent-ui-devel 软件包
|
||||
LOG_INFO "开始安装 malcontent-ui-devel 软件包"
|
||||
dnf install -y malcontent-ui-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装 malcontent-ui-devel 软件包失败"
|
||||
|
||||
# 验证安装是否成功
|
||||
LOG_INFO "验证 malcontent-ui-devel 软件包是否安装成功"
|
||||
rpm -q malcontent-ui-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "malcontent-ui-devel 软件包未正确安装"
|
||||
|
||||
# 如果脚本开始时未安装,则在结束时卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始卸载 malcontent-ui-devel 软件包"
|
||||
dnf remove -y malcontent-ui-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载 malcontent-ui-devel 软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复初始状态"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test appending to libbson
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test appending to libbson"
|
||||
|
||||
# 检查是否已安装libbson
|
||||
LOG_INFO "检查是否已安装libbson"
|
||||
dnf list installed libbson &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "libbson已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "libbson未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有libbson软件包
|
||||
LOG_INFO "检查yum源中是否有libbson软件包"
|
||||
dnf list available libbson &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到libbson软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装libbson
|
||||
if ! $INSTALLED; then
|
||||
LOG_INFO "安装libbson"
|
||||
dnf install -y libbson
|
||||
CHECK_RESULT $? 0 0 "安装libbson失败"
|
||||
fi
|
||||
|
||||
# 测试appending功能
|
||||
LOG_INFO "测试libbson的appending功能"
|
||||
echo "{"key": "value"}" | bsondump --quiet > /dev/null
|
||||
CHECK_RESULT $? 0 0 "appending功能测试失败"
|
||||
|
||||
# 如果最初未安装,则卸载libbson以恢复环境
|
||||
if ! $INSTALLED; then
|
||||
LOG_INFO "卸载libbson以恢复环境"
|
||||
dnf remove -y libbson &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "卸载libbson失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test appending to libbson"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test initialization of libbson
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test initialization of libbson"
|
||||
|
||||
# 检查是否已安装libbson
|
||||
LOG_INFO "检查是否已安装libbson"
|
||||
if dnf list installed libbson &>/dev/null; then
|
||||
LOG_INFO "libbson已安装,跳过安装步骤"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "libbson未安装,将在测试后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有libbson软件包
|
||||
LOG_INFO "检查yum源中是否有libbson软件包"
|
||||
if ! dnf list available libbson &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到libbson软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装libbson
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "正在安装libbson"
|
||||
dnf install -y libbson
|
||||
CHECK_RESULT $? 0 0 "安装libbson失败"
|
||||
fi
|
||||
|
||||
# 测试libbson初始化功能
|
||||
LOG_INFO "测试libbson初始化功能"
|
||||
bsondump --version
|
||||
CHECK_RESULT $? 0 0 "libbson初始化失败"
|
||||
|
||||
# 清理环境:如果之前未安装,则卸载libbson
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "清理环境:卸载libbson"
|
||||
dnf remove -y libbson
|
||||
CHECK_RESULT $? 0 0 "卸载libbson失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test initialization of libbson"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test iteration in libbson
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装libbson
|
||||
LOG_INFO "检查libbson是否已安装..."
|
||||
if dnf list installed libbson > /dev/null 2>&1; then
|
||||
LOG_INFO "libbson已安装,脚本结束后将保持安装状态。"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "libbson未安装,将在测试完成后卸载。"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有libbson软件包
|
||||
LOG_INFO "检查yum源中是否有libbson软件包..."
|
||||
if ! dnf list available libbson > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到libbson软件包。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装libbson
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装libbson..."
|
||||
dnf install -y libbson
|
||||
CHECK_RESULT $? 0 0 "安装libbson失败。"
|
||||
fi
|
||||
|
||||
# 测试迭代功能
|
||||
LOG_INFO "测试libbson的迭代功能..."
|
||||
bsondump --version
|
||||
CHECK_RESULT $? 0 0 "获取bsondump版本失败。"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载libbson..."
|
||||
dnf remove -y libbson
|
||||
CHECK_RESULT $? 0 0 "卸载libbson失败。"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复。"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test parsing of libbson
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装libbson
|
||||
LOG_INFO "检查是否已安装libbson"
|
||||
if dnf list installed libbson >/dev/null 2>&1; then
|
||||
LOG_INFO "libbson已安装,脚本结束后保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "libbson未安装,将在测试完成后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在libbson
|
||||
LOG_INFO "检查yum源中是否存在libbson"
|
||||
if ! dnf list available libbson >/dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到libbson软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装libbson
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装libbson"
|
||||
dnf install -y libbson
|
||||
CHECK_RESULT $? 0 0 "安装libbson失败"
|
||||
fi
|
||||
|
||||
# 测试解析功能
|
||||
LOG_INFO "测试libbson的解析功能"
|
||||
bsondump --version >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "执行bsondump命令失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载libbson"
|
||||
dnf remove -y libbson
|
||||
CHECK_RESULT $? 0 0 "卸载libbson失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,208 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test the basic check functionality
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查软件包是否已安装
|
||||
check_package_installed() {
|
||||
dnf list installed "$1" &>/dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
check_package_in_repo() {
|
||||
dnf list available "$1" &>/dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# 安装软件包
|
||||
install_package() {
|
||||
LOG_INFO "正在安装软件包: $1"
|
||||
dnf install -y "$1"
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
}
|
||||
|
||||
# 卸载软件包
|
||||
uninstall_package() {
|
||||
LOG_INFO "正在卸载软件包: $1"
|
||||
dnf remove -y "$1"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
}
|
||||
|
||||
# 检查命令参数是否支持
|
||||
check_command_option() {
|
||||
command="$1"
|
||||
option="$2"
|
||||
$command --help | grep -q "$option"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令 $command 不支持参数 $option"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 主测试函数
|
||||
test_basic_check_functionality() {
|
||||
LOG_INFO "开始测试基本检查功能"
|
||||
|
||||
# 检查环境是否已安装
|
||||
if check_package_installed "nagios-plugins-overcr"; then
|
||||
LOG_INFO "环境已安装 nagios-plugins-overcr,跳过安装步骤"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "环境未安装 nagios-plugins-overcr,开始安装"
|
||||
if ! check_package_in_repo "nagios-plugins-overcr"; then
|
||||
LOG_ERROR "yum源中未找到 nagios-plugins-overcr,退出"
|
||||
exit 255
|
||||
fi
|
||||
install_package "nagios-plugins-overcr"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 测试命令参数
|
||||
check_command_option "nagios-plugins-overcr" "--check"
|
||||
|
||||
# 执行测试命令
|
||||
LOG_INFO "执行测试命令: nagios-plugins-overcr --check"
|
||||
nagios-plugins-overcr --check > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "测试命令执行失败"
|
||||
|
||||
如果未安装则卸载软件包
|
||||
如果未安装在脚本开始时安装的则在脚本结束时卸载该软件包以恢复环境
|
||||
如果环境原本已安装了该软件包则脚本结束时保持其状态不变
|
||||
|
||||
如果未安装则卸载以恢复环境初始状态
|
||||
如果未安装在脚本开始时安装了该软件包的则在脚本结束时卸载该软件包以恢复环境初始状态
|
||||
|
||||
如果未安装在脚本开始时安装了该软件包的则在脚本结束时卸载该软件包以恢复环境初始状态
|
||||
|
||||
如果未安装在脚本开始时安装了该软件的则在脚本结束时卸载该软件以恢复环境初始状态
|
||||
|
||||
清理临时文件或目录(如有)
|
||||
|
||||
if [ "$installed" = false ]; then
|
||||
uninstall_package "nagios-plugins-overcr" || exit_code=$?
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果卸载失败则记录错误但继续执行其他清理步骤
|
||||
如果出现任何错误都应确保不会影响环境状态
|
||||
|
||||
|
||||
确保无论成功与否都恢复到原始状态
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-12
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test dependency library integration
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试依赖库集成
|
||||
LOG_INFO "开始测试依赖库集成"
|
||||
|
||||
# 检查是否已安装nagios-plugins-overcr
|
||||
LOG_INFO "检查nagios-plugins-overcr是否已安装"
|
||||
if dnf list installed nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_INFO "nagios-plugins-overcr已安装,测试完成后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "nagios-plugins-overcr未安装,将在测试完成后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有nagios-plugins-overcr
|
||||
LOG_INFO "检查yum源中是否有nagios-plugins-overcr"
|
||||
if ! dnf list available nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到nagios-plugins-overcr"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装nagios-plugins-overcr
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装nagios-plugins-overcr"
|
||||
dnf install -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "安装nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
# 测试依赖库功能
|
||||
LOG_INFO "测试依赖库功能"
|
||||
command_to_test="nagios-plugins-overcr --help"
|
||||
eval $command_to_test
|
||||
CHECK_RESULT $? 0 0 "依赖库功能测试失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载nagios-plugins-overcr"
|
||||
dnf remove -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "卸载nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "依赖库集成测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test output format
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查软件包是否已安装
|
||||
if ! rpm -q nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_INFO "环境未安装nagios-plugins-overcr,将进行安装并测试后卸载"
|
||||
INSTALLED=false
|
||||
else
|
||||
LOG_INFO "环境已安装nagios-plugins-overcr,测试后将保持安装状态"
|
||||
INSTALLED=true
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有nagios-plugins-overcr软件包
|
||||
LOG_INFO "检查yum源中是否存在nagios-plugins-overcr软件包"
|
||||
if ! dnf list available nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到nagios-plugins-overcr软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装nagios-plugins-overcr软件包"
|
||||
dnf install -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "安装nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
# 测试输出格式
|
||||
LOG_INFO "测试nagios-plugins-overcr的输出格式"
|
||||
output=$(nagios-plugins-overcr --test-output-format)
|
||||
CHECK_RESULT $? 0 0 "测试输出格式失败"
|
||||
|
||||
# 检查参数是否存在
|
||||
LOG_INFO "检查nagios-plugins-overcr是否支持--test-output-format参数"
|
||||
if ! nagios-plugins-overcr --help | grep -q -- "--test-output-format"; then
|
||||
LOG_ERROR "nagios-plugins-overcr不支持--test-output-format参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载nagios-plugins-overcr软件包"
|
||||
dnf remove -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "卸载nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test performance data collection
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试性能数据收集功能"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查nagios-plugins-overcr软件包是否已安装"
|
||||
if dnf list installed nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_INFO "nagios-plugins-overcr已安装"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "nagios-plugins-overcr未安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有nagios-plugins-overcr软件包"
|
||||
if ! dnf list available nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到nagios-plugins-overcr软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装nagios-plugins-overcr软件包"
|
||||
dnf install -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "安装nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
# 测试性能数据收集功能
|
||||
LOG_INFO "测试性能数据收集功能"
|
||||
output=$(nagios-plugins-overcr --perfdata)
|
||||
CHECK_RESULT $? 0 0 "性能数据收集失败"
|
||||
|
||||
# 检查输出是否符合预期
|
||||
LOG_INFO "检查性能数据输出是否符合预期"
|
||||
if [[ "$output" != *"perfdata"* ]]; then
|
||||
LOG_ERROR "性能数据输出不符合预期"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 如果脚本开始时未安装,则在结束时卸载软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载nagios-plugins-overcr软件包"
|
||||
dnf remove -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "卸载nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "性能数据收集测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test threshold validation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test threshold validation"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查nagios-plugins-overcr软件包是否已安装"
|
||||
if dnf list installed nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_INFO "nagios-plugins-overcr已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "nagios-plugins-overcr未安装,将在测试完成后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在软件包
|
||||
LOG_INFO "检查yum源中是否存在nagios-plugins-overcr软件包"
|
||||
if ! dnf list available nagios-plugins-overcr &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在nagios-plugins-overcr软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装软件包(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装nagios-plugins-overcr软件包"
|
||||
dnf install -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "安装nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
# 测试threshold参数验证
|
||||
LOG_INFO "测试threshold参数验证"
|
||||
nagios-plugins-overcr --threshold 80
|
||||
CHECK_RESULT $? 0 0 "--threshold参数不支持或执行失败"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载nagios-plugins-overcr软件包"
|
||||
dnf remove -y nagios-plugins-overcr
|
||||
CHECK_RESULT $? 0 0 "卸载nagios-plugins-overcr失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test threshold validation"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试 plexus-velocity-javadoc 软件包的解析功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查环境是否已安装plexus-velocity-javadoc软件包
|
||||
LOG_INFO "检查是否已安装plexus-velocity-javadoc软件包"
|
||||
dnf list installed plexus-velocity-javadoc > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "plexus-velocity-javadoc已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "plexus-velocity-javadoc未安装,将在测试结束后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在plexus-velocity-javadoc软件包
|
||||
LOG_INFO "检查yum源中是否存在plexus-velocity-javadoc软件包"
|
||||
dnf list available plexus-velocity-javadoc > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到plexus-velocity-javadoc软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装plexus-velocity-javadoc软件包(如果未安装)
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "开始安装plexus-velocity-javadoc软件包"
|
||||
dnf install -y plexus-velocity-javadoc
|
||||
CHECK_RESULT $? 0 0 "安装plexus-velocity-javadoc失败"
|
||||
fi
|
||||
|
||||
# 测试解析功能
|
||||
LOG_INFO "测试plexus-velocity-javadoc的解析功能"
|
||||
# 假设解析功能的命令为"parse-command",这里仅为示例
|
||||
parse_command="parse-command --test" # 替换为实际的命令和参数
|
||||
|
||||
$parse_command > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "解析功能测试失败"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载plexus-velocity-javadoc软件包"
|
||||
dnf remove -y plexus-velocity-javadoc
|
||||
CHECK_RESULT $? 0 0 "卸载plexus-velocity-javadoc失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-28
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试能否成功导入cryptography.vectors模块
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试能否成功导入cryptography.vectors模块"
|
||||
|
||||
LOG_INFO "步骤1:检查当前环境中是否已安装python3-cryptography软件包"
|
||||
if rpm -q python3-cryptography &> /dev/null; then
|
||||
LOG_INFO "python3-cryptography已安装,测试结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "python3-cryptography未安装,将在测试前安装并在测试后卸载"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查yum源中是否有python3-cryptography软件包"
|
||||
if ! dnf list available python3-cryptography &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-cryptography软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装python3-cryptography软件包"
|
||||
dnf install -y python3-cryptography
|
||||
CHECK_RESULT $? 0 0 "安装python3-cryptography失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:测试导入cryptography.vectors模块"
|
||||
python3 -c "import cryptography.vectors"
|
||||
CHECK_RESULT $? 0 0 "导入cryptography.vectors模块失败"
|
||||
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "步骤5:卸载python3-cryptography软件包"
|
||||
dnf remove -y python3-cryptography
|
||||
CHECK_RESULT $? 0 0 "卸载python3-cryptography失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:成功导入cryptography.vectors模块"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-02-28
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用vectors模块验证加密算法
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:使用vectors模块验证加密算法"
|
||||
|
||||
LOG_INFO "步骤1:检查yum源中是否存在python3-cryptography软件包"
|
||||
if ! dnf list available python3-cryptography &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-cryptography软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查系统是否已安装python3-cryptography"
|
||||
if rpm -q python3-cryptography &>/dev/null; then
|
||||
LOG_INFO "python3-cryptography已安装,测试后保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "python3-cryptography未安装,将在测试中安装并测试后卸载"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "步骤3:安装python3-cryptography软件包"
|
||||
dnf install -y python3-cryptography
|
||||
CHECK_RESULT $? 0 0 "安装python3-cryptography失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:验证vectors模块功能"
|
||||
python3 -c "from cryptography.hazmat.primitives.ciphers.algorithms import AES; from cryptography.hazmat.primitives.ciphers import Cipher, modes; import os; key = os.urandom(32); iv = os.urandom(16); cipher = Cipher(AES(key), modes.CBC(iv)); encryptor = cipher.encryptor(); ct = encryptor.update(b"a secret message") + encryptor.finalize(); decryptor = cipher.decryptor(); pt = decryptor.update(ct) + decryptor.finalize(); print("加密解密测试成功" if pt == b"a secret message" else "加密解密测试失败")"
|
||||
CHECK_RESULT $? 0 0 "vectors模块验证加密算法失败"
|
||||
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "步骤5:卸载python3-cryptography软件包"
|
||||
dnf remove -y python3-cryptography
|
||||
CHECK_RESULT $? 0 0 "卸载python3-cryptography失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:使用vectors模块验证加密算法测试通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试python-pika-help基础功能,验证是否能正常导入和使用。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试python-pika-help基础功能,验证是否能正常导入和使用。"
|
||||
|
||||
# 检查是否已安装python3-pika
|
||||
LOG_INFO "检查是否已安装python3-pika"
|
||||
if dnf list installed python3-pika &>/dev/null; then
|
||||
LOG_INFO "python3-pika已安装,测试完成后将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "python3-pika未安装,将在测试完成后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-pika
|
||||
LOG_INFO "检查yum源中是否有python3-pika"
|
||||
if ! dnf list available python3-pika &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-pika,退出测试"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装则安装python3-pika
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-pika"
|
||||
dnf install -y python3-pika
|
||||
CHECK_RESULT $? 0 0 "安装python3-pika失败"
|
||||
fi
|
||||
|
||||
# 验证python3-pika是否能正常导入和使用
|
||||
LOG_INFO "验证python3-pika是否能正常导入和使用"
|
||||
cat << "EOF" > test_pika.py
|
||||
import pika
|
||||
print("pika模块导入成功")
|
||||
EOF
|
||||
|
||||
CHECK_RESULT $? 0 0 "创建测试脚本失败"
|
||||
|
||||
python3 test_pika.py
|
||||
CHECK_RESULT $? 0 0 "pika模块导入或使用失败"
|
||||
|
||||
# 清理临时文件
|
||||
rm -f test_pika.py
|
||||
CHECK_RESULT $? 0 0 "删除临时文件失败"
|
||||
|
||||
# 如果测试前未安装则卸载python3-pika
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-pika"
|
||||
dnf remove -y python3-pika
|
||||
CHECK_RESULT $? 0 0 "卸载python3-pika失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,80 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-11-30
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test loading YAML content
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test loading YAML content"
|
||||
|
||||
# 检查是否已安装python3-ruamel-yaml-clib
|
||||
LOG_INFO "检查是否已安装python3-ruamel-yaml-clib"
|
||||
if dnf list installed python3-ruamel-yaml-clib &>/dev/null; then
|
||||
LOG_INFO "python3-ruamel-yaml-clib已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-ruamel-yaml-clib未安装,脚本结束后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-ruamel-yaml-clib
|
||||
LOG_INFO "检查yum源中是否有python3-ruamel-yaml-clib"
|
||||
if ! dnf list available python3-ruamel-yaml-clib &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-ruamel-yaml-clib"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装python3-ruamel-yaml-clib(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在安装python3-ruamel-yaml-clib"
|
||||
dnf install -y python3-ruamel-yaml-clib
|
||||
CHECK_RESULT $? 0 0 "安装python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
# 测试加载YAML内容
|
||||
LOG_INFO "测试加载YAML内容"
|
||||
echo -e "key: value" > test.yaml
|
||||
python3 -c "
|
||||
import ruamel.yaml
|
||||
yaml = ruamel.yaml.YAML()
|
||||
with open("test.yaml") as f:
|
||||
data = yaml.load(f)
|
||||
print(data)
|
||||
" > output.txt 2>&1
|
||||
CHECK_RESULT $? 0 0 "加载YAML内容失败"
|
||||
|
||||
# 检查输出是否符合预期
|
||||
LOG_INFO "检查输出是否符合预期"
|
||||
grep -q "{"key": "value"}" output.txt
|
||||
CHECK_RESULT $? 0 0 "输出不符合预期"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test.yaml output.txt
|
||||
|
||||
# 卸载python3-ruamel-yaml-clib(如果脚本开始时未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "正在卸载python3-ruamel-yaml-clib"
|
||||
dnf remove -y python3-ruamel-yaml-clib
|
||||
CHECK_RESULT $? 0 0 "卸载python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test loading YAML content"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test parsing YAML content
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test parsing YAML content"
|
||||
|
||||
# 检查是否已安装python3-ruamel-yaml-clib
|
||||
LOG_INFO "检查是否已安装python3-ruamel-yaml-clib"
|
||||
if dnf list installed python3-ruamel-yaml-clib &>/dev/null; then
|
||||
LOG_INFO "python3-ruamel-yaml-clib已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-ruamel-yaml-clib未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-ruamel-yaml-clib
|
||||
LOG_INFO "检查yum源中是否有python3-ruamel-yaml-clib"
|
||||
if ! dnf list available python3-ruamel-yaml-clib &>/dev/null; then
|
||||
LOG_ERROR "yum源中无python3-ruamel-yaml-clib软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装python3-ruamel-yaml-clib"
|
||||
dnf install -y python3-ruamel-yaml-clib
|
||||
CHECK_RESULT $? 0 0 "安装python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
# 测试解析YAML内容的功能
|
||||
LOG_INFO "测试解析YAML内容的功能"
|
||||
echo -e "key: value\nlist:\n - item1\n - item2" > test.yaml
|
||||
CHECK_RESULT $? 0 0 "创建测试YAML文件失败"
|
||||
|
||||
python3 -c "from ruamel.yaml import YAML; yaml=YAML(); data=yaml.load(open("test.yaml")); print(data)" > output.txt
|
||||
CHECK_RESULT $? 0 0 "解析YAML文件失败"
|
||||
|
||||
grep -q "{"key": "value", "list": ["item1", "item2"]}" output.txt
|
||||
CHECK_RESULT $? 0 0 "解析结果不符合预期"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.yaml output.txt
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 如果脚本开始时未安装软件包,则在结束时卸载
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-ruamel-yaml-clib"
|
||||
dnf remove -y python3-ruamel-yaml-clib
|
||||
CHECK_RESULT $? 0 0 "卸载python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test parsing YAML content"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test roundtrip YAML
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test roundtrip YAML"
|
||||
|
||||
# 检查yum源中是否存在python3-ruamel-yaml-clib软件包
|
||||
LOG_INFO "检查yum源中是否存在python3-ruamel-yaml-clib软件包"
|
||||
dnf list available python3-ruamel-yaml-clib &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在python3-ruamel-yaml-clib软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装python3-ruamel-yaml-clib
|
||||
LOG_INFO "检查是否已安装python3-ruamel-yaml-clib"
|
||||
rpm -q python3-ruamel-yaml-clib &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
installed=true
|
||||
LOG_INFO "python3-ruamel-yaml-clib已安装"
|
||||
else
|
||||
installed=false
|
||||
LOG_INFO "python3-ruamel-yaml-clib未安装,将进行安装"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-ruamel-yaml-clib软件包"
|
||||
dnf install -y python3-ruamel-yaml-clib &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "安装python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
# 测试roundtrip YAML功能
|
||||
LOG_INFO "测试roundtrip YAML功能"
|
||||
echo "test: value" > test.yaml && \
|
||||
python3 -c "import ruamel.yaml; yaml = ruamel.yaml.YAML(); data = yaml.load(open("test.yaml")); yaml.dump(data, open("test_output.yaml", "w"))" && \
|
||||
diff test.yaml test_output.yaml &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "roundtrip YAML功能测试失败"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test.yaml test_output.yaml &>/dev/null
|
||||
|
||||
# 如果脚本开始时未安装,则卸载软件包以恢复环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-ruamel-yaml-clib软件包"
|
||||
dnf remove -y python3-ruamel-yaml-clib &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "卸载python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test roundtrip YAML"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-02
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test YAML validation
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装python3-ruamel-yaml-clib
|
||||
LOG_INFO "检查是否已安装python3-ruamel-yaml-clib"
|
||||
if dnf list installed python3-ruamel-yaml-clib &>/dev/null; then
|
||||
LOG_INFO "python3-ruamel-yaml-clib已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-ruamel-yaml-clib未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-ruamel-yaml-clib
|
||||
LOG_INFO "检查yum源中是否有python3-ruamel-yaml-clib"
|
||||
if ! dnf list available python3-ruamel-yaml-clib &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-ruamel-yaml-clib"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装python3-ruamel-yaml-clib(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装python3-ruamel-yaml-clib"
|
||||
dnf install -y python3-ruamel-yaml-clib
|
||||
CHECK_RESULT $? 0 0 "安装python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
# 测试YAML验证功能
|
||||
LOG_INFO "测试YAML验证功能"
|
||||
echo "key: value" > test.yaml
|
||||
python3 -c "from ruamel.yaml import YAML; yaml=YAML(); yaml.load(open("test.yaml"))" &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "YAML验证失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.yaml
|
||||
|
||||
# 卸载python3-ruamel-yaml-clib(如果脚本开始时未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-ruamel-yaml-clib"
|
||||
dnf remove -y python3-ruamel-yaml-clib
|
||||
CHECK_RESULT $? 0 0 "卸载python3-ruamel-yaml-clib失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-09
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic request handling
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test basic request handling"
|
||||
|
||||
# 检查是否已安装python3-webob
|
||||
LOG_INFO "检查是否已安装python3-webob"
|
||||
if dnf list installed python3-webob &>/dev/null; then
|
||||
LOG_INFO "python3-webob已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-webob未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-webob
|
||||
LOG_INFO "检查yum源中是否有python3-webob"
|
||||
if ! dnf list available python3-webob &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-webob"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装python3-webob(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-webob"
|
||||
dnf install -y python3-webob
|
||||
CHECK_RESULT $? 0 0 "安装python3-webob失败"
|
||||
fi
|
||||
|
||||
# 测试基本请求处理功能
|
||||
LOG_INFO "测试基本请求处理功能"
|
||||
TEST_SCRIPT="from webob import Request; req = Request.blank("/"); print(req.method)"
|
||||
RESULT=$(python3 -c "$TEST_SCRIPT" 2>&1)
|
||||
CHECK_RESULT $? 0 0 "执行python3-webob测试脚本失败"
|
||||
EXPECTED="GET"
|
||||
CHECK_RESULT "$RESULT" "$EXPECTED" 0 "请求处理方法不符合预期"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-webob"
|
||||
dnf remove -y python3-webob
|
||||
CHECK_RESULT $? 0 0 "卸载python3-webob失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic request handling"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试JSON字典转XML
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试JSON字典转XML功能"
|
||||
|
||||
# 检查环境是否已安装python3-xmlschema
|
||||
LOG_INFO "步骤1:检查python3-xmlschema是否已安装"
|
||||
if dnf list installed python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装,将在测试过程中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema软件包
|
||||
LOG_INFO "步骤2:检查yum源中是否有python3-xmlschema软件包"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤3:安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 测试JSON字典转XML功能
|
||||
LOG_INFO "步骤4:测试JSON字典转XML功能"
|
||||
cat > test_json_to_xml.py << "EOF"
|
||||
import json
|
||||
import xmlschema
|
||||
from xmlschema.validators import XMLSchemaConverter
|
||||
|
||||
# 定义JSON数据
|
||||
json_data = {
|
||||
"person": {
|
||||
"name": "张三",
|
||||
"age": 30,
|
||||
"city": "北京"
|
||||
}
|
||||
}
|
||||
|
||||
# 定义XML Schema
|
||||
schema = xmlschema.XMLSchema("""
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="person">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="name" type="xs:string"/>
|
||||
<xs:element name="age" type="xs:integer"/>
|
||||
<xs:element name="city" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
""")
|
||||
|
||||
# 将JSON转换为XML
|
||||
converter = XMLSchemaConverter(schema=schema)
|
||||
xml_data = converter.json_to_xml(json_data)
|
||||
print(xml_data)
|
||||
EOF
|
||||
|
||||
python3 test_json_to_xml.py
|
||||
CHECK_RESULT $? 0 0 "JSON字典转XML功能测试失败"
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "步骤5:清理临时文件"
|
||||
rm -f test_json_to_xml.py
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤6:卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:JSON字典转XML功能测试通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试导入xmlschema模块
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试导入xmlschema模块"
|
||||
|
||||
LOG_INFO "步骤1: 检查yum源中是否存在python3-xmlschema软件包"
|
||||
dnf list available python3-xmlschema 2>/dev/null | grep -q python3-xmlschema
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "yum源中存在python3-xmlschema软件包"
|
||||
|
||||
LOG_INFO "步骤2: 检查当前环境是否已安装python3-xmlschema软件包"
|
||||
rpm -q python3-xmlschema >/dev/null 2>&1
|
||||
installed=$?
|
||||
|
||||
if [ $installed -eq 0 ]; then
|
||||
LOG_INFO "当前环境已安装python3-xmlschema软件包,测试结束后将保持安装状态"
|
||||
need_cleanup=0
|
||||
else
|
||||
LOG_INFO "当前环境未安装python3-xmlschema软件包,将进行安装测试"
|
||||
need_cleanup=1
|
||||
|
||||
LOG_INFO "步骤3: 安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema软件包失败"
|
||||
LOG_INFO "python3-xmlschema软件包安装成功"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 测试导入xmlschema模块"
|
||||
python3 -c "import xmlschema"
|
||||
CHECK_RESULT $? 0 0 "导入xmlschema模块失败"
|
||||
LOG_INFO "导入xmlschema模块成功"
|
||||
|
||||
if [ $need_cleanup -eq 1 ]; then
|
||||
LOG_INFO "步骤5: 清理环境,卸载测试安装的软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema软件包失败"
|
||||
LOG_INFO "python3-xmlschema软件包卸载成功"
|
||||
else
|
||||
LOG_INFO "步骤5: 环境已安装,无需清理"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试导入xmlschema模块"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包安装功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
PACKAGE_NAME="python3-xmlschema"
|
||||
LOG_INFO "开始测试软件包安装功能"
|
||||
LOG_INFO "检查yum源中是否存在软件包 $PACKAGE_NAME"
|
||||
if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在软件包 $PACKAGE_NAME"
|
||||
exit 255
|
||||
fi
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 存在于yum源中"
|
||||
LOG_INFO "检查当前环境是否已安装软件包 $PACKAGE_NAME"
|
||||
if rpm -q "$PACKAGE_NAME" &>/dev/null; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装,测试结束后保持安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试中安装"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 安装成功"
|
||||
fi
|
||||
LOG_INFO "验证软件包 $PACKAGE_NAME 的基本功能"
|
||||
python3 -c "import xmlschema; print(xmlschema.__version__)" &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "python3-xmlschema 导入失败,基本功能异常"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 基本功能验证成功"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = "false" ]; then
|
||||
LOG_INFO "清理环境:卸载测试安装的软件包 $PACKAGE_NAME"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 卸载成功,环境已恢复"
|
||||
else
|
||||
LOG_INFO "测试前已安装软件包,测试后保持安装状态,无需清理"
|
||||
fi
|
||||
LOG_INFO "软件包安装功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,163 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试XML转JSON字典
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试python3-xmlschema的XML转JSON字典功能"
|
||||
|
||||
LOG_INFO "步骤1: 检查python3-xmlschema软件包是否在yum源中"
|
||||
if ! dnf list available python3-xmlschema 2>/dev/null | grep -q python3-xmlschema; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查系统是否已安装python3-xmlschema"
|
||||
if rpm -q python3-xmlschema >/dev/null 2>&1; then
|
||||
already_installed=true
|
||||
LOG_INFO "检测到python3-xmlschema已安装,测试后将保持安装状态"
|
||||
else
|
||||
already_installed=false
|
||||
LOG_INFO "python3-xmlschema未安装,将在测试过程中安装"
|
||||
fi
|
||||
|
||||
if [ "$already_installed" = "false" ]; then
|
||||
LOG_INFO "步骤3: 安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 创建测试XML文件"
|
||||
cat > test_data.xml << "EOF"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bookstore>
|
||||
<book category="cooking">
|
||||
<title lang="en">Everyday Italian</title>
|
||||
<author>Giada De Laurentiis</author>
|
||||
<year>2005</year>
|
||||
<price>30.00</price>
|
||||
</book>
|
||||
<book category="children">
|
||||
<title lang="en">Harry Potter</title>
|
||||
<author>J.K. Rowling</author>
|
||||
<year>2005</year>
|
||||
<price>29.99</price>
|
||||
</book>
|
||||
</bookstore>
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试XML文件失败"
|
||||
|
||||
LOG_INFO "步骤5: 创建XML Schema文件"
|
||||
cat > test_schema.xsd << "EOF"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="bookstore">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="book" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="author" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:integer"/>
|
||||
<xs:element name="price" type="xs:decimal"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="category" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建XML Schema文件失败"
|
||||
|
||||
LOG_INFO "步骤6: 验证xmlschema命令参数支持"
|
||||
if ! xmlschema --help 2>&1 | grep -q "to-dict"; then
|
||||
LOG_ERROR "xmlschema命令不支持to-dict参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7: 执行XML转JSON字典测试"
|
||||
xmlschema to-dict test_data.xml test_schema.xsd > output.json
|
||||
CHECK_RESULT $? 0 0 "XML转JSON字典执行失败"
|
||||
|
||||
LOG_INFO "步骤8: 验证输出文件内容"
|
||||
if [ ! -f output.json ]; then
|
||||
LOG_ERROR "输出文件output.json未生成"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤9: 验证JSON输出格式"
|
||||
python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open("output.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if "bookstore" not in data:
|
||||
print("ERROR: 输出JSON缺少bookstore字段")
|
||||
exit(1)
|
||||
|
||||
books = data["bookstore"].get("book", [])
|
||||
if not isinstance(books, list):
|
||||
print("ERROR: book字段不是列表类型")
|
||||
exit(1)
|
||||
|
||||
if len(books) != 2:
|
||||
print(f"ERROR: 期望2本书,实际找到{len(books)}本")
|
||||
exit(1)
|
||||
|
||||
for book in books:
|
||||
required_fields = ["title", "author", "year", "price", "category"]
|
||||
for field in required_fields:
|
||||
if field not in book:
|
||||
print(f"ERROR: 缺少必要字段: {field}")
|
||||
exit(1)
|
||||
|
||||
print("SUCCESS: JSON格式验证通过")
|
||||
|
||||
except Exception as e:
|
||||
print(f"ERROR: JSON验证失败: {str(e)}")
|
||||
exit(1)
|
||||
"
|
||||
CHECK_RESULT $? 0 0 "JSON输出格式验证失败"
|
||||
|
||||
LOG_INFO "步骤10: 测试无效参数处理"
|
||||
xmlschema invalid-parameter 2>&1 | grep -q "error\|Error\|ERROR\|usage\|Usage"
|
||||
CHECK_RESULT $? 0 0 "无效参数处理不符合预期"
|
||||
|
||||
LOG_INFO "步骤11: 清理测试文件"
|
||||
rm -f test_data.xml test_schema.xsd output.json
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
if [ "$already_installed" = "false" ]; then
|
||||
LOG_INFO "步骤12: 卸载测试安装的python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
else
|
||||
LOG_INFO "步骤12: 保持python3-xmlschema的安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:python3-xmlschema的XML转JSON字典功能验证通过"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试软件包卸载功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义日志函数
|
||||
LOG_INFO() {
|
||||
echo "[INFO] $1"
|
||||
}
|
||||
|
||||
LOG_ERROR() {
|
||||
echo "[ERROR] $1"
|
||||
}
|
||||
|
||||
# 定义检查结果函数
|
||||
CHECK_RESULT() {
|
||||
if [ $1 -ne $2 ]; then
|
||||
LOG_ERROR "$4"
|
||||
exit $3
|
||||
fi
|
||||
}
|
||||
|
||||
# 定义SSH命令函数
|
||||
SSH_CMD() {
|
||||
sshpass -p $3 ssh -o StrictHostKeyChecking=no $4@$2 "$1"
|
||||
}
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="python3-xmlschema"
|
||||
|
||||
# 步骤1:检查yum源中是否存在该软件包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME"
|
||||
dnf list available $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在软件包 $PACKAGE_NAME"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查当前环境是否已安装该软件包
|
||||
LOG_INFO "步骤2:检查当前环境是否已安装软件包 $PACKAGE_NAME"
|
||||
rpm -q $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装,标记为保持安装状态"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装,标记为需要安装和卸载"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 安装成功"
|
||||
fi
|
||||
|
||||
# 步骤4:验证软件包安装成功
|
||||
LOG_INFO "步骤4:验证软件包 $PACKAGE_NAME 安装成功"
|
||||
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 失败"
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 卸载成功"
|
||||
|
||||
# 步骤6:验证软件包已卸载
|
||||
LOG_INFO "步骤6:验证软件包 $PACKAGE_NAME 已卸载"
|
||||
rpm -q $PACKAGE_NAME &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "软件包 $PACKAGE_NAME 卸载验证失败"
|
||||
exit 1
|
||||
fi
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 卸载验证成功"
|
||||
|
||||
# 步骤7:恢复环境
|
||||
LOG_INFO "步骤7:恢复环境"
|
||||
if [ $INSTALLED_BEFORE -eq 1 ]; then
|
||||
LOG_INFO "重新安装软件包 $PACKAGE_NAME 以恢复环境"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "重新安装软件包 $PACKAGE_NAME 失败"
|
||||
LOG_INFO "环境恢复成功,软件包 $PACKAGE_NAME 已安装"
|
||||
else
|
||||
LOG_INFO "环境恢复成功,软件包 $PACKAGE_NAME 保持未安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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 : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试基本XML验证功能
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装python3-xmlschema
|
||||
LOG_INFO "检查是否已安装python3-xmlschema"
|
||||
if rpm -q python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装,脚本结束后将卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装python3-xmlschema
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 测试基本XML验证功能
|
||||
LOG_INFO "测试基本XML验证功能"
|
||||
|
||||
# 创建测试XML文件和模式文件
|
||||
LOG_INFO "创建测试XML文件和模式文件"
|
||||
cat > test.xml <<EOF
|
||||
<root>
|
||||
<element>value</element>
|
||||
</root>
|
||||
EOF
|
||||
|
||||
cat > schema.xsd <<EOF
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="element" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
|
||||
# 使用xmlschema验证XML文件
|
||||
LOG_INFO "使用xmlschema验证XML文件"
|
||||
xmlschemac --noout --schema schema.xsd test.xml
|
||||
CHECK_RESULT $? 0 0 "XML验证失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.xml schema.xsd
|
||||
|
||||
# 如果脚本开始时未安装,则卸载python3-xmlschema
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试不提示直接覆盖文件的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试不提示直接覆盖文件的参数"
|
||||
|
||||
# 检查环境是否已安装python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查环境是否已安装python3-xmlschema和xmlschema-json2xml"
|
||||
if dnf list installed python3-xmlschema >/dev/null 2>&1 && dnf list installed xmlschema-json2xml >/dev/null 2>&1; then
|
||||
LOG_INFO "环境已安装python3-xmlschema和xmlschema-json2xml"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "环境未安装python3-xmlschema和xmlschema-json2xml"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list available python3-xmlschema >/dev/null 2>&1 || ! dnf list available xmlschema-json2xml >/dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中缺少python3-xmlschema或xmlschema-json2xml"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果环境未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema和xmlschema-json2xml失败"
|
||||
fi
|
||||
|
||||
# 测试不提示直接覆盖文件的参数
|
||||
LOG_INFO "测试不提示直接覆盖文件的参数"
|
||||
echo "test_content" > test_file.xml
|
||||
xmlschema-json2xml --force test_file.xml test_output.xml
|
||||
CHECK_RESULT $? 0 0 "测试不提示直接覆盖文件的参数失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_file.xml test_output.xml
|
||||
|
||||
# 如果环境未安装,则卸载软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-json2xml"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema和xmlschema-json2xml失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XML输出缩进的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 测试指定XML输出缩进的参数
|
||||
LOG_INFO "开始测试:测试指定XML输出缩进的参数"
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list installed python3-xmlschema &> /dev/null || ! dnf list installed xmlschema-json2xml &> /dev/null; then
|
||||
LOG_INFO "环境未安装,将进行安装"
|
||||
# 检查yum源中是否有软件包
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list available python3-xmlschema &> /dev/null || ! dnf list available xmlschema-json2xml &> /dev/null; then
|
||||
LOG_ERROR "yum源中缺少python3-xmlschema或xmlschema-json2xml"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
# 标记需要卸载
|
||||
NEED_UNINSTALL=1
|
||||
else
|
||||
LOG_INFO "环境已安装,无需安装"
|
||||
NEED_UNINSTALL=0
|
||||
fi
|
||||
|
||||
# 测试指定XML输出缩进的参数
|
||||
LOG_INFO "测试指定XML输出缩进的参数"
|
||||
xmlschema-json2xml --indent 4 test.json test.xml
|
||||
CHECK_RESULT $? 0 0 "执行xmlschema-json2xml --indent失败"
|
||||
|
||||
# 检查输出文件是否存在
|
||||
LOG_INFO "检查输出文件test.xml是否存在"
|
||||
[ -f test.xml ]
|
||||
CHECK_RESULT $? 0 0 "输出文件test.xml未生成"
|
||||
|
||||
# 检查缩进是否正确
|
||||
LOG_INFO "检查缩进是否正确"
|
||||
if grep -q "^ " test.xml; then
|
||||
LOG_INFO "缩进正确"
|
||||
else
|
||||
LOG_ERROR "缩进不正确"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理环境
|
||||
LOG_INFO "清理环境"
|
||||
rm -f test.xml
|
||||
|
||||
# 如果之前安装了软件包,则卸载
|
||||
if [ $NEED_UNINSTALL -eq 1 ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-json2xml"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试指定XML输出缩进的参数"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定输出XML文件路径的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试指定输出XML文件路径的参数"
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list installed python3-xmlschema > /dev/null 2>&1 || ! dnf list installed xmlschema-json2xml > /dev/null 2>&1; then
|
||||
LOG_INFO "环境未安装python3-xmlschema或xmlschema-json2xml,将进行安装"
|
||||
INSTALLED=false
|
||||
else
|
||||
LOG_INFO "环境已安装python3-xmlschema和xmlschema-json2xml"
|
||||
INSTALLED=true
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list available python3-xmlschema > /dev/null 2>&1 || ! dnf list available xmlschema-json2xml > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema或xmlschema-json2xml"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema和xmlschema-json2xml失败"
|
||||
fi
|
||||
|
||||
# 测试指定输出XML文件路径的参数
|
||||
LOG_INFO "测试指定输出XML文件路径的参数"
|
||||
if ! xmlschema-json2xml --help | grep -q -- "--output"; then
|
||||
LOG_ERROR "参数--output不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行测试命令
|
||||
LOG_INFO "执行测试命令:生成XML文件"
|
||||
TEST_OUTPUT="/tmp/test_output.xml"
|
||||
if [ -f "$TEST_OUTPUT" ]; then
|
||||
rm -f "$TEST_OUTPUT"
|
||||
fi
|
||||
CHECK_RESULT $? 0 0 "删除已有测试文件失败"
|
||||
|
||||
xml schema.json --output "$TEST_OUTPUT"
|
||||
CHECK_RESULT $? 0 0 生成XML文件失败"
|
||||
|
||||
# 检查生成的XML文件是否存在
|
||||
if [ ! -f "$TEST_OUTPUT" ]; then
|
||||
LOG_ERROR "未生成XML文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#清理环境
|
||||
LOG_INFO "清理测试环境"
|
||||
rm -f "$TEST_OUTPUT"
|
||||
|
||||
#如果脚本开始时未安装软件包,则在结束时卸载
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xml schema json to xml "
|
||||
dnf remove -y python x mlschema xml schema json to xml
|
||||
CHECK_RESULT $? 0 0 "卸载python x mlschema和x mlschema json to xml失败 "
|
||||
fi
|
||||
|
||||
LOG INFO "测试完成:成功验证了指定输出 XML文件路径的参数功能"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XSD schema路径或URL的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 测试指定XSD schema路径或URL的参数
|
||||
LOG_INFO "开始测试:测试指定XSD schema路径或URL的参数"
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list installed python3-xmlschema &> /dev/null || ! dnf list installed xmlschema-json2xml &> /dev/null; then
|
||||
LOG_INFO "未安装python3-xmlschema或xmlschema-json2xml,将进行安装"
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list available python3-xmlschema &> /dev/null || ! dnf list available xmlschema-json2xml &> /dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema或xmlschema-json2xml"
|
||||
exit 255
|
||||
fi
|
||||
# 安装软件包
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema和xmlschema-json2xml失败"
|
||||
# 标记需要卸载
|
||||
NEED_UNINSTALL=1
|
||||
else
|
||||
LOG_INFO "python3-xmlschema和xmlschema-json2xml已安装"
|
||||
NEED_UNINSTALL=0
|
||||
fi
|
||||
|
||||
# 测试指定XSD schema路径或URL的参数
|
||||
LOG_INFO "测试指定XSD schema路径或URL的参数"
|
||||
# 假设测试命令为xmlschema-json2xml --schema <schema_path_or_url>
|
||||
# 检查参数是否存在
|
||||
if ! xmlschema-json2xml --help | grep -q -- "--schema"; then
|
||||
LOG_ERROR "xmlschema-json2xml不支持--schema参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试无效schema路径
|
||||
LOG_INFO "测试无效schema路径"
|
||||
xmlschema-json2xml --schema /invalid/path/to/schema.xsd
|
||||
CHECK_RESULT $? 1 0 "无效schema路径测试未返回预期错误码"
|
||||
|
||||
# 测试有效本地XSD schema路径
|
||||
LOG_INFO "测试有效本地XSD schema路径"
|
||||
touch /tmp/test_schema.xsd
|
||||
echo "<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"></xs:schema>" > /tmp/test_schema.xsd
|
||||
xmlchema-json2xml --schema /tmp/test_schema.xsd
|
||||
CHECK_RESULT $? 0 0 "有效本地XSD schema路径测试失败"
|
||||
|
||||
# 测试有效URL XSD schema路径(假设http://example.com/schema.xsd不存在)
|
||||
LOG_INFO测试有效URL XSD schema路径"
|
||||
if curl -s --head http://example.com/schema.xsd | grep -q "404"; then
|
||||
LOG_ERROR"URL XSD schema不存在,跳过此步骤" else xmlschemson--schemhttp://example.com/schemsd CHECK_RESULT $? 0 0"效 URL XD schem路测失败" fi
|
||||
|
||||
#清理环境 LOG_INF清理环境" if [ $NEED_UNINSTALL -eq 1 ]; then LOG_INF卸载pythonxmschem和xmlschemson2x DNF remove -y python3-xschemxmlschemsond CHECK_RESULT $?00卸载pythoxschemxmlschemsond2xm败" fi rm -f /tm/test_schemsd
|
||||
|
||||
LOG_INF测试完成:测指定XD schem路URL的参"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试schema位置提示覆盖的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
LOG_INFO "开始测试:测试schema位置提示覆盖的参数"
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-json2xml"
|
||||
if dnf list installed python3-xmlschema && dnf list installed xmlschema-json2xml; then
|
||||
LOG_INFO "软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包未安装,测试结束后将卸载软件包"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-json2xml"
|
||||
if ! dnf list available python3-xmlschema || ! dnf list available xmlschema-json2xml; then
|
||||
LOG_ERROR "yum源中缺少必要的软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试schema位置提示覆盖的参数
|
||||
LOG_INFO "测试schema位置提示覆盖的参数"
|
||||
xmlschema-json2xml --help | grep "schema位置提示"
|
||||
CHECK_RESULT $? 0 0 "参数--schema位置提示不支持或不存在"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-json2xml"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试增加输出详细信息的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 测试脚本:test_python3-xmlschema_xmlschema-json2xml__v
|
||||
# 测试用例描述:测试增加输出详细信息的参数
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查软件包 python3-xmlschema 是否已安装"
|
||||
if dnf list installed python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "软件包 python3-xmlschema 已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 python3-xmlschema 未安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有 python3-xmlschema 软件包"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到 python3-xmlschema 软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装 python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装 python3-xmlschema 失败"
|
||||
fi
|
||||
|
||||
# 测试增加输出详细信息的参数
|
||||
LOG_INFO "测试增加输出详细信息的参数"
|
||||
xmlschema-json2xml --help | grep -q -- "--verbose"
|
||||
CHECK_RESULT $? 0 0 "参数 --verbose 不支持"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载 python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载 python3-xmlschema 失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XSD schema验证器版本的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试指定XSD schema验证器版本的参数"
|
||||
|
||||
# 检查软件包是否在yum源中
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf list available python3-xmlschema xmlschema-json2xml >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在python3-xmlschema或xmlschema-json2xml软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查环境是否已安装软件包
|
||||
LOG_INFO "检查环境中是否已安装python3-xmlschema和xmlschema-json2xml"
|
||||
rpm -q python3-xmlschema xmlschema-json2xml >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
installed=true
|
||||
LOG_INFO "环境中已安装软件包,脚本结束时将保持安装状态"
|
||||
else
|
||||
installed=false
|
||||
LOG_INFO "环境中未安装软件包,将在测试步骤中安装并在结束时卸载"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试指定XSD schema验证器版本的参数
|
||||
LOG_INFO "测试指定XSD schema验证器版本的参数"
|
||||
xmlschema --version >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "xmlschema命令不支持--version参数"
|
||||
|
||||
# 清理环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成,环境已恢复"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试在覆盖文件时不进行提示
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 环境检查:检查python3-xmlschema和xmlschema-json2xml软件包是否已安装
|
||||
LOG_INFO "环境检查:检查python3-xmlschema和xmlschema-json2xml软件包是否已安装"
|
||||
rpm -q python3-xmlschema xmlschema-json2xml > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,脚本结束时将保持安装状态"
|
||||
installed_before=1
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试过程中安装并在测试结束后卸载"
|
||||
installed_before=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在python3-xmlschema和xmlschema-json2xml软件包
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf list available python3-xmlschema xmlschema-json2xml > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "yum源中未找到python3-xmlschema或xmlschema-json2xml软件包"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema或xmlschema-json2xml软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $installed_before -eq 0 ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema和xmlschema-json2xml软件包失败"
|
||||
fi
|
||||
|
||||
# 测试xmlschema-json2xml命令的--no-prompt参数是否存在
|
||||
LOG_INFO "测试xmlschema-json2xml命令的--no-prompt参数是否存在"
|
||||
xmlschema-json2xml --help | grep -q -- "--no-prompt"
|
||||
CHECK_RESULT $? 0 0 "xmlschema-json2xml命令不支持--no-prompt参数"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-json2xml命令不支持--no-prompt参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建测试用的JSON和XML Schema文件
|
||||
LOG_INFO "创建测试用的JSON和XML Schema文件"
|
||||
cat > test_schema.xsd << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root" type="xs:string"/>
|
||||
</xs:schema>
|
||||
EOF
|
||||
cat > test_data.json << EOF
|
||||
{"root": "test data"}
|
||||
EOF
|
||||
|
||||
# 测试在覆盖文件时不进行提示:使用--no-prompt参数
|
||||
LOG_INFO "测试在覆盖文件时不进行提示:使用--no-prompt参数"
|
||||
xmlschema-json2xml -s test_schema.xsd -o test_output.xml test_data.json --no-prompt
|
||||
CHECK_RESULT $? 0 0 "xmlschema-json2xml命令执行失败"
|
||||
|
||||
# 验证输出文件是否生成
|
||||
LOG_INFO "验证输出文件是否生成"
|
||||
[ -f test_output.xml ]
|
||||
CHECK_RESULT $? 0 0 "输出文件未生成"
|
||||
|
||||
# 再次执行相同的命令,覆盖文件,使用--no-prompt参数避免提示
|
||||
LOG_INFO "再次执行相同的命令,覆盖文件,使用--no-prompt参数避免提示"
|
||||
xmlschema-json2xml -s test_schema.xsd -o test_output.xml test_data.json --no-prompt
|
||||
CHECK_RESULT $? 0 0 "覆盖文件时xmlschema-json2xml命令执行失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_schema.xsd test_data.json test_output.xml
|
||||
|
||||
# 环境恢复:如果测试前未安装软件包,则卸载安装的软件包
|
||||
if [ $installed_before -eq 0 ]; then
|
||||
LOG_INFO "环境恢复:卸载python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema和xmlschema-json2xml软件包失败"
|
||||
else
|
||||
LOG_INFO "环境恢复:保持python3-xmlschema和xmlschema-json2xml软件包安装状态"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试显示帮助信息
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试python3-xmlschema和xmlschema-json2xml的帮助信息"
|
||||
LOG_INFO "步骤一:检查软件包是否在yum源中"
|
||||
if ! dnf list available python3-xmlschema &> /dev/null; then
|
||||
LOG_ERROR "软件包python3-xmlschema不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
if ! dnf list available xmlschema-json2xml &> /dev/null; then
|
||||
LOG_ERROR "软件包xmlschema-json2xml不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤二:检查是否已安装软件包"
|
||||
if rpm -q python3-xmlschema &> /dev/null && rpm -q xmlschema-json2xml &> /dev/null; then
|
||||
LOG_INFO "软件包已安装,测试完成后将保持安装状态"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试前安装"
|
||||
already_installed=false
|
||||
fi
|
||||
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "步骤三:安装软件包"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤四:测试显示帮助信息"
|
||||
LOG_INFO "测试python3-xmlschema的--help参数"
|
||||
python3 -m xmlschema --help &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "python3-xmlschema的--help参数测试失败"
|
||||
|
||||
LOG_INFO "测试xmlschema-json2xml的--help参数"
|
||||
xmlschema-json2xml --help &> /dev/null
|
||||
CHECK_RESULT $? 0 0 "xmlschema-json2xml的--help参数测试失败"
|
||||
|
||||
LOG_INFO "步骤五:清理环境"
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "卸载测试安装的软件包"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XML输出的缩进
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-json2xml
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-json2xml"
|
||||
if dnf list installed python3-xmlschema &> /dev/null && dnf list installed xmlschema-json2xml &> /dev/null; then
|
||||
LOG_INFO "python3-xmlschema和xmlschema-json2xml已安装"
|
||||
INSTALLED="true"
|
||||
else
|
||||
LOG_INFO "python3-xmlschema和xmlschema-json2xml未安装"
|
||||
INSTALLED="false"
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema和xmlschema-json2xml软件包
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-json2xml软件包"
|
||||
if ! dnf list available python3-xmlschema &> /dev/null; then
|
||||
LOG_ERROR "yum源中无python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
if ! dnf list available xmlschema-json2xml &> /dev/null; then
|
||||
LOG_ERROR "yum源中无xmlschema-json2xml软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema和xmlschema-json2xml失败"
|
||||
fi
|
||||
|
||||
# 测试指定XML输出的缩进
|
||||
LOG_INFO "测试指定XML输出的缩进"
|
||||
# 创建测试JSON文件
|
||||
cat > /tmp/test.json <<EOF
|
||||
{
|
||||
"root": {
|
||||
"element": "value",
|
||||
"nested": {
|
||||
"item": "data"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# 使用xmlschema-json2xml转换JSON为XML,并指定缩进
|
||||
LOG_INFO "使用xmlschema-json2xml转换JSON为XML,并指定缩进为4"
|
||||
xmlschema-json2xml /tmp/test.json --indent 4 > /tmp/test_indent.xml
|
||||
CHECK_RESULT $? 0 0 "xmlschema-json2xml转换失败"
|
||||
|
||||
# 检查生成的XML文件是否包含缩进
|
||||
LOG_INFO "检查生成的XML文件是否包含缩进"
|
||||
if grep -q "^ <" /tmp/test_indent.xml; then
|
||||
LOG_INFO "XML文件包含4空格缩进"
|
||||
else
|
||||
LOG_ERROR "XML文件未包含指定缩进"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f /tmp/test.json /tmp/test_indent.xml
|
||||
|
||||
# 如果之前未安装软件包,则卸载
|
||||
if [ "$INSTALLED" = "false" ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-json2xml软件包"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema和xmlschema-json2xml失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,167 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定编码后XML文件的输出目录
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试指定编码后XML文件的输出目录
|
||||
|
||||
# 检查python3-xmlschema软件包是否可用
|
||||
LOG_INFO "检查python3-xmlschema软件包是否在yum源中"
|
||||
dnf list available python3-xmlschema 2>/dev/null | grep -q "python3-xmlschema"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中没有python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查环境是否已安装python3-xmlschema
|
||||
LOG_INFO "检查python3-xmlschema是否已安装"
|
||||
rpm -q python3-xmlschema >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
already_installed=true
|
||||
LOG_INFO "python3-xmlschema已安装,测试后保持安装状态"
|
||||
else
|
||||
already_installed=false
|
||||
LOG_INFO "python3-xmlschema未安装,将在测试前安装"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$already_installed" = "false" ]; then
|
||||
LOG_INFO "安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 创建测试用的JSON文件
|
||||
LOG_INFO "创建测试用的JSON文件"
|
||||
cat > test_input.json << "EOF"
|
||||
{
|
||||
"person": {
|
||||
"name": "张三",
|
||||
"age": 30,
|
||||
"city": "北京"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建JSON文件失败"
|
||||
|
||||
# 创建测试用的XML Schema文件
|
||||
LOG_INFO "创建测试用的XML Schema文件"
|
||||
cat > test_schema.xsd << "EOF"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="person">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="name" type="xs:string"/>
|
||||
<xs:element name="age" type="xs:integer"/>
|
||||
<xs:element name="city" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建XML Schema文件失败"
|
||||
|
||||
# 检查xmlschema-json2xml命令是否存在
|
||||
LOG_INFO "检查xmlschema-json2xml命令是否存在"
|
||||
command -v xmlschema-json2xml >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-json2xml命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查xmlschema-json2xml是否支持--output参数
|
||||
LOG_INFO "检查xmlschema-json2xml是否支持--output参数"
|
||||
xmlschema-json2xml --help 2>&1 | grep -q "\-\-output"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-json2xml不支持--output参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 创建输出目录
|
||||
LOG_INFO "创建输出目录"
|
||||
output_dir="/tmp/xml_output_test_$(date +%s)"
|
||||
mkdir -p "$output_dir"
|
||||
CHECK_RESULT $? 0 0 "创建输出目录失败"
|
||||
|
||||
# 测试指定编码后XML文件的输出目录功能
|
||||
LOG_INFO "测试指定编码后XML文件的输出目录功能"
|
||||
xmlschema-json2xml test_input.json test_schema.xsd --output "$output_dir/output.xml" --encoding "UTF-8"
|
||||
CHECK_RESULT $? 0 0 "xmlschema-json2xml执行失败"
|
||||
|
||||
# 验证输出文件是否生成
|
||||
LOG_INFO "验证输出文件是否生成"
|
||||
if [ -f "$output_dir/output.xml" ]; then
|
||||
LOG_INFO "输出文件已成功生成: $output_dir/output.xml"
|
||||
|
||||
# 验证文件内容
|
||||
LOG_INFO "验证输出文件内容"
|
||||
if grep -q "张三" "$output_dir/output.xml" && grep -q "北京" "$output_dir/output.xml"; then
|
||||
LOG_INFO "输出文件内容验证成功"
|
||||
else
|
||||
LOG_ERROR "输出文件内容验证失败"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
LOG_ERROR "输出文件未生成"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 验证编码是否正确
|
||||
LOG_INFO "验证输出文件编码"
|
||||
file_output=$(file -i "$output_dir/output.xml" 2>/dev/null || file "$output_dir/output.xml")
|
||||
echo "$file_output" | grep -q -i "utf-8"
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "输出文件编码为UTF-8,符合预期"
|
||||
else
|
||||
LOG_INFO "文件编码信息: $file_output"
|
||||
# 检查文件是否包含正确的XML声明
|
||||
if head -n 1 "$output_dir/output.xml" | grep -q "encoding="UTF-8""; then
|
||||
LOG_INFO "XML文件声明中包含UTF-8编码"
|
||||
else
|
||||
LOG_ERROR "输出文件编码不符合预期"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test_input.json test_schema.xsd
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 清理输出目录
|
||||
LOG_INFO "清理输出目录"
|
||||
rm -rf "$output_dir"
|
||||
CHECK_RESULT $? 0 0 "清理输出目录失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$already_installed" = "false" ]; then
|
||||
LOG_INFO "卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
LOG_INFO "环境已恢复到测试前状态"
|
||||
else
|
||||
LOG_INFO "保持python3-xmlschema安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试指定编码后XML文件的输出目录功能测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,194 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XSD模式文件的路径或URL
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义变量
|
||||
TEST_XSD_FILE="/tmp/test_schema.xsd"
|
||||
TEST_XML_FILE="/tmp/test_output.xml"
|
||||
TEST_JSON_FILE="/tmp/test_data.json"
|
||||
|
||||
# 清理函数
|
||||
cleanup() {
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f ${TEST_XSD_FILE} ${TEST_XML_FILE} ${TEST_JSON_FILE} 2>/dev/null
|
||||
}
|
||||
|
||||
# 检查软件包是否存在
|
||||
check_package() {
|
||||
LOG_INFO "检查软件包 python3-xmlschema 是否在yum源中"
|
||||
dnf list python3-xmlschema 2>&1 | grep -q "python3-xmlschema"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 python3-xmlschema 不在yum源中"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查命令参数
|
||||
check_command_args() {
|
||||
LOG_INFO "检查 xmlschema-json2xml 命令参数"
|
||||
xmlschema-json2xml --help 2>&1 | grep -q -- "--schema"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-json2xml 命令不支持 --schema 参数"
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查安装状态
|
||||
check_installed() {
|
||||
LOG_INFO "检查 python3-xmlschema 是否已安装"
|
||||
rpm -q python3-xmlschema >/dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
# 安装软件包
|
||||
install_package() {
|
||||
LOG_INFO "安装 python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装 python3-xmlschema 失败"
|
||||
}
|
||||
|
||||
# 卸载软件包
|
||||
uninstall_package() {
|
||||
LOG_INFO "卸载 python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载 python3-xmlschema 失败"
|
||||
}
|
||||
|
||||
# 创建测试XSD文件
|
||||
create_test_xsd() {
|
||||
LOG_INFO "创建测试XSD模式文件"
|
||||
cat > ${TEST_XSD_FILE} << "EOF"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="person">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="name" type="xs:string"/>
|
||||
<xs:element name="age" type="xs:integer"/>
|
||||
<xs:element name="email" type="xs:string" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建XSD文件失败"
|
||||
}
|
||||
|
||||
# 创建测试JSON数据
|
||||
create_test_json() {
|
||||
LOG_INFO "创建测试JSON数据"
|
||||
cat > ${TEST_JSON_FILE} << "EOF"
|
||||
{
|
||||
"name": "张三",
|
||||
"age": 30,
|
||||
"email": "zhangsan@example.com"
|
||||
}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建JSON文件失败"
|
||||
}
|
||||
|
||||
# 测试本地XSD文件
|
||||
test_local_xsd() {
|
||||
LOG_INFO "测试本地XSD文件路径"
|
||||
xmlschema-json2xml --schema ${TEST_XSD_FILE} ${TEST_JSON_FILE} ${TEST_XML_FILE}
|
||||
CHECK_RESULT $? 0 0 "使用本地XSD文件生成XML失败"
|
||||
|
||||
LOG_INFO "验证生成的XML文件"
|
||||
[ -f ${TEST_XML_FILE} ] && grep -q "张三" ${TEST_XML_FILE}
|
||||
CHECK_RESULT $? 0 0 "生成的XML文件内容不正确"
|
||||
}
|
||||
|
||||
# 测试URL XSD文件(模拟测试)
|
||||
test_url_xsd() {
|
||||
LOG_INFO "测试URL XSD文件(模拟测试)"
|
||||
|
||||
# 创建本地HTTP服务器模拟URL访问
|
||||
python3 -m http.server 8000 --directory /tmp --bind 127.0.0.1 >/dev/null 2>&1 &
|
||||
SERVER_PID=$!
|
||||
sleep 2
|
||||
|
||||
# 测试URL格式的XSD文件
|
||||
xmlschema-json2xml --schema "http://127.0.0.1:8000/test_schema.xsd" ${TEST_JSON_FILE} ${TEST_XML_FILE}.url
|
||||
local url_test_result=$?
|
||||
|
||||
kill $SERVER_PID 2>/dev/null
|
||||
wait $SERVER_PID 2>/dev/null
|
||||
|
||||
if [ $url_test_result -eq 0 ]; then
|
||||
LOG_INFO "URL XSD文件测试成功"
|
||||
rm -f ${TEST_XML_FILE}.url
|
||||
else
|
||||
LOG_INFO "URL XSD文件测试跳过(可能网络不可达)"
|
||||
fi
|
||||
}
|
||||
|
||||
# 主测试函数
|
||||
main_test() {
|
||||
LOG_INFO "开始测试指定XSD模式文件的路径或URL"
|
||||
|
||||
# 检查软件包
|
||||
check_package
|
||||
|
||||
# 检查命令参数
|
||||
check_command_args
|
||||
|
||||
# 记录初始安装状态
|
||||
check_installed
|
||||
local originally_installed=$?
|
||||
|
||||
# 如果未安装,则安装
|
||||
if [ $originally_installed -ne 0 ]; then
|
||||
install_package
|
||||
local need_uninstall=1
|
||||
else
|
||||
LOG_INFO "python3-xmlschema 已安装,保持安装状态"
|
||||
local need_uninstall=0
|
||||
fi
|
||||
|
||||
# 创建测试文件
|
||||
create_test_xsd
|
||||
create_test_json
|
||||
|
||||
# 执行测试
|
||||
test_local_xsd
|
||||
test_url_xsd
|
||||
|
||||
# 清理临时文件
|
||||
cleanup
|
||||
|
||||
# 如果测试前未安装,则卸载
|
||||
if [ $need_uninstall -eq 1 ]; then
|
||||
uninstall_package
|
||||
else
|
||||
LOG_INFO "保持 python3-xmlschema 安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
# 设置trap确保清理
|
||||
trap cleanup EXIT
|
||||
|
||||
# 执行主测试
|
||||
main_test
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定模式位置提示覆盖
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试指定模式位置提示覆盖"
|
||||
|
||||
# 检查yum源中是否存在软件包
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema和xmlschema-json2xml-upper-l软件包"
|
||||
if ! dnf list available python3-xmlschema > /dev/null 2>&1; then
|
||||
LOG_ERROR "软件包python3-xmlschema在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if ! dnf list available xmlschema-json2xml-upper-l > /dev/null 2>&1; then
|
||||
LOG_ERROR "软件包xmlschema-json2xml-upper-l在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查环境是否已安装软件包
|
||||
LOG_INFO "检查环境是否已安装python3-xmlschema和xmlschema-json2xml-upper-l"
|
||||
INSTALLED=false
|
||||
if rpm -q python3-xmlschema > /dev/null 2>&1 && rpm -q xmlschema-json2xml-upper-l > /dev/null 2>&1; then
|
||||
INSTALLED=true
|
||||
LOG_INFO "软件包已安装,测试完成后将保持安装状态"
|
||||
else
|
||||
LOG_INFO "软件包未安装,将进行安装并在测试完成后卸载"
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-json2xml-upper-l"
|
||||
dnf install -y python3-xmlschema xmlschema-json2xml-upper-l
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试指定模式位置提示覆盖
|
||||
LOG_INFO "测试指定模式位置提示覆盖"
|
||||
# 假设测试命令为xmlschema-json2xml-upper-l,并检查其参数
|
||||
if ! xmlschema-json2xml-upper-l --help 2>&1 | grep -q "模式位置提示"; then
|
||||
LOG_ERROR "参数"模式位置提示"不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行测试命令
|
||||
LOG_INFO "执行xmlschema-json2xml-upper-l命令测试模式位置提示覆盖"
|
||||
xmlschema-json2xml-upper-l --模式位置提示覆盖
|
||||
CHECK_RESULT $? 0 0 "执行xmlschema-json2xml-upper-l命令失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-json2xml-upper-l"
|
||||
dnf remove -y python3-xmlschema xmlschema-json2xml-upper-l
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试指定模式位置提示覆盖"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试增加输出详细程度
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="python3-xmlschema"
|
||||
COMMAND_NAME="xmlschema-json2xml"
|
||||
LOG_INFO "开始测试增加输出详细程度功能"
|
||||
|
||||
# 步骤1:检查yum源中是否存在指定软件包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME"
|
||||
dnf list available "$PACKAGE_NAME" &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查软件包是否已安装,决定安装和卸载策略
|
||||
LOG_INFO "步骤2:检查软件包 $PACKAGE_NAME 是否已安装"
|
||||
INSTALLED=false
|
||||
rpm -q "$PACKAGE_NAME" &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装,将在测试过程中安装"
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 步骤4:检查命令是否存在
|
||||
LOG_INFO "步骤4:检查命令 $COMMAND_NAME 是否存在"
|
||||
command -v "$COMMAND_NAME" &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令 $COMMAND_NAME 不存在"
|
||||
# 如果之前未安装,需要卸载已安装的软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:检查命令是否支持 -v 参数
|
||||
LOG_INFO "步骤5:检查命令 $COMMAND_NAME 是否支持 -v 参数"
|
||||
"$COMMAND_NAME" -v &>/dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_ERROR "命令 $COMMAND_NAME 不支持 -v 参数"
|
||||
# 如果之前未安装,需要卸载已安装的软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6:测试增加输出详细程度功能
|
||||
LOG_INFO "步骤6:测试增加输出详细程度功能"
|
||||
"$COMMAND_NAME" -v --help 2>&1 | grep -q "verbose"
|
||||
CHECK_RESULT $? 0 0 "命令 $COMMAND_NAME 的 -v 参数功能异常"
|
||||
|
||||
# 步骤7:环境恢复
|
||||
LOG_INFO "步骤7:环境恢复"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载软件包 $PACKAGE_NAME"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装,保持原状"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试增加输出详细程度功能完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定使用的XSD模式验证器版本
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试指定使用的XSD模式验证器版本"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="python3-xmlschema"
|
||||
|
||||
# 检查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 "软件包已安装,标记为已安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包未安装,标记为未安装状态"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装软件包:$PACKAGE_NAME"
|
||||
dnf install -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试指定使用的XSD模式验证器版本
|
||||
LOG_INFO "测试指定使用的XSD模式验证器版本"
|
||||
xmlschema-json2xml --version > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "命令xmlschema-json2xml不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行命令并检查结果
|
||||
LOG_INFO "执行命令:xmlschema-json2xml --version"
|
||||
xmlschema-json2xml --version
|
||||
CHECK_RESULT $? 0 0 "获取XSD模式验证器版本失败"
|
||||
|
||||
# 清理环境:如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载软件包:$PACKAGE_NAME"
|
||||
dnf remove -y $PACKAGE_NAME
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
else
|
||||
LOG_INFO "保持软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定何时解除XML数据的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试指定何时解除XML数据的参数"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查python3-xmlschema软件包是否已安装"
|
||||
if ! dnf list installed python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema未安装,将进行安装"
|
||||
INSTALLED=false
|
||||
else
|
||||
LOG_INFO "python3-xmlschema已安装"
|
||||
INSTALLED=true
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema软件包"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装软件包(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 测试xmlschema-validate命令的--defuse参数
|
||||
LOG_INFO "测试xmlschema-validate命令的--defuse参数"
|
||||
if ! xmlschema-validate --help | grep -q -- "--defuse"; then
|
||||
LOG_ERROR "xmlschema-validate命令不支持--defuse参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "执行xmlschema-validate --defuse测试"
|
||||
xmlschema-validate --defuse test.xml
|
||||
CHECK_RESULT $? 0 0 "xmlschema-validate --defuse测试失败"
|
||||
|
||||
# 清理环境(如果之前未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用懒惰验证模式的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装python3-xmlschema
|
||||
LOG_INFO "检查是否已安装python3-xmlschema"
|
||||
rpm -q python3-xmlschema > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "python3-xmlschema已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装,将在测试结束后卸载"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema"
|
||||
dnf list available python3-xmlschema > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装python3-xmlschema
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 测试使用懒惰验证模式的参数
|
||||
LOG_INFO "测试使用懒惰验证模式的参数"
|
||||
xmlschema-validate --lazy test.xml > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "懒惰验证模式参数支持"
|
||||
else
|
||||
LOG_ERROR "懒惰验证模式参数不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理环境
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XSD schema路径或URL的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装python3-xmlschema包
|
||||
LOG_INFO "检查是否已安装python3-xmlschema包"
|
||||
if ! dnf list installed python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema未安装,开始安装"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema包"
|
||||
exit 255
|
||||
fi
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "python3-xmlschema已安装"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 测试指定XSD schema路径或URL的参数
|
||||
LOG_INFO "测试指定XSD schema路径或URL的参数"
|
||||
if ! xmlschema-validate --help | grep -q "schema"; then
|
||||
LOG_ERROR "xmlschema-validate命令不支持schema参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试有效的XSD schema路径
|
||||
LOG_INFO "测试有效的XSD schema路径"
|
||||
TEST_XSD="/usr/share/xml/python3-xmlschema/test.xsd"
|
||||
if [ ! -f "$TEST_XSD" ]; then
|
||||
LOG_ERROR "测试用的XSD schema文件不存在"
|
||||
exit 1
|
||||
fi
|
||||
xmlschema-validate --schema "$TEST_XSD" &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "验证有效的XSD schema路径失败"
|
||||
|
||||
# 测试无效的XSD schema路径
|
||||
LOG_INFO "测试无效的XSD schema路径"
|
||||
xmlschema-validate --schema "/invalid/path/test.xsd" &>/dev/null
|
||||
CHECK_RESULT $? 1 0 "验证无效的XSD schema路径未返回预期错误码"
|
||||
|
||||
# 测试有效的XSD schema URL
|
||||
LOG_INFO "测试有效的XSD schema URL"
|
||||
TEST_URL="https://example.com/test.xsd"
|
||||
xmlschema-validate --schema "$TEST_URL" &>/dev/null
|
||||
CHECK_RESULT $? 0 0 "验证有效的XSD schema URL失败"
|
||||
|
||||
# 测试无效的XSD schema URL
|
||||
LOG_INFO "测试无效的XSD schema URL"
|
||||
xmlschema-validate --schema "https://invalid.url/test.xsd" &>/dev/null
|
||||
CHECK_RESULT $? 1 0 "验证无效的XSD schema URL未返回预期错误码"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" -eq 1 ]; then
|
||||
LOG_INFO "卸载python3-xmlschema包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定schema位置提示覆盖的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试指定schema位置提示覆盖的参数"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查是否已安装python3-xmlschema"
|
||||
if dnf list installed python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema已安装"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 测试指定schema位置提示覆盖的参数
|
||||
LOG_INFO "测试指定schema位置提示覆盖的参数"
|
||||
xmlschema-validate --schema-location test_schema.xsd test.xml
|
||||
CHECK_RESULT $? 0 0 "测试指定schema位置提示覆盖的参数失败"
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试指定schema位置提示覆盖的参数"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试增加输出详细信息的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试增加输出详细信息的参数"
|
||||
|
||||
# 检查是否已安装python3-xmlschema
|
||||
LOG_INFO "检查是否已安装python3-xmlschema"
|
||||
if ! dnf list installed python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema未安装,将进行安装"
|
||||
INSTALLED=false
|
||||
else
|
||||
LOG_INFO "python3-xmlschema已安装"
|
||||
INSTALLED=true
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装python3-xmlschema
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 测试xmlschema-validate命令是否支持详细输出参数
|
||||
LOG_INFO "测试xmlschema-validate命令是否支持详细输出参数"
|
||||
if ! xmlschema-validate --help | grep -q "\-\-verbose"; then
|
||||
LOG_ERROR "xmlschema-validate命令不支持--verbose参数"
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行xmlschema-validate命令并验证详细输出
|
||||
LOG_INFO "执行xmlschema-validate命令并验证详细输出"
|
||||
xmlschema-validate --verbose schema.xsd instance.xml
|
||||
CHECK_RESULT $? 0 0 "xmlschema-validate命令执行失败"
|
||||
|
||||
# 清理环境
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XSD schema验证器版本的参数
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试指定XSD schema验证器版本的参数"
|
||||
|
||||
# 检查软件包是否已安装
|
||||
LOG_INFO "检查python3-xmlschema软件包是否已安装"
|
||||
rpm -q python3-xmlschema
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "python3-xmlschema软件包已安装,测试结束后将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema软件包未安装,将在测试结束后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema软件包
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema软件包"
|
||||
dnf list available python3-xmlschema
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装python3-xmlschema软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema软件包失败"
|
||||
fi
|
||||
|
||||
# 测试xmlschema-validate命令的--version参数
|
||||
LOG_INFO "测试xmlschema-validate命令的--version参数"
|
||||
xmlschema-validate --version
|
||||
CHECK_RESULT $? 0 0 "xmlschema-validate命令不支持--version参数"
|
||||
|
||||
# 清理环境
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,116 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用--defuse参数指定何时解除XML数据(例如always, remote, never)。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试python3-xmlschema的xmlschema-validate命令的--defuse参数"
|
||||
|
||||
# 检查yum源中是否存在python3-xmlschema包
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema包"
|
||||
dnf list available python3-xmlschema &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装python3-xmlschema
|
||||
LOG_INFO "检查是否已安装python3-xmlschema"
|
||||
if rpm -q python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema已安装,标记为保持安装状态"
|
||||
KEEP_INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装,将进行安装"
|
||||
KEEP_INSTALLED=false
|
||||
fi
|
||||
|
||||
# 如果未安装则安装软件包
|
||||
if [ "$KEEP_INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 测试--defuse参数
|
||||
LOG_INFO "测试xmlschema-validate命令的--defuse参数"
|
||||
|
||||
# 创建一个简单的XML文件用于测试
|
||||
LOG_INFO "创建测试XML文件"
|
||||
cat > test.xml << "EOF"
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<item>test</item>
|
||||
</root>
|
||||
EOF
|
||||
|
||||
# 创建一个简单的XSD文件用于测试
|
||||
LOG_INFO "创建测试XSD文件"
|
||||
cat > test.xsd << "EOF"
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
|
||||
# 测试--defuse参数的不同值
|
||||
LOG_INFO "测试--defuse=always参数"
|
||||
xmlschema-validate --defuse=always test.xsd test.xml
|
||||
CHECK_RESULT $? 0 0 "--defuse=always参数测试失败"
|
||||
|
||||
LOG_INFO "测试--defuse=remote参数"
|
||||
xmlschema-validate --defuse=remote test.xsd test.xml
|
||||
CHECK_RESULT $? 0 0 "--defuse=remote参数测试失败"
|
||||
|
||||
LOG_INFO "测试--defuse=never参数"
|
||||
xmlschema-validate --defuse=never test.xsd test.xml
|
||||
CHECK_RESULT $? 0 0 "--defuse=never参数测试失败"
|
||||
|
||||
# 测试无效的--defuse参数值
|
||||
LOG_INFO "测试无效的--defuse参数值"
|
||||
xmlschema-validate --defuse=invalid test.xsd test.xml 2>/dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_INFO "无效参数值测试通过,按预期退出"
|
||||
else
|
||||
LOG_ERROR "无效参数值测试失败,未按预期退出"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.xml test.xsd
|
||||
|
||||
# 如果测试开始时未安装,则卸载软件包
|
||||
if [ "$KEEP_INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
else
|
||||
LOG_INFO "保持python3-xmlschema安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用--lazy参数启用延迟验证模式。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试python3-xmlschema软件包的xmlschema-validate命令的--lazy参数"
|
||||
LOG_INFO "检查是否已安装python3-xmlschema软件包"
|
||||
if rpm -q python3-xmlschema > /dev/null 2>&1; then
|
||||
LOG_INFO "python3-xmlschema软件包已安装,脚本结束后将保持安装状态"
|
||||
already_installed=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema软件包未安装,将在测试过程中安装"
|
||||
already_installed=false
|
||||
fi
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema软件包"
|
||||
if ! dnf list available python3-xmlschema > /dev/null 2>&1; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema软件包失败"
|
||||
fi
|
||||
LOG_INFO "检查xmlschema-validate命令是否支持--lazy参数"
|
||||
xmlschema-validate --help 2>&1 | grep -q "\-\-lazy"
|
||||
CHECK_RESULT $? 0 0 "xmlschema-validate命令不支持--lazy参数"
|
||||
LOG_INFO "创建一个简单的XML文件用于测试"
|
||||
cat > test.xml << EOF
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<item>test</item>
|
||||
</root>
|
||||
EOF
|
||||
LOG_INFO "创建一个简单的XSD文件用于测试"
|
||||
cat > test.xsd << EOF
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
LOG_INFO "使用--lazy参数运行xmlschema-validate命令进行延迟验证"
|
||||
xmlschema-validate --lazy test.xsd test.xml
|
||||
CHECK_RESULT $? 0 0 "使用--lazy参数运行xmlschema-validate命令失败"
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.xml test.xsd
|
||||
if [ "$already_installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema软件包失败"
|
||||
fi
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用--schema参数指定XSD文件路径来验证XML文件。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:使用--schema参数指定XSD文件路径来验证XML文件。"
|
||||
|
||||
LOG_INFO "步骤1:检查软件包是否在yum源中可用。"
|
||||
dnf list available python3-xmlschema 2>/dev/null | grep -q python3-xmlschema
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "软件包python3-xmlschema在yum源中不可用。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2:检查是否已安装python3-xmlschema。"
|
||||
rpm -q python3-xmlschema >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,脚本结束后保持安装状态。"
|
||||
INSTALLED_BEFORE=1
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试过程中安装。"
|
||||
INSTALLED_BEFORE=0
|
||||
fi
|
||||
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装python3-xmlschema软件包。"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败。"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4:创建测试用的XML和XSD文件。"
|
||||
cat > test.xml <<EOF
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<element>test</element>
|
||||
</root>
|
||||
EOF
|
||||
|
||||
cat > test.xsd <<EOF
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="element" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
|
||||
LOG_INFO "步骤5:使用--schema参数验证XML文件。"
|
||||
xmlschema validate --schema test.xsd test.xml
|
||||
CHECK_RESULT $? 0 0 "使用--schema参数验证XML文件失败。"
|
||||
|
||||
LOG_INFO "步骤6:测试--schema参数不存在或不支持的情况。"
|
||||
xmlschema validate --invalid-param test.xsd test.xml 2>/dev/null
|
||||
if [ $? -eq 255 ]; then
|
||||
LOG_INFO "--schema参数不存在或不支持,符合预期。"
|
||||
else
|
||||
LOG_ERROR "--schema参数存在或支持,不符合预期。"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤7:清理测试文件。"
|
||||
rm -f test.xml test.xsd
|
||||
|
||||
if [ $INSTALLED_BEFORE -eq 0 ]; then
|
||||
LOG_INFO "步骤8:卸载python3-xmlschema软件包。"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败。"
|
||||
else
|
||||
LOG_INFO "步骤8:保持python3-xmlschema安装状态。"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成。"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试同时使用--schema和-v参数来验证XML并获取详细输出。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试同时使用--schema和-v参数来验证XML并获取详细输出"
|
||||
LOG_INFO "步骤1: 检查环境中是否已安装python3-xmlschema包"
|
||||
if rpm -q python3-xmlschema > /dev/null 2>&1; then
|
||||
LOG_INFO "python3-xmlschema已安装,测试结束后保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装,将在测试前安装并在测试后卸载"
|
||||
installed=false
|
||||
fi
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "步骤2: 检查yum源中是否有python3-xmlschema包"
|
||||
if dnf list available python3-xmlschema > /dev/null 2>&1; then
|
||||
LOG_INFO "yum源中存在python3-xmlschema包,开始安装"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
else
|
||||
LOG_ERROR "yum源中不存在python3-xmlschema包,退出"
|
||||
exit 255
|
||||
fi
|
||||
fi
|
||||
LOG_INFO "步骤3: 创建测试用的XML文件和Schema文件"
|
||||
cat > test.xml << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<book>
|
||||
<title>Test Book</title>
|
||||
<author>Test Author</author>
|
||||
</book>
|
||||
EOF
|
||||
cat > test.xsd << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="book">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="author" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
LOG_INFO "步骤4: 验证xmlschema-validate命令是否支持--schema和-v参数"
|
||||
xmlschema-validate --help | grep -q -- "--schema"
|
||||
CHECK_RESULT $? 0 0 "xmlschema-validate命令不支持--schema参数"
|
||||
xmlschema-validate --help | grep -q -- "-v"
|
||||
CHECK_RESULT $? 0 0 "xmlschema-validate命令不支持-v参数"
|
||||
LOG_INFO "步骤5: 执行xmlschema-validate命令,同时使用--schema和-v参数验证XML文件"
|
||||
xmlschema-validate --schema test.xsd -v test.xml
|
||||
CHECK_RESULT $? 0 0 "使用--schema和-v参数验证XML文件失败"
|
||||
LOG_INFO "步骤6: 清理测试文件"
|
||||
rm -f test.xml test.xsd
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "步骤7: 卸载python3-xmlschema包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,143 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用-L参数提供模式位置提示覆盖。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 定义测试变量
|
||||
PACKAGE_NAME="python3-xmlschema"
|
||||
TEST_FILE="/tmp/test_schema.xsd"
|
||||
TEST_XML="/tmp/test.xml"
|
||||
|
||||
# 步骤1:检查yum源中是否存在python3-xmlschema包
|
||||
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:检查系统是否已安装python3-xmlschema
|
||||
LOG_INFO "步骤2:检查系统是否已安装${PACKAGE_NAME}"
|
||||
INSTALLED=0
|
||||
rpm -q ${PACKAGE_NAME} >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "系统已安装${PACKAGE_NAME}"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "系统未安装${PACKAGE_NAME}"
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装则安装软件包
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "步骤3:安装${PACKAGE_NAME}包"
|
||||
dnf install -y ${PACKAGE_NAME} >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装${PACKAGE_NAME}失败"
|
||||
fi
|
||||
|
||||
# 步骤4:验证xmlschema-validate命令是否存在
|
||||
LOG_INFO "步骤4:验证xmlschema-validate命令是否存在"
|
||||
which xmlschema-validate >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-validate命令不存在"
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
dnf remove -y ${PACKAGE_NAME} >/dev/null 2>&1
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤5:检查-L参数是否支持
|
||||
LOG_INFO "步骤5:检查-L参数是否支持"
|
||||
xmlschema-validate --help 2>&1 | grep -q "\-L"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-validate命令不支持-L参数"
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
dnf remove -y ${PACKAGE_NAME} >/dev/null 2>&1
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤6:创建测试用的XML Schema文件
|
||||
LOG_INFO "步骤6:创建测试用的XML Schema文件"
|
||||
cat > ${TEST_FILE} << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="note">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="to" type="xs:string"/>
|
||||
<xs:element name="from" type="xs:string"/>
|
||||
<xs:element name="heading" type="xs:string"/>
|
||||
<xs:element name="body" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建XML Schema文件失败"
|
||||
|
||||
# 步骤7:创建测试用的XML文件
|
||||
LOG_INFO "步骤7:创建测试用的XML文件"
|
||||
cat > ${TEST_XML} << EOF
|
||||
<?xml version="1.0"?>
|
||||
<note>
|
||||
<to>Tove</to>
|
||||
<from>Jani</from>
|
||||
<heading>Reminder</heading>
|
||||
<body>Don"t forget me this weekend!</body>
|
||||
</note>
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建XML文件失败"
|
||||
|
||||
# 步骤8:使用-L参数测试模式位置提示覆盖
|
||||
LOG_INFO "步骤8:使用-L参数测试模式位置提示覆盖"
|
||||
xmlschema-validate -L ${TEST_FILE} ${TEST_XML} >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "使用-L参数验证XML失败"
|
||||
|
||||
# 步骤9:测试无效XML以验证-L参数功能
|
||||
LOG_INFO "步骤9:测试无效XML以验证-L参数功能"
|
||||
cat > /tmp/invalid.xml << EOF
|
||||
<?xml version="1.0"?>
|
||||
<note>
|
||||
<to>Tove</to>
|
||||
<from>Jani</from>
|
||||
</note>
|
||||
EOF
|
||||
|
||||
xmlschema-validate -L ${TEST_FILE} /tmp/invalid.xml 2>&1 | grep -q "validation error"
|
||||
CHECK_RESULT $? 0 0 "使用-L参数验证无效XML时未检测到错误"
|
||||
|
||||
# 步骤10:清理测试文件
|
||||
LOG_INFO "步骤10:清理测试文件"
|
||||
rm -f ${TEST_FILE} ${TEST_XML} /tmp/invalid.xml
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
# 步骤11:如果测试前未安装则卸载软件包
|
||||
if [ ${INSTALLED} -eq 0 ]; then
|
||||
LOG_INFO "步骤11:卸载${PACKAGE_NAME}包"
|
||||
dnf remove -y ${PACKAGE_NAME} >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载${PACKAGE_NAME}失败"
|
||||
else
|
||||
LOG_INFO "步骤11:保持${PACKAGE_NAME}包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:成功测试了使用-L参数提供模式位置提示覆盖"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,125 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用-v参数增加输出详细程度。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装python3-xmlschema
|
||||
LOG_INFO "检查python3-xmlschema是否已安装"
|
||||
rpm -q python3-xmlschema > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "python3-xmlschema已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=1
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装,测试前将安装该软件包"
|
||||
INSTALLED=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有python3-xmlschema
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema软件包"
|
||||
dnf list available python3-xmlschema > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 验证xmlschema-validate命令是否存在
|
||||
LOG_INFO "验证xmlschema-validate命令是否存在"
|
||||
which xmlschema-validate > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-validate命令不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 验证-v参数是否存在
|
||||
LOG_INFO "验证xmlschema-validate是否支持-v参数"
|
||||
xmlschema-validate --help 2>&1 | grep -q "\-v"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "xmlschema-validate不支持-v参数"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 准备测试文件
|
||||
LOG_INFO "准备测试用的XML和XSD文件"
|
||||
cat > test.xml << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<element>test</element>
|
||||
</root>
|
||||
EOF
|
||||
|
||||
cat > test.xsd << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="element" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
EOF
|
||||
|
||||
# 测试不带-v参数的基本验证
|
||||
LOG_INFO "测试不带-v参数的xmlschema-validate命令"
|
||||
xmlschema-validate test.xml test.xsd > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "XML验证失败"
|
||||
|
||||
# 测试带-v参数的验证
|
||||
LOG_INFO "测试带-v参数的xmlschema-validate命令"
|
||||
xmlschema-validate -v test.xml test.xsd > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "带-v参数的XML验证失败"
|
||||
|
||||
# 测试带-v参数的详细输出
|
||||
LOG_INFO "验证-v参数是否增加输出详细程度"
|
||||
OUTPUT=$(xmlschema-validate -v test.xml test.xsd 2>&1)
|
||||
if [ -n "$OUTPUT" ]; then
|
||||
LOG_INFO "-v参数成功增加了输出详细程度"
|
||||
CHECK_RESULT 0 0 0 "验证通过"
|
||||
else
|
||||
LOG_ERROR "-v参数未增加输出详细程度"
|
||||
CHECK_RESULT 1 0 0 "验证失败"
|
||||
fi
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.xml test.xsd
|
||||
|
||||
# 环境恢复
|
||||
LOG_INFO "恢复测试环境"
|
||||
if [ $INSTALLED -eq 0 ]; then
|
||||
LOG_INFO "卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
else
|
||||
LOG_INFO "保持python3-xmlschema安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-03-17
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用--version参数指定XSD模式版本(例如1.0或1.1)。
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 测试使用--version参数指定XSD模式版本(例如1.0或1.1)
|
||||
LOG_INFO "开始测试python3-xmlschema软件包的xmlschema-validate命令的--version参数"
|
||||
|
||||
# 检查yum源中是否存在python3-xmlschema软件包
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema软件包"
|
||||
dnf list python3-xmlschema > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 判断环境是否已安装python3-xmlschema
|
||||
LOG_INFO "判断环境是否已安装python3-xmlschema"
|
||||
rpm -q python3-xmlschema > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "环境已安装python3-xmlschema,测试完成后将保持安装状态"
|
||||
installed=true
|
||||
else
|
||||
LOG_INFO "环境未安装python3-xmlschema,将进行安装并在测试完成后卸载"
|
||||
installed=false
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema软件包"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema软件包失败"
|
||||
fi
|
||||
|
||||
# 检查xmlschema-validate命令是否存在
|
||||
LOG_INFO "检查xmlschema-validate命令是否存在"
|
||||
which xmlschema-validate > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "xmlschema-validate命令不存在"
|
||||
|
||||
# 测试--version参数支持性
|
||||
LOG_INFO "检查--version参数是否被支持"
|
||||
xmlschema-validate --help 2>&1 | grep -q "\-\-version"
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "--version参数不被支持"
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
fi
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 测试指定版本1.0
|
||||
LOG_INFO "测试指定版本1.0"
|
||||
xmlschema-validate --version 1.0 --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "指定版本1.0失败"
|
||||
|
||||
# 测试指定版本1.1
|
||||
LOG_INFO "测试指定版本1.1"
|
||||
xmlschema-validate --version 1.1 --help > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "指定版本1.1失败"
|
||||
|
||||
# 测试无效版本参数
|
||||
LOG_INFO "测试无效版本参数"
|
||||
xmlschema-validate --version 2.0 --help > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_ERROR "无效版本参数2.0被接受,测试失败"
|
||||
CHECK_RESULT 1 0 0 "无效版本参数测试失败"
|
||||
else
|
||||
LOG_INFO "无效版本参数2.0被正确拒绝"
|
||||
CHECK_RESULT $? 1 0 "无效版本参数测试失败"
|
||||
fi
|
||||
|
||||
# 环境恢复
|
||||
LOG_INFO "开始环境恢复"
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema软件包"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema软件包失败"
|
||||
else
|
||||
LOG_INFO "保持python3-xmlschema软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试设置何时解除XML数据的选项
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查yum源中是否存在python3-xmlschema和xmlschema-xml2json-defuse软件包
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema和xmlschema-xml2json-defuse软件包"
|
||||
dnf list available python3-xmlschema xmlschema-xml2json-defuse >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中不存在python3-xmlschema或xmlschema-xml2json-defuse软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 检查是否已安装软件包
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-xml2json-defuse软件包"
|
||||
rpm -q python3-xmlschema xmlschema-xml2json-defuse >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
installed=true
|
||||
LOG_INFO "软件包已安装,测试结束后将保持安装状态"
|
||||
else
|
||||
installed=false
|
||||
LOG_INFO "软件包未安装,测试结束后将卸载软件包"
|
||||
fi
|
||||
|
||||
# 安装软件包
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-xml2json-defuse软件包"
|
||||
dnf install -y python3-xmlschema xmlschema-xml2json-defuse >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试设置何时解除XML数据的选项
|
||||
LOG_INFO "测试设置何时解除XML数据的选项"
|
||||
xmlschema --defuse test.xml > output.json 2>&1
|
||||
CHECK_RESULT $? 0 0 "解除XML数据的选项测试失败"
|
||||
|
||||
# 清理环境,恢复到之前的状态
|
||||
if [ "$installed" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-xml2json-defuse软件包"
|
||||
dnf remove -y python3-xmlschema xmlschema-xml2json-defuse >/dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试不提示直接覆盖的选项
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-xml2json
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-xml2json"
|
||||
if rpm -q python3-xmlschema xmlschema-xml2json &>/dev/null; then
|
||||
LOG_INFO "软件包已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在python3-xmlschema和xmlschema-xml2json
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema和xmlschema-xml2json"
|
||||
if ! dnf list available python3-xmlschema xmlschema-xml2json &>/dev/null; then
|
||||
LOG_ERROR "yum源中不存在python3-xmlschema或xmlschema-xml2json"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-xml2json"
|
||||
dnf install -y python3-xmlschema xmlschema-xml2json
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试不提示直接覆盖的选项功能
|
||||
LOG_INFO "测试不提示直接覆盖的选项功能"
|
||||
xml2json_output=$(xml2json --help 2>&1)
|
||||
if ! grep -q "--force" <<< "$xml2json_output"; then
|
||||
LOG_ERROR "--force参数不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行命令并检查结果
|
||||
LOG_INFO "执行xml2json命令测试覆盖选项"
|
||||
dummy_xml="<test>dummy</test>"
|
||||
echo "$dummy_xml" > test.xml
|
||||
xml2json --force test.xml -o test.json
|
||||
CHECK_RESULT $? 0 0 "执行xml2json命令失败"
|
||||
|
||||
# 清理测试文件
|
||||
LOG_INFO "清理测试文件"
|
||||
rm -f test.xml test.json
|
||||
|
||||
# 如果之前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-xml2json"
|
||||
dnf remove -y python3-xmlschema xmlschema-xml2json
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -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 : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试为JSON输出设置缩进的选项
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 测试脚本:test_python3-xmlschema_xmlschema-xml2json__indent
|
||||
|
||||
# 步骤1:检查是否已安装python3-xmlschema
|
||||
LOG_INFO "检查是否已安装python3-xmlschema"
|
||||
if dnf list installed python3-xmlschema &>/dev/null; then
|
||||
LOG_INFO "python3-xmlschema已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "python3-xmlschema未安装,将在测试结束后卸载"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 步骤2:检查yum源中是否有python3-xmlschema
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema"
|
||||
if ! dnf list available python3-xmlschema &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema,退出"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤3:安装python3-xmlschema(如果未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema"
|
||||
dnf install -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "安装python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
# 步骤4:测试为JSON输出设置缩进的选项
|
||||
LOG_INFO "测试为JSON输出设置缩进的选项"
|
||||
|
||||
# 创建临时XML文件
|
||||
cat > test.xml <<EOF
|
||||
<root>
|
||||
<element>value</element>
|
||||
</root>
|
||||
EOF
|
||||
|
||||
# 测试xml2json命令的--indent参数
|
||||
LOG_INFO "执行xml2json命令并设置缩进为4"
|
||||
xml2json --indent 4 test.xml test.json
|
||||
CHECK_RESULT $? 0 0 "xml2json命令执行失败"
|
||||
|
||||
# 检查生成的JSON文件是否存在缩进
|
||||
LOG_INFO "检查生成的JSON文件是否符合预期"
|
||||
if grep -q " "element": "value"" test.json; then
|
||||
LOG_INFO "JSON文件缩进设置成功"
|
||||
else
|
||||
LOG_ERROR "JSON文件缩进设置失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 步骤5:清理临时文件
|
||||
LOG_INFO "清理临时文件"
|
||||
rm -f test.xml test.json
|
||||
|
||||
# 步骤6:卸载python3-xmlschema(如果之前未安装)
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema"
|
||||
dnf remove -y python3-xmlschema
|
||||
CHECK_RESULT $? 0 0 "卸载python3-xmlschema失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试使用懒惰解码模式的选项
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:测试使用懒惰解码模式的选项"
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-xml2json
|
||||
LOG_INFO "检查环境是否已安装所需软件包"
|
||||
if dnf list installed python3-xmlschema && dnf list installed xmlschema-xml2json; then
|
||||
LOG_INFO "软件包已安装,测试结束后将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "软件包未安装,测试结束后将卸载软件包"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有软件包
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-xml2json"
|
||||
if ! dnf list available python3-xmlschema || ! dnf list available xmlschema-xml2json; then
|
||||
LOG_ERROR "yum源中缺少所需软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-xml2json"
|
||||
dnf install -y python3-xmlschema xmlschema-xml2json
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试懒惰解码模式选项
|
||||
LOG_INFO "测试懒惰解码模式选项"
|
||||
xmlschema-xml2json --lazy test.xml
|
||||
CHECK_RESULT $? 0 0 "懒惰解码模式选项测试失败"
|
||||
|
||||
# 如果测试前未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载python3-xmlschema和xmlschema-xml2json"
|
||||
dnf remove -y python3-xmlschema xmlschema-xml2json
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:测试使用懒惰解码模式的选项"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定输出文件路径的选项
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试指定输出文件路径的选项"
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-xml2json
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-xml2json"
|
||||
dnf list installed python3-xmlschema > /dev/null 2>&1
|
||||
python3_xmlschema_installed=$?
|
||||
dnf list installed xmlschema-xml2json > /dev/null 2>&1
|
||||
xmlschema_xml2json_installed=$?
|
||||
|
||||
if [ $python3_xmlschema_installed -eq 0 ] && [ $xmlschema_xml2json_installed -eq 0 ]; then
|
||||
LOG_INFO "软件包已安装,脚本结束时将保持安装状态"
|
||||
installed_before=1
|
||||
else
|
||||
LOG_INFO "软件包未安装,将在测试结束后卸载"
|
||||
installed_before=0
|
||||
fi
|
||||
|
||||
# 检查yum源中是否有软件包
|
||||
LOG_INFO "检查yum源中是否有python3-xmlschema和xmlschema-xml2json"
|
||||
dnf list available python3-xmlschema > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到python3-xmlschema"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
dnf list available xmlschema-xml2json > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "yum源中未找到xmlschema-xml2json"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 安装软件包
|
||||
if [ $installed_before -eq 0 ]; then
|
||||
LOG_INFO "安装python3-xmlschema和xmlschema-xml2json"
|
||||
dnf install -y python3-xmlschema xmlschema-xml2json
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试指定输出文件路径的选项
|
||||
LOG_INFO "测试指定输出文件路径的选项"
|
||||
output_file="/tmp/test_output.json"
|
||||
|
||||
# 执行命令并检查结果
|
||||
xmlschema-xml2json --output "$output_file" test.xml
|
||||
CHECK_RESULT $? 0 0 "执行命令失败"
|
||||
|
||||
# 检查输出文件是否存在
|
||||
LOG_INFO "检查输出文件是否存在"
|
||||
if [ -f "$output_file" ]; then
|
||||
LOG_INFO "输出文件创建成功"
|
||||
else
|
||||
LOG_ERROR "输出文件未创建"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清理输出文件
|
||||
LOG_INFO "清理输出文件"
|
||||
rm -f "$output_file"
|
||||
|
||||
# 卸载软件包(如果之前未安装)
|
||||
if [ $installed_before -eq 0 ]; then
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : 测试指定XSD架构路径或URL的选项
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
|
||||
# 检查是否已安装python3-xmlschema和xmlschema-xml2json包
|
||||
LOG_INFO "检查是否已安装python3-xmlschema和xmlschema-xml2json包"
|
||||
if ! dnf list installed python3-xmlschema &> /dev/null || ! dnf list installed xmlschema-xml2json &> /dev/null; then
|
||||
LOG_INFO "未检测到python3-xmlschema或xmlschema-xml2json包,将进行安装"
|
||||
INSTALLED=false
|
||||
else
|
||||
LOG_INFO "检测到python3-xmlschema和xmlschema-xml2json包已安装"
|
||||
INSTALLED=true
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在python3-xmlschema和xmlschema-xml2json包
|
||||
LOG_INFO "检查yum源中是否存在python3-xmlschema和xmlschema-xml2json包"
|
||||
if ! dnf list available python3-xmlschema &> /dev/null || ! dnf list available xmlschema-xml2json &> /dev/null; then
|
||||
LOG_ERROR "yum源中不存在python3-xmlschema或xmlschema-xml2json包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 若未安装则安装软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "开始安装python3-xmlschema和xmlschema-xml2json包"
|
||||
dnf install -y python3-xmlschema xmlchema- xml2json
|
||||
CHECK_RESULT $? 0 0 "安装软件包失败"
|
||||
fi
|
||||
|
||||
# 测试指定XSD架构路径或URL的选项
|
||||
LOG_INFO "测试指定XSD架构路径或URL的选项"
|
||||
xsd_path="/path/to/test.xsd" # 替换为实际的XSD文件路径或URL
|
||||
if [ ! -f "$xsd_path" ] && [[ ! "$xsd_path" =~ ^http[s]?:// ]]; then
|
||||
LOG_ERROR "指定的XSD路径或URL无效: $xsd_path"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 执行命令测试
|
||||
LOG_INFO "执行xml2json命令测试"
|
||||
output=$(xml2json --xsd "$xsd_path" --output test.json)
|
||||
CHECK_RESULT $? 0 0 "执行xml2json命令失败"
|
||||
|
||||
# 清理环境:若之前未安装则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载之前安装的软件包"
|
||||
dnf remove -y python3- xmlschema xmlschema- xml2json
|
||||
CHECK_RESULT $? 0 0 "卸载软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试脚本执行完毕,环境已恢复"
|
||||
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user