qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PULL 26/42] tests/functional: Convert the ppc_hv avocado test into a standalone test
Date: Wed,  4 Sep 2024 12:39:01 +0200	[thread overview]
Message-ID: <20240904103923.451847-27-thuth@redhat.com> (raw)
In-Reply-To: <20240904103923.451847-1-thuth@redhat.com>

A straight forward conversion, we just also have to remove the decorator
@skipUnless(os.getenv('SPEED')) since all non-trivial functional tests
are running in SPEED=thorough mode now. Also make sure that the extracted
assets are writable, so that the test does not fail if it gets re-run
and there are stale read-only files already around.

Message-ID: <20240830133841.142644-28-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 MAINTAINERS                                   |  2 +-
 tests/functional/meson.build                  |  2 +
 .../test_ppc64_hv.py}                         | 52 ++++++++-----------
 3 files changed, 24 insertions(+), 32 deletions(-)
 rename tests/{avocado/ppc_hv_tests.py => functional/test_ppc64_hv.py} (85%)
 mode change 100644 => 100755

diff --git a/MAINTAINERS b/MAINTAINERS
index ee291e6d55..52b53d693e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1531,7 +1531,7 @@ F: tests/qtest/libqos/*spapr*
 F: tests/qtest/rtas*
 F: tests/qtest/libqos/rtas*
 F: tests/functional/test_ppc64_pseries.py
-F: tests/avocado/ppc_hv_tests.py
+F: tests/functional/test_ppc64_hv.py
 
 PowerNV (Non-Virtualized)
 M: Cédric Le Goater <clg@kaod.org>
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index f0f0cbd500..fcb99c547d 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -13,6 +13,7 @@ endif
 test_timeouts = {
   'netdev_ethtool' : 180,
   'ppc_40p' : 240,
+  'ppc64_hv' : 1000,
   'ppc64_powernv' : 120,
   'ppc64_pseries' : 120,
   's390x_ccw_virtio' : 180,
@@ -68,6 +69,7 @@ tests_ppc_system_thorough = [
 ]
 
 tests_ppc64_system_thorough = [
+  'ppc64_hv',
   'ppc64_powernv',
   'ppc64_pseries',
 ]
diff --git a/tests/avocado/ppc_hv_tests.py b/tests/functional/test_ppc64_hv.py
old mode 100644
new mode 100755
similarity index 85%
rename from tests/avocado/ppc_hv_tests.py
rename to tests/functional/test_ppc64_hv.py
index 0e83bbac71..1a6e4b6d07
--- a/tests/avocado/ppc_hv_tests.py
+++ b/tests/functional/test_ppc64_hv.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+#
 # 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.
@@ -7,10 +9,9 @@
 # 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
+from unittest import skipIf, skipUnless
+from qemu_test import QemuSystemTest, Asset
+from qemu_test import wait_for_console_pattern, exec_command
 import os
 import time
 import subprocess
@@ -45,8 +46,7 @@ def missing_deps():
 # QEMU already installed and use that.
 # XXX: The order of these tests seems to matter, see git blame.
 @skipIf(missing_deps(), 'dependencies (%s) not installed' % ','.join(deps))
-@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
-@skipUnless(os.getenv('SPEED') == 'slow', 'runtime limited')
+@skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limited')
 class HypervisorTest(QemuSystemTest):
 
     timeout = 1000
@@ -54,6 +54,11 @@ class HypervisorTest(QemuSystemTest):
     panic_message = 'Kernel panic - not syncing'
     good_message = 'VFS: Cannot open root device'
 
+    ASSET_ISO = Asset(
+        ('https://dl-cdn.alpinelinux.org/alpine/v3.18/'
+         'releases/ppc64le/alpine-standard-3.18.4-ppc64le.iso'),
+        'c26b8d3e17c2f3f0fed02b4b1296589c2390e6d5548610099af75300edd7b3ff')
+
     def extract_from_iso(self, iso, path):
         """
         Extracts a file from an iso file into the test workdir
@@ -72,6 +77,7 @@ def extract_from_iso(self, iso, path):
             subprocess.run(cmd.split(),
                            stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
 
+        os.chmod(filename, 0o600)
         os.chdir(cwd)
 
         # Return complete path to extracted file.  Because callers to
@@ -83,16 +89,9 @@ def extract_from_iso(self, iso, path):
     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')
+        self.iso_path = self.ASSET_ISO.fetch()
+        self.vmlinuz = self.extract_from_iso(self.iso_path, '/boot/vmlinuz-lts')
+        self.initramfs = self.extract_from_iso(self.iso_path, '/boot/initramfs-lts')
 
     def do_start_alpine(self):
         self.vm.set_console()
@@ -158,12 +157,8 @@ def do_test_kvm(self, hpt=False):
         wait_for_console_pattern(self, 'alpine:~#')
 
     def test_hv_pseries(self):
-        """
-        :avocado: tags=arch:ppc64
-        :avocado: tags=machine:pseries
-        :avocado: tags=accel:tcg
-        """
         self.require_accelerator("tcg")
+        self.set_machine('pseries')
         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")
@@ -173,12 +168,8 @@ def test_hv_pseries(self):
         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.set_machine('pseries')
         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,cap-ccf-assist=off")
@@ -188,12 +179,8 @@ def test_hv_pseries_kvm(self):
         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.set_machine('powernv')
         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',
@@ -203,3 +190,6 @@ def test_hv_powernv(self):
         self.do_test_kvm()
         self.do_test_kvm(True)
         self.do_stop_alpine()
+
+if __name__ == '__main__':
+    QemuSystemTest.main()
-- 
2.46.0



  parent reply	other threads:[~2024-09-04 10:46 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04 10:38 [PULL 00/42] Introduce new functional test framework Thomas Huth
2024-09-04 10:38 ` [PULL 01/42] tests/avocado: machine aarch64: standardize location and RO access Thomas Huth
2024-09-04 10:38 ` [PULL 02/42] tests/avocado/boot_xen.py: fetch kernel during test setUp() Thomas Huth
2024-09-04 10:38 ` [PULL 03/42] tests/avocado/machine_aarch64_sbsaref.py: allow for rw usage of image Thomas Huth
2024-09-04 10:38 ` [PULL 04/42] Bump avocado to 103.0 Thomas Huth
2024-09-04 10:38 ` [PULL 05/42] tests/avocado/avocado_qemu: Fix the "from" statements in linuxtest.py Thomas Huth
2024-09-04 10:38 ` [PULL 06/42] tests/avocado/boot_linux_console: Remove the s390x subtest Thomas Huth
2024-09-04 10:38 ` [PULL 07/42] python: Install pycotap in our venv if necessary Thomas Huth
2024-09-04 10:38 ` [PULL 08/42] tests/functional: Add base classes for the upcoming pytest-based tests Thomas Huth
2024-09-04 10:38 ` [PULL 09/42] tests/functional: Set up logging Thomas Huth
2024-09-04 10:38 ` [PULL 10/42] tests/Makefile.include: Increase the level of indentation in the help text Thomas Huth
2024-09-04 10:38 ` [PULL 11/42] tests/functional: Prepare the meson build system for the functional tests Thomas Huth
2024-09-04 10:38 ` [PULL 12/42] tests/functional: Convert simple avocado tests into standalone python tests Thomas Huth
2024-09-04 10:38 ` [PULL 13/42] tests/functional: Convert avocado tests that just need a small adjustment Thomas Huth
2024-09-04 10:38 ` [PULL 14/42] tests/functional: add a module for handling asset download & caching Thomas Huth
2024-09-04 10:38 ` [PULL 15/42] tests/functional: enable pre-emptive caching of assets Thomas Huth
2024-11-26 16:44   ` Philippe Mathieu-Daudé
2024-11-26 16:45     ` Peter Maydell
2024-11-26 17:26       ` Daniel P. Berrangé
2024-11-26 17:31     ` Daniel P. Berrangé
2024-11-26 17:46       ` Peter Maydell
2024-11-26 17:52         ` Thomas Huth
2024-11-26 17:56           ` Daniel P. Berrangé
2024-11-26 21:17             ` Peter Maydell
2024-11-26 22:54           ` Richard Henderson
2024-11-27  6:29             ` Thomas Huth
2024-11-27 18:02               ` Richard Henderson
2024-11-28  9:54                 ` Thomas Huth
2024-11-28  9:58                   ` Daniel P. Berrangé
2024-11-27  9:06             ` Daniel P. Berrangé
2024-11-27 18:31               ` Pierrick Bouvier
2024-11-28  9:34                 ` Daniel P. Berrangé
2024-11-28 17:25                   ` Pierrick Bouvier
2024-11-28 17:57                     ` Daniel P. Berrangé
2024-09-04 10:38 ` [PULL 16/42] tests/functional: Allow asset downloading with concurrent threads Thomas Huth
2024-09-04 10:38 ` [PULL 17/42] tests/functional: Convert some tests that download files via fetch_asset() Thomas Huth
2024-09-04 10:38 ` [PULL 18/42] tests/functional: Add a function for extracting files from an archive Thomas Huth
2024-09-04 10:38 ` [PULL 19/42] tests/functional: Convert some avocado tests that needed avocado.utils.archive Thomas Huth
2024-09-04 10:38 ` [PULL 20/42] tests/functional: Convert the s390x avocado tests into standalone tests Thomas Huth
2024-09-04 10:38 ` [PULL 21/42] tests/functional: Convert the x86_cpu_model_versions test Thomas Huth
2024-09-04 10:38 ` [PULL 22/42] tests/functional: Convert the microblaze avocado tests into standalone tests Thomas Huth
2024-09-04 10:38 ` [PULL 23/42] tests/functional: Convert the virtio_gpu avocado test into a standalone test Thomas Huth
2024-09-04 10:38 ` [PULL 24/42] tests/functional: Convert most ppc avocado tests into standalone tests Thomas Huth
2024-09-04 10:39 ` [PULL 25/42] tests/functional: Convert the ppc_amiga avocado test into a standalone test Thomas Huth
2024-09-04 10:39 ` Thomas Huth [this message]
2024-09-04 10:39 ` [PULL 27/42] tests/functional: Convert the m68k nextcube test with tesseract Thomas Huth
2024-09-04 10:39 ` [PULL 28/42] tests/functional: Convert the acpi-bits test into a standalone test Thomas Huth
2024-09-04 10:39 ` [PULL 29/42] tests/functional: Convert the rx_gdbsim avocado " Thomas Huth
2024-09-04 10:39 ` [PULL 30/42] tests/functional: Convert the linux_initrd " Thomas Huth
2024-09-04 10:39 ` [PULL 31/42] tests/functional: Convert ARM Integrator/CP avocado tests Thomas Huth
2024-09-04 10:39 ` [PULL 32/42] tests/functional: Convert Aarch64 SBSA-Ref " Thomas Huth
2024-09-04 10:39 ` [PULL 33/42] tests/functional: Convert Aarch64 Virt machine " Thomas Huth
2024-09-04 10:39 ` [PULL 34/42] tests/functional: Convert mips64el Fuloong2e avocado test (1/2) Thomas Huth
2024-09-04 10:39 ` [PULL 35/42] tests/functional: Add QemuUserTest class Thomas Huth
2024-09-04 10:39 ` [PULL 36/42] tests/functional: Convert ARM bFLT linux-user avocado test Thomas Huth
2024-09-04 10:39 ` [PULL 37/42] tests/avocado: Remove unused QemuUserTest class Thomas Huth
2024-09-04 10:39 ` [PULL 38/42] gitlab-ci: Add "check-functional" to the build tests Thomas Huth
2024-09-04 10:39 ` [PULL 39/42] docs/devel: Split testing docs from the build docs and move to separate folder Thomas Huth
2024-09-04 10:39 ` [PULL 40/42] docs/devel/testing: Split the Avocado documentation into a separate file Thomas Huth
2024-09-04 10:39 ` [PULL 41/42] docs/devel/testing: Rename avocado_qemu.Test class Thomas Huth
2024-09-04 10:39 ` [PULL 42/42] docs/devel/testing: Add documentation for functional tests Thomas Huth
2024-09-06 11:32 ` [PULL 00/42] Introduce new functional test framework Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240904103923.451847-27-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).