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 13*8a6253a4SDaniel 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) 32cef1becbSThomas Huth bios_fh = open(self.workdir + "/u-boot-amigaone.bin", "wb") 33cef1becbSThomas Huth subprocess.run(['tail', '-c', '524288', 34cef1becbSThomas Huth self.workdir + "/floppy_edition/updater.image"], 35cef1becbSThomas Huth stdout=bios_fh) 36cef1becbSThomas Huth 37cef1becbSThomas Huth self.vm.set_console() 38cef1becbSThomas Huth self.vm.add_args('-bios', self.workdir + '/u-boot-amigaone.bin') 39cef1becbSThomas Huth self.vm.launch() 40cef1becbSThomas Huth wait_for_console_pattern(self, 'FLASH:') 41cef1becbSThomas Huth 42cef1becbSThomas Huthif __name__ == '__main__': 43cef1becbSThomas Huth QemuSystemTest.main() 44