qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] tests/avocado: ppc additions and other fixes
@ 2024-01-17 14:12 Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 1/8] tests/avocado: mark boot_linux.py long runtime instead of flaky Nicholas Piggin
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

Thanks for the feedback and comments on these before. I would like to
put these in the ppc tree soon (modulo the x86 patch 2). Happy for more
feedback but could make them as incremental changes too.

Changes since v1:
- Patch 1 (s390x fix) merged.
- Use existing SPEED=slow convention instead of new
  AVOCADO_ALLOW_LONG_RUNTIME (Thomas)
- Add slightly more guideline help text for SPEED=slow (Cedric)
- Fix hypervisor test to use KVM instead of forcing TCG always (Cedric)
- Fix hypervisor test avocado syntax issue (Cedric)
- Add powernv9 FreeBSD boot test, which is a bit tricky since powernv
  does not have a boot loader and not sure how to pass boot options to
  FreeBSD kernel directly.

Haven't done the BE FreeBSD test yet that Cedric suggested, will save
that for later.

Thanks,
Nick

Nicholas Piggin (8):
  tests/avocado: mark boot_linux.py long runtime instead of flaky
  tests/avocado: Mark x86-64 boot_linux.py TCG tests as long runtime
  tests/avocado: Enable replay_linux.py on ppc64 pseries
  tests/avocado: ppc add powernv10 boot_linux_console test
  tests/avocado: Add ppc pseries and powernv hash MMU tests
  tests/avocado: Add pseries KVM boot_linux test
  tests/avocado: ppc add hypervisor tests
  tests/avocado: Add FreeBSD distro boot tests for ppc

 MAINTAINERS                         |   1 +
 docs/devel/testing.rst              |  11 ++
 tests/avocado/boot_freebsd.py       | 174 ++++++++++++++++++++++++
 tests/avocado/boot_linux.py         |  32 +++--
 tests/avocado/boot_linux_console.py |   8 ++
 tests/avocado/ppc_hv_tests.py       | 203 ++++++++++++++++++++++++++++
 tests/avocado/ppc_powernv.py        |  23 +++-
 tests/avocado/ppc_pseries.py        |  20 ++-
 tests/avocado/replay_linux.py       |  76 ++++++++++-
 9 files changed, 525 insertions(+), 23 deletions(-)
 create mode 100644 tests/avocado/boot_freebsd.py
 create mode 100644 tests/avocado/ppc_hv_tests.py

-- 
2.42.0



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/8] tests/avocado: mark boot_linux.py long runtime instead of flaky
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 2/8] tests/avocado: Mark x86-64 boot_linux.py TCG tests as long runtime Nicholas Piggin
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

The ppc64 and s390x tests were first marked skipIf GITLAB_CI by commit
c0c8687ef0f ("tests/avocado: disable BootLinuxPPC64 test in CI"), and
commit 0f26d94ec9e ("tests/acceptance: skip s390x_ccw_vrtio_tcg on
GitLab") due to being very heavy-weight for gitlab CI.

Commit 9b45cc99318 ("docs/devel: rationalise unstable gitlab tests under
FLAKY_TESTS") changed this to being flaky but it isn't really, it just
had a long runtime.

So take the SPEED=slow variable from qtests and introduce it to avocado,
and make these tests require it.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 docs/devel/testing.rst      | 11 +++++++++++
 tests/avocado/boot_linux.py |  8 ++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index bd132306c1..5cdc23b90f 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -1346,6 +1346,17 @@ the environment.
 The definition of *large* is a bit arbitrary here, but it usually means an
 asset which occupies at least 1GB of size on disk when uncompressed.
 
+SPEED
+^^^^^
+Tests which have a long runtime will not be run unless ``SPEED=slow`` is
+exported on the environment.
+
+The definition of *long* is a bit arbitrary here, and it depends on the
+usefulness of the test too. A unique test is worth spending more time on,
+small variations on existing tests perhaps less so. As a rough guide,
+a test or set of similar tests which take more than 100 seconds to
+complete.
+
 AVOCADO_ALLOW_UNTRUSTED_CODE
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 There are tests which will boot a kernel image or firmware that can be
diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
index 7c4769904e..de4c8805f7 100644
--- a/tests/avocado/boot_linux.py
+++ b/tests/avocado/boot_linux.py
@@ -93,13 +93,11 @@ class BootLinuxPPC64(LinuxTest):
 
     timeout = 360
 
-    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
-
+    @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
     def test_pseries_tcg(self):
         """
         :avocado: tags=machine:pseries
         :avocado: tags=accel:tcg
-        :avocado: tags=flaky
         """
         self.require_accelerator("tcg")
         self.vm.add_args("-accel", "tcg")
@@ -113,13 +111,11 @@ class BootLinuxS390X(LinuxTest):
 
     timeout = 240
 
-    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on GitLab')
-
+    @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
     def test_s390_ccw_virtio_tcg(self):
         """
         :avocado: tags=machine:s390-ccw-virtio
         :avocado: tags=accel:tcg
-        :avocado: tags=flaky
         """
         self.require_accelerator("tcg")
         self.vm.add_args("-accel", "tcg")
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/8] tests/avocado: Mark x86-64 boot_linux.py TCG tests as long runtime
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 1/8] tests/avocado: mark boot_linux.py long runtime instead of flaky Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  2024-01-25  9:22   ` Cédric Le Goater
  2024-01-17 14:12 ` [PATCH v2 3/8] tests/avocado: Enable replay_linux.py on ppc64 pseries Nicholas Piggin
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

Re-testing gitlab CI shows the ppc64 and s390x boot_linux tests take
100-150 seconds each. The x86-64 TCG tests take a similar ~100s each,
and are the longest-running avocado tests in gitlab.
From avocado-system-centos:

  boot_linux.py:BootLinuxX8664.test_pc_i440fx_tcg:  PASS (112.34 s)
  boot_linux.py:BootLinuxX8664.test_pc_q35_tcg:  PASS (97.05 s)
  boot_linux.py:BootLinuxPPC64.test_pseries_tcg:  PASS (148.86 s)
  boot_linux.py:BootLinuxS390X.test_s390_ccw_virtio_tcg:  PASS (149.83 s)

So mark the x86-64 tests as SPEED=slow as well.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

The other way we could go is enabling them all since ppc64 and s390s are
now much faster than when they were originally disabled; or to only
enable q35, giving at least one boot_linux.py test.

[https://gitlab.com/npiggin/qemu/-/jobs/5842257510 for results]
---
 tests/avocado/boot_linux.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
index de4c8805f7..7c9cf6ae15 100644
--- a/tests/avocado/boot_linux.py
+++ b/tests/avocado/boot_linux.py
@@ -14,6 +14,9 @@
 
 from avocado import skipUnless
 
+# We don't run TCG tests in CI, as booting the current Fedora OS in TCG tests
+# is very heavyweight (~100s per test). There are lighter weight distros which
+# we use in the machine_aarch64_virt.py, tux_baseline.py, etc.
 
 class BootLinuxX8664(LinuxTest):
     """
@@ -21,6 +24,7 @@ class BootLinuxX8664(LinuxTest):
     """
     timeout = 480
 
+    @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
     def test_pc_i440fx_tcg(self):
         """
         :avocado: tags=machine:pc
@@ -39,6 +43,7 @@ def test_pc_i440fx_kvm(self):
         self.vm.add_args("-accel", "kvm")
         self.launch_and_wait(set_up_ssh_connection=False)
 
+    @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
     def test_pc_q35_tcg(self):
         """
         :avocado: tags=machine:q35
@@ -58,9 +63,6 @@ def test_pc_q35_kvm(self):
         self.launch_and_wait(set_up_ssh_connection=False)
 
 
-# For Aarch64 we only boot KVM tests in CI as booting the current
-# Fedora OS in TCG tests is very heavyweight. There are lighter weight
-# distros which we use in the machine_aarch64_virt.py tests.
 class BootLinuxAarch64(LinuxTest):
     """
     :avocado: tags=arch:aarch64
@@ -84,14 +86,11 @@ def test_virt_kvm(self):
         self.launch_and_wait(set_up_ssh_connection=False)
 
 
-# See the tux_baseline.py tests for almost the same coverage in a lot
-# less time.
 class BootLinuxPPC64(LinuxTest):
     """
     :avocado: tags=arch:ppc64
     """
-
-    timeout = 360
+    timeout = 480
 
     @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
     def test_pseries_tcg(self):
@@ -108,8 +107,7 @@ class BootLinuxS390X(LinuxTest):
     """
     :avocado: tags=arch:s390x
     """
-
-    timeout = 240
+    timeout = 480
 
     @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
     def test_s390_ccw_virtio_tcg(self):
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/8] tests/avocado: Enable replay_linux.py on ppc64 pseries
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 1/8] tests/avocado: mark boot_linux.py long runtime instead of flaky Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 2/8] tests/avocado: Mark x86-64 boot_linux.py TCG tests as long runtime Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 4/8] tests/avocado: ppc add powernv10 boot_linux_console test Nicholas Piggin
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

Add a ppc64 pseries test. This tends to hang in the replay phase near
the end of the trace due to a missing event, so it is marked flaky.

spapr-vscsi IO is extremely slow when running in record-replay modes,
particularly when driven by SLOF. This causes tests to time-out even
after an hour, so this uses guestfish to extract the kernel and initrd
and boot them directly.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 tests/avocado/replay_linux.py | 76 ++++++++++++++++++++++++++++++++++-
 1 file changed, 75 insertions(+), 1 deletion(-)

diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py
index f3a43dc98c..1408d13eeb 100644
--- a/tests/avocado/replay_linux.py
+++ b/tests/avocado/replay_linux.py
@@ -11,8 +11,9 @@
 import os
 import logging
 import time
+import subprocess
 
-from avocado import skipUnless
+from avocado import skipIf, skipUnless
 from avocado_qemu import BUILD_DIR
 from avocado.utils import cloudinit
 from avocado.utils import network
@@ -194,3 +195,76 @@ def test_virt_gicv3(self):
         self.run_rr(shift=3,
                     args=(*self.get_common_args(),
                           "-machine", "virt,gic-version=3"))
+
+# ppc64 pseries test.
+#
+# This machine tends to fail replay and hang very close to the end of the
+# trace, with missing events, which is still an open issue.
+#
+# spapr-scsi IO driven by SLOF/grub is extremely slow in record/replay mode,
+# so jump through some hoops to boot the kernel directly. With this, the test
+# runs in about 5 minutes (modulo hang), which suggests other machines may
+# have similar issues and could benefit from bypassing bootloaders.
+#
+ppc_deps = ["guestfish"] # dependent tools needed in the test setup/box.
+
+def which(tool):
+    """ looks up the full path for @tool, returns None if not found
+        or if @tool does not have executable permissions.
+    """
+    paths=os.getenv('PATH')
+    for p in paths.split(os.path.pathsep):
+        p = os.path.join(p, tool)
+        if os.path.exists(p) and os.access(p, os.X_OK):
+            return p
+    return None
+
+def ppc_missing_deps():
+    """ returns True if any of the test dependent tools are absent.
+    """
+    for dep in ppc_deps:
+        if which(dep) is None:
+            return True
+    return False
+
+@skipIf(ppc_missing_deps(), 'dependencies (%s) not installed' % ','.join(ppc_deps))
+@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'known failure in trace replay')
+class ReplayLinuxPPC64(ReplayLinux):
+    """
+    :avocado: tags=arch:ppc64
+    :avocado: tags=accel:tcg
+    """
+
+    hdd = 'scsi-hd'
+    cd = 'scsi-cd'
+    bus = None
+
+    def setUp(self):
+        super().setUp()
+
+        # kernel, initramfs, and kernel cmdline are all taken by hand from
+        # the Fedora image.
+        self.kernel="vmlinuz-5.3.7-301.fc31.ppc64le"
+        self.initramfs="initramfs-5.3.7-301.fc31.ppc64le.img"
+        cmd = "guestfish --ro -a %s run "
+              ": mount /dev/sda2 / "
+              ": copy-out /boot/%s %s "
+              ": copy-out /boot/%s %s "
+              % (self.boot_path, self.kernel, self.workdir,
+                 self.initramfs, self.workdir)
+        subprocess.run(cmd.split())
+
+    def test_pseries(self):
+        """
+        :avocado: tags=machine:pseries
+        """
+        kernel=os.path.normpath(os.path.join(self.workdir, self.kernel))
+        initramfs=os.path.normpath(os.path.join(self.workdir, self.initramfs))
+        cmdline="root=UUID=8a409ee6-3cb3-4b06-a266-39e2dae3e5fa ro "
+                "no_timer_check net.ifnames=0 console=tty1 "
+                "console=ttyS0,115200n8"
+        self.run_rr(shift=1, args=("-device", "spapr-vscsi",
+                                   "-machine", "x-vof=on",
+                                   "-kernel", kernel,
+                                   "-initrd", initramfs,
+                                   "-append", cmdline))
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/8] tests/avocado: ppc add powernv10 boot_linux_console test
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
                   ` (2 preceding siblings ...)
  2024-01-17 14:12 ` [PATCH v2 3/8] tests/avocado: Enable replay_linux.py on ppc64 pseries Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  2024-01-24  5:34   ` Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 5/8] tests/avocado: Add ppc pseries and powernv hash MMU tests Nicholas Piggin
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

Add test for POWER10.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 tests/avocado/boot_linux_console.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
index 3f0180e1f8..4f05bb7441 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -1386,6 +1386,14 @@ def test_ppc_powernv9(self):
         """
         self.do_test_ppc64_powernv('P9')
 
+    def test_ppc_powernv10(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv10
+        :avocado: tags=accel:tcg
+        """
+        self.do_test_ppc64_powernv('P10')
+
     def test_ppc_g3beige(self):
         """
         :avocado: tags=arch:ppc
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/8] tests/avocado: Add ppc pseries and powernv hash MMU tests
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
                   ` (3 preceding siblings ...)
  2024-01-17 14:12 ` [PATCH v2 4/8] tests/avocado: ppc add powernv10 boot_linux_console test Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  2024-01-25  9:25   ` Cédric Le Goater
  2024-01-17 14:12 ` [PATCH v2 6/8] tests/avocado: Add pseries KVM boot_linux test Nicholas Piggin
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

POWER CPUs support hash and radix MMU modes. Linux supports running in
either mode, but defaults to radix. To keep up testing of QEMU's hash
MMU implementation, add some Linux hash boot tests.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 tests/avocado/ppc_powernv.py | 23 +++++++++++++++++++----
 tests/avocado/ppc_pseries.py | 20 +++++++++++++++++---
 2 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/tests/avocado/ppc_powernv.py b/tests/avocado/ppc_powernv.py
index d0e5c07bde..4342941d5d 100644
--- a/tests/avocado/ppc_powernv.py
+++ b/tests/avocado/ppc_powernv.py
@@ -12,11 +12,11 @@
 class powernvMachine(QemuSystemTest):
 
     timeout = 90
-    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
     panic_message = 'Kernel panic - not syncing'
     good_message = 'VFS: Cannot open root device'
 
-    def do_test_linux_boot(self):
+    def do_test_linux_boot(self, command_line = KERNEL_COMMON_COMMAND_LINE):
         self.require_accelerator("tcg")
         kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                       '/fedora-secondary/releases/29/Everything/ppc64le/os'
@@ -25,9 +25,8 @@ def do_test_linux_boot(self):
         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
         self.vm.set_console()
-        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
         self.vm.add_args('-kernel', kernel_path,
-                         '-append', kernel_command_line)
+                         '-append', command_line)
         self.vm.launch()
 
     def test_linux_boot(self):
