[llvm-commits] CVS: llvm/test/lib/llvm.exp

Reid Spencer reid at x10sys.com
Sat Apr 14 12:37:44 PDT 2007



Changes in directory llvm/test/lib:

llvm.exp updated: 1.4 -> 1.5
---
Log message:

For PR1319: http://llvm.org/PR1319 :
More improvements:
1. Using ::errorInfo wasn't such a hot idea. Go back to just printing the
   offending line of code and the stderr output. This is sufficient and
   not entangled with Tcl goop.
2. Capture the problem report numbers and report them whether pass or fail.
   This helps quickly get some context when a test fails, if it has an
   associated PR number.


---
Diffs of the changes:  (+27 -6)

 llvm.exp |   33 +++++++++++++++++++++++++++------
 1 files changed, 27 insertions(+), 6 deletions(-)


Index: llvm/test/lib/llvm.exp
diff -u llvm/test/lib/llvm.exp:1.4 llvm/test/lib/llvm.exp:1.5
--- llvm/test/lib/llvm.exp:1.4	Sat Apr 14 13:51:19 2007
+++ llvm/test/lib/llvm.exp	Sat Apr 14 14:37:22 2007
@@ -1,11 +1,14 @@
-proc execOneLine { test outcome lineno line } {
+proc execOneLine { test PRS outcome lineno line } {
   set status 0
   set resultmsg ""
   set retval [ catch { eval exec -keepnewline -- $line } errmsg ]
   if { $retval != 0 } {
     set code [lindex $::errorCode 0]
     set lineno [expr $lineno + 1]
-    set errmsg " at RUN: line $lineno\n$::errorInfo"
+    if { $PRS != ""} {
+      set PRS " for $PRS" 
+    }
+    set errmsg " at line $lineno$PRS\nwhile running: $line\n$errmsg"
     switch "$code" {
       CHILDSTATUS {
         set status [lindex $::errorCode 2]
@@ -96,19 +99,34 @@
     # Open the test file and start reading lines
     set testFileId [ open $test r]
     set runline ""
+    set PRNUMS ""
     foreach line [split [read $testFileId] \n] {
 
-      #see if this is our run line
+      # if its the END. line then stop parsing (optimization for big files)
       if {[regexp {END.[ *]$} $line match endofscript]} {
         break
+
+      # if the line is continued, concatente and continue the loop
       } elseif {[regexp {RUN: *([^\\]+)(\\)$} $line match oneline suffix]} {
         set runline "$runline$oneline "
+
+      # if its a terminating RUN: line then do substitution on the whole line
+      # and then save the line.
       } elseif {[regexp {RUN: *([^&]+)(&&)?} $line match oneline suffix]} {
         set runline "$runline$oneline"
         set runline [ substitute $runline $test $tmpFile ]
         set lines($numLines) $runline
         set numLines [expr $numLines + 1]
         set runline ""
+
+      # if its an PR line, save the problem report number
+      } elseif {[regexp {PR([0-9]+)} $line match prnum]} {
+        if {$PRNUMS == ""} {
+          set PRNUMS $prnum
+        } else {
+          set PRNUMS "$PRNUMS,$prnum"
+        }
+      # if its an XFAIL line, see if we should be XFAILing or not.
       } elseif {[regexp {XFAIL:[ *](.+)} $line match targets]} {
         set targets
 
@@ -138,7 +156,7 @@
       for { set i 0 } { $i < $numLines } { set i [ expr $i + 1 ] } {
         regsub ^.*RUN:(.*) $lines($i) \1 theLine
         set theLine [subst $theLine ]
-        set resultmsg [execOneLine $test $outcome $i $theLine ]
+        set resultmsg [execOneLine $test $PRNUMS $outcome $i $theLine ]
         if { $resultmsg != "" } {
           if { $outcome == "XFAIL" } {
             xfail "$resultmsg"
@@ -150,10 +168,13 @@
         }
       }
       if { !$failed } {
+        if {$PRNUMS != ""} {
+          set PRNUMS " for $PRNUMS"
+        }
         if { $outcome == "XFAIL" } {
-          xpass "$test"
+          xpass "$test$PRNUMS"
         } else {
-          pass "$resultmsg"
+          pass "$test$PRNUMS"
         }
       }
     }






More information about the llvm-commits mailing list