tests/unix/ffi_float: Skip if strtof() is not available.

As the case for e.g. Android's Bionic Libc.
This commit is contained in:
Paul Sokolovsky 2018-09-11 00:40:41 +03:00 committed by Damien George
parent 34af10d2ef
commit cb66b75692

View File

@ -18,7 +18,14 @@ def ffi_open(names):
libc = ffi_open(('libc.so', 'libc.so.0', 'libc.so.6', 'libc.dylib'))
strtof = libc.func("f", "strtof", "sp")
try:
strtof = libc.func("f", "strtof", "sp")
except OSError:
# Some libc's (e.g. Android's Bionic) define strtof as macro/inline func
# in terms of strtod().
print("SKIP")
raise SystemExit
print('%.6f' % strtof('1.23', None))
strtod = libc.func("d", "strtod", "sp")