- # 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