[pypy-svn] r55746 - pypy/branch/faster-ctypes/pypy/rlib/test
fijal at codespeak.net
fijal at codespeak.net
Wed Jun 11 04:59:57 CEST 2008
Author: fijal
Date: Wed Jun 11 04:59:57 2008
New Revision: 55746
Modified:
pypy/branch/faster-ctypes/pypy/rlib/test/test_libffi.py
Log:
Fix a test by inserting explicit keepalive
Modified: pypy/branch/faster-ctypes/pypy/rlib/test/test_libffi.py
==============================================================================
--- pypy/branch/faster-ctypes/pypy/rlib/test/test_libffi.py (original)
+++ pypy/branch/faster-ctypes/pypy/rlib/test/test_libffi.py Wed Jun 11 04:59:57 2008
@@ -11,6 +11,7 @@
import os, sys
import py
import time
+from pypy.rlib.objectmodel import keepalive_until_here
def setup_module(mod):
if not (sys.platform.startswith('linux') or
@@ -38,12 +39,15 @@
return CDLL('msvcrt.dll')
else:
return CDLL('/lib/libc.so.6')
-
- def get_libm(self):
+
+ def _libmname(self):
if sys.platform == 'win32':
- return CDLL('msvcrt.dll')
+ return 'msvcrt.dll'
else:
- return CDLL('libm.so')
+ return 'libm.so'
+
+ def get_libm(self):
+ return CDLL(self._libmname())
def test_library_open(self):
lib = self.get_libc()
@@ -193,17 +197,17 @@
# forget this in code that is meant to be
def test_compile(self):
- import py
- py.test.skip("Segfaulting test, skip")
# XXX cannot run it on top of llinterp, some problems
# with pointer casts
+ libname = self._libmname()
def f(x, y):
- libm = self.get_libm()
+ libm = CDLL(libname)
c_pow = libm.getpointer('pow', [ffi_type_double, ffi_type_double], ffi_type_double)
c_pow.push_arg(x)
c_pow.push_arg(y)
res = c_pow.call(rffi.DOUBLE)
+ keepalive_until_here(libm)
return res
fn = compile(f, [float, float])
More information about the Pypy-commit
mailing list