Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/testsuite/ada] Put testcase code in own directory (2)
@ 2005-02-02 14:03 Joel Brobecker
  2005-02-02 14:55 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Brobecker @ 2005-02-02 14:03 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1774 bytes --]

Hello,

Here is a updated patch that moves the code used by each Ada testcase
into its own subdirectory. See this message for the motivation:
http://sources.redhat.com/ml/gdb-patches/2004-11/msg00138.html

Note that I introduced a new variable "testdir", which will contain
the name of the subdir where the sources used by this testcase are
stored. I found it useful when I modified fixed_points.exp to the new
scheme, as the testcase searches the line number for one of the source
files.

Also, "srcfile" doesn't really apply all that much to ada, since we have
more than one src file. I kept this variable for now for better
consistency with the non-ada testcases, with the meaning being the name
of the main unit in our program.

2005-02-02  Joel Brobecker  <brobecker@adacore.com>

        * gdb.ada/gnat_ada.gpr: New file.
        * gdb.ada/gnat_ada.gin: Delete, no longer used.
        * lib/ada.exp (gdb_compile_ada): Minor adaptation to new project file.
        * configure.ac: No longer generate gnat_ada.gpr.
        * gdb.ada/Makefile.in: Minor adaptations due to new project file.
        * gdb.ada/null_record/null_record.adb: Moved here from gdb.ada.
        * gdb.ada/null_record/bar.ads: Likewise.
        * gdb.ada/null_record/bar.adb: Likewise.
        * gdb.ada/fixed_points/fixed_points.adb: Likewise.
        * gdb.ada/null_record.exp (testdir): New variable.
        (testfile): executable is now in testdir subdirectory.
        (srcfile): Use full path to the main compilation unit.
        * gdb.ada/fixed_points.exp: Same changes as above.

Tested on x86-linux, no regression for these testcases. OK to apply?
(note that I didn't attach the .ads and .adb files, since they remain
identical to the current ones, I just move them)

Thanks,
-- 
Joel

