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]

[RFA] new patch: dejagnu runtest.exp redundant testing


This patch passes gdb and gcc / g++ testing.  I've also added more
inline comments as compared to the one that's withdrawn.

- Jimmy

2000-08-11	Jimmy Guo	<guo@cup.hp.com>

	* runtest.exp: Eliminate from test_top_dirs entries that
	are subdirectories of other entries, to avoid redundant
	testing on *.exp files in these subdirectories.

Index: runtest.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/runtest.exp,v
retrieving revision 1.4
diff -c -r1.4 runtest.exp
*** runtest.exp	2000/08/05 06:34:02	1.4
--- runtest.exp	2000/08/12 02:24:11
***************
*** 1664,1669 ****
--- 1664,1712 ----
  	set test_top_dirs [lsort [getdirs -all ${srcdir} "${tool}*"]]
  	if { ${test_top_dirs} == "" } {
  	    set test_top_dirs ${srcdir}
+ 	} else {
+ 	    # JYG:
+ 	    # DejaGNU's notion of test tree and test files is very
+ 	    # general:
+ 	    # given ${srcdir} and ${tool}, any subdirectory (at any
+ 	    # level deep) with the "${tool}" prefix starts a test tree;
+ 	    # given a test tree, any *.exp file underneath (at any
+ 	    # level deep) is a test file.
+ 	    #
+ 	    # For test tree layouts with ${tool} prefix on
+ 	    # both a parent and a child directory, we need to eliminate
+ 	    # the child directory entry from test_top_dirs list.
+ 	    # e.g. gdb.hp/gdb.base-hp/ would result in two entries
+ 	    # in the list: gdb.hp, gdb.hp/gdb.base-hp.
+ 	    # If the latter not eliminated, test files under
+ 	    # gdb.hp/gdb.base-hp would be run twice (since test files
+ 	    # are gathered from all sub-directories underneath a
+ 	    # directory).
+ 	    #
+ 	    # Since ${tool} may be g++, etc. which could confuse
+ 	    # regexp, we cannot do the simpler test:
+ 	    #     ...
+ 	    #     if [regexp "${srcdir}/.*${tool}.*/.*${tool}.*" ${dir}]
+ 	    #     ...
+ 	    # instead, we rely on the fact that test_top_dirs is
+ 	    # a sorted list of entries, and any entry that contains
+ 	    # the previous valid test top dir entry in its own pathname
+ 	    # must be excluded.
+ 
+ 	    set temp_top_dirs ""
+ 	    set prev_dir ""
+ 	    foreach dir "${test_top_dirs}" {
+ 		if { [string length ${prev_dir}] == 0 ||
+ 		     [string first ${prev_dir} ${dir}] == -1} {
+ 	            # the first top dir entry, or an entry that
+ 		    # does not share the previous entry's entire
+ 	            # pathname, record it as a valid top dir entry.
+ 		    #
+ 		    lappend temp_top_dirs ${dir}
+ 		    set prev_dir ${dir}
+ 		}
+ 	    }
+ 	    set test_top_dirs ${temp_top_dirs}
  	}
  	verbose "Top level testsuite dirs are ${test_top_dirs}" 2
  	set testlist "";


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