From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id k5RBAvoL119FUQAAWB0awg (envelope-from ) for ; Mon, 14 Dec 2020 01:53:46 -0500 Received: by simark.ca (Postfix, from userid 112) id F11A51F0AA; Mon, 14 Dec 2020 01:53:45 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 848141E590 for ; Mon, 14 Dec 2020 01:53:45 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E821C3858004; Mon, 14 Dec 2020 06:53:44 +0000 (GMT) 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-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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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 }