From: Bob Rossi <bob@brasko.net>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sources.redhat.com
Subject: Re: MI testsuite to use PTY for inferior
Date: Sat, 20 Aug 2005 09:07:00 -0000 [thread overview]
Message-ID: <20050819222721.GA20029@white> (raw)
In-Reply-To: <200508132151.j7DLpnoR015475@elgar.sibelius.xs4all.nl>
> Funny thing is that if I run mi-console.exp alone, it usually
> (although not always) succeeds.
>
> Attached are a gdb.log for a failing run and a passing run.
OK, I've tracked down why mi-console.exp breaks. Also, I can reproduce
it. The problem is slightly difficult to fix because of race conditions
so I was hoping to get some advice from people who might have had
similar experience with the testsuite.
For MI, the mi_gdb_test function is used to test the output of a
command. Only problem is, in mi_gdb_test there is this,
gdb_expect $tmt {
...
-re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
if ![string match "" $message] then {
pass "$message"
}
set result 0
}
...
-re ".*$mi_gdb_prompt\[ \]*$" {
if ![string match "" $message] then {
fail "$message"
}
set result 1
}
...
}
So, if the pattern the user passes in matches the regex, then a pass
will get put out. However, if the pattern does not match, and a
mi_gdb_prompt is reached, then a fail will be issued. Only difference
is, the second case does not have to wait the full $tmt (which is 60 in
this case) seconds to complete the match.
So, the first problem is that $pattern can not consist of more than a
single gdb prompt output. In MI this means, you send,
47-exec-next
and get back
47^running^M
(gdb) ^M
47*stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x080483e8",func="main",args=[],file
(gdb) ^M
You can not expect to get back both of those in a single mi_gdb_test
command list so,
mi_gdb_test "47-exec-next" \
"47\\^running\[\r\n\]+${mi_gdb_prompt}47\\*stopped.*}" \
"Testing console output" \
"Hello \\\\\"!\[\r\n\]+"
With that in mind, the next obvious solution, which is the one used, is
to do what is currently in mi-console.exp,
mi_gdb_test "47-exec-next" \
"47\\^running" \
"Testing console output" \
"Hello \\\\\"!\[\r\n\]+"
gdb_expect {
-re "47\\*stopped.*$mi_gdb_prompt$" {
pass "Finished step over hello"
}
timeout {
fail "Finished step over hello (timeout)"
}
}
This splits up the regex matching into 2 commands, which makes sense.
The problem is, in mi_gdb_test when it goes to match 47\\^running, it is
possible that either just that has been outputted by GDB (Yay, match!),
or that also the 47\\*stopped... output has also been output by GDB. In
this case, the testcase fails because the regex in mi_gdb_test does not
match the 'end anchor' of the output from GDB. Thus the race condition.
I'm still thinking of ways to fix this without totally hacking the
testsuite, any ideas?
To reproduce this problem, put 'sleep 1' just before the gdb_expect line
in mi-support.exp:mi_gdb_test. That gives GDB enough time to output
both items that need to be matched.
Thanks,
Bob Rossi
next prev parent reply other threads:[~2005-08-19 22:27 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-27 3:18 Bob Rossi
2005-08-13 22:04 ` Mark Kettenis
2005-08-20 9:07 ` Bob Rossi [this message]
2005-08-30 2:55 ` Daniel Jacobowitz
2005-09-01 0:52 ` Bob Rossi
2005-09-01 22:12 ` Mark Kettenis
2005-09-01 23:52 ` Bob Rossi
2005-09-05 19:52 ` Bob Rossi
2005-09-10 4:02 ` Daniel Jacobowitz
2005-07-30 5:54 Nick Roberts
2005-07-30 17:39 ` Bob Rossi
2005-07-30 18:08 ` Daniel Jacobowitz
2005-07-30 22:47 ` Nick Roberts
2005-07-31 1:19 ` Daniel Jacobowitz
2005-07-30 22:47 ` Nick Roberts
2005-07-30 23:03 ` Bob Rossi
2005-07-31 1:21 ` Daniel Jacobowitz
2005-07-31 13:16 ` Bob Rossi
2005-07-31 15:31 ` Daniel Jacobowitz
2005-07-31 21:20 ` Bob Rossi
2005-08-01 1:53 ` Daniel Jacobowitz
2005-08-01 2:05 ` Bob Rossi
2005-08-01 2:15 ` Daniel Jacobowitz
2005-08-01 11:32 ` Bob Rossi
2005-08-01 3:56 ` Eli Zaretskii
2005-08-01 11:30 ` Bob Rossi
2005-08-01 13:00 ` Daniel Jacobowitz
2005-08-01 13:16 ` Bob Rossi
2005-08-01 13:23 ` Daniel Jacobowitz
2005-08-01 13:31 ` Bob Rossi
2005-08-01 14:00 ` Daniel Jacobowitz
2005-08-01 14:07 ` Bob Rossi
2005-08-01 18:45 ` Eli Zaretskii
2005-08-01 19:01 ` Mark Kettenis
2005-08-01 19:25 ` Daniel Jacobowitz
2005-08-01 19:34 ` Mark Kettenis
2005-08-01 19:43 ` Bob Rossi
2005-08-01 20:48 ` Eli Zaretskii
2005-08-01 20:45 ` Eli Zaretskii
2005-08-01 20:52 ` Daniel Jacobowitz
2005-08-02 3:45 ` Eli Zaretskii
2005-08-02 3:50 ` Daniel Jacobowitz
2005-08-02 20:46 ` Eli Zaretskii
2005-08-02 20:48 ` Daniel Jacobowitz
2005-08-13 17:26 ` Bob Rossi
2005-08-13 21:41 ` Daniel Jacobowitz
2005-07-31 21:35 ` Nick Roberts
2005-07-31 21:37 ` Daniel Jacobowitz
2005-07-31 23:32 ` Nick Roberts
2005-08-01 1:51 ` Daniel Jacobowitz
2005-08-03 2:07 ` Bob Rossi
2005-08-03 12:48 ` Bob Rossi
2005-08-03 13:19 ` Daniel Jacobowitz
2005-08-03 18:22 ` Bob Rossi
2005-08-03 18:23 ` Daniel Jacobowitz
2005-08-03 18:24 ` Bob Rossi
2005-08-03 18:32 ` Daniel Jacobowitz
2005-08-03 19:31 ` Bob Rossi
2005-08-04 2:23 ` Bob Rossi
2005-08-04 2:27 ` Bob Rossi
2005-08-04 4:05 ` Daniel Jacobowitz
2005-08-04 13:07 ` Bob Rossi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050819222721.GA20029@white \
--to=bob@brasko.net \
--cc=gdb-patches@sources.redhat.com \
--cc=mark.kettenis@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox