Skip to contentSkip to conversation

tests/acceptance: Allow overwrite smp and memory

PATCH In review Ahmed Abouzied 5 participants 6 messages Aug 2, 2021 – Apr 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/acceptance: Allow overwrite smp and memory

Removes the hard-coded values in setUp(). Class inheriting from avocado_qemu.LinuxTest can overwrite the default smp and memory instead.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/453

---
 tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/acceptance/avocado_qemu/__init__.py +4 -2
index 2c4fef3e14..2639b89c84 100644
@@ -441,6 +441,8 @@ class LinuxTest(Test, LinuxSSHMixIn):
     distro = None
     username = 'root'
     password = 'password'
+    smp = '2'
+    memory = '1024'
 
     def _set_distro(self):
         distro_name = self.params.get(
@@ -471,8 +473,8 @@ def _set_distro(self):
     def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
         super(LinuxTest, self).setUp()
         self._set_distro()
-        self.vm.add_args('-smp', '2')
-        self.vm.add_args('-m', '1024')
+        self.vm.add_args('-smp', self.smp)
+        self.vm.add_args('-m', self.memory)
         # The following network device allows for SSH connections
         self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
                          '-device', '%s,netdev=vnet' % network_device_type)
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Ahmed Abouzied

Removes the hard-coded values in setUp(). Class inheriting from avocado_qemu.LinuxTest can overwrite the default smp and memory instead.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/453

---
 tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/acceptance/avocado_qemu/__init__.py +2 -0
index 2c4fef3e14..2639b89c84 100644
@@ -441,6 +441,8 @@ class LinuxTest(Test, LinuxSSHMixIn):
     distro = None
     username = 'root'
     password = 'password'
+    smp = '2'
+    memory = '1024'
 
     def _set_distro(self):
         distro_name = self.params.get(

tests/acceptance/avocado_qemu/__init__.py def _set_distro(self): · line 474

Quoted 4 lines
tests/acceptance/avocado_qemu/__init__.py +0 -1
@@ -471,8 +473,8 @@ def _set_distro(self):
     def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
         super(LinuxTest, self).setUp()
         self._set_distro()
-        self.vm.add_args('-smp', '2')

I don't understand why we use 2 as default value, but this is unrelated to this patch, so:

Quoted 7 lines
tests/acceptance/avocado_qemu/__init__.py +2 -1
-        self.vm.add_args('-m', '1024')
+        self.vm.add_args('-smp', self.smp)
+        self.vm.add_args('-m', self.memory)
         # The following network device allows for SSH connections
         self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
                          '-device', '%s,netdev=vnet' % network_device_type)
#2 lore raw

Subject: "Allow overwrite default smp and memsize command line options"?

Quoted 41 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Ahmed Abouzied

Removes the hard-coded values in setUp(). Class inheriting from avocado_qemu.LinuxTest can overwrite the default smp and memory instead.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/453

---
 tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/acceptance/avocado_qemu/__init__.py +2 -0
index 2c4fef3e14..2639b89c84 100644
@@ -441,6 +441,8 @@ class LinuxTest(Test, LinuxSSHMixIn):
     distro = None
     username = 'root'
     password = 'password'
+    smp = '2'
+    memory = '1024'
 
     def _set_distro(self):
         distro_name = self.params.get(

tests/acceptance/avocado_qemu/__init__.py def _set_distro(self): · line 474

Quoted 4 lines
tests/acceptance/avocado_qemu/__init__.py +0 -1
@@ -471,8 +473,8 @@ def _set_distro(self):
     def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
         super(LinuxTest, self).setUp()
         self._set_distro()
-        self.vm.add_args('-smp', '2')

I don't understand why we use 2 as default value, but this is unrelated to this patch, so:

Quoted 7 lines
tests/acceptance/avocado_qemu/__init__.py +2 -1
-        self.vm.add_args('-m', '1024')
+        self.vm.add_args('-smp', self.smp)
+        self.vm.add_args('-m', self.memory)
         # The following network device allows for SSH connections
         self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
                          '-device', '%s,netdev=vnet' % network_device_type)
#3 lore raw
In reply to Ahmed Abouzied

ping

Just pinging about this little patch. Patchew link here:
https://patchew.org/QEMU/[email protected]/.

Best regards,
Ahmed Abouzied

Quoted 40 lines · Ahmed Abouzied

