[pypy-commit] pypy jit-settrace: Added a test

alex_gaynor noreply at buildbot.pypy.org
Thu Oct 24 22:58:28 CEST 2013


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: jit-settrace
Changeset: r67584:849ecbc3d133
Date: 2013-10-24 13:57 -0700
http://bitbucket.org/pypy/pypy/changeset/849ecbc3d133/

Log:	Added a test

diff --git a/pypy/module/pypyjit/test_pypy_c/test_min_max.py b/pypy/module/pypyjit/test_pypy_c/test_min_max.py
--- a/pypy/module/pypyjit/test_pypy_c/test_min_max.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_min_max.py
@@ -1,8 +1,7 @@
-import py
 from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
 
+
 class TestMinMax(BaseTestPyPyC):
-
     def test_min_max(self):
         def main():
             i=0
@@ -24,7 +23,6 @@
             --TICK--
             jump(..., descr=...)
         """)
-        
 
     def test_silly_max(self):
         def main():
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -408,3 +408,20 @@
         log = self.run(main, [300])
         loop, = log.loops_by_id("long_op")
         assert len(loop.ops_by_id("long_op")) == 0
+
+    def test_settrace(self):
+        def main(n):
+            import sys
+            sys.settrace(lambda *args, **kwargs: None)
+
+            def f():
+                return 1
+
+            while n:
+                n -= f()
+
+        log = self.run(main, [300])
+        loops = log.loops_by_filename(self.filepath)
+        # the following assertion fails if the loop was cancelled due
+        # to "abort: vable escape"
+        assert len(loops) == 1


More information about the pypy-commit mailing list