[pypy-svn] r70519 - pypy/branch/jit-profiling/pypy/interpreter/test
fijal at codespeak.net
fijal at codespeak.net
Tue Jan 12 10:42:06 CET 2010
Author: fijal
Date: Tue Jan 12 10:42:06 2010
New Revision: 70519
Added:
pypy/branch/jit-profiling/pypy/interpreter/test/test_profiling.py (contents, props changed)
Log:
Start writing tests for the new profiling case, for starters something simple
Added: pypy/branch/jit-profiling/pypy/interpreter/test/test_profiling.py
==============================================================================
--- (empty file)
+++ pypy/branch/jit-profiling/pypy/interpreter/test/test_profiling.py Tue Jan 12 10:42:06 2010
@@ -0,0 +1,27 @@
+
+from pypy.interpreter.executioncontext import ExecutionContext, TRACE_CALL,\
+ TRACE_RETURN
+
+class MockExecutionContext(ExecutionContext):
+ pass
+
+class MockFrame(object):
+ w_f_trace = None
+ last_exception = None
+
+ def hide(self):
+ return False
+
+class TestProfiling(object):
+ def test_simple(self):
+ events = []
+ def profilefunc(space, ignored, frame, event, w_arg):
+ events.append(event)
+
+ ec = MockExecutionContext(self.space)
+ frame = MockFrame()
+ ec.setllprofile(profilefunc, self.space.w_None)
+ ec.enter(frame)
+ ec.call_trace(frame)
+ ec.leave(frame)
+ assert events == [TRACE_CALL, TRACE_RETURN]
More information about the Pypy-commit
mailing list