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

As the case for e.g. Android's Bionic Libc.
pull/1/head
Paul Sokolovsky 2018-09-11 00:40:41 +03:00 committed by Damien George
parent 34af10d2ef
commit cb66b75692
1 changed files with 8 additions and 1 deletions

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")