From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37238 invoked by alias); 5 Mar 2020 22:43:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 37229 invoked by uid 89); 5 Mar 2020 22:43:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=core-file, TUI, tui, HX-Languages-Length:4585 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Mar 2020 22:43:20 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 07F1CB20E; Thu, 5 Mar 2020 22:43:18 +0000 (UTC) Subject: [PING][PATCH][gdb/testsuite] Fix check-read1 FAIL in gdb.tui/corefile-run.exp From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey References: <20200222204523.GA9079@delia> Message-ID: <21c6f092-58d7-448c-08f1-45a3ef10fac0@suse.de> Date: Thu, 05 Mar 2020 22:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200222204523.GA9079@delia> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-03/txt/msg00133.txt On 22-02-2020 21:45, Tom de Vries wrote: > Hi, > > With test-case gdb.tui/corefile-run.exp and make target check-read1, I run > into: > ... > FAIL: gdb.tui/corefile-run.exp: run until the end > ... > > In more detail, using -v: > ... > PASS: gdb.tui/corefile-run.exp: load corefile > ^M+++ _ctl_0x0d > ^[[17d+++ _csi_d <<<17>>> > ^[[M+++ _csi_M <<<>>> > ^[[24d+++ _csi_d <<<24>>> > (INSERT <<(>> > gINSERT <> > dINSERT <> > bINSERT <> > )INSERT <<)>> > INSERT << >> > FAIL: gdb.tui/corefile-run.exp: run until the end > ... > > With some debugging code added in wait_for, what happens becomes more clear: > ... > if {[regexp -- $wait_for $prev]} { > + verbose -log "\nwait_for: MATCHED line ($_cur_y): \"$prev\"" > + verbose -log "wait_for: AGAINST regexp: \"$wait_for\"" > ... > > In corefile-run.exp, we execute: > ... > Term::command "run" > ... > and in proc Term::command, we send the command, and then call wait_for: > ... > proc command {cmd} { > send_gdb "$cmd\n" > wait_for [string_to_regexp $cmd] > } > ... > which first waits for the command string, and then for the prompt. > > In this case however, the matching of the command string triggers on a > previous line: > ... > wait_for: MATCHED line (16): \ > "(gdb) core-file corefile-run.core[New LWP 6426] " > wait_for: AGAINST regexp: "run" > ... > and from there on things go out of sync, eventually resulting in the FAIL. > > Fix this in proc command by more precisely specifying the expected pattern: > adding a ^$gdb_prompt prefix. > > Add a command_no_prompt_prefix variant to use for initial terminal commands > where there's no prompt yet. > > Tested gdb.tui/*.exp on x86_64-linux, with make target check and check-read1. > > OK for trunk? > Ping. Thanks, - Tom > [gdb/testsuite] Fix check-read1 FAIL in gdb.tui/corefile-run.exp > > gdb/testsuite/ChangeLog: > > 2020-02-22 Tom de Vries > > * lib/tuiterm.exp (Term::command_no_prompt_prefix): New proc. > (Term::command): Use prompt prefix. > (Term::enter_tui): Use command_no_prompt_prefix instead of prefix. > * gdb.tui/tui-layout-asm-short-prog.exp: Use > command_no_prompt_prefix instead of prefix. > * gdb.tui/tui-layout-asm.exp: Same. > > --- > gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp | 2 +- > gdb/testsuite/gdb.tui/tui-layout-asm.exp | 2 +- > gdb/testsuite/lib/tuiterm.exp | 13 +++++++++++-- > 3 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp > index d0b871ff76..4aa1ba3046 100644 > --- a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp > +++ b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.exp > @@ -32,7 +32,7 @@ if {![Term::prepare_for_tui]} { > } > > # This puts us into TUI mode, and should display the ASM window. > -Term::command "layout asm" > +Term::command_no_prompt_prefix "layout asm" > Term::check_box_contents "check asm box contents" 0 0 80 15 "<_start>" > > # Record the first line of output, we'll need this later. > diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm.exp b/gdb/testsuite/gdb.tui/tui-layout-asm.exp > index 40f46eaeec..257321fec7 100644 > --- a/gdb/testsuite/gdb.tui/tui-layout-asm.exp > +++ b/gdb/testsuite/gdb.tui/tui-layout-asm.exp > @@ -30,7 +30,7 @@ if {![Term::prepare_for_tui]} { > } > > # This puts us into TUI mode, and should display the ASM window. > -Term::command "layout asm" > +Term::command_no_prompt_prefix "layout asm" > Term::check_box_contents "check asm box contents" 0 0 80 15 "
" > > # Scroll the ASM window down using the down arrow key. In an ideal > diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp > index da5580324a..fea9427ef4 100644 > --- a/gdb/testsuite/lib/tuiterm.exp > +++ b/gdb/testsuite/lib/tuiterm.exp > @@ -485,7 +485,7 @@ namespace eval Term { > return 0 > } > > - command "tui enable" > + command_no_prompt_prefix "tui enable" > return 1 > } > > @@ -493,8 +493,17 @@ namespace eval Term { > # seen in the TUI. CMD should not end with a newline -- that will > # be supplied by this function. > proc command {cmd} { > + global gdb_prompt > + send_gdb "$cmd\n" > + set str [string_to_regexp $cmd] > + set str "^$gdb_prompt $str" > + wait_for $str > + } > + > + proc command_no_prompt_prefix {cmd} { > send_gdb "$cmd\n" > - wait_for [string_to_regexp $cmd] > + set str [string_to_regexp $cmd] > + wait_for "^$str" > } > > # Return the text of screen line N, without attributes. Lines are >