Skip to content

Commit

Permalink
[gdb/testsuite] Fix gdb.python/py-cmd.exp
Browse files Browse the repository at this point in the history
[ 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.
  • Loading branch information
vries committed Mar 10, 2023
1 parent ddc003b commit 254de26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gdb/testsuite/gdb.python/py-cmd.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 254de26

Please sign in to comment.