update testcase for testsuite protobuf2-lite-static

This commit is contained in:
2026-04-16 18:25:29 +08:00
parent ad00edc901
commit 4f6571317e
3 changed files with 0 additions and 138 deletions

View File

@@ -6,14 +6,6 @@
"name": "test_protobuf2-lite-static_function_parsing",
"desc": "Test parsing functionality"
},
{
"name": "test_protobuf2-lite-static_function_serialize",
"desc": "Test serialization functionality"
},
{
"name": "test_protobuf2-lite-static_function_deserialize",
"desc": "Test deserialization functionality"
},
{
"name": "test_protobuf2-lite-static_function_message",
"desc": "Test message handling"

View File

@@ -1,65 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : Test deserialization functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试Test deserialization functionality"
# 检查环境是否已安装protobuf2-lite-static
LOG_INFO "检查protobuf2-lite-static是否已安装"
if dnf list installed protobuf2-lite-static &>/dev/null; then
LOG_INFO "protobuf2-lite-static已安装测试结束后保持安装状态"
INSTALLED=true
else
LOG_INFO "protobuf2-lite-static未安装将在测试结束后卸载"
INSTALLED=false
fi
# 检查yum源中是否有protobuf2-lite-static
LOG_INFO "检查yum源中是否有protobuf2-lite-static"
if ! dnf list available protobuf2-lite-static &>/dev/null; then
LOG_ERROR "yum源中未找到protobuf2-lite-static"
exit 255
fi
# 安装protobuf2-lite-static
if [ "$INSTALLED" = false ]; then
LOG_INFO "安装protobuf2-lite-static"
dnf install -y protobuf2-lite-static
CHECK_RESULT $? 0 0 "安装protobuf2-lite-static失败"
fi
# 测试deserialization功能
LOG_INFO "测试deserialization功能"
# 假设有一个测试程序test_deserialize这里仅作示例实际应根据具体需求编写测试逻辑
./test_deserialize --input test_data.bin --output test_output.txt
CHECK_RESULT $? 0 0 "deserialization功能测试失败"
# 清理环境
if [ "$INSTALLED" = false ]; then
LOG_INFO "卸载protobuf2-lite-static"
dnf remove -y protobuf2-lite-static
CHECK_RESULT $? 0 0 "卸载protobuf2-lite-static失败"
fi
LOG_INFO "测试完成Test deserialization functionality"
}
main "$@"

View File

@@ -1,65 +0,0 @@
#!/usr/bin/bash
# Copyright (c) 2024 ISCAS .ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# #############################################
# @Author : honghua
# @Contact : honghua@iscas.ac.cn
# @Date : 2025-12-03
# @License : Mulan PSL v2
# @Desc : Test serialization functionality
# ############################################
source "$OET_PATH/libs/locallibs/common_lib.sh"
function run_test() {
LOG_INFO "开始测试序列化功能"
# 检查protobuf2-lite-static软件包是否已安装
LOG_INFO "检查protobuf2-lite-static是否已安装"
if rpm -q protobuf2-lite-static; then
LOG_INFO "protobuf2-lite-static已安装"
installed=true
else
LOG_INFO "protobuf2-lite-static未安装"
installed=false
fi
# 检查yum源中是否有protobuf2-lite-static软件包
LOG_INFO "检查yum源中是否有protobuf2-lite-static"
if ! dnf list available protobuf2-lite-static &>/dev/null; then
LOG_ERROR "yum源中没有protobuf2-lite-static软件包"
exit 255
fi
# 如果未安装则安装protobuf2-lite-static
if [ "$installed" = false ]; then
LOG_INFO "开始安装protobuf2-lite-static"
dnf install -y protobuf2-lite-static
CHECK_RESULT $? 0 0 "安装protobuf2-lite-static失败"
fi
# 测试序列化功能
LOG_INFO "测试序列化功能"
command_to_test="protoc --encode=TestMessage test.proto < test_input.txt > test_output.bin"
eval "$command_to_test"
CHECK_RESULT $? 0 0 "序列化功能测试失败"
# 清理环境如果脚本开始时未安装则卸载protobuf2-lite-static
if [ "$installed" = false ]; then
LOG_INFO "卸载protobuf2-lite-static"
dnf remove -y protobuf2-lite-static
CHECK_RESULT $? 0 0 "卸载protobuf2-lite-static失败"
fi
LOG_INFO "测试序列化功能完成"
}
main "$@"