@@ -54,6 +53,22 @@ def test_linux_smp_boot(self):
         wait_for_console_pattern(self, console_pattern, self.panic_message)
         wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+    def test_linux_smp_hpt_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv
+        :avocado: tags=accel:tcg
+        """
+
+        self.vm.add_args('-smp', '4')
+        self.do_test_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
+                                'disable_radix')
+        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
+        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
+                                 self.panic_message)
+        wait_for_console_pattern(self, console_pattern, self.panic_message)
+        wait_for_console_pattern(self, self.good_message, self.panic_message)
+
     def test_linux_smt_boot(self):
         """
         :avocado: tags=arch:ppc64
diff --git a/tests/avocado/ppc_pseries.py b/tests/avocado/ppc_pseries.py
index a8311e6555..74aaa4ac4a 100644
--- a/tests/avocado/ppc_pseries.py
+++ b/tests/avocado/ppc_pseries.py
@@ -12,11 +12,11 @@
 class pseriesMachine(QemuSystemTest):
 
     timeout = 90
-    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
     panic_message = 'Kernel panic - not syncing'
     good_message = 'VFS: Cannot open root device'
 
-    def do_test_ppc64_linux_boot(self):
+    def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE):
         kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                       '/fedora-secondary/releases/29/Everything/ppc64le/os'
                       '/ppc/ppc64/vmlinuz')
@@ -24,7 +24,6 @@ def do_test_ppc64_linux_boot(self):
         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
         self.vm.set_console()
-        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
         self.vm.add_args('-kernel', kernel_path,
                          '-append', kernel_command_line)
         self.vm.launch()
@@ -62,6 +61,21 @@ def test_ppc64_linux_smp_boot(self):
         wait_for_console_pattern(self, console_pattern, self.panic_message)
         wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+    def test_ppc64_linux_hpt_smp_boot(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        """
+
+        self.vm.add_args('-smp', '4')
+        self.do_test_ppc64_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
+                                      'disable_radix')
+        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
+        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
+                                 self.panic_message)
+        wait_for_console_pattern(self, console_pattern, self.panic_message)
+        wait_for_console_pattern(self, self.good_message, self.panic_message)
+
     def test_ppc64_linux_smt_boot(self):
         """
         :avocado: tags=arch:ppc64
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/8] tests/avocado: Add pseries KVM boot_linux test
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
                   ` (4 preceding siblings ...)
  2024-01-17 14:12 ` [PATCH v2 5/8] tests/avocado: Add ppc pseries and powernv hash MMU tests Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  2024-01-25  9:25   ` Cédric Le Goater
  2024-01-17 14:12 ` [PATCH v2 7/8] tests/avocado: ppc add hypervisor tests Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 8/8] tests/avocado: Add FreeBSD distro boot tests for ppc Nicholas Piggin
  7 siblings, 1 reply; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

ppc has no avocado tests for the KVM backend. Add a KVM boot_linux.py
test for pseries.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 tests/avocado/boot_linux.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
index 7c9cf6ae15..4c9b15ba06 100644
--- a/tests/avocado/boot_linux.py
+++ b/tests/avocado/boot_linux.py
@@ -102,6 +102,14 @@ def test_pseries_tcg(self):
         self.vm.add_args("-accel", "tcg")
         self.launch_and_wait(set_up_ssh_connection=False)
 
+    def test_pseries_kvm(self):
+        """
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.vm.add_args("-accel", "kvm")
+        self.launch_and_wait(set_up_ssh_connection=False)
 
 class BootLinuxS390X(LinuxTest):
     """
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 7/8] tests/avocado: ppc add hypervisor tests
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
                   ` (5 preceding siblings ...)
  2024-01-17 14:12 ` [PATCH v2 6/8] tests/avocado: Add pseries KVM boot_linux test Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  2024-01-17 14:12 ` [PATCH v2 8/8] tests/avocado: Add FreeBSD distro boot tests for ppc Nicholas Piggin
  7 siblings, 0 replies; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

The powernv and pseries machines both provide hypervisor facilities
that are supported by KVM. This is a large and complicated set of
features that don't get much system-level testing in ppc tests.

Add a new test case for these which runs QEMU KVM inside the target.
This downloads an Alpine VM image, boots it and downloads and installs
the qemu package, then boots a virtual machine under it, re-using the
original Alpine VM image.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 MAINTAINERS                   |   1 +
 tests/avocado/ppc_hv_tests.py | 203 ++++++++++++++++++++++++++++++++++
 2 files changed, 204 insertions(+)
 create mode 100644 tests/avocado/ppc_hv_tests.py

diff --git a/MAINTAINERS b/MAINTAINERS
index b406fb20c0..bf41ac61c8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1523,6 +1523,7 @@ F: tests/qtest/libqos/*spapr*
 F: tests/qtest/rtas*
 F: tests/qtest/libqos/rtas*
 F: tests/avocado/ppc_pseries.py
+F: tests/avocado/ppc_hv_tests.py
 
 PowerNV (Non-Virtualized)
 M: Cédric Le Goater <clg@kaod.org>
diff --git a/tests/avocado/ppc_hv_tests.py b/tests/avocado/ppc_hv_tests.py
new file mode 100644
index 0000000000..2f80d0d176
--- /dev/null
+++ b/tests/avocado/ppc_hv_tests.py
@@ -0,0 +1,203 @@
+# Tests that specifically try to exercise hypervisor features of the
+# target machines. powernv supports the Power hypervisor ISA, and
+# pseries supports the nested-HV hypervisor spec.
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+from avocado import skipIf, skipUnless
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern, exec_command
+import os
+import time
+import subprocess
+
+deps = ["xorriso"] # dependent tools needed in the test setup/box.
+
+def which(tool):
+    """ looks up the full path for @tool, returns None if not found
+        or if @tool does not have executable permissions.
+    """
+    paths=os.getenv('PATH')
+    for p in paths.split(os.path.pathsep):
+        p = os.path.join(p, tool)
+        if os.path.exists(p) and os.access(p, os.X_OK):
+            return p
+    return None
+
+def missing_deps():
+    """ returns True if any of the test dependent tools are absent.
+    """
+    for dep in deps:
+        if which(dep) is None:
+            return True
+    return False
+
+# Alpine is a light weight distro that supports QEMU. These tests boot
+# that on the machine then run a QEMU guest inside it in KVM mode,
+# that runs the same Alpine distro image.
+# QEMU packages are downloaded and installed on each test. That's not a
+# large download, but it may be more polite to create qcow2 image with
+# QEMU already installed and use that.
+@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
+@skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
+@skipIf(missing_deps(), 'dependencies (%s) not installed' % ','.join(deps))
+class HypervisorTest(QemuSystemTest):
+
+    timeout = 1000
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
+    panic_message = 'Kernel panic - not syncing'
+    good_message = 'VFS: Cannot open root device'
+
+    def extract_from_iso(self, iso, path):
+        """
+        Extracts a file from an iso file into the test workdir
+
+        :param iso: path to the iso file
+        :param path: path within the iso file of the file to be extracted
+        :returns: path of the extracted file
+        """
+        filename = os.path.basename(path)
+
+        cwd = os.getcwd()
+        os.chdir(self.workdir)
+
+        with open(filename, "w") as outfile:
+            cmd = "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, filename)
+            subprocess.run(cmd.split(),
+                           stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+
+        os.chdir(cwd)
+
+        # Return complete path to extracted file.  Because callers to
+        # extract_from_iso() specify 'path' with a leading slash, it is
+        # necessary to use os.path.relpath() as otherwise os.path.join()
+        # interprets it as an absolute path and drops the self.workdir part.
+        return os.path.normpath(os.path.join(self.workdir, filename))
+
+    def setUp(self):
+        super().setUp()
+
+        iso_url = ('https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/ppc64le/alpine-standard-3.18.4-ppc64le.iso')
+
+        # Alpine use sha256 so I recalculated this myself
+        iso_sha256 = 'c26b8d3e17c2f3f0fed02b4b1296589c2390e6d5548610099af75300edd7b3ff'
+        iso_path = self.fetch_asset(iso_url, asset_hash=iso_sha256,
+                                    algorithm = "sha256")
+
+        self.iso_path = iso_path
+        self.vmlinuz = self.extract_from_iso(iso_path, '/boot/vmlinuz-lts')
+        self.initramfs = self.extract_from_iso(iso_path, '/boot/initramfs-lts')
+
+    def do_start_alpine(self):
+        self.vm.set_console()
+        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
+        self.vm.add_args("-kernel", self.vmlinuz)
+        self.vm.add_args("-initrd", self.initramfs)
+        self.vm.add_args("-smp", "4", "-m", "2g")
+        self.vm.add_args("-drive", f"file={self.iso_path},format=raw,if=none,id=drive0")
+
+        self.vm.launch()
+        wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'localhost login:')
+        wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
+        exec_command(self, 'setup-alpine -qe')
+        wait_for_console_pattern(self, 'localhost:~#')
+
+    def do_stop_alpine(self):
+        exec_command(self, 'poweroff')
+        wait_for_console_pattern(self, 'alpine:~#')
+        self.vm.wait()
+
+    def do_setup_kvm(self):
+        exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/main > /etc/apk/repositories')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'echo http://dl-cdn.alpinelinux.org/alpine/v3.18/community >> /etc/apk/repositories')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'apk update')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'apk add qemu-system-ppc64')
+        wait_for_console_pattern(self, 'alpine:~#')
+        exec_command(self, 'modprobe kvm-hv')
+        wait_for_console_pattern(self, 'alpine:~#')
+
+    # This uses the host's block device as the source file for guest block
+    # device for install media. This is a bit hacky but allows reuse of the
+    # iso without having a passthrough filesystem configured.
+    def do_test_kvm(self, hpt=False):
+        if hpt:
+            append = 'disable_radix'
+        else:
+            append = ''
+        exec_command(self, 'qemu-system-ppc64 -nographic -smp 2 -m 1g '
+                           '-machine pseries,x-vof=on,accel=kvm '
+                           '-machine cap-cfpc=broken,cap-sbbc=broken,'
+                                    'cap-ibs=broken,cap-ccf-assist=off '
+                           '-drive file=/dev/nvme0n1,format=raw,readonly=on '
+                           '-initrd /media/nvme0n1/boot/initramfs-lts '
+                           '-kernel /media/nvme0n1/boot/vmlinuz-lts '
+                           '-append \'usbcore.nousb ' + append + '\'')
+        # Alpine 3.18 kernel seems to crash in XHCI USB driver.
+        wait_for_console_pattern(self, 'Welcome to Alpine Linux 3.18')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'localhost login:')
+        wait_for_console_pattern(self, 'You may change this message by editing /etc/motd.')
+        exec_command(self, 'poweroff >& /dev/null')
+        wait_for_console_pattern(self, 'localhost:~#')
+        wait_for_console_pattern(self, 'reboot: Power down')
+        time.sleep(1)
+        exec_command(self, '') # console has strange issue after qemu exit
+        exec_command(self, 'reset')
+        exec_command(self, 'echo VM finished')
+        wait_for_console_pattern(self, 'VM finished')
+
+    def test_hv_pseries(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.vm.add_args("-accel", "tcg,thread=multi")
+        self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
+        self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_stop_alpine()
+
+    def test_hv_pseries_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.vm.add_args("-accel", "kvm")
+        self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
+        self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_stop_alpine()
+
+    def test_hv_powernv(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.vm.add_args("-accel", "tcg,thread=multi")
+        self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
+                         '-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
+                         '-netdev', 'user,id=net0,hostfwd=::20022-:22,hostname=alpine')
+        self.do_start_alpine()
+        self.do_setup_kvm()
+        self.do_test_kvm()
+        self.do_test_kvm(True)
+        self.do_stop_alpine()
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 8/8] tests/avocado: Add FreeBSD distro boot tests for ppc
  2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
                   ` (6 preceding siblings ...)
  2024-01-17 14:12 ` [PATCH v2 7/8] tests/avocado: ppc add hypervisor tests Nicholas Piggin
@ 2024-01-17 14:12 ` Nicholas Piggin
  7 siblings, 0 replies; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-17 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Alex Bennée, Daniel Henrique Barboza,
	Cédric Le Goater, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc,
	Warner Losh

