xref: /qemu/tests/functional/test_ppc_amiga.py (revision beaf88c895a5eda649777757c80ab4171de777ff)
1#!/usr/bin/env python3
2#
3# Test AmigaNG boards
4#
5# Copyright (c) 2023 BALATON Zoltan
6#
7# This work is licensed under the terms of the GNU GPL, version 2 or
8# later.  See the COPYING file in the top-level directory.
9
10import subprocess
11
12from qemu_test import QemuSystemTest, Asset
13from qemu_test import wait_for_console_pattern
14from zipfile import ZipFile
15
16class AmigaOneMachine(QemuSystemTest):
17
18    timeout = 90
19
20    ASSET_IMAGE = Asset(
21        ('https://www.hyperion-entertainment.com/index.php/'
22         'downloads?view=download&format=raw&file=25'),
23        '8ff39330ba47d4f64de4ee8fd6809e9c010a9ef17fe51e95c3c1d53437cb481f')
24
25    def test_ppc_amigaone(self):
26        self.require_accelerator("tcg")
27        self.set_machine('amigaone')
28        tar_name = 'A1Firmware_Floppy_05-Mar-2005.zip'
29        zip_file = self.ASSET_IMAGE.fetch()
30        with ZipFile(zip_file, 'r') as zf:
31            zf.extractall(path=self.workdir)
32        bios = self.scratch_file("u-boot-amigaone.bin")
33        with open(bios, "wb") as bios_fh:
34            subprocess.run(['tail', '-c', '524288',
35                            self.scratch_file("floppy_edition",
36                                              "updater.image")],
37                           stdout=bios_fh)
38
39        self.vm.set_console()
40        self.vm.add_args('-bios', bios)
41        self.vm.launch()
42        wait_for_console_pattern(self, 'FLASH:')
43
44if __name__ == '__main__':
45    QemuSystemTest.main()
46