llvm.org GIT mirror llvm / a007021
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314915 91177308-0d34-0410-b5e6-96231b3b80d8 Francis Ricci 2 years ago
1 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
106106 def norm(x):
107107 return os.path.normcase(os.path.normpath(x))
108108
109 current_paths = self.config.environment.get(variable, "")
110 current_paths = current_paths.split(os.path.pathsep)
111 paths = [norm(p) for p in current_paths]
109 current_paths = self.config.environment.get(variable, None)
110 if current_paths:
111 current_paths = current_paths.split(os.path.pathsep)
112 paths = [norm(p) for p in current_paths]
113 else:
114 paths = []
115
112116 # If we are passed a list [a b c], then iterating this list forwards
113117 # and adding each to the beginning would result in b c a. So we
114118 # need to iterate in reverse to end up with the original ordering.