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

gh-104736: Fix test_gdb tests on ppc64le with clang #109360

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 13, 2023

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex: Fedora 38). Search patterns in gdb "bt" command output to detect when gdb fails to retrieve the traceback. For example, skip a test if Backtrace stopped: frame did not save the PC is found.

@vstinner vstinner added the tests Tests in the Lib/test dir label Sep 13, 2023
Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
@vstinner
Copy link
Member Author

Test on this machine:

  • Fedora 38
  • Linux xxx 6.2.8-200.fc37.ppc64le #1 SMP Wed Mar 22 18:34:43 UTC 2023 ppc64le ppc64le ppc64le GNU/Linux
  • clang version 16.0.6 (Fedora 16.0.6-2.fc38)
  • GNU gdb (GDB) Fedora Linux 13.2-3.fc38

Results:

  • Without the fix: FAILURE: Total tests: run=46 failures=2 skipped=39 -- 5 tests pass
  • With the fix: SUCCESS: Total tests: run=46 skipped=41 -- 5 tests pass

Without the fix

$ ./python -m test test_gdb -v -u all 
(...)
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... FAIL

Verify that "py-bt" displays invocations of PyCFunction instances ... FAIL
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_fastcall_keywords]
(...)

======================================================================
FAIL: test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_gdb.py", line 950, in test_pycfunction
    self.assertIn(f'<built-in method {func_name}', gdb_output)
AssertionError: '<built-in method meth_varargs' not found in 'Breakpoint 1 (meth_varargs) pending.\n\nThis GDB supports auto-downloading debuginfo from the following URLs:\n  <https://debuginfod.fedoraproject.org/>\nEnable debuginfod for this session? (y or [n]) [answered N; input not from terminal]\nDebuginfod has been disabled.\nTo make this setting permanent, add \'set debuginfod enabled off\' to .gdbinit.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib64/libthread_db.so.1".\n\nBreakpoint 1, meth_varargs (self=<module at remote 0x7fffea383170>, args=()) at ./Modules/_testcapimodule.c:2060\n2060\t    return Py_BuildValue("NO", _null_to_none(self), args);\n#0  meth_varargs (self=<module at remote 0x7fffea383170>, args=()) at ./Modules/_testcapimodule.c:2060\n#1  PyModuleDef_Type ()\nBacktrace stopped: frame did not save the PC\nUnable to locate python frame\n'

======================================================================
FAIL: test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_gdb.py", line 950, in test_pycfunction
    self.assertIn(f'<built-in method {func_name}', gdb_output)
AssertionError: '<built-in method meth_fastcall_keywords' not found in 'Breakpoint 1 (meth_fastcall_keywords) pending.\n\nThis GDB supports auto-downloading debuginfo from the following URLs:\n  <https://debuginfod.fedoraproject.org/>\nEnable debuginfod for this session? (y or [n]) [answered N; input not from terminal]\nDebuginfod has been disabled.\nTo make this setting permanent, add \'set debuginfod enabled off\' to .gdbinit.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib64/libthread_db.so.1".\n\nBreakpoint 1, meth_fastcall_keywords (self=<module at remote 0x7fffea3831d0>, args=, nargs=0, kwargs=0x0) at ./Modules/_testcapimodule.c:2107\n2107\t    PyObject *pyargs = _fastcall_to_tuple(args, nargs);\n#0  meth_fastcall_keywords (self=<module at remote 0x7fffea3831d0>, args=, nargs=0, kwargs=0x0) at ./Modules/_testcapimodule.c:2107\n#1  ?? ()\nUnable to locate python frame\n'

(...)

Total duration: 1 min 23 sec
Total tests: run=46 failures=2 skipped=39
Total test files: run=1/1 failed=1
Result: FAILURE

Full logs:

[vstinner@localhost cpython]$ ./python -m test test_gdb -v -u all 
== CPython 3.13.0a0 (heads/main:388d91c, Sep 12 2023, 22:49:42) [Clang 16.0.6 (Fedora 16.0.6-2.fc38)]
== Linux-5.8.17-200.fc32.ppc64le-ppc64le-with-glibc2.37 little-endian
== Python build: debug
== cwd: /home/vstinner/cpython/build/test_python_worker_2057070æ
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 1.99 Run 1 test sequentially
0:00:00 load avg: 1.99 [1/1] test_gdb
GDB version 13.2:
    GNU gdb (GDB) Fedora Linux 13.2-3.fc38
    Copyright (C) 2023 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.test_NULL_ob_type)
