qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Ani Sinha <anisinha@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	John Snow <jsnow@redhat.com>
Subject: [RFC PATCH 6/8] tests/pytest: Convert some tests that download files via fetch_asset()
Date: Thu, 11 Jul 2024 13:55:44 +0200	[thread overview]
Message-ID: <20240711115546.40859-7-thuth@redhat.com> (raw)
In-Reply-To: <20240711115546.40859-1-thuth@redhat.com>

Now that we've got a working fetch_asset() function, we can convert
some Avocado tests that use this function for downloading their
required files.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/pytest/meson.build                      | 16 +++++++++++++++
 .../test_machine_arm_n8x0.py}                 | 20 +++++++------------
 .../test_machine_avr6.py}                     |  7 ++-----
 .../test_machine_loongarch.py}                | 11 ++++------
 .../test_machine_mips_loongson3v.py}          | 19 ++++++------------
 5 files changed, 35 insertions(+), 38 deletions(-)
 rename tests/{avocado/machine_arm_n8x0.py => pytest/test_machine_arm_n8x0.py} (71%)
 rename tests/{avocado/machine_avr6.py => pytest/test_machine_avr6.py} (91%)
 rename tests/{avocado/machine_loongarch.py => pytest/test_machine_loongarch.py} (89%)
 rename tests/{avocado/machine_mips_loongson3v.py => pytest/test_machine_mips_loongson3v.py} (59%)

diff --git a/tests/pytest/meson.build b/tests/pytest/meson.build
index 1486628d45..d3607db362 100644
--- a/tests/pytest/meson.build
+++ b/tests/pytest/meson.build
@@ -8,6 +8,22 @@ pytests_generic = [
   'version',
 ]
 
+pytests_arm = [
+  'machine_arm_n8x0',
+]
+
+pytests_avr = [
+  'machine_avr6',
+]
+
+pytests_loongarch64 = [
+  'machine_loongarch',
+]
+
+pytests_mips64el = [
+  'machine_mips_loongson3v',
+]
+
 pytests_x86_64 = [
   'cpu_queries',
   'mem_addr_space',
diff --git a/tests/avocado/machine_arm_n8x0.py b/tests/pytest/test_machine_arm_n8x0.py
similarity index 71%
rename from tests/avocado/machine_arm_n8x0.py
rename to tests/pytest/test_machine_arm_n8x0.py
index 12e9a6803b..082284b975 100644
--- a/tests/avocado/machine_arm_n8x0.py
+++ b/tests/pytest/test_machine_arm_n8x0.py
@@ -10,9 +10,9 @@
 
 import os
 
-from avocado import skipUnless
-from avocado_qemu import QemuSystemTest
-from avocado_qemu import wait_for_console_pattern
+from unittest import skipUnless
+from qemu_pytest import QemuSystemTest
+from qemu_pytest import wait_for_console_pattern
 
 class N8x0Machine(QemuSystemTest):
     """Boots the Linux kernel and checks that the console is operational"""
@@ -32,18 +32,12 @@ def __do_test_n8x0(self):
         self.vm.launch()
         wait_for_console_pattern(self, 'TSC2005 driver initializing')
 
-    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+    @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
     def test_n800(self):
-        """
-        :avocado: tags=arch:arm
-        :avocado: tags=machine:n800
-        """
+        self.machine = 'n800'
         self.__do_test_n8x0()
 
-    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+    @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
     def test_n810(self):
-        """
-        :avocado: tags=arch:arm
-        :avocado: tags=machine:n810
-        """
+        self.machine = 'n810'
         self.__do_test_n8x0()
diff --git a/tests/avocado/machine_avr6.py b/tests/pytest/test_machine_avr6.py
similarity index 91%
rename from tests/avocado/machine_avr6.py
rename to tests/pytest/test_machine_avr6.py
index 5485db79c6..479038a221 100644
--- a/tests/avocado/machine_avr6.py
+++ b/tests/pytest/test_machine_avr6.py
@@ -19,16 +19,12 @@
 
 import time
 
-from avocado_qemu import QemuSystemTest
+from qemu_pytest import QemuSystemTest
 
 class AVR6Machine(QemuSystemTest):
     timeout = 5
 
     def test_freertos(self):
-        """
-        :avocado: tags=arch:avr
-        :avocado: tags=machine:arduino-mega-2560-v3
-        """
         """
         https://github.com/seharris/qemu-avr-tests/raw/master/free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf
         constantly prints out 'ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRSTUVWX'
@@ -39,6 +35,7 @@ def test_freertos(self):
         rom_hash = '7eb521f511ca8f2622e0a3c5e8dd686efbb911d4'
         rom_path = self.fetch_asset(rom_url, asset_hash=rom_hash)
 
+        self.machine = 'arduino-mega-2560-v3'
         self.vm.add_args('-bios', rom_path)
         self.vm.add_args('-nographic')
         self.vm.launch()
diff --git a/tests/avocado/machine_loongarch.py b/tests/pytest/test_machine_loongarch.py
similarity index 89%
rename from tests/avocado/machine_loongarch.py
rename to tests/pytest/test_machine_loongarch.py
index 8de308f2d6..3eb68745ac 100644
--- a/tests/avocado/machine_loongarch.py
+++ b/tests/pytest/test_machine_loongarch.py
@@ -5,9 +5,9 @@
 # Copyright (c) 2023 Loongson Technology Corporation Limited
 #
 
-from avocado_qemu import QemuSystemTest
-from avocado_qemu import exec_command_and_wait_for_pattern
-from avocado_qemu import wait_for_console_pattern
+from qemu_pytest import QemuSystemTest
+from qemu_pytest import exec_command_and_wait_for_pattern
+from qemu_pytest import wait_for_console_pattern
 
 class LoongArchMachine(QemuSystemTest):
     KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
@@ -21,10 +21,7 @@ def wait_for_console_pattern(self, success_message, vm=None):
 
     def test_loongarch64_devices(self):
 
-        """
-        :avocado: tags=arch:loongarch64
-        :avocado: tags=machine:virt
-        """
+        self.machine = 'virt'
 
         kernel_url = ('https://github.com/yangxiaojuan-loongson/qemu-binary/'
                       'releases/download/2024-05-30/vmlinuz.efi')
diff --git a/tests/avocado/machine_mips_loongson3v.py b/tests/pytest/test_machine_mips_loongson3v.py
similarity index 59%
rename from tests/avocado/machine_mips_loongson3v.py
rename to tests/pytest/test_machine_mips_loongson3v.py
index 5194cf18c9..189b22c04e 100644
--- a/tests/avocado/machine_mips_loongson3v.py
+++ b/tests/pytest/test_machine_mips_loongson3v.py
@@ -10,28 +10,21 @@
 import os
 import time
 
-from avocado import skipUnless
-from avocado_qemu import QemuSystemTest
-from avocado_qemu import wait_for_console_pattern
+from unittest import skipUnless
+from qemu_pytest import QemuSystemTest
+from qemu_pytest import wait_for_console_pattern
 
 class MipsLoongson3v(QemuSystemTest):
     timeout = 60
 
-    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+    @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
     def test_pmon_serial_console(self):
-        """
-        :avocado: tags=arch:mips64el
-        :avocado: tags=endian:little
-        :avocado: tags=machine:loongson3-virt
-        :avocado: tags=cpu:Loongson-3A1000
-        :avocado: tags=device:liointc
-        :avocado: tags=device:goldfish_rtc
-        """
+        self.machine = 'loongson3-virt'
 
         pmon_hash = '7c8b45dd81ccfc55ff28f5aa267a41c3'
         pmon_path = self.fetch_asset('https://github.com/loongson-community/pmon/'
                                     'releases/download/20210112/pmon-3avirt.bin',
-                                     asset_hash=pmon_hash, algorithm='md5')
+                                     asset_hash=pmon_hash)
 
         self.vm.set_console()
         self.vm.add_args('-bios', pmon_path)
-- 
2.45.2



  parent reply	other threads:[~2024-07-11 11:57 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 11:55 [RFC PATCH 0/8] Convert avocado tests to normal Python unittests Thomas Huth
2024-07-11 11:55 ` [RFC PATCH 1/8] tests/pytest: Add base classes for the upcoming pytest-based tests Thomas Huth
2024-07-12  8:50   ` Daniel P. Berrangé
2024-07-11 11:55 ` [RFC PATCH 2/8] tests/pytest: Convert some simple avocado tests into pytests Thomas Huth
2024-07-12  8:51   ` Daniel P. Berrangé
2024-07-11 11:55 ` [RFC PATCH 3/8] tests/pytest: Convert info_usernet and version test with small adjustments Thomas Huth
2024-07-12  8:55   ` Daniel P. Berrangé
2024-07-11 11:55 ` [RFC PATCH 4/8] tests/pytest: add pytest to the meson build system Thomas Huth
2024-07-12  9:01   ` Daniel P. Berrangé
2024-07-12 10:14     ` Thomas Huth
2024-07-12 10:26       ` Daniel P. Berrangé
2024-07-12 11:54         ` Thomas Huth
2024-07-12 11:47       ` Daniel P. Berrangé
2024-07-12 11:59         ` Thomas Huth
2024-07-11 11:55 ` [RFC PATCH 5/8] tests_pytest: Implement fetch_asset() method for downloading assets Thomas Huth
2024-07-11 16:45   ` Richard Henderson
2024-07-11 18:49     ` Richard Henderson
2024-07-11 19:23       ` Alex Bennée
2024-07-11 21:35         ` Richard Henderson
2024-07-12  4:24           ` Thomas Huth
2024-07-12  4:21       ` Thomas Huth
2024-07-12  4:18     ` Thomas Huth
2024-07-12  9:09   ` Daniel P. Berrangé
2024-07-12  9:26     ` Thomas Huth
2024-07-11 11:55 ` Thomas Huth [this message]
2024-07-12  9:11   ` [RFC PATCH 6/8] tests/pytest: Convert some tests that download files via fetch_asset() Daniel P. Berrangé
2024-07-11 11:55 ` [RFC PATCH 7/8] tests/pytest: Add a function for extracting files from an archive Thomas Huth
2024-07-12  9:14   ` Daniel P. Berrangé
2024-07-12 11:52     ` Thomas Huth
2024-07-12 11:56       ` Daniel P. Berrangé
2024-07-11 11:55 ` [RFC PATCH 8/8] tests/pytest: Convert avocado test that needed avocado.utils.archive Thomas Huth
2024-07-11 12:45 ` [RFC PATCH 0/8] Convert avocado tests to normal Python unittests Daniel P. Berrangé
2024-07-11 14:39 ` Fabiano Rosas
2024-07-11 17:44   ` Thomas Huth
2024-07-12  7:07     ` Daniel P. Berrangé
2024-07-12 14:25       ` Alex Bennée
2024-07-12 14:28         ` Daniel P. Berrangé
2024-07-16 16:45 ` John Snow
2024-07-16 18:03   ` Paolo Bonzini
2024-07-16 18:10     ` Daniel P. Berrangé
2024-07-16 19:34       ` Paolo Bonzini
2024-07-16 19:46         ` Daniel P. Berrangé
2024-07-17  7:32     ` Thomas Huth
2024-07-17  7:41       ` Paolo Bonzini
2024-07-17  6:21   ` Thomas Huth

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=20240711115546.40859-7-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=anisinha@redhat.com \
    --cc=berrange@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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).