Skip to contentSkip to conversation

tests/functional/ppc: skip remote interrupts test if -net user not built

PATCH Superseded Shivang Upadhyay 3 participants 10 messages Jul 24 – Jul 27 PowerPC

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/functional/ppc: skip remote interrupts test if -net user not built

While running remote interrupts test, without libslirp-devel installed, facing the following panic logs.

File

    ...
    raise VMLaunchFailure(
    ...<3 lines>...
    ) from exc
    ...
        Output: qemu-system-ppc64: -netdev user,id=net0: network backend

'user' is not compiled into this binary

Skipping the test if vm fails to launch.

---
 tests/functional/ppc64/test_powernv.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tests/functional/ppc64/test_powernv.py +7 -1
index bac2017e18..73ba4e7221 100755
@@ -11,6 +11,8 @@
 from qemu_test import wait_for_console_pattern
 from qemu_test import exec_command_and_wait_for_pattern
 
+from qemu.machine.machine import VMLaunchFailure
+
 class PowernvMachine(LinuxKernelTest):
 
     timeout = 90
@@ -112,7 +114,11 @@ def test_linux_remote_interrupts(self):
             f'file={rootfs_path},format=raw,if=none,id=drive0,readonly=on',
             '-append', 'root=/dev/nvme0n1 console=hvc0',
             '-device', 'nvme,drive=drive0,bus=pcie.2,addr=0x0,serial=1234')
-        self.vm.launch()
+        try:
+            self.vm.launch()
+        except VMLaunchFailure:
+            # Maybe not compiled with netuser backend
+            self.skipTest(f'Could not find -net user')
 
         # Wait for boot to complete
         console_pattern = 'CPU maps initialized for 1 thread per core'
Signature · 1 line
2.54.0
#1 lore raw
Quoted 35 lines · Shivang Upadhyay

While running remote interrupts test, without libslirp-devel installed, facing the following panic logs.

   File
     ...
     raise VMLaunchFailure(
     ...<3 lines>...
     ) from exc
     ...
         Output: qemu-system-ppc64: -netdev user,id=net0: network backend

'user' is not compiled into this binary

Skipping the test if vm fails to launch.

---
  tests/functional/ppc64/test_powernv.py | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
tests/functional/ppc64/test_powernv.py +2 -0
index bac2017e18..73ba4e7221 100755
@@ -11,6 +11,8 @@
  from qemu_test import wait_for_console_pattern
  from qemu_test import exec_command_and_wait_for_pattern
 
+from qemu.machine.machine import VMLaunchFailure
+
  class PowernvMachine(LinuxKernelTest):
 
      timeout = 90
@@ -112,7 +114,11 @@ def test_linux_remote_interrupts(self):
              f'file={rootfs_path},format=raw,if=none,id=drive0,readonly=on',
              '-append', 'root=/dev/nvme0n1 console=hvc0',

tests/functional/ppc64/test_powernv.py def test_linux_remote_interrupts(self): · line 124

Quoted 10 lines
tests/functional/ppc64/test_powernv.py +5 -1
              '-device', 'nvme,drive=drive0,bus=pcie.2,addr=0x0,serial=1234')
-        self.vm.launch()
+        try:
+            self.vm.launch()
+        except VMLaunchFailure:
+            # Maybe not compiled with netuser backend
+            self.skipTest(f'Could not find -net user')
 
          # Wait for boot to complete
          console_pattern = 'CPU maps initialized for 1 thread per core'

Please use self.require_netdev('user') instead, like it is already done in other tests.

Thanks,
Thomas

#2 lore raw
Quoted 10 lines · Thomas Huth
Quoted 3 lines

           # Wait for boot to complete
           console_pattern = 'CPU maps initialized for 1 thread per core'

Please use self.require_netdev('user') instead, like it is already done in
other tests.

  Thanks,
    Thomas

Thanks Thomas, I didn't see this case. I saw some other tests using VMLaunchFailure this way, so went ahead like this. I'll send a revision.

~Shivang.

#3 lore raw
In reply to Shivang Upadhyay

Hi Shivang,

Thanks for the patch. Please find my comments below:

Quoted 33 lines · Shivang Upadhyay

