]> granicus.if.org Git - llvm/commitdiff
[lit] Fix UnboundLocalError for invalid shtest redirects
authorMichal Gorny <mgorny@gentoo.org>
Tue, 25 Jul 2017 22:38:31 +0000 (22:38 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Tue, 25 Jul 2017 22:38:31 +0000 (22:38 +0000)
Replace the incorrect variable reference when invalid redirect is used.
This fixes the following issue:

  File "/usr/src/llvm/utils/lit/lit/TestRunner.py", line 316, in processRedirects
    raise InternalShellError(cmd, "Unsupported redirect: %r" % (r,))
UnboundLocalError: local variable 'r' referenced before assignment

which in turn broke shtest-shell.py and max-failures.py lit tests.

The breakage was introduced during refactoring in rL307310.

Differential Revision: https://reviews.llvm.org/D35857

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309044 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/TestRunner.py

index 46bcac4b306e29ef77ca944f1a10cb9e0a9c362a..a60a0f854870d81d62182ad8b55ab6f24ddc81b9 100644 (file)
@@ -313,7 +313,7 @@ def processRedirects(cmd, stdin_source, cmd_shenv, opened_files):
         elif op == ('<',):
             redirects[0] = [filename, 'r', None]
         else:
-            raise InternalShellError(cmd, "Unsupported redirect: %r" % (r,))
+            raise InternalShellError(cmd, "Unsupported redirect: %r" % ((op, filename),))
 
     # Open file descriptors in a second pass.
     std_fds = [None, None, None]