[pypy-svn] r70355 - pypy/branch/virtual-forcing/pypy/module/pypyjit/test

arigo at codespeak.net arigo at codespeak.net
Wed Dec 30 14:43:27 CET 2009


Author: arigo
Date: Wed Dec 30 14:43:26 2009
New Revision: 70355

Modified:
   pypy/branch/virtual-forcing/pypy/module/pypyjit/test/test_pypy_c.py
Log:
Verify the pypy-c passed as option to "--pypy":
it must have the jit, but not threads, because
for now the tests get confused with the extra
thread stuff.


Modified: pypy/branch/virtual-forcing/pypy/module/pypyjit/test/test_pypy_c.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/module/pypyjit/test/test_pypy_c.py	(original)
+++ pypy/branch/virtual-forcing/pypy/module/pypyjit/test/test_pypy_c.py	Wed Dec 30 14:43:26 2009
@@ -445,7 +445,27 @@
     def setup_class(cls):
         if option.pypy_c is None:
             py.test.skip("pass --pypy!")
+        if not has_info(option.pypy_c, 'translation.jit'):
+            py.test.skip("must give a pypy-c with the jit enabled")
+        if has_info(option.pypy_c, 'translation.thread'):
+            py.test.skip("for now, must give a pypy-c-jit without threads")
         cls.tmpdir = udir.join('pypy-jit')
         cls.tmpdir.ensure(dir=1)
         cls.counter = 0
         cls.pypy_c = option.pypy_c
+
+def has_info(pypy_c, option):
+    g = os.popen('"%s" --info' % pypy_c, 'r')
+    lines = g.readlines()
+    g.close()
+    for line in lines:
+        line = line.strip()
+        if line.startswith(option + ':'):
+            line = line[len(option)+1:].strip()
+            if line == 'True':
+                return True
+            elif line == 'False':
+                return False
+            else:
+                return line
+    raise ValueError(option + ' not found in ' + pypy_c)



More information about the Pypy-commit mailing list