diff options
author | Francis Ricci <francisjricci@gmail.com> | 2017-10-04 17:30:28 +0000 |
---|---|---|
committer | Francis Ricci <francisjricci@gmail.com> | 2017-10-04 17:30:28 +0000 |
commit | 954b94f5dfc16b999e96e21d96f6a3d91a1c9adc (patch) | |
tree | 426e938ae7b79a6ad14306cb7cbf3040460a03f8 | |
parent | 6fb55716e9c77e716f4ac25abc84687eac29f848 (diff) | |
download | bcm5719-llvm-954b94f5dfc16b999e96e21d96f6a3d91a1c9adc.tar.gz bcm5719-llvm-954b94f5dfc16b999e96e21d96f6a3d91a1c9adc.zip |
[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
llvm-svn: 314915
-rw-r--r-- | llvm/utils/lit/lit/llvm/config.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py index c3bdef318d6..b1ad5876099 100644 --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -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. |