tests/acceptance: enhance s390x devices test
cover tests/acceptance: enhance s390x devices test
This series builds upon the new s390x acceptance test currently queued on my s390-next branch.
Sadly, the kernel/initrd I'm using does not have the virtio-net driver, so I cannot test things like mac address specification etc. Instead, I added some quick checks regarding legacy virtio and propagation of device type and fid properties.
Next up: maybe some device plug/unplug tests; but I still need to find some inspiration there.
[And yes, I know that checkpatch moans about long lines -- hard to avoid if you use a function with a very long name.]
Cornelia Huck (3):
tests/acceptance: test virtio-ccw revision handling tests/acceptance: verify s390x device detection tests/acceptance: test s390x zpci fid propagation
tests/acceptance/machine_s390_ccw_virtio.py | 41 ++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-)
base-commit: 875a99a0354211276b6daf635427b3c52a025790
Signature · 1 line
2.26.2
PATCH 1/3 tests/acceptance: test virtio-ccw revision handling
The max_revision prop of virtio-ccw devices can be used to force an older revision for compatibility handling. The easiest way to check this is to force a device to revision 0, which turns off virtio-1.
--- tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +16 -2
@@ -51,6 +51,10 @@ class S390CCWVirtioMachine(Test): '-initrd', initrd_path, '-append', kernel_command_line, '-device', 'virtio-net-ccw,devno=fe.1.1111', + '-device', + 'virtio-rng-ccw,devno=fe.2.0000,max_revision=0', + '-device', + 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', '-device', 'virtio-net-pci,id=zzz') self.vm.launch()
@@ -60,9 +64,19 @@ class S390CCWVirtioMachine(Test): # first debug shell is too early, we need to wait for device detection exec_command_and_wait_for_pattern(self, 'exit', shell_ready) - ccw_bus_id="0.1.1111" + ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234" pci_bus_id="0005:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', - ccw_bus_id) + ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', pci_bus_id) + # check that the device at 0.2.0000 is in legacy mode, while the + # device at 0.3.1234 has the virtio-1 feature bit set + virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000" + virtio_rng_features_legacy="0000000000000000000000000000110000000000000000000000000000000000" + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.2.0000/virtio?/features', + virtio_rng_features_legacy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', + virtio_rng_features)
Signature · 1 line
2.26.2
Re: [PATCH 1/3] tests/acceptance: test virtio-ccw revision handling
Quoted 9 lines · Cornelia Huck
The
max_revisionprop of virtio-ccw devices can be used to force an older revision for compatibility handling. The easiest way to check this is to force a device to revision 0, which turns off virtio-1.Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
Re: [PATCH 1/3] tests/acceptance: test virtio-ccw revision handling
In reply to Cornelia HuckHi,
Quoted 31 lines · Cornelia Huck
The
max_revisionprop of virtio-ccw devices can be used to force an older revision for compatibility handling. The easiest way to check this is to force a device to revision 0, which turns off virtio-1.Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)tests/acceptance/machine_s390_ccw_virtio.py +5
-1@@ -51,6 +51,10 @@ class S390CCWVirtioMachine(Test): '-initrd', initrd_path, '-append', kernel_command_line, '-device', 'virtio-net-ccw,devno=fe.1.1111', + '-device', + 'virtio-rng-ccw,devno=fe.2.0000,max_revision=0', + '-device', + 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', '-device', 'virtio-net-pci,id=zzz') self.vm.launch()@@ -60,9 +64,19 @@ class S390CCWVirtioMachine(Test): # first debug shell is too early, we need to wait for device detection exec_command_and_wait_for_pattern(self, 'exit', shell_ready) - ccw_bus_id="0.1.1111" + ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234"
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 76
Quoted 10 lines
tests/acceptance/machine_s390_ccw_virtio.py +5
-1pci_bus_id="0005:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', - ccw_bus_id) + ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', pci_bus_id) + # check that the device at 0.2.0000 is in legacy mode, while the + # device at 0.3.1234 has the virtio-1 feature bit set + virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000" + virtio_rng_features_legacy="0000000000000000000000000000110000000000000000000000000000000000"
Do something like...
virtio_rng_features="0000000000000000000000000000" + \
"110010000000000000000000000000000000"
... and checkpatch should not complain.
Quoted 6 lines
tests/acceptance/machine_s390_ccw_virtio.py +6
-0+ exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.2.0000/virtio?/features', + virtio_rng_features_legacy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', + virtio_rng_features)
Re: [PATCH 1/3] tests/acceptance: test virtio-ccw revision handling
Quoted 47 lines · On Fri, 4 Dec 2020 10:36:33 -0300 Wainer dos Santos Moschetta…
Hi,
Quoted 31 lines · Cornelia Huck
The
max_revisionprop of virtio-ccw devices can be used to force an older revision for compatibility handling. The easiest way to check this is to force a device to revision 0, which turns off virtio-1.Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)tests/acceptance/machine_s390_ccw_virtio.py +5
-1@@ -51,6 +51,10 @@ class S390CCWVirtioMachine(Test): '-initrd', initrd_path, '-append', kernel_command_line, '-device', 'virtio-net-ccw,devno=fe.1.1111', + '-device', + 'virtio-rng-ccw,devno=fe.2.0000,max_revision=0', + '-device', + 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', '-device', 'virtio-net-pci,id=zzz') self.vm.launch()@@ -60,9 +64,19 @@ class S390CCWVirtioMachine(Test): # first debug shell is too early, we need to wait for device detection exec_command_and_wait_for_pattern(self, 'exit', shell_ready) - ccw_bus_id="0.1.1111" + ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234"tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 76
Quoted 10 lines
tests/acceptance/machine_s390_ccw_virtio.py +5
-1pci_bus_id="0005:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', - ccw_bus_id) + ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', pci_bus_id) + # check that the device at 0.2.0000 is in legacy mode, while the + # device at 0.3.1234 has the virtio-1 feature bit set + virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000" + virtio_rng_features_legacy="0000000000000000000000000000110000000000000000000000000000000000"Do something like...
Quoted 4 lines
virtio_rng_features="0000000000000000000000000000" + \
"110010000000000000000000000000000000"... and checkpatch should not complain.
Yes, I can tweak it like that before queuing.
Quoted 3 lines
Reviewed-by Wainer dos Santos Moschetta <[email protected]>
Thanks!
Quoted 8 lines
Quoted 8 lines
tests/acceptance/machine_s390_ccw_virtio.py +6
-0+ exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.2.0000/virtio?/features', + virtio_rng_features_legacy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', + virtio_rng_features)
PATCH 2/3 tests/acceptance: verify s390x device detection
In reply to Cornelia HuckThe kernel/initrd combination does not provide the virtio-net driver; therefore, simply check whether the presented device type is indeed virtio-net for the two virtio-net-{ccw,pci} devices.
--- tests/acceptance/machine_s390_ccw_virtio.py | 11 +++++++++++ 1 file changed, 11 insertions(+)
tests/acceptance/machine_s390_ccw_virtio.py +11 -0
@@ -80,3 +80,14 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', virtio_rng_features) + # verify that we indeed have virtio-net devices (without having the + # virtio-net driver handy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.1.1111/cutype', + '3832/01') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor', + '0x1af4') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', + '0x0001')
Signature · 1 line
2.26.2
Re: [PATCH 2/3] tests/acceptance: verify s390x device detection
Quoted 18 lines · Cornelia Huck
The kernel/initrd combination does not provide the virtio-net driver; therefore, simply check whether the presented device type is indeed virtio-net for the two virtio-net-{ccw,pci} devices.
Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 11 +++++++++++ 1 file changed, 11 insertions(+)tests/acceptance/machine_s390_ccw_virtio.py +1
-0@@ -80,3 +80,14 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', virtio_rng_features) + # verify that we indeed have virtio-net devices (without having the
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 93
Quoted 10 lines
tests/acceptance/machine_s390_ccw_virtio.py +10
-0+ # virtio-net driver handy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.1.1111/cutype', + '3832/01') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor', + '0x1af4') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', + '0x0001')
Re: [PATCH 2/3] tests/acceptance: verify s390x device detection
In reply to Cornelia HuckQuoted 18 lines · Cornelia Huck
The kernel/initrd combination does not provide the virtio-net driver; therefore, simply check whether the presented device type is indeed virtio-net for the two virtio-net-{ccw,pci} devices.
Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 11 +++++++++++ 1 file changed, 11 insertions(+)tests/acceptance/machine_s390_ccw_virtio.py +1
-0@@ -80,3 +80,14 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', virtio_rng_features) + # verify that we indeed have virtio-net devices (without having the
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 93
Quoted 10 lines
tests/acceptance/machine_s390_ccw_virtio.py +10
-0+ # virtio-net driver handy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.1.1111/cutype', + '3832/01') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor', + '0x1af4') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', + '0x0001')
Here I think it's ok to do...
exec_command_and_wait_for_pattern(self, 'cat /sys/bus/ccw/devices/0.1.1111/cutype', '3832/01')
... so checkpatch is happy, everybody is happy.
Re: [PATCH 2/3] tests/acceptance: verify s390x device detection
Quoted 32 lines · On Fri, 4 Dec 2020 10:47:34 -0300 Wainer dos Santos Moschetta…
Quoted 18 lines · Cornelia Huck
The kernel/initrd combination does not provide the virtio-net driver; therefore, simply check whether the presented device type is indeed virtio-net for the two virtio-net-{ccw,pci} devices.
Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 11 +++++++++++ 1 file changed, 11 insertions(+)tests/acceptance/machine_s390_ccw_virtio.py +1
-0@@ -80,3 +80,14 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features', virtio_rng_features) + # verify that we indeed have virtio-net devices (without having thetests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 93
Quoted 10 lines
tests/acceptance/machine_s390_ccw_virtio.py +10
-0+ # virtio-net driver handy) + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/ccw/devices/0.1.1111/cutype', + '3832/01') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor', + '0x1af4') + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', + '0x0001')Here I think it's ok to do...
Quoted 7 lines
exec_command_and_wait_for_pattern(self,
'cat/sys/bus/ccw/devices/0.1.1111/cutype', '3832/01')... so checkpatch is happy, everybody is happy.
Reviewed-by Wainer dos Santos Moschetta <[email protected]>
Ok, I'll try to raise the general happiness level, then :) Thanks!
PATCH 3/3 tests/acceptance: test s390x zpci fid propagation
In reply to Cornelia HuckVerify that a fid specified on the command line shows up correctly as the function_id in the guest.
--- tests/acceptance/machine_s390_ccw_virtio.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +9 -3
@@ -56,7 +56,9 @@ class S390CCWVirtioMachine(Test): '-device', 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', - '-device', 'virtio-net-pci,id=zzz') + '-device', 'virtio-net-pci,id=zzz', + '-device', 'zpci,uid=0xa,fid=12,target=serial', + '-device', 'virtio-serial-pci,id=serial') self.vm.launch() shell_ready = "sh: can't access tty; job control turned off"
@@ -65,11 +67,11 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'exit', shell_ready) ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234" - pci_bus_id="0005:00:00.0" + pci_bus_ids="0005:00:00.0 000a:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', - pci_bus_id) + pci_bus_ids) # check that the device at 0.2.0000 is in legacy mode, while the # device at 0.3.1234 has the virtio-1 feature bit set virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000"
@@ -91,3 +93,7 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', '0x0001') + # check fid propagation + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id', + '0x0000000c')
Signature · 1 line
2.26.2
Re: [PATCH 3/3] tests/acceptance: test s390x zpci fid propagation
Quoted 39 lines · Cornelia Huck
Verify that a fid specified on the command line shows up correctly as the
function_idin the guest.Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)tests/acceptance/machine_s390_ccw_virtio.py +5
-3@@ -56,7 +56,9 @@ class S390CCWVirtioMachine(Test): '-device', 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', - '-device', 'virtio-net-pci,id=zzz') + '-device', 'virtio-net-pci,id=zzz', + '-device', 'zpci,uid=0xa,fid=12,target=serial', + '-device', 'virtio-serial-pci,id=serial') self.vm.launch() shell_ready = "sh: can't access tty; job control turned off"@@ -65,11 +67,11 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'exit', shell_ready) ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234" - pci_bus_id="0005:00:00.0" + pci_bus_ids="0005:00:00.0 000a:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', - pci_bus_id) + pci_bus_ids) # check that the device at 0.2.0000 is in legacy mode, while the # device at 0.3.1234 has the virtio-1 feature bit set virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000"
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 99
Quoted 7 lines
tests/acceptance/machine_s390_ccw_virtio.py +4
-0@@ -91,3 +93,7 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', '0x0001') + # check fid propagation + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id', + '0x0000000c')
Re: [PATCH 3/3] tests/acceptance: test s390x zpci fid propagation
In reply to Cornelia HuckQuoted 7 lines · Cornelia Huck
Verify that a fid specified on the command line shows up correctly as the
function_idin the guest.Signed-off-by Cornelia Huck <[email protected]>--- tests/acceptance/machine_s390_ccw_virtio.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
Quoted 38 lines
tests/acceptance/machine_s390_ccw_virtio.py +9
-3@@ -56,7 +56,9 @@ class S390CCWVirtioMachine(Test): '-device', 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2', '-device', 'zpci,uid=5,target=zzz', - '-device', 'virtio-net-pci,id=zzz') + '-device', 'virtio-net-pci,id=zzz', + '-device', 'zpci,uid=0xa,fid=12,target=serial', + '-device', 'virtio-serial-pci,id=serial') self.vm.launch() shell_ready = "sh: can't access tty; job control turned off"@@ -65,11 +67,11 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'exit', shell_ready) ccw_bus_ids="0.1.1111 0.2.0000 0.3.1234" - pci_bus_id="0005:00:00.0" + pci_bus_ids="0005:00:00.0 000a:00:00.0" exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', ccw_bus_ids) exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', - pci_bus_id) + pci_bus_ids) # check that the device at 0.2.0000 is in legacy mode, while the # device at 0.3.1234 has the virtio-1 feature bit set virtio_rng_features="0000000000000000000000000000110010000000000000000000000000000000"@@ -91,3 +93,7 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device', '0x0001') + # check fid propagation + exec_command_and_wait_for_pattern(self, + 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id', + '0x0000000c')
Cornelia Huck
AppliedQuoted 19 lines · On Mon, 30 Nov 2020 19:02:13 +0100 Cornelia Huck <[email protected]> wrote:
This series builds upon the new s390x acceptance test currently queued on my s390-next branch.
Sadly, the kernel/initrd I'm using does not have the virtio-net driver, so I cannot test things like mac address specification etc. Instead, I added some quick checks regarding legacy virtio and propagation of device type and fid properties.
Next up: maybe some device plug/unplug tests; but I still need to find some inspiration there.
[And yes, I know that checkpatch moans about long lines -- hard to avoid if you use a function with a very long name.]
Cornelia Huck (3):
tests/acceptance: test virtio-ccw revision handling tests/acceptance: verify s390x device detection tests/acceptance: test s390x zpci fid propagation
Quoted 5 lines
tests/acceptance/machine_s390_ccw_virtio.py | 41 ++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-)base-commit:
875a99a0354211276b6daf635427b3c52a025790
Queued to s390-next (with some overlong lines fixed up.)