[PATCH v4 14/14] tests/functional/aarch64/aspeed_ast2700: Add PCIe and network tests

Jamin Lin via posted 14 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v4 14/14] tests/functional/aarch64/aspeed_ast2700: Add PCIe and network tests
Posted by Jamin Lin via 1 month, 1 week ago
Extend the AST2700 and AST2700fc functional tests with PCIe and network
checks.

This patch introduces a helper "do_ast2700_pcie_test()" that runs "lspci"
on the emulated system and verifies the expected PCIe devices:

- 0002:00:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge
- 0002:01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection

Additional changes:
- Add `-device e1000e,netdev=net1,bus=pcie.2 -netdev user,id=net1` to the
  AST2700 and AST2700fc test machines.
- In the AST2700 vbootrom test, assign an IP address to the e1000e
  interface and verify it using `ip addr`.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 .../functional/aarch64/test_aspeed_ast2700.py | 21 +++++++++++++++++++
 .../aarch64/test_aspeed_ast2700fc.py          | 13 ++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/tests/functional/aarch64/test_aspeed_ast2700.py b/tests/functional/aarch64/test_aspeed_ast2700.py
index a3db267294..0973fce0e9 100755
--- a/tests/functional/aarch64/test_aspeed_ast2700.py
+++ b/tests/functional/aarch64/test_aspeed_ast2700.py
@@ -69,6 +69,16 @@ def do_ast2700_i2c_test(self):
         exec_command_and_wait_for_pattern(self,
             'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000')
 
+    def do_ast2700_pcie_test(self):
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 0002:00:00.0',
+            '0002:00:00.0 PCI bridge: '
+            'ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge')
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 0002:01:00.0',
+            '0002:01:00.0 Ethernet controller: '
+            'Intel Corporation 82574L Gigabit Network Connection')
+
     def start_ast2700_test(self, name):
         num_cpu = 4
         uboot_size = os.path.getsize(self.scratch_file(name,
@@ -125,20 +135,31 @@ def test_aarch64_ast2700a0_evb_sdk_v09_06(self):
 
     def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
         self.set_machine('ast2700a1-evb')
+        self.require_netdev('user')
 
         self.archive_extract(self.ASSET_SDK_V906_AST2700A1)
+        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
+        self.vm.add_args('-netdev', 'user,id=net1')
         self.start_ast2700_test('ast2700-default')
         self.verify_openbmc_boot_and_login('ast2700-default')
         self.do_ast2700_i2c_test()
+        self.do_ast2700_pcie_test()
 
     def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_07(self):
         self.set_machine('ast2700a1-evb')
+        self.require_netdev('user')
 
         self.archive_extract(self.ASSET_SDK_V907_AST2700A1_VBOOROM)
+        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
+        self.vm.add_args('-netdev', 'user,id=net1')
         self.start_ast2700_test_vbootrom('ast2700-default')
         self.verify_vbootrom_firmware_flow()
         self.verify_openbmc_boot_and_login('ast2700-default')
         self.do_ast2700_i2c_test()
+        self.do_ast2700_pcie_test()
+        exec_command_and_wait_for_pattern(self,
+            'ip addr show dev eth2',
+            'inet 10.0.2.15/24')
 
 if __name__ == '__main__':
     QemuSystemTest.main()
diff --git a/tests/functional/aarch64/test_aspeed_ast2700fc.py b/tests/functional/aarch64/test_aspeed_ast2700fc.py
index b85370e182..28b66614d9 100755
--- a/tests/functional/aarch64/test_aspeed_ast2700fc.py
+++ b/tests/functional/aarch64/test_aspeed_ast2700fc.py
@@ -20,6 +20,8 @@ def do_test_aarch64_aspeed_sdk_start(self, image):
         self.vm.set_console()
         self.vm.add_args('-device',
                          'tmp105,bus=aspeed.i2c.bus.1,address=0x4d,id=tmp-test')
+        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
+        self.vm.add_args('-netdev', 'user,id=net1')
         self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
                          '-net', 'nic', '-net', 'user', '-snapshot')
 
@@ -49,6 +51,16 @@ def do_ast2700_i2c_test(self):
         exec_command_and_wait_for_pattern(self,
             'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000')
 
+    def do_ast2700_pcie_test(self):
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 0002:00:00.0',
+            '0002:00:00.0 PCI bridge: '
+            'ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge')
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 0002:01:00.0',
+            '0002:01:00.0 Ethernet controller: '
+            'Intel Corporation 82574L Gigabit Network Connection')
+
     def do_ast2700fc_ssp_test(self):
         self.vm.shutdown()
         self.vm.set_console(console_index=1)
@@ -128,6 +140,7 @@ def test_aarch64_ast2700fc_sdk_v09_06(self):
         self.start_ast2700fc_test('ast2700-default')
         self.verify_openbmc_boot_and_login('ast2700-default')
         self.do_ast2700_i2c_test()
+        self.do_ast2700_pcie_test()
         self.do_ast2700fc_ssp_test()
         self.do_ast2700fc_tsp_test()
 
