Patchwork Have testsuite find gdbserver in new location

login
register
mail settings
Submitter Tom Tromey
Date Feb. 12, 2020, 12:57 a.m.
Message ID <20200212005703.14566-1-tom@tromey.com>
Download mbox | patch
Permalink /patch/37984/
State New
Headers show

Comments

Tom Tromey - Feb. 12, 2020, 12:57 a.m.
This updates the gdb testsuite to look for gdbserver in its new
location.  The old location is also checked for, on the theory that
perhaps someone sets GDB to a full path for install testing.

gdb/testsuite/ChangeLog
2020-02-11  Tom Tromey  <tom@tromey.com>

	* lib/gdbserver-support.exp (find_gdbserver): Find gdbserver in
	build directory.
	* boards/gdbserver-base.exp: Update path to gdbserver.

Change-Id: If03db762ba53882ddfaf2d2d516de14c3fa03938
---
 gdb/testsuite/ChangeLog                 |  6 ++++++
 gdb/testsuite/boards/gdbserver-base.exp |  2 +-
 gdb/testsuite/lib/gdbserver-support.exp | 14 ++++++++------
 3 files changed, 15 insertions(+), 7 deletions(-)
Luis Machado - Feb. 14, 2020, 10:26 a.m.
On 2/11/20 9:57 PM, Tom Tromey wrote:
> This updates the gdb testsuite to look for gdbserver in its new
> location.  The old location is also checked for, on the theory that
> perhaps someone sets GDB to a full path for install testing.

Will gdbserver live in the old location if we "install" it?

> 
> gdb/testsuite/ChangeLog
> 2020-02-11  Tom Tromey  <tom@tromey.com>
> 
> 	* lib/gdbserver-support.exp (find_gdbserver): Find gdbserver in
> 	build directory.
> 	* boards/gdbserver-base.exp: Update path to gdbserver.
> 
> Change-Id: If03db762ba53882ddfaf2d2d516de14c3fa03938
> ---
>   gdb/testsuite/ChangeLog                 |  6 ++++++
>   gdb/testsuite/boards/gdbserver-base.exp |  2 +-
>   gdb/testsuite/lib/gdbserver-support.exp | 14 ++++++++------
>   3 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/gdb/testsuite/boards/gdbserver-base.exp b/gdb/testsuite/boards/gdbserver-base.exp
> index 4db834dd842..f27a2fdf915 100644
> --- a/gdb/testsuite/boards/gdbserver-base.exp
> +++ b/gdb/testsuite/boards/gdbserver-base.exp
> @@ -22,7 +22,7 @@ process_multilib_options ""
>   set_board_info compiler "[find_gcc]"
>   
>   # Test the copy of gdbserver in the build directory.
> -set_board_info gdb_server_prog "[pwd]/../gdbserver/gdbserver"
> +set_board_info gdb_server_prog "[pwd]/../../gdbserver/gdbserver"
>   
>   # gdbserver does not intercept target file operations and perform them
>   # on the host.
> diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
> index 12796e8a41e..706bbeb9df4 100644
> --- a/gdb/testsuite/lib/gdbserver-support.exp
> +++ b/gdb/testsuite/lib/gdbserver-support.exp
> @@ -138,13 +138,15 @@ proc find_gdbserver { } {
>       return [target_info gdb_server_prog]
>     }
>   
> -  set gdbserver "${GDB}server"
> -  if { [file isdirectory $gdbserver] } {
> -    append gdbserver "/gdbserver"
> -  }
> +  set toplevel [file join [file dirname $GDB] .. gdbserver]
> +  foreach gdbserver [list "${GDB}server" $toplevel] {
> +      if { [file isdirectory $gdbserver] } {
> +	  append gdbserver "/gdbserver"
> +      }
>   
> -  if { [file executable $gdbserver] } {
> -    return $gdbserver
> +      if { [file executable $gdbserver] } {
> +	  return $gdbserver
> +      }
>     }
>   
>     return ""
>
Tom Tromey - Feb. 14, 2020, 6:40 p.m.
>>>>> "Luis" == Luis Machado <luis.machado@linaro.org> writes:

Luis> On 2/11/20 9:57 PM, Tom Tromey wrote:
>> This updates the gdb testsuite to look for gdbserver in its new
>> location.  The old location is also checked for, on the theory that
>> perhaps someone sets GDB to a full path for install testing.

Luis> Will gdbserver live in the old location if we "install" it?

Yeah.  My thinking was that you might want to do something like

    runtest GDB=/mumble/prefix/bin/gdb

... and then since the patch does this:

>> +  set toplevel [file join [file dirname $GDB] .. gdbserver]
>> +  foreach gdbserver [list "${GDB}server" $toplevel] {

... the test suite would still find /mumble/prefix/bin/gdbserver

Tom

Patch

diff --git a/gdb/testsuite/boards/gdbserver-base.exp b/gdb/testsuite/boards/gdbserver-base.exp
index 4db834dd842..f27a2fdf915 100644
--- a/gdb/testsuite/boards/gdbserver-base.exp
+++ b/gdb/testsuite/boards/gdbserver-base.exp
@@ -22,7 +22,7 @@  process_multilib_options ""
 set_board_info compiler "[find_gcc]"
 
 # Test the copy of gdbserver in the build directory.
-set_board_info gdb_server_prog "[pwd]/../gdbserver/gdbserver"
+set_board_info gdb_server_prog "[pwd]/../../gdbserver/gdbserver"
 
 # gdbserver does not intercept target file operations and perform them
 # on the host.
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 12796e8a41e..706bbeb9df4 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -138,13 +138,15 @@  proc find_gdbserver { } {
     return [target_info gdb_server_prog]
   }
 
-  set gdbserver "${GDB}server"
-  if { [file isdirectory $gdbserver] } {
-    append gdbserver "/gdbserver"
-  }
+  set toplevel [file join [file dirname $GDB] .. gdbserver]
+  foreach gdbserver [list "${GDB}server" $toplevel] {
+      if { [file isdirectory $gdbserver] } {
+	  append gdbserver "/gdbserver"
+      }
 
-  if { [file executable $gdbserver] } {
-    return $gdbserver
+      if { [file executable $gdbserver] } {
+	  return $gdbserver
+      }
   }
 
   return ""