diff mbox series

[2/3] tests/acceptance: Let the framework handle "cpu:VALUE" tagged tests

Message ID 20210224212654.1146167-3-wainersm@redhat.com (mailing list archive)
State New, archived
Headers show
Series tests/acceptance: Handle tests with "cpu" tag | expand

Commit Message

Wainer dos Santos Moschetta Feb. 24, 2021, 9:26 p.m. UTC
The tests that are already tagged with "cpu:VALUE" don't need to add
"-cpu VALUE" to the list of arguments of the vm object because the avocado_qemu
framework is able to handle it automatically. So this adjust those tests and
ensure their cpu's VALUE are recognized by QEMU.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 tests/acceptance/boot_linux.py         |  3 ---
 tests/acceptance/machine_mips_malta.py |  7 +++----
 tests/acceptance/replay_kernel.py      |  8 +++-----
 tests/acceptance/reverse_debugging.py  |  2 +-
 tests/acceptance/tcg_plugins.py        | 15 +++++++--------
 5 files changed, 14 insertions(+), 21 deletions(-)

Comments

Cleber Rosa March 9, 2021, 7:04 p.m. UTC | #1
On Wed, Feb 24, 2021 at 06:26:53PM -0300, Wainer dos Santos Moschetta wrote:
> The tests that are already tagged with "cpu:VALUE" don't need to add
> "-cpu VALUE" to the list of arguments of the vm object because the avocado_qemu
> framework is able to handle it automatically. So this adjust those tests and
> ensure their cpu's VALUE are recognized by QEMU.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
>  tests/acceptance/boot_linux.py         |  3 ---
>  tests/acceptance/machine_mips_malta.py |  7 +++----
>  tests/acceptance/replay_kernel.py      |  8 +++-----
>  tests/acceptance/reverse_debugging.py  |  2 +-
>  tests/acceptance/tcg_plugins.py        | 15 +++++++--------
>  5 files changed, 14 insertions(+), 21 deletions(-)
> 
> diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py
> index 0d178038a0..55637d126e 100644
> --- a/tests/acceptance/boot_linux.py
> +++ b/tests/acceptance/boot_linux.py
> @@ -82,7 +82,6 @@ def test_virt_tcg(self):
>          """
>          self.require_accelerator("tcg")
>          self.vm.add_args("-accel", "tcg")
> -        self.vm.add_args("-cpu", "max")
>          self.vm.add_args("-machine", "virt,gic-version=2")
>          self.add_common_args()
>          self.launch_and_wait()
> @@ -95,7 +94,6 @@ def test_virt_kvm_gicv2(self):
>          """
>          self.require_accelerator("kvm")
>          self.vm.add_args("-accel", "kvm")
> -        self.vm.add_args("-cpu", "host")
>          self.vm.add_args("-machine", "virt,gic-version=2")
>          self.add_common_args()
>          self.launch_and_wait()
> @@ -108,7 +106,6 @@ def test_virt_kvm_gicv3(self):
>          """
>          self.require_accelerator("kvm")
>          self.vm.add_args("-accel", "kvm")
> -        self.vm.add_args("-cpu", "host")
>          self.vm.add_args("-machine", "virt,gic-version=3")
>          self.add_common_args()
>          self.launch_and_wait()
> diff --git a/tests/acceptance/machine_mips_malta.py b/tests/acceptance/machine_mips_malta.py
> index 7c9a4ee4d2..b67d8cb141 100644
> --- a/tests/acceptance/machine_mips_malta.py
> +++ b/tests/acceptance/machine_mips_malta.py
> @@ -62,7 +62,6 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
>          kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
>                                 'clocksource=GIC console=tty0 console=ttyS0')
>          self.vm.add_args('-kernel', kernel_path,
> -                         '-cpu', 'I6400',
>                           '-smp', '%u' % cpu_cores_count,
>                           '-vga', 'std',
>                           '-append', kernel_command_line)
> @@ -96,7 +95,7 @@ def test_mips_malta_i6400_framebuffer_logo_1core(self):
>          """
>          :avocado: tags=arch:mips64el
>          :avocado: tags=machine:malta
> -        :avocado: tags=cpu:i6400
> +        :avocado: tags=cpu:I6400

This is actually a fix in itself, as the CPU model is indeed case
sensitive:

  $ ./qemu-system-mips64el -cpu i6400
  qemu-system-mips64el: unable to find CPU model 'i6400'

I'd put it in a separate patch.

