tests: Make ffi_callback.py be able to run on uclibc and macosx.

Similar to ffi_float.py.
This commit is contained in:
Paul Sokolovsky 2015-01-09 04:09:55 +02:00
parent 58056b0f43
commit 7bfe4b21b9

View File

@ -5,7 +5,18 @@ except ImportError:
print("SKIP") print("SKIP")
sys.exit() sys.exit()
libc = ffi.open("libc.so.6")
def ffi_open(names):
err = None
for n in names:
try:
mod = ffi.open(n)
return mod
except OSError as e:
err = e
raise err
libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib'))
qsort = libc.func("v", "qsort", "piip") qsort = libc.func("v", "qsort", "piip")