diff --git a/docs/system_base/qperf/tc_qperf_fun001.yaml b/docs/system_base/qperf/tc_qperf_fun001.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ae64cc8db0e62aae672b86297522abf41275850b --- /dev/null +++ b/docs/system_base/qperf/tc_qperf_fun001.yaml @@ -0,0 +1,57 @@ +作者: douzhichong +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local,qperf +用例描述: qperf网络性能测试工具基本功能测试 +修改人: douzhichong + +前置条件: +- 系统已安装qperf工具 +- 系统至少有一个网络接口处于UP状态 +- 本地主机可以正常访问网络 + +测试步骤: +- 获取本地UP状态网络接口的IPv4地址 +- 测试qperf TCP带宽测量功能 +- 测试qperf TCP延迟测量功能 +- 测试qperf UDP带宽测量功能 +- 测试qperf UDP延迟测量功能 +- 测试qperf组合参数(tcp_bw+tcp_lat)同时测量TCP带宽和延迟 +- 测试qperf组合参数(udp_bw+udp_lat)同时测量UDP带宽和延迟 +- 测试qperf组合参数(udp_bw+tcp_bw)同时测量UDP和TCP带宽 +- 测试qperf组合参数(udp_lat+tcp_lat)同时测量UDP和TCP延迟 +- 测试qperf详细输出模式(-vvu参数) +- 测试qperf消息大小范围参数(msg_size:1:64K:*2)的TCP性能测试 +- 测试qperf消息大小范围参数(msg_size:1:64K:*2)的UDP性能测试 +- 测试qperf udp_lat和quit组合功能 +- 测试qperf帮助命令的tests选项 +- 测试qperf帮助命令的opts选项 +- 测试qperf帮助命令的examples选项 +- 测试qperf帮助命令的options选项 +- 验证qperf版本命令能够正确执行并返回版本信息 +- 验证qperf基本帮助命令能够正常显示帮助信息 + +期望结果: +- 能够成功获取本地UP状态网络接口的IPv4地址 +- qperf TCP带宽测量能够正常执行并显示"tcp_bw:"输出 +- qperf TCP延迟测量能够正常执行并显示"tcp_lat:"输出 +- qperf UDP带宽测量能够正常执行并显示"udp_bw:"输出 +- qperf UDP延迟测量能够正常执行并显示"udp_lat:"输出 +- qperf组合参数(tcp_bw+tcp_lat)能够同时测量并显示带宽和延迟信息 +- qperf组合参数(udp_bw+udp_lat)能够同时测量并显示带宽和延迟信息 +- qperf组合参数(udp_bw+tcp_bw)能够同时测量并显示UDP和TCP带宽信息 +- qperf组合参数(udp_lat+tcp_lat)能够同时测量并显示UDP和TCP延迟信息 +- qperf详细输出模式能够正常显示tcp_lat、udp_lat和conf信息 +- qperf消息大小范围参数能够对TCP带宽和延迟进行梯度测试 +- qperf消息大小范围参数能够对UDP带宽和延迟进行梯度测试 +- qperf udp_lat和quit组合能够正常显示相应信息 +- qperf帮助命令的tests选项能够显示"Miscellaneous"或"Socket Based"相关信息 +- qperf帮助命令的opts选项能够正常显示选项信息 +- qperf帮助命令的examples选项能够显示"In these examples"内容 +- qperf帮助命令的options选项能够正常显示选项信息 +- qperf版本命令能够正常执行并显示"qperf"版本信息 +- qperf基本帮助命令能够正常执行并显示"Synopsis"概要信息 +- 所有测试步骤均通过,返回码为0 +- 测试完成后能够正确清理环境 diff --git a/tests/system_base/qperf/tc_qperf_fun001.py b/tests/system_base/qperf/tc_qperf_fun001.py new file mode 100644 index 0000000000000000000000000000000000000000..bfd37a56ccc8bfc957a6303c7eabff6aecaabc69 --- /dev/null +++ b/tests/system_base/qperf/tc_qperf_fun001.py @@ -0,0 +1,95 @@ +""" +@File: tc_qperf_fun001.py +@Time: 2025/12/15 15:30:20 +@Author: douzhichong +@Version: 1.0 +@Contact: douzhichong@inspur.com +@License: Mulan PSL v2 +@Modify: douzhichong +""" +import subprocess + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_qperf_fun001.yaml for details + + :avocado: tags=P1,noarch,local,qperf + """ + PARAM_DIC = {"pkg_name": "qperf"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + + def test(self): + code,ipv4=self.cmd("ip -4 addr show | grep -A2 \"state UP\" | grep -oP 'inet \K[\d.]+'") + + # 单一参数测试 + code, result = self.cmd(f'qperf "{ipv4}" tcp_bw | grep "tcp_bw:"') + self.assertFalse(code, "qperf tcp_bw test failed") + + code, result = self.cmd(f'qperf "{ipv4}" tcp_lat | grep "tcp_lat:"') + self.assertFalse(code, "qperf tcp_lat test failed") + + code, result = self.cmd(f'qperf "{ipv4}" udp_bw | grep "udp_bw:"') + self.assertFalse(code, "qperf udp_bw test failed") + + code, result = self.cmd(f'qperf "{ipv4}" udp_lat | grep "udp_lat:"') + self.assertFalse(code, "qperf udp_lat test failed") + + # 组合测试 + code, result = self.cmd( + f'qperf -t 3 --use_bits_per_sec "{ipv4}" tcp_bw tcp_lat | grep -E "tcp_bw:|tcp_lat:"') + self.assertFalse(code, "qperf tcp_bw+tcp_lat combined test failed") + + code, result = self.cmd( + f'qperf -t 3 --use_bits_per_sec "{ipv4}" udp_bw udp_lat | grep -E "udp_bw:|udp_lat:"') + self.assertFalse(code, "qperf udp_bw+udp_lat combined test failed") + + code, result = self.cmd( + f'qperf -t 3 --use_bits_per_sec "{ipv4}" udp_bw tcp_bw | grep -E "udp_bw:|tcp_bw:"') + self.assertFalse(code, "qperf udp_bw+tcp_bw combined test failed") + + code, result = self.cmd( + f'qperf -t 3 --use_bits_per_sec "{ipv4}" udp_lat tcp_lat | grep -E "udp_lat:|tcp_lat:"') + self.assertFalse(code, "qperf udp_lat+tcp_lat combined test failed") + + # 高级测试 + code, result = self.cmd( + f'qperf "{ipv4}" -t 10 -vvu tcp_lat udp_lat conf | grep -E "tcp_lat:|udp_lat:|conf:"') + self.assertFalse(code, "qperf vvu test failed") + + code, result = self.cmd( + f'qperf "{ipv4}" -oo msg_size:1:64K:*2 -vu tcp_bw tcp_lat | grep -E "tcp_bw:|tcp_lat:"') + self.assertFalse(code, "qperf msg_size tcp test failed") + + code, result = self.cmd( + f'qperf "{ipv4}" -oo msg_size:1:64K:*2 -vu udp_bw udp_lat | grep -E "udp_bw:|udp_lat:"') + self.assertFalse(code, "qperf msg_size udp test failed") + + code, result = self.cmd(f'qperf "{ipv4}" udp_lat quit | grep -E "udp_lat:|quit:"') + self.assertFalse(code, "qperf udp_lat+quit test failed") + + # 帮助和版本信息测试 + code, result = self.cmd('qperf --help tests | grep -E "Miscellaneous|Socket Based"') + self.assertFalse(code, "qperf --help tests failed") + + code, result = self.cmd('qperf --help opts') + self.assertFalse(code, "qperf --help opts failed") + + code, result = self.cmd('qperf --help examples | grep "In these examples"') + self.assertFalse(code, "qperf --help examples failed") + + code, result = self.cmd('qperf --help options') + self.assertFalse(code, "qperf --help options failed") + + code, result = self.cmd('qperf --version | grep "qperf"') + self.assertFalse(code, "qperf --version failed") + + code, result = self.cmd('qperf --help | grep "Synopsis"') + self.assertFalse(code, "qperf --help failed") + + def tearDown(self): + super().tearDown(self.PARAM_DIC)