Test if the compiler supports Ada, and enable Ada tests if so. While I was
[oota-llvm.git] / test / lib / llvm-dg.exp
index 8363af7807badc0a54e1f6f1647ca9db0ffe6ef0..6f83800888d50e7432c396fe4cf119361fad19b1 100644 (file)
@@ -1,4 +1,9 @@
-proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcontext} {
+proc llvm-runtest { programs } { 
+    global srcroot objroot srcdir objdir subdir target_triplet prcontext 
+    global llvmgcc llvmgxx global llvmgcc_version llvmgccmajvers 
+    global gccpath gxxpath compile_c compile_cxx link shlibext llvmlibsdir
+
+    set timeout 60
 
     set path [file join $objdir $subdir]
     
@@ -14,7 +19,9 @@ proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcont
  
     foreach test $programs {
        
-       set timeout 40
+       #Should figure out best way to set the timeout
+       #set timeout 40
+       
        set filename [file tail $test]
        set output [file join Output $filename.out]
        set script $output.script
@@ -40,25 +47,32 @@ proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcont
                set runline
                set hasRunline 1
 
+                set new_runline $runline
+               #replace %prcontext with prcontext.tcl (Must replace before %p)
+               regsub -all {%prcontext} $new_runline $prcontext new_runline
+               #replace %llvmgcc with actual path to llvmgcc
+               regsub -all {%llvmgcc} $new_runline "$llvmgcc -emit-llvm" new_runline
+               #replace %llvmgxx with actual path to llvmg++
+               regsub -all {%llvmgxx} $new_runline "$llvmgxx -emit-llvm" new_runline
+               #replace %compile_c with C compilation command
+               regsub -all {%compile_c} $new_runline "$compile_c" new_runline
+               #replace %compile_cxx with C++ compilation command
+               regsub -all {%compile_cxx} $new_runline "$compile_cxx" new_runline
+               #replace %link with C++ link command
+               regsub -all {%link} $new_runline "$link" new_runline
+               #replace %shlibext with shared library extension
+               regsub -all {%shlibext} $new_runline "$shlibext" new_runline
+               #replace %llvmlibsdir with configure library directory
+               regsub -all {%llvmlibsdir} $new_runline "$llvmlibsdir" new_runline
+               #replace %p with path to source, 
+               regsub -all {%p} $new_runline [file join $srcdir $subdir] new_runline
                #replace %s with filename
-               regsub -all {%s} $runline $test new_runline
-
+               regsub -all {%s} $new_runline $test new_runline
                #replace %t with temp filenames
                regsub -all {%t} $new_runline [file join Output $tmpFile] new_runline
-
-               #replace %llvmgcc with actual path to llvmgcc
-               regsub -all {%llvmgcc} $new_runline $llvmgcc new_runline
-
-               #replace %llvmgxx with actual path to llvmg++
-               regsub -all {%llvmgxx} $new_runline $llvmgxx new_runline
-               
-               #replace %prcontext with prcontext.tcl (Goes away when we remove qmtest)
-               regsub -all {%prcontext} $new_runline $prcontext new_runline
-
                puts $scriptFileId $new_runline
            } elseif {[regexp {XFAIL:[ *](.+)} $line match targets]} {
                set targets
-               
 
                #split up target if more then 1 specified
                foreach target [split $targets ,] {
@@ -66,6 +80,10 @@ proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcont
                        set outcome XFAIL
                    } elseif { [regexp $target $target_triplet match] } {
                        set outcome XFAIL
+                   } elseif { [regexp {llvmgcc(([0-9]+)|([0-9]+[.][0-9]+))} $target match submatch submatch2]  } {
+               if { [regexp ^($submatch)$|^(($submatch)(\.)) $llvmgcc_version match] } {
+                         set outcome XFAIL
+                       }
                    }
                    
                }
@@ -82,7 +100,7 @@ proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcont
        } else {
 
            #run script and catch errors
-           set retval [ catch {exec /bin/sh $script >& $output} ]
+           set retval [ catch {exec /bin/sh $script >& $output} errmsg ]
            
            if { $retval == 1 } {
                #Get output
@@ -94,10 +112,10 @@ proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcont
                switch $outcome {
                    PASS {
                        file delete $output
-                       fail "$test: \n$result"
+                       fail "$test: \n$errmsg\n$result"
                    }
                    XFAIL {
-                       xfail "$test: \n$result"
+                       xfail "$test: \n$errmsg\n$result"
                    }
                    default {
                        file delete $output
@@ -116,5 +134,3 @@ proc llvm-runtest { programs objdir subdir target_triplet llvmgcc llvmgxx prcont
        }
     }
 }
-
-