[pypy-svn] r62720 - in pypy/trunk/pypy/jit: . metainterp/test

arigo at codespeak.net arigo at codespeak.net
Sat Mar 7 18:25:46 CET 2009


Author: arigo
Date: Sat Mar  7 18:25:45 2009
New Revision: 62720

Added:
   pypy/trunk/pypy/jit/conftest.py   (contents, props changed)
Modified:
   pypy/trunk/pypy/jit/metainterp/test/test_zrpy_basic.py
Log:
Add a py.test option, "--slow", to run all the test_zrpy_*.
By default only one test is run, which should be enough to
catch most cases.


Added: pypy/trunk/pypy/jit/conftest.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/jit/conftest.py	Sat Mar  7 18:25:45 2009
@@ -0,0 +1,13 @@
+import py
+
+
+option = py.test.config.option
+
+class JitTestPlugin:
+    def pytest_addoption(self, parser):
+        group = parser.addgroup("JIT options")
+        group.addoption('--slow', action="store_true",
+               default=False, dest="run_slow_tests",
+               help="run all the compiled tests (instead of just a few)")
+
+ConftestPlugin = JitTestPlugin

Modified: pypy/trunk/pypy/jit/metainterp/test/test_zrpy_basic.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_zrpy_basic.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_zrpy_basic.py	Sat Mar  7 18:25:45 2009
@@ -2,10 +2,14 @@
 from pypy.jit.metainterp.warmspot import rpython_ll_meta_interp, ll_meta_interp
 from pypy.jit.metainterp.test import test_basic
 from pypy.rlib.jit import JitDriver
+from pypy.jit.conftest import option
+
 
 class TestBasic:
 
     def test_loop_1(self):
+        if not option.run_slow_tests:
+            py.test.skip("use --slow to execute this long-running test")
         jitdriver = JitDriver(greens = [], reds = ['i', 'total'])
         def f(i):
             total = 0
@@ -21,6 +25,7 @@
         assert res == 490
 
     def test_loop_2(self):
+        # this test runs even without the --slow option, to see at least one
         jitdriver = JitDriver(greens = [], reds = ['i', 'total'])
         def f(i):
             total = 0
@@ -39,9 +44,13 @@
 
 class LLInterpJitMixin:
     type_system = 'lltype'
-    meta_interp = staticmethod(rpython_ll_meta_interp)
     basic = False
 
+    def meta_interp(self, *args, **kwds):
+        if not option.run_slow_tests:
+            py.test.skip("use --slow to execute this long-running test")
+        return rpython_ll_meta_interp(*args, **kwds)
+
     def check_history(self, expected=None, **check):
         pass
     def check_loops(self, expected=None, **check):



More information about the Pypy-commit mailing list