Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 610626 - dev-lang/python fails test_ctypes:test_struct_by_value (all versions) on arm64
Summary: dev-lang/python fails test_ctypes:test_struct_by_value (all versions) on arm64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL: https://bugs.python.org/issue23249
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks:
 
Reported: 2017-02-23 00:18 UTC by Mart Raudsepp
Modified: 2020-09-01 03:57 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log for python2.7 tests on arm64 (python27-build.log,308.34 KB, text/plain)
2017-02-23 00:18 UTC, Mart Raudsepp
Details
build.log with py3.5 (build.log,392.96 KB, text/plain)
2018-03-01 18:29 UTC, Mart Raudsepp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mart Raudsepp gentoo-dev 2017-02-23 00:18:17 UTC
Created attachment 464758 [details]
build.log for python2.7 tests on arm64

Ran 442 tests in 5.842s

FAILED (failures=1, skipped=86)
test test_ctypes failed -- Traceback (most recent call last):
  File "/tmp/portage/dev-lang/python-2.7.13/work/Python-2.7.13/Lib/ctypes/test/test_win32.py", line 112, in test_struct_by_value
    self.assertEqual(ret.left, left.value)
AssertionError: -200 != 10

Ran 15 tests in 1.481s

FAILED (failures=1)
test test_time failed -- Traceback (most recent call last):
  File "/tmp/portage/dev-lang/python-2.7.13/work/Python-2.7.13/Lib/test/test_time.py", line 120, in test_strptime
    (format, strf_output))
AssertionError: conversion specifier '%Z' failed with 'MSK' input.

2 tests failed again:
    test_ctypes test_time
