public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix gdb.python/py-cmd.exp
@ 2023-03-10 15:34 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-03-10 15:34 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=254de2628f5e6da0c0d48eb86f40ece3d96b7b75

commit 254de2628f5e6da0c0d48eb86f40ece3d96b7b75
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Mar 10 16:34:04 2023 +0100

    [gdb/testsuite] Fix gdb.python/py-cmd.exp
    
    [ Using $pp as shorthand for the pagination prompt
    "--Type <RET> for more, q to quit, c to continue without paging--". ]
    
    The test-case gdb.python/py-cmd.exp passes, but the handling of the
    test_multiline command output looks a bit odd:
    ...
    (gdb) test_multiline
    test_multiline output
      ...
    test_multiline output
    $ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline
    q
    test_multiline
    Quit
    (gdb) test_multiline
    test_multiline output
      ...
    test_multiline output
    $ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline: q
    ...
    
    What happens is:
    - a test_multiline command is issued
    - some output is printed, followed by a pagination prompt
    - the test-case concludes that pagination occurred, and produces a PASS
    - "q\n" is replied to the pagination prompt
    - without waiting for response to the "q\n", another test_multiline command is
      issued
    - in response to the "q\n" we get "Quit\n(gdb) "
    - some output is printed, followed by a pagination prompt
    - the test-case concludes that there's a valid response to the "q\n", and
      produces a PASS, consuming the second pagination prompt, but without a reply.
    
    My conclusion is that the second test_multiline command is unintentional, so fix
    this by removing it.
    
    Without it, we have the more straightforward:
    ...
    (gdb) test_multiline
    test_multiline output
      ...
    test_multiline output
    $ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline
    q
    Quit
    (gdb) PASS: gdb.python/py-cmd.exp: verify pagination from test_multiline: q
    ...
    
    This also fixes the following warning with target board native-gdbserver:
    ...
    WARNING: Timed out waiting for EOF in server after monitor exit
    ...
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.python/py-cmd.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index 016ea445f10..12b52e4fd61 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -291,7 +291,7 @@ gdb_test_multiple "test_multiline" $test {
 
 send_gdb "q\n"
 set test "verify pagination from test_multiline: q"
-gdb_test_multiple "test_multiline" $test {
+gdb_test_multiple "" $test {
     -re "Error occurred in Python" {
 	fail $test
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-10 15:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 15:34 [binutils-gdb] [gdb/testsuite] Fix gdb.python/py-cmd.exp 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).