public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp
@ 2016-05-10 10:57 Yao Qi
  2016-05-10 11:25 ` Andreas Schwab
  2016-05-18 11:27 ` Pedro Alves
  0 siblings, 2 replies; 5+ messages in thread
From: Yao Qi @ 2016-05-10 10:57 UTC (permalink / raw)
  To: gdb-patches

batch-preserve-term-settings.exp fails if the shell prompt isn't $.  It
is # in our testing env.  In fact, the shell prompt can be anything.

The perfect solution would be "set_board_info shell_prompt" in the
host board file, and use board_info shell_prompt in
batch-preserve-term-settings.exp.  This is a little bit overkill to
me, and we still need to figure out the different prompts on different
shells.  I also tried to start shell with the prompt preset, but there is
not unique way to set shell prompt in different shells, so I give up.

It is reasonably simple to match either $ or # for the shell prompt, and
we can easily extend it to match other char, like >.

gdb/testsuite:

2016-05-10  Yao Qi  <yao.qi@linaro.org>

	* gdb.base/batch-preserve-term-settings.exp: Remove variable
	shell_prompt.  Update shell_prompt_re.
---
 gdb/testsuite/gdb.base/batch-preserve-term-settings.exp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
index c925e88..f54a608 100644
--- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
+++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
@@ -28,8 +28,7 @@ if [is_remote host] {
 }
 
 # The shell's prompt.
-set shell_prompt "$ "
-set shell_prompt_re [string_to_regexp $shell_prompt]
+set shell_prompt_re "\[$|#\] "
 
 # Spawn shell.  Returns true on success, false otherwise.
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp
  2016-05-10 10:57 [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp Yao Qi
@ 2016-05-10 11:25 ` Andreas Schwab
  2016-05-10 12:02   ` Yao Qi
  2016-05-18 11:27 ` Pedro Alves
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2016-05-10 11:25 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Yao Qi <qiyaoltc@gmail.com> writes:

> diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
> index c925e88..f54a608 100644
> --- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
> +++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
> @@ -28,8 +28,7 @@ if [is_remote host] {
>  }
>  
>  # The shell's prompt.
> -set shell_prompt "$ "
> -set shell_prompt_re [string_to_regexp $shell_prompt]
> +set shell_prompt_re "\[$|#\] "

Did you intent to match "|" too?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp
  2016-05-10 11:25 ` Andreas Schwab
@ 2016-05-10 12:02   ` Yao Qi
  2016-05-16 16:34     ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2016-05-10 12:02 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Yao Qi, gdb-patches

Andreas Schwab <schwab@suse.de> writes:

>>  # The shell's prompt.
>> -set shell_prompt "$ "
>> -set shell_prompt_re [string_to_regexp $shell_prompt]
>> +set shell_prompt_re "\[$|#\] "
>
> Did you intent to match "|" too?

Ur, no, that is not intended.  "|" should be removed from
shell_prompt_re.

-- 
Yao (齐尧)

Subject: [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp

batch-preserve-term-settings.exp fails if the shell prompt isn't $.  It
is # in our testing env.  In fact, the shell prompt can be anything.

The perfect solution would be "set_board_info shell_prompt" in the
host board file, and use board_info shell_prompt in
batch-preserve-term-settings.exp.  This is a little bit overkill to
me, and we still need to figure out the different prompts on different
shells.  I also tried to start shell with the prompt preset, but there is
not unique way to set shell prompt in different shells, so I give up.

It is reasonably simple to match either $ or # for the shell prompt, and
we can easily extend it to match other char, like >.

gdb/testsuite:

2016-05-10  Yao Qi  <yao.qi@linaro.org>

	* gdb.base/batch-preserve-term-settings.exp: Remove variable
	shell_prompt.  Update shell_prompt_re.

diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
index c925e88..a2de2c0 100644
--- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
+++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
@@ -28,8 +28,7 @@ if [is_remote host] {
 }
 
 # The shell's prompt.
-set shell_prompt "$ "
-set shell_prompt_re [string_to_regexp $shell_prompt]
+set shell_prompt_re "\[$#\] "
 
 # Spawn shell.  Returns true on success, false otherwise.
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp
  2016-05-10 12:02   ` Yao Qi
@ 2016-05-16 16:34     ` Yao Qi
  0 siblings, 0 replies; 5+ messages in thread
From: Yao Qi @ 2016-05-16 16:34 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Yao Qi <qiyaoltc@gmail.com> writes:

> gdb/testsuite:
>
> 2016-05-10  Yao Qi  <yao.qi@linaro.org>
>
> 	* gdb.base/batch-preserve-term-settings.exp: Remove variable
> 	shell_prompt.  Update shell_prompt_re.

I pushed it in.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp
  2016-05-10 10:57 [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp Yao Qi
  2016-05-10 11:25 ` Andreas Schwab
@ 2016-05-18 11:27 ` Pedro Alves
  1 sibling, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2016-05-18 11:27 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 05/10/2016 11:57 AM, Yao Qi wrote:
> batch-preserve-term-settings.exp fails if the shell prompt isn't $.  It
> is # in our testing env.  In fact, the shell prompt can be anything.
> 
> The perfect solution would be "set_board_info shell_prompt" in the
> host board file, and use board_info shell_prompt in
> batch-preserve-term-settings.exp.  This is a little bit overkill to
> me, and we still need to figure out the different prompts on different
> shells.  I also tried to start shell with the prompt preset, but there is
> not unique way to set shell prompt in different shells, so I give up.

Yeah, I think that'd be overkill.  Anyone running tests with a custom
prompt can just not do that.

> It is reasonably simple to match either $ or # for the shell prompt, and
> we can easily extend it to match other char, like >.

Excepting "#" is reasonable, since it'll be the usual prompt if
you run the shell as root.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-18 11:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 10:57 [PATCH] Match shell_prompt # in batch-preserve-term-settings.exp Yao Qi
2016-05-10 11:25 ` Andreas Schwab
2016-05-10 12:02   ` Yao Qi
2016-05-16 16:34     ` Yao Qi
2016-05-18 11:27 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).