[llvm] r309044 - [lit] Fix UnboundLocalError for invalid shtest redirects

Michal Gorny via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 15:38:31 PDT 2017


Author: mgorny
Date: Tue Jul 25 15:38:31 2017
New Revision: 309044

URL: http://llvm.org/viewvc/llvm-project?rev=309044&view=rev
Log:
[lit] Fix UnboundLocalError for invalid shtest redirects

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

Modified:
    llvm/trunk/utils/lit/lit/TestRunner.py

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=309044&r1=309043&r2=309044&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Tue Jul 25 15:38:31 2017
@@ -313,7 +313,7 @@ def processRedirects(cmd, stdin_source,
         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]




More information about the llvm-commits mailing list