Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android: test_os fails #71122

Closed
xdegaye mannequin opened this issue May 3, 2016 · 10 comments
Closed

android: test_os fails #71122

xdegaye mannequin opened this issue May 3, 2016 · 10 comments
Assignees
Labels
3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented May 3, 2016

BPO 26935
Nosy @loewis, @xdegaye, @vadmium, @moreati, @yan12125
Files
  • test_output.txt: test results
  • test_urandom_fd_reopened.patch
  • test_urandom_fd_reopened_2.patch
  • test_urandom_fd_reopened_3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/xdegaye'
    closed_at = <Date 2016-11-16.07:37:17.604>
    created_at = <Date 2016-05-03.15:03:20.194>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'android: test_os fails'
    updated_at = <Date 2016-11-16.07:37:17.602>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2016-11-16.07:37:17.602>
    actor = 'xdegaye'
    assignee = 'xdegaye'
    closed = True
    closed_date = <Date 2016-11-16.07:37:17.604>
    closer = 'xdegaye'
    components = ['Tests']
    creation = <Date 2016-05-03.15:03:20.194>
    creator = 'xdegaye'
    dependencies = []
    files = ['42700', '42768', '45335', '45368']
    hgrepos = []
    issue_num = 26935
    keywords = ['patch']
    message_count = 10.0
    messages = ['264736', '265074', '265099', '265124', '265127', '265144', '265249', '279984', '280124', '280920']
    nosy_count = 6.0
    nosy_names = ['loewis', 'xdegaye', 'python-dev', 'martin.panter', 'Alex.Willmer', 'yan12125']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue26935'
    versions = ['Python 3.6', 'Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 3, 2016

    One test of test_os fails on an android emulator running an x86 system image at API level 21.

    See the attached test_output.txt file.

    @xdegaye xdegaye mannequin added stdlib Python modules in the Lib dir build The build process and cross-build type-bug An unexpected behavior, bug, or error labels May 3, 2016
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 7, 2016

    On android dup2() returns with an error when both fds are the same:

    root@generic_x86:/data/local/tmp # python
    Python 3.6.0a0 (default:811ccdee6f87+, May  7 2016, 12:44:06) 
    [GCC 4.9 20140827 (prerelease)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os
    >>> os.dup2(1, 1)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: [Errno 22] Invalid argument

    The attached patch fixes this in test_urandom_fd_reopened.

    @vadmium
    Copy link
    Member

    vadmium commented May 7, 2016

    I think this is an Android bug. See specification <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html\>, fix <https://android.googlesource.com/platform/bionic/+/be52e658171edf6651895c40d1563289bafa52f7%5E!/\>.

    If the change is to go into Python, it would be good to include a comment admitting it is an Android workaround, rather than a general deficiency.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 8, 2016

    Since this seems to be fixed in a version of android that is more recent that API 21, maybe use the value of 'sdk.release' when platform.android_ver() is available after issue bpo-26855 is fixed, with for example, if this is fixed at API 23:

        sdk_release = platform.android_ver()[1]
        if new_fd != fd or not sdk_release or sdk_release >= 23:

    @vadmium
    Copy link
    Member

    vadmium commented May 8, 2016

    Yes something like that should do the trick

    @vadmium vadmium added tests Tests in the Lib/test dir and removed stdlib Python modules in the Lib dir build The build process and cross-build labels May 8, 2016
    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented May 8, 2016

    My implementation at bpo-26855 returns a tuple of strings like other funcitons, including java_ver() and mac_ver(). Maybe it requires a change.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 10, 2016

    This is fixed at API 23 (Android 6.0) and test_os runs on an android-23-x86 emulator without failures.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 3, 2016

    This new patch takes into account Martin comment in msg265099 and fixes a call to getpwall() as Android does not have getpwall().

    @xdegaye xdegaye mannequin added the 3.7 label Nov 3, 2016
    @xdegaye xdegaye mannequin self-assigned this Nov 3, 2016
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 5, 2016

    New patch. Thanks for the review Martin!

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 16, 2016

    New changeset 80e4cb5888f3 by Xavier de Gaye in branch '3.6':
    Issue bpo-26935: Fix broken Android dup2() in test_os
    https://hg.python.org/cpython/rev/80e4cb5888f3

    New changeset da59b7084dbe by Xavier de Gaye in branch 'default':
    Issue bpo-26935: Merge 3.6
    https://hg.python.org/cpython/rev/da59b7084dbe

    @xdegaye xdegaye mannequin closed this as completed Nov 16, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant