This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb: tests: mark async unsupported dynamically
- From: Pedro Alves <palves at redhat dot com>
- To: Mike Frysinger <vapier at gentoo dot org>, gdb-patches at sourceware dot org
- Date: Wed, 24 Jun 2015 12:25:46 +0100
- Subject: Re: [PATCH] gdb: tests: mark async unsupported dynamically
- Authentication-results: sourceware.org; auth=none
- References: <1434770234-24916-1-git-send-email-vapier at gentoo dot org>
On 06/20/2015 04:17 AM, Mike Frysinger wrote:
> There are many targets which do not support asynchronous execution.
> Rather than having the async tests mark them as FAIL, use UNSUPPORTED
> as that better represents the state.
> ---
> 2015-06-19 Mike Frysinger <vapier@gentoo.org>
>
> * gdb.base/async.exp (test_background): Call unsupported when async
> isn't supported.
>
> gdb/testsuite/gdb.base/async.exp | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
> index 2d3fb73..4b9168a 100644
> --- a/gdb/testsuite/gdb.base/async.exp
> +++ b/gdb/testsuite/gdb.base/async.exp
> @@ -58,6 +58,9 @@ proc test_background {command before_prompt after_prompt {message ""}} {
> -re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" {
> pass "$message"
> }
> + -re "Asynchronous execution not supported on this target\.\r\n" {
> + unsupported "$message"
> + }
> -re "$gdb_prompt.*completed\.\r\n" {
> fail "$message"
> }
>
We should also return something that the caller checks to bail the
rest of the file. Otherwise, as soon as we add something to the
test that expects that e.g., "print foo" returns some value after the
previous async commands worked, that test will fail on sync targets.
Something like:
send_gdb "$command\n"
gdb_expect {
-re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" {
pass "$message"
+ return 0
}
-re "$gdb_prompt.*completed\.\r\n" {
fail "$message"
}
timeout {
fail "$message (timeout)"
}
}
+ return -1
}
and:
-test_background "next&" "" ".*z = 9.*"
+if {[test_background "next&" "" ".*z = 9.*"] < 0} {
+ return
+}
... rest unchanged ...
Thanks,
Pedro Alves