[pypy-svn] r55845 - pypy/branch/oo-jit/pypy/jit/rainbow/test
antocuni at codespeak.net
antocuni at codespeak.net
Sat Jun 14 16:07:06 CEST 2008
Author: antocuni
Date: Sat Jun 14 16:07:06 2008
New Revision: 55845
Modified:
pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py
Log:
port test_0tlc to ootype, but disable ootype tests because they fail right now
Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py (original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_0tlc.py Sat Jun 14 16:07:06 2008
@@ -1,5 +1,5 @@
import py
-from pypy.rpython.module.support import LLSupport
+from pypy.rpython.module.support import LLSupport, OOSupport
from pypy.jit.rainbow.test.test_portal import PortalTest
from pypy.jit.rainbow.test.test_vlist import P_OOPSPEC
from pypy.tool.sourcetools import func_with_new_name
@@ -9,20 +9,23 @@
from pypy.jit.tl.test.test_tl import FACTORIAL_SOURCE
-tlc_interp_without_call = func_with_new_name(
- tlc.interp_without_call, "tlc_interp_without_call")
-tlc_interp_eval_without_call = tlc.interp_eval_without_call
-
-# to stick attributes on the new function object, not on tlc.interp_wi*
-def build_bytecode(s):
- result = ''.join([chr(int(t)) for t in s.split(',')])
- return LLSupport.to_rstr(result)
-tlc_interp_without_call.convert_arguments = [build_bytecode, int, int]
+class BaseTestTLC(PortalTest):
+ small = False
+ def _get_interp(self):
+ def interp(llbytecode, pc, inputarg):
+ from pypy.rpython.annlowlevel import hlstr
+ bytecode = hlstr(llbytecode)
+ return tlc.interp_without_call(bytecode, pc, inputarg)
+
+ to_rstr = self.to_rstr
+ def build_bytecode(s):
+ result = ''.join([chr(int(t)) for t in s.split(',')])
+ return to_rstr(result)
+ interp.convert_arguments = [build_bytecode, int, int]
+
+ return interp
-class TestTLC(PortalTest):
- small = False
- type_system = "lltype"
def test_factorial(self):
code = tlc.compile(FACTORIAL_SOURCE)
@@ -30,9 +33,10 @@
n = 5
expected = 120
-
- res = self.timeshift_from_portal(tlc_interp_without_call,
- tlc_interp_eval_without_call,
+
+ interp = self._get_interp()
+ res = self.timeshift_from_portal(interp,
+ tlc.interp_eval_without_call,
[bytecode, 0, n],
policy=P_OOPSPEC)#, backendoptimize=True)
assert res == expected
@@ -52,8 +56,19 @@
DIV
""")
bytecode = ','.join([str(ord(c)) for c in code])
- res = self.timeshift_from_portal(tlc_interp_without_call,
- tlc_interp_eval_without_call,
+
+ interp = self._get_interp()
+ res = self.timeshift_from_portal(interp,
+ tlc.interp_eval_without_call,
[bytecode, 0, 1],
policy=P_OOPSPEC)#, backendoptimize=True)
assert res == 20
+
+
+class TestLLType(BaseTestTLC):
+ type_system = "lltype"
+ to_rstr = staticmethod(LLSupport.to_rstr)
+
+##class TestOOType(BaseTestTLC):
+## type_system = "ootype"
+## to_rstr = staticmethod(OOSupport.to_rstr)
More information about the Pypy-commit
mailing list