[-- Attachment #2: gnat_ada.gpr --]
[-- Type: text/plain, Size: 1047 bytes --]

--  Copyright 2004 Free Software Foundation, Inc.
--
--  This program is free software; you can redistribute it and/or modify
--  it under the terms of the GNU General Public License as published by
--  the Free Software Foundation; either version 2 of the License, or
--  (at your option) any later version.
--
--  This program is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU General Public License for more details.
--
--  You should have received a copy of the GNU General Public License
--  along with this program; if not, write to the Free Software
--  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

--  This project file allows us to control the location where the
--  compilation artifacts produced when building the Ada examples
--  are stored.

project Gnat_Ada is

   for Source_Dirs use (external ("SRC"));
   for Object_Dir use external ("OBJ");

end Gnat_Ada;

[-- Attachment #3: gdb.ada.1.diff --]
[-- Type: text/plain, Size: 4668 bytes --]

Index: lib/ada.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/ada.exp,v
retrieving revision 1.3
diff -u -p -r1.3 ada.exp
--- lib/ada.exp	1 Apr 2004 18:42:08 -0000	1.3
+++ lib/ada.exp	2 Feb 2005 13:44:41 -0000
@@ -409,12 +409,16 @@ if {[info procs find_gnatmake] == ""} {
 
 proc gdb_compile_ada {source dest type options} {
 
+    set srcdir [file dirname $source]
+    set gprdir [file dirname $srcdir]
     set objdir [file dirname $dest]
 
     append options " ada"
-    append options " additional_flags=-P$objdir/gnat_ada"
+    append options " additional_flags=-P$gprdir/gnat_ada"
+    append options " additional_flags=-XSRC=[file tail $srcdir]"
+    append options " additional_flags=-XOBJ=$objdir"
 
-    set result [target_compile $source $dest $type $options]
+    set result [target_compile [file tail $source] $dest $type $options]
 
     # The Ada build always produces some output, even when the build
     # succeeds. Thus, we can not use the output the same way we do in
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/configure.ac,v
retrieving revision 1.1
diff -u -p -r1.1 configure.ac
--- configure.ac	7 Jan 2005 21:53:23 -0000	1.1
+++ configure.ac	2 Feb 2005 13:42:41 -0000
@@ -109,7 +109,7 @@ AC_CHECK_HEADERS(pthread.h)
 AC_EXEEXT
 
 AC_OUTPUT([Makefile \
-  gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
+  gdb.ada/Makefile \
   gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
   gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
   gdb.fortran/Makefile gdb.java/Makefile gdb.mi/Makefile \
Index: gdb.ada/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.ada/Makefile.in,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.in
--- gdb.ada/Makefile.in	1 Apr 2004 00:53:50 -0000	1.1
+++ gdb.ada/Makefile.in	2 Feb 2005 13:44:41 -0000
@@ -1,7 +1,7 @@
 VPATH = @srcdir@
 srcdir = @srcdir@
 
-EXECUTABLES = null_record
+EXECUTABLES = null_record/null_record fixed_points/fixed_points
 
 MISCELLANEOUS =
 
@@ -9,13 +9,16 @@ all info install-info dvi install uninst
 	@echo "Nothing to be done for $@..."
 
 clean mostlyclean:
-	-gnatclean -Pgnat_ada -q $(EXECUTABLES)
+	-find . -name '*.o' -print | xargs rm -f
+	-find . -name '*.ali' -print | xargs rm -f
+	-find . -name 'b~*.ad[sb]' -print | xargs rm -f
+	-rm -f *~ a.out xgdb *.x *.ci *.tmp
 	-rm -f *~ *.o a.out xgdb *.x *.ci *.tmp
 	-rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES)
 	-rm -f $(MISCELLANEOUS) twice-tmp.c
 
 distclean maintainer-clean realclean: clean
 	-rm -f *~ core
-	-rm -f Makefile config.status config.log gnat_ada.gpr
+	-rm -f Makefile config.status config.log
 	-rm -f *-init.exp
 	-rm -fr *.log summary detail *.plog *.sum *.psum site.*
Index: gdb.ada/null_record.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.ada/null_record.exp,v
retrieving revision 1.4
diff -u -p -r1.4 null_record.exp
--- gdb.ada/null_record.exp	21 Oct 2004 03:55:07 -0000	1.4
+++ gdb.ada/null_record.exp	2 Feb 2005 13:44:41 -0000
@@ -21,8 +21,9 @@ if $tracelevel then {
 
 load_lib "ada.exp"
 
-set testfile "null_record"
-set srcfile ${testfile}.adb
+set testdir "null_record"
+set testfile "${testdir}/null_record"
+set srcfile ${srcdir}/${subdir}/${testfile}.adb
 set binfile ${objdir}/${subdir}/${testfile}
 
 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
Index: gdb.ada/fixed_points.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.ada/fixed_points.exp,v
retrieving revision 1.1
diff -u -p -r1.1 fixed_points.exp
--- gdb.ada/fixed_points.exp	13 Dec 2004 16:04:20 -0000	1.1
+++ gdb.ada/fixed_points.exp	2 Feb 2005 13:44:41 -0000
@@ -21,8 +21,9 @@ if $tracelevel then {
 
 load_lib "ada.exp"
 
-set testfile "fixed_points"
-set srcfile ${testfile}.adb
+set testdir "fixed_points"
+set testfile "${testdir}/fixed_points"
+set srcfile ${srcdir}/${subdir}/${testfile}.adb
 set binfile ${objdir}/${subdir}/${testfile}
 
 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
@@ -34,8 +35,8 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-set bp_location [gdb_get_line_number "Set breakpoint here"]
-runto "${srcfile}:$bp_location"
+set bp_location [gdb_get_line_number "Set breakpoint here" ${testdir}/fixed_points.adb]
+runto "fixed_points.adb:$bp_location"
 
 gdb_test "print base_object" \
          ".* = -50" \

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

* Re: [RFA/testsuite/ada] Put testcase code in own directory (2)
  2005-02-02 14:03 [RFA/testsuite/ada] Put testcase code in own directory (2) Joel Brobecker
@ 2005-02-02 14:55 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2005-02-02 14:55 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Joel Brobecker wrote:
> Hello,
> 
> Here is a updated patch that moves the code used by each Ada testcase
> into its own subdirectory. See this message for the motivation:
> http://sources.redhat.com/ml/gdb-patches/2004-11/msg00138.html
> 
> Note that I introduced a new variable "testdir", which will contain
> the name of the subdir where the sources used by this testcase are
> stored. I found it useful when I modified fixed_points.exp to the new
> scheme, as the testcase searches the line number for one of the source
> files.
> 
> Also, "srcfile" doesn't really apply all that much to ada, since we have
> more than one src file. I kept this variable for now for better
> consistency with the non-ada testcases, with the meaning being the name
> of the main unit in our program.
> 
> 2005-02-02  Joel Brobecker  <brobecker@adacore.com>
> 
>         * gdb.ada/gnat_ada.gpr: New file.
>         * gdb.ada/gnat_ada.gin: Delete, no longer used.
>         * lib/ada.exp (gdb_compile_ada): Minor adaptation to new project file.
>         * configure.ac: No longer generate gnat_ada.gpr.
>         * gdb.ada/Makefile.in: Minor adaptations due to new project file.
>         * gdb.ada/null_record/null_record.adb: Moved here from gdb.ada.
>         * gdb.ada/null_record/bar.ads: Likewise.
>         * gdb.ada/null_record/bar.adb: Likewise.
>         * gdb.ada/fixed_points/fixed_points.adb: Likewise.
>         * gdb.ada/null_record.exp (testdir): New variable.
>         (testfile): executable is now in testdir subdirectory.
>         (srcfile): Use full path to the main compilation unit.
>         * gdb.ada/fixed_points.exp: Same changes as above.
mkay


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

end of thread, other threads:[~2005-02-02 14:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-02 14:03 [RFA/testsuite/ada] Put testcase code in own directory (2) Joel Brobecker
2005-02-02 14:55 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox