[llvm] r314915 - [test] Fix append_path in the empty case

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 10:30:28 PDT 2017


Author: fjricci
Date: Wed Oct  4 10:30:28 2017
New Revision: 314915

URL: http://llvm.org/viewvc/llvm-project?rev=314915&view=rev
Log:
[test] Fix append_path in the empty case

Summary:
normpath() was being called on an empty string and appended to
the environment variable in the case where the environment variable
was unset. This led to ":." being appended to the path, since
normpath() of an empty string is '.', presumably to represent cwd.

Reviewers: zturner, sqlbyme, modocache

Subscribers: llvm-commits

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

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

Modified: llvm/trunk/utils/lit/lit/llvm/config.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/llvm/config.py?rev=314915&r1=314914&r2=314915&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/llvm/config.py (original)
+++ llvm/trunk/utils/lit/lit/llvm/config.py Wed Oct  4 10:30:28 2017
@@ -107,9 +107,13 @@ class LLVMConfig(object):
             def norm(x):
                 return os.path.normcase(os.path.normpath(x))
 
-            current_paths = self.config.environment.get(variable, "")
-            current_paths = current_paths.split(os.path.pathsep)
-            paths = [norm(p) for p in current_paths]
+            current_paths = self.config.environment.get(variable, None)
+            if current_paths:
+                current_paths = current_paths.split(os.path.pathsep)
+                paths = [norm(p) for p in current_paths]
+            else:
+                paths = []
+
             # If we are passed a list [a b c], then iterating this list forwards
             # and adding each to the beginning would result in b c a.  So we
             # need to iterate in reverse to end up with the original ordering.




More information about the llvm-commits mailing list