[pypy-svn] r63640 - in pypy/branch/pyjitpl5-simplify/pypy/jit/backend: llgraph/test test x86/test

fijal at codespeak.net fijal at codespeak.net
Sat Apr 4 23:58:30 CEST 2009


Author: fijal
Date: Sat Apr  4 23:58:27 2009
New Revision: 63640

Added:
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/__init__.py   (contents, props changed)
Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/test/test_llgraph.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py
Log:
Factor out common tests to a single place


Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/test/test_llgraph.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/test/test_llgraph.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/test/test_llgraph.py	Sat Apr  4 23:58:27 2009
@@ -248,25 +248,3 @@
         #
         cpu.do_strsetitem([x, BoxInt(4), BoxInt(ord('/'))])
         assert x.getptr(lltype.Ptr(rstr.STR)).chars[4] == '/'
-
-    def test_do_call(self):
-        from pypy.rpython.annlowlevel import llhelper
-        cpu = self.cpu
-        #
-        def func(c):
-            return chr(ord(c) + 1)
-        FPTR = lltype.Ptr(lltype.FuncType([lltype.Char], lltype.Char))
-        func_ptr = llhelper(FPTR, func)
-        calldescr = cpu.calldescrof([lltype.Char], lltype.Char)
-        x = cpu.do_call(
-            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(func_ptr))),
-             BoxInt(ord('A'))],
-            calldescr)
-        assert x.value == ord('B')
-
-    def test_executor(self):
-        cpu = self.cpu
-        x = execute(cpu, rop.INT_ADD, [BoxInt(100), ConstInt(42)])
-        assert x.value == 142
-        s = execute(cpu, rop.NEWSTR, [BoxInt(8)])
-        assert len(s.getptr(lltype.Ptr(rstr.STR)).chars) == 8

Added: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/__init__.py
==============================================================================

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py	Sat Apr  4 23:58:27 2009
@@ -1,6 +1,8 @@
 
 from pypy.jit.metainterp.history import BoxInt, Box, BoxPtr, TreeLoop, ConstInt
 from pypy.jit.metainterp.resoperation import ResOperation, rop
+from pypy.rpython.lltypesystem import lltype, llmemory, rstr
+from pypy.jit.metainterp.executor import execute
 
 class BaseBackendTest(object):
     
@@ -40,3 +42,24 @@
         self.cpu.compile_operations(loop)
         return loop
 
+    def test_do_call(self):
+        from pypy.rpython.annlowlevel import llhelper
+        cpu = self.cpu
+        #
+        def func(c):
+            return chr(ord(c) + 1)
+        FPTR = lltype.Ptr(lltype.FuncType([lltype.Char], lltype.Char))
+        func_ptr = llhelper(FPTR, func)
+        calldescr = cpu.calldescrof([lltype.Char], lltype.Char)
+        x = cpu.do_call(
+            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(func_ptr))),
+             BoxInt(ord('A'))],
+            calldescr)
+        assert x.value == ord('B')
+
+    def test_executor(self):
+        cpu = self.cpu
+        x = execute(cpu, rop.INT_ADD, [BoxInt(100), ConstInt(42)])
+        assert x.value == 142
+        s = execute(cpu, rop.NEWSTR, [BoxInt(8)])
+        assert len(s.getptr(lltype.Ptr(rstr.STR)).chars) == 8

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py	Sat Apr  4 23:58:27 2009
@@ -464,28 +464,3 @@
         cpu.do_strsetitem([x, BoxInt(4), BoxInt(ord('/'))])
         assert x.getptr(lltype.Ptr(rstr.STR)).chars[4] == '/'
 
-    def test_do_call(self):
-        from pypy.rpython.annlowlevel import llhelper
-        cpu = self.cpu
-        #
-        def func(c):
-            return chr(ord(c) + 1)
-        FPTR = lltype.Ptr(lltype.FuncType([lltype.Char], lltype.Char))
-        func_ptr = llhelper(FPTR, func)
-        calldescr = cpu.calldescrof([lltype.Char], lltype.Char)
-        x = cpu.do_call(
-            [BoxInt(cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(func_ptr))),
-             BoxInt(ord('A'))],
-            calldescr)
-        assert x.value == ord('B')
-
-    def test_executor(self):
-        cpu = self.cpu
-        x = execute(cpu, rop.INT_ADD, [BoxInt(100), ConstInt(42)])
-        assert x.value == 142
-        s = execute(cpu, rop.NEWSTR, [BoxInt(8)])
-        assert len(s.getptr(lltype.Ptr(rstr.STR)).chars) == 8
-        # XXX cannot work without rtyper
-        #s = execute(cpu, rop.INT_MUL_OVF, [BoxInt(sys.maxint/2), BoxInt(10)])
-        #assert cpu.get_exception()
-



More information about the Pypy-commit mailing list