Re: allow gdb_test_multiple { -timeout n }

Pedro Alves
2010-03-12T21:11:23Z

On Friday 12 March 2010 21:09:02, Pedro Alves wrote:
> I've applied this patch of Daniel's. It tweaks gdb_test_multiple
> to be able to forward expect a -timeout switch. E.g.,
> instead of:
>
> set prev_timeout $timeout
> set timeout 10
>
> gdb_test_multiple "" "" {
> -re "$gdb_prompt $" { }
> }
>
> set timeout $prev_timeout
>
> you can simply do:
>
> gdb_test_multiple "" "" {
> -timeout 10
> -re "$gdb_prompt $" { }
> }

This patch.

--
Pedro Alves

2010-03-12 Daniel Jacobowitz <dan@codesourcery.com>

* lib/gdb.exp (gdb_test_multiple): Handle -timeout.

---
gdb/testsuite/lib/gdb.exp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

Index: src/gdb/testsuite/lib/gdb.exp
===================================================================
--- src.orig/gdb/testsuite/lib/gdb.exp 2010-03-12 19:13:56.000000000 +0000
+++ src/gdb/testsuite/lib/gdb.exp 2010-03-12 20:57:56.000000000 +0000
@@ -601,12 +601,23 @@ proc gdb_test_multiple { command message
set processed_code ""
set patterns ""
set expecting_action 0
+ set expecting_arg 0
foreach item $user_code subst_item $subst_code {
if { $item == "-n" || $item == "-notransfer" || $item == "-nocase" } {
lappend processed_code $item
continue
}
- if {$item == "-indices" || $item == "-re" || $item == "-ex"} {
+ if { $item == "-indices" || $item == "-re" || $item == "-ex" } {
+ lappend processed_code $item
+ continue
+ }
+ if { $item == "-timeout" } {
+ set expecting_arg 1
+ lappend processed_code $item
+ continue
+ }
+ if { $expecting_arg } {
+ set expecting_arg 0
lappend processed_code $item
continue
}