This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dejagnu testing issue


On Fri, Oct 21, 2011 at 10:32 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Fri, 21 Oct 2011 10:14:42 +0200, Kevin Pouget wrote:
>> for the record, here is the way to get the pid based on "expect_out":
>>
>> gdb_test_multiple "info inferior" "list inferiors" {
>> ? ? -re ".* \* 1.*process (\[0-9\]*).*$gdb_prompt $" {
>> ? ? ? set pid $expect_out(1,string)
>> ? ? ? pass "list inferiors"
>> ? ? }
>> }
>
> While it works to make it working as was intended it could be for example:
>
> gdb_test_multiple "info inferior" "list inferiors" {
> ? ?-re "\r\n\\* 1 *process (\[0-9\]*) .*\r\n$gdb_prompt $" {
> ? ? ? ?set pid $expect_out(1,string)
> ? ? ? ?pass "list inferiors"
> ? ?}
> }
>
> Initial .* is redundant, start of the expect string is not anchored.
>
> \* is equal to * as the first level of backslashes is parsed by TCL
> interpreter, not by the regex compiler.
>
> If one fixes \* -> \\* to really match an asterisk it no longer matches.
> The asterisk is preceded by a newline, not by a space as in your regex string.

Thanks for this precision, the Dejagnu testsuite is not the easiest
tool to master ...

> Initial .* is redundant, start of the expect string is not anchored.

just with this comment, I noticed that a lot of my tests not wrong,
but not correctly written at least, and almost the same for
> If one fixes \* -> \\* to really match an asterisk it no longer matches.


Cordially,

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]