Bug#893745: python-cffi: FTBFS on ia64: several test failures

"Aaron M. Ucko" <[email protected]>
Newsgroups gmane.linux.debian.ports.ia64
Message-ID <152167334198.29079.7593939677313164089.reportbug__32349.9920931228$1521673461$gmane$org@ghostwheel.internal.ucko.debian.net>
Source: python-cffi
Version: 1.11.5-1
Severity: important
Tags: upstream
Justification: fails to build from source (but built successfully in the past)
User: [email protected]
Usertags: ia64

Builds of python-cffi for ia64 (admittedly not a release architecture)
have been failing lately, per the below excerpts from [1].

Could you please take a look?

Thanks!

[1] https://buildd.debian.org/status/fetch.php?pkg=python-cffi&arch=ia64&ver=1.11.5-1&stamp=1519768961&raw=0

----------------------------------------------------------------------

I: pybuild base:184: python2.7 -m pytest c/ testing/
============================= test session starts ==============================
[...]
=================================== FAILURES ===================================
__________________________ test_struct_return_in_func __________________________

    def test_struct_return_in_func():
        BChar = new_primitive_type("char")
        BShort = new_primitive_type("short")
        BFloat = new_primitive_type("float")
        BDouble = new_primitive_type("double")
        BInt = new_primitive_type("int")
        BStruct = new_struct_type("struct foo_s")
        complete_struct_or_union(BStruct, [('a1', BChar, -1),
                                           ('a2', BShort, -1)])
        BFunc10 = new_function_type((BInt,), BStruct)
        f = cast(BFunc10, _testfunc(10))
        s = f(40)
        assert repr(s) == "<cdata 'struct foo_s' owning 4 bytes>"
