[PATCH v3 13/14] tests/functional/arm/test_aspeed_ast2600: Add PCIe and network test

Jamin Lin via posted 14 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH v3 13/14] tests/functional/arm/test_aspeed_ast2600: Add PCIe and network test
Posted by Jamin Lin via 1 month, 3 weeks ago
Extend the AST2600 functional tests with PCIe and network checks.

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

- 80:00.0 Host bridge: ASPEED Technology, Inc. Device 2600
- 80:08.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge
- 81:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection

To exercise the PCIe network device, the test adds:

  -device e1000e,netdev=net1,bus=pcie.0
  -netdev user,id=net1

and assigns an IP address to the interface, verifying it with `ip addr`.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 tests/functional/arm/test_aspeed_ast2600.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/functional/arm/test_aspeed_ast2600.py b/tests/functional/arm/test_aspeed_ast2600.py
index 87e3595584..a7d9b894fc 100755
--- a/tests/functional/arm/test_aspeed_ast2600.py
+++ b/tests/functional/arm/test_aspeed_ast2600.py
@@ -101,6 +101,23 @@ def test_arm_ast2600_evb_buildroot_tpm(self):
         'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.07/ast2600-default-obmc.tar.gz',
         'cb6c08595bcbba1672ce716b068ba4e48eda1ed9abe78a07b30392ba2278feba')
 
+    def do_ast2600_pcie_test(self):
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 80:00.0',
+            '80:00.0 Host bridge: '
+            'ASPEED Technology, Inc. Device 2600')
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 80:08.0',
+            '80:08.0 PCI bridge: '
+            'ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge')
+        exec_command_and_wait_for_pattern(self,
+            'lspci -s 81:00.0',
+            '81:00.0 Ethernet controller: '
+            'Intel Corporation 82574L Gigabit Network Connection')
+        exec_command_and_wait_for_pattern(self,
+            'ip addr add 192.168.1.100/24 dev eth4 && ip addr',
+            'inet 192.168.1.100/24 scope global eth4')
+
     def test_arm_ast2600_evb_sdk(self):
         self.set_machine('ast2600-evb')
 
@@ -110,6 +127,8 @@ def test_arm_ast2600_evb_sdk(self):
             'tmp105,bus=aspeed.i2c.bus.5,address=0x4d,id=tmp-test')
         self.vm.add_args('-device',
             'ds1338,bus=aspeed.i2c.bus.5,address=0x32')
+        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.0')
+        self.vm.add_args('-netdev', 'user,id=net1')
         self.do_test_arm_aspeed_sdk_start(
             self.scratch_file("ast2600-default", "image-bmc"))
 
@@ -135,6 +154,7 @@ def test_arm_ast2600_evb_sdk(self):
         year = time.strftime("%Y")
         exec_command_and_wait_for_pattern(self,
              '/sbin/hwclock -f /dev/rtc1', year)
+        self.do_ast2600_pcie_test()
 
     def test_arm_ast2600_otp_blockdev_device(self):
         self.vm.set_machine("ast2600-evb")
-- 
2.43.0
Re: [SPAM] [PATCH v3 13/14] tests/functional/arm/test_aspeed_ast2600: Add PCIe and network test
Posted by Cédric Le Goater 1 month, 3 weeks ago
+ Thomas

On 9/18/25 05:13, Jamin Lin wrote:
> Extend the AST2600 functional tests with PCIe and network checks.
> 
> This patch introduces a new helper "do_ast2600_pcie_test()" that runs "lspci"
> on the emulated system and verifies the presence of the expected PCIe devices:
> 
> - 80:00.0 Host bridge: ASPEED Technology, Inc. Device 2600
> - 80:08.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge
> - 81:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
> 
> To exercise the PCIe network device, the test adds:
> 
>    -device e1000e,netdev=net1,bus=pcie.0
>    -netdev user,id=net1
> 
> and assigns an IP address to the interface, verifying it with `ip addr`.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   tests/functional/arm/test_aspeed_ast2600.py | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/tests/functional/arm/test_aspeed_ast2600.py b/tests/functional/arm/test_aspeed_ast2600.py
> index 87e3595584..a7d9b894fc 100755
> --- a/tests/functional/arm/test_aspeed_ast2600.py
> +++ b/tests/functional/arm/test_aspeed_ast2600.py
> @@ -101,6 +101,23 @@ def test_arm_ast2600_evb_buildroot_tpm(self):
>           'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.07/ast2600-default-obmc.tar.gz',
>           'cb6c08595bcbba1672ce716b068ba4e48eda1ed9abe78a07b30392ba2278feba')
>   
> +    def do_ast2600_pcie_test(self):
> +        exec_command_and_wait_for_pattern(self,
> +            'lspci -s 80:00.0',
> +            '80:00.0 Host bridge: '
> +            'ASPEED Technology, Inc. Device 2600')
> +        exec_command_and_wait_for_pattern(self,
> +            'lspci -s 80:08.0',
> +            '80:08.0 PCI bridge: '
> +            'ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge')
> +        exec_command_and_wait_for_pattern(self,
> +            'lspci -s 81:00.0',
> +            '81:00.0 Ethernet controller: '
> +            'Intel Corporation 82574L Gigabit Network Connection')
> +        exec_command_and_wait_for_pattern(self,
> +            'ip addr add 192.168.1.100/24 dev eth4 && ip addr',
> +            'inet 192.168.1.100/24 scope global eth4')

I think checking that the user netdev returned 'inet 10.0.2.15/24'
should be enough. It would mean that DHCP has  worked and that MSI
were triggered. No need to assign a new IP address IMO.

