diff mbox

gfortran testsuite: implicitly cleanup-modules

Message ID 20120316145958.GA19127@mx.loc
State New
Headers show

Commit Message

Bernhard Reutner-Fischer March 16, 2012, 2:59 p.m. UTC
On Fri, Mar 16, 2012 at 11:04:45AM +0100, Bernhard Reutner-Fischer wrote:

>The underlying problem is that dejagnu's runtest.exp only allows for a
>single "libdir" where it searches for includes -- see comment in
>libgomp.exp and libitm.exp
>
>While just adding more and more load_gcc_lib calls to users outside of
>gcc/ is the easy way out, it is (IMHO) error prone (i ran make check
>just in gcc and not in toplevel, fixed my script now).
>
>It would be desirable if dejagnu would just find all the currently
>load_gcc_lib'ed files on its own, via load_lib.
>One could
>- teach dejagnu to treat libdir as a list of paths

The attached works for me for a toplevel make -k check (double-checked
with individual make check in lib{gomp,itm}). I do not intend to pursue
this any further.

Comments

Bernhard Reutner-Fischer June 28, 2012, 10:27 p.m. UTC | #1
Rehi Janis,

Good to see you active again :)

Perhaps you want to pursue this? We'd need to suggest this to dejagnu,
have it in a release and bump the minimum required deja version of gcc.
So it may take time but IMO would be a worthwhile cleanup.
Or do you see a better way to handle this properly?

The first patch below is the dejagnu part, the other patch is the
corresponding follow-up for gcc.

cheers,
Bernhard

On Fri, Mar 16, 2012 at 03:59:58PM +0100, Bernhard Reutner-Fischer wrote:
>On Fri, Mar 16, 2012 at 11:04:45AM +0100, Bernhard Reutner-Fischer wrote:
>
>>The underlying problem is that dejagnu's runtest.exp only allows for a
>>single "libdir" where it searches for includes -- see comment in
>>libgomp.exp and libitm.exp
>>
>>While just adding more and more load_gcc_lib calls to users outside of
>>gcc/ is the easy way out, it is (IMHO) error prone (i ran make check
>>just in gcc and not in toplevel, fixed my script now).
>>
>>It would be desirable if dejagnu would just find all the currently
>>load_gcc_lib'ed files on its own, via load_lib.
>>One could
>>- teach dejagnu to treat libdir as a list of paths
>
>The attached works for me for a toplevel make -k check (double-checked
>with individual make check in lib{gomp,itm}). I do not intend to pursue
>this any further.

>runtest.exp: add libdirs list for load_lib()
>
>libgomp wants to load .exp files from ../gcc/testsuite/lib.
>Instrument load_lib to be able to find the files.
>Previously we used to have a helper proc that had to first load all
>dependent .exp manually and then, again manually, the desired .exp.
>
>2012-03-16  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
>
>	* runtest.exp (libdirs): New global list.
>	(load_lib): Append libdirs to search_and_load_files directories.
>
>diff --git a/runtest.exp b/runtest.exp
>index 4bfed83..8e6a7de 100644
>--- a/runtest.exp
>+++ b/runtest.exp
>@@ -589,7 +589,7 @@ proc lookfor_file { dir name } {
> # source tree, (up one or two levels), then in the current dir.
> #
> proc load_lib { file } {
>-    global verbose libdir srcdir base_dir execpath tool
>+    global verbose libdir libdirs srcdir base_dir execpath tool
>     global loaded_libs
> 
>     if {[info exists loaded_libs($file)]} {
>@@ -597,8 +597,11 @@ proc load_lib { file } {
>     }
> 
>     set loaded_libs($file) ""
>-
>-    if { [search_and_load_file "library file" $file [list ../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname $srcdir]]]/dejagnu/lib]] == 0 } {
>+    set search_dirs [list ../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname $srcdir]]]/dejagnu/lib]
>+    if {[info exists libdirs]} {
>+        lappend search_dirs $libdirs
>+    }
>+    if { [search_and_load_file "library file" $file $search_dirs ] == 0 } {
> 	send_error "ERROR: Couldn't find library file $file.\n"
> 	exit 1
>     }
>@@ -652,6 +655,8 @@ set libdir   [file dirname $execpath]/dejagnu
> if {[info exists env(DEJAGNULIBS)]} {
>     set libdir $env(DEJAGNULIBS)
> }
>+# list of extra directories for load_lib
>+set libdirs {}
> 
> verbose "Using $libdir to find libraries"
> 

