@@ -25,52 +25,20 @@ import logging
2525import os , sys
2626sys .path .append (f'{ os .path .dirname (sys .argv [0 ])} /../../lib' )
2727
28- from qemu import qemu_command , qemu_net_setup
29- from pexpect_utils import *
30- from utils import *
28+ from qemu import QemuConfig , qemu_main
29+ from utils import setup_logging
3130
3231
3332def main ():
3433 setup_logging ()
35- setup_timeout (60 )
3634
37- expected_release = get_expected_release ()
38- if expected_release is None :
39- return False
35+ qconf = QemuConfig ('mac99' )
36+ qconf .configure_from_env ()
37+ qconf .configure_from_args (sys .argv [1 :])
38+ qconf .smp = 1
39+ qconf .apply_defaults ()
4040
41- vmlinux = get_vmlinux ()
42- if vmlinux is None :
43- return False
44-
45- p = PexpectHelper ()
46- cmd = qemu_command (qemu = 'qemu-system-ppc' , machine = 'mac99' , vmlinux = vmlinux , cmdline = 'noreboot' )
47- p .spawn (cmd , logfile = open ('console.log' , 'w' ))
48-
49- standard_boot (p )
50-
51- p .send ("echo -n 'booted-revision: '; uname -r" )
52- p .expect (f'booted-revision: { expected_release } ' )
53- p .expect_prompt ()
54-
55- p .send ('cat /proc/cpuinfo' )
56- p .expect ('PowerMac3,1 MacRISC MacRISC2 Power Macintosh' )
57- p .expect_prompt ()
58-
59- if os .environ .get ('QEMU_NET_TESTS' , True ) != '0' :
60- qemu_net_setup (p )
61- ping_test (p )
62- wget_test (p )
63-
64- p .send ('halt' )
65- p .wait_for_exit ()
66-
67- if filter_log_warnings (open ('console.log' ), open ('warnings.txt' , 'w' )):
68- logging .error ('Errors/warnings seen in console.log' )
69- return False
70-
71- logging .info ('Test completed OK' )
72-
73- return True
41+ return qemu_main (qconf )
7442
7543
7644sys .exit (0 if main () else 1 )
0 commit comments