Ensure that a PyObject* with NULL ob_type is handled gracefully ... ok
test_NULL_ptr (test.test_gdb.PrettyPrintTests.test_NULL_ptr)
Ensure that a NULL PyObject* is handled gracefully ... ok
test_builtin_method (test.test_gdb.PrettyPrintTests.test_builtin_method) ... ok
test_builtins_help (test.test_gdb.PrettyPrintTests.test_builtins_help)
Ensure that the new-style class _Helper in site.py can be handled ... ok
test_bytes (test.test_gdb.PrettyPrintTests.test_bytes)
Verify the pretty-printing of bytes ... ok
test_corrupt_ob_type (test.test_gdb.PrettyPrintTests.test_corrupt_ob_type)
Ensure that a PyObject* with a corrupt ob_type is handled gracefully ... ok
test_corrupt_tp_flags (test.test_gdb.PrettyPrintTests.test_corrupt_tp_flags)
Ensure that a PyObject* with a type with corrupt tp_flags is handled ... ok
test_corrupt_tp_name (test.test_gdb.PrettyPrintTests.test_corrupt_tp_name)
Ensure that a PyObject* with a type with corrupt tp_name is handled ... ok
test_dicts (test.test_gdb.PrettyPrintTests.test_dicts)
Verify the pretty-printing of dictionaries ... ok
test_exceptions (test.test_gdb.PrettyPrintTests.test_exceptions) ... ok
test_frames (test.test_gdb.PrettyPrintTests.test_frames) ... ok
test_frozensets (test.test_gdb.PrettyPrintTests.test_frozensets)
Verify the pretty-printing of frozensets ... ok
test_getting_backtrace (test.test_gdb.PrettyPrintTests.test_getting_backtrace) ... ok
test_int (test.test_gdb.PrettyPrintTests.test_int)
Verify the pretty-printing of various int values ... ok
test_lists (test.test_gdb.PrettyPrintTests.test_lists)
Verify the pretty-printing of lists ... ok
test_modern_class (test.test_gdb.PrettyPrintTests.test_modern_class)
Verify the pretty-printing of new-style class instances ...  ok
test_selfreferential_dict (test.test_gdb.PrettyPrintTests.test_selfreferential_dict)
Ensure that a reference loop involving a dict doesn't lead proxyval ... ok
test_selfreferential_list (test.test_gdb.PrettyPrintTests.test_selfreferential_list)
Ensure that a reference loop involving a list doesn't lead proxyval ... ok
test_selfreferential_new_style_instance (test.test_gdb.PrettyPrintTests.test_selfreferential_new_style_instance) ... ok
test_selfreferential_old_style_instance (test.test_gdb.PrettyPrintTests.test_selfreferential_old_style_instance) ... ok
test_sets (test.test_gdb.PrettyPrintTests.test_sets)
Verify the pretty-printing of sets ... ok
test_singletons (test.test_gdb.PrettyPrintTests.test_singletons)
Verify the pretty-printing of True, False and None ... ok
test_strings (test.test_gdb.PrettyPrintTests.test_strings)
Verify the pretty-printing of unicode strings ... ok
test_subclassing_list (test.test_gdb.PrettyPrintTests.test_subclassing_list)
Verify the pretty-printing of an instance of a list subclass ... ok
test_subclassing_tuple (test.test_gdb.PrettyPrintTests.test_subclassing_tuple)
Verify the pretty-printing of an instance of a tuple subclass ... ok
test_truncation (test.test_gdb.PrettyPrintTests.test_truncation)
Verify that very long output is truncated ... ok
test_tuples (test.test_gdb.PrettyPrintTests.test_tuples)
Verify the pretty-printing of tuples ... ok
test_bt (test.test_gdb.PyBtTests.test_bt)
Verify that the "py-bt" command works ... skipped "'(unable to read python frame information)' found in gdb output"
test_bt_full (test.test_gdb.PyBtTests.test_bt_full)
Verify that the "py-bt-full" command works ... skipped "'(unable to read python frame information)' found in gdb output"
test_gc (test.test_gdb.PyBtTests.test_gc)
Verify that "py-bt" indicates if a thread is garbage-collecting ... skipped "'(unable to read python frame information)' found in gdb output"
test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction)
Verify that "py-bt" displays invocations of PyCFunction instances ... 
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... FAIL
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... FAIL
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
test_threads (test.test_gdb.PyBtTests.test_threads)
Verify that "py-bt" indicates threads that are waiting for the GIL ... skipped "'(unable to read python frame information)' found in gdb output"
test_wrapper_call (test.test_gdb.PyBtTests.test_wrapper_call) ... skipped "'(unable to read python frame information)' found in gdb output"
test_basic_command (test.test_gdb.PyListTests.test_basic_command)
Verify that the "py-list" command works ... skipped "'Unable to read information on python frame' found in gdb output"
test_one_abs_arg (test.test_gdb.PyListTests.test_one_abs_arg)
Verify the "py-list" command with one absolute argument ... skipped "'Unable to read information on python frame' found in gdb output"
test_two_abs_args (test.test_gdb.PyListTests.test_two_abs_args)
Verify the "py-list" command with two absolute arguments ... skipped "'Unable to read information on python frame' found in gdb output"
test_basic_command (test.test_gdb.PyLocalsTests.test_basic_command) ... skipped "'Unable to read information on python frame' found in gdb output"
test_locals_after_up (test.test_gdb.PyLocalsTests.test_locals_after_up) ... skipped "'Unable to read information on python frame' found in gdb output"
test_basic_command (test.test_gdb.PyPrintTests.test_basic_command)
Verify that the "py-print" command works ... skipped "'Unable to read information on python frame' found in gdb output"
test_print_after_up (test.test_gdb.PyPrintTests.test_print_after_up) ... skipped "'Unable to read information on python frame' found in gdb output"
test_printing_builtin (test.test_gdb.PyPrintTests.test_printing_builtin) ... skipped "'Unable to read information on python frame' found in gdb output"
test_printing_global (test.test_gdb.PyPrintTests.test_printing_global) ... skipped "'Unable to read information on python frame' found in gdb output"
test_down_at_bottom (test.test_gdb.StackNavigationTests.test_down_at_bottom)
Verify handling of "py-down" at the bottom of the stack ... ok
test_pyup_command (test.test_gdb.StackNavigationTests.test_pyup_command)
Verify that the "py-up" command works ... skipped "'(unable to read python frame information)' found in gdb output"
test_up_at_top (test.test_gdb.StackNavigationTests.test_up_at_top)
Verify handling of "py-up" at the top of the stack ... skipped "'(unable to read python frame information)' found in gdb output"
test_up_then_down (test.test_gdb.StackNavigationTests.test_up_then_down)
Verify "py-up" followed by "py-down" ... skipped "'(unable to read python frame information)' found in gdb output"