>libgomp/ChangeLog
>
>2012-03-16  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
>
>	* testsuite/lib/libgomp.exp: Set libdirs. Remove now redundant
>	manual inclusion of gfortran-dg's dependencies.
>
>libitm/ChangeLog
>
>2012-03-16  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
>
>	* testsuite/lib/libitm.exp: Set libdirs. Remove now redundant
>	manual inclusion of gcc-dg's dependencies.
>
>
>diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
>index 02909f8..54e1e652 100644
>--- a/libgomp/testsuite/lib/libgomp.exp
>+++ b/libgomp/testsuite/lib/libgomp.exp
>@@ -1,32 +1,12 @@
>-# Damn dejagnu for not having proper library search paths for load_lib.
>-# We have to explicitly load everything that gcc-dg.exp wants to load.
>+global libdirs
>+lappend libdirs $srcdir/../../gcc/testsuite/lib
> 
>-proc load_gcc_lib { filename } {
>-    global srcdir loaded_libs
>+load_lib dg.exp
> 
>-    load_file $srcdir/../../gcc/testsuite/lib/$filename
>-    set loaded_libs($filename) ""
>-}
>+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!
>+load_lib gcc-defs.exp
> 
>-load_lib dg.exp
>-load_gcc_lib file-format.exp
>-load_gcc_lib target-supports.exp
>-load_gcc_lib target-supports-dg.exp
>-load_gcc_lib scanasm.exp
>-load_gcc_lib scandump.exp
>-load_gcc_lib scanrtl.exp
>-load_gcc_lib scantree.exp
>-load_gcc_lib scanipa.exp
>-load_gcc_lib prune.exp
>-load_gcc_lib target-libpath.exp
>-load_gcc_lib wrapper.exp
>-load_gcc_lib gcc-defs.exp
>-load_gcc_lib torture-options.exp
>-load_gcc_lib timeout.exp
>-load_gcc_lib timeout-dg.exp
>-load_gcc_lib fortran-modules.exp
>-load_gcc_lib gcc-dg.exp
>-load_gcc_lib gfortran-dg.exp
>+load_lib gfortran-dg.exp
> 
> set dg-do-what-default run
> 
>diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
>index f322ed5..1ac8f31 100644
>--- a/libitm/testsuite/lib/libitm.exp
>+++ b/libitm/testsuite/lib/libitm.exp
>@@ -12,34 +12,15 @@
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> 
>-# Damn dejagnu for not having proper library search paths for load_lib.
>-# We have to explicitly load everything that gcc-dg.exp wants to load.
>+global libdirs
>+lappend libdirs $srcdir/../../gcc/testsuite/lib
> 
>-proc load_gcc_lib { filename } {
>-    global srcdir loaded_libs
>+load_lib dg.exp
> 
>-    load_file $srcdir/../../gcc/testsuite/lib/$filename
>-    set loaded_libs($filename) ""
>-}
>+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!
>+load_lib gcc-defs.exp
> 
>-load_lib dg.exp
>-load_gcc_lib file-format.exp
>-load_gcc_lib target-supports.exp
>-load_gcc_lib target-supports-dg.exp
>-load_gcc_lib scanasm.exp
>-load_gcc_lib scandump.exp
>-load_gcc_lib scanrtl.exp
>-load_gcc_lib scantree.exp
>-load_gcc_lib scanipa.exp
>-load_gcc_lib prune.exp
>-load_gcc_lib target-libpath.exp
>-load_gcc_lib wrapper.exp
>-load_gcc_lib gcc-defs.exp
>-load_gcc_lib torture-options.exp
>-load_gcc_lib timeout.exp
>-load_gcc_lib timeout-dg.exp
>-load_gcc_lib fortran-modules.exp
>-load_gcc_lib gcc-dg.exp
>+load_lib gcc-dg.exp
> 
> set dg-do-what-default run
>
Mike Stump June 28, 2012, 11:43 p.m. UTC | #2
On Jun 28, 2012, at 3:27 PM, Bernhard Reutner-Fischer wrote:
> Perhaps you want to pursue this? We'd need to suggest this to dejagnu,

