This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 11/11] Tests for non-stop behaviour.
- From: Daniel Jacobowitz <drow at false dot org>
- To: Vladimir Prus <vladimir at codesourcery dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 11 Jul 2008 09:59:57 -0400
- Subject: Re: [RFA 11/11] Tests for non-stop behaviour.
- References: <200806282102.19484.vladimir@codesourcery.com>
On Sat, Jun 28, 2008 at 09:02:19PM +0400, Vladimir Prus wrote:
> +send_gdb "-exec-interrupt --thread 1\n"
> +gdb_expect {
> + -re "\\^done\r\n$mi_gdb_prompt\\*stopped\[^\r\n\]+\r\n$" {
> + pass "interrupted"
> + }
> + timeout {
> + fail "interrupted (timeout)"
> + }
> +}
A general comment - please avoid writing tests where the options are
"pass" and "timeout". If mi_gdb_test is not general enough then we need
something like mi_gdb_test_multiple instead of send_gdb/gdb_expect
directly. Otherwise other failure patterns are not detected, so
the test case is very annoying if it starts to fail as each individual
test times out.
> +# The interrupt command sends SIGINT to the target, and therefore the
> +# thread might not be stopped immediately when we return from the target.
> +# So, wait a bit
> +sleep 1
> +check_thread_states {"stopped" "stopped" "stopped"} "thread state, stop 4"
Any test with an explicit delay is likely to fail under high load
(like in a nightly tester). If this is a problem, the right fix is
probably to loop checking; take only one second in the common case but
allow some longer interval like 20s.
--
Daniel Jacobowitz
CodeSourcery