[gdb/testsuite] Fix gdb.ada/big_packed_array.exp on s390x-linux

Message ID 20250123120939.714-1-tdevries@suse.de
State Committed
Headers
Series [gdb/testsuite] Fix gdb.ada/big_packed_array.exp on s390x-linux |

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-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries Jan. 23, 2025, 12:09 p.m. UTC
  When running test-case gdb.ada/big_packed_array.exp on s390x-linux, I run
into:
...
(gdb) print bad^M
$2 = (0 => 0 <repeats 24 times>, 1)^M
(gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad
...

This is with gcc 7.5.0, and this xfail should trigger:
...
           if { $have_xfail && [string is integer $last] \
                   && [expr ($last & 0xf) == 0] } {
                # gcc/101643
                setup_xfail *-*-*
            }
...
but it doesn't because $last is '1'.

Fix this by using 0xf0 as mask for big endian.

Tested on s390x-linux.
---
 gdb/testsuite/gdb.ada/big_packed_array.exp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)


base-commit: 0c1b7977c93facc6e198da457e17559c0ba7b10b
  

Comments

Tom de Vries Feb. 4, 2025, 1:07 p.m. UTC | #1
On 1/23/25 13:09, Tom de Vries wrote:
> When running test-case gdb.ada/big_packed_array.exp on s390x-linux, I run
> into:
> ...
> (gdb) print bad^M
> $2 = (0 => 0 <repeats 24 times>, 1)^M
> (gdb) FAIL: gdb.ada/big_packed_array.exp: scenario=minimal: print bad
> ...
> 
> This is with gcc 7.5.0, and this xfail should trigger:
> ...
>             if { $have_xfail && [string is integer $last] \
>                     && [expr ($last & 0xf) == 0] } {
>                  # gcc/101643
>                  setup_xfail *-*-*
>              }
> ...
> but it doesn't because $last is '1'.
> 
> Fix this by using 0xf0 as mask for big endian.
> 

I've pushed this.

Thanks,
- Tom

> Tested on s390x-linux.
> ---
>   gdb/testsuite/gdb.ada/big_packed_array.exp | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp
> index 33b1dfd7634..6f030f368d8 100644
> --- a/gdb/testsuite/gdb.ada/big_packed_array.exp
> +++ b/gdb/testsuite/gdb.ada/big_packed_array.exp
> @@ -21,6 +21,8 @@ standard_ada_testfile foo_ra24_010
>   
>   set old_gcc [gnat_version_compare < 9]
>   
> +set endian [target_endianness]
> +
>   foreach_gnat_encoding scenario flags {all minimal} {
>       lappend flags debug
>   
> @@ -54,8 +56,13 @@ foreach_gnat_encoding scenario flags {all minimal} {
>          }
>          -re -wrap $re_xfail2 {
>   	   set last $expect_out(1,string)
> +	   if { $endian == "little" } {
> +	       set mask 0x0f
> +	   } else {
> +	       set mask 0xf0
> +	   }
>              if { $have_xfail && [string is integer $last] \
> -		    && [expr ($last & 0xf) == 0] } {
> +		    && [expr ($last & $mask) == 0] } {
>                  # gcc/101643
>                  setup_xfail *-*-*
>              }
> 
> base-commit: 0c1b7977c93facc6e198da457e17559c0ba7b10b
  

Patch

diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp
index 33b1dfd7634..6f030f368d8 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/big_packed_array.exp
@@ -21,6 +21,8 @@  standard_ada_testfile foo_ra24_010
 
 set old_gcc [gnat_version_compare < 9]
 
+set endian [target_endianness]
+
 foreach_gnat_encoding scenario flags {all minimal} {
     lappend flags debug
 
@@ -54,8 +56,13 @@  foreach_gnat_encoding scenario flags {all minimal} {
        }
        -re -wrap $re_xfail2 {
 	   set last $expect_out(1,string)
+	   if { $endian == "little" } {
+	       set mask 0x0f
+	   } else {
+	       set mask 0xf0
+	   }
            if { $have_xfail && [string is integer $last] \
-		    && [expr ($last & 0xf) == 0] } {
+		    && [expr ($last & $mask) == 0] } {
                # gcc/101643
                setup_xfail *-*-*
            }