While running remote interrupts test, without libslirp-devel installed, facing the following panic logs.

File

    ...
    raise VMLaunchFailure(
    ...<3 lines>...
    ) from exc
    ...
        Output: qemu-system-ppc64: -netdev user,id=net0: network backend

'user' is not compiled into this binary

Skipping the test if vm fails to launch.

---
 tests/functional/ppc64/test_powernv.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tests/functional/ppc64/test_powernv.py +2 -0
index bac2017e18..73ba4e7221 100755
@@ -11,6 +11,8 @@
 from qemu_test import wait_for_console_pattern
 from qemu_test import exec_command_and_wait_for_pattern
 
+from qemu.machine.machine import VMLaunchFailure
+
 class PowernvMachine(LinuxKernelTest):
 
     timeout = 90

tests/functional/ppc64/test_powernv.py def test_linux_remote_interrupts(self): · line 121

Quoted 9 lines
tests/functional/ppc64/test_powernv.py +5 -1
@@ -112,7 +114,11 @@ def test_linux_remote_interrupts(self):
             f'file={rootfs_path},format=raw,if=none,id=drive0,readonly=on',
             '-append', 'root=/dev/nvme0n1 console=hvc0',
             '-device', 'nvme,drive=drive0,bus=pcie.2,addr=0x0,serial=1234')
-        self.vm.launch()
+        try:
+            self.vm.launch()
+        except VMLaunchFailure:
+            # Maybe not compiled with netuser backend
+            self.skipTest(f'Could not find -net user')

I think VMLaunchFailure would be raised for any VM launch failure — not just a missing netdev backend. This bare catch will silently skip the test even when the VM fails for completely unrelated reasons which may mask real regressions.

The framework already has require_netdev() which probes the binary before launching the VM using qemu-system-ppc64 -M none -netdev help. Catching a post-launch failure to work around a pre-launch condition is the wrong layering entirely.

Below change should be enough to achieve what you are trying.

tests/functional/ppc64/test_powernv.py +1 -0
index bac2017e18df..f3e05e4d3810 100755
@@ -90,6 +90,7 @@ def test_linux_smt_boot(self):
 
     def test_linux_remote_interrupts(self):
         self.require_accelerator("tcg")
+        self.require_netdev('user')
         self.set_machine('powernv')
 
         # Have below setup in this test:

Thanks,
Amit

Quoted 7 lines
tests/functional/ppc64/test_powernv.py +0 -0
         # Wait for boot to complete
         console_pattern = 'CPU maps initialized for 1 thread per core'
Signature · 1 line
2.54.0
#4 lore raw
Quoted 9 lines · Amit Machhiwal

Below change should be enough to achieve what you are trying.

tests/functional/ppc64/test_powernv.py +0 -0
index bac2017e18df..f3e05e4d3810 100755
@@ -90,6 +90,7 @@ def test_linux_smt_boot(self):
Quoted 6 lines


     def test_linux_remote_interrupts(self):
         self.require_accelerator("tcg")
+        self.require_netdev('user')
         self.set_machine('powernv')

Hi Amit,
Thanks for proper fix, I wanted something like this. I'll try this and
send a revision.

~Shivang.

#5 lore raw

PATCH v2 1/1 tests/functional/ppc: skip remote interrupts test if -net user not built

In reply to Shivang Upadhyay

While running remote interrupts test, without libslirp-devel installed, facing the following panic logs.

File

    ...
    raise VMLaunchFailure(
    ...<3 lines>...
    ) from exc
    ...
        Output: qemu-system-ppc64: -netdev user,id=net0: network backend

'user' is not compiled into this binary

Adding netdev user requirement for this test.

---
 tests/functional/ppc64/test_powernv.py | 1 +
 1 file changed, 1 insertion(+)
tests/functional/ppc64/test_powernv.py +1 -0
index bac2017e18..9a95b6011d 100755
@@ -91,6 +91,7 @@ def test_linux_smt_boot(self):
     def test_linux_remote_interrupts(self):
         self.require_accelerator("tcg")
         self.set_machine('powernv')
