cffi: disable tests on aarch64-darwin#152166
Conversation
The tests were disabled on Darwin prior to 54b5495, which probably fixed them for x86_64-darwin, but not for aarch64-darwin.
8d9216c to
18fcfb9
Compare
| doCheck = !stdenv.hostPlatform.isMusl; | ||
| # Lots of tests fail on aarch64-darwin due to "Cannot allocate write+execute memory": | ||
| # * https://cffi.readthedocs.io/en/latest/using.html#callbacks | ||
| doCheck = !stdenv.hostPlatform.isMusl && !(stdenv.isDarwin && stdenv.isAarch64); |
There was a problem hiding this comment.
I did some debugging on this issue. It's caused by nixpkg's build of libffi not being code-signed for this. I was able to work around this by linking cffi against libffi from the apple sdk. Here's my patch, it might be helpful (only tested on aarch64). emilytrau@56c8491
There was a problem hiding this comment.
(sorry i found this in august, been slacking on the pull request 😅)
There was a problem hiding this comment.
@angustrau I'm still getting errors with your patch:
_________________________ ERROR collecting c/test_c.py _________________________
ImportError while importing test module '/private/tmp/nix-build-python3.9-cffi-1.15.0.drv-0/cffi-1.15.0/c/test_c.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/nix/store/wcmyw7rvadybk5cdcdd7xghwbzk2p44w-python3-3.9.9/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
c/test_c.py:8: in <module>
from _cffi_backend import *
E ImportError: dlopen(/nix/store/5f5a625s680i4hll3jd0sx11m3qyvs3i-python3.9-cffi-1.15.0/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_ffi_prep_closure'
_____________ ERROR collecting testing/cffi1/test_parse_c_type.py ______________
testing/cffi1/test_parse_c_type.py:74: in <module>
def fetch_constant_five(p):
cffi/api.py:396: in callback_decorator_wrap
return self._backend.callback(cdecl, python_callable,
E MemoryError: Cannot allocate write+execute memory for ffi.callback(). You might be running on a system that prevents this. For more information, see https://cffi.readthedocs.io/en/latest/using.html#callbacks
The first error does not happen without your patch.
There was a problem hiding this comment.
I merged for now, as the tests weren't ran anyway until this staging-next iteration and this platform is idle on Hydra. If you find a better fix, it can be added later.
|
@ofborg build python39Packages.cffi |
|
@bobrik, thank you for taking care of my mess! |

Motivation for this change
The tests were disabled on Darwin prior to 54b5495, which probably fixed them for x86_64-darwin, but not for aarch64-darwin.
This was merged in #126411, which landed in the most recent staging-next: #148396. The evaluation after that merge doesn't look too good:
Spot checking a few packages points at cffi, so I think it's fair to merge this straight into the master branch.
cc @vcunat, @jonringer, @toonn
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes