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: test_pycfunction_fastcall_keywords() failed on PPC64LE Fedora Stable Clang 3.x #110166

Closed
vstinner opened this issue Oct 1, 2023 · 3 comments
Labels
tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Oct 1, 2023

PPC64LE Fedora Stable Clang 3.x:

======================================================================
FAIL: test_pycfunction_fastcall_keywords (test.test_gdb.test_cfunction_full.CFunctionFullTests.test_pycfunction_fastcall_keywords) [_testcapi.meth_fastcall_keywords]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_gdb/test_cfunction.py", line 67, in check_pycfunction
    self.check(func_name, cmd)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_gdb/test_cfunction_full.py", line 32, in check
    self.assertRegex(gdb_output, regex)
AssertionError: Regex didn't match: '#(1|2)\\ <built\\-in\\ method\\ meth_fastcall_keywords' not found in 'Breakpoint 1 (meth_fastcall_keywords) pending.\n
[Thread debugging using libthread_db enabled]\n
Using host libthread_db library "/lib64/libthread_db.so.1".\n
\n
Breakpoint 1, meth_fastcall_keywords (self=<module at remote 0x7fffea3948f0>, args=, nargs=0, kwargs=0x0) at ./Modules/_testcapimodule.c:2114\n
2114\t    PyObject *pyargs = _fastcall_to_tuple(args, nargs);\n
Unable to locate python frame\n
'

Stdout:

  test call: _testcapi.meth_fastcall_keywords()

======================================================================
FAIL: test_pycfunction_varargs (test.test_gdb.test_cfunction_full.CFunctionFullTests.test_pycfunction_varargs) [_testcapi.meth_varargs]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_gdb/test_cfunction.py", line 67, in check_pycfunction
    self.check(func_name, cmd)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le.clang/build/Lib/test/test_gdb/test_cfunction_full.py", line 32, in check
    self.assertRegex(gdb_output, regex)
AssertionError: Regex didn't match: '#(1|2)\\ <built\\-in\\ method\\ meth_varargs' not found in 'Breakpoint 1 (meth_varargs) pending.\n
[Thread debugging using libthread_db enabled]\n
Using host libthread_db library "/lib64/libthread_db.so.1".\n
\n
Breakpoint 1, meth_varargs (self=<module at remote 0x7fffea394890>, args=()) at ./Modules/_testcapimodule.c:2067\n
2067\t    return Py_BuildValue("NO", _null_to_none(self), args);\n
Unable to locate python frame\n
'

Stdout:

  test call: _testcapi.meth_varargs()

----------------------------------------------------------------------

configure:

./configure --prefix '$(PWD)/target' --with-pydebug

test.pythoninfo:

CC.version: gcc (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1)

libregrtests.build_info: debug

sysconfig[PY_CFLAGS]: -fno-strict-overflow -Wsign-compare -g -Og -Wall
sysconfig[PY_CFLAGS_NODIST]: -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal
sysconfig[PY_STDMODULE_CFLAGS]: -fno-strict-overflow -Wsign-compare -g -Og -Wall -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include

build: https://buildbot.python.org/all/#/builders/435/builds/3683

Linked PRs

@vstinner vstinner added the tests Tests in the Lib/test dir label Oct 1, 2023
@vstinner
Copy link
Member Author

vstinner commented Oct 4, 2023

That's a variant of gh-104736.

code.py:

import _testcapi      
def foo(): 
    _testcapi.meth_fastcall_keywords()
def bar():                    
    foo()                                
bar()                  

Gdb:

[vstinner@localhost cpython]$ gdb -args ./python code.py
GNU gdb (GDB) Fedora Linux 13.2-5.fc38
(gdb) b meth_fastcall_keywords
(gdb) source python-gdb.py
(gdb) run
Starting program: /home/vstinner/cpython/python code.py

Breakpoint 1, meth_fastcall_keywords (self=<module at remote 0x7fffea37c590>, args=0x7fffea410128, nargs=0, kwargs=0x0) at ./Modules/_testcapimodule.c:2114
2114	    PyObject *pyargs = _fastcall_to_tuple(args, nargs);

(gdb) py-bt-full
Unable to locate python frame

(gdb) where
#0  meth_fastcall_keywords (self=<module at remote 0x7fffea37c590>, args=0x7fffea410128, nargs=0, kwargs=0x0) at ./Modules/_testcapimodule.c:2114
#1  0x0000000000000000 in ?? ()

vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
Skip stack trace tests using get_stack_trace() if "Unable to locate
python frame" is logged by gdb.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
CFunctionFullTests now also runs "bt" command before "py-bt-full",
similar than CFunctionTests which also runs "bt" command before
"py-bt". So test_gdb can skip the test if patterns like "?? ()" are
found in the output.
vstinner added a commit that referenced this issue Oct 4, 2023
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.
@vstinner
Copy link
Member Author

vstinner commented Oct 4, 2023

Using clang -O0, it works as expected, a single test is skipped:

./configure CC=clang LD=clang --with-pydebug 'CFLAGS=-fno-omit-frame-pointer -O0'
(...)
All 5 tests OK.

Total duration: 1 min 28 sec
Total tests: run=57 skipped=1
Total test files: run=5/5
Result: SUCCESS

vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
…ython#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)
vstinner added a commit that referenced this issue 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 issue 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 issue 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>
@vstinner
Copy link
Member Author

vstinner commented Oct 5, 2023

The issue should now be fixed in 3.11, 3.12 and main branches.

@vstinner vstinner closed this as completed Oct 5, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…ython#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.
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

No branches or pull requests

1 participant