public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: get_set_option_choices: expect \r\n after each item
@ 2022-11-14 15:14 Simon Marchi
  2022-11-15  7:01 ` Tom de Vries
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2022-11-14 15:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

I get some random failures since commit 8d45c3a82a0e ("[gdb/testsuite]
Set completions to unlimited in get_set_option_choices"), which can be
reproduced with:

    $ make check-read1 TESTS="gdb.base/parse_number.exp"

For instance:

    set architecture A^M
    Ambiguous item "A".^M
    (gdb) FAIL: gdb.base/parse_number.exp: arch=A: set architecture A

The problem is the regexp in get_set_option_choices, it can match only
part of a completion result.  With check-read1, that is alwasy one
letter.  Fix this by expecting the \r\n at the end of the line, so we
only match entire results.

Change-Id: Ib1733737feab7dde0f7095866e089081a891054e
---
 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 bdb8da9daf98..abc67fb2b9e2 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9138,7 +9138,7 @@ proc get_set_option_choices {set_cmd} {
 
     with_set max-completions unlimited {
 	gdb_test_multiple $cmd $test {
-	    -re "\r\n$set_cmd (\[^\r\n\]+)" {
+	    -re "\r\n$set_cmd (\[^\r\n\]+)\r\n" {
 		lappend values $expect_out(1,string)
 		exp_continue
 	    }

base-commit: a5b6e43669b78729d2ef78d668e19bac2b11197d
-- 
2.38.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-15 15:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 15:14 [PATCH] gdb/testsuite: get_set_option_choices: expect \r\n after each item Simon Marchi
2022-11-15  7:01 ` Tom de Vries
2022-11-15 14:59   ` Simon Marchi
2022-11-15 15:05     ` Tom de Vries
2022-11-15 15:49       ` Simon Marchi

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).