Fix GNAT version check in gdb.ada

Message ID 20241211165632.1366881-1-tromey@adacore.com
State New
Headers
Series Fix GNAT version check in gdb.ada |

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 Tromey Dec. 11, 2024, 4:56 p.m. UTC
  Commit 1411185a ("Introduce and use gnat_version_compare") changed the
Ada tests to use a new proc for version checking.  Unfortunately this
patch inadvertently reversed the sense of the test in
packed_array_assign.exp.

After fixing this, I went through that patch again and looked for
other problems.  I found one spot where the wrong syntax was used, and
some others where I believe the sense of the test was inverted.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32444
---
 gdb/testsuite/gdb.ada/null_array.exp                  | 2 +-
 gdb/testsuite/gdb.ada/packed_array_assign.exp         | 2 +-
 gdb/testsuite/gdb.ada/packed_record.exp               | 2 +-
 gdb/testsuite/gdb.ada/variant_record_packed_array.exp | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

Andrew Burgess Dec. 12, 2024, 10:29 a.m. UTC | #1
Tom Tromey <tromey@adacore.com> writes:

> Commit 1411185a ("Introduce and use gnat_version_compare") changed the
> Ada tests to use a new proc for version checking.  Unfortunately this
> patch inadvertently reversed the sense of the test in
> packed_array_assign.exp.
>
> After fixing this, I went through that patch again and looked for
> other problems.  I found one spot where the wrong syntax was used, and
> some others where I believe the sense of the test was inverted.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32444

Cross checked these changes against commit 1411185a, and these look
good.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew



> ---
>  gdb/testsuite/gdb.ada/null_array.exp                  | 2 +-
>  gdb/testsuite/gdb.ada/packed_array_assign.exp         | 2 +-
>  gdb/testsuite/gdb.ada/packed_record.exp               | 2 +-
>  gdb/testsuite/gdb.ada/variant_record_packed_array.exp | 4 ++--
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.ada/null_array.exp b/gdb/testsuite/gdb.ada/null_array.exp
> index 7fa7c19fcb9..b4e218f0f0f 100644
> --- a/gdb/testsuite/gdb.ada/null_array.exp
> +++ b/gdb/testsuite/gdb.ada/null_array.exp
> @@ -28,7 +28,7 @@ clean_restart ${testfile}
>  set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
>  runto "foo.adb:$bp_location"
>  
> -if {[gnat_version_compare <= 4.4]} {
> +if {[gnat_version_compare <= {4 4}]} {
>      # Ada array bounds are missing in older GCCs.
>      setup_xfail *-*-* 
>  }
> diff --git a/gdb/testsuite/gdb.ada/packed_array_assign.exp b/gdb/testsuite/gdb.ada/packed_array_assign.exp
> index 47e48f96dcd..0b7d106f57e 100644
> --- a/gdb/testsuite/gdb.ada/packed_array_assign.exp
> +++ b/gdb/testsuite/gdb.ada/packed_array_assign.exp
> @@ -54,7 +54,7 @@ set re \
>  	 "packed_array_assign_y => 1\\)\\)"]
>  
>  # GNAT >= 12.0 has the needed fix here.
> -set zeros_expected [gnat_version_compare >= 12]
> +set zeros_expected [gnat_version_compare < 12]
>  set all_zeros \
>      [string_to_regexp "((packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0))"]
>  
> diff --git a/gdb/testsuite/gdb.ada/packed_record.exp b/gdb/testsuite/gdb.ada/packed_record.exp
> index f3479530841..043c94093de 100644
> --- a/gdb/testsuite/gdb.ada/packed_record.exp
> +++ b/gdb/testsuite/gdb.ada/packed_record.exp
> @@ -38,7 +38,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
>  	}
>  	-re " = .*more than max-value-size.*\[\r\n\]+$gdb_prompt $" {
>  	    # GNAT >= 12.0 has the needed fix here.
> -	    if {$scenario == "minimal" && [gnat_version_compare >= 12]} {
> +	    if {$scenario == "minimal" && [gnat_version_compare < 12]} {
>  		setup_kfail "minimal encodings" *-*-*
>  	    }
>  	    fail $test
> diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
> index 22b67ccf2e0..f193459b335 100644
> --- a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
> +++ b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
> @@ -41,7 +41,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
>  	}
>  	-re " = \\(size => 8, length => 8, buffer => warning: could not find bounds information on packed array.*$gdb_prompt $" {
>  	    # GNAT >= 11.0 has the needed fix here.
> -	    if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
> +	    if {$scenario == "minimal" && [gnat_version_compare < 11]} {
>  		setup_kfail "minimal encodings" *-*-*
>  	    }
>  	    fail $test
> @@ -62,7 +62,7 @@ foreach_gnat_encoding scenario flags {all minimal} {
>  	}
>  	-re " = \\(size => 8, length => 8, buffer => warning: could not find bounds information on packed array.*$gdb_prompt $" {
>  	    # GNAT >= 11.0 has the needed fix here.
> -	    if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
> +	    if {$scenario == "minimal" && [gnat_version_compare < 11]} {
>  		setup_kfail "minimal encodings" *-*-*
>  	    }
>  	    fail $test
> -- 
> 2.47.0
  

Patch

diff --git a/gdb/testsuite/gdb.ada/null_array.exp b/gdb/testsuite/gdb.ada/null_array.exp
index 7fa7c19fcb9..b4e218f0f0f 100644
--- a/gdb/testsuite/gdb.ada/null_array.exp
+++ b/gdb/testsuite/gdb.ada/null_array.exp
@@ -28,7 +28,7 @@  clean_restart ${testfile}
 set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
 runto "foo.adb:$bp_location"
 
-if {[gnat_version_compare <= 4.4]} {
+if {[gnat_version_compare <= {4 4}]} {
     # Ada array bounds are missing in older GCCs.
     setup_xfail *-*-* 
 }
diff --git a/gdb/testsuite/gdb.ada/packed_array_assign.exp b/gdb/testsuite/gdb.ada/packed_array_assign.exp
index 47e48f96dcd..0b7d106f57e 100644
--- a/gdb/testsuite/gdb.ada/packed_array_assign.exp
+++ b/gdb/testsuite/gdb.ada/packed_array_assign.exp
@@ -54,7 +54,7 @@  set re \
 	 "packed_array_assign_y => 1\\)\\)"]
 
 # GNAT >= 12.0 has the needed fix here.
-set zeros_expected [gnat_version_compare >= 12]
+set zeros_expected [gnat_version_compare < 12]
 set all_zeros \
     [string_to_regexp "((packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0), (packed_array_assign_w => 0, packed_array_assign_x => 0, packed_array_assign_y => 0))"]
 
diff --git a/gdb/testsuite/gdb.ada/packed_record.exp b/gdb/testsuite/gdb.ada/packed_record.exp
index f3479530841..043c94093de 100644
--- a/gdb/testsuite/gdb.ada/packed_record.exp
+++ b/gdb/testsuite/gdb.ada/packed_record.exp
@@ -38,7 +38,7 @@  foreach_gnat_encoding scenario flags {all minimal} {
 	}
 	-re " = .*more than max-value-size.*\[\r\n\]+$gdb_prompt $" {
 	    # GNAT >= 12.0 has the needed fix here.
-	    if {$scenario == "minimal" && [gnat_version_compare >= 12]} {
+	    if {$scenario == "minimal" && [gnat_version_compare < 12]} {
 		setup_kfail "minimal encodings" *-*-*
 	    }
 	    fail $test
diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
index 22b67ccf2e0..f193459b335 100644
--- a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
@@ -41,7 +41,7 @@  foreach_gnat_encoding scenario flags {all minimal} {
 	}
 	-re " = \\(size => 8, length => 8, buffer => warning: could not find bounds information on packed array.*$gdb_prompt $" {
 	    # GNAT >= 11.0 has the needed fix here.
-	    if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
+	    if {$scenario == "minimal" && [gnat_version_compare < 11]} {
 		setup_kfail "minimal encodings" *-*-*
 	    }
 	    fail $test
@@ -62,7 +62,7 @@  foreach_gnat_encoding scenario flags {all minimal} {
 	}
 	-re " = \\(size => 8, length => 8, buffer => warning: could not find bounds information on packed array.*$gdb_prompt $" {
 	    # GNAT >= 11.0 has the needed fix here.
-	    if {$scenario == "minimal" && [gnat_version_compare >= 11]} {
+	    if {$scenario == "minimal" && [gnat_version_compare < 11]} {
 		setup_kfail "minimal encodings" *-*-*
 	    }
 	    fail $test