From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from kwanyin.sergiodj.net (kwanyin.sergiodj.net [158.69.185.54]) by sourceware.org (Postfix) with ESMTPS id 9DA5A385E000 for ; Sun, 22 Mar 2020 22:06:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9DA5A385E000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] [gdb/testsuite] Fix check-read1 FAIL in gdb.tui/corefile-run.exp From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <301b21e0dfee41c7a93f41089428d5d03fee685b@gdb-build> Date: Sun, 22 Mar 2020 18:06:00 -0400 X-Spam-Status: No, score=-16.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-testers@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-testers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2020 22:06:04 -0000 *** TEST RESULTS FOR COMMIT 301b21e0dfee41c7a93f41089428d5d03fee685b *** commit 301b21e0dfee41c7a93f41089428d5d03fee685b Author: Tom de Vries AuthorDate: Fri Mar 13 00:31:15 2020 +0100 Commit: Tom de Vries CommitDate: Fri Mar 13 00:31:15 2020 +0100 [gdb/testsuite] Fix check-read1 FAIL in gdb.tui/corefile-run.exp 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. gdb/testsuite/ChangeLog: 2020-03-13 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. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e13a230b70..de419eba18 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2020-03-13 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. + 2020-03-12 Simon Marchi * gdb.base/break-interp.exp: Use foreach_with_prefix. 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 7505821a85..8c9f97af6e 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -489,7 +489,7 @@ namespace eval Term { return 0 } - command "tui enable" + command_no_prompt_prefix "tui enable" return 1 } @@ -497,8 +497,19 @@ 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 + } + + # As proc command, but don't wait for a initial prompt. This is used for + # inital terminal commands, where there's no prompt yet. + 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