> +
>       def test_arm_ast2600_evb_sdk(self):
>           self.set_machine('ast2600-evb')
>   
> @@ -110,6 +127,8 @@ def test_arm_ast2600_evb_sdk(self):
>               'tmp105,bus=aspeed.i2c.bus.5,address=0x4d,id=tmp-test')
>           self.vm.add_args('-device',
>               'ds1338,bus=aspeed.i2c.bus.5,address=0x32')
> +        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.0')
> +        self.vm.add_args('-netdev', 'user,id=net1')

you need to add

         self.require_netdev('user')



Thanks,

C.



>           self.do_test_arm_aspeed_sdk_start(
>               self.scratch_file("ast2600-default", "image-bmc"))
>   
> @@ -135,6 +154,7 @@ def test_arm_ast2600_evb_sdk(self):
>           year = time.strftime("%Y")
>           exec_command_and_wait_for_pattern(self,
>                '/sbin/hwclock -f /dev/rtc1', year)
> +        self.do_ast2600_pcie_test()
>   
>       def test_arm_ast2600_otp_blockdev_device(self):
>           self.vm.set_machine("ast2600-evb")
RE: [SPAM] [PATCH v3 13/14] tests/functional/arm/test_aspeed_ast2600: Add PCIe and network test
Posted by Jamin Lin 1 month, 3 weeks ago
Hi Cédric

> tests/functional/arm/test_aspeed_ast2600: Add PCIe and network test
> 
> + Thomas
> 
> On 9/18/25 05:13, Jamin Lin wrote:
> > Extend the AST2600 functional tests with PCIe and network checks.
> >
> > This patch introduces a new helper "do_ast2600_pcie_test()" that runs "lspci"
> > on the emulated system and verifies the presence of the expected PCIe
> devices:
> >
> > - 80:00.0 Host bridge: ASPEED Technology, Inc. Device 2600
> > - 80:08.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI
> > Bridge
> > - 81:00.0 Ethernet controller: Intel Corporation 82574L Gigabit
> > Network Connection
> >
> > To exercise the PCIe network device, the test adds:
> >
> >    -device e1000e,netdev=net1,bus=pcie.0
> >    -netdev user,id=net1
> >
> > and assigns an IP address to the interface, verifying it with `ip addr`.
> >
> > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> > ---
> >   tests/functional/arm/test_aspeed_ast2600.py | 20
> ++++++++++++++++++++
> >   1 file changed, 20 insertions(+)
> >
> > diff --git a/tests/functional/arm/test_aspeed_ast2600.py
> > b/tests/functional/arm/test_aspeed_ast2600.py
> > index 87e3595584..a7d9b894fc 100755
> > --- a/tests/functional/arm/test_aspeed_ast2600.py
> > +++ b/tests/functional/arm/test_aspeed_ast2600.py
> > @@ -101,6 +101,23 @@ def test_arm_ast2600_evb_buildroot_tpm(self):
> >
> 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.07/ast
> 2600-default-obmc.tar.gz',
> >
> >
> 'cb6c08595bcbba1672ce716b068ba4e48eda1ed9abe78a07b30392ba2278feba'
> )
> >
> > +    def do_ast2600_pcie_test(self):
> > +        exec_command_and_wait_for_pattern(self,
> > +            'lspci -s 80:00.0',
> > +            '80:00.0 Host bridge: '
> > +            'ASPEED Technology, Inc. Device 2600')
> > +        exec_command_and_wait_for_pattern(self,
> > +            'lspci -s 80:08.0',
> > +            '80:08.0 PCI bridge: '
> > +            'ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge')
> > +        exec_command_and_wait_for_pattern(self,
> > +            'lspci -s 81:00.0',
> > +            '81:00.0 Ethernet controller: '
> > +            'Intel Corporation 82574L Gigabit Network Connection')
> > +        exec_command_and_wait_for_pattern(self,
> > +            'ip addr add 192.168.1.100/24 dev eth4 && ip addr',
> > +            'inet 192.168.1.100/24 scope global eth4')
> 
> I think checking that the user netdev returned 'inet 10.0.2.15/24'
> should be enough. It would mean that DHCP has  worked and that MSI were
> triggered. No need to assign a new IP address IMO.
> 
Thanks for your review and suggestion.
Will fix it.

> > +
> >       def test_arm_ast2600_evb_sdk(self):
> >           self.set_machine('ast2600-evb')
> >
> > @@ -110,6 +127,8 @@ def test_arm_ast2600_evb_sdk(self):
> >               'tmp105,bus=aspeed.i2c.bus.5,address=0x4d,id=tmp-test')
> >           self.vm.add_args('-device',
> >               'ds1338,bus=aspeed.i2c.bus.5,address=0x32')
> > +        self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.0')
> > +        self.vm.add_args('-netdev', 'user,id=net1')
> 
> you need to add
> 
>          self.require_netdev('user')
> 
Will add.

Jamin
> 
> 
> Thanks,
> 
> C.
> 
> 
> 
> >           self.do_test_arm_aspeed_sdk_start(
> >               self.scratch_file("ast2600-default", "image-bmc"))
> >
> > @@ -135,6 +154,7 @@ def test_arm_ast2600_evb_sdk(self):
> >           year = time.strftime("%Y")
> >           exec_command_and_wait_for_pattern(self,
> >                '/sbin/hwclock -f /dev/rtc1', year)
> > +        self.do_ast2600_pcie_test()
> >
> >       def test_arm_ast2600_otp_blockdev_device(self):
> >           self.vm.set_machine("ast2600-evb")