gdb/testsuite: fix gdb.btrace/non-stop.exp end of history check

Message ID 20240827111849.717166-1-blarsen@redhat.com
State New
Headers
Series gdb/testsuite: fix gdb.btrace/non-stop.exp end of history check |

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

Guinevere Larsen Aug. 27, 2024, 11:18 a.m. UTC
  The recent commit 089197010993b3a5dc50bf882470bab2de696d92 changed the
warnings when GDB reaches the end of the recorded history, and updated
tests to expect the new messages. The pattern used for
gdb.btrace/non-stop.exp, however, was too broad and could cause the
following test result:

    ...
    (gdb) PASS: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: prompt
    ^M
    Reached end of recorded history; stopping.^M
    Following forward execution will be added to history.^M
    test (arg=0x0) at /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M
    30        return arg; /* bp.2 */^M
    ^M
    Reached end of recorded history; stopping.^M
    Following forward execution will be added to history.^M
    test (arg=0x0) at /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M
    30        return arg; /* bp.2 */^M
    PASS: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: thread 0
    FAIL: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: thread 1 (timeout)
    ...

This happens because the pattern looks like one of these 2:
    "Reached end of recorded.*Backwards execution.*"
    "Reached end of recorded.*Following forward.*"

What seems to have happened is that all the output came at once, and
most of it was consumed by the first '.*' pattern when checking for
thread 0, so there was no output left for checking thread 1. This commit
fixes that by making the expected outputs more exact.

I also fixed the whitespace errors in gdb_cont_to_no_history_backwards
that pre-dated the commit above, since I was already touching that proc.
---
 gdb/testsuite/gdb.btrace/non-stop.exp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
  

Comments

Tom de Vries Aug. 27, 2024, 11:44 a.m. UTC | #1
On 8/27/24 13:18, Guinevere Larsen wrote:
> The recent commit 089197010993b3a5dc50bf882470bab2de696d92 changed the
> warnings when GDB reaches the end of the recorded history, and updated
> tests to expect the new messages. The pattern used for
> gdb.btrace/non-stop.exp, however, was too broad and could cause the
> following test result:
> 
>      ...
>      (gdb) PASS: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: prompt
>      ^M
>      Reached end of recorded history; stopping.^M
>      Following forward execution will be added to history.^M
>      test (arg=0x0) at /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M
>      30        return arg; /* bp.2 */^M
>      ^M
>      Reached end of recorded history; stopping.^M
>      Following forward execution will be added to history.^M
>      test (arg=0x0) at /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M
>      30        return arg; /* bp.2 */^M
>      PASS: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: thread 0
>      FAIL: gdb.btrace/non-stop.exp: no progress: all: thread apply all continue: thread 1 (timeout)
>      ...
> 
> This happens because the pattern looks like one of these 2:
>      "Reached end of recorded.*Backwards execution.*"
>      "Reached end of recorded.*Following forward.*"
> 
> What seems to have happened is that all the output came at once, and
> most of it was consumed by the first '.*' pattern when checking for
> thread 0, so there was no output left for checking thread 1. This commit
> fixes that by making the expected outputs more exact.
> 
> I also fixed the whitespace errors in gdb_cont_to_no_history_backwards
> that pre-dated the commit above, since I was already touching that proc.

Hi Gwen,

thanks for the quick fix.

