diff options
author | Matt Davis <mrd@redhat.com> | 2022-06-29 14:14:10 -0700 |
---|---|---|
committer | Matt Davis <mrd@redhat.com> | 2022-06-29 14:14:10 -0700 |
commit | eaa9538f4130d7953297e1926ec4c08bd6c8d9f0 (patch) | |
tree | 1cb58cb08e8ecf0dfcb8f59ff8ac63a6df6f7c8d /testing/cffi0 | |
parent | ddd56a92609eacd598cde41e4244b08722f01730 (diff) | |
download | cffi-eaa9538f4130d7953297e1926ec4c08bd6c8d9f0.tar.gz |
musllinux test updates and wheels, py3.11 beta wheels
Diffstat (limited to 'testing/cffi0')
-rw-r--r-- | testing/cffi0/test_function.py | 18 | ||||
-rw-r--r-- | testing/cffi0/test_ownlib.py | 4 | ||||
-rw-r--r-- | testing/cffi0/test_parsing.py | 4 | ||||
-rw-r--r-- | testing/cffi0/test_unicode_literals.py | 4 | ||||
-rw-r--r-- | testing/cffi0/test_verify.py | 4 |
5 files changed, 27 insertions, 7 deletions
diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py index b4bb23d..84d8db6 100644 --- a/testing/cffi0/test_function.py +++ b/testing/cffi0/test_function.py @@ -5,7 +5,7 @@ import math, os, sys import ctypes.util from cffi.backend_ctypes import CTypesBackend from testing.udir import udir -from testing.support import FdWriteCapture, StdErrCapture +from testing.support import FdWriteCapture, StdErrCapture, is_musl from .backend_tests import needs_dlopen_none try: @@ -13,6 +13,12 @@ try: except ImportError: from io import StringIO +try: + from packaging.tags import platform_tags + _platform_tags_cached = set(platform_tags()) + _is_musl = any(t.startswith('musllinux') for t in _platform_tags_cached) +except ImportError: + _is_musl = False lib_m = 'm' if sys.platform == 'win32': @@ -20,6 +26,8 @@ if sys.platform == 'win32': import distutils.ccompiler if distutils.ccompiler.get_default_compiler() == 'msvc': lib_m = 'msvcrt' +elif is_musl: + lib_m = 'c' class TestFunction(object): Backend = CTypesBackend @@ -165,11 +173,15 @@ class TestFunction(object): ffi.cast("long long", 168)) ffi.C.fprintf(ffi.C.stderr, b"hello %p\n", ffi.NULL) res = fd.getvalue() + if is_musl: + nil_repr = b'0' + else: + nil_repr = b'(nil)' assert res == (b"hello with no arguments\n" b"hello, world!\n" b"hello, world2!\n" b"hello int 42 long 84 long long 168\n" - b"hello (nil)\n") + b"hello " + nil_repr + b"\n") def test_must_specify_type_of_vararg(self): ffi = FFI(backend=self.Backend()) @@ -265,7 +277,7 @@ class TestFunction(object): assert res == 5 def test_write_variable(self): - if not sys.platform.startswith('linux'): + if not sys.platform.startswith('linux') or _is_musl: py.test.skip("probably no symbol 'stdout' in the lib") ffi = FFI(backend=self.Backend()) ffi.cdef(""" diff --git a/testing/cffi0/test_ownlib.py b/testing/cffi0/test_ownlib.py index ffad879..bbdab8c 100644 --- a/testing/cffi0/test_ownlib.py +++ b/testing/cffi0/test_ownlib.py @@ -2,7 +2,7 @@ import py, sys, os import subprocess, weakref from cffi import FFI from cffi.backend_ctypes import CTypesBackend -from testing.support import u +from testing.support import u, is_musl SOURCE = """\ @@ -388,7 +388,7 @@ class TestOwnLib(object): def test_dlopen_handle(self): if self.module is None: py.test.skip("fix the auto-generation of the tiny test lib") - if sys.platform == 'win32': + if sys.platform == 'win32' or is_musl: py.test.skip("uses 'dl' explicitly") if self.__class__.Backend is CTypesBackend: py.test.skip("not for the ctypes backend") diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py index a5e4587..5d93a8d 100644 --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -1,6 +1,7 @@ import py, sys, re from cffi import FFI, FFIError, CDefError, VerificationError from .backend_tests import needs_dlopen_none +from testing.support import is_musl class FakeBackend(object): @@ -80,6 +81,9 @@ if sys.platform == 'win32': import distutils.ccompiler if distutils.ccompiler.get_default_compiler() == 'msvc': lib_m = 'msvcrt' +elif is_musl: + lib_m = 'c' + def test_simple(): ffi = FFI(backend=FakeBackend()) diff --git a/testing/cffi0/test_unicode_literals.py b/testing/cffi0/test_unicode_literals.py index 7b0a5cc..8838de5 100644 --- a/testing/cffi0/test_unicode_literals.py +++ b/testing/cffi0/test_unicode_literals.py @@ -9,6 +9,8 @@ from __future__ import unicode_literals # import sys, math from cffi import FFI +from testing.support import is_musl + lib_m = "m" if sys.platform == 'win32': @@ -16,6 +18,8 @@ if sys.platform == 'win32': import distutils.ccompiler if distutils.ccompiler.get_default_compiler() == 'msvc': lib_m = 'msvcrt' +elif is_musl: + lib_m = 'c' def test_cast(): diff --git a/testing/cffi0/test_verify.py b/testing/cffi0/test_verify.py index 3a1c0b9..de1608d 100644 --- a/testing/cffi0/test_verify.py +++ b/testing/cffi0/test_verify.py @@ -3,7 +3,7 @@ import pytest import sys, os, math, weakref from cffi import FFI, VerificationError, VerificationMissing, model, FFIError from testing.support import * -from testing.support import extra_compile_args +from testing.support import extra_compile_args, is_musl lib_m = ['m'] @@ -1609,7 +1609,7 @@ def test_keepalive_ffi(): assert func() == 42 def test_FILE_stored_in_stdout(): - if not sys.platform.startswith('linux'): + if not sys.platform.startswith('linux') or is_musl: py.test.skip("likely, we cannot assign to stdout") ffi = FFI() ffi.cdef("int printf(const char *, ...); FILE *setstdout(FILE *);") |