Removes the hard-coded values in setUp(). Class inheriting from avocado_qemu.LinuxTest can overwrite the default smp and memory instead.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/453

---
 tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/acceptance/avocado_qemu/__init__.py +4 -3
index 2c4fef3e14..2639b89c84 100644
@@ -441,6 +441,8 @@ class LinuxTest(Test, LinuxSSHMixIn):
     distro = None
     username = 'root'
     password = 'password'
+    smp = '2'
+    memory = '1024'
 
     def _set_distro(self):
         distro_name = self.params.get(
@@ -471,8 +473,8 @@ def _set_distro(self):
     def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
         super(LinuxTest, self).setUp()
         self._set_distro()
-        self.vm.add_args('-smp', '2')
-        self.vm.add_args('-m', '1024')
+        self.vm.add_args('-smp', self.smp)
+        self.vm.add_args('-m', self.memory)
         # The following network device allows for SSH connections
         self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0
-:22',
                          '-device', '%s,netdev=vnet' %

network_device_type)
--
2.25.1

#4 lore raw
Quoted 3 lines · Ahmed Abouzied

ping

Just pinging about this little patch. Patchew link here: https://patchew.org/QEMU/[email protected]/

Sorry, seems like this completely fell through the cracks ... since nobody else picked this up yet, I've now put it into my current pull request, so that the issue should finally get resolved now.

Thomas

Quoted 43 lines · On Tue, Aug 3, 2021 at 12:24 AM Ahmed Abouzied <[email protected]…
    Removes the hard-coded values in setUp(). Class inheriting from
    avocado_qemu.LinuxTest can overwrite the default smp and memory instead.

    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/453
    <https://gitlab.com/qemu-project/qemu/-/issues/453>
    Signed-off-by: Ahmed Abouzied <[email protected]
    <mailto:[email protected]>>
    ---
      tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
      1 file changed, 4 insertions(+), 2 deletions(-)

    diff --git a/tests/acceptance/avocado_qemu/__init__.py
    b/tests/acceptance/avocado_qemu/__init__.py
    index 2c4fef3e14..2639b89c84 100644
    --- a/tests/acceptance/avocado_qemu/__init__.py
    +++ b/tests/acceptance/avocado_qemu/__init__.py
    @@ -441,6 +441,8 @@ class LinuxTest(Test, LinuxSSHMixIn):
          distro = None
          username = 'root'
          password = 'password'
    +    smp = '2'
    +    memory = '1024'

          def _set_distro(self):
              distro_name = self.params.get(
    @@ -471,8 +473,8 @@ def _set_distro(self):
          def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
              super(LinuxTest, self).setUp()
              self._set_distro()
    -        self.vm.add_args('-smp', '2')
    -        self.vm.add_args('-m', '1024')
    +        self.vm.add_args('-smp', self.smp)
    +        self.vm.add_args('-m', self.memory)
              # The following network device allows for SSH connections
              self.vm.add_args('-netdev',
    'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
                               '-device', '%s,netdev=vnet' %
    network_device_type)
    -- 
    2.25.1
Reviewed-by on v1 1/1
#5 lore raw
In reply to Ahmed Abouzied

Hi Ahmed,

Sorry for taking longer to reply you as I just returned from vacation.

Quoted 4 lines · Ahmed Abouzied

Removes the hard-coded values in setUp(). Class inheriting from avocado_qemu.LinuxTest can overwrite the default smp and memory instead.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/453

Thanks for working on that issue!

Quoted 4 lines
---
  tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

I would change the patch's subject as suggested by Philippe in another email. Apart from that, the change looks good to me. So:

Quoted 25 lines
tests/acceptance/avocado_qemu/__init__.py +4 -2
index 2c4fef3e14..2639b89c84 100644
@@ -441,6 +441,8 @@ class LinuxTest(Test, LinuxSSHMixIn):
      distro = None
      username = 'root'
      password = 'password'
+    smp = '2'
+    memory = '1024'
 
      def _set_distro(self):
          distro_name = self.params.get(
@@ -471,8 +473,8 @@ def _set_distro(self):
      def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
          super(LinuxTest, self).setUp()
          self._set_distro()
-        self.vm.add_args('-smp', '2')
-        self.vm.add_args('-m', '1024')
+        self.vm.add_args('-smp', self.smp)
+        self.vm.add_args('-m', self.memory)
          # The following network device allows for SSH connections
          self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
                           '-device', '%s,netdev=vnet' % network_device_type)