public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove extra output directory level for Ada tests
@ 2016-07-05 14:39 Simon Marchi
  2016-07-06 14:07 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Marchi @ 2016-07-05 14:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

The output of Ada tests create a layout where the test name
("formatted_ref" in this example) appears twice:

outputs
└── gdb.ada
    └── formatted_ref
        └── formatted_ref
            ├── b~formatted_ref.adb
            ├── b~formatted_ref.ads
            ├── b~formatted_ref.ali
            ├── b~formatted_ref.o
            ├── defs.ali
            ├── defs.o
            ├── formatted_ref
            ├── formatted_ref.ali
            └── formatted_ref.o

This causes a problem when testing with the native-gdbserver board, when
the binary has the same name as the test.  When gdb_remote_download is
called to upload the compiled binary, the implementation for
native-gdbserver copies it in the standard output directory (in
outputs/gdb.ada/formatted_ref).  However, there is already a directory
named formatted_ref in there, so the copy fails and gdbserver isn't able
to load the binary.

This patch bypasses the problem by removing the extra directory level.
The compiled binary will already be in its final location in the
standard output directory, so the copy will effectively be a no-op.

gdb/testsuite/ChangeLog:

	* lib/ada.exp: Remove extra directory level in build directory.
	* gdb.ada/cond_lang.exp: Likewise.
	* gdb.ada/exec_changed.exp: Likewise.
	* gdb.ada/lang_switch.exp: Likewise.
---
 gdb/testsuite/gdb.ada/cond_lang.exp    | 4 ++--
 gdb/testsuite/gdb.ada/exec_changed.exp | 7 +++----
 gdb/testsuite/gdb.ada/lang_switch.exp  | 4 ++--
 gdb/testsuite/lib/ada.exp              | 7 +++----
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/cond_lang.exp b/gdb/testsuite/gdb.ada/cond_lang.exp
index e08fada..997b37a 100644
--- a/gdb/testsuite/gdb.ada/cond_lang.exp
+++ b/gdb/testsuite/gdb.ada/cond_lang.exp
@@ -17,8 +17,8 @@ load_lib "ada.exp"
 
 standard_ada_testfile a
 
-set cfile "${testdir}/foo"
-set csrcfile ${srcdir}/${subdir}/${cfile}.c
+set cfile "foo"
+set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
 set cobject [standard_output_file ${cfile}.o]
 
 gdb_compile "${csrcfile}" "${cobject}" object [list debug]
diff --git a/gdb/testsuite/gdb.ada/exec_changed.exp b/gdb/testsuite/gdb.ada/exec_changed.exp
index 6cc6408..a574cd5 100644
--- a/gdb/testsuite/gdb.ada/exec_changed.exp
+++ b/gdb/testsuite/gdb.ada/exec_changed.exp
@@ -32,9 +32,8 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}$EXEEXT" executable {debug}] != ""}
 }
 
 # Build the second test program
-set testfile2 "${testdir}/second"
-set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb
-set binfile2 [standard_output_file ${testfile2}$EXEEXT]
+set srcfile2 ${srcdir}/${subdir}/${testdir}/second.adb
+set binfile2 [standard_output_file second$EXEEXT]
 
 if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
     return -1
@@ -42,7 +41,7 @@ if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
 
 # Start with a fresh gdb.
 
-set common_binfile [standard_output_file ${testdir}/common$EXEEXT]
+set common_binfile [standard_output_file common$EXEEXT]
 
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
diff --git a/gdb/testsuite/gdb.ada/lang_switch.exp b/gdb/testsuite/gdb.ada/lang_switch.exp
index 8045358..661829b 100644
--- a/gdb/testsuite/gdb.ada/lang_switch.exp
+++ b/gdb/testsuite/gdb.ada/lang_switch.exp
@@ -16,8 +16,8 @@
 load_lib "ada.exp"
 
 standard_ada_testfile lang_switch
-set cfile "${testdir}/foo"
-set csrcfile ${srcdir}/${subdir}/${cfile}.c
+set cfile "foo"
+set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
 set cobject [standard_output_file ${cfile}.o]
 
 gdb_compile "${csrcfile}" "${cobject}" object [list debug]
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 01f3008..a9d1758 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -73,9 +73,8 @@ proc standard_ada_testfile {base_file {dir ""}} {
     } else {
 	set testdir $dir
     }
-    set testfile $testdir/$base_file
-    set srcfile $srcdir/$subdir/$testfile.adb
-    set binfile [standard_output_file $testfile]
 
-    file mkdir [standard_output_file $testdir]
+    set testfile $base_file
+    set srcfile $srcdir/$subdir/$testdir/$testfile.adb
+    set binfile [standard_output_file $testfile]
 }
-- 
2.9.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove extra output directory level for Ada tests
  2016-07-05 14:39 [PATCH] Remove extra output directory level for Ada tests Simon Marchi
@ 2016-07-06 14:07 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2016-07-06 14:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