>          """
>          self.do_test_i6400_framebuffer_logo(1)
>  
> @@ -105,7 +104,7 @@ def test_mips_malta_i6400_framebuffer_logo_7cores(self):
>          """
>          :avocado: tags=arch:mips64el
>          :avocado: tags=machine:malta
> -        :avocado: tags=cpu:i6400
> +        :avocado: tags=cpu:I6400
>          :avocado: tags=mips:smp
>          """
>          self.do_test_i6400_framebuffer_logo(7)
> @@ -115,7 +114,7 @@ def test_mips_malta_i6400_framebuffer_logo_8cores(self):
>          """
>          :avocado: tags=arch:mips64el
>          :avocado: tags=machine:malta
> -        :avocado: tags=cpu:i6400
> +        :avocado: tags=cpu:I6400
>          :avocado: tags=mips:smp
>          """
>          self.do_test_i6400_framebuffer_logo(8)
> diff --git a/tests/acceptance/replay_kernel.py b/tests/acceptance/replay_kernel.py
> index c1cb862468..6ae18485be 100644
> --- a/tests/acceptance/replay_kernel.py
> +++ b/tests/acceptance/replay_kernel.py
> @@ -156,8 +156,7 @@ def test_aarch64_virt(self):
>                                 'console=ttyAMA0')
>          console_pattern = 'VFS: Cannot open root device'
>  
> -        self.run_rr(kernel_path, kernel_command_line, console_pattern,
> -                    args=('-cpu', 'cortex-a53'))
> +        self.run_rr(kernel_path, kernel_command_line, console_pattern)
>  
>      def test_arm_virt(self):
>          """
> @@ -303,7 +302,7 @@ def test_ppc64_e500(self):
>          tar_url = ('https://www.qemu-advent-calendar.org'
>                     '/2018/download/day19.tar.xz')
>          file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
> -        self.do_test_advcal_2018(file_path, 'uImage', ('-cpu', 'e5500'))
> +        self.do_test_advcal_2018(file_path, 'uImage')
>  
>      def test_ppc_g3beige(self):
>          """
> @@ -350,8 +349,7 @@ def test_xtensa_lx60(self):
>          tar_url = ('https://www.qemu-advent-calendar.org'
>                     '/2018/download/day02.tar.xz')
>          file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
> -        self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf',
> -                                 args=('-cpu', 'dc233c'))
> +        self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf')
>  
>  @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
>  class ReplayKernelSlow(ReplayKernelBase):
> diff --git a/tests/acceptance/reverse_debugging.py b/tests/acceptance/reverse_debugging.py
> index be01aca217..d2921e70c3 100644
> --- a/tests/acceptance/reverse_debugging.py
> +++ b/tests/acceptance/reverse_debugging.py
> @@ -207,4 +207,4 @@ def test_aarch64_virt(self):
>          kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
>  
>          self.reverse_debugging(
> -            args=('-kernel', kernel_path, '-cpu', 'cortex-a53'))
> +            args=('-kernel', kernel_path))
> diff --git a/tests/acceptance/tcg_plugins.py b/tests/acceptance/tcg_plugins.py
> index c21bf9e52a..9ca1515c3b 100644
> --- a/tests/acceptance/tcg_plugins.py
> +++ b/tests/acceptance/tcg_plugins.py
> @@ -25,7 +25,7 @@ class PluginKernelBase(LinuxKernelTest):
>      KERNEL_COMMON_COMMAND_LINE = 'printk.time=1 panic=-1 '
>  
>      def run_vm(self, kernel_path, kernel_command_line,
> -               plugin, plugin_log, console_pattern, args):
> +               plugin, plugin_log, console_pattern, args=None):
>  
>          vm = self.get_vm()
>          vm.set_console()
> @@ -68,7 +68,7 @@ def test_aarch64_virt_insn(self):
>          :avocado: tags=accel:tcg
>          :avocado: tags=arch:aarch64
>          :avocado: tags=machine:virt
> -        :avocado: tags=cpu:cortex-a57
> +        :avocado: tags=cpu:cortex-a53

Another good catch, another fix that deserve to be split out of this
patch IMO.

Also, I'd double check with Alex if it makes any difference picking
a53 or a57 for this test case.

>          """
>          kernel_path = self._grab_aarch64_kernel()
>          kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> @@ -80,8 +80,7 @@ def test_aarch64_virt_insn(self):
>  
>          self.run_vm(kernel_path, kernel_command_line,
>                      "tests/plugin/libinsn.so", plugin_log.name,
> -                    console_pattern,
> -                    args=('-cpu', 'cortex-a53'))
> +                    console_pattern)
>  
>          with plugin_log as lf, \
>               mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
> @@ -95,7 +94,7 @@ def test_aarch64_virt_insn_icount(self):
>          :avocado: tags=accel:tcg
>          :avocado: tags=arch:aarch64
>          :avocado: tags=machine:virt
> -        :avocado: tags=cpu:cortex-a57
> +        :avocado: tags=cpu:cortex-a53
>          """
>          kernel_path = self._grab_aarch64_kernel()
>          kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> @@ -108,7 +107,7 @@ def test_aarch64_virt_insn_icount(self):
>          self.run_vm(kernel_path, kernel_command_line,
>                      "tests/plugin/libinsn.so", plugin_log.name,
>                      console_pattern,
> -                    args=('-cpu', 'cortex-a53', '-icount', 'shift=1'))
> +                    args=('-icount', 'shift=1'))
>  
>          with plugin_log as lf, \
>               mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
> @@ -121,7 +120,7 @@ def test_aarch64_virt_mem_icount(self):
>          :avocado: tags=accel:tcg
>          :avocado: tags=arch:aarch64
>          :avocado: tags=machine:virt
> -        :avocado: tags=cpu:cortex-a57
> +        :avocado: tags=cpu:cortex-a53
>          """
>          kernel_path = self._grab_aarch64_kernel()
>          kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> @@ -134,7 +133,7 @@ def test_aarch64_virt_mem_icount(self):
>          self.run_vm(kernel_path, kernel_command_line,
>                      "tests/plugin/libmem.so,arg=both", plugin_log.name,
>                      console_pattern,
> -                    args=('-cpu', 'cortex-a53', '-icount', 'shift=1'))
> +                    args=('-icount', 'shift=1'))
>  
>          with plugin_log as lf, \
>               mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
> -- 
> 2.29.2
>
diff mbox series

