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