Skip to content

Commit

Permalink
python3Packages.cffi: fix tests on FreeBSD
Browse files Browse the repository at this point in the history
- disable a test, see comments.
- modify the existing patch to do what it claims to do (fixing
  compilation on clang) instead of only applying to darwin.
  • Loading branch information
rhelmot committed Aug 16, 2024
1 parent 38b5a20 commit f3363eb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
diff -r c649a735cf82 testing/support.py
--- a/testing/support.py Thu Feb 23 05:42:01 2023 +0100
+++ b/testing/support.py Sat May 20 21:46:56 2023 -0400
@@ -112,6 +112,7 @@
'-Wno-unreachable-code']
# special things for clang
extra_compile_args.append('-Qunused-arguments')
+ extra_compile_args.append('-Wno-null-pointer-subtraction')
else:
# assume a standard gcc
diff --git a/testing/support.py b/testing/support.py
index 063e52cf..ef0abdc7 100644
--- a/testing/support.py
+++ b/testing/support.py
@@ -117,6 +117,7 @@ else:
extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion',
'-Wno-unused-parameter',
'-Wno-unreachable-code']
+extra_compile_args.append('-Wno-null-pointer-subtraction')

is_musl = False
if sys.platform == 'linux':
10 changes: 10 additions & 0 deletions pkgs/development/python-modules/cffi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ else
--replace '/usr/include/libffi' '${lib.getDev libffi}/include'
'';

# it's kind of a miracle that this is all it takes for tests to work on FreeBSD.
# There are various comments in the source to the effect of assuming that anything that's
# not darwin or win32 must be linux and act exactly like linux
disabledTests = lib.optionals stdenv.isFreeBSD [
# this test assumes that libdl.dlopen actually works, but it does not on FreeBSD. You need
# to link against libc for the working function, but the function ends up being provided by
# the dynamic loader and so the test is not trivially fixable.
"test_dlopen_handle"
];

nativeBuildInputs = [
pkg-config
setuptools
Expand Down

0 comments on commit f3363eb

Please sign in to comment.