This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] dejagnu runtest.exp misc. fixes
- To: Fernando Nasser <fnasser at cygnus dot com>
- Subject: Re: [PATCH] dejagnu runtest.exp misc. fixes
- From: Jimmy Guo <guo at cup dot hp dot com>
- Date: Tue, 1 Aug 2000 09:57:06 -0700 (PDT)
- Cc: gdb-patches at sourceware dot cygnus dot com
>Jimmy,
>
>Can you elaborate on how one would use this. What happens today and what
>will happen after this change? Can you give an example, please?
>
>Thanks,
>F.
- dir_to_run / cmdline_dir_to_run:
In multipass testing spec, one can do something like (in site.exp):
set MULTIPASS "{1 \"dir_to_run=gdb.base gdb.c++\" \
\"CXX_FOR_TARGET=... ...}"
The cmdline_dir_to_run value can be specified through the runtest
--di option.
Today's runtest won't handle list of directories ... if you specify
such a list no test will be run. The change will just introduce a
loop around the possibly space delimited list of directories to check
if a given test suite directory is specified in these variables.
- find -maxdepth 1 ${dir} *.exp
(Oops, lib/utils.exp needs to be changed accordingly. The revised
patch is below.)
${dir} is one directory in the list of ${test_top_dirs}.
${test_top_dirs} is assigned by a statement:
set test_top_dirs [lsort [getdirs -all ${srcdir} "${tool}*"]]
For gdb testing, gdb.hp/gdb.base-hp/, for example, will have
two directory entries in ${test_top_dirs}:
gdb.hp/ gdb.hp/gdb.base-hp/
When retrieving .exp files under a test directory, today's dejagnu
would get and run all gdb.hp/gdb.base-hp/ tests twice. The change is
to enforce the notion that we treat all test directories as if they
are base directories, and don't look in sub-directories for tests.
- Jimmy
Mon Jul 31 16:54:52 Jimmy Guo <guo@cup.hp.com>
* 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.
Index: runtest.exp
/usr/local/bin/diff -c -L runtest.exp runtest.exp@@/main/cygnus/6 runtest.exp
*** runtest.exp
--- runtest.exp Mon Jul 31 16:54:33 2000
***************
*** 1734,1740 ****
# 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
}
}
--- 1734,1747 ----
# 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
}
}
***************
*** 1744,1755 ****
# 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
}
--- 1751,1772 ----
# 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
}
}
! # JYG: Limit find to one level, since we don't want
! # to pick up foo/bar/baz.exp twice ...
! # ${test_top_dirs} includes '... foo/ foo/bar/ ...'
! foreach test_name [lsort [find -maxdepth 1 ${dir} *.exp]] {
if { ${test_name} == "" } {
continue
}
Index: lib/utils.exp
/usr/local/bin/diff -c -L lib/utils.exp lib/utils.exp@@/GDB_2000_07_24 lib/utils.exp
*** lib/utils.exp
--- lib/utils.exp Wed Dec 8 18:48:15 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