Skip to contentSkip to conversation

tests/acceptance: Test virtio-rng and -balloon on s390x

PATCH Superseded Thomas Huth 4 participants 16 messages Dec 11, 2020 – Dec 15, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover tests/acceptance: Test virtio-rng and -balloon on s390x

Add two more simple tests to check that virtio-rng and virtio-balloon are at least (very) basically working on s390x.

Based-on: [email protected]

Thomas Huth (3):
tests/acceptance: Extract the code to clear dmesg and wait for CRW
reports
tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via
/dev/hwrng
tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon
device

 tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------
 1 file changed, 43 insertions(+), 16 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/3 tests/acceptance: Extract the code to clear dmesg and wait for CRW reports

We will use this in more spots soon, so it's easier to put this into a separate function.

---
 tests/acceptance/machine_s390_ccw_virtio.py | 30 ++++++++++++---------
 1 file changed, 17 insertions(+), 13 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +17 -13
index 864ef4ee6e..733a7ca24a 100644
@@ -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_guests_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_guests_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_guests_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')
Signature · 1 line
2.27.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] tests/acceptance: Extract the code to clear dmesg and wait for CRW reports

Hi,

Quoted 7 lines · Thomas Huth

We will use this in more spots soon, so it's easier to put this into a separate function.

---
  tests/acceptance/machine_s390_ccw_virtio.py | 30 ++++++++++++---------
  1 file changed, 17 insertions(+), 13 deletions(-)
Quoted 62 lines
tests/acceptance/machine_s390_ccw_virtio.py +17 -13
index 864ef4ee6e..733a7ca24a 100644
@@ -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_guests_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_guests_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_guests_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')
#3 lore raw

Re: [PATCH 1/3] tests/acceptance: Extract the code to clear dmesg and wait for CRW reports

In reply to Thomas Huth
Quoted 21 lines · On Fri, 11 Dec 2020 18:31:32 +0100 Thomas Huth <[email protected]> wrote:

We will use this in more spots soon, so it's easier to put this into a separate function.

---
 tests/acceptance/machine_s390_ccw_virtio.py | 30 ++++++++++++---------
 1 file changed, 17 insertions(+), 13 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +2 -0
index 864ef4ee6e..733a7ca24a 100644
@@ -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',

tests/acceptance/machine_s390_ccw_virtio.py from avocado_qemu import wait_for_console_pattern · line 33

Quoted 10 lines
tests/acceptance/machine_s390_ccw_virtio.py +7 -1
                                  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_guests_dmesg(self):

<nitpick> Maybe clear_guest_dmesg? </nitpick>

Quoted 7 lines
tests/acceptance/machine_s390_ccw_virtio.py +4 -0
+        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):
 
#4 lore raw

PATCH 2/3 tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via /dev/hwrng

In reply to Thomas Huth

/dev/hwrng is only functional if virtio-rng is working right, so let's add a sanity check for this device node.

---
 tests/acceptance/machine_s390_ccw_virtio.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +15 -2
index 733a7ca24a..7d0a78139b 100644
@@ -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=/tmp/out.dat bs=1k count=10',
+                        '10+0 records out')
+        self.clear_guests_dmesg()
+        self.vm.command('device_del', id='rn1')
+        self.wait_for_crw_reports()
+        self.clear_guests_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=/tmp/out.dat 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,
Signature · 1 line
2.27.0
#5 lore raw

Re: [PATCH 2/3] tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via /dev/hwrng

Hi,

Quoted 2 lines · Thomas Huth

/dev/hwrng is only functional if virtio-rng is working right, so let's add a sanity check for this device node.

Good idea.

Quoted 29 lines
---
  tests/acceptance/machine_s390_ccw_virtio.py | 17 +++++++++++++++--
  1 file changed, 15 insertions(+), 2 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +5 -2
index 733a7ca24a..7d0a78139b 100644
@@ -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=/tmp/out.dat bs=1k count=10',

tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 111

Quoted 10 lines
tests/acceptance/machine_s390_ccw_virtio.py +10 -0
+                        '10+0 records out')
+        self.clear_guests_dmesg()
+        self.vm.command('device_del', id='rn1')
+        self.wait_for_crw_reports()
+        self.clear_guests_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=/tmp/out.dat bs=1k count=10',
+                        'dd: /dev/hwrng: No such device')

Maybe the expected pattern is too fragile. On my Fedora 33 system, 'dd' will print a different message.

What if it checks for the presence of the device file, e.g:

... self, 'test -c /dev/hwrng; echo $?', '1')

- Wainer

Quoted 3 lines
tests/acceptance/machine_s390_ccw_virtio.py +0 -0
          # verify that we indeed have virtio-net devices (without having the
          # virtio-net driver handy)
          exec_command_and_wait_for_pattern(self,
#6 lore raw

Re: [PATCH 2/3] tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via /dev/hwrng

Quoted 46 lines · Wainer dos Santos Moschetta

Hi,

Quoted 2 lines · Thomas Huth

/dev/hwrng is only functional if virtio-rng is working right, so let's add a sanity check for this device node.

Good idea.

Quoted 38 lines

---
  tests/acceptance/machine_s390_ccw_virtio.py | 17 +++++++++++++++--

  1 file changed, 15 insertions(+), 2 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +2 -2
index 733a7ca24a..7d0a78139b 100644
@@ -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',

tests/acceptance/machine_s390_ccw_virtio.py +0 -0
@@ -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=/tmp/out.dat bs=1k count=10', +                        '10+0 records out')
+        self.clear_guests_dmesg()
+        self.vm.command('device_del', id='rn1')
+        self.wait_for_crw_reports()
+        self.clear_guests_dmesg()

Quoted 8 lines
Quoted 5 lines

+        self.vm.command('device_del', id='rn2')
+        self.wait_for_crw_reports()
+        exec_command_and_wait_for_pattern(self,
+                        'dd if=/dev/hwrng of=/tmp/out.dat bs=1k count=10', +                        'dd: /dev/hwrng: No such device')

Maybe the expected pattern is too fragile. On my Fedora 33 system, 'dd' will print a different message.

We are running this test with a well-defined kernel + initrd, so I don't think we have to care of other versions of dd here.

Quoted 3 lines

What if it checks for the presence of the device file, e.g:

... self, 'test -c /dev/hwrng; echo $?', '1')

That doesn't work, the /dev/hwrng is still there (so test -c succeeds), since this initrd uses static device nodes for this in /dev. /dev/hwrng just can not be opened anymore after the device has been removed.

Thomas

#7 lore raw

Re: [PATCH 2/3] tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via /dev/hwrng

On Sat, 12 Dec 2020 08:10:01 +0100
Thomas Huth <[email protected]> wrote:

Minor nit: I think that the subject is a bit unwieldy. What about

"tests/acceptance: Test virtio-rng on s390 via /dev/hwrng"

?

Quoted 43 lines · Wainer dos Santos Moschetta
Quoted 42 lines

Hi,

Quoted 2 lines · Thomas Huth

/dev/hwrng is only functional if virtio-rng is working right, so let's add a sanity check for this device node.

Good idea.

Quoted 34 lines

---
  tests/acceptance/machine_s390_ccw_virtio.py | 17 +++++++++++++++--

  1 file changed, 15 insertions(+), 2 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +2 -2
index 733a7ca24a..7d0a78139b 100644
@@ -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',

tests/acceptance/machine_s390_ccw_virtio.py +0 -0
@@ -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=/tmp/out.dat bs=1k count=10', +                        '10+0 records out')

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+        self.clear_guests_dmesg()
+        self.vm.command('device_del', id='rn1')
+        self.wait_for_crw_reports()
+        self.clear_guests_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=/tmp/out.dat bs=1k count=10',

Does this work if you direct the output to /dev/null?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

+                        'dd: /dev/hwrng: No such device')

Maybe the expected pattern is too fragile. On my Fedora 33 system, 'dd' will print a different message.

We are running this test with a well-defined kernel + initrd, so I don't think we have to care of other versions of dd here.

Quoted 7 lines
Quoted 3 lines

What if it checks for the presence of the device file, e.g:

... self, 'test -c /dev/hwrng; echo $?', '1')

That doesn't work, the /dev/hwrng is still there (so test -c succeeds), since this initrd uses static device nodes for this in /dev. /dev/hwrng just can not be opened anymore after the device has been removed.

I had been thinking about a different approach to check that, but dd really looks like the easiest way.

#8 lore raw

Re: [PATCH 2/3] tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via /dev/hwrng

In reply to Thomas Huth
Quoted 52 lines · Thomas Huth
Quoted 43 lines · Wainer dos Santos Moschetta

Hi,

Quoted 2 lines · Thomas Huth

/dev/hwrng is only functional if virtio-rng is working right, so let's add a sanity check for this device node.

Good idea.

Quoted 36 lines
---
   tests/acceptance/machine_s390_ccw_virtio.py | 17 +++++++++++++++--
   1 file changed, 15 insertions(+), 2 deletions(-)
tests/acceptance/machine_s390_ccw_virtio.py +2 -2
index 733a7ca24a..7d0a78139b 100644
@@ -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',

tests/acceptance/machine_s390_ccw_virtio.py +7 -0
@@ -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=/tmp/out.dat bs=1k count=10',
+                        '10+0 records out')
+        self.clear_guests_dmesg()
+        self.vm.command('device_del', id='rn1')
+        self.wait_for_crw_reports()
Quoted 8 lines

tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 111

Quoted 6 lines
tests/acceptance/machine_s390_ccw_virtio.py +6 -0
+        self.clear_guests_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=/tmp/out.dat bs=1k count=10',
+                        'dd: /dev/hwrng: No such device')

Maybe the expected pattern is too fragile. On my Fedora 33 system, 'dd' will print a different message.

Quoted 2 lines

We are running this test with a well-defined kernel + initrd, so I don't think we have to care of other versions of dd here.

I was thinking in the case someone change the kernel+initrd for this test. Well, in that case the same person will have to make the adjustments. So,

Quoted 9 lines
Quoted 4 lines

What if it checks for the presence of the device file, e.g:

... self, 'test -c /dev/hwrng; echo $?', '1')

That doesn't work, the /dev/hwrng is still there (so test -c succeeds), since this initrd uses static device nodes for this in /dev. /dev/hwrng just can not be opened anymore after the device has been removed.

Thomas

#9 lore raw

PATCH 3/3 tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon device

In reply to Thomas Huth

Inflate the balloon and check whether the size of the memory changes.

---
 tests/acceptance/machine_s390_ccw_virtio.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
tests/acceptance/machine_s390_ccw_virtio.py +11 -1
index 7d0a78139b..81f6c066c7 100644
@@ -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')
Signature · 1 line
2.27.0
Reviewed-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon device

Quoted 1 line · Thomas Huth

Inflate the balloon and check whether the size of the memory changes.

Yeah, because a true balloon should inflate :D

Quoted 5 lines
---
  tests/acceptance/machine_s390_ccw_virtio.py | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
Quoted 28 lines
tests/acceptance/machine_s390_ccw_virtio.py +11 -1
index 7d0a78139b..81f6c066c7 100644
@@ -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')
Reviewed-by Tested-by on the v1 series
#11 lore raw
In reply to Thomas Huth
Quoted 13 lines · Thomas Huth

Add two more simple tests to check that virtio-rng and virtio-balloon are at least (very) basically working on s390x.

Based-on: [email protected]

Thomas Huth (3):
tests/acceptance: Extract the code to clear dmesg and wait for CRW
reports
tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via
/dev/hwrng
tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon
device

Quoted 3 lines
  tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------
  1 file changed, 43 insertions(+), 16 deletions(-)

One observation, test_s390x_devices tends to get longer and difficult to debug in case of problems. If a test covers one specific device type, It will improve readability, flexibility, and debugging. In case you don't want to spend time breaking this into multiple tests, I'll be glad to do that after the whole series is merged.

As far as code concerned,

