[pypy-svn] r50718 - pypy/dist/pypy/jit/timeshifter/test

antocuni at codespeak.net antocuni at codespeak.net
Thu Jan 17 18:20:16 CET 2008


Author: antocuni
Date: Thu Jan 17 18:20:16 2008
New Revision: 50718

Modified:
   pypy/dist/pypy/jit/timeshifter/test/test_portal.py
   pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
Log:
fix some more tests



Modified: pypy/dist/pypy/jit/timeshifter/test/test_portal.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_portal.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_portal.py	Thu Jan 17 18:20:16 2008
@@ -1,6 +1,6 @@
 from pypy import conftest
 from pypy.translator.translator import graphof
-from pypy.jit.timeshifter.test.test_timeshift import hannotate, getargtypes
+from pypy.jit.timeshifter.test.test_timeshift import TestLLType as TSTestLLType, getargtypes
 from pypy.jit.timeshifter.hrtyper import HintRTyper
 from pypy.jit.timeshifter.test.test_timeshift import P_NOVIRTUAL, StopAtXPolicy
 from pypy.jit.timeshifter.test.test_vlist import P_OOPSPEC
@@ -53,7 +53,7 @@
             assert argtypes == getargtypes(self.rtyper.annotator, main_args)
             return main_args
 
-        hs, ha, self.rtyper = hannotate(main, main_args, portal=portal,
+        hs, ha, self.rtyper = TSTestLLType.hannotate(main, main_args, portal=portal,
                                    policy=policy, inline=inline,
                                    backendoptimize=backendoptimize)
 

Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py	Thu Jan 17 18:20:16 2008
@@ -49,8 +49,8 @@
 
 class TimeshiftingTests(object):
     RGenOp = LLRGenOp
-
     small = True
+    type_system = 'lltype' # because a lot of tests inherits from this class
 
     def setup_class(cls):
         from pypy.jit.timeshifter.test.conftest import option
@@ -65,14 +65,15 @@
         del cls._cache
         del cls._cache_order
 
-    def hannotate(self, func, values, policy=None, inline=None, backendoptimize=False,
+    @classmethod
+    def hannotate(cls, func, values, policy=None, inline=None, backendoptimize=False,
                   portal=None):
         # build the normal ll graphs for ll_function
         t = TranslationContext()
         a = t.buildannotator()
         argtypes = getargtypes(a, values)
         a.build_types(func, argtypes)
-        rtyper = t.buildrtyper(type_system = self.type_system)
+        rtyper = t.buildrtyper(type_system = cls.type_system)
         rtyper.specialize()
         if inline:
             auto_inlining(t, threshold=inline)
@@ -82,7 +83,7 @@
         if portal is None:
             portal = func
 
-        policy = self.fixpolicy(policy)
+        policy = cls.fixpolicy(policy)
         if hasattr(policy, "seetranslator"):
             policy.seetranslator(t)
         graph1 = graphof(t, portal)
@@ -96,9 +97,10 @@
             hannotator.translator.view()
         return hs, hannotator, rtyper
 
-    def fixpolicy(self, policy):
+    @classmethod
+    def fixpolicy(cls, policy):
         import copy
-        if self.type_system == 'ootype' and policy is not None:
+        if cls.type_system == 'ootype' and policy is not None:
             newpolicy = copy.copy(policy)
             newpolicy.oopspec = False
             return newpolicy


More information about the pypy-svn mailing list