======================================================================
FAIL: test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_gdb.py", line 950, in test_pycfunction
    self.assertIn(f'<built-in method {func_name}', gdb_output)
AssertionError: '<built-in method meth_varargs' not found in 'Breakpoint 1 (meth_varargs) pending.\n\nThis GDB supports auto-downloading debuginfo from the following URLs:\n  <https://debuginfod.fedoraproject.org/>\nEnable debuginfod for this session? (y or [n]) [answered N; input not from terminal]\nDebuginfod has been disabled.\nTo make this setting permanent, add \'set debuginfod enabled off\' to .gdbinit.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib64/libthread_db.so.1".\n\nBreakpoint 1, meth_varargs (self=<module at remote 0x7fffea383170>, args=()) at ./Modules/_testcapimodule.c:2060\n2060\t    return Py_BuildValue("NO", _null_to_none(self), args);\n#0  meth_varargs (self=<module at remote 0x7fffea383170>, args=()) at ./Modules/_testcapimodule.c:2060\n#1  PyModuleDef_Type ()\nBacktrace stopped: frame did not save the PC\nUnable to locate python frame\n'

======================================================================
FAIL: test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_gdb.py", line 950, in test_pycfunction
    self.assertIn(f'<built-in method {func_name}', gdb_output)
AssertionError: '<built-in method meth_fastcall_keywords' not found in 'Breakpoint 1 (meth_fastcall_keywords) pending.\n\nThis GDB supports auto-downloading debuginfo from the following URLs:\n  <https://debuginfod.fedoraproject.org/>\nEnable debuginfod for this session? (y or [n]) [answered N; input not from terminal]\nDebuginfod has been disabled.\nTo make this setting permanent, add \'set debuginfod enabled off\' to .gdbinit.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib64/libthread_db.so.1".\n\nBreakpoint 1, meth_fastcall_keywords (self=<module at remote 0x7fffea3831d0>, args=, nargs=0, kwargs=0x0) at ./Modules/_testcapimodule.c:2107\n2107\t    PyObject *pyargs = _fastcall_to_tuple(args, nargs);\n#0  meth_fastcall_keywords (self=<module at remote 0x7fffea3831d0>, args=, nargs=0, kwargs=0x0) at ./Modules/_testcapimodule.c:2107\n#1  ?? ()\nUnable to locate python frame\n'