After fixing two trivial tcl errors:
...
diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp 
b/gdb/testsuite/gdb.btrace/non-stop.exp
index edde7fc24b1..8397c2015f8 100644
--- a/gdb/testsuite/gdb.btrace/non-stop.exp
+++ b/gdb/testsuite/gdb.btrace/non-stop.exp
@@ -82,7 +82,7 @@ proc gdb_cont_to_bp_line { line threads nthreads } {
  proc gdb_cont_to_no_history_backward { threads cmd nthreads } {
      gdb_cont_to $threads $cmd \
  	[multi_line \
-	     "Reached end of recorded history; stopping\."
+	     "Reached end of recorded history; stopping\." \
  	     "Backward execution from here not possible\." \
  	     "\[^\\\r\\\n\]*" \
  	     "\[^\\\r\\\n\]*" \
@@ -93,7 +93,7 @@ proc gdb_cont_to_no_history_backward { threads cmd 
nthreads } {
  proc gdb_cont_to_no_history_forward { threads cmd nthreads } {
      gdb_cont_to $threads $cmd \
  	[multi_line \
-	     "Reached end of recorded history; stopping\."
+	     "Reached end of recorded history; stopping\." \
  	     "Following forward execution will be added to history\." \
  	     "\[^\\\r\\\n\]*" \
  	     "\[^\\\r\\\n\]*" \
...
the test-case passes for me.

With those fixes, LGTM.

Approved-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom
  
Guinevere Larsen Aug. 28, 2024, 11:42 a.m. UTC | #2
On 8/27/24 8:44 AM, Tom de Vries wrote:
> On 8/27/24 13:18, Guinevere Larsen wrote:
>> The recent commit 089197010993b3a5dc50bf882470bab2de696d92 changed the
>> warnings when GDB reaches the end of the recorded history, and updated
>> tests to expect the new messages. The pattern used for
>> gdb.btrace/non-stop.exp, however, was too broad and could cause the
>> following test result:
>>
>>      ...
>>      (gdb) PASS: gdb.btrace/non-stop.exp: no progress: all: thread 
>> apply all continue: prompt
>>      ^M
>>      Reached end of recorded history; stopping.^M
>>      Following forward execution will be added to history.^M
>>      test (arg=0x0) at 
>> /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M
>>      30        return arg; /* bp.2 */^M
>>      ^M
>>      Reached end of recorded history; stopping.^M
>>      Following forward execution will be added to history.^M
>>      test (arg=0x0) at 
>> /data/vries/gdb/src/gdb/testsuite/gdb.btrace/non-stop.c:30^M
>>      30        return arg; /* bp.2 */^M
>>      PASS: gdb.btrace/non-stop.exp: no progress: all: thread apply 
>> all continue: thread 0
>>      FAIL: gdb.btrace/non-stop.exp: no progress: all: thread apply 
>> all continue: thread 1 (timeout)
>>      ...
>>
>> This happens because the pattern looks like one of these 2:
>>      "Reached end of recorded.*Backwards execution.*"
>>      "Reached end of recorded.*Following forward.*"
>>
>> What seems to have happened is that all the output came at once, and
>> most of it was consumed by the first '.*' pattern when checking for
>> thread 0, so there was no output left for checking thread 1. This commit
>> fixes that by making the expected outputs more exact.
>>
>> I also fixed the whitespace errors in gdb_cont_to_no_history_backwards
>> that pre-dated the commit above, since I was already touching that proc.
>
> Hi Gwen,
>
> thanks for the quick fix.
>
> After fixing two trivial tcl errors:
> ...
> diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp 
> b/gdb/testsuite/gdb.btrace/non-stop.exp
> index edde7fc24b1..8397c2015f8 100644
> --- a/gdb/testsuite/gdb.btrace/non-stop.exp
> +++ b/gdb/testsuite/gdb.btrace/non-stop.exp
> @@ -82,7 +82,7 @@ proc gdb_cont_to_bp_line { line threads nthreads } {
>  proc gdb_cont_to_no_history_backward { threads cmd nthreads } {
>      gdb_cont_to $threads $cmd \
>      [multi_line \
> -         "Reached end of recorded history; stopping\."
> +         "Reached end of recorded history; stopping\." \
>           "Backward execution from here not possible\." \
>           "\[^\\\r\\\n\]*" \
>           "\[^\\\r\\\n\]*" \
> @@ -93,7 +93,7 @@ proc gdb_cont_to_no_history_backward { threads cmd 
> nthreads } {
>  proc gdb_cont_to_no_history_forward { threads cmd nthreads } {
>      gdb_cont_to $threads $cmd \
>      [multi_line \
> -         "Reached end of recorded history; stopping\."
> +         "Reached end of recorded history; stopping\." \
>           "Following forward execution will be added to history\." \
>           "\[^\\\r\\\n\]*" \
>           "\[^\\\r\\\n\]*" \
> ...
> the test-case passes for me.
>
> With those fixes, LGTM.
>
> Approved-By: Tom de Vries <tdevries@suse.de>
Thanks for the review! Pushed with the changes.
  

Patch

diff --git a/gdb/testsuite/gdb.btrace/non-stop.exp b/gdb/testsuite/gdb.btrace/non-stop.exp
index 5e43545f6a9..edde7fc24b1 100644
--- a/gdb/testsuite/gdb.btrace/non-stop.exp
+++ b/gdb/testsuite/gdb.btrace/non-stop.exp
@@ -81,18 +81,20 @@  proc gdb_cont_to_bp_line { line threads nthreads } {
 
 proc gdb_cont_to_no_history_backward { threads cmd nthreads } {
     gdb_cont_to $threads $cmd \
-        [multi_line \
-             "Reached end of recorded.*Backward execution.*" \
-             "\[^\\\r\\\n\]*" \
-             "\[^\\\r\\\n\]*" \
-            ] \
-        $nthreads
+	[multi_line \
+	     "Reached end of recorded history; stopping\."
+	     "Backward execution from here not possible\." \
+	     "\[^\\\r\\\n\]*" \
+	     "\[^\\\r\\\n\]*" \
+	     ] \
+	$nthreads
 }
 
 proc gdb_cont_to_no_history_forward { threads cmd nthreads } {
     gdb_cont_to $threads $cmd \
 	[multi_line \
-	     "Reached end of recorded.*Following forward.*" \
+	     "Reached end of recorded history; stopping\."
+	     "Following forward execution will be added to history\." \
 	     "\[^\\\r\\\n\]*" \
 	     "\[^\\\r\\\n\]*" \
 	    ] \