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