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