[pypy-commit] pypy default: Improve the test: checks that at least 500 recursion levels work.

arigo noreply at buildbot.pypy.org
Sun Aug 5 11:48:27 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r56581:6a9d0f284578
Date: 2012-08-05 11:48 +0200
http://bitbucket.org/pypy/pypy/changeset/6a9d0f284578/

Log:	Improve the test: checks that at least 500 recursion levels work.

diff --git a/pypy/translator/c/test/test_standalone.py b/pypy/translator/c/test/test_standalone.py
--- a/pypy/translator/c/test/test_standalone.py
+++ b/pypy/translator/c/test/test_standalone.py
@@ -722,7 +722,11 @@
     def test_inhibit_tail_call(self):
         # the point is to check that the f()->f() recursion stops
         from pypy.rlib.rstackovf import StackOverflow
+        class Glob:
+            pass
+        glob = Glob()
         def f(n):
+            glob.n = n
             if n <= 0:
                 return 42
             return f(n+1)
@@ -730,11 +734,14 @@
             try:
                 return f(1)
             except StackOverflow:
-                print 'hi!'
+                print 'hi!', glob.n
                 return 0
         t, cbuilder = self.compile(entry_point, stackcheck=True)
         out = cbuilder.cmdexec("")
-        assert out.strip() == "hi!"
+        text = out.strip()
+        assert text.startswith("hi! ")
+        n = int(text[4:])
+        assert n > 500 and n < 5000000
 
     def test_set_length_fraction(self):
         # check for pypy.rlib.rstack._stack_set_length_fraction()


More information about the pypy-commit mailing list