7083N/A
2756N/AThe testsuite makes some incorrect assumptions:
2756N/A
7083N/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
7083N/A - We need to not assume "a standard gcc", so replace the -Werror flag
7083N/A with -errwarn to turn on the warnings are expected to cause compilation
7083N/A to fail. Also, there is no equivalent for -Wconversion in Studio, so turn
7083N/A off testing for conversion errors.
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
7083N/A - There is one test helper in test_recompiler where we suddenly try to do C++
7083N/A but without changing the compiler executable. This works in gcc but not with
7083N/A Studio.
2756N/A
7083N/A - test_recompiler has some test cases work in gcc or clang but not with Studio:
7083N/A test_some_float_type and test_some_float_invalid_3 raise an error "non-constant
7083N/A initializer involving a cast".
7083N/A test_restrict_fields uses the __restrict keyword, which seems to require gcc.
7083N/A
7083N/A - Don't force the use of gcc when compiling a test shared object; get
7083N/A that passed in from the makefile.
7083N/A
7083N/A
7083N/A--- cffi-1.1.2/testing/cffi0/callback_in_thread.py 2015-06-09 03:04:07.000000000 -0700
7083N/A+++ cffi-1.1.2/testing/cffi0/callback_in_thread.py 2015-08-11 10:56:22.822161292 -0700
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):
7083N/A--- cffi-1.1.2/testing/cffi0/test_verify.py 2015-06-09 03:04:07.000000000 -0700
7083N/A+++ cffi-1.1.2/testing/cffi0/test_verify.py 2015-08-12 14:17:18.300215250 -0700
7083N/A@@ -18,6 +18,9 @@
7083N/A extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion']
7083N/A # special things for clang
7083N/A extra_compile_args.append('-Qunused-arguments')
7083N/A+ elif (sys.platform == 'sunos5'):
7083N/A+ extra_compile_args = ["-errtags=yes",
7083N/A+ "-errwarn=E_ASSIGNMENT_TYPE_MISMATCH,E_RETURN_VALUE_TYPE_MISMATCH"]
7083N/A else:
7083N/A # assume a standard gcc
7083N/A extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion']
7083N/A@@ -95,6 +98,11 @@
7083N/A py.test.skip("needs GCC or Clang")
2756N/A ffi = FFI()
7083N/A ffi.cdef(cdef)
7083N/A+
7083N/A+ if sys.platform == 'sunos5':
7083N/A+ lib = ffi.verify(source, **kargs)
7083N/A+ return lib
7083N/A+
7083N/A py.test.raises(VerificationError, ffi.verify, source, **kargs)
7083N/A extra_compile_args_orig = extra_compile_args[:]
7083N/A extra_compile_args.remove('-Wconversion')
7083N/A@@ -1737,13 +1745,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, ... };")
7083N/A@@ -1768,7 +1776,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)
7083N/A--- cffi-1.1.2/testing/cffi1/test_new_ffi_1.py 2015-06-09 03:04:07.000000000 -0700
7083N/A+++ cffi-1.1.2/testing/cffi1/test_new_ffi_1.py 2015-08-12 15:18:12.105387245 -0700
7083N/A@@ -81,6 +81,10 @@
7083N/A DEFS = DEFS.replace('data[0]', 'data[1]') # not supported
7083N/A CCODE = (DEFS + "\n#pragma pack(push,1)\n" + DEFS_PACKED +
7083N/A "\n#pragma pack(pop)\n")
7083N/A+ elif sys.platform == "sunos5":
7083N/A+ DEFS = DEFS.replace('data[0]', 'data[1]') # not supported
7083N/A+ CCODE = (DEFS +
7083N/A+ DEFS_PACKED.replace('/*here*/', '__attribute__((packed))'))
7083N/A else:
7083N/A CCODE = (DEFS +
7083N/A DEFS_PACKED.replace('/*here*/', '__attribute__((packed))'))
7083N/A@@ -893,9 +897,9 @@
7083N/A assert ffi.cast("enum foq", 0) != ffi.cast("enum bar", 0)
7083N/A assert ffi.cast("enum bar", 0) != ffi.cast("int", 0)
7083N/A assert repr(ffi.cast("enum bar", -1)) == "<cdata 'enum bar' -1: CC1>"
7083N/A- assert repr(ffi.cast("enum foq", -1)) == ( # enums are unsigned, if
7083N/A- "<cdata 'enum foq' 4294967295>") or ( # they contain no neg value
7083N/A- sys.platform == "win32") # (but not on msvc)
7083N/A+ assert repr(ffi.cast("enum foq", -1)) == ( # enums are unsigned, if
7083N/A+ "<cdata 'enum foq' 4294967295>") or ( # they contain no neg value
7083N/A+ sys.platform in ("win32", "sunos5")) # (but not on msvc or SS)
7083N/A # enum baz { A2=0x1000, B2=0x2000 };
7083N/A assert ffi.string(ffi.cast("enum baz", 0x1000)) == "A2"
7083N/A assert ffi.string(ffi.cast("enum baz", 0x2000)) == "B2"
7083N/A@@ -1011,7 +1015,7 @@
7083N/A def test_bitfield_enum(self):
7083N/A # typedef enum { AA1, BB1, CC1 } foo_e_t;
7083N/A # typedef struct { foo_e_t f:2; } bfenum_t;
7083N/A- if sys.platform == "win32":
7083N/A+ if sys.platform in ("win32", "sunos5"):
7083N/A py.test.skip("enums are not unsigned")
7083N/A s = ffi.new("bfenum_t *")
7083N/A s.f = 2
7083N/A@@ -1211,7 +1215,7 @@
7083N/A assert repr(p.a).startswith("<cdata 'int[2]' 0x")
7083N/A
7083N/A def test_struct_containing_array_varsize_workaround(self):
7083N/A- if sys.platform == "win32":
7083N/A+ if sys.platform in ("win32", "sunos5"):
7083N/A py.test.skip("array of length 0 not supported")
7083N/A # struct array0 { int len; short data[0]; };
7083N/A p = ffi.new("char[]", ffi.sizeof("struct array0") + 7 * SIZE_OF_SHORT)
7083N/A--- cffi-1.1.2/testing/cffi1/test_recompiler.py 2015-06-09 03:04:10.000000000 -0700
7083N/A+++ cffi-1.1.2/testing/cffi1/test_recompiler.py 2015-08-11 11:08:16.757848317 -0700
7083N/A@@ -22,10 +22,14 @@
7083N/A kwds.setdefault('undef_macros', ['NDEBUG'])
7083N/A module_name = '_CFFI_' + module_name
7083N/A ffi.set_source(module_name, source)
7083N/A- if not os.environ.get('NO_CPP'): # test the .cpp mode too
7083N/A+ if sys.platform == 'sunos5':
7083N/A+ kwds['extra_compile_args'] = (kwds.get('extra_compile_args', []) +
7083N/A+ ["-errtags=yes", "-errwarn=E_ASSIGNMENT_TYPE_MISMATCH,"
7083N/A+ "E_RETURN_VALUE_TYPE_MISMATCH"])
7083N/A+ elif not os.environ.get('NO_CPP'): # test the .cpp mode too
7083N/A kwds.setdefault('source_extension', '.cpp')
7083N/A source = 'extern "C" {\n%s\n}' % (source,)
7083N/A else:
7083N/A kwds['extra_compile_args'] = (kwds.get('extra_compile_args', []) +
7083N/A ['-Werror'])
7083N/A return recompiler._verify(ffi, module_name, source, *args, **kwds)
7083N/A@@ -1076,2 +1076,3 @@
7083N/A def test_some_float_type():
7083N/A+ py.test.skip("needs GCC or Clang")
7083N/A ffi = FFI()
7083N/A@@ -1111,2 +1111,3 @@
7083N/A def test_some_float_invalid_3():
7083N/A+ py.test.skip("needs GCC or Clang")
7083N/A ffi = FFI()
7083N/A@@ -1225,2 +1225,3 @@
7083N/A def test_restrict_fields():
7083N/A+ py.test.skip("needs GCC or Clang")
2756N/A ffi = FFI()
7083N/A--- cffi-1.1.2/testing/cffi1/test_verify1.py 2015-06-09 03:04:07.000000000 -0700
7083N/A+++ cffi-1.1.2/testing/cffi1/test_verify1.py 2015-08-12 15:02:07.774160223 -0700
7083N/A@@ -18,6 +18,9 @@
7083N/A extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion']
7083N/A # special things for clang
7083N/A extra_compile_args.append('-Qunused-arguments')
7083N/A+ elif (sys.platform == 'sunos5'):
7083N/A+ extra_compile_args = ["-errtags=yes",
7083N/A+ "-errwarn=E_ASSIGNMENT_TYPE_MISMATCH,E_RETURN_VALUE_TYPE_MISMATCH"]
7083N/A else:
7083N/A # assume a standard gcc
7083N/A extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion']
7083N/A@@ -75,6 +77,10 @@
7083N/A py.test.skip("needs GCC or Clang")
7083N/A ffi = FFI()
7083N/A ffi.cdef(cdef)
7083N/A+ if sys.platform == 'sunos5':
7083N/A+ lib = ffi.verify(source, **kargs)
7083N/A+ return lib
7083N/A+
7083N/A py.test.raises(VerificationError, ffi.verify, source, **kargs)
7083N/A extra_compile_args_orig = extra_compile_args[:]
7083N/A extra_compile_args.remove('-Wconversion')
7083N/A@@ -1726,13 +1732,13 @@
7083N/A ('-123', 4, -1),
7083N/A ('-2147483647-1', 4, -1),
7083N/A ]
7083N/A- if FFI().sizeof("long") == 8:
7083N/A+ if FFI().sizeof("long") == 8 and sys.platform != 'sunos5':
7083N/A cases += [('4294967296L', 8, 2**64-1),
7083N/A ('%dUL' % (2**64-1), 8, 2**64-1),
7083N/A ('-2147483649L', 8, -1),
7083N/A ('%dL-1L' % (1-2**63), 8, -1)]
7083N/A for hidden_value, expected_size, expected_minus1 in cases:
7083N/A- if sys.platform == 'win32' and 'U' in hidden_value:
7083N/A+ if sys.platform in ('win32', 'sunos5') and 'U' in hidden_value:
7083N/A continue # skipped on Windows
7083N/A ffi = FFI()
7083N/A ffi.cdef("enum foo_e { AA, BB, ... };")
7083N/A@@ -1740,7 +1746,7 @@
7083N/A assert lib.AA == 0
7083N/A assert lib.BB == eval(hidden_value.replace('U', '').replace('L', ''))
7083N/A assert ffi.sizeof("enum foo_e") == expected_size
7083N/A- if sys.platform != 'win32':
7083N/A+ if sys.platform not in ('win32', 'sunos5'):
7083N/A assert int(ffi.cast("enum foo_e", -1)) == expected_minus1
7083N/A # test with the large value hidden:
7083N/A # disabled so far, doesn't work
7083N/A@@ -1759,7 +1765,7 @@
7083N/A (0xffffffff, 'U'),
7083N/A (maxulong, 'UL'),
7083N/A (-int(maxulong / 3), 'L')]:
7083N/A- if c2c and sys.platform == 'win32':
7083N/A+ if c2c and sys.platform in ('win32', 'sunos5'):
7083N/A continue # enums may always be signed with MSVC
7083N/A ffi = FFI()
7083N/A ffi.cdef("enum foo_e { AA };")
7083N/A--- cffi-1.1.2/testing/cffi0/test_ownlib.py 2015-06-09 03:04:07.000000000 -0700
7083N/A+++ cffi-1.1.2/testing/cffi0/test_ownlib.py 2015-08-12 13:55:21.239982926 -0700
7083N/A@@ -1,4 +1,4 @@
7083N/A-import py, sys
7083N/A+import os, py, sys
7083N/A import subprocess, weakref
7083N/A from cffi import FFI
7083N/A from cffi.backend_ctypes import CTypesBackend
7083N/A@@ -102,7 +102,6 @@
7083N/A from testing.udir import udir
7083N/A udir.join('testownlib.c').write(SOURCE)
7083N/A if sys.platform == 'win32':
7083N/A- import os
7083N/A # did we already build it?
7083N/A if os.path.exists(str(udir.join('testownlib.dll'))):
7083N/A cls.module = str(udir.join('testownlib.dll'))
7083N/A@@ -129,7 +128,7 @@
7083N/A cls.module = str(udir.join('testownlib.dll'))
7083N/A else:
7083N/A subprocess.check_call(
7083N/A- 'gcc testownlib.c -shared -fPIC -o testownlib.so',
7083N/A+ os.getenv('TESTOWNLIB_CC') % ('testownlib.c', 'testownlib.so'),
7083N/A cwd=str(udir), shell=True)
7083N/A cls.module = str(udir.join('testownlib.so'))
7083N/A