dejagnu
[Top][All Lists]
Advanced

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

unique-ify test directory list


From: DJ Delorie
Subject: unique-ify test directory list
Date: Wed, 18 Feb 2004 15:26:07 -0500

We recently noticed (internal to Red Hat) that some gcc tests were
being run twice.  This doesn't fix the root cause of the problem
(probably recursing where recursing isn't needed, the extras were
always a subdirectory below the other tests) but it does fix the
symptom.  Note: it's the second call to uniq that actually elminated
the extra tests, but I kept the first call "just to be safe".  This
was just the easiest change for us, I'm passing it along in case you
want to either use it or further debug the problem.

2004-02-18  DJ Delorie  <address@hidden>

        * lib/utils.exp: Add "uniq" proc, to filter out duplicates.
        * runtest.exp: Call it as needed.


diff -r -C 2 dejagnu-1.4.3/runtest.exp dejagnu-1.4.3-patched/runtest.exp
*** dejagnu-1.4.3/runtest.exp   Wed Sep  4 00:06:59 2002
--- dejagnu-1.4.3-patched/runtest.exp   Wed Feb 18 15:17:54 2004
***************
*** 1702,1706 ****
        # exist and there are no subdirectories in $srcdir, then
        # we default to srcdir.
!       set test_top_dirs [lsort [getdirs -all ${srcdir} "${tool}*"]]
        if { ${test_top_dirs} == "" } {
            set test_top_dirs ${srcdir}
--- 1702,1706 ----
        # exist and there are no subdirectories in $srcdir, then
        # we default to srcdir.
!       set test_top_dirs [uniq [lsort [getdirs -all ${srcdir} "${tool}*"]]]
        if { ${test_top_dirs} == "" } {
            set test_top_dirs ${srcdir}
***************
*** 1847,1851 ****
                    }
  
!                   foreach test_name [lsort [find ${dir} *.exp]] {
                        if { ${test_name} == "" } {
                            continue
--- 1847,1851 ----
                    }
  
!                   foreach test_name [uniq [lsort [find ${dir} *.exp]]] {
                        if { ${test_name} == "" } {
                            continue
diff -r -C 2 dejagnu-1.4.3/lib/utils.exp dejagnu-1.4.3-patched/lib/utils.exp
*** dejagnu-1.4.3/lib/utils.exp Thu Aug 29 23:54:53 2002
--- dejagnu-1.4.3-patched/lib/utils.exp Wed Feb 18 15:17:54 2004
***************
*** 439,440 ****
--- 439,455 ----
  }
  
+ #
+ #  Given a sorted list, return a list of unique entries in that list.
+ #
+ proc uniq { list } {
+     set newlist ""
+     set prev ""
+     foreach entry $list {
+         if { "$entry" != "$prev" } {
+         set newlist "$newlist $entry"
+       }
+       set prev $entry
+     }
+     return $newlist
+ }
+ 




reply via email to

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