Skip to content

Commit aa0066d

Browse files
committed
qemu: Convert qemu-g5 to use qemu_main()
1 parent 73ddc0d commit aa0066d

1 file changed

Lines changed: 9 additions & 41 deletions

File tree

scripts/boot/qemu-g5

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,56 +20,24 @@
2020
# export ROOT_DISK_PATH=~/some/directory
2121
# Expects ppc64-rootfs.cpio.gz in ROOT_DISK_PATH
2222

23-
import logging
2423
import os, sys
2524
sys.path.append(f'{os.path.dirname(sys.argv[0])}/../../lib')
2625

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
3028

3129

3230
def main():
3331
setup_logging()
34-
setup_timeout(60)
3532

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'
3938

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()
7340

41+
return qemu_main(qconf)
7442

7543
sys.exit(0 if main() else 1)

0 commit comments

Comments
 (0)