From 7bfe4b21b943d73d277441374d8688df91d6e037 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 9 Jan 2015 04:09:55 +0200 Subject: [PATCH] tests: Make ffi_callback.py be able to run on uclibc and macosx. Similar to ffi_float.py. --- tests/unix/ffi_callback.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/unix/ffi_callback.py b/tests/unix/ffi_callback.py index 1d610365c7..7f8af15b37 100644 --- a/tests/unix/ffi_callback.py +++ b/tests/unix/ffi_callback.py @@ -5,7 +5,18 @@ except ImportError: print("SKIP") 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")