Actually, we have the technology, so that isn't necessary.  :-)  You can install replacements for any procs you want, not pretty, but... it does work.  I think this is a more deterministic path forward than waiting for a mythical dejagnu release.  Also, we then can avoid the hassle of requiring a new dejagnu.
Bernhard Reutner-Fischer June 29, 2012, 12:15 a.m. UTC | #3
On Thu, Jun 28, 2012 at 04:43:05PM -0700, Mike Stump wrote:
>On Jun 28, 2012, at 3:27 PM, Bernhard Reutner-Fischer wrote:
>> Perhaps you want to pursue this? We'd need to suggest this to dejagnu,
>
>Actually, we have the technology, so that isn't necessary.  :-)  You can install replacements for any procs you want, not pretty, but... it does work.  I think this is a more deterministic path forward than waiting for a mythical dejagnu release.  Also, we then can avoid the hassle of requiring a new dejagnu.

Wouldn't that mean that we have to completely replace proc load_lib?
But anyway.
Mike, it would be nice if you could fix
>+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!

if you did not do that already -- TIA :)

That's under the assumption that one should be able to use the major
lib/*exp without including their pre-requisites first.

cheers,
Mike Stump June 29, 2012, 2:59 a.m. UTC | #4
On Jun 28, 2012, at 5:15 PM, Bernhard Reutner-Fischer wrote:
> On Thu, Jun 28, 2012 at 04:43:05PM -0700, Mike Stump wrote:
>> On Jun 28, 2012, at 3:27 PM, Bernhard Reutner-Fischer wrote:
>>> Perhaps you want to pursue this? We'd need to suggest this to dejagnu,
>> 
>> Actually, we have the technology, so that isn't necessary.  :-)  You can install replacements for any procs you want, not pretty, but... it does work.  I think this is a more deterministic path forward than waiting for a mythical dejagnu release.  Also, we then can avoid the hassle of requiring a new dejagnu.
> 
> Wouldn't that mean that we have to completely replace proc load_lib?

Yes; worse, it is a cut-n-paste from dejagnu and can effectively rev lock us to the current dejagnu release...  One can delegate, but I don't think any pre or post processing in this case is enough to `fix' the issue, so it would be a wholesale replacement.

> But anyway.
> Mike, it would be nice if you could fix
>> +# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!

Sounds like a single line fix.  It is the testing of that fix that is the annoying part.
Bernhard Reutner-Fischer June 7, 2013, 2:30 p.m. UTC | #5
On 29 June 2012 04:59, Mike Stump <mikestump@comcast.net> wrote:
> On Jun 28, 2012, at 5:15 PM, Bernhard Reutner-Fischer wrote:
>> On Thu, Jun 28, 2012 at 04:43:05PM -0700, Mike Stump wrote:
>>> On Jun 28, 2012, at 3:27 PM, Bernhard Reutner-Fischer wrote:
>>>> Perhaps you want to pursue this? We'd need to suggest this to dejagnu,
>>>
>>> Actually, we have the technology, so that isn't necessary.  :-)  You can install replacements for any procs you want, not pretty, but... it does work.  I think this is a more deterministic path forward than waiting for a mythical dejagnu release.  Also, we then can avoid the hassle of requiring a new dejagnu.
>>
>> Wouldn't that mean that we have to completely replace proc load_lib?
>
> Yes; worse, it is a cut-n-paste from dejagnu and can effectively rev lock us to the current dejagnu release...  One can delegate, but I don't think any pre or post processing in this case is enough to `fix' the issue, so it would be a wholesale replacement.

Ben,

Would you accept something like the patch in the message below into dejagnu?
http://gcc.gnu.org/ml/fortran/2012-03/msg00094.html

Above patch was motivated by these (unpleasant) observations:
http://gcc.gnu.org/ml/fortran/2012-03/msg00092.html

thanks,
>
>> But anyway.
>> Mike, it would be nice if you could fix
>>> +# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!
>
> Sounds like a single line fix.  It is the testing of that fix that is the annoying part.
Ben Elliston June 10, 2013, 11:21 p.m. UTC | #6
Hi Bernhard,

> Would you accept something like the patch in the message below into dejagnu?
> http://gcc.gnu.org/ml/fortran/2012-03/msg00094.html

Yes, I'm happy to fix this limitation.  However, your patch isn't
complete .. you need to update the documentation, testsuite, etc.
Please send a revised patch to dejagnu@gnu.org and I'll review it.

Cheers, Ben
diff mbox

Patch

libgomp/ChangeLog

2012-03-16  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* testsuite/lib/libgomp.exp: Set libdirs. Remove now redundant
	manual inclusion of gfortran-dg's dependencies.

libitm/ChangeLog

2012-03-16  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* testsuite/lib/libitm.exp: Set libdirs. Remove now redundant
	manual inclusion of gcc-dg's dependencies.


diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 02909f8..54e1e652 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -1,32 +1,12 @@ 
-# Damn dejagnu for not having proper library search paths for load_lib.
-# We have to explicitly load everything that gcc-dg.exp wants to load.
+global libdirs
+lappend libdirs $srcdir/../../gcc/testsuite/lib
 
-proc load_gcc_lib { filename } {
-    global srcdir loaded_libs
+load_lib dg.exp
 
-    load_file $srcdir/../../gcc/testsuite/lib/$filename
-    set loaded_libs($filename) ""
-}
+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!
+load_lib gcc-defs.exp
 
-load_lib dg.exp
-load_gcc_lib file-format.exp
-load_gcc_lib target-supports.exp
-load_gcc_lib target-supports-dg.exp
-load_gcc_lib scanasm.exp
-load_gcc_lib scandump.exp
-load_gcc_lib scanrtl.exp
-load_gcc_lib scantree.exp
-load_gcc_lib scanipa.exp
-load_gcc_lib prune.exp
-load_gcc_lib target-libpath.exp
-load_gcc_lib wrapper.exp
-load_gcc_lib gcc-defs.exp
-load_gcc_lib torture-options.exp
-load_gcc_lib timeout.exp
-load_gcc_lib timeout-dg.exp
-load_gcc_lib fortran-modules.exp
-load_gcc_lib gcc-dg.exp
-load_gcc_lib gfortran-dg.exp
+load_lib gfortran-dg.exp
 
 set dg-do-what-default run
 
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index f322ed5..1ac8f31 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -12,34 +12,15 @@ 
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-# Damn dejagnu for not having proper library search paths for load_lib.
-# We have to explicitly load everything that gcc-dg.exp wants to load.
+global libdirs
+lappend libdirs $srcdir/../../gcc/testsuite/lib
 
-proc load_gcc_lib { filename } {
-    global srcdir loaded_libs
+load_lib dg.exp
 
-    load_file $srcdir/../../gcc/testsuite/lib/$filename
-    set loaded_libs($filename) ""
-}
+# BUG: gcc-dg calls gcc-set-multilib-library-path but does not load gcc-defs!
+load_lib gcc-defs.exp
 
-load_lib dg.exp
-load_gcc_lib file-format.exp
-load_gcc_lib target-supports.exp
-load_gcc_lib target-supports-dg.exp
-load_gcc_lib scanasm.exp
-load_gcc_lib scandump.exp
-load_gcc_lib scanrtl.exp
-load_gcc_lib scantree.exp
-load_gcc_lib scanipa.exp
-load_gcc_lib prune.exp
-load_gcc_lib target-libpath.exp
-load_gcc_lib wrapper.exp
-load_gcc_lib gcc-defs.exp
-load_gcc_lib torture-options.exp
-load_gcc_lib timeout.exp
-load_gcc_lib timeout-dg.exp
-load_gcc_lib fortran-modules.exp
-load_gcc_lib gcc-dg.exp
+load_lib gcc-dg.exp
 
 set dg-do-what-default run