Patch

diff --git a/tests/acceptance/boot_linux.py b/tests/acceptance/boot_linux.py
index 0d178038a0..55637d126e 100644
--- a/tests/acceptance/boot_linux.py
+++ b/tests/acceptance/boot_linux.py
@@ -82,7 +82,6 @@  def test_virt_tcg(self):
         """
         self.require_accelerator("tcg")
         self.vm.add_args("-accel", "tcg")
-        self.vm.add_args("-cpu", "max")
         self.vm.add_args("-machine", "virt,gic-version=2")
         self.add_common_args()
         self.launch_and_wait()
@@ -95,7 +94,6 @@  def test_virt_kvm_gicv2(self):
         """
         self.require_accelerator("kvm")
         self.vm.add_args("-accel", "kvm")
-        self.vm.add_args("-cpu", "host")
         self.vm.add_args("-machine", "virt,gic-version=2")
         self.add_common_args()
         self.launch_and_wait()
@@ -108,7 +106,6 @@  def test_virt_kvm_gicv3(self):
         """
         self.require_accelerator("kvm")
         self.vm.add_args("-accel", "kvm")
-        self.vm.add_args("-cpu", "host")
         self.vm.add_args("-machine", "virt,gic-version=3")
         self.add_common_args()
         self.launch_and_wait()
diff --git a/tests/acceptance/machine_mips_malta.py b/tests/acceptance/machine_mips_malta.py
index 7c9a4ee4d2..b67d8cb141 100644
--- a/tests/acceptance/machine_mips_malta.py
+++ b/tests/acceptance/machine_mips_malta.py
@@ -62,7 +62,6 @@  def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                'clocksource=GIC console=tty0 console=ttyS0')
         self.vm.add_args('-kernel', kernel_path,
-                         '-cpu', 'I6400',
                          '-smp', '%u' % cpu_cores_count,
                          '-vga', 'std',
                          '-append', kernel_command_line)
@@ -96,7 +95,7 @@  def test_mips_malta_i6400_framebuffer_logo_1core(self):
         """
         :avocado: tags=arch:mips64el
         :avocado: tags=machine:malta
-        :avocado: tags=cpu:i6400
+        :avocado: tags=cpu:I6400
         """
         self.do_test_i6400_framebuffer_logo(1)
 
@@ -105,7 +104,7 @@  def test_mips_malta_i6400_framebuffer_logo_7cores(self):
         """
         :avocado: tags=arch:mips64el
         :avocado: tags=machine:malta
-        :avocado: tags=cpu:i6400
+        :avocado: tags=cpu:I6400
         :avocado: tags=mips:smp
         """
         self.do_test_i6400_framebuffer_logo(7)
@@ -115,7 +114,7 @@  def test_mips_malta_i6400_framebuffer_logo_8cores(self):
         """
         :avocado: tags=arch:mips64el
         :avocado: tags=machine:malta
-        :avocado: tags=cpu:i6400
+        :avocado: tags=cpu:I6400
         :avocado: tags=mips:smp
         """
         self.do_test_i6400_framebuffer_logo(8)
diff --git a/tests/acceptance/replay_kernel.py b/tests/acceptance/replay_kernel.py
index c1cb862468..6ae18485be 100644
--- a/tests/acceptance/replay_kernel.py
+++ b/tests/acceptance/replay_kernel.py
@@ -156,8 +156,7 @@  def test_aarch64_virt(self):
                                'console=ttyAMA0')
         console_pattern = 'VFS: Cannot open root device'
 
-        self.run_rr(kernel_path, kernel_command_line, console_pattern,
-                    args=('-cpu', 'cortex-a53'))
+        self.run_rr(kernel_path, kernel_command_line, console_pattern)
 
     def test_arm_virt(self):
         """
