1#!/usr/bin/env python3
2#
3# Smoke tests for 74xx cpus (aka G4).
4#
5# Copyright (c) 2021, IBM Corp.
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
11from qemu_test import wait_for_console_pattern
12
13class ppc74xxCpu(QemuSystemTest):
14
15    timeout = 5
16
17    def test_ppc_7400(self):
18        self.require_accelerator("tcg")
19        self.set_machine('g3beige')
20        self.vm.set_console()
21        self.vm.add_args('-cpu', '7400')
22        self.vm.launch()
23        wait_for_console_pattern(self, '>> OpenBIOS')
24        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
25
26    def test_ppc_7410(self):
27        self.require_accelerator("tcg")
28        self.set_machine('g3beige')
29        self.vm.set_console()
30        self.vm.add_args('-cpu', '7410')
31        self.vm.launch()
32        wait_for_console_pattern(self, '>> OpenBIOS')
33        wait_for_console_pattern(self, '>> CPU type PowerPC,74xx')
34
35    def test_ppc_7441(self):
36        self.require_accelerator("tcg")
37        self.set_machine('g3beige')
38        self.vm.set_console()
39        self.vm.add_args('-cpu', '7441')
40        self.vm.launch()
41        wait_for_console_pattern(self, '>> OpenBIOS')
42        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
43
44    def test_ppc_7445(self):
45        self.require_accelerator("tcg")
46        self.set_machine('g3beige')
47        self.vm.set_console()
48        self.vm.add_args('-cpu', '7445')
49        self.vm.launch()
50        wait_for_console_pattern(self, '>> OpenBIOS')
51        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
52
53    def test_ppc_7447(self):
54        self.require_accelerator("tcg")
55        self.set_machine('g3beige')
56        self.vm.set_console()
57        self.vm.add_args('-cpu', '7447')
58        self.vm.launch()
59        wait_for_console_pattern(self, '>> OpenBIOS')
60        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
61
62    def test_ppc_7447a(self):
63        self.require_accelerator("tcg")
64        self.set_machine('g3beige')
65        self.vm.set_console()
66        self.vm.add_args('-cpu', '7447a')
67        self.vm.launch()
68        wait_for_console_pattern(self, '>> OpenBIOS')
69        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
70
71    def test_ppc_7448(self):
72        self.require_accelerator("tcg")
73        self.set_machine('g3beige')
74        self.vm.set_console()
75        self.vm.add_args('-cpu', '7448')
76        self.vm.launch()
77        wait_for_console_pattern(self, '>> OpenBIOS')
78        wait_for_console_pattern(self, '>> CPU type PowerPC,MPC86xx')
79
80    def test_ppc_7450(self):
81        self.require_accelerator("tcg")
82        self.set_machine('g3beige')
83        self.vm.set_console()
84        self.vm.add_args('-cpu', '7450')
85        self.vm.launch()
86        wait_for_console_pattern(self, '>> OpenBIOS')
87        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
88
89    def test_ppc_7451(self):
90        self.require_accelerator("tcg")
91        self.set_machine('g3beige')
92        self.vm.set_console()
93        self.vm.add_args('-cpu', '7451')
94        self.vm.launch()
95        wait_for_console_pattern(self, '>> OpenBIOS')
96        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
97
98    def test_ppc_7455(self):
99        self.require_accelerator("tcg")
100        self.set_machine('g3beige')
101        self.vm.set_console()
102        self.vm.add_args('-cpu', '7455')
103        self.vm.launch()
104        wait_for_console_pattern(self, '>> OpenBIOS')
105        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
106
107    def test_ppc_7457(self):
108        self.require_accelerator("tcg")
109        self.set_machine('g3beige')
110        self.vm.set_console()
111        self.vm.add_args('-cpu', '7457')
112        self.vm.launch()
113        wait_for_console_pattern(self, '>> OpenBIOS')
114        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
115
116    def test_ppc_7457a(self):
117        self.require_accelerator("tcg")
118        self.set_machine('g3beige')
119        self.vm.set_console()
120        self.vm.add_args('-cpu', '7457a')
121        self.vm.launch()
122        wait_for_console_pattern(self, '>> OpenBIOS')
123        wait_for_console_pattern(self, '>> CPU type PowerPC,G4')
124
125if __name__ == '__main__':
126    QemuSystemTest.main()
127