update testcase for testsuite qt5-qtremoteobjects-devel
This commit is contained in:
@@ -2,29 +2,13 @@
|
||||
"path": "$OET_PATH/testcases/function_test/pkg_test/qt5-qtremoteobjects/qt5-qtremoteobjects-devel",
|
||||
"machine num": 1,
|
||||
"cases": [
|
||||
{
|
||||
"name": "test_qt5-qtremoteobjects-devel_function_basic",
|
||||
"desc": "Test basic functionality of qt5-qtremoteobjects-devel"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtremoteobjects-devel_install",
|
||||
"desc": "Test installation of qt5-qtremoteobjects-devel package"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtremoteobjects-devel_uninstall",
|
||||
"desc": "Test uninstallation of qt5-qtremoteobjects-devel package"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtremoteobjects-devel_check_files",
|
||||
"desc": "Test existence of development files (headers, libraries)"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtremoteobjects-devel_basic_compile",
|
||||
"desc": "Test basic compilation with the development package"
|
||||
},
|
||||
{
|
||||
"name": "test_qt5-qtremoteobjects-devel_remoteobject_usage",
|
||||
"desc": "Test basic Remote Objects functionality usage"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2026-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic compilation with the development package
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
set -e
|
||||
|
||||
LOG_INFO "开始测试:Test basic compilation with the development package"
|
||||
|
||||
# 定义软件包名称
|
||||
PACKAGE_NAME="qt5-qtremoteobjects-devel"
|
||||
|
||||
# 步骤1:检查yum源中是否存在指定的软件包
|
||||
LOG_INFO "步骤1:检查yum源中是否存在软件包 $PACKAGE_NAME"
|
||||
if ! dnf list available "$PACKAGE_NAME" &>/dev/null; then
|
||||
LOG_ERROR "软件包 $PACKAGE_NAME 在yum源中不存在"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# 步骤2:检查当前环境是否已安装该软件包
|
||||
LOG_INFO "步骤2:检查当前环境是否已安装软件包 $PACKAGE_NAME"
|
||||
if rpm -q "$PACKAGE_NAME" &>/dev/null; then
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 已安装,标记为已安装状态"
|
||||
INSTALLED_BEFORE_TEST=true
|
||||
else
|
||||
LOG_INFO "软件包 $PACKAGE_NAME 未安装,标记为未安装状态"
|
||||
INSTALLED_BEFORE_TEST=false
|
||||
fi
|
||||
|
||||
# 步骤3:如果未安装,则安装软件包作为测试步骤
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "步骤3:安装软件包 $PACKAGE_NAME"
|
||||
dnf install -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "安装软件包 $PACKAGE_NAME 失败"
|
||||
fi
|
||||
|
||||
# 步骤4:测试基本编译功能
|
||||
LOG_INFO "步骤4:测试使用 $PACKAGE_NAME 进行基本编译"
|
||||
# 创建一个简单的测试源文件
|
||||
TEST_SRC_FILE="/tmp/test_qtremoteobjects.cpp"
|
||||
TEST_BIN_FILE="/tmp/test_qtremoteobjects"
|
||||
cat > "$TEST_SRC_FILE" << "EOF"
|
||||
#include <QCoreApplication>
|
||||
#include <QRemoteObjectNode>
|
||||
int main(int argc, char *argv[]) {
|
||||
QCoreApplication app(argc, argv);
|
||||
QRemoteObjectNode node;
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 尝试编译测试程序
|
||||
LOG_INFO "尝试编译测试程序"
|
||||
qmake -v &>/dev/null
|
||||
CHECK_RESULT $? 0 255 "qmake 命令不存在或不支持"
|
||||
|
||||
# 使用qmake和make进行编译(假设使用Qt的基本编译流程)
|
||||
# 注意:这里简化了Qt项目的编译流程,实际可能需要.pro文件等
|
||||
# 这里仅检查开发包的关键头文件和库是否存在并能被找到
|
||||
LOG_INFO "检查Qt Remote Objects开发头文件和库"
|
||||
if [ -f /usr/include/qt5/QtRemoteObjects/QRemoteObjectNode ] || [ -f /usr/include/QtRemoteObjects/QRemoteObjectNode ]; then
|
||||
LOG_INFO "找到 QRemoteObjectNode 头文件"
|
||||
else
|
||||
LOG_ERROR "未找到 QRemoteObjectNode 头文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 尝试编译一个简单的程序来链接库
|
||||
LOG_INFO "尝试编译并链接一个简单的测试程序"
|
||||
cat > /tmp/test_link.cpp << "EOF"
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
g++ -o /tmp/test_link /tmp/test_link.cpp -lQt5RemoteObjects 2>/dev/null
|
||||
CHECK_RESULT $? 0 0 "链接 Qt5RemoteObjects 库失败"
|
||||
|
||||
# 清理临时测试文件
|
||||
rm -f "$TEST_SRC_FILE" "$TEST_BIN_FILE" /tmp/test_link.cpp /tmp/test_link
|
||||
|
||||
# 步骤5:环境恢复
|
||||
LOG_INFO "步骤5:恢复测试环境"
|
||||
if [ "$INSTALLED_BEFORE_TEST" = false ]; then
|
||||
LOG_INFO "卸载在测试中安装的软件包 $PACKAGE_NAME"
|
||||
dnf remove -y "$PACKAGE_NAME"
|
||||
CHECK_RESULT $? 0 0 "卸载软件包 $PACKAGE_NAME 失败"
|
||||
else
|
||||
LOG_INFO "测试前已安装软件包 $PACKAGE_NAME,保持安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic compilation with the development package"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Copyright (c) 2024 ISCAS .ALL rights reserved.
|
||||
# This program is licensed under Mulan PSL v2.
|
||||
# You can use it according to the terms and conditions of the Mulan PSL v2.
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
# #############################################
|
||||
# @Author : honghua
|
||||
# @Contact : honghua@iscas.ac.cn
|
||||
# @Date : 2025-12-10
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic functionality of qt5-qtremoteobjects-devel
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装qt5-qtremoteobjects-devel软件包
|
||||
LOG_INFO "检查是否已安装qt5-qtremoteobjects-devel软件包"
|
||||
rpm -q qt5-qtremoteobjects-devel > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
LOG_INFO "qt5-qtremoteobjects-devel已安装,脚本结束时将保持安装状态"
|
||||
INSTALLED=true
|
||||
else
|
||||
LOG_INFO "qt5-qtremoteobjects-devel未安装,将在测试步骤中安装"
|
||||
INSTALLED=false
|
||||
fi
|
||||
|
||||
# 检查yum源中是否存在qt5-qtremoteobjects-devel软件包
|
||||
LOG_INFO "检查yum源中是否存在qt5-qtremoteobjects-devel软件包"
|
||||
dnf list available qt5-qtremoteobjects-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中不存在qt5-qtremoteobjects-devel软件包"
|
||||
|
||||
# 安装qt5-qtremoteobjects-devel软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "安装qt5-qtremoteobjects-devel软件包"
|
||||
dnf install -y qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "安装qt5-qtremoteobjects-devel软件包失败"
|
||||
fi
|
||||
|
||||
# 测试基本功能
|
||||
LOG_INFO "测试基本功能"
|
||||
qmake -query QT_INSTALL_HEADERS > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 0 "qmake命令执行失败"
|
||||
|
||||
# 清理环境:如果脚本开始时未安装,则卸载软件包
|
||||
if [ "$INSTALLED" = false ]; then
|
||||
LOG_INFO "卸载qt5-qtremoteobjects-devel软件包"
|
||||
dnf remove -y qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "卸载qt5-qtremoteobjects-devel软件包失败"
|
||||
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-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test basic Remote Objects functionality usage
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
LOG_INFO "开始测试:Test basic Remote Objects functionality usage"
|
||||
|
||||
LOG_INFO "步骤1: 检查yum源中是否存在qt5-qtremoteobjects-devel软件包"
|
||||
if ! dnf list available qt5-qtremoteobjects-devel &>/dev/null; then
|
||||
LOG_ERROR "yum源中未找到qt5-qtremoteobjects-devel软件包"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤2: 检查是否已安装qt5-qtremoteobjects-devel软件包"
|
||||
if rpm -q qt5-qtremoteobjects-devel &>/dev/null; then
|
||||
LOG_INFO "qt5-qtremoteobjects-devel已安装,脚本结束后将保持安装状态"
|
||||
INSTALLED_BEFORE=true
|
||||
else
|
||||
INSTALLED_BEFORE=false
|
||||
LOG_INFO "qt5-qtremoteobjects-devel未安装,将执行安装步骤"
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤3: 安装qt5-qtremoteobjects-devel软件包"
|
||||
dnf install -y qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "安装qt5-qtremoteobjects-devel软件包失败"
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4: 验证Remote Objects基本功能"
|
||||
LOG_INFO "步骤4.1: 检查qremoteobjects命令行工具是否可用"
|
||||
if ! command -v qremoteobjects &>/dev/null; then
|
||||
LOG_ERROR "qremoteobjects命令不存在或不支持"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
LOG_INFO "步骤4.2: 执行qremoteobjects --help查看帮助信息"
|
||||
qremoteobjects --help
|
||||
CHECK_RESULT $? 0 0 "执行qremoteobjects --help失败"
|
||||
|
||||
LOG_INFO "步骤4.3: 创建一个简单的Remote Objects示例程序"
|
||||
cat > test_remoteobject.cpp << "EOF"
|
||||
#include <QCoreApplication>
|
||||
#include <QRemoteObjectNode>
|
||||
#include <QRemoteObjectRegistryHost>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
QRemoteObjectNode node;
|
||||
QRemoteObjectRegistryHost registry(node);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
CHECK_RESULT $? 0 0 "创建测试源码文件失败"
|
||||
|
||||
LOG_INFO "步骤4.4: 编译测试程序"
|
||||
g++ -fPIC -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtRemoteObjects -lQt5Core -lQt5RemoteObjects test_remoteobject.cpp -o test_remoteobject
|
||||
CHECK_RESULT $? 0 0 "编译测试程序失败"
|
||||
|
||||
LOG_INFO "步骤4.5: 运行测试程序"
|
||||
./test_remoteobject
|
||||
CHECK_RESULT $? 0 0 "运行测试程序失败"
|
||||
|
||||
LOG_INFO "步骤5: 清理测试文件"
|
||||
rm -f test_remoteobject.cpp test_remoteobject
|
||||
CHECK_RESULT $? 0 0 "清理测试文件失败"
|
||||
|
||||
if [ "$INSTALLED_BEFORE" = false ]; then
|
||||
LOG_INFO "步骤6: 卸载qt5-qtremoteobjects-devel软件包"
|
||||
dnf remove -y qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "卸载qt5-qtremoteobjects-devel软件包失败"
|
||||
else
|
||||
LOG_INFO "步骤6: 保持qt5-qtremoteobjects-devel软件包安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成:Test basic Remote Objects functionality usage"
|
||||
}
|
||||
|
||||
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 : 2026-04-04
|
||||
# @License : Mulan PSL v2
|
||||
# @Desc : Test uninstallation of qt5-qtremoteobjects-devel package
|
||||
# ############################################
|
||||
|
||||
source "$OET_PATH/libs/locallibs/common_lib.sh"
|
||||
|
||||
function run_test() {
|
||||
# 检查是否已安装qt5-qtremoteobjects-devel
|
||||
LOG_INFO "检查qt5-qtremoteobjects-devel是否已安装"
|
||||
rpm -q qt5-qtremoteobjects-devel > /dev/null 2>&1
|
||||
is_installed=$?
|
||||
|
||||
# 如果未安装,则安装软件包
|
||||
if [ $is_installed -ne 0 ]; then
|
||||
LOG_INFO "qt5-qtremoteobjects-devel未安装,开始安装"
|
||||
|
||||
# 检查yum源中是否有该软件包
|
||||
LOG_INFO "检查yum源中是否存在qt5-qtremoteobjects-devel"
|
||||
dnf list available qt5-qtremoteobjects-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 0 255 "yum源中未找到qt5-qtremoteobjects-devel软件包"
|
||||
|
||||
# 安装软件包
|
||||
LOG_INFO "开始安装qt5-qtremoteobjects-devel"
|
||||
dnf install -y qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "安装qt5-qtremoteobjects-devel失败"
|
||||
|
||||
# 验证安装成功
|
||||
LOG_INFO "验证qt5-qtremoteobjects-devel安装成功"
|
||||
rpm -q qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "qt5-qtremoteobjects-devel未正确安装"
|
||||
else
|
||||
LOG_INFO "qt5-qtremoteobjects-devel已安装"
|
||||
fi
|
||||
|
||||
# 测试卸载功能
|
||||
LOG_INFO "开始测试卸载qt5-qtremoteobjects-devel"
|
||||
dnf remove -y qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "卸载qt5-qtremoteobjects-devel失败"
|
||||
|
||||
# 验证卸载成功
|
||||
LOG_INFO "验证qt5-qtremoteobjects-devel已卸载"
|
||||
rpm -q qt5-qtremoteobjects-devel > /dev/null 2>&1
|
||||
CHECK_RESULT $? 1 0 "qt5-qtremoteobjects-devel未正确卸载"
|
||||
|
||||
# 环境恢复
|
||||
LOG_INFO "开始恢复环境"
|
||||
if [ $is_installed -eq 0 ]; then
|
||||
LOG_INFO "重新安装qt5-qtremoteobjects-devel"
|
||||
dnf install -y qt5-qtremoteobjects-devel
|
||||
CHECK_RESULT $? 0 0 "重新安装qt5-qtremoteobjects-devel失败"
|
||||
else
|
||||
LOG_INFO "保持环境为未安装状态"
|
||||
fi
|
||||
|
||||
LOG_INFO "测试完成"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user