[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 19/24] tests/functional: Convert the ppc_amiga avocado test in
From: |
Daniel P . Berrangé |
Subject: |
[PATCH v3 19/24] tests/functional: Convert the ppc_amiga avocado test into a standalone test |
Date: |
Tue, 30 Jul 2024 18:03:39 +0100 |
From: Thomas Huth <thuth@redhat.com>
Use the Python standard zipfile module instead of avocado.utils for
extracting the ZIP file that we download here, and use the standard
subprocess module for running the "tail" command.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/avocado/ppc_amiga.py | 38 ---------------------------
tests/functional/meson.build | 1 +
tests/functional/test_ppc_amiga.py | 42 ++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 38 deletions(-)
delete mode 100644 tests/avocado/ppc_amiga.py
create mode 100755 tests/functional/test_ppc_amiga.py
diff --git a/tests/avocado/ppc_amiga.py b/tests/avocado/ppc_amiga.py
deleted file mode 100644
index b6f866f91d..0000000000
--- a/tests/avocado/ppc_amiga.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# Test AmigaNG boards
-#
-# Copyright (c) 2023 BALATON Zoltan
-#
-# 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.utils import archive
-from avocado.utils import process
-from avocado_qemu import QemuSystemTest
-from avocado_qemu import wait_for_console_pattern
-
-class AmigaOneMachine(QemuSystemTest):
-
- timeout = 90
-
- def test_ppc_amigaone(self):
- """
- :avocado: tags=arch:ppc
- :avocado: tags=machine:amigaone
- :avocado: tags=device:articia
- :avocado: tags=accel:tcg
- """
- self.require_accelerator("tcg")
- tar_name = 'A1Firmware_Floppy_05-Mar-2005.zip'
- tar_url = ('https://www.hyperion-entertainment.com/index.php/'
- 'downloads?view=download&format=raw&file=25')
- tar_hash = 'c52e59bc73e31d8bcc3cc2106778f7ac84f6c755'
- zip_file = self.fetch_asset(tar_name, locations=tar_url,
- asset_hash=tar_hash)
- archive.extract(zip_file, self.workdir)
- cmd = f"tail -c 524288 {self.workdir}/floppy_edition/updater.image
>{self.workdir}/u-boot-amigaone.bin"
- process.run(cmd, shell=True)
-
- self.vm.set_console()
- self.vm.add_args('-bios', self.workdir + '/u-boot-amigaone.bin')
- self.vm.launch()
- wait_for_console_pattern(self, 'FLASH:')
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index b4f5c9e38e..fba3891e16 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -56,6 +56,7 @@ tests_ppc_quick = [
tests_ppc_thorough = [
'ppc_405',
'ppc_40p',
+ 'ppc_amiga',
'ppc_bamboo',
'ppc_mpc8544ds',
'ppc_virtex_ml507',
diff --git a/tests/functional/test_ppc_amiga.py
b/tests/functional/test_ppc_amiga.py
new file mode 100755
index 0000000000..8c356e1ba7
--- /dev/null
+++ b/tests/functional/test_ppc_amiga.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+#
+# Test AmigaNG boards
+#
+# Copyright (c) 2023 BALATON Zoltan
+#
+# 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 subprocess
+
+from qemu_test import QemuSystemTest, Asset
+from qemu_test import wait_for_console_pattern, run_cmd
+from zipfile import ZipFile
+
+class AmigaOneMachine(QemuSystemTest):
+
+ timeout = 90
+
+ ASSET_IMAGE = Asset(('https://www.hyperion-entertainment.com/index.php/'
+ 'downloads?view=download&format=raw&file=25'),
+ 'c52e59bc73e31d8bcc3cc2106778f7ac84f6c755')
+
+ def test_ppc_amigaone(self):
+ self.require_accelerator("tcg")
+ self.set_machine('amigaone')
+ tar_name = 'A1Firmware_Floppy_05-Mar-2005.zip'
+ zip_file = self.ASSET_IMAGE.fetch()
+ with ZipFile(zip_file, 'r') as zf:
+ zf.extractall(path=self.workdir)
+ bios_fh = open(self.workdir + "/u-boot-amigaone.bin", "wb")
+ subprocess.run(['tail', '-c', '524288',
+ self.workdir + "/floppy_edition/updater.image"],
+ stdout=bios_fh)
+
+ self.vm.set_console()
+ self.vm.add_args('-bios', self.workdir + '/u-boot-amigaone.bin')
+ self.vm.launch()
+ wait_for_console_pattern(self, 'FLASH:')
+
+if __name__ == '__main__':
+ QemuSystemTest.main()
--
2.45.2
- [PATCH v3 04/24] tests/Makefile.include: Increase the level of indentation in the help text, (continued)
- [PATCH v3 04/24] tests/Makefile.include: Increase the level of indentation in the help text, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 09/24] tests/functional: enable pre-emptive caching of assets, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 10/24] tests/functional: Convert some tests that download files via fetch_asset(), Daniel P . Berrangé, 2024/07/30
- [PATCH v3 11/24] tests/functional: Add a function for extracting files from an archive, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 12/24] tests/functional: Convert some avocado tests that needed avocado.utils.archive, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 13/24] tests/functional: Convert the s390x avocado tests into standalone tests, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 14/24] tests/functional: Convert the x86_cpu_model_versions test, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 15/24] tests/functional: Convert the microblaze avocado tests into standalone tests, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 16/24] tests/functional: Convert the riscv_opensbi avocado test into a standalone test, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 17/24] tests/functional: Convert the virtio_gpu avocado test into a standalone test, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 19/24] tests/functional: Convert the ppc_amiga avocado test into a standalone test,
Daniel P . Berrangé <=
- [PATCH v3 18/24] tests/functional: Convert most ppc avocado tests into standalone tests, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 20/24] tests/functional: Convert the ppc_hv avocado test into a standalone test, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 22/24] tests/functional: Convert the acpi-bits test into a standalone test, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 21/24] tests/functional: Convert the m68k nextcube test with tesseract, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 23/24] tests/functional: Convert the rx_gdbsim avocado test into a standalone test, Daniel P . Berrangé, 2024/07/30
- [PATCH v3 24/24] gitlab-ci: Add "check-functional" to the build tests, Daniel P . Berrangé, 2024/07/30
- Re: [PATCH v3 00/24] Convert avocado tests to normal Python unittests, Philippe Mathieu-Daudé, 2024/07/30