* [RFA/testsuite/ada] Put testcase code in own directory
@ 2004-11-08 21:16 Joel Brobecker
2004-11-11 16:43 ` Andrew Cagney
2005-01-20 17:18 ` Andrew Cagney
0 siblings, 2 replies; 5+ messages in thread
From: Joel Brobecker @ 2004-11-08 21:16 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]
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,
--
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.diff --]
[-- Type: text/plain, Size: 3548 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 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.*
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA/testsuite/ada] Put testcase code in own directory
2004-11-08 21:16 [RFA/testsuite/ada] Put testcase code in own directory Joel Brobecker
@ 2004-11-11 16:43 ` Andrew Cagney
2004-12-01 3:20 ` Joel Brobecker
2005-01-20 17:18 ` Andrew Cagney
1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-11-11 16:43 UTC (permalink / raw)
To: Joel Brobecker, Michael Elizabeth Chastain; +Cc: gdb-patches
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.*
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA/testsuite/ada] Put testcase code in own directory
2004-11-11 16:43 ` Andrew Cagney
@ 2004-12-01 3:20 ` Joel Brobecker
2004-12-01 4:54 ` Daniel Jacobowitz
0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2004-12-01 3:20 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: Andrew Cagney, gdb-patches
Michael,
> 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? :-)
In reviewing this patch, I see that there are some pieces that I forgot
to include. So the patch can not be accepted as is.
However, would you mind telling us what you think about the principle?
If you want my opinion, I am strongly attached to the idea of having
one subdirectory per testcase. The current approach used for C where
you can pretty much always have all the code for one testcase stored
in one .c file simply does not work for Ada. With GNAT, you need the
filename to match the name of the unit, and you need to have one and
only one unit per file[1]. Most testcases will involve at least 3 files,
one containing the main procedure (that one compilation unit), plus
a .ads file containing the spec of a package, plus a .adb file
containing the body of a package. Some testcases will use many
more files than this (we have one testcase internally that creates
something like 200 packages).
For maintenance reasons, I really feel that one subdirectory per
testcase is the way to go.
I hope you'll agree with me, in which case I'll work on producing
a new iteration of this patch, complete this time.
> >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.
Thanks,
--
Joel
[1]: This rule can actually be worked around with GNAT, by using
gnatchop. What you do then is storing all the code in one file,
and then let gnatchop parse it and cut it into files that follow
the GNAT convention. I don't like this approach, though. One of
the problems is that it is suboptimal in terms of efficiency, since
you end up parsing the entire code to split it every time you run
the testcase. It's just better to have then already splitted. It's
also easier to track the changes in individual files rather than
one bigger file. And also, we might override during the split other
files created during previous testcase runs. Very annoying to have
the wrong code when you come back after en entire testsuite run and
try to understand why a given test failed.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA/testsuite/ada] Put testcase code in own directory
2004-12-01 3:20 ` Joel Brobecker
@ 2004-12-01 4:54 ` Daniel Jacobowitz
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-12-01 4:54 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Michael Elizabeth Chastain, Andrew Cagney, gdb-patches
On Tue, Nov 30, 2004 at 07:20:21PM -0800, Joel Brobecker wrote:
> Michael,
>
> > 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? :-)
>
> In reviewing this patch, I see that there are some pieces that I forgot
> to include. So the patch can not be accepted as is.
>
> However, would you mind telling us what you think about the principle?
> If you want my opinion, I am strongly attached to the idea of having
> one subdirectory per testcase. The current approach used for C where
> you can pretty much always have all the code for one testcase stored
> in one .c file simply does not work for Ada. With GNAT, you need the
> filename to match the name of the unit, and you need to have one and
> only one unit per file[1]. Most testcases will involve at least 3 files,
> one containing the main procedure (that one compilation unit), plus
> a .ads file containing the spec of a package, plus a .adb file
> containing the body of a package. Some testcases will use many
> more files than this (we have one testcase internally that creates
> something like 200 packages).
>
> For maintenance reasons, I really feel that one subdirectory per
> testcase is the way to go.
>
> I hope you'll agree with me, in which case I'll work on producing
> a new iteration of this patch, complete this time.
Well, it seems reasonable to me.
I'd even go a step further and put multi-file C tests into their own
directories. That may be overkill, though.
--
Daniel Jacobowitz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA/testsuite/ada] Put testcase code in own directory
2004-11-08 21:16 [RFA/testsuite/ada] Put testcase code in own directory Joel Brobecker
2004-11-11 16:43 ` Andrew Cagney
@ 2005-01-20 17:18 ` Andrew Cagney
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2005-01-20 17:18 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
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>/.
(put on head developer hat)
Yes, ok. And going forward as the testsuite expands to include more
complex multi-file cases this is only going to become more common.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-20 17:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-08 21:16 [RFA/testsuite/ada] Put testcase code in own directory Joel Brobecker
2004-11-11 16:43 ` Andrew Cagney
2004-12-01 3:20 ` Joel Brobecker
2004-12-01 4:54 ` Daniel Jacobowitz
2005-01-20 17:18 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox