[3/4] gdb/testsuite: require amd-dbgapi support to run rocm tests

Message ID 20230207132802.223510-4-lancelot.six@amd.com
State New
Headers
Series Fix gdb.rocm/simple.exp on hosts without ROCm |

Commit Message

Lancelot SIX Feb. 7, 2023, 1:28 p.m. UTC
  Update allow_hipcc_tests to check that GDB has the amd-dbgapi support
built-in.  Without this support, all tests using hipcc and the rocm
stack will fail.
---
 gdb/testsuite/lib/rocm.exp | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Simon Marchi Feb. 7, 2023, 1:59 p.m. UTC | #1
On 2/7/23 08:28, Lancelot SIX via Gdb-patches wrote:
> Update allow_hipcc_tests to check that GDB has the amd-dbgapi support
> built-in.  Without this support, all tests using hipcc and the rocm
> stack will fail.
> ---
>  gdb/testsuite/lib/rocm.exp | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/gdb/testsuite/lib/rocm.exp b/gdb/testsuite/lib/rocm.exp
> index 1440ac85d32..b5b59748c27 100644
> --- a/gdb/testsuite/lib/rocm.exp
> +++ b/gdb/testsuite/lib/rocm.exp
> @@ -22,6 +22,13 @@ proc allow_hipcc_tests { } {
>      if {[target_info gdb_protocol] != ""} {
>  	return 0
>      }
> +
> +    # Ensure that GDB is built with amd-dbgapi support.
> +    set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS --configuration"]
> +    if { [expr {[string first "--with-amd-dbgapi" $output] == -1}] } {

The expr is unnecessary.  Otherwise, LGTM.

Simon
  

Patch

diff --git a/gdb/testsuite/lib/rocm.exp b/gdb/testsuite/lib/rocm.exp
index 1440ac85d32..b5b59748c27 100644
--- a/gdb/testsuite/lib/rocm.exp
+++ b/gdb/testsuite/lib/rocm.exp
@@ -22,6 +22,13 @@  proc allow_hipcc_tests { } {
     if {[target_info gdb_protocol] != ""} {
 	return 0
     }
+
+    # Ensure that GDB is built with amd-dbgapi support.
+    set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS --configuration"]
+    if { [expr {[string first "--with-amd-dbgapi" $output] == -1}] } {
+	return 0
+    }
+
     return 1
 }