From: Reid Spencer Date: Wed, 11 Apr 2007 17:56:23 +0000 (+0000) Subject: Update the way llvm2cpp tests are done: X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=0aac889d71f1800846ce0b1c828ba6755c6512f3;p=oota-llvm.git Update the way llvm2cpp tests are done: 1. Make sure bytecode/assembly inputs are always redirected stdin so that the module name is . 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35914 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/lib/llvm2cpp.exp b/test/lib/llvm2cpp.exp index ee1ddc1bb32..b4141acabd6 100644 --- a/test/lib/llvm2cpp.exp +++ b/test/lib/llvm2cpp.exp @@ -12,6 +12,7 @@ proc llvm2cpp-test { files } { 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 @@ proc llvm2cpp-test { files } { 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"