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

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

commit 89447229c7961dd99d5167f2ebcc5d8973d5d5ae
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Mar 31 17:15:37 2023 +0200

    [gdb/testsuite] Fix gdb.threads/threadapply.exp with editing off
    
    With test-case gdb.threads/threadapply.exp and editing set to on, we have:
    ...
    (gdb) define remove^M
    Type commands for definition of "remove".^M
    End with a line saying just "end".^M
    >remove-inferiors 3^M
    >end^M
    (gdb)
    ...
    but with editing set to off, we run into:
    ...
    (gdb) define remove^M
    Type commands for definition of "remove".^M
    End with a line saying just "end".^M
    >remove-inferiors 3^M
    end^M
    >(gdb) FAIL: gdb.threads/threadapply.exp: thread_set=all: try remove: \
      define remove (timeout)
    ...
    
    The commands are issued by this test:
    ...
            gdb_define_cmd "remove" {
                "remove-inferiors 3"
            }
    ...
    which does:
    - gdb_test_multiple "define remove", followed by
    - gdb_test_multiple "remove-inferiors 3\nend".
    
    Proc gdb_test_multiple has special handling for multi-line commands, which
    splits it up into subcommands, and for each subcommand issues it and then
    waits for the resulting prompt (the secondary prompt ">" for all but the last
    subcommand).
    
    However, that doesn't work as expected in this case because the initial
    gdb_test_multiple "define remove" fails to match all resulting output, and
    consequently the secondary prompt resulting from "define remove" is counted as
    if it was the one resulting from "remove-inferiors 3".
    
    Fix this by matching the entire output of "define remove", including the
    secondary prompt.
    
    Tested on x86_64-linux.
    
    PR testsuite/30288
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30288

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

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 8b85618abcd..bb4bd656471 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -8490,7 +8490,7 @@ proc gdb_define_cmd {command command_list} {
     set test "define $command"
 
     gdb_test_multiple "define $command" $test {
-	-re "End with"  {
+	-re "End with \[^\r\n\]*\r\n *>$"  {
 	    gdb_test_multiple $input $test {
 		-re "\r\n$gdb_prompt " {
 		}

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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 15:15 [binutils-gdb] [gdb/testsuite] Fix gdb.threads/threadapply.exp with editing off 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).