xref: /qemu/tests/functional/test_ppc_amiga.py (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
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
14
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        self.archive_extract(self.ASSET_IMAGE, format="zip")
30        bios = self.scratch_file("u-boot-amigaone.bin")
31        with open(bios, "wb") as bios_fh:
32            subprocess.run(['tail', '-c', '524288',
33                            self.scratch_file("floppy_edition",
34                                              "updater.image")],
35                           stdout=bios_fh)
36
37        self.vm.set_console()
38        self.vm.add_args('-bios', bios)
39        self.vm.launch()
40        wait_for_console_pattern(self, 'FLASH:')
41
42if __name__ == '__main__':
43    QemuSystemTest.main()
44