Fetching asset from tests/acceptance/machine_s390_ccw_virtio.py:S390CCWVirtioMachine.test_s390x_devices Fetching asset from tests/acceptance/machine_s390_ccw_virtio.py:S390CCWVirtioMachine.test_s390x_devices
JOB ID : 8ba8e572f2582f9a48f2542423342e51e257db97
JOB LOG : /home/linux1/src/qemu.dev/build/tests/results/job-2020-12-11T15.01-8ba8e57/job.log
(1/1)
tests/acceptance/machine_s390_ccw_virtio.py:S390CCWVirtioMachine.test_s390x_devices: PASS (7.89 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME : 8.03 s

#12 lore raw
Quoted 18 lines · Willian Rampazzo
Quoted 13 lines · Thomas Huth

Add two more simple tests to check that virtio-rng and virtio-balloon are at least (very) basically working on s390x.

Based-on: [email protected]

Thomas Huth (3):
   tests/acceptance: Extract the code to clear dmesg and wait for CRW reports
   tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via /dev/hwrng
   tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon device

Quoted 3 lines

  tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------

  1 file changed, 43 insertions(+), 16 deletions(-)
Quoted 5 lines

One observation, test_s390x_devices tends to get longer and difficult to debug in case of problems. If a test covers one specific device type, It will improve readability, flexibility, and debugging. In case you don't want to spend time breaking this into multiple tests, I'll be glad to do that after the whole series is merged.

Theoretically yes, but practically we also want to run the tests as fast as possible. Quite a bit of time is used to boot the kernel, so if we add a new test for each and every device, that would increase the test time quite a bit. Thus I'd rather prefer to keep everything in one single test instead for now.

Quoted 4 lines

As far as code concerned,

Thanks!

Thomas

#13 lore raw
Quoted 25 lines · On Sat, 12 Dec 2020 08:15:13 +0100 Thomas Huth <[email protected]> wrote:
Quoted 18 lines · Willian Rampazzo
Quoted 13 lines · Thomas Huth

Add two more simple tests to check that virtio-rng and virtio-balloon are at least (very) basically working on s390x.

Based-on: [email protected]

Thomas Huth (3):
   tests/acceptance: Extract the code to clear dmesg and wait for CRW reports
   tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via /dev/hwrng
   tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon device

Quoted 3 lines

  tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------

  1 file changed, 43 insertions(+), 16 deletions(-)
Quoted 5 lines

One observation, test_s390x_devices tends to get longer and difficult to debug in case of problems. If a test covers one specific device type, It will improve readability, flexibility, and debugging. In case you don't want to spend time breaking this into multiple tests, I'll be glad to do that after the whole series is merged.

Quoted 5 lines

Theoretically yes, but practically we also want to run the tests as fast as possible. Quite a bit of time is used to boot the kernel, so if we add a new test for each and every device, that would increase the test time quite a bit. Thus I'd rather prefer to keep everything in one single test instead for now.

I agree.

Is there any other way to make this more debuggable?

#14 lore raw
Quoted 35 lines · Cornelia Huck
Quoted 25 lines · On Sat, 12 Dec 2020 08:15:13 +0100 Thomas Huth <[email protected]> wrote:
Quoted 18 lines · Willian Rampazzo
Quoted 13 lines · Thomas Huth

Add two more simple tests to check that virtio-rng and virtio-balloon are at least (very) basically working on s390x.

Based-on: [email protected]

Thomas Huth (3):
tests/acceptance: Extract the code to clear dmesg and wait for CRW
reports
tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via
/dev/hwrng
tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon
device

Quoted 3 lines
  tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------
  1 file changed, 43 insertions(+), 16 deletions(-)
Quoted 5 lines

One observation, test_s390x_devices tends to get longer and difficult to debug in case of problems. If a test covers one specific device type, It will improve readability, flexibility, and debugging. In case you don't want to spend time breaking this into multiple tests, I'll be glad to do that after the whole series is merged.

Quoted 5 lines

Theoretically yes, but practically we also want to run the tests as fast as possible. Quite a bit of time is used to boot the kernel, so if we add a new test for each and every device, that would increase the test time quite a bit. Thus I'd rather prefer to keep everything in one single test instead for now.

Quoted 3 lines

I agree.

Is there any other way to make this more debuggable?

I have some ideas in mind but I need to run some tests. I'm fine merging the current code and improving it later.

#15 lore raw
In reply to Thomas Huth
Quoted 26 lines · Thomas Huth
Quoted 18 lines · Willian Rampazzo
Quoted 13 lines · Thomas Huth

Add two more simple tests to check that virtio-rng and virtio-balloon are at least (very) basically working on s390x.

Based-on: [email protected]

Thomas Huth (3):
tests/acceptance: Extract the code to clear dmesg and wait for CRW
reports
tests/acceptance/machine_s390_ccw_virtio: Test virtio-rng via
/dev/hwrng
tests/acceptance/machine_s390_ccw_virtio: Test the virtio-balloon
device

Quoted 3 lines
  tests/acceptance/machine_s390_ccw_virtio.py | 59 +++++++++++++++------
  1 file changed, 43 insertions(+), 16 deletions(-)
Quoted 5 lines

One observation, test_s390x_devices tends to get longer and difficult to debug in case of problems. If a test covers one specific device type, It will improve readability, flexibility, and debugging. In case you don't want to spend time breaking this into multiple tests, I'll be glad to do that after the whole series is merged.

Quoted 5 lines

Theoretically yes, but practically we also want to run the tests as fast as possible. Quite a bit of time is used to boot the kernel, so if we add a new test for each and every device, that would increase the test time quite a bit. Thus I'd rather prefer to keep everything in one single test instead for now.

That is, indeed, a good point!

Quoted 10 lines
Quoted 5 lines

As far as code concerned,

Thanks!

Thomas