[llvm] r330672 - Remove code that's almost always dead, and harmful if not.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 18:05:05 PDT 2018


Author: nico
Date: Mon Apr 23 18:05:04 2018
New Revision: 330672

URL: http://llvm.org/viewvc/llvm-project?rev=330672&view=rev
Log:
Remove code that's almost always dead, and harmful if not.

lit's util.which() would check if the passed-in path existed directly,
and if so return it as-is.  This is never the case when running llvm's, clang's,
or lld's tests normally.  But when running `./llvm-lit path/to/clang/test`
with a cwd of llvm-build/bin, this if would detect that clang exists at path
'clang' and return 'clang' as the discovered clang binary -- and then lit would
use the " clang " -> "*** Do not use 'clang' in tests, use '%clang'. ***"
substitution to replace that with a broken test.  By removing this early
return, lit ends up with the usual absolute path and everything works even
in this uncommon case.

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

Modified: llvm/trunk/utils/lit/lit/util.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/util.py?rev=330672&r1=330671&r2=330672&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/util.py (original)
+++ llvm/trunk/utils/lit/lit/util.py Mon Apr 23 18:05:04 2018
@@ -193,10 +193,6 @@ def which(command, paths=None):
     if paths is None:
         paths = os.environ.get('PATH', '')
 
-    # Check for absolute match first.
-    if os.path.isfile(command):
-        return os.path.normpath(command)
-
     # Would be nice if Python had a lib function for this.
     if not paths:
         paths = os.defpath




More information about the llvm-commits mailing list