-- 
2.43.0
Re: [SPAM] [PATCH v4 14/14] tests/functional/aarch64/aspeed_ast2700: Add PCIe and network tests
Posted by Cédric Le Goater 1 month, 1 week ago
On 9/19/25 05:24, Jamin Lin wrote:
> Extend the AST2700 and AST2700fc functional tests with PCIe and network
> checks.
> 
> This patch introduces a helper "do_ast2700_pcie_test()" that runs "lspci"
> on the emulated system and verifies the expected PCIe devices:
> 
> - 0002:00:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge
> - 0002:01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
> 
> Additional changes:
> - Add `-device e1000e,netdev=net1,bus=pcie.2 -netdev user,id=net1` to the
>    AST2700 and AST2700fc test machines.
> - In the AST2700 vbootrom test, assign an IP address to the e1000e
>    interface and verify it using `ip addr`.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   .../functional/aarch64/test_aspeed_ast2700.py | 21 +++++++++++++++++++
>   .../aarch64/test_aspeed_ast2700fc.py          | 13 ++++++++++++
>   2 files changed, 34 insertions(+)
> 
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700.py b/tests/functional/aarch64/test_aspeed_ast2700.py
> index a3db267294..0973fce0e9 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700.py
> @@ -69,6 +69,16 @@ def do_ast2700_i2c_test(self):
>           exec_command_and_wait_for_pattern(self,
>               'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000')
>   
> +    def do_ast2700_pcie_test(self):
> +        exec_command_and_wait_for_pattern(self,
> +            'lspci -s 0002:00:00.0',
> +            '0002:00:00.0 PCI bridge: '
> +            'ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge')
> +        exec_command_and_wait_for_pattern(self,
> +            'lspci -s 0002:01:00.0',
> +            '0002:01:00.0 Ethernet controller: '
> +            'Intel Corporation 82574L Gigabit Network Connection')
> +
>       def start_ast2700_test(self, name):
>           num_cpu = 4
>           uboot_size = os.path.getsize(self.scratch_file(name,
> @@ -125,20 +135,31 @@ def test_aarch64_ast2700a0_evb_sdk_v09_06(self):
>   
>       def test_aarch64_ast2700a1_evb_sdk_v09_06(self):
>           self.set_machine('ast2700a1-evb')
> +        self.require_netdev('user')
>   
>           self.archive_extract(self.ASSET_SDK_V906_AST2700A1)
> +        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
> +        self.vm.add_args('-netdev', 'user,id=net1')
>           self.start_ast2700_test('ast2700-default')
>           self.verify_openbmc_boot_and_login('ast2700-default')
>           self.do_ast2700_i2c_test()
> +        self.do_ast2700_pcie_test()
>   
>       def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_07(self):
>           self.set_machine('ast2700a1-evb')
> +        self.require_netdev('user')
>   
>           self.archive_extract(self.ASSET_SDK_V907_AST2700A1_VBOOROM)
> +        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
> +        self.vm.add_args('-netdev', 'user,id=net1')
>           self.start_ast2700_test_vbootrom('ast2700-default')
>           self.verify_vbootrom_firmware_flow()
>           self.verify_openbmc_boot_and_login('ast2700-default')
>           self.do_ast2700_i2c_test()
> +        self.do_ast2700_pcie_test()
> +        exec_command_and_wait_for_pattern(self,
> +            'ip addr show dev eth2',
> +            'inet 10.0.2.15/24')
>   
>   if __name__ == '__main__':
>       QemuSystemTest.main()
> diff --git a/tests/functional/aarch64/test_aspeed_ast2700fc.py b/tests/functional/aarch64/test_aspeed_ast2700fc.py
> index b85370e182..28b66614d9 100755
> --- a/tests/functional/aarch64/test_aspeed_ast2700fc.py
> +++ b/tests/functional/aarch64/test_aspeed_ast2700fc.py
> @@ -20,6 +20,8 @@ def do_test_aarch64_aspeed_sdk_start(self, image):
>           self.vm.set_console()
>           self.vm.add_args('-device',
>                            'tmp105,bus=aspeed.i2c.bus.1,address=0x4d,id=tmp-test')
> +        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
> +        self.vm.add_args('-netdev', 'user,id=net1')
>           self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
>                            '-net', 'nic', '-net', 'user', '-snapshot')
>   
> @@ -49,6 +51,16 @@ def do_ast2700_i2c_test(self):
>           exec_command_and_wait_for_pattern(self,
>               'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000')
>   
> +    def do_ast2700_pcie_test(self):
> +        exec_command_and_wait_for_pattern(self,
> +            'lspci -s 0002:00:00.0',
> +            '0002:00:00.0 PCI bridge: '
> +            'ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge')
> +        exec_command_and_wait_for_pattern(self,
> +            'lspci -s 0002:01:00.0',
> +            '0002:01:00.0 Ethernet controller: '
> +            'Intel Corporation 82574L Gigabit Network Connection')
> +
>       def do_ast2700fc_ssp_test(self):
>           self.vm.shutdown()
>           self.vm.set_console(console_index=1)
> @@ -128,6 +140,7 @@ def test_aarch64_ast2700fc_sdk_v09_06(self):
>           self.start_ast2700fc_test('ast2700-default')
>           self.verify_openbmc_boot_and_login('ast2700-default')
>           self.do_ast2700_i2c_test()
> +        self.do_ast2700_pcie_test()
>           self.do_ast2700fc_ssp_test()
>           self.do_ast2700fc_tsp_test()
>   


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.