From patchwork Thu Sep 17 07:28:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 8736 Received: (qmail 76468 invoked by alias); 17 Sep 2015 07:29:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 76455 invoked by uid 89); 17 Sep 2015 07:29:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Sep 2015 07:29:14 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZcTd1-0001iU-Fn from Sandra_Loosemore@mentor.com ; Thu, 17 Sep 2015 00:29:11 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.224.2; Thu, 17 Sep 2015 00:29:10 -0700 Message-ID: <55FA6B97.4080209@codesourcery.com> Date: Thu, 17 Sep 2015 01:28:23 -0600 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: gdb-patches , Keith Seitz Subject: [patch, testsuite] require readline for gdb.linespec/explicit.exp tab-completion tests Tab-completion tests require readline support. The ones in gdb.base/completion.exp are already conditional, but the recently-added gdb.linespec/explicit.exp tests are not. This patch fixes that, and also an obvious typo ("faill" -> "fail"). The patch is kind of long because I had to insert an "if" block and reindent, but there's nothing else going on here. OK to commit? BTW, independently of the readline-related failures on Windows host that are addressed by this patch, on Linux host I've also run into the failures already noted in this thread: https://sourceware.org/ml/gdb-patches/2015-08/msg00432.html The immediate problem is that the response to the "break -function mai\t" test doesn't always include the ^G character in the output pattern, and the other FAILs are cascading off of the testcase not being structured to recover from a pattern match failure (it's sending more commands without a newline to terminate the one that failed). But, I have no clue why GDB is giving a ^G in some configurations and not others (I observed that this test fails on nios2-elf target but passes on nios2-linux-gnu, for instance), or whether this difference is indicative of an actual bug. So I've not touched that part of the testcase. -Sandra diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp index a0851cd..1fa203f 100644 --- a/gdb/testsuite/gdb.linespec/explicit.exp +++ b/gdb/testsuite/gdb.linespec/explicit.exp @@ -145,186 +145,193 @@ namespace eval $testfile { gdb_test "break $linespec thread 123" "Unknown thread 123." } - # Test the explicit location completer - foreach abbrev {"fun" "so" "lab" "li"} full {"function" "source" "label" "line"} { - set tst "complete 'break -$abbrev'" - send_gdb "break -${abbrev}\t" - gdb_test_multiple "" $tst { - "break -$full " { - send_gdb "\n" - gdb_test_multiple "" $tst { - -re "missing argument for \"-$full\".*$gdb_prompt " { - pass $tst + # Tests below are about tab-completion, which doesn't work if readline + # library isn't used. Check it first. + if { [readline_is_used] } { + + # Test the explicit location completer + foreach abbrev {"fun" "so" "lab" "li"} full {"function" "source" "label" "line"} { + set tst "complete 'break -$abbrev'" + send_gdb "break -${abbrev}\t" + gdb_test_multiple "" $tst { + "break -$full " { + send_gdb "\n" + gdb_test_multiple "" $tst { + -re "missing argument for \"-$full\".*$gdb_prompt " { + pass $tst + } } } } - } - set tst "complete -$full with no value" - send_gdb "break -$full \t" - gdb_test_multiple "" $tst { - -re ".*break -$full " { - send_gdb "\n" - gdb_test_multiple "" $tst { - -re ".*Source filename requires function, label, or line offset\..*$gdb_prompt " { - if {[string equal $full "source"]} { + set tst "complete -$full with no value" + send_gdb "break -$full \t" + gdb_test_multiple "" $tst { + -re ".*break -$full " { + send_gdb "\n" + gdb_test_multiple "" $tst { + -re ".*Source filename requires function, label, or line offset\..*$gdb_prompt " { + if {[string equal $full "source"]} { + pass $tst + } else { + fail $tst + } + } + -re "missing argument for \"-$full\".*$gdb_prompt " { pass $tst - } else { - faill $tst } } - -re "missing argument for \"-$full\".*$gdb_prompt " { - pass $tst - } } } } - } - set tst "complete unique function name" - send_gdb "break -function mai\t" - gdb_test_multiple "" $tst { - "break -function mai\\\x07n" { - send_gdb "\n" - gdb_test "" ".*Breakpoint \[0-9\]+.*" $tst - gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + set tst "complete unique function name" + send_gdb "break -function mai\t" + gdb_test_multiple "" $tst { + "break -function mai\\\x07n" { + send_gdb "\n" + gdb_test "" ".*Breakpoint \[0-9\]+.*" $tst + gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + } } - } - set tst "complete non-unique function name" - send_gdb "break -function myfunc\t" - gdb_test_multiple "" $tst { - "break -function myfunc\\\x07tion" { - send_gdb "\t\t" - gdb_test_multiple "" $tst { - -re "\\\x07\r\nmyfunction\[ \t\]+myfunction2\[ \t\]+myfunction3\[ \t\]+myfunction4\[ \t\]+\r\n$gdb_prompt " { - gdb_test "2" ".*Breakpoint \[0-9\]+.*" $tst - gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + set tst "complete non-unique function name" + send_gdb "break -function myfunc\t" + gdb_test_multiple "" $tst { + "break -function myfunc\\\x07tion" { + send_gdb "\t\t" + gdb_test_multiple "" $tst { + -re "\\\x07\r\nmyfunction\[ \t\]+myfunction2\[ \t\]+myfunction3\[ \t\]+myfunction4\[ \t\]+\r\n$gdb_prompt " { + gdb_test "2" ".*Breakpoint \[0-9\]+.*" $tst + gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + } } } } - } - set tst "complete non-existant function name" - send_gdb "break -function foo\t" - gdb_test_multiple "" $tst { - "break -function foo\\\x07" { - send_gdb "\t\t" - gdb_test_multiple "" $tst { - -re "\\\x07\\\x07" { - send_gdb "\n" - gdb_test "" {Function "foo" not defined.} $tst + set tst "complete non-existant function name" + send_gdb "break -function foo\t" + gdb_test_multiple "" $tst { + "break -function foo\\\x07" { + send_gdb "\t\t" + gdb_test_multiple "" $tst { + -re "\\\x07\\\x07" { + send_gdb "\n" + gdb_test "" {Function "foo" not defined.} $tst + } } } } - } - set tst "complete unique file name" - send_gdb "break -source 3ex\t" - gdb_test_multiple "" $tst { - "break -source 3explicit.c " { - send_gdb "\n" - gdb_test "" \ - {Source filename requires function, label, or line offset.} $tst + set tst "complete unique file name" + send_gdb "break -source 3ex\t" + gdb_test_multiple "" $tst { + "break -source 3explicit.c " { + send_gdb "\n" + gdb_test "" \ + {Source filename requires function, label, or line offset.} $tst + } } - } - set tst "complete non-unique file name" - send_gdb "break -source exp\t" - gdb_test_multiple "" $tst { - "break -source exp\\\x07licit" { - send_gdb "\t\t" - gdb_test_multiple "" $tst { - -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\r\n$gdb_prompt" { - send_gdb "\n" - gdb_test "" \ - {Source filename requires function, label, or line offset.} \ - $tst + set tst "complete non-unique file name" + send_gdb "break -source exp\t" + gdb_test_multiple "" $tst { + "break -source exp\\\x07licit" { + send_gdb "\t\t" + gdb_test_multiple "" $tst { + -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+\r\n$gdb_prompt" { + send_gdb "\n" + gdb_test "" \ + {Source filename requires function, label, or line offset.} \ + $tst + } } } - } - "break -source exp\\\x07l" { - # This pattern may occur when glibc debuginfo is installed. - send_gdb "\t\t" - gdb_test_multiple "" $tst { - -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+expl.*\r\n$gdb_prompt" { - send_gdb "\n" - gdb_test "" \ - {Source filename requires function, label, or line offset.} \ - $tst + "break -source exp\\\x07l" { + # This pattern may occur when glibc debuginfo is installed. + send_gdb "\t\t" + gdb_test_multiple "" $tst { + -re "\\\x07\r\nexplicit.c\[ \t\]+explicit2.c\[ \t\]+expl.*\r\n$gdb_prompt" { + send_gdb "\n" + gdb_test "" \ + {Source filename requires function, label, or line offset.} \ + $tst + } } } } - } - set tst "complete non-existant file name" - send_gdb "break -source foo\t" - gdb_test_multiple "" $tst { - "break -source foo" { - send_gdb "\t\t" - gdb_test_multiple "" $tst { - "\\\x07\\\x07" { - send_gdb "\n" - gdb_test "" \ - {Source filename requires function, label, or line offset.} \ - $tst + set tst "complete non-existant file name" + send_gdb "break -source foo\t" + gdb_test_multiple "" $tst { + "break -source foo" { + send_gdb "\t\t" + gdb_test_multiple "" $tst { + "\\\x07\\\x07" { + send_gdb "\n" + gdb_test "" \ + {Source filename requires function, label, or line offset.} \ + $tst + } } } } - } - set tst "complete filename and unique function name" - send_gdb "break -source explicit.c -function ma\t" - gdb_test_multiple "" $tst { - "break -source explicit.c -function main " { - send_gdb "\n" - gdb_test "" ".*Breakpoint .*" $tst - gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + set tst "complete filename and unique function name" + send_gdb "break -source explicit.c -function ma\t" + gdb_test_multiple "" $tst { + "break -source explicit.c -function main " { + send_gdb "\n" + gdb_test "" ".*Breakpoint .*" $tst + gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + } } - } - set tst "complete filename and non-unique function name" - send_gdb "break -so 3explicit.c -func myfunc\t" - gdb_test_multiple "" $tst { - "break -so 3explicit.c -func myfunc\\\x07tion" { - send_gdb "\t\t" - gdb_test_multiple "" $tst { - -re "\\\x07\r\nmyfunction3\[ \t\]+myfunction4\[ \t\]+\r\n$gdb_prompt " { - gdb_test "3" ".*Breakpoint \[0-9\]+.*" $tst - gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + set tst "complete filename and non-unique function name" + send_gdb "break -so 3explicit.c -func myfunc\t" + gdb_test_multiple "" $tst { + "break -so 3explicit.c -func myfunc\\\x07tion" { + send_gdb "\t\t" + gdb_test_multiple "" $tst { + -re "\\\x07\r\nmyfunction3\[ \t\]+myfunction4\[ \t\]+\r\n$gdb_prompt " { + gdb_test "3" ".*Breakpoint \[0-9\]+.*" $tst + gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + } } } } - } - set tst "complete filename and non-existant function name" - send_gdb "break -sou 3explicit.c -fun foo\t" - gdb_test_multiple "" $tst { - "break -sou 3explicit.c -fun foo\\\x07" { - send_gdb "\t\t" - gdb_test_multiple "" $tst { - "\\\x07\\\x07" { - send_gdb "\n" - gdb_test "" \ - {Function "foo" not defined in "3explicit.c".} $tst + set tst "complete filename and non-existant function name" + send_gdb "break -sou 3explicit.c -fun foo\t" + gdb_test_multiple "" $tst { + "break -sou 3explicit.c -fun foo\\\x07" { + send_gdb "\t\t" + gdb_test_multiple "" $tst { + "\\\x07\\\x07" { + send_gdb "\n" + gdb_test "" \ + {Function "foo" not defined in "3explicit.c".} $tst + } } } } - } - set tst "complete filename and function reversed" - send_gdb "break -func myfunction4 -source 3ex\t" - gdb_test_multiple "" $tst { - "break -func myfunction4 -source 3explicit.c " { - send_gdb "\n" - gdb_test "" "Breakpoint \[0-9\]+.*" $tst - gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + set tst "complete filename and function reversed" + send_gdb "break -func myfunction4 -source 3ex\t" + gdb_test_multiple "" $tst { + "break -func myfunction4 -source 3explicit.c " { + send_gdb "\n" + gdb_test "" "Breakpoint \[0-9\]+.*" $tst + gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint" + } } - } - # NOTE: We don't bother testing more elaborate combinations of options, - # such as "-func main -sour 3ex\t" (main is defined in explicit.c). The - # completer cannot handle these yet. + # NOTE: We don't bother testing more elaborate combinations of options, + # such as "-func main -sour 3ex\t" (main is defined in explicit.c). + # The completer cannot handle these yet. + + } + # End of completion tests. # Test pending explicit breakpoints gdb_exit