summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2016-12-22 12:40:24 +0100
committerArmin Rigo <arigo@tunes.org>2016-12-22 12:40:24 +0100
commita5e7007477a7f56390d8989907c034ef55dfcc42 (patch)
tree5fde9160788a972fe8643e0faeea67a94d253aa0 /testing
parentd7b25146b02e4e33787b38dc18b5eb4b91c19fb1 (diff)
downloadcffi-a5e7007477a7f56390d8989907c034ef55dfcc42.tar.gz
A failing test
Diffstat (limited to 'testing')
-rw-r--r--testing/cffi1/test_recompiler.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
index 8dea0aa..727f9fc 100644
--- a/testing/cffi1/test_recompiler.py
+++ b/testing/cffi1/test_recompiler.py
@@ -2088,3 +2088,25 @@ def test_call_with_union():
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)