+        self.require_netdev('user')
 
         # Have below setup in this test:
         # 1. e1000e attached to pcie.6, which is from 7th PHB, belonging to 2nd
Signature · 1 line
2.54.0
Tested-by Reviewed-by on v2 1/1
#6 lore raw

Hi Shivang,

Thanks for making the suggested changes and sending a v2. My comments are inline.

Quoted 12 lines · Shivang Upadhyay

While running remote interrupts test, without libslirp-devel installed, facing the following panic logs.

File

    ...
    raise VMLaunchFailure(
    ...<3 lines>...
    ) from exc
    ...
        Output: qemu-system-ppc64: -netdev user,id=net0: network backend

'user' is not compiled into this binary

Quoted 8 lines

Adding netdev user requirement for this test.

---
 tests/functional/ppc64/test_powernv.py | 1 +
 1 file changed, 1 insertion(+)

Tested on a system without libslirp-devel. Test is correctly skipped:

ok 1 test_powernv.PowernvMachine.test_linux_remote_interrupts # SKIP no support for user networking 1..1

tests/functional/ppc64/test_powernv.py def test_linux_smt_boot(self): · line 94

Quoted 10 lines
tests/functional/ppc64/test_powernv.py +1 -0
index bac2017e18..9a95b6011d 100755
@@ -91,6 +91,7 @@ def test_linux_smt_boot(self):
     def test_linux_remote_interrupts(self):
         self.require_accelerator("tcg")
         self.set_machine('powernv')
+        self.require_netdev('user')

One minor nit: require_netdev('user') is placed after set_machine(). Though it's not necessary, I would prefer to group all require_* guards together at the top before any setup, so it's immediately clear what preconditions the test has. Either way:

~Amit

Quoted 7 lines
tests/functional/ppc64/test_powernv.py +0 -0
         # Have below setup in this test:
         # 1. e1000e attached to pcie.6, which is from 7th PHB, belonging to 2nd
Signature · 1 line
2.54.0
#7 lore raw
Quoted 10 lines · Amit Machhiwal
Quoted 3 lines

          self.require_accelerator("tcg")
          self.set_machine('powernv')
+        self.require_netdev('user')

One minor nit: require_netdev('user') is placed after set_machine(). Though it's not necessary, I would prefer to group all require_* guards
together at the top before any setup, so it's immediately clear what preconditions the test has. Either way:

Quoted 3 lines

~Amit

Sure Amit, I'll send v3 with the suggested change, and Keep your review tag.

Thanks
~Shivang.

Reviewed-by on v2 1/1
#8 lore raw
In reply to Shivang Upadhyay
Quoted 26 lines · Shivang Upadhyay

While running remote interrupts test, without libslirp-devel installed, facing the following panic logs.

   File
     ...
     raise VMLaunchFailure(
     ...<3 lines>...
     ) from exc
     ...
         Output: qemu-system-ppc64: -netdev user,id=net0: network backend

'user' is not compiled into this binary

Adding netdev user requirement for this test.

---
  tests/functional/ppc64/test_powernv.py | 1 +
  1 file changed, 1 insertion(+)
tests/functional/ppc64/test_powernv.py +0 -0
index bac2017e18..9a95b6011d 100755

tests/functional/ppc64/test_powernv.py def test_linux_smt_boot(self): · line 97

Quoted 7 lines
tests/functional/ppc64/test_powernv.py +1 -0
@@ -91,6 +91,7 @@ def test_linux_smt_boot(self):
      def test_linux_remote_interrupts(self):
          self.require_accelerator("tcg")
          self.set_machine('powernv')
+        self.require_netdev('user')
 
          # Have below setup in this test:
          # 1. e1000e attached to pcie.6, which is from 7th PHB, belonging to 2nd
Fixes 63f5ba80921 ("tests/functional: Add remote interrupts test ...")
#9 lore raw
Quoted 9 lines · Thomas Huth
Quoted 4 lines


           # Have below setup in this test:
           # 1. e1000e attached to pcie.6, which is from 7th PHB, belonging to 2nd

Fixes 63f5ba80921 ("tests/functional: Add remote interrupts test

...")

Thanks, I'll add these tags to v3, Along with minor reordering, suggested by Amit.

~Shivang.