|
20 | 20 | # export ROOT_DISK_PATH=~/some/directory |
21 | 21 | # Expects ppc64-rootfs.cpio.gz in ROOT_DISK_PATH |
22 | 22 |
|
23 | | -import logging |
24 | 23 | import os, sys |
25 | 24 | sys.path.append(f'{os.path.dirname(sys.argv[0])}/../../lib') |
26 | 25 |
|
27 | | -from qemu import qemu_command, qemu_net_setup |
28 | | -from pexpect_utils import * |
29 | | -from utils import * |
| 26 | +from qemu import QemuConfig, qemu_main |
| 27 | +from utils import setup_logging |
30 | 28 |
|
31 | 29 |
|
32 | 30 | def main(): |
33 | 31 | setup_logging() |
34 | | - setup_timeout(60) |
35 | 32 |
|
36 | | - expected_release = get_expected_release() |
37 | | - if expected_release is None: |
38 | | - return False |
| 33 | + qconf = QemuConfig('mac99') |
| 34 | + qconf.configure_from_env() |
| 35 | + qconf.configure_from_args(sys.argv[1:]) |
| 36 | + qconf.machine_caps += ['via=pmu'] |
| 37 | + qconf.qemu_path = 'qemu-system-ppc64' |
39 | 38 |
|
40 | | - vmlinux = get_vmlinux() |
41 | | - if vmlinux is None: |
42 | | - return False |
43 | | - |
44 | | - p = PexpectHelper() |
45 | | - cmd = qemu_command(vmlinux=vmlinux, machine='mac99,via=pmu', cmdline='noreboot') |
46 | | - p.spawn(cmd, logfile=open('console.log', 'w')) |
47 | | - |
48 | | - standard_boot(p) |
49 | | - |
50 | | - p.send("echo -n 'booted-revision: '; uname -r") |
51 | | - p.expect(f'booted-revision: {expected_release}') |
52 | | - p.expect_prompt() |
53 | | - |
54 | | - p.send('cat /proc/cpuinfo') |
55 | | - p.expect("PowerMac3,1 MacRISC MacRISC2 Power Macintosh") |
56 | | - p.expect_prompt() |
57 | | - |
58 | | - if os.environ.get('QEMU_NET_TESTS', True) != '0': |
59 | | - qemu_net_setup(p) |
60 | | - ping_test(p) |
61 | | - wget_test(p) |
62 | | - |
63 | | - p.send("poweroff") |
64 | | - p.wait_for_exit() |
65 | | - |
66 | | - if filter_log_warnings(open('console.log'), open('warnings.txt', 'w')): |
67 | | - logging.error('Errors/warnings seen in console.log') |
68 | | - return False |
69 | | - |
70 | | - logging.info('Test completed OK') |
71 | | - |
72 | | - return True |
| 39 | + qconf.apply_defaults() |
73 | 40 |
|
| 41 | + return qemu_main(qconf) |
74 | 42 |
|
75 | 43 | sys.exit(0 if main() else 1) |
0 commit comments