@@ -303,7 +302,7 @@  def test_ppc64_e500(self):
         tar_url = ('https://www.qemu-advent-calendar.org'
                    '/2018/download/day19.tar.xz')
         file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
-        self.do_test_advcal_2018(file_path, 'uImage', ('-cpu', 'e5500'))
+        self.do_test_advcal_2018(file_path, 'uImage')
 
     def test_ppc_g3beige(self):
         """
@@ -350,8 +349,7 @@  def test_xtensa_lx60(self):
         tar_url = ('https://www.qemu-advent-calendar.org'
                    '/2018/download/day02.tar.xz')
         file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
-        self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf',
-                                 args=('-cpu', 'dc233c'))
+        self.do_test_advcal_2018(file_path, 'santas-sleigh-ride.elf')
 
 @skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
 class ReplayKernelSlow(ReplayKernelBase):
diff --git a/tests/acceptance/reverse_debugging.py b/tests/acceptance/reverse_debugging.py
index be01aca217..d2921e70c3 100644
--- a/tests/acceptance/reverse_debugging.py
+++ b/tests/acceptance/reverse_debugging.py
@@ -207,4 +207,4 @@  def test_aarch64_virt(self):
         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
         self.reverse_debugging(
-            args=('-kernel', kernel_path, '-cpu', 'cortex-a53'))
+            args=('-kernel', kernel_path))
diff --git a/tests/acceptance/tcg_plugins.py b/tests/acceptance/tcg_plugins.py
index c21bf9e52a..9ca1515c3b 100644
--- a/tests/acceptance/tcg_plugins.py
+++ b/tests/acceptance/tcg_plugins.py
@@ -25,7 +25,7 @@  class PluginKernelBase(LinuxKernelTest):
     KERNEL_COMMON_COMMAND_LINE = 'printk.time=1 panic=-1 '
 
     def run_vm(self, kernel_path, kernel_command_line,
-               plugin, plugin_log, console_pattern, args):
+               plugin, plugin_log, console_pattern, args=None):
 
         vm = self.get_vm()
         vm.set_console()
@@ -68,7 +68,7 @@  def test_aarch64_virt_insn(self):
         :avocado: tags=accel:tcg
         :avocado: tags=arch:aarch64
         :avocado: tags=machine:virt
-        :avocado: tags=cpu:cortex-a57
+        :avocado: tags=cpu:cortex-a53
         """
         kernel_path = self._grab_aarch64_kernel()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
@@ -80,8 +80,7 @@  def test_aarch64_virt_insn(self):
 
         self.run_vm(kernel_path, kernel_command_line,
                     "tests/plugin/libinsn.so", plugin_log.name,
-                    console_pattern,
-                    args=('-cpu', 'cortex-a53'))
+                    console_pattern)
 
         with plugin_log as lf, \
              mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
@@ -95,7 +94,7 @@  def test_aarch64_virt_insn_icount(self):
         :avocado: tags=accel:tcg
         :avocado: tags=arch:aarch64
         :avocado: tags=machine:virt
-        :avocado: tags=cpu:cortex-a57
+        :avocado: tags=cpu:cortex-a53
         """
         kernel_path = self._grab_aarch64_kernel()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
@@ -108,7 +107,7 @@  def test_aarch64_virt_insn_icount(self):
         self.run_vm(kernel_path, kernel_command_line,
                     "tests/plugin/libinsn.so", plugin_log.name,
                     console_pattern,
-                    args=('-cpu', 'cortex-a53', '-icount', 'shift=1'))
+                    args=('-icount', 'shift=1'))
 
         with plugin_log as lf, \
              mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s:
@@ -121,7 +120,7 @@  def test_aarch64_virt_mem_icount(self):
         :avocado: tags=accel:tcg
         :avocado: tags=arch:aarch64
         :avocado: tags=machine:virt
-        :avocado: tags=cpu:cortex-a57
+        :avocado: tags=cpu:cortex-a53
         """
         kernel_path = self._grab_aarch64_kernel()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
@@ -134,7 +133,7 @@  def test_aarch64_virt_mem_icount(self):
         self.run_vm(kernel_path, kernel_command_line,
                     "tests/plugin/libmem.so,arg=both", plugin_log.name,
                     console_pattern,
-                    args=('-cpu', 'cortex-a53', '-icount', 'shift=1'))
+                    args=('-icount', 'shift=1'))
 
         with plugin_log as lf, \
              mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s: