From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 90B783858004 for ; Mon, 14 Dec 2020 06:53:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 90B783858004 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A5C45AD35 for ; Mon, 14 Dec 2020 06:53:41 +0000 (UTC) Date: Mon, 14 Dec 2020 07:53:39 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Handle shell prompt in batch-preserve-term-settings.exp Message-ID: <20201214065337.GA3067@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Dec 2020 06:53:43 -0000 Hi, On SLE-11, I run into: ... FAIL: gdb.base/batch-preserve-term-settings.exp: batch run: spawn shell \ (timeout) ... The problem is that the shell prompt has PS1="\h:\w> ", but the test expects a shell prompt ending in a space preceded by either '$' or '#': ... set shell_prompt_re "\[$#\] " ... We could easily fix this by adding '>' to shell_prompt_re, but this wouldn't work for other PS1 setting. Fix this instead by setting the shell prompt to "gdb-subshell$ " (as in gdb.base/multi-line-starts-subshell.exp). Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/testsuite] Handle shell prompt in batch-preserve-term-settings.exp gdb/testsuite/ChangeLog: 2020-12-14 Tom de Vries PR testsuite/26951 * gdb.base/batch-preserve-term-settings.exp: Use "gdb-subshell$ " as shell prompt. --- gdb/testsuite/gdb.base/batch-preserve-term-settings.exp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp index 7ae3518beb..c39d638aeb 100644 --- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp +++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp @@ -28,12 +28,13 @@ if [is_remote host] { } # The shell's prompt. -set shell_prompt_re "\[$#\] " +set shell_prompt_ps1 "gdb-subshell$ " +set shell_prompt_re [string_to_regexp $shell_prompt_ps1] # Spawn shell. Returns true on success, false otherwise. proc spawn_shell {} { - global shell_prompt_re + global shell_prompt_ps1 shell_prompt_re set res [remote_spawn host "/bin/sh"] if { $res < 0 || $res == "" } { @@ -41,10 +42,12 @@ proc spawn_shell {} { return 0 } + send_gdb "PS1=\"$shell_prompt_ps1\"\n" + set gotit 0 set test "spawn shell" gdb_expect { - -re "$shell_prompt_re$" { + -re "PS1=\[^\r\n\]*\r\n$shell_prompt_re$" { pass $test set gotit 1 }