This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix in-tree, parallel running of Ada tests


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=437277d47a15711f29e02e5265ce8bbb8c8ef4f5

commit 437277d47a15711f29e02e5265ce8bbb8c8ef4f5
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Feb 8 14:00:49 2016 -0500

    Fix in-tree, parallel running of Ada tests
    
    While testing the following patch,
    
      [PATCH] Always organize test artifacts in a directory hierarchy
      https://sourceware.org/ml/gdb-patches/2016-01/msg00133.html
    
    I noticed that it broke Ada testing.  This lead me to think that
    parallel testing when building in-tree didn't work previously in Ada.
    It is confirmed by this test:
    
    $ make check TESTS="gdb.ada/fun_addr.exp" -j 2
    ...
    Running ./gdb.ada/fun_addr.exp ...
    FAIL: gdb.ada/fun_addr.exp: compilation foo.adb
    ...
    
    This patch fixes in-tree parallel testing for Ada, and consequently
    serial and parallel testing when the aforementioned patch is applied.
    
    The problem originates from the fact that Ada support code cd's to the
    builddir before compiling.  In itself it's not a problem, it allows to
    place intermediate auto-generated files in that directory.  The Ada
    compilation refers to the source file, which is in another directory,
    only by its base name (e.g. foo.adb).  In serial mode, that worked
    because builddir was the same as the source directory (e.g.
    gdb.ada/fun_addr/).  In an out-of-tree build, it works because the
    source directory is added as an include directory (note: this is not the
    same $srcdir as autoconf's):
    
      set srcdir [file dirname $source]
      additional_flags=-I$srcdir
    
    which becomes:
    
      additional_flags=-I/home/emaisin/build/binutils-gdb/gdb/testsuite/gdb.ada/fun_addr
    
    However, when building in-tree, srcdir is relative: ./gdb.ada/fun_addr.
    When using parallel or always-in-outputs-directory mode, we are cd'ed in
    the outputs directory.  So -I$srcdir is relative to the current
    directory, which is wrong.
    
    To fix it, I made the TCL variable srcdir (set in site.exp, from which
    everything else is derived) always absolute.  It is done by assigning
    autoconf's abs_srcdir instead of autoconf's srcdir.  This way -I$srcdir
    will always be good, regardless of where we cd'ed to.  A small apparent
    change is that when running tests, DejaGnu will say:
    
      Running /tmp/binutils-gdb/gdb/testsuite/gdb.ada/fun_addr.exp ...
    
    instead of
    
      Running ./gdb.ada/fun_addr.exp ...
    
    I hope it's not too much of an annoyance.  I think that it should make
    the testsuite a tiny bit more robust against other bugs of the same
    class.
    
    Regtested in & out of tree, only with native target.
    
    gdb/testsuite/ChangeLog:
    
    	* Makefile.in (abs_srcdir): Assign @abs_srcdir@.
    	(site.exp): Assign abs_srcdir to tcl's srcdir.

Diff:
---
 gdb/testsuite/ChangeLog   | 5 +++++
 gdb/testsuite/Makefile.in | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 046f112..1cc07c8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-08  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* Makefile.in (abs_srcdir): Assign @abs_srcdir@.
+	(site.exp): Assign abs_srcdir to tcl's srcdir.
+
 2016-02-04  Yao Qi  <yao.qi@linaro.org>
 
 	* gdb.base/foll-exec-mode.c: Include limits.h.
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index f59acc3..6597196 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -21,6 +21,7 @@ srcdir = @srcdir@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
 
 target_alias = @target_noncanonical@
 program_transform_name = @program_transform_name@
@@ -125,7 +126,7 @@ $(abs_builddir)/site.exp site.exp: ./config.status Makefile
 	@echo "set target_alias $(target_alias)" >> ./tmp0
 	@echo "set target_triplet ${target_canonical}" >> ./tmp0
 	@echo "set build_triplet ${build_canonical}" >> ./tmp0
-	@echo "set srcdir ${srcdir}" >> ./tmp0
+	@echo "set srcdir ${abs_srcdir}" >> ./tmp0
 	@echo "set tool gdb" >> ./tmp0
 	@echo 'source $${srcdir}/lib/append_gdb_boards_dir.exp' >> ./tmp0
 	@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]