>       assert s.a1 == bytechr(40)
E       AssertionError: assert '\x00' == '('
E         - \x00
E         + (

c/test_c.py:2014: AssertionError
_________________________ TestFFI.test_struct_by_value _________________________

self = <testing.cffi0.test_ffi_backend.TestFFI object at 0x2000000001b312d0>

    def test_struct_by_value(self):
        if self.module is None:
            py.test.skip("fix the auto-generation of the tiny test lib")
        ffi = FFI(backend=self.Backend())
        ffi.cdef("""
                typedef struct {
                    long x;
                    long y;
                } POINT;
    
                typedef struct {
                    long left;
                    long top;
                    long right;
                    long bottom;
                } RECT;
    
                long left, top, right, bottom;
    
                RECT ReturnRect(int i, RECT ar, RECT* br, POINT cp, RECT dr,
                            RECT *er, POINT fp, RECT gr);
            """)
        ownlib = ffi.dlopen(self.module)
    
        rect = ffi.new('RECT[1]')
        pt = ffi.new('POINT[1]')
        pt[0].x = 15
        pt[0].y = 25
        rect[0].left = ownlib.left
        rect[0].right = ownlib.right
        rect[0].top = ownlib.top
        rect[0].bottom = ownlib.bottom
    
        for i in range(4):
            ret = ownlib.ReturnRect(i, rect[0], rect, pt[0], rect[0],
                                    rect, pt[0], rect[0])
>           assert ret.left == ownlib.left
E           AssertionError: assert 18014398513676288 == 10
E            +  where 18014398513676288 = <cdata 'RECT' owning 32 bytes>.left
E            +  and   10 = <cffi.api.FFILibrary_/tmp/ffi-0/testownlib.so object at 0x2000000001b31410>.left

testing/cffi0/test_ownlib.py:296: AssertionError
_______________________ TestOwnLib.test_struct_by_value ________________________

self = <testing.cffi0.test_ownlib.TestOwnLib object at 0x2000000003d6b4d0>

    def test_struct_by_value(self):
        if self.module is None:
            py.test.skip("fix the auto-generation of the tiny test lib")
        ffi = FFI(backend=self.Backend())
        ffi.cdef("""
                typedef struct {
                    long x;
                    long y;
                } POINT;
    
                typedef struct {
                    long left;
                    long top;
                    long right;
                    long bottom;
                } RECT;
    
                long left, top, right, bottom;
    
                RECT ReturnRect(int i, RECT ar, RECT* br, POINT cp, RECT dr,
                            RECT *er, POINT fp, RECT gr);
            """)
        ownlib = ffi.dlopen(self.module)
    
        rect = ffi.new('RECT[1]')
        pt = ffi.new('POINT[1]')
        pt[0].x = 15
        pt[0].y = 25
        rect[0].left = ownlib.left
        rect[0].right = ownlib.right
        rect[0].top = ownlib.top
        rect[0].bottom = ownlib.bottom
    
        for i in range(4):
            ret = ownlib.ReturnRect(i, rect[0], rect, pt[0], rect[0],
                                    rect, pt[0], rect[0])
>           assert ret.left == ownlib.left
E           AssertionError: assert 18014398513676288 == 123457
E            +  where 18014398513676288 = <cdata 'RECT &' 0x60000000004faba0>.left
E            +  and   123457 = <cffi.api.FFILibrary_/tmp/ffi-0/testownlib.so object at 0x20000000036887d0>.left

testing/cffi0/test_ownlib.py:296: AssertionError
_______________________ test_no_unknown_exported_symbols _______________________

    def test_no_unknown_exported_symbols():
        if not hasattr(_cffi_backend, '__file__'):
            py.test.skip("_cffi_backend module is built-in")
        if not sys.platform.startswith('linux'):
            py.test.skip("linux-only")
        g = os.popen("objdump -T '%s'" % _cffi_backend.__file__, 'r')
        for line in g:
            if not line.startswith('0'):
                continue
            if '*UND*' in line:
                continue
            name = line.split()[-1]
            if name.startswith('_') or name.startswith('.'):
                continue
            if name not in ('init_cffi_backend', 'PyInit__cffi_backend'):
>               raise Exception("Unexpected exported name %r" % (name,))
E               Exception: Unexpected exported name 'ctypedescr_clear'

testing/cffi1/test_cffi_binary.py:19: Exception
_______________________ test_win32_calling_convention_3 ________________________

    def test_win32_calling_convention_3():
        ffi = FFI()
        ffi.cdef("""
            struct point { int x, y; };
    
            int (*const cb1)(struct point);
            int (__stdcall *const cb2)(struct point);
    
            struct point __stdcall call1(int(*cb)(struct point));
            struct point call2(int(__stdcall *cb)(struct point));
        """)
        lib = verify(ffi, 'test_win32_calling_convention_3', r"""
            #ifndef _MSC_VER
            #  define __cdecl
            #  define __stdcall
            #endif
            struct point { int x, y; };
            int           cb1(struct point pt) { return pt.x + 10 * pt.y; }
            int __stdcall cb2(struct point pt) { return pt.x + 100 * pt.y; }
            struct point __stdcall call1(int(__cdecl *cb)(struct point)) {
                int i;
                struct point result = { 0, 0 };
                //printf("here1\n");
                //printf("cb = %p, cb1 = %p\n", cb, (void *)cb1);
                for (i = 0; i < 1000; i++) {
                    struct point p = { i, -i };
                    int r = cb(p);
                    result.x += r;
                    result.y -= r;
                }
                return result;
            }
            struct point __cdecl call2(int(__stdcall *cb)(struct point)) {
                int i;
                struct point result = { 0, 0 };
                for (i = 0; i < 1000; i++) {
                    struct point p = { -i, i };
                    int r = cb(p);
                    result.x += r;
                    result.y -= r;
                }
                return result;
            }
        """)
        ptr_call1 = ffi.addressof(lib, 'call1')
        ptr_call2 = ffi.addressof(lib, 'call2')
        if sys.platform == 'win32' and not sys.maxsize > 2**32:
            py.test.raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2'))
            py.test.raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2'))
            py.test.raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1'))
            py.test.raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1'))
        pt = lib.call1(ffi.addressof(lib, 'cb1'))
        assert (pt.x, pt.y) == (-9*500*999, 9*500*999)
        pt = ptr_call1(ffi.addressof(lib, 'cb1'))
>       assert (pt.x, pt.y) == (-9*500*999, 9*500*999)
E       assert (0, 8388607) == (-4495500, 4495500)
E         At index 0 diff: 0 != -4495500
E         Use -v to get the full diff

testing/cffi1/test_recompiler.py:1534: AssertionError
----------------------------- Captured stdout call -----------------------------
generating /tmp/ffi-0/_CFFI_test_win32_calling_convention_3.cpp
setting the current directory to '/tmp/ffi-0'
running build_ext
building '_CFFI_test_win32_calling_convention_3' extension
ia64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -UNDEBUG -I/usr/include/python2.7 -c _CFFI_test_win32_calling_convention_3.cpp -o ./_CFFI_test_win32_calling_convention_3.o
ia64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-diLoLc/python2.7-2.7.14=. -Wformat -Werror=format-security -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 ./_CFFI_test_win32_calling_convention_3.o -o ./_CFFI_test_win32_calling_convention_3.so
----------------------------- Captured stderr call -----------------------------
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
__________________________ test_extern_python_struct ___________________________

    def test_extern_python_struct():
        ffi = FFI()
        ffi.cdef("""
            struct foo_s { int a, b, c; };
            extern "Python" int bar(int, struct foo_s, int);
            extern "Python" { struct foo_s baz(int, int);
                              struct foo_s bok(void); }
        """)
        lib = verify(ffi, 'test_extern_python_struct',
                     "struct foo_s { int a, b, c; };")
        #
        @ffi.def_extern()
        def bar(x, s, z):
            return x + s.a + s.b + s.c + z
        res = lib.bar(1000, [1001, 1002, 1004], 1008)
        assert res == 5015
        #
        @ffi.def_extern()
        def baz(x, y):
            return [x + y, x - y, x * y]
        res = lib.baz(1000, 42)
>       assert res.a == 1042
E       AssertionError: assert 1109917696 == 1042
E        +  where 1109917696 = <cdata 'struct foo_s' owning 12 bytes>.a

testing/cffi1/test_recompiler.py:1675: AssertionError
----------------------------- Captured stdout call -----------------------------
generating /tmp/ffi-0/_CFFI_test_extern_python_struct.cpp
setting the current directory to '/tmp/ffi-0'
running build_ext
building '_CFFI_test_extern_python_struct' extension
ia64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -UNDEBUG -I/usr/include/python2.7 -c _CFFI_test_extern_python_struct.cpp -o ./_CFFI_test_extern_python_struct.o
ia64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-diLoLc/python2.7-2.7.14=. -Wformat -Werror=format-security -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 ./_CFFI_test_extern_python_struct.o -o ./_CFFI_test_extern_python_struct.so
----------------------------- Captured stderr call -----------------------------
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.