xref: /qemu/tests/functional/test_ppc_40p.py (revision 407a688315d0d23af20e3b8beb020a97828140eb)
1*407a6883SThomas Huth#!/usr/bin/env python3
2*407a6883SThomas Huth#
3*407a6883SThomas Huth# Functional test that boots a PReP/40p machine and checks its serial console.
4*407a6883SThomas Huth#
5*407a6883SThomas Huth# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
6*407a6883SThomas Huth#
7*407a6883SThomas Huth# This work is licensed under the terms of the GNU GPL, version 2 or
8*407a6883SThomas Huth# later. See the COPYING file in the top-level directory.
9*407a6883SThomas Huth
10*407a6883SThomas Huthimport os
11*407a6883SThomas Huth
12*407a6883SThomas Huthfrom unittest import skipUnless
13*407a6883SThomas Huthfrom qemu_test import QemuSystemTest, Asset
14*407a6883SThomas Huthfrom qemu_test import wait_for_console_pattern
15*407a6883SThomas Huth
16*407a6883SThomas Huth
17*407a6883SThomas Huthclass IbmPrep40pMachine(QemuSystemTest):
18*407a6883SThomas Huth
19*407a6883SThomas Huth    timeout = 60
20*407a6883SThomas Huth
21*407a6883SThomas Huth    ASSET_BIOS = Asset(
22*407a6883SThomas Huth        ('http://ftpmirror.your.org/pub/misc/'
23*407a6883SThomas Huth         'ftp.software.ibm.com/rs6000/firmware/'
24*407a6883SThomas Huth         '7020-40p/P12H0456.IMG'),
25*407a6883SThomas Huth        'd957f79c73f760d1455d2286fcd901ed6d06167320eb73511b478a939be25b3f')
26*407a6883SThomas Huth    ASSET_NETBSD40 = Asset(
27*407a6883SThomas Huth        ('https://archive.netbsd.org/pub/NetBSD-archive/'
28*407a6883SThomas Huth         'NetBSD-4.0/prep/installation/floppy/generic_com0.fs'),
29*407a6883SThomas Huth        'f86236e9d01b3f0dd0f5d3b8d5bbd40c68e78b4db560a108358f5ad58e636619')
30*407a6883SThomas Huth    ASSET_NETBSD71 = Asset(
31*407a6883SThomas Huth        ('https://archive.netbsd.org/pub/NetBSD-archive/'
32*407a6883SThomas Huth         'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso'),
33*407a6883SThomas Huth        'cc7cb290b06aaa839362deb7bd9f417ac5015557db24088508330f76c3f825ec')
34*407a6883SThomas Huth
35*407a6883SThomas Huth    # 12H0455 PPS Firmware Licensed Materials
36*407a6883SThomas Huth    # Property of IBM (C) Copyright IBM Corp. 1994.
37*407a6883SThomas Huth    # All rights reserved.
38*407a6883SThomas Huth    # U.S. Government Users Restricted Rights - Use, duplication or disclosure
39*407a6883SThomas Huth    # restricted by GSA ADP Schedule Contract with IBM Corp.
40*407a6883SThomas Huth    @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
41*407a6883SThomas Huth    def test_factory_firmware_and_netbsd(self):
42*407a6883SThomas Huth        self.set_machine('40p')
43*407a6883SThomas Huth        self.require_accelerator("tcg")
44*407a6883SThomas Huth        bios_path = self.ASSET_BIOS.fetch()
45*407a6883SThomas Huth        drive_path = self.ASSET_NETBSD40.fetch()
46*407a6883SThomas Huth
47*407a6883SThomas Huth        self.vm.set_console()
48*407a6883SThomas Huth        self.vm.add_args('-bios', bios_path,
49*407a6883SThomas Huth                         '-fda', drive_path)
50*407a6883SThomas Huth        self.vm.launch()
51*407a6883SThomas Huth        os_banner = 'NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:49:40 PST 2007'
52*407a6883SThomas Huth        wait_for_console_pattern(self, os_banner)
53*407a6883SThomas Huth        wait_for_console_pattern(self, 'Model: IBM PPS Model 6015')
54*407a6883SThomas Huth
55*407a6883SThomas Huth    def test_openbios_192m(self):
56*407a6883SThomas Huth        self.set_machine('40p')
57*407a6883SThomas Huth        self.require_accelerator("tcg")
58*407a6883SThomas Huth        self.vm.set_console()
59*407a6883SThomas Huth        self.vm.add_args('-m', '192') # test fw_cfg
60*407a6883SThomas Huth
61*407a6883SThomas Huth        self.vm.launch()
62*407a6883SThomas Huth        wait_for_console_pattern(self, '>> OpenBIOS')
63*407a6883SThomas Huth        wait_for_console_pattern(self, '>> Memory: 192M')
64*407a6883SThomas Huth        wait_for_console_pattern(self, '>> CPU type PowerPC,604')
65*407a6883SThomas Huth
66*407a6883SThomas Huth    def test_openbios_and_netbsd(self):
67*407a6883SThomas Huth        self.set_machine('40p')
68*407a6883SThomas Huth        self.require_accelerator("tcg")
69*407a6883SThomas Huth        drive_path = self.ASSET_NETBSD71.fetch()
70*407a6883SThomas Huth        self.vm.set_console()
71*407a6883SThomas Huth        self.vm.add_args('-cdrom', drive_path,
72*407a6883SThomas Huth                         '-boot', 'd')
73*407a6883SThomas Huth
74*407a6883SThomas Huth        self.vm.launch()
75*407a6883SThomas Huth        wait_for_console_pattern(self, 'NetBSD/prep BOOT, Revision 1.9')
76*407a6883SThomas Huth
77*407a6883SThomas Huthif __name__ == '__main__':
78*407a6883SThomas Huth    QemuSystemTest.main()
79