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