This is the mail archive of the gdb-patches@sources.redhat.com 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]

Re: [RFA/testsuite/ada] Put testcase code in own directory


Joel,

nothing for or against this. However it's strategic decision - one for MichaelC - should for package like languages such as ada (and for that matter java) we have a directory per test? :-)

Andrew

Joel Brobecker wrote:
Hello,

This implements something I have been thinking about doing for
a little while. The idea is have the code for each testcase be
in its own subdirectory. For instance, this change moves the code
for null_record.exp to the null_record/ subdir.

The reason for this is to avoid name clashes. It is much more common
in Ada to split the code between several compilation units. The model
used in C where you usually have one .c file per testcase doesn't
apply well to Ada.

The framework I'm trying to implement is that we would have one
.exp file named <testcase>.exp, and have the sources located in
subdir <testcase>/.

2004-11-08 Joel Brobecker <brobecker@gnat.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.in: No longer generate gnat_ada.gpr.
        * gdb.ada/Makefile.in: Minor adaptation due to new project file.
        * gdb.ada/null_record.exp (testfile): executable is now in
        null_record subdirectory.
        (srcfile): Use full path to the main compilation unit.

Tested on x86-linux.

OK to apply?

Thanks,


------------------------------------------------------------------------


--  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;


------------------------------------------------------------------------


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 8 Nov 2004 20:47:47 -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.in
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/configure.in,v
retrieving revision 1.17
diff -u -p -r1.17 configure.in
--- configure.in 12 Oct 2004 14:41:42 -0000 1.17
+++ configure.in 8 Nov 2004 20:40:54 -0000
@@ -119,7 +119,7 @@ AC_EXEEXT
AC_CONFIG_SUBDIRS($configdirs)
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 8 Nov 2004 20:40:55 -0000
@@ -1,7 +1,7 @@
VPATH = @srcdir@
srcdir = @srcdir@
-EXECUTABLES = null_record
+EXECUTABLES = null_record/null_record
MISCELLANEOUS =
@@ -9,13 +9,15 @@ all info install-info dvi install uninst
@echo "Nothing to be done for $@..."
clean mostlyclean:
- -gnatclean -Pgnat_ada -q $(EXECUTABLES)
- -rm -f *~ *.o a.out xgdb *.x *.ci *.tmp
+ -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 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
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 8 Nov 2004 20:40:55 -0000
@@ -21,8 +21,8 @@ if $tracelevel then {
load_lib "ada.exp"
-set testfile "null_record"
-set srcfile ${testfile}.adb
+set testfile "null_record/null_record"
+set srcfile ${srcdir}/${subdir}/${testfile}.adb
set binfile ${objdir}/${subdir}/${testfile}
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
-rm -fr *.log summary detail *.plog *.sum *.psum site.*


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