My work needs to test some cases before others, but I found Dejagnu didn't 
support it. It tests cases according to their directory order only. So I 
modified runtest.exp to achieve my tests order control. My code is not very 
mature, but it is a way. So I think this feature is valueable to some people of 
special requests, why not add it to Dejagnu framework?

Explanation of my method:

If there exists file "priority.seq" in test source directory, test cases 
specified in that file will be done first and orderly. After done them, others 
should be done. Here is an example content of "priority.seq":

third/third.exp
./second/second.exp
./first/first.exp

Bellow are changes in "runtest.exp", my version is 1.4.99:

diff runtest.exp original_src/runtest.exp

1791,1834d1790
< 
<      # If exist priority.seq, read it to priorities list orderly.  
<      if { [file exists $srcdir/priority.seq] } {
<       set sequence_file [open $srcdir/priority.seq RDONLY]
<       foreach line [split [read $sequence_file] \n] {
<       if { [file exists $srcdir/$line ] } {
<           lappend priorities $line
<       } else {
<    warning "$srcdir/$line does not exist. Please check $srcdir/priority.seq 
for error entries." 
<       }
<       }
<          close $sequence_file
<      }
< 
<      # Run these *.exp files in priorities list first.  
<      if { $priorities != "" } {
<          foreach test_name $priorities {
<       if { ${ignoretests} != "" } {
<           if { 0 <= [lsearch ${ignoretests} [file tail ${test_name}]]} {
<        continue
<           }
<       }
< 
<       # set subdir to the tail of the dirname after $srcdir,
<       # for the driver files that want it.  XXX this is silly.
<       # drivers should get a single var, not "$srcdir/$subdir"
<       set subdir [file dirname $test_name]
<       set p [expr {[string length $srcdir] - 1}]
<       while {0 < $p && [string index $srcdir $p] == "/"} {
<           incr p -1
<       }
<       if {[string range $subdir 0 $p] == $srcdir} {
<           set subdir [string range $subdir [expr {$p + 1}] end]
<           regsub "^/" $subdir "" subdir
<       }
< 
<       # XXX not the right thing to do.
<       set runtests [list [file tail $test_name] ""]
< 
<       runtest $test_name
<       lappend ignoretests [file tail $test_name]
<          }
<      }
< 


Wenbo Yang
2006-12-14
_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
http://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to