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 10from qemu_test import QemuSystemTest, Asset 11from qemu_test import wait_for_console_pattern, skipUntrustedTest 12from qemu_test import exec_command_and_wait_for_pattern 13 14 15class IbmPrep40pMachine(QemuSystemTest): 16 17 timeout = 60 18 19 ASSET_BIOS = Asset( 20 ('http://ftpmirror.your.org/pub/misc/' 21 'ftp.software.ibm.com/rs6000/firmware/' 22 '7020-40p/P12H0456.IMG'), 23 'd957f79c73f760d1455d2286fcd901ed6d06167320eb73511b478a939be25b3f') 24 ASSET_NETBSD40 = Asset( 25 ('https://archive.netbsd.org/pub/NetBSD-archive/' 26 'NetBSD-4.0/prep/installation/floppy/generic_com0.fs'), 27 'f86236e9d01b3f0dd0f5d3b8d5bbd40c68e78b4db560a108358f5ad58e636619') 28 ASSET_NETBSD71 = Asset( 29 ('https://archive.netbsd.org/pub/NetBSD-archive/' 30 'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso'), 31 'cc7cb290b06aaa839362deb7bd9f417ac5015557db24088508330f76c3f825ec') 32 33 # 12H0455 PPS Firmware Licensed Materials 34 # Property of IBM (C) Copyright IBM Corp. 1994. 35 # All rights reserved. 36 # U.S. Government Users Restricted Rights - Use, duplication or disclosure 37 # restricted by GSA ADP Schedule Contract with IBM Corp. 38 @skipUntrustedTest() 39 def test_factory_firmware_and_netbsd(self): 40 self.set_machine('40p') 41 self.require_accelerator("tcg") 42 bios_path = self.ASSET_BIOS.fetch() 43 drive_path = self.ASSET_NETBSD40.fetch() 44 45 self.vm.set_console() 46 self.vm.add_args('-bios', bios_path, 47 '-drive', 48 f"file={drive_path},format=raw,if=floppy,read-only=true") 49 self.vm.launch() 50 os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007' 51 wait_for_console_pattern(self, os_banner) 52 wait_for_console_pattern(self, 'Model: IBM PPS Model 6015') 53 54 def test_openbios_192m(self): 55 self.set_machine('40p') 56 self.require_accelerator("tcg") 57 self.vm.set_console() 58 self.vm.add_args('-m', '192') # test fw_cfg 59 60 self.vm.launch() 61 wait_for_console_pattern(self, '>> OpenBIOS') 62 wait_for_console_pattern(self, '>> Memory: 192M') 63 wait_for_console_pattern(self, '>> CPU type PowerPC,604') 64 65 def test_openbios_and_netbsd(self): 66 self.set_machine('40p') 67 self.require_accelerator("tcg") 68 drive_path = self.ASSET_NETBSD71.fetch() 69 self.vm.set_console() 70 self.vm.add_args('-cdrom', drive_path, 71 '-boot', 'd') 72 73 self.vm.launch() 74 wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9') 75 76 ASSET_40P_SANDALFOOT = Asset( 77 'http://www.juneau-lug.org/zImage.initrd.sandalfoot', 78 '749ab02f576c6dc8f33b9fb022ecb44bf6a35a0472f2ea6a5e9956bc15933901') 79 80 def test_openbios_and_linux(self): 81 self.set_machine('40p') 82 self.require_accelerator("tcg") 83 drive_path = self.ASSET_40P_SANDALFOOT.fetch() 84 self.vm.set_console() 85 self.vm.add_args('-cdrom', drive_path, 86 '-boot', 'd') 87 88 self.vm.launch() 89 wait_for_console_pattern(self, 'Please press Enter to activate this console.') 90 exec_command_and_wait_for_pattern(self, '\012', '#') 91 exec_command_and_wait_for_pattern(self, 'uname -a', 'Linux ppc 2.4.18') 92 93if __name__ == '__main__': 94 QemuSystemTest.main() 95