----------------------------------------------------------------------
Ran 46 tests in 82.800s

FAILED (failures=2, skipped=39)
test test_gdb failed
test_gdb failed (2 failures) in 1 min 23 sec

== Tests result: FAILURE ==

1 test failed:
    test_gdb

Total duration: 1 min 23 sec
Total tests: run=46 failures=2 skipped=39
Total test files: run=1/1 failed=1
Result: FAILURE

With the fix

[vstinner@localhost cpython]$ ./python -m test test_gdb -v -u all 
(...)
1 test OK.

Total duration: 1 min 26 sec
Total tests: run=46 skipped=41
Total test files: run=1/1
Result: SUCCESS

Full logs:

[vstinner@localhost cpython]$ ./python -m test test_gdb -v -u all 
== CPython 3.13.0a0 (heads/main:388d91c, Sep 12 2023, 22:49:42) [Clang 16.0.6 (Fedora 16.0.6-2.fc38)]
== Linux-5.8.17-200.fc32.ppc64le-ppc64le-with-glibc2.37 little-endian
== Python build: debug
== cwd: /home/vstinner/cpython/build/test_python_worker_2058409æ
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 2.24 Run 1 test sequentially
0:00:00 load avg: 2.24 [1/1] test_gdb
GDB version 13.2:
    GNU gdb (GDB) Fedora Linux 13.2-3.fc38
    Copyright (C) 2023 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.test_NULL_ob_type)
Ensure that a PyObject* with NULL ob_type is handled gracefully ... ok
test_NULL_ptr (test.test_gdb.PrettyPrintTests.test_NULL_ptr)
Ensure that a NULL PyObject* is handled gracefully ... ok
test_builtin_method (test.test_gdb.PrettyPrintTests.test_builtin_method) ... ok
test_builtins_help (test.test_gdb.PrettyPrintTests.test_builtins_help)
Ensure that the new-style class _Helper in site.py can be handled ... ok
test_bytes (test.test_gdb.PrettyPrintTests.test_bytes)
Verify the pretty-printing of bytes ... ok
test_corrupt_ob_type (test.test_gdb.PrettyPrintTests.test_corrupt_ob_type)
Ensure that a PyObject* with a corrupt ob_type is handled gracefully ... ok
test_corrupt_tp_flags (test.test_gdb.PrettyPrintTests.test_corrupt_tp_flags)
Ensure that a PyObject* with a type with corrupt tp_flags is handled ... ok
test_corrupt_tp_name (test.test_gdb.PrettyPrintTests.test_corrupt_tp_name)
Ensure that a PyObject* with a type with corrupt tp_name is handled ... ok
test_dicts (test.test_gdb.PrettyPrintTests.test_dicts)
Verify the pretty-printing of dictionaries ... ok
test_exceptions (test.test_gdb.PrettyPrintTests.test_exceptions) ... ok
test_frames (test.test_gdb.PrettyPrintTests.test_frames) ... ok
test_frozensets (test.test_gdb.PrettyPrintTests.test_frozensets)
Verify the pretty-printing of frozensets ... ok
test_getting_backtrace (test.test_gdb.PrettyPrintTests.test_getting_backtrace) ... ok
test_int (test.test_gdb.PrettyPrintTests.test_int)
Verify the pretty-printing of various int values ...  ok
test_lists (test.test_gdb.PrettyPrintTests.test_lists)
Verify the pretty-printing of lists ... ok
test_modern_class (test.test_gdb.PrettyPrintTests.test_modern_class)
Verify the pretty-printing of new-style class instances ... ok
test_selfreferential_dict (test.test_gdb.PrettyPrintTests.test_selfreferential_dict)
Ensure that a reference loop involving a dict doesn't lead proxyval ... ok
test_selfreferential_list (test.test_gdb.PrettyPrintTests.test_selfreferential_list)
Ensure that a reference loop involving a list doesn't lead proxyval ... ok
test_selfreferential_new_style_instance (test.test_gdb.PrettyPrintTests.test_selfreferential_new_style_instance) ... ok
test_selfreferential_old_style_instance (test.test_gdb.PrettyPrintTests.test_selfreferential_old_style_instance) ... ok
test_sets (test.test_gdb.PrettyPrintTests.test_sets)
Verify the pretty-printing of sets ... ok
test_singletons (test.test_gdb.PrettyPrintTests.test_singletons)
Verify the pretty-printing of True, False and None ... ok
test_strings (test.test_gdb.PrettyPrintTests.test_strings)
Verify the pretty-printing of unicode strings ... ok
test_subclassing_list (test.test_gdb.PrettyPrintTests.test_subclassing_list)
Verify the pretty-printing of an instance of a list subclass ... ok
test_subclassing_tuple (test.test_gdb.PrettyPrintTests.test_subclassing_tuple)
Verify the pretty-printing of an instance of a tuple subclass ... ok
test_truncation (test.test_gdb.PrettyPrintTests.test_truncation)
Verify that very long output is truncated ... ok
test_tuples (test.test_gdb.PrettyPrintTests.test_tuples)
Verify the pretty-printing of tuples ... ok
test_bt (test.test_gdb.PyBtTests.test_bt)
Verify that the "py-bt" command works ... skipped "'(unable to read python frame information)' found in gdb output"
test_bt_full (test.test_gdb.PyBtTests.test_bt_full)
Verify that the "py-bt-full" command works ... skipped "'(unable to read python frame information)' found in gdb output"
test_gc (test.test_gdb.PyBtTests.test_gc)
Verify that "py-bt" indicates if a thread is garbage-collecting ... skipped "'(unable to read python frame information)' found in gdb output"
test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction)
Verify that "py-bt" displays invocations of PyCFunction instances ... 
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'Backtrace stopped: frame did not save the PC' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_varargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_varargs_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_o]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_noargs]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_fastcall]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "' ?? ()' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass.meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethClass().meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
  test_pycfunction (test.test_gdb.PyBtTests.test_pycfunction) [_testcapi.MethStatic().meth_fastcall_keywords]
Verify that "py-bt" displays invocations of PyCFunction instances ... skipped "'(unable to read python frame information)' found in gdb output"
test_threads (test.test_gdb.PyBtTests.test_threads)
Verify that "py-bt" indicates threads that are waiting for the GIL ... skipped "'(unable to read python frame information)' found in gdb output"
test_wrapper_call (test.test_gdb.PyBtTests.test_wrapper_call) ... skipped "'(unable to read python frame information)' found in gdb output"
test_basic_command (test.test_gdb.PyListTests.test_basic_command)
Verify that the "py-list" command works ... skipped "'Unable to read information on python frame' found in gdb output"
test_one_abs_arg (test.test_gdb.PyListTests.test_one_abs_arg)
Verify the "py-list" command with one absolute argument ... skipped "'Unable to read information on python frame' found in gdb output"
test_two_abs_args (test.test_gdb.PyListTests.test_two_abs_args)
Verify the "py-list" command with two absolute arguments ... skipped "'Unable to read information on python frame' found in gdb output"
test_basic_command (test.test_gdb.PyLocalsTests.test_basic_command) ... skipped "'Unable to read information on python frame' found in gdb output"
test_locals_after_up (test.test_gdb.PyLocalsTests.test_locals_after_up) ... skipped "'Unable to read information on python frame' found in gdb output"
test_basic_command (test.test_gdb.PyPrintTests.test_basic_command)
Verify that the "py-print" command works ... skipped "'Unable to read information on python frame' found in gdb output"
test_print_after_up (test.test_gdb.PyPrintTests.test_print_after_up) ... skipped "'Unable to read information on python frame' found in gdb output"
test_printing_builtin (test.test_gdb.PyPrintTests.test_printing_builtin) ... skipped "'Unable to read information on python frame' found in gdb output"
test_printing_global (test.test_gdb.PyPrintTests.test_printing_global) ... skipped "'Unable to read information on python frame' found in gdb output"
test_down_at_bottom (test.test_gdb.StackNavigationTests.test_down_at_bottom)
Verify handling of "py-down" at the bottom of the stack ... ok
test_pyup_command (test.test_gdb.StackNavigationTests.test_pyup_command)
Verify that the "py-up" command works ... skipped "'(unable to read python frame information)' found in gdb output"
test_up_at_top (test.test_gdb.StackNavigationTests.test_up_at_top)
Verify handling of "py-up" at the top of the stack ... skipped "'(unable to read python frame information)' found in gdb output"
test_up_then_down (test.test_gdb.StackNavigationTests.test_up_then_down)
Verify "py-up" followed by "py-down" ... skipped "'(unable to read python frame information)' found in gdb output"

