This is the mail archive of the gdb-patches@sourceware.cygnus.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]

Resubmit: (patch) hpjyg12: dejagnu/runtest.exp & dejagnu/lib/utils.exp


Didn't realize the utils.exp must be updated as well to limit find to
one level.  Here is a evision of the patch.

ChangeLog:

1999-11-05	Jimmy Guo	<guo@cup.hp.com>

	* runtest.exp (main execution loop): cleanup env() code for
          MULTIPASS / PASS; $dir_to_run / $cmdline_dir_to_run can be
	  a list expr, we should do string match on each individual
          directory specified there against what we have in the
          testsuite tree; limit find $dir *.exp to 1 level to avoid
          running the same test twice when the test is under a testsuite
          hierarchy (e.g. gdb.hp/gdb.base-hp/foo.exp -- find gdb.hp
          *.exp will pick this up, and find gdb.hp/gdb.base-hp will pick
          this up again, and both gdb.hp & gdb.hp/gdb.base-hp is in the
          test suite directory list!)

	* utils.exp (find): Add -maxdepth <n> optional argument.

Index: dejagnu/runtest.exp
/opt/gnu/bin/diff -r -c -N  /view/guo.import//CLO/Components/WDB/Src/gnu/dejagnu/runtest.exp dejagnu/runtest.exp
*** /view/guo.import//CLO/Components/WDB/Src/gnu/dejagnu/runtest.exp	Tue May 11 16:06:24 1999
--- dejagnu/runtest.exp	Wed Aug  4 01:01:17 1999
***************
*** 1594,1617 ****
  # "{ name var1=value1 ... }" where `name' is a generic name for the pass and
  # currently has no other meaning.
  
-     global env
- 
      if { [info exists MULTIPASS] } {
  	set multipass $MULTIPASS
-     } elseif {[info exists env(MULTIPASS)]} {
- 	set multipass $env(MULTIPASS)
      }
      if { $multipass == "" } {
  	set multipass { "" }
      }
  
! # 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 ""
      }
--- 1594,1611 ----
  # "{ name var1=value1 ... }" where `name' is a generic name for the pass and
  # currently has no other meaning.
  
      if { [info exists MULTIPASS] } {
  	set multipass $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 [info exists PASS] {
  	set pass $PASS
      } else {
  	set pass ""
      }
***************
*** 1728,1734 ****
  		    # value (for example in MULTIPASS) and the test
  		    # directory matches that directory.
  		    if {[info exists dir_to_run] && $dir_to_run != ""} {
! 			if ![string match "*${dir_to_run}*" $dir] {
  			    continue
  			}
  		    }
--- 1722,1735 ----
  		    # value (for example in MULTIPASS) and the test
  		    # directory matches that directory.
  		    if {[info exists dir_to_run] && $dir_to_run != ""} {
!                         set found 0
!                         foreach directory $dir_to_run { 
!                             if [string match "*${directory}*" $dir] {
!                                 set found 1
!                                 break
!                             }
!                         }
!                         if {!$found} {
  			    continue
  			}
  		    }
***************
*** 1738,1749 ****
  		    # directory matches that directory
  		    if {[info exists cmdline_dir_to_run] \
  			    && $cmdline_dir_to_run != ""} {
! 			if ![string match "*${cmdline_dir_to_run}*" $dir] {
  			    continue
  			}
  		    }
  
! 		    foreach test_name [lsort [find ${dir} *.exp]] {
  			if { ${test_name} == "" } {
  			    continue
  			}
--- 1739,1771 ----
  		    # directory matches that directory
  		    if {[info exists cmdline_dir_to_run] \
  			    && $cmdline_dir_to_run != ""} {
!                         set found 0
!                         foreach directory $cmdline_dir_to_run {
!                             if [string match "*${directory}*" $dir] {
!                                 set found 1
!                                 break
!                             }
!                         }
!                         if {!$found} {
  			    continue
  			}
  		    }
  
! 		    #
! 		    # Since we have a list of all directory paths in
! 		    # ${test_top_dirs}, we don't want to run a test
! 		    # multiple times which could occur if we
! 		    # just did [find ${dir} *.exp] below, e.g.
! 		    # if we want to run a test foo.exp under
! 		    # tool.top_suite/tool.leaf_suite/foo.exp,
! 		    # and we have $test_top_dirs as:
! 		    # 'tool.top_suite tool.top_suite/tool.leaf_suite'
! 		    # we don't want the loop below to find
! 		    # tool.top_suite/tool.leaf_suite/foo.exp twice.
! 		    # By limiting find to 1 level, we avoid such mistake.
! 		    # - guo
! 		    #
! 		    foreach test_name [lsort [find -maxdepth 1 ${dir} *.exp]] {
  			if { ${test_name} == "" } {
  			    continue
  			}
Index: dejagnu/lib/utils.exp
/opt/gnu/bin/diff -r -c -N  /view/guo.import//CLO/Components/WDB/Src/gnu/dejagnu/lib/utils.exp dejagnu/lib/utils.exp
*** /view/guo.import//CLO/Components/WDB/Src/gnu/dejagnu/lib/utils.exp	Tue Jun  8 12:15:08 1999
--- dejagnu/lib/utils.exp	Wed Aug  4 01:01:18 1999
***************
*** 87,104 ****
  
  #
  # Finds all the files recursively
! #     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 { rootdir pattern } {
      # first find all the directories
      set dirs "$rootdir "
!     while 1 {
  	set tmp $rootdir
  	set rootdir ""
  	if [string match "" $tmp] {
--- 87,120 ----
  
  #
  # 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.
  #
! 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]
! 
      # first find all the directories
      set dirs "$rootdir "
!     set depth 1
!     while { $maxdepth == 0 || $depth < $maxdepth } {
  	set tmp $rootdir
  	set rootdir ""
  	if [string match "" $tmp] {
***************
*** 115,120 ****
--- 131,137 ----
  	    }
  	}
  	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]