* [pushed 0/3] [gdb/testsuite] A few fixes in gdb.python/python.exp
@ 2026-11-01 14:07 Tom de Vries
2026-11-01 14:07 ` [pushed 1/3] [gdb/testsuite] Handle help() timeout " Tom de Vries
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tom de Vries @ 2026-11-01 14:07 UTC (permalink / raw)
To: gdb-patches
This series contains three patches for test-case gdb.python/python.exp.
Tested on x86_64-linux with make-check-all.sh.
Tom de Vries (3):
[gdb/testsuite] Handle help() timeout in gdb.python/python.exp
[gdb/testsuite] Fix remote host confusion in gdb.python/python.exp
[gdb/testsuite] Disable part of gdb.python/python.exp for
!readline_is_used
gdb/testsuite/gdb.python/python.exp | 48 +++++++++++++++++------------
1 file changed, 29 insertions(+), 19 deletions(-)
base-commit: 865dd73481041beb76bb5d47916451bd2a15036c
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pushed 1/3] [gdb/testsuite] Handle help() timeout in gdb.python/python.exp
2026-11-01 14:07 [pushed 0/3] [gdb/testsuite] A few fixes in gdb.python/python.exp Tom de Vries
@ 2026-11-01 14:07 ` Tom de Vries
2026-11-01 14:07 ` [pushed 2/3] [gdb/testsuite] Fix remote host confusion " Tom de Vries
2026-11-01 14:07 ` [pushed 3/3] [gdb/testsuite] Disable part of gdb.python/python.exp for !readline_is_used Tom de Vries
2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-11-01 14:07 UTC (permalink / raw)
To: gdb-patches
I ran into the following timeout in test-case gdb.python/python.exp:
...
(gdb) python
>help()
>end
FAIL: $exp: python interactive help: python; help(); end (timeout)
define zzq
Welcome to Python 3.13's help utility! If this is your first time using
Python, you should definitely check out the tutorial at
https://docs.python.org/3.13/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To get a list of available
modules, keywords, symbols, or topics, enter "modules", "keywords",
"symbols", or "topics".
Each module also comes with a one-line summary of what it does; to list
the modules whose name or summary contain a given string such as "spam",
enter "modules spam".
To quit this help utility and return to the interpreter,
enter "q", "quit" or "exit".
help> No Python documentation found for 'define zzq'.
...
The timeout means that gdb is stuck at the "help>" prompt, making all the
following tests fail.
Fix this using a clean_restart.
---
gdb/testsuite/gdb.python/python.exp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 63225cff8c6..3adbef72001 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -74,6 +74,10 @@ with_test_prefix "python interactive help" {
}
}
+# A timeout in the previous test would have gdb stuck at the "help>" prompt,
+# causing all following tests to fail. Start a clean session.
+clean_restart
+
gdb_test_multiline "show python command" \
"define zzq" "Type commands for definition of .* just \"end\"\\.*" \
"python" "" \
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pushed 2/3] [gdb/testsuite] Fix remote host confusion in gdb.python/python.exp
2026-11-01 14:07 [pushed 0/3] [gdb/testsuite] A few fixes in gdb.python/python.exp Tom de Vries
2026-11-01 14:07 ` [pushed 1/3] [gdb/testsuite] Handle help() timeout " Tom de Vries
@ 2026-11-01 14:07 ` Tom de Vries
2026-11-01 14:07 ` [pushed 3/3] [gdb/testsuite] Disable part of gdb.python/python.exp for !readline_is_used Tom de Vries
2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-11-01 14:07 UTC (permalink / raw)
To: gdb-patches
With host board local-remote-host, target board remote-gdbserver-on-localhost
and test-case gdb.python/python.exp I run into:
...
(gdb) Executing on local-remote-host: \
rm -f $outputs/gdb.python/python/source2-symlink.py (timeout = 300)
builtin_spawn [open ...]
rm: cannot remove '$outputs/gdb.python/python/source2-symlink.py': \
Permission denied
XYZ1ZYX
Executing on host: \
ln -sf $outputs/gdb.python/python/source2-symlink.py (timeout = 300)
builtin_spawn [open ...]
XYZ0ZYX
source -s $outputs/gdb.python/python/source2-symlink.py \
$outputs/gdb.python/python/source2-symlink.py: No such file or directory.
(gdb) FAIL: $exp: source -s source2-symlink.py
...
There are two problems:
- the remote download specifies a 'tofile' on build
- the ln specifies a link name on build
Fix these by:
- using simply source2-symlink.notpy as 'tofile'
- using host_standard_output_file to specify the link name on host
---
gdb/testsuite/gdb.python/python.exp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 3adbef72001..f8a2e35c961 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -98,11 +98,12 @@ gdb_test "source $remote_source2_py" "yes" "source source2.py"
gdb_test "source -s source2.py" "yes"
set remote_source2_symlink_notpy \
- [gdb_remote_download host ${srcdir}/${subdir}/source2.py \
- [standard_output_file "source2-symlink.notpy"]]
-set remote_source2_symlink_py [standard_output_file "source2-symlink.py"]
+ [gdb_remote_download host $srcdir/$subdir/source2.py source2-symlink.notpy]
+set remote_source2_symlink_py [host_standard_output_file source2-symlink.py]
remote_file host delete $remote_source2_symlink_py
-set status [remote_exec host "ln -sf $remote_source2_symlink_notpy $remote_source2_symlink_py"]
+set status \
+ [remote_exec host \
+ "ln -sf $remote_source2_symlink_notpy $remote_source2_symlink_py"]
set test "source -s source2-symlink.py"
if {[lindex $status 0] == 0} {
gdb_test "source -s $remote_source2_symlink_py" "yes" $test
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pushed 3/3] [gdb/testsuite] Disable part of gdb.python/python.exp for !readline_is_used
2026-11-01 14:07 [pushed 0/3] [gdb/testsuite] A few fixes in gdb.python/python.exp Tom de Vries
2026-11-01 14:07 ` [pushed 1/3] [gdb/testsuite] Handle help() timeout " Tom de Vries
2026-11-01 14:07 ` [pushed 2/3] [gdb/testsuite] Fix remote host confusion " Tom de Vries
@ 2026-11-01 14:07 ` Tom de Vries
2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-11-01 14:07 UTC (permalink / raw)
To: gdb-patches
With host board local-remote-host-notty, target board
remote-gdbserver-on-localhost and test-case gdb.python/python.exp I ran into:
...
(gdb) python gdb.execute('set logging enabled on')^M
FAIL: $exp: enable logging via python (timeout)
...
The problem is that there's no visible prompt because of the combination of
"set editing off" (due to using local-remote-host-notty) and logging. I don't
know whether this is a bug or not. I've filed a PR [1] about this.
Regardless, this problem is not specific to python, so just skip the logging
part of the test-case if !readline_is_used.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=34926
---
gdb/testsuite/gdb.python/python.exp | 41 ++++++++++++++++-------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index f8a2e35c961..b34e4f61c31 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -575,21 +575,26 @@ foreach type {Instruction LazyString Membuf Record RecordFunctionSegment \
"gdb.$type is registered"
}
-set logfile [host_standard_output_file gdb.txt]
-gdb_test_no_output "set logging file $logfile" \
- "set logging file [file tail $logfile]"
-gdb_test_no_output "set logging redirect on" \
- "enable logging redirect via python"
-gdb_test_no_output "python gdb.execute('set logging enabled on')" \
- "enable logging via python"
-
-# Even with logging redirect on, this should capture the output.
-gdb_test_no_output "python x = gdb.execute('print 23', to_string=True)" \
- "print from python with logging redirect"
-
-gdb_test "set logging enabled off" \
- "Done logging to .*gdb.txt." \
- "disable logging"
-
-gdb_test "python print(x)" " = 23.*" \
- "python still captured output"
+# The combination of logging and !readline_is_used means we don't get a
+# visible prompt (PR cli/34926), so skip this part.
+set readline_is_used [readline_is_used]
+if {$readline_is_used} {
+ set logfile [host_standard_output_file gdb.txt]
+ gdb_test_no_output "set logging file $logfile" \
+ "set logging file [file tail $logfile]"
+ gdb_test_no_output "set logging redirect on" \
+ "enable logging redirect via python"
+ gdb_test_no_output "python gdb.execute('set logging enabled on')" \
+ "enable logging via python"
+
+ # Even with logging redirect on, this should capture the output.
+ gdb_test_no_output "python x = gdb.execute('print 23', to_string=True)" \
+ "print from python with logging redirect"
+
+ gdb_test "set logging enabled off" \
+ "Done logging to .*gdb.txt." \
+ "disable logging"
+
+ gdb_test "python print(x)" " = 23.*" \
+ "python still captured output"
+}
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-01 14:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01 14:07 [pushed 0/3] [gdb/testsuite] A few fixes in gdb.python/python.exp Tom de Vries
2026-11-01 14:07 ` [pushed 1/3] [gdb/testsuite] Handle help() timeout " Tom de Vries
2026-11-01 14:07 ` [pushed 2/3] [gdb/testsuite] Fix remote host confusion " Tom de Vries
2026-11-01 14:07 ` [pushed 3/3] [gdb/testsuite] Disable part of gdb.python/python.exp for !readline_is_used Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox