[pypy-svn] r77576 - pypy/branch/jitffi/pypy/jit/backend/test

antocuni at codespeak.net antocuni at codespeak.net
Mon Oct 4 16:50:07 CEST 2010


Author: antocuni
Date: Mon Oct  4 16:50:05 2010
New Revision: 77576

Modified:
   pypy/branch/jitffi/pypy/jit/backend/test/runner_test.py
Log:
fix the test to use the new libffi interface


Modified: pypy/branch/jitffi/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/backend/test/runner_test.py	(original)
+++ pypy/branch/jitffi/pypy/jit/backend/test/runner_test.py	Mon Oct  4 16:50:05 2010
@@ -517,16 +517,15 @@
             assert res.value == func_ints(*args)
 
     def test_call_to_c_function(self):
-        # XXX: fix this to use libffi instead of clibffi
-        from pypy.rlib.clibffi import CDLL, ffi_type_uchar, ffi_type_sint
+        from pypy.rlib.libffi import CDLL, types, ArgChain
         libc = CDLL('libc.so.6')
-        c_tolower = libc.getpointer('tolower', [ffi_type_uchar], ffi_type_sint)
-        c_tolower.push_arg('A')
-        assert c_tolower.call(lltype.Signed) == ord('a')
+        c_tolower = libc.getpointer('tolower', [types.uchar], types.sint)
+        argchain = ArgChain().int(ord('A'))
+        assert c_tolower.call(argchain, rffi.INT) == ord('a')
 
         func_adr = llmemory.cast_ptr_to_adr(c_tolower.funcsym)
         funcbox = ConstInt(heaptracker.adr2int(func_adr))
-        calldescr = self.cpu.calldescrof_dynamic([ffi_type_uchar], ffi_type_sint)
+        calldescr = self.cpu.calldescrof_dynamic([types.uchar], types.sint)
         res = self.execute_operation(rop.CALL,
                                      [funcbox, BoxInt(ord('A'))],
                                      'int',



More information about the Pypy-commit mailing list