tests/functional/ppc: skip remote interrupts test if -net user not built
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
@@ -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
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.
Signed-off-by Shivang Upadhyay <[email protected]>--- tests/functional/ppc64/test_powernv.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)tests/functional/ppc64/test_powernv.py +2
-0@@ -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
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.
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.
Signed-off-by Shivang Upadhyay <[email protected]>--- tests/functional/ppc64/test_powernv.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)tests/functional/ppc64/test_powernv.py +2
-0@@ -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
@@ -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
Quoted 9 lines · Amit Machhiwal
Below change should be enough to achieve what you are trying.
tests/functional/ppc64/test_powernv.py +0
-0@@ -90,6 +90,7 @@ def test_linux_smt_boot(self):
Quoted 6 lines
deftest_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.
PATCH v2 1/1 tests/functional/ppc: skip remote interrupts test if -net user not built
In reply to Shivang UpadhyayWhile 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
@@ -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
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.
Suggested-by Amit Machhiwal <[email protected]>Suggested-by Thomas Huth <[email protected]>Signed-off-by Shivang Upadhyay <[email protected]>--- 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@@ -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 2ndSignature · 1 line
2.54.0
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 afterset_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
Reviewed-by Amit Machhiwal <[email protected]>~Amit
Sure Amit, I'll send v3 with the suggested change, and Keep your review tag.
Thanks
~Shivang.
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.
Suggested-by Amit Machhiwal <[email protected]>Suggested-by Thomas Huth <[email protected]>Signed-off-by Shivang Upadhyay <[email protected]>--- tests/functional/ppc64/test_powernv.py | 1 + 1 file changed, 1 insertion(+)tests/functional/ppc64/test_powernv.py +0
-0
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
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 2ndFixes 63f5ba80921 ("tests/functional: Add remote interrupts test...")
Reviewed-by Thomas Huth <[email protected]>
Thanks, I'll add these tags to v3, Along with minor reordering, suggested by Amit.
~Shivang.