diff test/testemulation.py @ 366:39bf68bf1891

Fix sample tests and deterministic build
author Windel Bouwman
date Fri, 21 Mar 2014 09:43:01 +0100
parents c49459768aaa
children 5333318ee33d
line wrap: on
line diff
--- a/test/testemulation.py	Wed Mar 19 22:32:04 2014 +0100
+++ b/test/testemulation.py	Fri Mar 21 09:43:01 2014 +0100
@@ -23,26 +23,28 @@
         pass
 
     # Listen to the control socket:
-    qemu_control = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-    qemu_control.bind('qemucontrol.sock')
-    qemu_control.listen(0)
+    qemu_control_serve = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+    qemu_control_serve.bind('qemucontrol.sock')
+    qemu_control_serve.listen(0)
 
     # Listen to the serial output:
-    qemu_serial = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-    qemu_serial.bind('qemuserial.sock')
-    qemu_serial.listen(0)
+    qemu_serial_serve = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+    qemu_serial_serve.bind('qemuserial.sock')
+    qemu_serial_serve.listen(0)
 
     args = ['qemu-system-arm', '-M', machine, '-m', '16M',
         '-nographic', '-kernel', kernel, '-monitor',
         'unix:qemucontrol.sock',
         '-serial', 'unix:qemuserial.sock', '-S']
-    p = subprocess.Popen(args)
-        #stdout=subprocess.DEVNULL,
-        #stderr=subprocess.DEVNULL)
+    p = subprocess.Popen(args,
+        stdout=subprocess.DEVNULL,
+        stderr=subprocess.DEVNULL)
 
     # Give process some time to boot:
-    qemu_serial, address_peer = qemu_serial.accept()
-    qemu_control, address_peer = qemu_control.accept()
+    qemu_serial, address_peer = qemu_serial_serve.accept()
+    qemu_control, address_peer = qemu_control_serve.accept()
+
+    # Give the go command:
     qemu_control.send('cont\n'.encode('ascii'))
 
     qemu_serial.settimeout(0.2)
@@ -63,9 +65,10 @@
         p.wait(timeout=3)
     except subprocess.TimeoutExpired:
         p.kill()
-        print(p.communicate())
     qemu_control.close()
     qemu_serial.close()
+    qemu_control_serve.close()
+    qemu_serial_serve.close()
 
     try:
         os.remove('qemucontrol.sock')