* [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon on s390x
@ 2020-12-15 18:36 Thomas Huth
2020-12-15 18:36 ` [PATCH v2 1/3] tests/acceptance: Extract the code to clear dmesg and wait for CRW reports Thomas Huth
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-15 18:36 UTC (permalink / raw)
To: qemu-devel, Cornelia Huck
Cc: qemu-s390x, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Cleber Rosa
Add two more simple tests to check that virtio-rng and virtio-balloon
are at least (very) basically working on s390x.
Based-on: 20201204121450.120730-1-cohuck@redhat.com
v2:
- Cosmetic changes according to Cornelia's suggestions
- Added Reviewed-bys from Wainer and Willian
Thomas Huth (3):
tests/acceptance: Extract the code to clear dmesg and wait for CRW
reports
tests/acceptance: Test virtio-rng on s390 via /dev/hwrng
tests/acceptance: Test the virtio-balloon device on s390x
tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------
1 file changed, 43 insertions(+), 16 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] tests/acceptance: Extract the code to clear dmesg and wait for CRW reports
2020-12-15 18:36 [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon on s390x Thomas Huth
@ 2020-12-15 18:36 ` Thomas Huth
2020-12-15 18:36 ` [PATCH v2 2/3] tests/acceptance: Test virtio-rng on s390 via /dev/hwrng Thomas Huth
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-15 18:36 UTC (permalink / raw)
To: qemu-devel, Cornelia Huck
Cc: qemu-s390x, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Cleber Rosa
We will use this in more spots soon, so it's easier to put this into
a separate function.
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Tested-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/acceptance/machine_s390_ccw_virtio.py | 30 ++++++++++++---------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py
index 864ef4ee6e..3d146b9ce6 100644
--- a/tests/acceptance/machine_s390_ccw_virtio.py
+++ b/tests/acceptance/machine_s390_ccw_virtio.py
@@ -17,12 +17,24 @@ from avocado_qemu import wait_for_console_pattern
class S390CCWVirtioMachine(Test):
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+ timeout = 120
+
def wait_for_console_pattern(self, success_message, vm=None):
wait_for_console_pattern(self, success_message,
failure_message='Kernel panic - not syncing',
vm=vm)
- timeout = 120
+ def wait_for_crw_reports(self):
+ exec_command_and_wait_for_pattern(self,
+ 'while ! (dmesg -c | grep CRW) ; do sleep 1 ; done',
+ 'CRW reports')
+
+ dmesg_clear_count = 1
+ def clear_guest_dmesg(self):
+ exec_command_and_wait_for_pattern(self, 'dmesg -c > /dev/null; '
+ 'echo dm_clear\ ' + str(self.dmesg_clear_count),
+ 'dm_clear ' + str(self.dmesg_clear_count))
+ self.dmesg_clear_count += 1
def test_s390x_devices(self):
@@ -100,26 +112,18 @@ class S390CCWVirtioMachine(Test):
'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id',
'0x0000000c')
# add another device
- exec_command_and_wait_for_pattern(self,
- 'dmesg -c > /dev/null; echo dm_clear\ 1',
- 'dm_clear 1')
+ self.clear_guest_dmesg()
self.vm.command('device_add', driver='virtio-net-ccw',
devno='fe.0.4711', id='net_4711')
- exec_command_and_wait_for_pattern(self,
- 'while ! (dmesg -c | grep CRW) ; do sleep 1 ; done',
- 'CRW reports')
+ self.wait_for_crw_reports()
exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/',
'0.0.4711')
# and detach it again
- exec_command_and_wait_for_pattern(self,
- 'dmesg -c > /dev/null; echo dm_clear\ 2',
- 'dm_clear 2')
+ self.clear_guest_dmesg()
self.vm.command('device_del', id='net_4711')
self.vm.event_wait(name='DEVICE_DELETED',
match={'data': {'device': 'net_4711'}})
- exec_command_and_wait_for_pattern(self,
- 'while ! (dmesg -c | grep CRW) ; do sleep 1 ; done',
- 'CRW reports')
+ self.wait_for_crw_reports()
exec_command_and_wait_for_pattern(self,
'ls /sys/bus/ccw/devices/0.0.4711',
'No such file or directory')
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] tests/acceptance: Test virtio-rng on s390 via /dev/hwrng
2020-12-15 18:36 [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon on s390x Thomas Huth
2020-12-15 18:36 ` [PATCH v2 1/3] tests/acceptance: Extract the code to clear dmesg and wait for CRW reports Thomas Huth
@ 2020-12-15 18:36 ` Thomas Huth
2020-12-15 18:36 ` [PATCH v2 3/3] tests/acceptance: Test the virtio-balloon device on s390x Thomas Huth
2020-12-17 17:51 ` [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon " Cornelia Huck
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-15 18:36 UTC (permalink / raw)
To: qemu-devel, Cornelia Huck
Cc: qemu-s390x, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Cleber Rosa
/dev/hwrng is only functional if virtio-rng is working right, so let's
add a sanity check for this device node.
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Tested-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/acceptance/machine_s390_ccw_virtio.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py
index 3d146b9ce6..e1ad0e29b0 100644
--- a/tests/acceptance/machine_s390_ccw_virtio.py
+++ b/tests/acceptance/machine_s390_ccw_virtio.py
@@ -64,9 +64,9 @@ class S390CCWVirtioMachine(Test):
'-append', kernel_command_line,
'-device', 'virtio-net-ccw,devno=fe.1.1111',
'-device',
- 'virtio-rng-ccw,devno=fe.2.0000,max_revision=0',
+ 'virtio-rng-ccw,devno=fe.2.0000,max_revision=0,id=rn1',
'-device',
- 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2',
+ 'virtio-rng-ccw,devno=fe.3.1234,max_revision=2,id=rn2',
'-device', 'zpci,uid=5,target=zzz',
'-device', 'virtio-net-pci,id=zzz',
'-device', 'zpci,uid=0xa,fid=12,target=serial',
@@ -96,6 +96,19 @@ class S390CCWVirtioMachine(Test):
exec_command_and_wait_for_pattern(self,
'cat /sys/bus/ccw/devices/0.3.1234/virtio?/features',
virtio_rng_features)
+ # check that /dev/hwrng works - and that it's gone after ejecting
+ exec_command_and_wait_for_pattern(self,
+ 'dd if=/dev/hwrng of=/dev/null bs=1k count=10',
+ '10+0 records out')
+ self.clear_guest_dmesg()
+ self.vm.command('device_del', id='rn1')
+ self.wait_for_crw_reports()
+ self.clear_guest_dmesg()
+ self.vm.command('device_del', id='rn2')
+ self.wait_for_crw_reports()
+ exec_command_and_wait_for_pattern(self,
+ 'dd if=/dev/hwrng of=/dev/null bs=1k count=10',
+ 'dd: /dev/hwrng: No such device')
# verify that we indeed have virtio-net devices (without having the
# virtio-net driver handy)
exec_command_and_wait_for_pattern(self,
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] tests/acceptance: Test the virtio-balloon device on s390x
2020-12-15 18:36 [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon on s390x Thomas Huth
2020-12-15 18:36 ` [PATCH v2 1/3] tests/acceptance: Extract the code to clear dmesg and wait for CRW reports Thomas Huth
2020-12-15 18:36 ` [PATCH v2 2/3] tests/acceptance: Test virtio-rng on s390 via /dev/hwrng Thomas Huth
@ 2020-12-15 18:36 ` Thomas Huth
2020-12-17 17:51 ` [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon " Cornelia Huck
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2020-12-15 18:36 UTC (permalink / raw)
To: qemu-devel, Cornelia Huck
Cc: qemu-s390x, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Cleber Rosa
Inflate the balloon and check whether the size of the memory changes.
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Tested-by: Willian Rampazzo <willianr@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/acceptance/machine_s390_ccw_virtio.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tests/acceptance/machine_s390_ccw_virtio.py b/tests/acceptance/machine_s390_ccw_virtio.py
index e1ad0e29b0..abe25a08f0 100644
--- a/tests/acceptance/machine_s390_ccw_virtio.py
+++ b/tests/acceptance/machine_s390_ccw_virtio.py
@@ -70,7 +70,8 @@ class S390CCWVirtioMachine(Test):
'-device', 'zpci,uid=5,target=zzz',
'-device', 'virtio-net-pci,id=zzz',
'-device', 'zpci,uid=0xa,fid=12,target=serial',
- '-device', 'virtio-serial-pci,id=serial')
+ '-device', 'virtio-serial-pci,id=serial',
+ '-device', 'virtio-balloon-ccw')
self.vm.launch()
shell_ready = "sh: can't access tty; job control turned off"
@@ -140,3 +141,12 @@ class S390CCWVirtioMachine(Test):
exec_command_and_wait_for_pattern(self,
'ls /sys/bus/ccw/devices/0.0.4711',
'No such file or directory')
+ # test the virtio-balloon device
+ exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo',
+ 'MemTotal: 115640 kB')
+ self.vm.command('human-monitor-command', command_line='balloon 96')
+ exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo',
+ 'MemTotal: 82872 kB')
+ self.vm.command('human-monitor-command', command_line='balloon 128')
+ exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo',
+ 'MemTotal: 115640 kB')
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon on s390x
2020-12-15 18:36 [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon on s390x Thomas Huth
` (2 preceding siblings ...)
2020-12-15 18:36 ` [PATCH v2 3/3] tests/acceptance: Test the virtio-balloon device on s390x Thomas Huth
@ 2020-12-17 17:51 ` Cornelia Huck
3 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2020-12-17 17:51 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-s390x, Philippe Mathieu-Daudé,
qemu-devel, Wainer dos Santos Moschetta, Cleber Rosa
On Tue, 15 Dec 2020 19:36:20 +0100
Thomas Huth <thuth@redhat.com> wrote:
> Add two more simple tests to check that virtio-rng and virtio-balloon
> are at least (very) basically working on s390x.
>
> Based-on: 20201204121450.120730-1-cohuck@redhat.com
>
> v2:
> - Cosmetic changes according to Cornelia's suggestions
> - Added Reviewed-bys from Wainer and Willian
>
> Thomas Huth (3):
> tests/acceptance: Extract the code to clear dmesg and wait for CRW
> reports
> tests/acceptance: Test virtio-rng on s390 via /dev/hwrng
> tests/acceptance: Test the virtio-balloon device on s390x
>
> tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------
> 1 file changed, 43 insertions(+), 16 deletions(-)
>
Thanks, applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-17 17:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 18:36 [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon on s390x Thomas Huth
2020-12-15 18:36 ` [PATCH v2 1/3] tests/acceptance: Extract the code to clear dmesg and wait for CRW reports Thomas Huth
2020-12-15 18:36 ` [PATCH v2 2/3] tests/acceptance: Test virtio-rng on s390 via /dev/hwrng Thomas Huth
2020-12-15 18:36 ` [PATCH v2 3/3] tests/acceptance: Test the virtio-balloon device on s390x Thomas Huth
2020-12-17 17:51 ` [PATCH v2 0/3] tests/acceptance: Test virtio-rng and -balloon " Cornelia Huck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).