On 16-07-05 10:39 AM, Simon Marchi wrote:
> The output of Ada tests create a layout where the test name
> ("formatted_ref" in this example) appears twice:
> 
> outputs
> └── gdb.ada
>     └── formatted_ref
>         └── formatted_ref
>             ├── b~formatted_ref.adb
>             ├── b~formatted_ref.ads
>             ├── b~formatted_ref.ali
>             ├── b~formatted_ref.o
>             ├── defs.ali
>             ├── defs.o
>             ├── formatted_ref
>             ├── formatted_ref.ali
>             └── formatted_ref.o
> 
> This causes a problem when testing with the native-gdbserver board, when
> the binary has the same name as the test.  When gdb_remote_download is
> called to upload the compiled binary, the implementation for
> native-gdbserver copies it in the standard output directory (in
> outputs/gdb.ada/formatted_ref).  However, there is already a directory
> named formatted_ref in there, so the copy fails and gdbserver isn't able
> to load the binary.
> 
> This patch bypasses the problem by removing the extra directory level.
> The compiled binary will already be in its final location in the
> standard output directory, so the copy will effectively be a no-op.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* lib/ada.exp: Remove extra directory level in build directory.
> 	* gdb.ada/cond_lang.exp: Likewise.
> 	* gdb.ada/exec_changed.exp: Likewise.
> 	* gdb.ada/lang_switch.exp: Likewise.
> ---
>  gdb/testsuite/gdb.ada/cond_lang.exp    | 4 ++--
>  gdb/testsuite/gdb.ada/exec_changed.exp | 7 +++----
>  gdb/testsuite/gdb.ada/lang_switch.exp  | 4 ++--
>  gdb/testsuite/lib/ada.exp              | 7 +++----
>  4 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.ada/cond_lang.exp b/gdb/testsuite/gdb.ada/cond_lang.exp
> index e08fada..997b37a 100644
> --- a/gdb/testsuite/gdb.ada/cond_lang.exp
> +++ b/gdb/testsuite/gdb.ada/cond_lang.exp
> @@ -17,8 +17,8 @@ load_lib "ada.exp"
>  
>  standard_ada_testfile a
>  
> -set cfile "${testdir}/foo"
> -set csrcfile ${srcdir}/${subdir}/${cfile}.c
> +set cfile "foo"
> +set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
>  set cobject [standard_output_file ${cfile}.o]
>  
>  gdb_compile "${csrcfile}" "${cobject}" object [list debug]
> diff --git a/gdb/testsuite/gdb.ada/exec_changed.exp b/gdb/testsuite/gdb.ada/exec_changed.exp
> index 6cc6408..a574cd5 100644
> --- a/gdb/testsuite/gdb.ada/exec_changed.exp
> +++ b/gdb/testsuite/gdb.ada/exec_changed.exp
> @@ -32,9 +32,8 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}$EXEEXT" executable {debug}] != ""}
>  }
>  
>  # Build the second test program
> -set testfile2 "${testdir}/second"
> -set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb
> -set binfile2 [standard_output_file ${testfile2}$EXEEXT]
> +set srcfile2 ${srcdir}/${subdir}/${testdir}/second.adb
> +set binfile2 [standard_output_file second$EXEEXT]
>  
>  if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
>      return -1
> @@ -42,7 +41,7 @@ if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
>  
>  # Start with a fresh gdb.
>  
> -set common_binfile [standard_output_file ${testdir}/common$EXEEXT]
> +set common_binfile [standard_output_file common$EXEEXT]
>  
>  gdb_start
>  gdb_reinitialize_dir $srcdir/$subdir
> diff --git a/gdb/testsuite/gdb.ada/lang_switch.exp b/gdb/testsuite/gdb.ada/lang_switch.exp
> index 8045358..661829b 100644
> --- a/gdb/testsuite/gdb.ada/lang_switch.exp
> +++ b/gdb/testsuite/gdb.ada/lang_switch.exp
> @@ -16,8 +16,8 @@
>  load_lib "ada.exp"
>  
>  standard_ada_testfile lang_switch
> -set cfile "${testdir}/foo"
> -set csrcfile ${srcdir}/${subdir}/${cfile}.c
> +set cfile "foo"
> +set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
>  set cobject [standard_output_file ${cfile}.o]
>  
>  gdb_compile "${csrcfile}" "${cobject}" object [list debug]
> diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
> index 01f3008..a9d1758 100644
> --- a/gdb/testsuite/lib/ada.exp
> +++ b/gdb/testsuite/lib/ada.exp
> @@ -73,9 +73,8 @@ proc standard_ada_testfile {base_file {dir ""}} {
>      } else {
>  	set testdir $dir
>      }
> -    set testfile $testdir/$base_file
> -    set srcfile $srcdir/$subdir/$testfile.adb
> -    set binfile [standard_output_file $testfile]
>  
> -    file mkdir [standard_output_file $testdir]
> +    set testfile $base_file
> +    set srcfile $srcdir/$subdir/$testdir/$testfile.adb
> +    set binfile [standard_output_file $testfile]
>  }
> 

Pushed (approved by Joel in [1]).

[1] https://sourceware.org/ml/gdb-patches/2016-07/msg00098.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-06 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-05 14:39 [PATCH] Remove extra output directory level for Ada tests Simon Marchi
2016-07-06 14:07 ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).