[pypy-svn] r64604 - pypy/branch/pyjitpl5/pypy/jit/backend/test

arigo at codespeak.net arigo at codespeak.net
Thu Apr 23 17:41:15 CEST 2009


Author: arigo
Date: Thu Apr 23 17:41:15 2009
New Revision: 64604

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py
   pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
Log:
Do multiple runs of the test (15 by default).


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/conftest.py	Thu Apr 23 17:41:15 2009
@@ -23,5 +23,9 @@
                         dest="n_vars",
                         help="supply this many randomly-valued arguments to "
                              "the function")
+        group.addoption('--repeat', action="store", type="int",
+                        default=15,
+                        dest="repeat",
+                        help="run the test this many times"),
 
 ConftestPlugin = RandomRunnerPlugin

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py	Thu Apr 23 17:41:15 2009
@@ -161,8 +161,7 @@
 
 # ____________________________________________________________
 
-def test_random_function():
-    r = Random()
+def check_random_function(r):
     block_length = demo_conftest.option.block_length
     vars = [BoxInt(r.random_integer())
             for i in range(demo_conftest.option.n_vars)]
@@ -200,3 +199,12 @@
 
     for v in endvars:
         assert v.value == expected[v]
+
+    print '        # passed.'
+    print
+
+
+def test_random_function():
+    r = Random()
+    for i in range(demo_conftest.option.repeat):
+        check_random_function(r)



More information about the Pypy-commit mailing list