Comment 1 Mart Raudsepp gentoo-dev 2017-02-23 00:19:32 UTC
# emerge --info '=dev-lang/python-2.7.13::gentoo'
Portage 2.3.3 (python 3.4.5-final-0, default/linux/arm64/13.0/systemd, gcc-5.4.0, glibc-2.23-r3, 4.4.23-linaro-lt-qcom aarch64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.4.23-linaro-lt-qcom-aarch64-with-gentoo-2.3
KiB Mem:      853292 total,    663608 free
KiB Swap:    4194300 total,   4099604 free
sh bash 4.4_p11
ld GNU ld (Gentoo 2.27 p1.0) 2.27
app-shells/bash:          4.4_p11::gentoo
dev-lang/perl:            5.24.1::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo, 3.5.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.19.1::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo, 2.27::gentoo
sys-devel/gcc:            4.9.4::gentoo, 5.4.0-r2::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /home/leio/gentoo/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -march=armv8-a+crc -mcpu=cortex-a53 -mfix-cortex-a53-835769"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2"
DISTDIR="/distfiles"
FCFLAGS="-O2"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2"
GENTOO_MIRRORS="http://mirror.mdfnet.se/gentoo/"
LANG="et_EE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4 -l6"
PKGDIR="/distfiles/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
USE="acl arm64 bzip2 cli cracklib crypt cxx dri fortran iconv ipv6 modules multilib ncurses nls nptl openmp pam pcre readline seccomp session ssl systemd tcpd udev unicode xattr zlib" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_5" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 Mart Raudsepp gentoo-dev 2017-02-23 00:50:15 UTC
python-3.4.6 also fails test_struct_by_value in the same way, but not the test_strptime test (unless it's luck involved)
Comment 3 Mart Raudsepp gentoo-dev 2017-02-23 01:00:11 UTC
https://bugs.python.org/issue23249 for the test_win32 failure
Comment 4 Mart Raudsepp gentoo-dev 2017-02-23 02:07:21 UTC
Moving the time test out of here to a new bug, as it's failing on amd64 as well, while this ctypes test failure is arm64 specific per $URL
Comment 5 Mart Raudsepp gentoo-dev 2017-02-23 04:13:43 UTC
dev-python/cffi-1.9.1 fails similarly:

testing/cffi0/test_ffi_backend.py::TestFFI::test_struct_by_value <- testing/cffi0/test_ownlib.py FAILED

====================================== FAILURES =======================================
____________________________ TestFFI.test_struct_by_value _____________________________

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

    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           assert -200 == 10
E            +  where -200 = <cdata 'RECT' owning 32 bytes>.left
E            +  and   10 = <cffi.api.FFILibrary_/tmp/portage/dev-python/cffi-1.9.1/temp/ffi-0/testownlib.so object at 0x7f922093d0>.left

testing/cffi0/test_ownlib.py:281: AssertionError
!!!!!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!
================== 1 failed, 486 passed, 29 skipped in 57.75 seconds ==================
Comment 6 Mart Raudsepp gentoo-dev 2017-02-23 04:14:28 UTC
libffi tests succeed, but maybe they don't exercise this case and the issue is in there instead?
Comment 7 Mart Raudsepp gentoo-dev 2018-03-01 18:29:00 UTC
Created attachment 521738 [details]
build.log with py3.5

further failures on current stable, but still including ctypes
Comment 8 Mart Raudsepp gentoo-dev 2018-03-01 18:31:13 UTC
emerge --info for the latest, just in case:

Portage 2.3.6 (python 2.7.12-final-0, default/linux/arm64/17.0, gcc-6.4.0, glibc-2.25-r9, 4.9.0-4-arm64 aarch64)
=================================================================
System uname: Linux-4.9.0-4-arm64-aarch64-with-gentoo-2.3
KiB Mem:   131544964 total, 123989208 free
KiB Swap:    3321056 total,   3321056 free
Timestamp of repository gentoo: Thu, 01 Mar 2018 17:00:01 +0000
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-lang/perl:            5.24.1-r2::gentoo
dev-lang/python:          2.7.12::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r9::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="arm64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2"
GENTOO_MIRRORS="http://gentoo.osuosl.org/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j96"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl arm64 berkdb bzip2 cli crypt cxx dri fortran gdbm iconv ipv6 modules multilib ncurses nls nptl openmp pam pcre readline seccomp ssl tcpd unicode xattr zlib" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp neon thumb thumb2 v4 v5 v6 v7 v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby21 ruby22 ruby23" USERLAND="GNU" VIDEO_CARDS="fbdev dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 9 Marcus Comstedt 2018-04-21 12:02:52 UTC
(In reply to Mart Raudsepp from comment #6)
> libffi tests succeed, but maybe they don't exercise this case and the issue
> is in there instead?

Yes, the test_ctypes failure does not happen when using a more recent libffi.

I tested this by:

* Applying all upstreams commits from https://github.com/libffi/libffi, starting at v3.2.1 and stopping at 4fe1aea, to src/aarch64 in the libffi source tree
* Building and installing the resulting libffi
* Running "ebuild /usr/portage/dev-lang/python/python-2.7.14-r1.ebuild test"
Comment 10 Mart Raudsepp gentoo-dev 2018-10-16 09:03:52 UTC
In libffi-3.3_rc0 I see ChangeLog saying this, however:

Date:   Tue Feb 20 10:47:09 2018 +0100

    Revert "Fix passing struct by value on aarch64"
    
    This reverts commit 482b37f00467325e3389bab322525099860dd9aa.
    
    That was actually a bug in python, see <https://bugs.python.org/issue30353>.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-09-01 03:57:48 UTC
(In reply to Marcus Comstedt from comment #9)
> (In reply to Mart Raudsepp from comment #6)
> > libffi tests succeed, but maybe they don't exercise this case and the issue
> > is in there instead?
> 
> Yes, the test_ctypes failure does not happen when using a more recent libffi.
> 
> I tested this by:
> 
> * Applying all upstreams commits from https://github.com/libffi/libffi,
> starting at v3.2.1 and stopping at 4fe1aea, to src/aarch64 in the libffi
> source tree
> * Building and installing the resulting libffi
> * Running "ebuild /usr/portage/dev-lang/python/python-2.7.14-r1.ebuild test"

Based on this and the fact I've not seen this since, I think we're OK to close now.