[gdb/testsuite] Fix timeout in gdb.mi/mi-multi-commands.exp

Message ID 20240903114353.9418-1-tdevries@suse.de
State Committed
Headers
Series [gdb/testsuite] Fix timeout in gdb.mi/mi-multi-commands.exp |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries Sept. 3, 2024, 11:43 a.m. UTC
  On aarch64-linux, with test-case gdb.mi/mi-multi-commands.exp once in a while
I run into (edited for readability):
...
(gdb) ^M
<LOTS-OF-SPACES>-data-evaluate-expression $a^M
-data-evaluate-^done,value="\"FIRST COMMAND\""^M
expression $b(gdb) ^M
^M
^done,value="\"TEST COMPLETE\""^M
(gdb) ^M
PASS: $exp: args=: look for first command output, command length 236
FAIL: $exp: args=: look for second command output, command length 236 (timeout)
...

This is more likely to trigger when running the test-case using
taskset -c <cpu> (where in a big.little setup we pick a little cpu).

The setup here is that the test-case issues these two commands at once:
...
-data-evaluate-expression $a
-data-evaluate-expression $b
...
where the length of the first command is artificially increased by prefixing
it with spaces, show as <LOTS-OF-SPACES> above.

What happens is that gdb, after parsing the first command, executes it.
Then the output of the first command intermixes with the echoing of the second
command, which produces this line containing the first prompt:
...
expression $b(gdb) ^M
...
which doesn't match the \r\n prefix of the regexp supposed to consume the
first prompt:
...
           -re "\r\n$mi_gdb_prompt" {
...

Fix this by dropping the \r\n prefix.

Tested on aarch64-linux.

PR testsuite/29781
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29781
---
 gdb/testsuite/gdb.mi/mi-multi-commands.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: a6ecb18b796b2a7342ab72d14c6bd440b718030f
  

Comments

Tom de Vries Sept. 23, 2024, 5:46 a.m. UTC | #1
On 9/3/24 13:43, Tom de Vries wrote:
> On aarch64-linux, with test-case gdb.mi/mi-multi-commands.exp once in a while
> I run into (edited for readability):
> ...
> (gdb) ^M
> <LOTS-OF-SPACES>-data-evaluate-expression $a^M
> -data-evaluate-^done,value="\"FIRST COMMAND\""^M
> expression $b(gdb) ^M
> ^M
> ^done,value="\"TEST COMPLETE\""^M
> (gdb) ^M
> PASS: $exp: args=: look for first command output, command length 236
> FAIL: $exp: args=: look for second command output, command length 236 (timeout)
> ...
> 
> This is more likely to trigger when running the test-case using
> taskset -c <cpu> (where in a big.little setup we pick a little cpu).
> 
> The setup here is that the test-case issues these two commands at once:
> ...
> -data-evaluate-expression $a
> -data-evaluate-expression $b
> ...
> where the length of the first command is artificially increased by prefixing
> it with spaces, show as <LOTS-OF-SPACES> above.
> 
> What happens is that gdb, after parsing the first command, executes it.
> Then the output of the first command intermixes with the echoing of the second
> command, which produces this line containing the first prompt:
> ...
> expression $b(gdb) ^M
> ...
> which doesn't match the \r\n prefix of the regexp supposed to consume the
> first prompt:
> ...
>             -re "\r\n$mi_gdb_prompt" {
> ...
> 
> Fix this by dropping the \r\n prefix.
> 

Pushed.

Thanks,
- Tom

> Tested on aarch64-linux.
> 
> PR testsuite/29781
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29781
> ---
>   gdb/testsuite/gdb.mi/mi-multi-commands.exp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
> index 3a2e774bddc..028e187366a 100644
> --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
> +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
> @@ -103,7 +103,7 @@ proc run_test { args } {
>   		set seen_first_message true
>   		exp_continue
>   	    }
> -	    -re "\r\n$mi_gdb_prompt" {
> +	    -re "$mi_gdb_prompt" {
>   		gdb_assert $seen_first_message $gdb_test_name
>   	    }
>   	}
> 
> base-commit: a6ecb18b796b2a7342ab72d14c6bd440b718030f
  

Patch

diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
index 3a2e774bddc..028e187366a 100644
--- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
+++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
@@ -103,7 +103,7 @@  proc run_test { args } {
 		set seen_first_message true
 		exp_continue
 	    }
-	    -re "\r\n$mi_gdb_prompt" {
+	    -re "$mi_gdb_prompt" {
 		gdb_assert $seen_first_message $gdb_test_name
 	    }
 	}