test failures on aarch64-linux-gnu

Bug #1271256 reported by Matthias Klose
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-cffi (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

test failures on aarch64-linux-gnu

see https://launchpad.net/ubuntu/+source/python-cffi/0.8.1-1/+build/5477901

=================================== FAILURES ===================================
___________________________ TestFFI.test_wchar_cast ____________________________

self = <testing.test_ffi_backend.TestFFI object at 0x580e910>

    def test_wchar_cast(self):
        ffi = FFI(backend=self.Backend())
        self.check_wchar_t(ffi)
        p = ffi.cast("int", ffi.cast("wchar_t", u+'\u1234'))
        assert int(p) == 0x1234
        p = ffi.cast("long long", ffi.cast("wchar_t", -1))
        if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned
            assert int(p) == 0xffff
        else: # 4 bytes, signed
> assert int(p) == -1
E assert 4294967295 == -1
E + where 4294967295 = int(<cdata 'long long' 4294967295>)

testing/backend_tests.py:759: AssertionError
________________ TestBitfield.test_bitfield_anonymous_no_align _________________

self = <testing.test_ffi_backend.TestBitfield instance at 0x76a7368>

    @pytest.mark.skipif("platform.machine().startswith('arm')")
    def test_bitfield_anonymous_no_align(self):
        L = FFI().alignof("long long")
> self.check("char y; int :1;", 0, 1, 2)

testing/test_ffi_backend.py:128:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <testing.test_ffi_backend.TestBitfield instance at 0x76a7368>
source = 'char y; int :1;', expected_ofs_y = 0, expected_align = 1
expected_size = 2

    def check(self, source, expected_ofs_y, expected_align, expected_size):
        # NOTE: 'expected_*' is the numbers expected from GCC.
        # The numbers expected from MSVC are not explicitly written
        # in this file, and will just be taken from the compiler.
        ffi = FFI()
        ffi.cdef("struct s1 { %s };" % source)
        ctype = ffi.typeof("struct s1")
        # verify the information with gcc
        ffi1 = FFI()
        ffi1.cdef("""
                static const int Gofs_y, Galign, Gsize;
                struct s1 *try_with_value(int fieldnum, long long value);
            """)
        fnames = [name for name, cfield in ctype.fields
                       if name and cfield.bitsize > 0]
        setters = ['case %d: s.%s = value; break;' % iname
                   for iname in enumerate(fnames)]
        lib = ffi1.verify("""
                struct s1 { %s };
                struct sa { char a; struct s1 b; };
                #define Gofs_y offsetof(struct s1, y)
                #define Galign offsetof(struct sa, b)
                #define Gsize sizeof(struct s1)
                struct s1 *try_with_value(int fieldnum, long long value)
                {
                    static struct s1 s;
                    memset(&s, 0, sizeof(s));
                    switch (fieldnum) { %s }
                    return &s;
                }
            """ % (source, ' '.join(setters)))
        if sys.platform == 'win32':
            expected_ofs_y = lib.Gofs_y
            expected_align = lib.Galign
            expected_size = lib.Gsize
        else:
> assert (lib.Gofs_y, lib.Galign, lib.Gsize) == (
                expected_ofs_y, expected_align, expected_size)
E assert (0L, 4L, 4L) == (0, 1, 2)
E At index 1 diff: 4L != 1

testing/test_ffi_backend.py:79: AssertionError
_______________________ TestBitfield.test_bitfield_zero ________________________

self = <testing.test_ffi_backend.TestBitfield instance at 0x73095a8>

    @pytest.mark.skipif("platform.machine().startswith('arm')")
    def test_bitfield_zero(self):
        L = FFI().alignof("long long")
> self.check("char y; int :0;", 0, 1, 4)

testing/test_ffi_backend.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <testing.test_ffi_backend.TestBitfield instance at 0x73095a8>
source = 'char y; int :0;', expected_ofs_y = 0, expected_align = 1
expected_size = 4

    def check(self, source, expected_ofs_y, expected_align, expected_size):
        # NOTE: 'expected_*' is the numbers expected from GCC.
        # The numbers expected from MSVC are not explicitly written
        # in this file, and will just be taken from the compiler.
        ffi = FFI()
        ffi.cdef("struct s1 { %s };" % source)
        ctype = ffi.typeof("struct s1")
        # verify the information with gcc
        ffi1 = FFI()
        ffi1.cdef("""
                static const int Gofs_y, Galign, Gsize;
                struct s1 *try_with_value(int fieldnum, long long value);
            """)
        fnames = [name for name, cfield in ctype.fields
                       if name and cfield.bitsize > 0]
        setters = ['case %d: s.%s = value; break;' % iname
                   for iname in enumerate(fnames)]
        lib = ffi1.verify("""
                struct s1 { %s };
                struct sa { char a; struct s1 b; };
                #define Gofs_y offsetof(struct s1, y)
                #define Galign offsetof(struct sa, b)
                #define Gsize sizeof(struct s1)
                struct s1 *try_with_value(int fieldnum, long long value)
                {
                    static struct s1 s;
                    memset(&s, 0, sizeof(s));
                    switch (fieldnum) { %s }
                    return &s;
                }
            """ % (source, ' '.join(setters)))
        if sys.platform == 'win32':
            expected_ofs_y = lib.Gofs_y
            expected_align = lib.Galign
            expected_size = lib.Gsize
        else:
> assert (lib.Gofs_y, lib.Galign, lib.Gsize) == (
                expected_ofs_y, expected_align, expected_size)
E assert (0L, 4L, 4L) == (0, 1, 4)
E At index 1 diff: 4L != 1

testing/test_ffi_backend.py:79: AssertionError
============= 3 failed, 1038 passed, 50 skipped in 235.30 seconds ==============

Revision history for this message
Stefano Rivera (stefanor) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-cffi - 0.8.1-1ubuntu2

---------------
python-cffi (0.8.1-1ubuntu2) trusty; urgency=medium

  * AArch64 fixes (Will Newton). LP: #1271256.
 -- Matthias Klose <email address hidden> Wed, 22 Jan 2014 13:30:00 +0100

Changed in python-cffi (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.