[pypy-svn] pypy default: This test got the answer small enough by chance, because the

arigo commits-noreply at bitbucket.org
Sun Dec 19 13:09:49 CET 2010


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r40128:658d0b72a42f
Date: 2010-12-19 13:09 +0100
http://bitbucket.org/pypy/pypy/changeset/658d0b72a42f/

Log:	This test got the answer small enough by chance, because the
	parameters were such that no bridge would be generated from the
	loop, but only from the entry bridge.  Multiplying the number of
	iterations through the loop by 10, we actually get the answer
	"5", which is ok too.  Added a comment about why it is ok too.

diff --git a/pypy/jit/backend/x86/test/test_ztranslation.py b/pypy/jit/backend/x86/test/test_ztranslation.py
--- a/pypy/jit/backend/x86/test/test_ztranslation.py
+++ b/pypy/jit/backend/x86/test/test_ztranslation.py
@@ -189,14 +189,14 @@
 
         @dont_look_inside
         def f(x, total):
-            if x <= 3:
+            if x <= 30:
                 raise ImDone(total * 10)
-            if x > 20:
+            if x > 200:
                 return 2
             raise ValueError
         @dont_look_inside
         def g(x):
-            if x > 15:
+            if x > 150:
                 raise ValueError
             return 2
         class Base:
@@ -207,7 +207,7 @@
                 return 1
         @dont_look_inside
         def h(x):
-            if x < 2000:
+            if x < 20000:
                 return Sub()
             else:
                 return Base()
@@ -238,8 +238,8 @@
         logfile = udir.join('test_ztranslation.log')
         os.environ['PYPYLOG'] = 'jit-log-opt:%s' % (logfile,)
         try:
-            res = self.meta_interp(main, [40])
-            assert res == main(40)
+            res = self.meta_interp(main, [400])
+            assert res == main(400)
         finally:
             del os.environ['PYPYLOG']
 
@@ -248,5 +248,7 @@
             if 'guard_class' in line:
                 guard_class += 1
         # if we get many more guard_classes, it means that we generate
-        # guards that always fail
-        assert 0 < guard_class <= 4
+        # guards that always fail (the following assert's original purpose
+        # is to catch the following case: each GUARD_CLASS is misgenerated
+        # and always fails with "gcremovetypeptr")
+        assert 0 < guard_class < 10


More information about the Pypy-commit mailing list