diff test/testemulation.py @ 375:19eacf4f7270

Started on memory manager
author Windel Bouwman
date Sun, 23 Mar 2014 15:44:06 +0100
parents 68841f9ab96c
children 9667d78ba79e
line wrap: on
line diff
--- a/test/testemulation.py	Fri Mar 21 15:27:18 2014 +0100
+++ b/test/testemulation.py	Sun Mar 23 15:44:06 2014 +0100
@@ -4,6 +4,7 @@
 import subprocess
 import socket
 import time
+import shutil
 
 from testzcc import ZccBaseTestCase
 
@@ -16,9 +17,18 @@
     except OSError:
         pass
 
+qemu_app = 'qemu-system-arm'
+
+def has_qemu():
+    """ Determines if qemu is possible """
+    return bool(shutil.which(qemu_app))
+
+
 def runQemu(kernel, machine='lm3s811evb'):
     """ Runs qemu on a given kernel file """
 
+    if not has_qemu():
+        return ''
     tryrm('qemucontrol.sock')
     tryrm('qemuserial.sock')
 
@@ -32,7 +42,7 @@
     qemu_serial_serve.bind('qemuserial.sock')
     qemu_serial_serve.listen(0)
 
-    args = ['qemu-system-arm', '-M', machine, '-m', '16M',
+    args = [qemu_app, '-M', machine, '-m', '16M',
         '-nographic',
         '-kernel', kernel,
         '-monitor', 'unix:qemucontrol.sock',
@@ -86,8 +96,8 @@
 class EmulationTestCase(ZccBaseTestCase):
     """ Tests the compiler driver """
     def setUp(self):
-        if 'TESTEMU' not in os.environ:
-            self.skipTest('Not running emulation tests')
+        if not has_qemu():
+            self.skipTest('Not running Qemu test')
 
     def testM3Bare(self):
         """ Build bare m3 binary and emulate it """