test.patch revision 2719
2719N/AThe testsuite makes some incorrect assumptions:
2719N/A
2719N/A - we need to not assume "a standard gcc", so replace the -Werror flag
2719N/A with -errwarn to turn on the warnings are expected to cause compilation
2719N/A to fail.
2719N/A
2719N/A - don't use the -pthread flag for compilation; as Studio doesn't have any
2719N/A clue what to do with it, and we don't need it on Solaris, anyway.
2719N/A
2719N/A - don't force the use of gcc when compiling a test shared object; get
2719N/A that passed in from the makefile.
2719N/A
2719N/A - don't assume that stdin/stdout/stderr are changeable:
2719N/A
2719N/A https://bitbucket.org/cffi/cffi/issue/145/solaris-stdout-and-stderr-not-in-libc-not
2719N/A
2719N/A fixed in
2719N/A
2719N/A https://bitbucket.org/cffi/cffi/commits/237031079adc
2719N/A
2719N/A - don't assume that enums can be unsigned or are the same size as long:
2719N/A
2719N/A https://bitbucket.org/cffi/cffi/issue/143/test_enum_size-makes-invalid-assumptions
2719N/A
2719N/AAlso fix a problem with some assignments to void*:
2719N/A
2719N/A https://bitbucket.org/cffi/cffi/issue/146/incorrect-type-for-c_callback-variable
2719N/A
2719N/Afixed in
2719N/A
2719N/A https://bitbucket.org/cffi/cffi/commits/51d87933eb4b
2719N/A
2719N/A--- cffi-0.8.2/testing/test_verify.py Thu Mar 6 22:51:56 2014
2719N/A+++ cffi-0.8.2/testing/test_verify.py Thu Mar 20 18:39:01 2014
2719N/A@@ -18,8 +18,10 @@
2719N/A extra_compile_args = [
2719N/A '-Werror', '-Qunused-arguments', '-Wno-error=shorten-64-to-32']
2719N/A else:
2719N/A- # assume a standard gcc
2719N/A- extra_compile_args = ['-Werror']
2719N/A+ extra_compile_args = [
2719N/A+ '-errtags=yes',
2719N/A+ '-errwarn=E_ASSIGNMENT_TYPE_MISMATCH,E_RETURN_VALUE_TYPE_MISMATCH'
2719N/A+ ]
2719N/A
2719N/A class FFI(FFI):
2719N/A def verify(self, *args, **kwds):
2719N/A--- cffi-0.8.2/testing/callback_in_thread.py Fri Mar 21 15:58:21 2014
2719N/A+++ cffi-0.8.2/testing/callback_in_thread.py Fri Mar 21 15:58:30 2014
2719N/A@@ -22,7 +22,7 @@
2719N/A pthread_create(&thread, NULL, my_wait_function, (void*)mycb);
2719N/A return 0;
2719N/A }
2719N/A- """, extra_compile_args=['-pthread'])
2719N/A+ """)
2719N/A seen = []
2719N/A @ffi.callback('int(*)(int,int)')
2719N/A def mycallback(x, y):
2719N/A--- cffi-0.8.2/testing/test_ownlib.py Tue Oct 9 02:10:04 2012
2719N/A+++ cffi-0.8.2/testing/test_ownlib.py Tue Mar 25 15:39:35 2014
2719N/A@@ -1,4 +1,4 @@
2719N/A-import py, sys
2719N/A+import os, py, sys
2719N/A import subprocess, weakref
2719N/A from cffi import FFI
2719N/A from cffi.backend_ctypes import CTypesBackend
2719N/A@@ -28,7 +28,7 @@
2719N/A from testing.udir import udir
2719N/A udir.join('testownlib.c').write(SOURCE)
2719N/A subprocess.check_call(
2719N/A- 'gcc testownlib.c -shared -fPIC -o testownlib.so',
2719N/A+ os.getenv('TESTOWNLIB_CC') % ('testownlib.c', 'testownlib.so'),
2719N/A cwd=str(udir), shell=True)
2719N/A cls.module = str(udir.join('testownlib.so'))
2719N/A
2719N/A--- cffi-0.8.2/c/test_c.py Thu Mar 6 22:51:56 2014
2719N/A+++ cffi-0.8.2/c/test_c.py Mon Mar 24 14:53:27 2014
2719N/A@@ -1102,7 +1102,7 @@
2719N/A def test_read_variable():
2719N/A ## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
2719N/A ## https://bugs.pypy.org/issue1643
2719N/A- if sys.platform == 'win32' or sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
2719N/A+ if not sys.platform.startswith("linux"):
2719N/A py.test.skip("untested")
2719N/A BVoidP = new_pointer_type(new_void_type())
2719N/A ll = find_and_load_library('c')
2719N/A@@ -1112,7 +1112,7 @@
2719N/A def test_read_variable_as_unknown_length_array():
2719N/A ## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
2719N/A ## https://bugs.pypy.org/issue1643
2719N/A- if sys.platform == 'win32' or sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
2719N/A+ if not sys.platform.startswith("linux"):
2719N/A py.test.skip("untested")
2719N/A BCharP = new_pointer_type(new_primitive_type("char"))
2719N/A BArray = new_array_type(BCharP, None)
2719N/A@@ -1124,7 +1124,7 @@
2719N/A def test_write_variable():
2719N/A ## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard
2719N/A ## https://bugs.pypy.org/issue1643
2719N/A- if sys.platform == 'win32' or sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
2719N/A+ if not sys.platform.startswith("linux"):
2719N/A py.test.skip("untested")
2719N/A BVoidP = new_pointer_type(new_void_type())
2719N/A ll = find_and_load_library('c')
2719N/A--- cffi-0.8.2/testing/test_verify.py Thu Mar 6 22:51:56 2014
2719N/A+++ cffi-0.8.2/testing/test_verify.py Mon Mar 24 15:03:49 2014
2719N/A@@ -1472,8 +1474,8 @@
2719N/A assert func() == 42
2719N/A
2719N/A def test_FILE_stored_in_stdout():
2719N/A- if sys.platform == 'win32':
2719N/A- py.test.skip("MSVC: cannot assign to stdout")
2719N/A+ if not sys.platform.startswith("linux"):
2719N/A+ py.test.skip("likely, we cannot assign to stdout")
2719N/A ffi = FFI()
2719N/A ffi.cdef("int printf(const char *, ...); FILE *setstdout(FILE *);")
2719N/A lib = ffi.verify("""
2719N/A--- cffi-0.8.2/testing/test_verify.py Thu Mar 6 22:51:56 2014
2719N/A+++ cffi-0.8.2/testing/test_verify.py Mon Mar 24 15:06:23 2014
2719N/A@@ -1598,13 +1598,13 @@
2719N/A ('-123', 4, -1),
2719N/A ('-2147483647-1', 4, -1),
2719N/A ]
2719N/A- if FFI().sizeof("long") == 8:
2719N/A+ if FFI().sizeof("long") == 8 and sys.platform != 'sunos5':
2719N/A cases += [('4294967296L', 8, 2**64-1),
2719N/A ('%dUL' % (2**64-1), 8, 2**64-1),
2719N/A ('-2147483649L', 8, -1),
2719N/A ('%dL-1L' % (1-2**63), 8, -1)]
2719N/A for hidden_value, expected_size, expected_minus1 in cases:
2719N/A- if sys.platform == 'win32' and 'U' in hidden_value:
2719N/A+ if sys.platform in ('win32', 'sunos5') and 'U' in hidden_value:
2719N/A continue # skipped on Windows
2719N/A ffi = FFI()
2719N/A ffi.cdef("enum foo_e { AA, BB, ... };")
2719N/A@@ -1629,7 +1627,7 @@
2719N/A (maxulong, -1, ''),
2719N/A (-1, 0xffffffff, 'U'),
2719N/A (-1, maxulong, 'UL')]:
2719N/A- if c2c and sys.platform == 'win32':
2719N/A+ if c2c and sys.platform in ('win32', 'sunos5'):
2719N/A continue # enums may always be signed with MSVC
2719N/A ffi = FFI()
2719N/A ffi.cdef("enum foo_e { AA=%s };" % c1)
2719N/A--- a/testing/test_verify.py
2719N/A+++ b/testing/test_verify.py
2719N/A@@ -1656,8 +1656,8 @@
2719N/A ffi = FFI()
2719N/A ffi.cdef("""
2719N/A int (*python_callback)(int how_many, int *values);
2719N/A- void *const c_callback; /* pass this ptr to C routines */
2719N/A- int some_c_function(void *cb);
2719N/A+ int (*const c_callback)(int,...); /* pass this ptr to C routines */
2719N/A+ int some_c_function(int(*cb)(int,...));
2719N/A """)
2719N/A lib = ffi.verify("""
2719N/A #include <stdarg.h>