From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id E27923898505; Tue, 15 Nov 2022 15:48:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E27923898505 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668527298; bh=jUrY8jcYO1w9/T85W7meQEgZ5dBDbrMdmqL4n04G15Q=; h=From:To:Subject:Date:From; b=XoPHLJL1o1E4y+w9uVrtxmRy82vFRelRprEoWUOlR79rU4CYnmaoMpB2gMuYi/YOv fHZB5CG2F3ef3yrRKWoJfBKYSGDjQ+lRxzLO2wUHt3EUOoh2msuWiaKJ2bIEcUkQ8U HoLbU8VT98MmOi69nLBUjkYeCSUax3MlkhDkvuCs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: get_set_option_choices: expect \r\n after each item X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 4f4a46ba7c5f7e18218a4fcda5a38ee7dc819202 X-Git-Newrev: 7e21379963c8be351a03693ce64d0a597ea0dbd7 Message-Id: <20221115154818.E27923898505@sourceware.org> Date: Tue, 15 Nov 2022 15:48:18 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7e21379963c8= be351a03693ce64d0a597ea0dbd7 commit 7e21379963c8be351a03693ce64d0a597ea0dbd7 Author: Simon Marchi Date: Mon Nov 14 10:10:04 2022 -0500 gdb/testsuite: get_set_option_choices: expect \r\n after each item =20 I get some random failures since commit 8d45c3a82a0e ("[gdb/testsuite] Set completions to unlimited in get_set_option_choices"), which can be reproduced with: =20 $ make check-read1 TESTS=3D"gdb.base/parse_number.exp" =20 For instance: =20 set architecture A^M Ambiguous item "A".^M (gdb) FAIL: gdb.base/parse_number.exp: arch=3DA: set architecture A =20 The problem is the regexp in get_set_option_choices, it is possible that is only matches part of a completion result. With check-read1, that is always one letter. =20 Fix this by expecting the \r\n at the end of the line, so we only match entire results. Use ^ in match patterns to ensure we don't miss any output. =20 Approved-By: Tom de Vries Change-Id: Ib1733737feab7dde0f7095866e089081a891054e Diff: --- gdb/testsuite/lib/gdb.exp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0543da31da6..698b3f4bd79 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -9156,11 +9156,16 @@ proc get_set_option_choices {set_cmd} { =20 with_set max-completions unlimited { gdb_test_multiple $cmd $test { - -re "\r\n$set_cmd (\[^\r\n\]+)" { + -re "^[string_to_regexp $cmd]\r\n" { + exp_continue + } + + -re "^$set_cmd (\[^\r\n\]+)\r\n" { lappend values $expect_out(1,string) exp_continue } - -re -wrap "" { + + -re "^$::gdb_prompt $" { pass $gdb_test_name } }