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]

recent dejagnu changes



We've tracked it down a bit further.  This change:

date: 2000/08/02 22:35:10;  author: guo;  state: Exp;  lines: +8 -1
* runtest.exp: Handle multiple directories in TCL variables
dir_to_run and cmdline_dir_to_run; limit *.exp find to
one directory level to avoid foo/bar/baz.exp getting tested
twice (when ${dir} is 'foo', and when ${dir} is 'foo/bar').

* lib/utils.exp (find): Add support for a -maxdepth <n>
option to limit find to <n> directories deep.

is the one that breaks the GCC testsuite.  As far as I can see, it can
never be a correct change.  It's not possible to change the GCC
testsuite to match, because old versions of the testsuite need to work
too.

I also think that this change:

* lib/target.exp (default_target_compile,default_target_assemble,
default_link): Remove env() interface for *_FOR_TARGET TCL vars.

and this change:

* runtest.exp: Cleanup reference to $env(MULTIPASS) and
$env(PASS).  These were added by HP but unused since.

are unwise.  I don't know what might depend on this functionality.

They also seem to be part of the same patch judging by the ChangeLog
entry.

So I propose to revert all of the recent changes except for those to
lib/framework.exp.  I've tested this patch by running the resulting
dejagnu against the gcc and gdb testsuites, and running its own
testsuite, under powerpc-linux X powerpc-eabisim; the results were
very bad for gdb ("gdb-internal-error: legacy_register_name: called"),
but the testsuite seemed to be doing the right thing.

Any objections?

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/dejagnu-revertjimmy.patch==========
2000-08-04  Geoff Keating  <geoffk@cygnus.com>

	* runtest.exp: Revert last changes.
	* lib/target.exp: Likewise.
	* lib/utils.exp: Likewise.

