[pypy-commit] cffi default: A failing test

arigo pypy.commits at gmail.com
Thu Dec 22 06:41:00 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2838:b6dd9a07cdf4
Date: 2016-12-22 12:40 +0100
http://bitbucket.org/cffi/cffi/changeset/b6dd9a07cdf4/

Log:	A failing test

diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
--- a/testing/cffi1/test_recompiler.py
+++ b/testing/cffi1/test_recompiler.py
@@ -2088,3 +2088,25 @@
     assert lib.f().a == 42
     e = py.test.raises(NotImplementedError, lib.g, 0)
     print str(e.value)
+
+def test_call_with_packed_struct():
+    if sys.platform == 'win32':
+        py.test.skip("needs a GCC extension")
+    ffi = FFI()
+    ffi.cdef("""
+        struct foo { char y; int x; };
+        struct foo f(void);
+        struct foo g(int, ...);
+    """, packed=True)
+    lib = verify(ffi, "test_call_with_packed_struct", """
+        struct foo { char y; int x; } __attribute__((packed));
+        struct foo f(void) {
+            struct foo s = { 40, 200 };
+            return s;
+        }
+        struct foo g(int a, ...) { }
+    """)
+    assert lib.f().y == chr(40)
+    assert lib.f().x == 200
+    e = py.test.raises(NotImplementedError, lib.g, 0)
+    print str(e.value)


More information about the pypy-commit mailing list