rlib/test/test_libffi.py::TestLibffiCall::()::test_unsigned_short_args
cls = <class 'rpython.rlib.test.test_libffi.TestLibffiCall'>
@classmethod
def setup_class(cls):
from rpython.tool.udir import udir
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator.platform import platform
BaseFfiTest.setup_class()
# prepare C code as an example, so we can load it and call
# it via rlib.libffi
c_file = udir.ensure("test_libffi", dir=1).join("foolib.c")
# automatically collect the C source from the docstrings of the tests
snippets = []
for name in dir(cls):
if name.startswith('test_'):
meth = getattr(cls, name)
# the heuristic to determine it it's really C code could be
# improved: so far we just check that there is a '{' :-)
if meth.__doc__ is not None and '{' in meth.__doc__:
snippets.append(meth.__doc__)
#
INCLUDE = '#include "src/precommondefs.h"\n'
c_file.write(INCLUDE + str(py.code.Source('\n'.join(snippets))))
eci = ExternalCompilationInfo(include_dirs=[cdir])
cls.libfoo_name = str(platform.compile([c_file], eci, 'x',
standalone=False))
> cls.dll = cls.CDLL(cls.libfoo_name)
rlib\test\test_libffi.py:234:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
rlib\libffi.py:446: in __init__
self.lib = dlopen(libname, mode)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'd:\\systemtemp\\pytest\\usession-main-810\\test_libffi\\x.dll'
mode = -1
def dlopen(name, mode=-1):
# mode is unused on windows, but a consistant signature
if not name:
raise DLOpenError("cannot use None")
with rffi.scoped_utf82wcharp(name, codepoints_in_utf8(name)) as buf:
res = rwin32.LoadLibraryW(buf)
if not res:
err = rwin32.GetLastError_saved()
ustr, lgt = rwin32.FormatErrorW(err)
> raise DLOpenError(ustr)
E DLOpenError: 'Teseiidmdl ol o efud\xf2\xa0\x80\x8d\x00\xc6\xb8\xe2\x89\x94D\\yysufpp27v..8Srp'
rlib\rdynload.py:242: DLOpenError
builder: rpython-win-x86-64 build #399+
test: rlib/test/test_libffi.py::TestLibffiCall::()::test_unsigned_short_args