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 14cef1becbSThomas Huthfrom zipfile import ZipFile 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' 29cef1becbSThomas Huth zip_file = self.ASSET_IMAGE.fetch() 30cef1becbSThomas Huth with ZipFile(zip_file, 'r') as zf: 31cef1becbSThomas Huth zf.extractall(path=self.workdir) 32*beaf88c8SDaniel P. Berrangé bios = self.scratch_file("u-boot-amigaone.bin") 33*beaf88c8SDaniel P. Berrangé with open(bios, "wb") as bios_fh: 34cef1becbSThomas Huth subprocess.run(['tail', '-c', '524288', 35*beaf88c8SDaniel P. Berrangé self.scratch_file("floppy_edition", 36*beaf88c8SDaniel P. Berrangé "updater.image")], 37cef1becbSThomas Huth stdout=bios_fh) 38cef1becbSThomas Huth 39cef1becbSThomas Huth self.vm.set_console() 40*beaf88c8SDaniel P. Berrangé self.vm.add_args('-bios', bios) 41cef1becbSThomas Huth self.vm.launch() 42cef1becbSThomas Huth wait_for_console_pattern(self, 'FLASH:') 43cef1becbSThomas Huth 44cef1becbSThomas Huthif __name__ == '__main__': 45cef1becbSThomas Huth QemuSystemTest.main() 46