1 #!/usr/bin/env python3 2 # 3 # Functional test that boots a PReP/40p machine and checks its serial console. 4 # 5 # Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org> 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 10 from qemu_test import QemuSystemTest, Asset 11 from qemu_test import wait_for_console_pattern, skipUntrustedTest 12 13 14 class IbmPrep40pMachine(QemuSystemTest): 15 16 timeout = 60 17 18 ASSET_BIOS = Asset( 19 ('http://ftpmirror.your.org/pub/misc/' 20 'ftp.software.ibm.com/rs6000/firmware/' 21 '7020-40p/P12H0456.IMG'), 22 'd957f79c73f760d1455d2286fcd901ed6d06167320eb73511b478a939be25b3f') 23 ASSET_NETBSD40 = Asset( 24 ('https://archive.netbsd.org/pub/NetBSD-archive/' 25 'NetBSD-4.0/prep/installation/floppy/generic_com0.fs'), 26 'f86236e9d01b3f0dd0f5d3b8d5bbd40c68e78b4db560a108358f5ad58e636619') 27 ASSET_NETBSD71 = Asset( 28 ('https://archive.netbsd.org/pub/NetBSD-archive/' 29 'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso'), 30 'cc7cb290b06aaa839362deb7bd9f417ac5015557db24088508330f76c3f825ec') 31 32 # 12H0455 PPS Firmware Licensed Materials 33 # Property of IBM (C) Copyright IBM Corp. 1994. 34 # All rights reserved. 35 # U.S. Government Users Restricted Rights - Use, duplication or disclosure 36 # restricted by GSA ADP Schedule Contract with IBM Corp. 37 @skipUntrustedTest() 38 def test_factory_firmware_and_netbsd(self): 39 self.set_machine('40p') 40 self.require_accelerator("tcg") 41 bios_path = self.ASSET_BIOS.fetch() 42 drive_path = self.ASSET_NETBSD40.fetch() 43 44 self.vm.set_console() 45 self.vm.add_args('-bios', bios_path, 46 '-drive', 47 f"file={drive_path},format=raw,if=floppy,read-only=true") 48 self.vm.launch() 49 os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007' 50 wait_for_console_pattern(self, os_banner) 51 wait_for_console_pattern(self, 'Model: IBM PPS Model 6015') 52 53 def test_openbios_192m(self): 54 self.set_machine('40p') 55 self.require_accelerator("tcg") 56 self.vm.set_console() 57 self.vm.add_args('-m', '192') # test fw_cfg 58 59 self.vm.launch() 60 wait_for_console_pattern(self, '>> OpenBIOS') 61 wait_for_console_pattern(self, '>> Memory: 192M') 62 wait_for_console_pattern(self, '>> CPU type PowerPC,604') 63 64 def test_openbios_and_netbsd(self): 65 self.set_machine('40p') 66 self.require_accelerator("tcg") 67 drive_path = self.ASSET_NETBSD71.fetch() 68 self.vm.set_console() 69 self.vm.add_args('-cdrom', drive_path, 70 '-boot', 'd') 71 72 self.vm.launch() 73 wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9') 74 75 if __name__ == '__main__': 76 QemuSystemTest.main() 77