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

Reid Spencer reid at x10sys.com
Wed Apr 11 10:56:40 PDT 2007



Changes in directory llvm/test/lib:

llvm2cpp.exp updated: 1.6 -> 1.7
---
Log message:

Update the way llvm2cpp tests are done:
1. Make sure bytecode/assembly inputs are always redirected stdin so that
   the module name is <stdin>. This helps not get false negatives when the
   diff is done.
2. Scan the test file to determine if llvm-upgrade needs to be run.
3. Avoid running testings that are XFAIL'd because they'll cause a failure
   when run for llvm2cpp.
4. Get some better error message output.


---
Diffs of the changes:  (+39 -7)

 llvm2cpp.exp |   46 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 39 insertions(+), 7 deletions(-)


Index: llvm/test/lib/llvm2cpp.exp
diff -u llvm/test/lib/llvm2cpp.exp:1.6 llvm/test/lib/llvm2cpp.exp:1.7
--- llvm/test/lib/llvm2cpp.exp:1.6	Thu Jun  1 02:23:32 2006
+++ llvm/test/lib/llvm2cpp.exp	Wed Apr 11 12:56:23 2007
@@ -12,6 +12,7 @@
   set llvm2cpp [file join $llvmtoolsdir llvm2cpp ]
   set llvmas [file join $llvmtoolsdir llvm-as ]
   set llvmdis [file join $llvmtoolsdir llvm-dis ]
+  set llvmupgrade [ file join $llvmtoolsdir llvm-upgrade ]
 
   #Make Output Directory if it does not exist already
   if { [file exists path] } {
@@ -33,20 +34,51 @@
     set testname [file rootname $filename]
     set bytecode [file join Output $filename.bc]
 
-    # Note that the stderr for llvm-as must be redirected to /dev/null because
-    # otherwise exec will see the msgs and return 1 even though they are only 
-    # warnings. If real errors are generated on stderr then llvm-as will return
-    # a non-zero retval anyway so we're good.
+    # Note that the stderr for llvm-as, etc. must be redirected to /dev/null 
+    # because otherwise exec will see the msgs and return 1 even though they 
+    # are only warnings. If real errors are generated on stderr then llvm-as 
+    # will return a non-zero retval anyway so we're good.
+
+    # Scan the test file to see if there's an XFAIL file. If so, don't run it
+    set retval [ catch { 
+      exec -keepnewline grep XFAIL $test 2>/dev/null } msg ]
+    if { $retval == 0 } {
+      continue;
+    }
+
+    # Scan the test file to see if there's a line with "lvm-upgrade" in it. 
+    # If so, run llvm-upgrade first or else llvm-as will fail on it.
+    set retval [ catch { 
+      exec -keepnewline grep llvm-upgrade $test 2>/dev/null } msg ]
+
+    if { $retval == 0 } {
+      # In this case we must run llvm-upgrade before llvm-as
+      set pipeline llvm-upgrade|llvm-as|llvm-dis
+      set retval [ catch { 
+        exec -keepnewline $llvmupgrade < $test -o - | $llvmas | $llvmdis -f -o $assembly 2>/dev/null } msg ]
+    } else {
+      # llvm-upgrade not necessary, just llvm-as/llvm-dis
+      set pipeline llvm-as|llvm-dis
+      set retval [ catch { 
+        exec -keepnewline $llvmas < $test -o - | $llvmdis -f -o $assembly 2>/dev/null } msg ]
+    }
+
+    if { $retval != 0 } {
+      fail "$test: $pipeline returned $retval\n$msg"
+      continue 
+    }
+
+    # Build bytecode for llvm2cpp input
     set retval [ catch { 
-      exec -keepnewline $llvmas $test -o - | $llvmdis -f -o $assembly 2>/dev/null } msg ]
+      exec -keepnewline $llvmas < $assembly > $bytecode 2>/dev/null } msg ]
 
     if { $retval != 0 } {
-      fail "$test: llvm-as/llvm-dis returned $retval\n$msg"
+      fail "$test: llvm-as returned $retval\n$msg"
       continue 
     }
 
     set retval [ catch { 
-      exec -keepnewline $llvm2cpp -f -o $generated < $test 2>/dev/null } msg]
+      exec -keepnewline $llvm2cpp -f -o $generated < $bytecode 2>/dev/null } msg]
 
     if { $retval != 0 } {
       fail "$test: llvm2cpp returned $retval\n$msg"






More information about the llvm-commits mailing list