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

test_gdb fails all tests on a profile-opt build configured --with-lto #70975

Closed
gpshead opened this issue Apr 17, 2016 · 7 comments
Closed

test_gdb fails all tests on a profile-opt build configured --with-lto #70975

gpshead opened this issue Apr 17, 2016 · 7 comments
Labels
build The build process and cross-build

Comments

@gpshead
Copy link
Member

gpshead commented Apr 17, 2016

BPO 26788
Nosy @gpshead, @vstinner, @methane
Files
  • issue26788.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 = None
    closed_at = <Date 2020-06-11.13:41:00.063>
    created_at = <Date 2016-04-17.06:29:59.307>
    labels = ['build']
    title = 'test_gdb fails all tests on a profile-opt build configured --with-lto'
    updated_at = <Date 2020-06-11.13:41:00.060>
    user = 'https://github.com/gpshead'

    bugs.python.org fields:

    activity = <Date 2020-06-11.13:41:00.060>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-06-11.13:41:00.063>
    closer = 'vstinner'
    components = ['Build']
    creation = <Date 2016-04-17.06:29:59.307>
    creator = 'gregory.p.smith'
    dependencies = []
    files = ['42574']
    hgrepos = []
    issue_num = 26788
    keywords = ['patch']
    message_count = 7.0
    messages = ['263599', '263625', '264055', '287979', '287982', '288021', '371279']
    nosy_count = 4.0
    nosy_names = ['gregory.p.smith', 'vstinner', 'methane', 'alecsandru.patrascu']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue26788'
    versions = ['Python 3.5', 'Python 3.6']

    @gpshead
    Copy link
    Member Author

    gpshead commented Apr 17, 2016

    cpython/build35.lto$ ./python ../3.5/Lib/test/test_gdb.py
    GDB version 7.10:
    GNU gdb (Ubuntu 7.10-1ubuntu2) 7.10
    ...
    ======================================================================
    FAIL: test_tuples (main.PrettyPrintTests)
    Verify the pretty-printing of tuples
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "../3.5/Lib/test/test_gdb.py", line 359, in test_tuples
        self.assertGdbRepr(tuple(), '()')
      File "../3.5/Lib/test/test_gdb.py", line 279, in assertGdbRepr
        gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')')
      File "../3.5/Lib/test/test_gdb.py", line 255, in get_gdb_repr
        self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output))
    AssertionError: Unexpected gdb output: 'Breakpoint 1 at 0x4cc310\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".\n\nBreakpoint 1, builtin_id ()\n#0  builtin_id ()\n'
    Breakpoint 1 at 0x4cc310
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

    Breakpoint 1, builtin_id ()
    #0 builtin_id ()

    I don't know the right thing to do here. This might depend on compiler, linker, arch and gdb version? Are it's LTO executables debuggable? It's not clear to me that we can do anything about this. We may just want to skip the test when configured --with-lto. Or perhaps this is an indication that this specific toolchain's LTO build (x86_64, ubuntu wily gcc 5.2.1 and gdb 7.1.0) has issues and shouldn't be used?

    @gpshead gpshead added the build The build process and cross-build label Apr 17, 2016
    @alecsandrupatrascu
    Copy link
    Mannequin

    alecsandrupatrascu mannequin commented Apr 17, 2016

    I will investigate this issue to understand what is happening there and submit a fix. Thank you for pointing out the exact OS and toolchain used.

    @alecsandrupatrascu
    Copy link
    Mannequin

    alecsandrupatrascu mannequin commented Apr 23, 2016

    I uploaded a patch that skips these tests if optimizations are available.

    @methane
    Copy link
    Member

    methane commented Feb 17, 2017

    LGTM, but would you send pull request on Github?

    @vstinner
    Copy link
    Member

    +@unittest.skipIf(python_is_optimized(),
    + "Python was compiled with optimizations")
    class PrettyPrintTests(DebuggerTests):

    I disagree with this skip. I just compiled Python with "./configure" and GCC: these tests pass. Except of one buildbot, PGO is not used on buildbots nor Travis CI. I would prefer to keep running these tests by default, but only skip on PGO build.

    By the way, would it maybe possible to find the missing information "<optimized out>" from other variables?

    @gpshead
    Copy link
    Member Author

    gpshead commented Feb 17, 2017

    there may be something in sysconfig.get_config_vars() we could use or, better, we could add something specific to indicate both pgo and lto builds.

    @vstinner
    Copy link
    Member

    I fail to reproduce the issue on the master branch of Python on Fedora 32:

    • Python master at commit 9727694
    • Fedora 32
    • gcc (GCC) 10.1.1
    • GNU gdb (GDB) Fedora 9.1-5.fc32

    Notice that multiple tests are skipped:

    $ ./configure --with-lto && make && ./python -m test -v test_gdb 
    (...)
    gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 (...)
    (...)
    == CPython 3.10.0a0 (heads/master:9727694f08, Jun 11 2020, 15:31:25) [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
    == Linux-5.6.16-300.fc32.x86_64-x86_64-with-glibc2.31 little-endian
    == cwd: /home/vstinner/python/master/build/test_python_139705
    == CPU count: 8
    == encodings: locale=UTF-8, FS=utf-8
    0:00:00 load avg: 2.77 Run tests sequentially
    0:00:00 load avg: 2.77 [1/1] test_gdb
    GDB version 9.1:
        GNU gdb (GDB) Fedora 9.1-5.fc32
        Copyright (C) 2020 Free Software Foundation, Inc.
        License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
        This is free software: you are free to change and redistribute it.
        There is NO WARRANTY, to the extent permitted by law.
    test_NULL_ob_type (test.test_gdb.PrettyPrintTests)
    Ensure that a PyObject* with NULL ob_type is handled gracefully ... ok
    test_NULL_ptr (test.test_gdb.PrettyPrintTests)
    Ensure that a NULL PyObject* is handled gracefully ... ok
    test_builtin_method (test.test_gdb.PrettyPrintTests) ... ok
    test_builtins_help (test.test_gdb.PrettyPrintTests)
    Ensure that the new-style class _Helper in site.py can be handled ... ok
    test_bytes (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of bytes ... ok
    test_corrupt_ob_type (test.test_gdb.PrettyPrintTests)
    Ensure that a PyObject* with a corrupt ob_type is handled gracefully ... ok
    test_corrupt_tp_flags (test.test_gdb.PrettyPrintTests)
    Ensure that a PyObject* with a type with corrupt tp_flags is handled ... ok
    test_corrupt_tp_name (test.test_gdb.PrettyPrintTests)
    Ensure that a PyObject* with a type with corrupt tp_name is handled ... ok
    test_dicts (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of dictionaries ... ok
    test_exceptions (test.test_gdb.PrettyPrintTests) ... ok
    test_frames (test.test_gdb.PrettyPrintTests) ... ok
    test_frozensets (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of frozensets ... ok
    test_getting_backtrace (test.test_gdb.PrettyPrintTests) ... ok
    test_int (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of various int values ... ok
    test_lists (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of lists ... ok
    test_modern_class (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of new-style class instances ... ok
    test_selfreferential_dict (test.test_gdb.PrettyPrintTests)
    Ensure that a reference loop involving a dict doesn't lead proxyval ... ok
    test_selfreferential_list (test.test_gdb.PrettyPrintTests)
    Ensure that a reference loop involving a list doesn't lead proxyval ... ok
    test_selfreferential_new_style_instance (test.test_gdb.PrettyPrintTests) ... ok
    test_selfreferential_old_style_instance (test.test_gdb.PrettyPrintTests) ... ok
    test_sets (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of sets ... ok
    test_singletons (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of True, False and None ... ok
    test_strings (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of unicode strings ... ok
    test_subclassing_list (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of an instance of a list subclass ... ok
    test_subclassing_tuple (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of an instance of a tuple subclass ... ok
    test_truncation (test.test_gdb.PrettyPrintTests)
    Verify that very long output is truncated ... ok
    test_tuples (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of tuples ... ok
    test_bt (test.test_gdb.PyBtTests)
    Verify that the "py-bt" command works ... skipped 'Python was compiled with optimizations'
    test_bt_full (test.test_gdb.PyBtTests)
    Verify that the "py-bt-full" command works ... skipped 'Python was compiled with optimizations'
    test_gc (test.test_gdb.PyBtTests)
    Verify that "py-bt" indicates if a thread is garbage-collecting ... skipped 'Python was compiled with optimizations'
    test_pycfunction (test.test_gdb.PyBtTests)
    Verify that "py-bt" displays invocations of PyCFunction instances ... skipped 'Python was compiled with optimizations'
    test_threads (test.test_gdb.PyBtTests)
    Verify that "py-bt" indicates threads that are waiting for the GIL ... ok
    test_wrapper_call (test.test_gdb.PyBtTests) ... skipped 'Python was compiled with optimizations'
    test_basic_command (test.test_gdb.PyListTests)
    Verify that the "py-list" command works ... skipped 'Python was compiled with optimizations'
    test_one_abs_arg (test.test_gdb.PyListTests)
    Verify the "py-list" command with one absolute argument ... skipped 'Python was compiled with optimizations'
    test_two_abs_args (test.test_gdb.PyListTests)
    Verify the "py-list" command with two absolute arguments ... skipped 'Python was compiled with optimizations'
    test_basic_command (test.test_gdb.PyLocalsTests) ... skipped 'Python was compiled with optimizations'
    test_locals_after_up (test.test_gdb.PyLocalsTests) ... skipped 'Python was compiled with optimizations'
    test_basic_command (test.test_gdb.PyPrintTests)
    Verify that the "py-print" command works ... skipped 'Python was compiled with optimizations'
    test_print_after_up (test.test_gdb.PyPrintTests) ... skipped 'Python was compiled with optimizations'
    test_printing_builtin (test.test_gdb.PyPrintTests) ... skipped 'Python was compiled with optimizations'
    test_printing_global (test.test_gdb.PyPrintTests) ... skipped 'Python was compiled with optimizations'
    test_down_at_bottom (test.test_gdb.StackNavigationTests)
    Verify handling of "py-down" at the bottom of the stack ... ok
    test_pyup_command (test.test_gdb.StackNavigationTests)
    Verify that the "py-up" command works ... skipped 'Python was compiled with optimizations'
    test_up_at_top (test.test_gdb.StackNavigationTests)
    Verify handling of "py-up" at the top of the stack ... ok
    test_up_then_down (test.test_gdb.StackNavigationTests)
    Verify "py-up" followed by "py-down" ... skipped 'Python was compiled with optimizations'

    Ran 46 tests in 84.636s

    OK (skipped=16)
    test_gdb passed in 1 min 25 sec

    == Tests result: SUCCESS ==

    1 test OK.

    Total duration: 1 min 25 sec
    Tests result: SUCCESS

    @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
    build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants