mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00

* 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 commit757cbd4f29
) * 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 commit44d9a71ea2
) * 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 commit1de9406f91
)
30 lines
935 B
Python
30 lines
935 B
Python
# Verify that gdb can pretty-print the various PyObject* types
|
|
#
|
|
# The code for testing gdb was adapted from similar work in Unladen Swallow's
|
|
# Lib/test/test_jit_gdb.py
|
|
|
|
import os
|
|
import sysconfig
|
|
import unittest
|
|
from test import support
|
|
|
|
|
|
MS_WINDOWS = (os.name == 'nt')
|
|
if MS_WINDOWS:
|
|
# On Windows, Python is usually built by MSVC. Passing /p:DebugSymbols=true
|
|
# option to MSBuild produces PDB debug symbols, but gdb doesn't support PDB
|
|
# debug symbol files.
|
|
raise unittest.SkipTest("test_gdb doesn't work on Windows")
|
|
|
|
if support.PGO:
|
|
raise unittest.SkipTest("test_gdb is not useful for PGO")
|
|
|
|
if not sysconfig.is_python_build():
|
|
raise unittest.SkipTest("test_gdb only works on source builds at the moment.")
|
|
|
|
if support.check_cflags_pgo():
|
|
raise unittest.SkipTest("test_gdb is not reliable on PGO builds")
|
|
|
|
|
|
def load_tests(*args):
|
|
return support.load_package_tests(os.path.dirname(__file__), *args)
|