From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 1505F3858CD1; Fri, 8 Dec 2023 18:07:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1505F3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1702058830; bh=B43QzEr3z0WtrRwYGHOfWvfSpn1BzOY2miydqkrVmdI=; h=From:To:Subject:Date:From; b=CUk5+AXP0QVmNAWFNMoskZJ+OT0xjc0lzvmV//8UIg3V3/mF7NpRPXGTWxbRzTwbh nJbE023preNRWmVwWPmMQZ5y/98Q1ocLdZwYCmHyT7R6RqLngFjLql0qOHTk1HLJSQ r81Rz6UZfnAsgVSonJVWVLqNbko9MYXXCAnxW4ls= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix gdb.ada/complete.exp timeout in READ1 mode X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 8fd5a6058fc14e1d460fa166457f949e23e50b5f X-Git-Newrev: e59d0ad9bf8dfc4002835c8eee9e70e951c63d64 Message-Id: <20231208180710.1505F3858CD1@sourceware.org> Date: Fri, 8 Dec 2023 18:07:10 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3De59d0ad9bf8d= fc4002835c8eee9e70e951c63d64 commit e59d0ad9bf8dfc4002835c8eee9e70e951c63d64 Author: Andrew Burgess Date: Wed Nov 29 15:26:18 2023 +0000 gdb/testsuite: fix gdb.ada/complete.exp timeout in READ1 mode =20 While reviewing another patch I spotted a timeout in gdb.ada/complete.exp when testing in READ1 mode, e.g.: =20 $ make check-read1 TESTS=3D"gdb.ada/complete.exp" ... FAIL: gdb.ada/complete.exp: complete break ada (timeout) ... =20 The problem is an attempt to match the entire output from GDB within a single gdb_test_multiple pattern, for a completion command that returns a large number of completions. =20 This commit changes the gdb_test_multiple to process the output line by line. I don't use the gdb_test_multiple -lbl option, as I've always found that option backward -- it checks for the \r\n at the start of each line rather than the end, I think it's much clearer to use '^' at the start of each pattern, and '\r\n' at the end, so that's what I've done here. =20 .... Or I would, if this test didn't already define $eol as the end of line regexp ... except that $eol was set to '[\r\n]*', which isn't that helpful, so I've updated $eol to be just '\r\n' the actual end of line regexp. =20 And now, the test passes without a timeout when using READ1. =20 There should be no change in what is tested after this commit. =20 Approved-By: Tom Tromey Diff: --- gdb/testsuite/gdb.ada/complete.exp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/com= plete.exp index 9e9250545e9..a73a012d1cc 100644 --- a/gdb/testsuite/gdb.ada/complete.exp +++ b/gdb/testsuite/gdb.ada/complete.exp @@ -28,7 +28,7 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb] runto "foo.adb:$bp_location" =20 -set eol "\[\r\n\]*" +set eol "\r\n" =20 # A convenience function that verifies that the "complete EXPR" command # returns the EXPECTED_OUTPUT. @@ -227,11 +227,20 @@ test_gdb_complete "ambiguous_func" \ gdb_test_no_output "set max-completions unlimited" =20 set test "complete break ada" -gdb_test_multiple "$test" $test { - -re "^$test$eol\(break ada\[\]\[a-z0-9._@/-\]*$eol\)+$gdb_prompt $" { - pass $test +gdb_test_multiple $test "" { + -re "^($test$eol)" { + exp_continue } + + -re "^(break ada\[\]\[a-z0-9._@/-\]*$eol)" { + exp_continue + } + + -re "^$gdb_prompt $" { + pass $gdb_test_name + } + -re "\[A-Z\].*$gdb_prompt $" { - fail "$test (gdb/22670)" + fail "$gdb_test_name (gdb/22670)" } }