@@ -28,58 +28,27 @@ import logging
2828import os , sys
2929sys .path .append (f'{ os .path .dirname (sys .argv [0 ])} /../../lib' )
3030
31- from qemu import qemu_command , qemu_net_setup
32- from pexpect_utils import *
33- from utils import *
31+ from qemu import QemuConfig , qemu_main
32+ from utils import setup_logging
3433
3534
3635def main ():
3736 setup_logging ()
38- setup_timeout (60 )
3937
40- expected_release = get_expected_release ()
41- if expected_release is None :
42- return False
43-
44- vmlinux = get_vmlinux ()
45- if vmlinux is None :
46- return False
38+ qconf = QemuConfig ('ppce500' )
39+ qconf .configure_from_env ()
40+ qconf .configure_from_args (sys .argv [1 :])
41+ qconf .qemu_path = 'qemu-system-ppc64'
42+ qconf .net_tests = False
43+ qconf .mem = '4G'
44+ qconf .smp = 1
45+ qconf .cpu = 'e5500'
4746
4847 if os .environ .get ('COMPAT_USERSPACE' , False ):
49- initrd = 'ppc-rootfs.cpio.gz'
50- else :
51- initrd = 'ppc64-novsx-rootfs.cpio.gz'
52-
53- p = PexpectHelper ()
54- cmd = qemu_command (vmlinux = vmlinux , machine = 'ppce500' , cpu = 'e5500' ,
55- mem = '4G' , initrd = initrd , cmdline = 'noreboot' )
56- p .spawn (cmd , logfile = open ('console.log' , 'w' ))
57-
58- standard_boot (p )
59-
60- p .send ("echo -n 'booted-revision: '; uname -r" )
61- p .expect (f'booted-revision: { expected_release } ' )
62- p .expect_prompt ()
63-
64- p .send ('cat /proc/cpuinfo' )
65- p .expect ("QEMU ppce500" )
66- p .expect_prompt ()
67-
68- if os .environ .get ('QEMU_NET_TESTS' , True ) != '0' :
69- qemu_net_setup (p )
70- ping_test (p , check = False )
71- wget_test (p )
72-
73- p .send ('poweroff' )
74- p .wait_for_exit ()
75-
76- if filter_log_warnings (open ('console.log' ), open ('warnings.txt' , 'w' )):
77- logging .error ('Errors/warnings seen in console.log' )
78- return False
79-
80- logging .info ('Test completed OK' )
48+ qconf .initrd = 'ppc-rootfs.cpio.gz'
8149
82- return True
50+ qconf . apply_defaults ()
8351
52+ return qemu_main (qconf )
8453
8554sys .exit (0 if main () else 1 )
0 commit comments