----------------------------------------------------------------------
Ran 46 tests in 85.120s

OK (skipped=41)
test_gdb passed in 1 min 26 sec

== Tests result: SUCCESS ==

1 test OK.

Total duration: 1 min 26 sec
Total tests: run=46 skipped=41
Total test files: run=1/1
Result: SUCCESS

@vstinner vstinner enabled auto-merge (squash) September 13, 2023 04:10
@vstinner vstinner added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Sep 13, 2023
@vstinner vstinner merged commit 44d9a71 into python:main Sep 13, 2023
25 checks passed
@vstinner vstinner deleted the test_gdb_ppc64le branch September 13, 2023 04:24
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 13, 2023
…09360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
(cherry picked from commit 44d9a71)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Sep 13, 2023

GH-109361 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Sep 13, 2023
@bedevere-app
Copy link

bedevere-app bot commented Sep 13, 2023

GH-109362 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Sep 13, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 13, 2023
…09360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
(cherry picked from commit 44d9a71)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this pull request Sep 13, 2023
#109362)

gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
(cherry picked from commit 44d9a71)

Co-authored-by: Victor Stinner <vstinner@python.org>
Yhg1s pushed a commit that referenced this pull request Sep 13, 2023
#109361)

gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
(cherry picked from commit 44d9a71)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit to vstinner/cpython that referenced this pull request Sep 13, 2023
)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
vstinner added a commit to vstinner/cpython that referenced this pull request Oct 4, 2023
)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.

(cherry picked from commit 44d9a71)
vstinner added a commit that referenced this pull request Oct 4, 2023
* gh-109972: Enhance test_gdb (#110026)

* Split test_pycfunction.py: add test_cfunction_full.py.
  Split the function into the following 6 functions. In verbose
  mode, these "pycfunction" tests now log each tested call.

  * test_pycfunction_noargs()
  * test_pycfunction_o()
  * test_pycfunction_varargs()
  * test_pycfunction_varargs_keywords()
  * test_pycfunction_fastcall()
  * test_pycfunction_fastcall_keywords()

* Move get_gdb_repr() to PrettyPrintTests.
* Replace DebuggerTests.get_sample_script() with SAMPLE_SCRIPT.
* Rename checkout_hook_path to CHECKOUT_HOOK_PATH.
* Rename gdb_version to GDB_VERSION_TEXT.
* Replace (gdb_major_version, gdb_minor_version) with GDB_VERSION.
* run_gdb() uses "backslashreplace" error handler instead of "replace".
* Add check_gdb() function to util.py.
* Enhance support.check_cflags_pgo(): check also for sysconfig
  PGO_PROF_USE_FLAG (if available) in compiler flags.
* Move some SkipTest checks to test_gdb/__init__.py.
* Elaborate why gdb cannot be tested on Windows: gdb doesn't support
  PDB debug symbol files.

(cherry picked from commit 757cbd4)

* gh-104736: Fix test_gdb tests on ppc64le with clang (#109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.

(cherry picked from commit 44d9a71)

* gh-110166: Fix gdb CFunctionFullTests on ppc64le clang build (#110331)

CFunctionFullTests now also runs "bt" command before "py-bt-full",
similar to CFunctionTests which also runs "bt" command before
"py-bt". So test_gdb can skip the test if patterns like "?? ()" are
found in the gdb output.

(cherry picked from commit 1de9406)
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 4, 2023
…110351)

* pythongh-109972: Enhance test_gdb (pythonGH-110026)

* Split test_pycfunction.py: add test_cfunction_full.py.
  Split the function into the following 6 functions. In verbose
  mode, these "pycfunction" tests now log each tested call.

  * test_pycfunction_noargs()
  * test_pycfunction_o()
  * test_pycfunction_varargs()
  * test_pycfunction_varargs_keywords()
  * test_pycfunction_fastcall()
  * test_pycfunction_fastcall_keywords()

* Move get_gdb_repr() to PrettyPrintTests.
* Replace DebuggerTests.get_sample_script() with SAMPLE_SCRIPT.
* Rename checkout_hook_path to CHECKOUT_HOOK_PATH.
* Rename gdb_version to GDB_VERSION_TEXT.
* Replace (gdb_major_version, gdb_minor_version) with GDB_VERSION.
* run_gdb() uses "backslashreplace" error handler instead of "replace".
* Add check_gdb() function to util.py.
* Enhance support.check_cflags_pgo(): check also for sysconfig
  PGO_PROF_USE_FLAG (if available) in compiler flags.
* Move some SkipTest checks to test_gdb/__init__.py.
* Elaborate why gdb cannot be tested on Windows: gdb doesn't support
  PDB debug symbol files.

(cherry picked from commit 757cbd4)

* pythongh-104736: Fix test_gdb tests on ppc64le with clang (pythonGH-109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.

(cherry picked from commit 44d9a71)

* pythongh-110166: Fix gdb CFunctionFullTests on ppc64le clang build (pythonGH-110331)

CFunctionFullTests now also runs "bt" command before "py-bt-full",
similar to CFunctionTests which also runs "bt" command before
"py-bt". So test_gdb can skip the test if patterns like "?? ()" are
found in the gdb output.

(cherry picked from commit bbce8bd)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 1de9406)
vstinner added a commit that referenced this pull request Oct 4, 2023
…10354)

[3.12] gh-109972: Enhance test_gdb (GH-110026) (GH-110351)

* gh-109972: Enhance test_gdb (GH-110026)

* Split test_pycfunction.py: add test_cfunction_full.py.
  Split the function into the following 6 functions. In verbose
  mode, these "pycfunction" tests now log each tested call.

  * test_pycfunction_noargs()
  * test_pycfunction_o()
  * test_pycfunction_varargs()
  * test_pycfunction_varargs_keywords()
  * test_pycfunction_fastcall()
  * test_pycfunction_fastcall_keywords()

* Move get_gdb_repr() to PrettyPrintTests.
* Replace DebuggerTests.get_sample_script() with SAMPLE_SCRIPT.
* Rename checkout_hook_path to CHECKOUT_HOOK_PATH.
* Rename gdb_version to GDB_VERSION_TEXT.
* Replace (gdb_major_version, gdb_minor_version) with GDB_VERSION.
* run_gdb() uses "backslashreplace" error handler instead of "replace".
* Add check_gdb() function to util.py.
* Enhance support.check_cflags_pgo(): check also for sysconfig
  PGO_PROF_USE_FLAG (if available) in compiler flags.
* Move some SkipTest checks to test_gdb/__init__.py.
* Elaborate why gdb cannot be tested on Windows: gdb doesn't support
  PDB debug symbol files.

(cherry picked from commit 757cbd4)

* gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.

(cherry picked from commit 44d9a71)

* gh-110166: Fix gdb CFunctionFullTests on ppc64le clang build (GH-110331)

CFunctionFullTests now also runs "bt" command before "py-bt-full",
similar to CFunctionTests which also runs "bt" command before
"py-bt". So test_gdb can skip the test if patterns like "?? ()" are
found in the gdb output.

(cherry picked from commit bbce8bd)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 1de9406)

Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants