diff --git a/docs/system_base/pciutils/tc_pciutils_lspci_fun_001.yaml b/docs/system_base/pciutils/tc_pciutils_lspci_fun_001.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c90effd830b7ff212bf53f0d8adfbb1147978cfc --- /dev/null +++ b/docs/system_base/pciutils/tc_pciutils_lspci_fun_001.yaml @@ -0,0 +1,53 @@ +作者: xufei +优先级: P1 +支持架构: noarch +执行方式: 自动 +测试类型: 功能测试 +通用标签: local +用例描述: 测试pciutils工具功能 +修改人: xufei + +前置条件: +- 可安装pciutils +- 具有root权限 +- 支持PCI设备查询 +- 有PCI设备(或虚拟化环境支持) +- 支持lspci命令 +- 支持grep命令 +- 可执行lspci命令 + +测试步骤: +- 安装pciutils +- 显示PCI设备信息 +- 使用lspci显示设备 +- 搜索bridge设备 +- 显示制造商信息 +- 使用lspci -n显示ID +- 搜索rev信息 +- 显示驱动信息 +- 使用lspci -v显示驱动 +- 搜索bridge设备详情 +- 显示模块信息 +- 使用lspci -k显示模块 +- 搜索bridge设备模块 +- 显示连接关系 +- 使用lspci -t显示树状 +- 显示详细信息 +- 使用lspci -vvv显示详情 +- 搜索bridge设备细节 +- 验证工具功能 +- 检查lspci基本功能 +- 清理环境 + +期望结果: +- 成功安装pciutils +- 成功显示PCI设备信息 +- 成功显示制造商信息 +- 成功显示驱动信息 +- 成功显示模块信息 +- 成功显示连接关系 +- 成功显示详细信息 +- lspci命令工作正常 +- 所有命令返回码为0 +- 成功清理环境 +- pciutils功能测试通过 \ No newline at end of file diff --git a/tests/system_base/pciutils/tc_pciutils_lspci_fun_001.py b/tests/system_base/pciutils/tc_pciutils_lspci_fun_001.py new file mode 100644 index 0000000000000000000000000000000000000000..90196feb2897f95e8a1369eb5dff531c72ed6ceb --- /dev/null +++ b/tests/system_base/pciutils/tc_pciutils_lspci_fun_001.py @@ -0,0 +1,57 @@ +# -*- encoding: utf-8 -*- + +""" +@File: tc_pciutils_lspci_fun_001.py +@Time: 2026/04/28 14:23:53 +@Author: xufei +@Version: 1.0 +@Contact: xufei@inspur.com +@License: Mulan PSL v2 +@Modify: xufei +""" + +from common.basetest import LocalTest + + +class Test(LocalTest): + """ + See tc_pciutils_lspci_fun_001.yaml for details + + :avocado: tags=P1,noarch,local,pciutils + """ + PARAM_DIC = {"pkg_name": "pciutils"} + + def setUp(self): + super().setUp(self.PARAM_DIC) + + def test(self): + self.log.info("start to run test.") + + code1, result1 = self.cmd('lspci | grep -i bridge') + self.assertEqual(code1, 0, "show pci device info fail") + + code2, result2 = self.cmd('lspci -n | grep rev') + self.assertEqual(code2, 0, "show device manufacturer and device ID fail") + + code3, result3 = self.cmd('lspci -v | grep -A3 -i bridge') + self.assertEqual(code3, 0, "show device driver info fail") + + code4, result4 = self.cmd('lspci -k | grep -A3 -i bridge') + self.assertEqual(code4, 0, "show device driver module info fail") + + code5, result5 = self.cmd('lspci -t') + self.assertEqual(code5, 0, "show device connection relationship info fail") + + code6, result6 = self.cmd('lspci -vvv | grep -A3 -i bridge') + self.assertEqual(code6, 0, "show pci device detail info fail") + + code7, result7 = self.cmd('lspci -v') + if code7 == 0: + self.log.info("lspci command works correctly") + + self.log.info("End to run test.") + + def tearDown(self): + super().tearDown(self.PARAM_DIC) + +