Index: runtest.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/runtest.exp,v
retrieving revision 1.3
retrieving revision 1.1.1.2
diff -u -p -r1.3 -r1.1.1.2
--- runtest.exp	2000/08/02 22:35:10	1.3
+++ runtest.exp	1999/12/07 04:02:17	1.1.1.2
@@ -1604,16 +1604,20 @@ foreach current_target $target_list {
 
     if { [info exists MULTIPASS] } {
 	set multipass $MULTIPASS
+    } elseif {[info exists env(MULTIPASS)]} {
+	set multipass $env(MULTIPASS)
     }
     if { $multipass == "" } {
 	set multipass { "" }
     }
 
-# If PASS is specified, we want to run only the tests specified.
-# Its value should be a number or a list of numbers that specify
-# the passes that we want to run.
+# If PASS is specified, either as a TCL variable or in environment, we
+# want to run only the tests specified. Its value should be a number
+# or a list of numbers that specify the passes that we want to run.
     if [info exists PASS] {
 	set pass $PASS
+    } elseif [info exists env(PASS)] {
+	set pass $env(PASS)
     } else {
 	set pass ""
     }
@@ -1730,16 +1734,7 @@ foreach current_target $target_list {
 		    # value (for example in MULTIPASS) and the test
 		    # directory matches that directory.
 		    if {[info exists dir_to_run] && $dir_to_run != ""} {
-			# JYG: dir_to_run might be a space delimited list
-			# of directories.  Look for match on each item.
-			set found 0
-			foreach directory $dir_to_run {
-			    if [string match "*${directory}*" $dir] {
-				set found 1
-				break
-			    }
-			}
-			if {!$found} {
+			if ![string match "*${dir_to_run}*" $dir] {
 			    continue
 			}
 		    }
@@ -1749,30 +1744,12 @@ foreach current_target $target_list {
 		    # directory matches that directory
 		    if {[info exists cmdline_dir_to_run] \
 			    && $cmdline_dir_to_run != ""} {
-			# JYG: cmdline_dir_to_run might be a space delimited
-			# list of directories.  Look for match on each item.
-			set found 0
-			foreach directory $cmdline_dir_to_run {
-			    if [string match "*${directory}*" $dir] {
-				set found 1
-				break
-			    }
-			}
-			if {!$found} {
+			if ![string match "*${cmdline_dir_to_run}*" $dir] {
 			    continue
 			}
 		    }
 
-		    # JYG: Limit find to one directory level to treat
-		    # each test directory as a base directory.
-		    # test_top_dirs includes all subdirectory paths,
-		    # e.g. for gdb.hp/gdb.base-hp/, test_top_dirs
-		    # has two entries: gdb.hp/, and gdb.base-hp/.
-		    # If we just use '[find ${dir} *.exp]', all
-		    # *.exp files in gdb.hp/gdb.base-hp/ would be
-		    # picked up twice and tested twice, which is
-		    # what we don't need.
-		    foreach test_name [lsort [find -maxdepth 1 ${dir} *.exp]] {
+		    foreach test_name [lsort [find ${dir} *.exp]] {
 			if { ${test_name} == "" } {
 			    continue
 			}
Index: lib/target.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/target.exp,v
retrieving revision 1.6
retrieving revision 1.5
diff -u -p -r1.6 -r1.5
--- target.exp	2000/08/02 22:38:52	1.6
+++ target.exp	2000/06/04 03:34:35	1.5
@@ -289,6 +289,7 @@ proc target_compile {source destfile typ
 proc default_target_compile {source destfile type options} {
     global target_triplet
     global tool_root_dir
+    global env
     global CFLAGS_FOR_TARGET
     global compiler_flags
 
@@ -305,6 +306,11 @@ proc default_target_compile {source dest
 
     if [info exists CFLAGS_FOR_TARGET] {
 	append add_flags " $CFLAGS_FOR_TARGET"
+# The top level Makefile sets (and exports) a *FLAGS_FOR_TARGET
+# that may not be applicable to testsuite runs.  This conflict
+# needs to be resolved.
+#    } elseif [info exists env(CFLAGS_FOR_TARGET)] {
+#	append add_flags " $env(CFLAGS_FOR_TARGET)"
     }
 
     if [info exists target_info(host,name)] {
@@ -398,18 +404,43 @@ proc default_target_compile {source dest
 	if { $compiler == "" } {
 	    set compiler $CC_FOR_TARGET
 	}
+# When started from a mid-level directory (eg gdb)
+# the Makefile may export a *_FOR_TARGET that isn't
+# applicable.
+#    } elseif [info exists env(CC_FOR_TARGET)] {
+#	if { $compiler == "" } {
+#	    set compiler $env(CC_FOR_TARGET)
+#	}
+    } elseif { [info exists env(CC_FOR_TARGET)] && $env(CC_FOR_TARGET) != "" } {
+	if { $compiler == "" } {
+	    set compiler $env(CC_FOR_TARGET)
+	}
     }
 
     if [info exists CXX_FOR_TARGET] {
 	if { $compiler_type == "c++" } {
 	    set compiler $CXX_FOR_TARGET
 	}
+# When started from a mid-level directory (eg gdb)
+# the Makefile may export a *_FOR_TARGET that isn't
+# applicable.
+#    } elseif [info exists env(CXX_FOR_TARGET)] {
+#	if { $compiler_type == "c++" } {
+#	    set compiler $env(CXX_FOR_TARGET)
+#	}
     }
 
     if [info exists F77_FOR_TARGET] {
 	if { $compiler_type == "f77" } {
 	    set compiler $F77_FOR_TARGET
 	}
+# When started from a mid-level directory (eg gdb)
+# the Makefile may export a *_FOR_TARGET that isn't
+# applicable.
+#    } elseif [info exists env(F77_FOR_TARGET)] {
+#	if { $compiler_type == "f77" } {
+#	    set compiler $env(F77_FOR_TARGET)
+#	}
     }
 
     if { $compiler == "" } {
@@ -624,11 +655,14 @@ proc target_assemble { source destfile f
 }
 
 proc default_target_assemble { source destfile flags } {
-    global AS_FOR_TARGET
-    global ASFLAGS_FOR_TARGET
+    global env
+    global AS_FOR_TARGET;
+    global ASFLAGS_FOR_TARGET;
 
     if [info exists AS_FOR_TARGET] {
 	set AS "$AS_FOR_TARGET";
+    } elseif [info exists env(AS_FOR_TARGET)] {
+	set AS $env(AS_FOR_TARGET)
     } else {
 	if ![board_info target exists assembler] {
 	    set AS [find_gas];
@@ -639,6 +673,11 @@ proc default_target_assemble { source de
 
     if [info exists ASFLAGS_FOR_TARGET] {
 	append flags " $ASFLAGS_FOR_TARGET";
+# The top level Makefile sets (and exports) a *FLAGS_FOR_TARGET
+# that may not be applicable to testsuite runs.  This conflict
+# needs to be resolved.
+#    } elseif [info exists env(ASFLAGS_FOR_TARGET)] {
+#	append flags " $env(ASFLAGS_FOR_TARGET)"
     }
 
     if [is_remote host] {
@@ -672,8 +711,9 @@ proc target_link { objects destfile flag
 }
 
 proc default_link { board objects destfile flags } {
-    global LD_FOR_TARGET
-    global LDFLAGS_FOR_TARGET
+    global env
+    global LD_FOR_TARGET;
+    global LDFLAGS_FOR_TARGET;
 
     # return -L's in ldflags
     proc only--Ls { ldflags } {
@@ -702,6 +742,8 @@ proc default_link { board objects destfi
 
     if [info exists LD_FOR_TARGET] {
 	set LD "$LD_FOR_TARGET";
+    } elseif [info exists env(LD_FOR_TARGET)] {
+	set LD $env(LD_FOR_TARGET)
     } else {
 	if ![board_info target exists linker] {
 	    set LD [find_ld];
@@ -712,6 +754,11 @@ proc default_link { board objects destfi
 
     if [info exists LDFLAGS_FOR_TARGET] {
 	append flags " $LDFLAGS_FOR_TARGET";
+# The top level Makefile sets (and exports) a *FLAGS_FOR_TARGET
+# that may not be applicable to testsuite runs.  This conflict
+# needs to be resolved.
+#    } elseif [info exists env(LDFLAGS_FOR_TARGET)] {
+#	append flags " $env(LDFLAGS_FOR_TARGET)"
     }
 
     # `ldflags' consists of arguments to gcc (that are then
Index: lib/utils.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/utils.exp,v
retrieving revision 1.2
retrieving revision 1.1.1.1
diff -u -p -r1.2 -r1.1.1.1
--- utils.exp	2000/08/02 22:35:10	1.2
+++ utils.exp	1999/11/09 01:28:42	1.1.1.1
@@ -87,34 +87,18 @@ proc getdirs { args } {
 
 #
 # Finds all the files recursively
-# Args:
-#     [-maxdepth <n>]
-#         limit recursive find depth to <n> level;
-#         default is to recursively find in all subdirectories
-#     rootdir
-#         the directory to start the search from. This is and all
-#         subdirectories are searched for filenames. Directory names
-#         are not included in the list, but the filenames have path
-#         information. 
-#     pattern
-#         the pattern to match. Patterns are csh style globbing rules.
-# Returns:
-#     a list or a NULL.
+#     rootdir - this is the directory to start the search
+#   	  from. This is and all subdirectories are search for
+#   	  filenames. Directory names are not included in the
+#   	  list, but the filenames have path information. 
+#     pattern - this is the pattern to match. Patterns are csh style
+#   	  globbing rules.
+#     returns: a list or a NULL.
 #
-proc find { args } {
-    if { [lindex $args 0] == "-maxdepth" } {
-        set maxdepth [lindex $args 1]
-	set args [lrange $args 2 end]
-    } else {
-	set maxdepth 0
-    }
-    set rootdir [lindex $args 0]
-    set pattern [lindex $args 1]
-
+proc find { rootdir pattern } {
     # first find all the directories
     set dirs "$rootdir "
-    set depth 1
-    while { $maxdepth == 0 || $depth < $maxdepth } {
+    while 1 {
 	set tmp $rootdir
 	set rootdir ""
 	if [string match "" $tmp] {
@@ -131,7 +115,6 @@ proc find { args } {
 	    }
 	}
 	set tmp ""
-        set depth [expr $depth + 1]
     }
     
     # find all the files that match the pattern
============================================================

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