FreeBSD project provides qcow2 images that work well for testing QEMU.
Add pseries tests for HPT and Radix, KVM and TCG, and powernv9 tests.

This uses short-term snapshot build artifacts, because FreeBSD has not
set up long-term builds for ppc64 yet.

Other architectures could be added so this does not get a ppc_ prefix
but is instead named similarly to boot_linux.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Unfortunately the latest stable (14.0) x86-64 VM image does not seem to
output to console by default and I've not been able to find a reliable
way to edit the filesystem to change the boot loader options, or use
console input in the test case to change it on the fly.

Thanks,
Nick

---
 tests/avocado/boot_freebsd.py | 174 ++++++++++++++++++++++++++++++++++
 1 file changed, 174 insertions(+)
 create mode 100644 tests/avocado/boot_freebsd.py

diff --git a/tests/avocado/boot_freebsd.py b/tests/avocado/boot_freebsd.py
new file mode 100644
index 0000000000..c01cd06cca
--- /dev/null
+++ b/tests/avocado/boot_freebsd.py
@@ -0,0 +1,174 @@
+# Functional tests that boot FreeBSD in various configurations
+#
+# Copyright (c) 2023 IBM Corporation
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import os
+import subprocess
+
+from avocado import skipUnless
+from avocado_qemu import QemuSystemTest
+from avocado_qemu import wait_for_console_pattern
+from avocado_qemu import exec_command
+from avocado.utils import archive
+from avocado.utils import process
+from avocado.utils.path import find_command
+
+@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
+@skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
+class BootFreeBSDPPC64(QemuSystemTest):
+    """
+    :avocado: tags=arch:ppc64
+    """
+
+    timeout = 360
+
+    def setUp(self):
+        super().setUp()
+
+        # We need zstd for all the tests
+        # See https://github.com/avocado-framework/avocado/issues/5609
+        zstd = find_command('zstd', False)
+        if zstd is False:
+            self.cancel('Could not find "zstd", which is required to '
+                        'decompress rootfs')
+        tar = find_command('tar', False)
+        if tar is False:
+            self.cancel('Could not find "tar", which is required to '
+                        'decompress rootfs')
+
+        drive_url = ('https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/disk.qcow2.zst')
+        drive_hash = '95d863dbbc4b60f4899d1ef21d6489fca05bf03d'
+        drive_path_zstd = self.fetch_asset(drive_url, asset_hash=drive_hash)
+        self.drive_path = os.path.join(self.workdir, 'disk.qcow2')
+
+        cmd = f"{zstd} -d {drive_path_zstd} -o {self.drive_path}"
+        process.run(cmd)
+
+        kernel_url = ('https://artifact.ci.freebsd.org/snapshot/15.0-CURRENT/8a735ffdf04936c6785ac4fa31486639262dd416/powerpc/powerpc64le/kernel.txz')
+        kernel_hash = '31d14c2dc658858830a7acab5128a5b91ea548cf'
+        kernel_path_txz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+        self.kernel_path = os.path.join(self.workdir, 'kernel')
+
+        with open(self.kernel_path, "w") as outfile:
+            cmd = f"{tar} OJxf {kernel_path_txz} ./boot/kernel/kernel"
+            subprocess.run(cmd.split(), stdout=outfile)
+
+    def set_pseries_devices(self):
+        self.vm.add_args('-drive', f"file={self.drive_path},format=qcow2,if=virtio")
+        self.vm.add_args('-net', 'nic,model=virtio')
+
+    def set_powernv_devices(self):
+        self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
+                         '-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
+                         '-netdev', 'user,id=net0,hostfwd=::20022-:22,hostname=freebsd')
+        self.vm.add_args("-drive", f"file={self.drive_path},format=qcow2,if=none,id=drive0")
+        self.vm.add_args("-kernel", self.kernel_path)
+
+    def run_pseries_test(self, force_HPT=False):
+        if force_HPT:
+            self.vm.add_args('-m', '4g')
+        else:
+            self.vm.add_args('-m', '1g')
+        self.vm.add_args('-smp', '4')
+        self.set_pseries_devices()
+        self.vm.set_console()
+        self.vm.launch()
+
+        wait_for_console_pattern(self, 'Hit [Enter] to boot immediately, or any other key for command prompt.')
+        if force_HPT:
+            exec_command(self, 'x')
+            wait_for_console_pattern(self, 'OK')
+            exec_command(self, 'set radix_mmu=0')
+            exec_command(self, 'boot')
+            wait_for_console_pattern(self, 'cas: selected hash MMU', 'panic:')
+        else:
+            exec_command(self, '')
+            wait_for_console_pattern(self, 'cas: selected radix MMU', 'panic:')
+
+        wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT', 'panic:')
+        wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs', 'panic:')
+        wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)', 'panic:')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'resizewin: timeout reading from terminal')
+        exec_command(self, 'poweroff')
+        wait_for_console_pattern(self, 'Uptime:', 'panic:')
+        self.vm.wait()
+
+    # powernv does not have a bootloader so must load the kernel directly
+    # and work around manual specification of the root device. Also can't
+    # specify options like radix_mmu the same way (todo: work out how it
+    # is done, and add HPT test).
+    def run_powernv_test(self, force_HPT=False):
+        self.vm.add_args('-m', '8g')
+        self.vm.add_args('-smp', '4')
+        self.set_powernv_devices()
+        self.vm.set_console()
+        self.vm.launch()
+
+        wait_for_console_pattern(self, 'FreeBSD 15.0-CURRENT', 'panic:')
+        wait_for_console_pattern(self, 'FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs', 'panic:')
+        wait_for_console_pattern(self, '<empty line>    Abort manual input')
+        exec_command(self, 'ufs:diskid/DISK-1234s3')
+
+        wait_for_console_pattern(self, 'FreeBSD/powerpc (Amnesiac) (ttyu0)', 'panic:')
+        exec_command(self, 'root')
+        wait_for_console_pattern(self, 'resizewin: timeout reading from terminal')
+        exec_command(self, 'poweroff')
+        wait_for_console_pattern(self, 'Uptime:', 'panic:')
+        wait_for_console_pattern(self, 'OPAL: Shutdown request', 'panic:')
+        self.vm.wait()
+
+    def test_pseries_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.vm.add_args("-cpu", "power10")
+        self.vm.add_args("-accel", "tcg,thread=multi")
+        self.run_pseries_test()
+
+    def test_pseries_hpt_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.vm.add_args("-accel", "tcg,thread=multi")
+        self.run_pseries_test(force_HPT=True)
+
+    def test_pseries_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.vm.add_args("-accel", "kvm")
+        self.run_pseries_test()
+
+    def test_pseries_hpt_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+        """
+        self.require_accelerator("kvm")
+        self.vm.add_args("-accel", "kvm")
+        self.run_pseries_test(force_HPT=True)
+
+    # powernv9 works, powernv10 fails
+    def test_powernv(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:powernv9
+        :avocado: tags=accel:tcg
+        """
+        self.require_accelerator("tcg")
+        self.vm.add_args("-accel", "tcg,thread=multi")
+        self.run_powernv_test()
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/8] tests/avocado: ppc add powernv10 boot_linux_console test
  2024-01-17 14:12 ` [PATCH v2 4/8] tests/avocado: ppc add powernv10 boot_linux_console test Nicholas Piggin
@ 2024-01-24  5:34   ` Nicholas Piggin
  0 siblings, 0 replies; 13+ messages in thread
From: Nicholas Piggin @ 2024-01-24  5:34 UTC (permalink / raw)
  To: Nicholas Piggin, qemu-devel
  Cc: Alex Bennée, Daniel Henrique Barboza, Cédric Le Goater,
	Harsh Prateek Bora, Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

This test seems to be flaky, it hangs without ever getting the
MTD partition message. But I think it might be the init process
quieting the kernel console messages that just happens to run
first. P10 seems to just hit this up more, maybe small timing
differences.

So I'll send a patch to adjust the tets harness to avoid it.

Thanks,
Nick

On Thu Jan 18, 2024 at 12:12 AM AEST, Nicholas Piggin wrote:
> Add test for POWER10.
>
> Reviewed-by: Cédric Le Goater <clg@kaod.org>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  tests/avocado/boot_linux_console.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
> index 3f0180e1f8..4f05bb7441 100644
> --- a/tests/avocado/boot_linux_console.py
> +++ b/tests/avocado/boot_linux_console.py
> @@ -1386,6 +1386,14 @@ def test_ppc_powernv9(self):
>          """
>          self.do_test_ppc64_powernv('P9')
>  
> +    def test_ppc_powernv10(self):
> +        """
> +        :avocado: tags=arch:ppc64
> +        :avocado: tags=machine:powernv10
> +        :avocado: tags=accel:tcg
> +        """
> +        self.do_test_ppc64_powernv('P10')
> +
>      def test_ppc_g3beige(self):
>          """
>          :avocado: tags=arch:ppc



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/8] tests/avocado: Mark x86-64 boot_linux.py TCG tests as long runtime
  2024-01-17 14:12 ` [PATCH v2 2/8] tests/avocado: Mark x86-64 boot_linux.py TCG tests as long runtime Nicholas Piggin
@ 2024-01-25  9:22   ` Cédric Le Goater
  0 siblings, 0 replies; 13+ messages in thread
From: Cédric Le Goater @ 2024-01-25  9:22 UTC (permalink / raw)
  To: Nicholas Piggin, qemu-devel
  Cc: Alex Bennée, Daniel Henrique Barboza, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

On 1/17/24 15:12, Nicholas Piggin wrote:
> Re-testing gitlab CI shows the ppc64 and s390x boot_linux tests take
> 100-150 seconds each. The x86-64 TCG tests take a similar ~100s each,
> and are the longest-running avocado tests in gitlab.
>  From avocado-system-centos:
> 
>    boot_linux.py:BootLinuxX8664.test_pc_i440fx_tcg:  PASS (112.34 s)
>    boot_linux.py:BootLinuxX8664.test_pc_q35_tcg:  PASS (97.05 s)
>    boot_linux.py:BootLinuxPPC64.test_pseries_tcg:  PASS (148.86 s)
>    boot_linux.py:BootLinuxS390X.test_s390_ccw_virtio_tcg:  PASS (149.83 s)
> 
> So mark the x86-64 tests as SPEED=slow as well.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> 
> The other way we could go is enabling them all since ppc64 and s390s are
> now much faster than when they were originally disabled; or to only
> enable q35, giving at least one boot_linux.py test.
> 
> [https://gitlab.com/npiggin/qemu/-/jobs/5842257510 for results]


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


> ---
>   tests/avocado/boot_linux.py | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
> index de4c8805f7..7c9cf6ae15 100644
> --- a/tests/avocado/boot_linux.py
> +++ b/tests/avocado/boot_linux.py
> @@ -14,6 +14,9 @@
>   
>   from avocado import skipUnless
>   
> +# We don't run TCG tests in CI, as booting the current Fedora OS in TCG tests
> +# is very heavyweight (~100s per test). There are lighter weight distros which
> +# we use in the machine_aarch64_virt.py, tux_baseline.py, etc.
>   
>   class BootLinuxX8664(LinuxTest):
>       """
> @@ -21,6 +24,7 @@ class BootLinuxX8664(LinuxTest):
>       """
>       timeout = 480
>   
> +    @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
>       def test_pc_i440fx_tcg(self):
>           """
>           :avocado: tags=machine:pc
> @@ -39,6 +43,7 @@ def test_pc_i440fx_kvm(self):
>           self.vm.add_args("-accel", "kvm")
>           self.launch_and_wait(set_up_ssh_connection=False)
>   
> +    @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
>       def test_pc_q35_tcg(self):
>           """
>           :avocado: tags=machine:q35
> @@ -58,9 +63,6 @@ def test_pc_q35_kvm(self):
>           self.launch_and_wait(set_up_ssh_connection=False)
>   
>   
> -# For Aarch64 we only boot KVM tests in CI as booting the current
> -# Fedora OS in TCG tests is very heavyweight. There are lighter weight
> -# distros which we use in the machine_aarch64_virt.py tests.
>   class BootLinuxAarch64(LinuxTest):
>       """
>       :avocado: tags=arch:aarch64
> @@ -84,14 +86,11 @@ def test_virt_kvm(self):
>           self.launch_and_wait(set_up_ssh_connection=False)
>   
>   
> -# See the tux_baseline.py tests for almost the same coverage in a lot
> -# less time.
>   class BootLinuxPPC64(LinuxTest):
>       """
>       :avocado: tags=arch:ppc64
>       """
> -
> -    timeout = 360
> +    timeout = 480
>   
>       @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
>       def test_pseries_tcg(self):
> @@ -108,8 +107,7 @@ class BootLinuxS390X(LinuxTest):
>       """
>       :avocado: tags=arch:s390x
>       """
> -
> -    timeout = 240
> +    timeout = 480
>   
>       @skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
>       def test_s390_ccw_virtio_tcg(self):



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 5/8] tests/avocado: Add ppc pseries and powernv hash MMU tests
  2024-01-17 14:12 ` [PATCH v2 5/8] tests/avocado: Add ppc pseries and powernv hash MMU tests Nicholas Piggin
@ 2024-01-25  9:25   ` Cédric Le Goater
  0 siblings, 0 replies; 13+ messages in thread
From: Cédric Le Goater @ 2024-01-25  9:25 UTC (permalink / raw)
  To: Nicholas Piggin, qemu-devel
  Cc: Alex Bennée, Daniel Henrique Barboza, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

On 1/17/24 15:12, Nicholas Piggin wrote:
> POWER CPUs support hash and radix MMU modes. Linux supports running in
> either mode, but defaults to radix. To keep up testing of QEMU's hash
> MMU implementation, add some Linux hash boot tests.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


> ---
>   tests/avocado/ppc_powernv.py | 23 +++++++++++++++++++----
>   tests/avocado/ppc_pseries.py | 20 +++++++++++++++++---
>   2 files changed, 36 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/avocado/ppc_powernv.py b/tests/avocado/ppc_powernv.py
> index d0e5c07bde..4342941d5d 100644
> --- a/tests/avocado/ppc_powernv.py
> +++ b/tests/avocado/ppc_powernv.py
> @@ -12,11 +12,11 @@
>   class powernvMachine(QemuSystemTest):
>   
>       timeout = 90
> -    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
> +    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
>       panic_message = 'Kernel panic - not syncing'
>       good_message = 'VFS: Cannot open root device'
>   
> -    def do_test_linux_boot(self):
> +    def do_test_linux_boot(self, command_line = KERNEL_COMMON_COMMAND_LINE):
>           self.require_accelerator("tcg")
>           kernel_url = ('https://archives.fedoraproject.org/pub/archive'
>                         '/fedora-secondary/releases/29/Everything/ppc64le/os'
> @@ -25,9 +25,8 @@ def do_test_linux_boot(self):
>           kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
>   
>           self.vm.set_console()
> -        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
>           self.vm.add_args('-kernel', kernel_path,
> -                         '-append', kernel_command_line)
> +                         '-append', command_line)
>           self.vm.launch()
>   
>       def test_linux_boot(self):
> @@ -54,6 +53,22 @@ def test_linux_smp_boot(self):
>           wait_for_console_pattern(self, console_pattern, self.panic_message)
>           wait_for_console_pattern(self, self.good_message, self.panic_message)
>   
> +    def test_linux_smp_hpt_boot(self):
> +        """
> +        :avocado: tags=arch:ppc64
> +        :avocado: tags=machine:powernv
> +        :avocado: tags=accel:tcg
> +        """
> +
> +        self.vm.add_args('-smp', '4')
> +        self.do_test_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
> +                                'disable_radix')
> +        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
> +        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
> +                                 self.panic_message)
> +        wait_for_console_pattern(self, console_pattern, self.panic_message)
> +        wait_for_console_pattern(self, self.good_message, self.panic_message)
> +
>       def test_linux_smt_boot(self):
>           """
>           :avocado: tags=arch:ppc64
> diff --git a/tests/avocado/ppc_pseries.py b/tests/avocado/ppc_pseries.py
> index a8311e6555..74aaa4ac4a 100644
> --- a/tests/avocado/ppc_pseries.py
> +++ b/tests/avocado/ppc_pseries.py
> @@ -12,11 +12,11 @@
>   class pseriesMachine(QemuSystemTest):
>   
>       timeout = 90
> -    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
> +    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
>       panic_message = 'Kernel panic - not syncing'
>       good_message = 'VFS: Cannot open root device'
>   
> -    def do_test_ppc64_linux_boot(self):
> +    def do_test_ppc64_linux_boot(self, kernel_command_line = KERNEL_COMMON_COMMAND_LINE):
>           kernel_url = ('https://archives.fedoraproject.org/pub/archive'
>                         '/fedora-secondary/releases/29/Everything/ppc64le/os'
>                         '/ppc/ppc64/vmlinuz')
> @@ -24,7 +24,6 @@ def do_test_ppc64_linux_boot(self):
>           kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
>   
>           self.vm.set_console()
> -        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=hvc0'
>           self.vm.add_args('-kernel', kernel_path,
>                            '-append', kernel_command_line)
>           self.vm.launch()
> @@ -62,6 +61,21 @@ def test_ppc64_linux_smp_boot(self):
>           wait_for_console_pattern(self, console_pattern, self.panic_message)
>           wait_for_console_pattern(self, self.good_message, self.panic_message)
>   
> +    def test_ppc64_linux_hpt_smp_boot(self):
> +        """
> +        :avocado: tags=arch:ppc64
> +        :avocado: tags=machine:pseries
> +        """
> +
> +        self.vm.add_args('-smp', '4')
> +        self.do_test_ppc64_linux_boot(self.KERNEL_COMMON_COMMAND_LINE +
> +                                      'disable_radix')
> +        console_pattern = 'smp: Brought up 1 node, 4 CPUs'
> +        wait_for_console_pattern(self, 'hash-mmu: Initializing hash mmu',
> +                                 self.panic_message)
> +        wait_for_console_pattern(self, console_pattern, self.panic_message)
> +        wait_for_console_pattern(self, self.good_message, self.panic_message)
> +
>       def test_ppc64_linux_smt_boot(self):
>           """
>           :avocado: tags=arch:ppc64



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 6/8] tests/avocado: Add pseries KVM boot_linux test
  2024-01-17 14:12 ` [PATCH v2 6/8] tests/avocado: Add pseries KVM boot_linux test Nicholas Piggin
@ 2024-01-25  9:25   ` Cédric Le Goater
  0 siblings, 0 replies; 13+ messages in thread
From: Cédric Le Goater @ 2024-01-25  9:25 UTC (permalink / raw)
  To: Nicholas Piggin, qemu-devel
  Cc: Alex Bennée, Daniel Henrique Barboza, Harsh Prateek Bora,
	Philippe Mathieu-Daudé, Thomas Huth,
	Wainer dos Santos Moschetta, Beraldo Leal, Cleber Rosa, qemu-ppc

On 1/17/24 15:12, Nicholas Piggin wrote:
> ppc has no avocado tests for the KVM backend. Add a KVM boot_linux.py
> test for pseries.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


> ---
>   tests/avocado/boot_linux.py | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
> index 7c9cf6ae15..4c9b15ba06 100644
> --- a/tests/avocado/boot_linux.py
> +++ b/tests/avocado/boot_linux.py
> @@ -102,6 +102,14 @@ def test_pseries_tcg(self):
>           self.vm.add_args("-accel", "tcg")
>           self.launch_and_wait(set_up_ssh_connection=False)
>   
> +    def test_pseries_kvm(self):
> +        """
> +        :avocado: tags=machine:pseries
> +        :avocado: tags=accel:kvm
> +        """
> +        self.require_accelerator("kvm")
> +        self.vm.add_args("-accel", "kvm")
> +        self.launch_and_wait(set_up_ssh_connection=False)
>   
>   class BootLinuxS390X(LinuxTest):
>       """



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-01-25  9:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17 14:12 [PATCH v2 0/8] tests/avocado: ppc additions and other fixes Nicholas Piggin
2024-01-17 14:12 ` [PATCH v2 1/8] tests/avocado: mark boot_linux.py long runtime instead of flaky Nicholas Piggin
2024-01-17 14:12 ` [PATCH v2 2/8] tests/avocado: Mark x86-64 boot_linux.py TCG tests as long runtime Nicholas Piggin
2024-01-25  9:22   ` Cédric Le Goater
2024-01-17 14:12 ` [PATCH v2 3/8] tests/avocado: Enable replay_linux.py on ppc64 pseries Nicholas Piggin
2024-01-17 14:12 ` [PATCH v2 4/8] tests/avocado: ppc add powernv10 boot_linux_console test Nicholas Piggin
2024-01-24  5:34   ` Nicholas Piggin
2024-01-17 14:12 ` [PATCH v2 5/8] tests/avocado: Add ppc pseries and powernv hash MMU tests Nicholas Piggin
2024-01-25  9:25   ` Cédric Le Goater
2024-01-17 14:12 ` [PATCH v2 6/8] tests/avocado: Add pseries KVM boot_linux test Nicholas Piggin
2024-01-25  9:25   ` Cédric Le Goater
2024-01-17 14:12 ` [PATCH v2 7/8] tests/avocado: ppc add hypervisor tests Nicholas Piggin
2024-01-17 14:12 ` [PATCH v2 8/8] tests/avocado: Add FreeBSD distro boot tests for ppc Nicholas Piggin

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).