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: [RFA 11/11] Tests for non-stop behaviour.


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


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