[pypy-svn] r70427 - pypy/trunk/pypy/interpreter/test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Jan 7 15:05:34 CET 2010


Author: cfbolz
Date: Thu Jan  7 15:05:32 2010
New Revision: 70427

Modified:
   pypy/trunk/pypy/interpreter/test/test_pyframe.py
Log:
a test that fails when running apptests with a pypy-c-jit


Modified: pypy/trunk/pypy/interpreter/test/test_pyframe.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_pyframe.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_pyframe.py	Thu Jan  7 15:05:32 2010
@@ -369,3 +369,38 @@
         res = f(1)
         sys.settrace(None)
         assert res == 42
+
+class AppTestJitTraceInteraction(object):
+
+    def setup_class(cls):
+        from pypy import conftest
+        if not conftest.option.runappdirect:
+            py.test.skip("only for py.test -A")
+
+    def test_trace_while_blackholing(self):
+        import sys
+        l = []
+        def trace(frame, event, arg):
+            l.append((frame.f_code.co_name, event))
+            return trace
+        def g(i, x):
+            if i > x - 10:
+                print i
+            if i == x - 5:
+                sys.settrace(trace)
+
+        def f(x):
+            res = 0
+            for i in range(x):
+                res += i
+                g(i, x)
+
+        f(10)
+        sys.settrace(None)
+        assert l == [('g', 'call'), ('g', 'line'), ('g', 'line'), ('g', 'line'), ('g', 'return')] * 4
+        l1 = l
+        l = []
+        f(10000)
+        sys.settrace(None)
+
+        assert l == l1



More information about the Pypy-commit mailing list