diff options
author | Armin Rigo <arigo@tunes.org> | 2020-02-07 10:00:28 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2020-02-07 10:00:28 +0100 |
commit | fd32626a37916db215f48c1c6afee2253ae4ee96 (patch) | |
tree | 960def6b25ee8a00d554da3cdc3288ed8f83f1b8 /extra_tests | |
parent | Change the FAQ entry "why not github" (diff) | |
download | pypy-fd32626a37916db215f48c1c6afee2253ae4ee96.tar.gz pypy-fd32626a37916db215f48c1c6afee2253ae4ee96.tar.bz2 pypy-fd32626a37916db215f48c1c6afee2253ae4ee96.zip |
update to cffi/f2ec51ca7510
Diffstat (limited to 'extra_tests')
-rw-r--r-- | extra_tests/cffi_tests/cffi0/test_function.py | 13 | ||||
-rw-r--r-- | extra_tests/cffi_tests/cffi0/test_verify.py | 10 | ||||
-rw-r--r-- | extra_tests/cffi_tests/cffi1/test_recompiler.py | 10 | ||||
-rw-r--r-- | extra_tests/cffi_tests/support.py | 1 |
4 files changed, 34 insertions, 0 deletions
diff --git a/extra_tests/cffi_tests/cffi0/test_function.py b/extra_tests/cffi_tests/cffi0/test_function.py index 8b6bf821a3..084a97bfb2 100644 --- a/extra_tests/cffi_tests/cffi0/test_function.py +++ b/extra_tests/cffi_tests/cffi0/test_function.py @@ -521,3 +521,16 @@ class TestFunction(object): assert str(e.value).startswith("library '") assert str(e.value).endswith("' has already been closed") ffi.dlclose(lib) # does not raise + + def test_passing_large_list(self): + if self.Backend is CTypesBackend: + py.test.skip("the ctypes backend doesn't support this") + ffi = FFI(backend=self.Backend()) + ffi.cdef(""" + void getenv(char *); + """) + needs_dlopen_none() + m = ffi.dlopen(None) + arg = [b"F", b"O", b"O"] + [b"\x00"] * 20000000 + x = m.getenv(arg) + assert x is None diff --git a/extra_tests/cffi_tests/cffi0/test_verify.py b/extra_tests/cffi_tests/cffi0/test_verify.py index 7d34ecf647..39ff8e4b1d 100644 --- a/extra_tests/cffi_tests/cffi0/test_verify.py +++ b/extra_tests/cffi_tests/cffi0/test_verify.py @@ -2551,3 +2551,13 @@ def test_arithmetic_in_cdef(): """.replace('?', str(a))) # the verify() crashes if the values in the enum are different from # the values we computed ourselves from the cdef() + +def test_passing_large_list(): + ffi = FFI() + ffi.cdef("""void passing_large_list(long[]);""") + lib = ffi.verify(""" + static void passing_large_list(long a[]) { } + """) + arg = list(range(20000000)) + lib.passing_large_list(arg) + # assert did not segfault diff --git a/extra_tests/cffi_tests/cffi1/test_recompiler.py b/extra_tests/cffi_tests/cffi1/test_recompiler.py index 6c1a9e8cd1..4391bd5dd2 100644 --- a/extra_tests/cffi_tests/cffi1/test_recompiler.py +++ b/extra_tests/cffi_tests/cffi1/test_recompiler.py @@ -2446,3 +2446,13 @@ def test_struct_with_func_with_struct_arg(): }; """) py.test.raises(RuntimeError, ffi.new, "struct BinaryTree *") + +def test_passing_large_list(): + ffi = FFI() + ffi.cdef("""void passing_large_list(long[]);""") + lib = verify(ffi, "test_passing_large_list", """ + static void passing_large_list(long a[]) { } + """) + arg = list(range(20000000)) + lib.passing_large_list(arg) + # assert did not segfault diff --git a/extra_tests/cffi_tests/support.py b/extra_tests/cffi_tests/support.py index 46d1b9d6a6..e20a772959 100644 --- a/extra_tests/cffi_tests/support.py +++ b/extra_tests/cffi_tests/support.py @@ -104,6 +104,7 @@ else: [int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0]): # assume a standard clang or gcc extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion', + '-Wno-unused-parameter', '-Wno-unreachable-code'] # special things for clang extra_compile_args.append('-Qunused-arguments') |