dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

# XXX not the right thing to do.


From: Dave Korn
Subject: # XXX not the right thing to do.
Date: Sat, 22 Apr 2006 18:52:23 +0100


    Hello whoever's still out here,

  The subject line above is a comment from runtest.exp.  Indeed, it isn't the
right thing to do.  I found it broke the ability for me to specify a
particular subset of tests using the <path-to-exp-file>=<patternmatch> syntax
as in, for example,

make -k check-gcc RUNTESTFLAGS='-v --all -v --target_board=dlx-py-sim --tool
gcc ASIC=${ASIC} ARTIMI_ROOT=${ARTIMI_ROOT} ./gcc.dg/dg.exp=\"builtin*.c
W*.c\"' 2>&1 | tee chk.log

  I found that this sort of patch worked for me, inasmuch as it ran the right
subset of tests when I tried it.  I haven't tried it with multiple
"<expfile>=<pattern>" options though.  It's not fit for submission as it
stands

Index: dejagnu/runtest.exp
===================================================================
RCS file: /sources/repository/tools/cygwin/share/dejagnu/runtest.exp,v
retrieving revision 1.1
diff -p -u -r1.1 runtest.exp
--- dejagnu/runtest.exp 20 Feb 2004 12:27:03 -0000      1.1
+++ dejagnu/runtest.exp 22 Apr 2006 17:34:47 -0000
@@ -523,6 +523,14 @@ for { set i 0 } { $i < $argc } { incr i 
            continue
        }
 
+       "*.exp" -
+       "*.exp=*" {                     #  specify test names to run
+         # Prevent these from being detected as bogus make-style var names
+         # by the clause below (which rejects lowercase).
+         verbose "Skipping $option for now" 2
+         continue
+       }
+
        "[A-Z0-9_-.]*=*" { # process makefile style args like CC=gcc, etc...
            if [regexp "^(\[A-Z0-9_-\]+)=(.*)$" $option junk var val] {
                set $var $val
@@ -1783,8 +1795,40 @@ foreach current_target $target_list {
                    regsub "^/" $subdir "" subdir
                }
 
-               # XXX not the right thing to do.
-               set runtests [list [file tail $test_name] ""]
+    # Set default runtests list first.
+    set runtests [list [file tail $test_name] ""]
+               # Then check to see if the range of tests is limited,
+               # set `runtests' to a list of two elements: the script name
+               # and any arguments ("" if none).
+    verbose "searching for $test_name in [array names all_runtests]" 1
+    if [info exists all_runtests] {
+      foreach ptn [array names all_runtests]  {
+        verbose "TEST PATTERN $ptn element $all_runtests($ptn)" 3
+        # test_name is always full path, so if we don't match current element
+        # we should try prefixing with srcdir/subdir and then with just
srcdir
+        if { [string match $ptn $test_name] } {
+          set runtests [list [file tail $test_name] $all_runtests($ptn)]
+          verbose "direct match so runtests is $runtests" 2
+          break
+        }
+        if { [string match $srcdir/$subdir/$ptn $test_name] } {
+          set runtests [list [file tail $test_name] $all_runtests($ptn)]
+          verbose "srcdir/subdir match so runtests is $runtests" 2
+          break
+        }
+        if { [string match $subdir/$ptn $test_name] } {
+          set runtests [list [file tail $test_name] $all_runtests($ptn)]
+          verbose "subdir match so runtests is $runtests" 2
+          break
+        }
+        if { [string match $srcdir/$ptn $test_name] } {
+          set runtests [list [file tail $test_name] $all_runtests($ptn)]
+          verbose "srcdir match so runtests is $runtests" 2
+          break
+        }
+      }
+    }
+    verbose "finally runtests is $runtests" 2
 
                runtest $test_name
            }


  The first hunk just protects these style of options from being falsely
matched by the variable-parsing code, and doesn't actually need to allow plain
'*.exp' without a qualifier, because there has to be an equals sign for that
rule to match, but it's nice to be consistent.  The second hunk solves the
actual problem, which is that the code to filter out the pattern-matched tests
only appears to exist in the "Go digging for tests." arm of the "if {
$testlist != "" } ... else ... " construct which handles the case where no
list of *.exp files has been supplied.

  Comments, please?  I'm no tcl expert.  If this looks right I could tidy up
and submit it, but I'm a bit curious why nobody else has had problems with
this bit of code?


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....





reply via email to

[Prev in Thread] Current Thread [Next in Thread]