This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] testsuite: race fix: gdb.trace/report.exp
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Mon, 7 Mar 2011 11:01:57 +0000
- Subject: Re: [patch] testsuite: race fix: gdb.trace/report.exp
- References: <20110306105901.GA30591@host1.jankratochvil.net>
Thanks for this addressing this.
--
Pedro Alves
On Sunday 06 March 2011 10:59:01, Jan Kratochvil wrote:
> Hi,
>
> with FSF gdbserver (as this testcase does not get executed with linux-nat)
> there are flipping results for:
> -PASS: gdb.trace/report.exp: 12.1: trace report #1
> +FAIL: gdb.trace/report.exp: 12.1: trace report #1
>
> where the GDB output in gdb.log does not change at all.
>
> expect(1):
> Each time new output arrives, it is compared to each pattern in
> the order they are listed.
>
> So expect will skip and discard the second...sixth data just to match the
> first pattern when larger chunk of data has been read at once.
>
> These unanchored expect strings are too wild to get under sane control IMO,
> therefore anchored it completely. Posting for comments as there are many ways
> how solve this common problem. I will check it in in some time otherwise.
>
> This is not a regression, the testcase is there in this form since:
> commit 14cd51f7793a9ce07bc435069f57269450141363
> Author: Stan Shebs <shebs@apple.com>
> Date: Fri Apr 16 01:35:26 1999 +0000
> Initial revision
>
> Thanks,
> Jan
>
>
> gdb/testsuite/
> 2011-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * gdb.trace/report.exp (12.1: trace report #1): New match for the
> initial commands echo. New match for `Found trace'. Anchor all the
> other matches. Anchor and match for `No trace frame found' the final
> match.
>
> --- a/gdb/testsuite/gdb.trace/report.exp
> +++ b/gdb/testsuite/gdb.trace/report.exp
> @@ -296,31 +296,37 @@ gdb_test_multiple "print \$trace_file" "11.4: test \$trace_file" {
> #
>
> gdb_test_multiple "while \$trace_frame != -1\n output \$trace_file\n printf \", line \%d \(tracepoint #\%d\)\\n\", \$trace_line, \$tracepoint\n tfind\n end" "12.1: trace report #1" {
> - -re " line $testline1 .tracepoint .$tdp1" {
> + -re "> end\r\n" {
> + exp_continue
> + }
> + -re "^Found trace frame \[0-9\]+, tracepoint \[0-9\]+\r\n" {
> + exp_continue
> + }
> + -re "^\[^\r\n\]* line $testline1 .tracepoint .$tdp1\\)\r\n" {
> set linecount1 [expr $linecount1 + 1]
> exp_continue
> }
> - -re " line $testline2 .tracepoint .$tdp2" {
> + -re "^\[^\r\n\]* line $testline2 .tracepoint .$tdp2\\)\r\n" {
> set linecount2 [expr $linecount2 + 1]
> exp_continue
> }
> - -re " line $testline3 .tracepoint .$tdp3" {
> + -re "^\[^\r\n\]* line $testline3 .tracepoint .$tdp3\\)\r\n" {
> set linecount3 [expr $linecount3 + 1]
> exp_continue
> }
> - -re " line $testline4 .tracepoint .$tdp4" {
> + -re "^\[^\r\n\]* line $testline4 .tracepoint .$tdp4\\)\r\n" {
> set linecount4 [expr $linecount4 + 1]
> exp_continue
> }
> - -re " line $testline5 .tracepoint .$tdp5" {
> + -re "^\[^\r\n\]* line $testline5 .tracepoint .$tdp5\\)\r\n" {
> set linecount5 [expr $linecount5 + 1]
> exp_continue
> }
> - -re " line $testline6 .tracepoint .$tdp6" {
> + -re "^\[^\r\n\]* line $testline6 .tracepoint .$tdp6\\)\r\n" {
> set linecount6 [expr $linecount6 + 1]
> exp_continue
> }
> - -re ".*$gdb_prompt $" {
> + -re "^No trace frame found\r\n$gdb_prompt $" {
> if { ($linecount1 < 4) || ($linecount2 < 4) || ($linecount3 < 4) || ($linecount4 < 4) || ($linecount5 < 4) || ($linecount6 < 4) } {
> fail "12.1: trace report #1"
> } else {
>