Re: [patch] python prompt additions at first prompt.

Phil Muldoon
2011-08-02T09:07:53Z

Matt Rice <ratmice@gmail.com> writes:

> On Mon, Aug 1, 2011 at 7:13 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:

> Think it was the quoting of $gdb_prompt which had me foiled.
>
> 2011-08-01 Matt Rice <ratmice@gmail.com>
>
> * gdb.python/py-prompt.exp: New file.

Thanks.

> +++ b/gdb/testsuite/gdb.python/py-prompt.exp
> @@ -0,0 +1,60 @@
> +# Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
> +

This is a new file, so we just need 2011.

Also, the other prompt tests are in python.exp, so this standalone test
is kind of an anomaly. What do you think about combining the python.exp
prompt tests into this test file? If you think that is ok, then you can
just submit another consolidation patch after this one has been approved
and checked in.

> +set GDBFLAGS [concat $GDBFLAGS " -ex \"python def foo(x): return \'(Foo) \'\""]
> +set GDBFLAGS [concat $GDBFLAGS " -ex \"python gdb.prompt_hook = foo\""]
> +
> +set tmp_gdbflags $GDBFLAGS
> +set saved_gdb_prompt $gdb_prompt
> +
> +global gdb_prompt
> +set gdb_prompt "\[(\]Foo\[)\]"
> +
> +
> +# The following tests are strange in that we are testing the first prompt
> +# gdb_start will fail/timeout if does not receive the '(foo) ' prompt.
> +# otherwise no 'passing' test is performed.
> +set GDBFLAGS [concat $tmp_gdbflags " -ex \"set editing on\""]
> +gdb_start
> +gdb_exit

While this does test the prompt at startup, without a PASS/FAIL how can
we track if it has regressed? I think it will just timeout, which is
not optimal.

If Tom (or any other maintainer) is ok with it, I guess I am too. If
there is a method to utilise a formal PASS/FAIL into the test I would
prefer that.

Thanks again for doing this.

Cheers

Phil